/* ============================================================
   Global styles + page chrome
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; background: var(--dark-grey); }

body {
  font-family: "Plus Jakarta Sans", "Google Sans", "Roboto Flex", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  color: var(--white);
  background: transparent;                /* let .page-bg show through; html holds the dark fallback */
  min-height: 100vh;
  overflow-x: hidden;
  cursor: none;                           /* custom magnetic cursor */
}
@media (hover: none), (pointer: coarse) {
  body { cursor: auto; }
}

button, a { cursor: none; }
@media (hover: none), (pointer: coarse) { button, a { cursor: pointer; } }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--white); color: var(--dark-grey); }

/* ----------------------------------------------------------
   Page background — cross-fading layered stack.
   Container has bg-{state} class; matching layer fades to opacity 1.
   ---------------------------------------------------------- */
.page-bg {
  position: fixed; inset: 0;
  z-index: -2;
  pointer-events: none;
}

.bg-layer {
  position: absolute; inset: 0;
  opacity: 0;
  will-change: opacity;
  transition: opacity calc(0.7s * var(--t-mult, 1)) ease-in-out;
}

.layer-portfolio-base { background: radial-gradient(122.37% 136.03% at 0% 0%, var(--mood-grad-a, #223282) 0%, var(--mood-grad-b, #152055) 100%); }
.layer-portfolio      { background: radial-gradient(103.51% 114.1%  at 0% 0%, #292932 42.58%, #1C1C20 100%); }
.layer-detail         { background: radial-gradient(103.51% 114.1%  at 0% 0%, #292932 42.58%, #1C1C20 100%); }
.layer-about          { background: var(--white); }

.page-bg.bg-base      .layer-portfolio-base { opacity: 1; }
.page-bg.bg-portfolio .layer-portfolio      { opacity: 1; }
.page-bg.bg-detail    .layer-detail         { opacity: 1; }
.page-bg.bg-about     .layer-about          { opacity: 1; }

/* ----------------------------------------------------------
   Layout primitives
   ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.divider-line {
  width: 120px; height: 1px;
  background: currentColor; opacity: 0.3;
  margin-top: 40px;
margin-bottom: 40px;
}

/* Borders between sections */
.section-rule-top    { border-top:    1px solid var(--border-subtle-on-dark); }
.section-rule-bottom { border-bottom: 1px solid var(--border-subtle-on-dark); }
.theme-light .section-rule-top    { border-top-color:    var(--border-subtle-on-light); }
.theme-light .section-rule-bottom { border-bottom-color: var(--border-subtle-on-light); }

/* ----------------------------------------------------------
   Type scale (px values from Figma)
   ---------------------------------------------------------- */
.t-h1-display { font-size: 48px; line-height: 58px; font-weight: 700; letter-spacing: -0.01em; }
.t-h1         { font-size: 40px; line-height: 48px; font-weight: 700; letter-spacing: -0.005em; }
.t-h2         { font-size: 40px; line-height: 38px; font-weight: 700; }
.t-h3         { font-size: 32px; line-height: 38px; font-weight: 500; }
.t-h4         { font-size: 24px; line-height: 28px; font-weight: 300; }
.t-body-lg    { font-size: 18px; line-height: 28px; font-weight: 300; }
.t-body       { font-size: 20px; line-height: 1.6; font-weight: 400; }
.t-body-sm    { font-size: 18px; line-height: 1.6; font-weight: 400; }
.t-caption    { font-size: 14px; line-height: 1.6; font-weight: 400; }
.t-mono       { font-family: "JetBrains Mono", ui-monospace, "SF Mono", monospace; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; }
.t-mono-lg    { font-family: "JetBrains Mono", ui-monospace, "SF Mono", monospace; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }

/* Emphasis inside Light copy = Bold */
.t-h4 strong, .t-body-lg strong { font-weight: 700; }

@media (max-width: 1024px) {
  .t-h1-display { font-size: 52px; line-height: 64px; }
  .t-h1         { font-size: 40px; line-height: 52px; }
  .t-h2         { font-size: 36px; line-height: 48px; }
  .t-h3         { font-size: 28px; line-height: 38px; }
  .t-h4, .t-body-lg { font-size: 22px; line-height: 32px; }
}
@media (max-width: 640px) {
  .t-h1-display { font-size: 40px; line-height: 48px; }
  .t-h1         { font-size: 30px; line-height: 38px; }
  .t-h2         { font-size: 26px; line-height: 34px; }
  .t-h3         { font-size: 22px; line-height: 30px; }
  .t-h4, .t-body-lg { font-size: 19px; line-height: 28px; }
  .t-body       { font-size: 18px; line-height: 28px; }
  .t-body-sm    { font-size: 16px; line-height: 24px; }
}
@media (max-width: 420px) {
  .t-h1-display { font-size: 33px; line-height: 40px; }
  .t-h1         { font-size: 27px; line-height: 34px; }
  .t-h2         { font-size: 23px; line-height: 31px; }
}

/* Theme override for light pages (About me) */
.theme-light { color: var(--dark-grey); }
.theme-light ::selection { background: var(--dark-grey); color: var(--white); }

/* ----------------------------------------------------------
   Header
   ---------------------------------------------------------- */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--bleed-pad);
  z-index: 50;
  pointer-events: auto;
  background: transparent;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 300ms ease-in-out, backdrop-filter 300ms ease-in-out, -webkit-backdrop-filter 300ms ease-in-out;
}
.header.is-scrolled {
  background: rgba(255, 255, 255, 0.01);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.header__brand { font-size: 18px; font-weight: 400; }
.header__nav { display: flex; align-items: center; gap: 40px; }
.nav-link {
  font-size: 18px; font-weight: 400;
  opacity: var(--opacity-inactive);
  transition: opacity 220ms var(--ease-out-expo), font-weight 200ms, transform 280ms var(--ease-out-expo);
  position: relative;
}
.nav-link:hover { opacity: 1; }
.nav-link.is-active { opacity: 1; font-weight: 600; }
/*
.nav-link.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px;
  height: 2px; background: currentColor;
} */

.linkedin-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  transition: background 220ms var(--ease-out-expo);
}
.linkedin-btn:hover { background: rgba(255,255,255,0.10); }
.theme-light .linkedin-btn:hover { background: rgba(41,41,50,0.08); }

/* Hamburger trigger — hidden on desktop */
.header__burger {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: 0; color: inherit;
  border-radius: 8px;
  transition: background 220ms var(--ease-out-expo);
}
.header__burger:hover { background: rgba(255,255,255,0.10); }
.theme-light .header__burger:hover { background: rgba(41,41,50,0.08); }

/* Tablet: tighten nav, scale chrome */
@media (max-width: 1024px) {
  .header__nav { gap: 28px; }
  .nav-link, .header__brand { font-size: 16px; }
}

/* Mobile: brand + hamburger clustered on the right, links → drawer */
@media (max-width: 768px) {
  .header { justify-content: flex-end; gap: 18px; }
  .header__nav { display: none; }
  .header__burger { display: inline-flex; }
  .header__brand { font-size: 16px; }
}

/* ----------------------------------------------------------
   Mobile navigation drawer (slides in from the right)
   ---------------------------------------------------------- */
.nav-drawer {
  position: fixed; inset: 0;
  z-index: 60;
  visibility: hidden;
  pointer-events: none;
}
.nav-drawer.is-open { visibility: visible; pointer-events: auto; }

.nav-drawer__backdrop {
  position: absolute; inset: 0;
  border: 0; padding: 0;
  background: rgba(10, 14, 19, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity calc(360ms * var(--t-mult, 1)) var(--ease-out-expo);
}
.nav-drawer.is-open .nav-drawer__backdrop { opacity: 1; }

.nav-drawer__panel {
  position: absolute; top: 0; right: 0;
  height: 100%;
  width: min(82vw, 340px);
  background: var(--dark-grey);
  color: var(--white);
  display: flex; flex-direction: column;
  padding: 24px;
  transform: translateX(100%);
  transition: transform calc(460ms * var(--t-mult, 1)) var(--ease-out-expo);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.38);
}
.nav-drawer.is-open .nav-drawer__panel { transform: translateX(0); }
.theme-light .nav-drawer__panel { background: var(--white); color: var(--dark-grey); }

.nav-drawer__top {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
  margin: -24px -24px 12px;
  padding: 0 16px 0 24px;
}
.nav-drawer__brand { font-size: 16px; }
.nav-drawer__close {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: inherit;
  border-radius: 8px;
  transition: background 220ms var(--ease-out-expo);
}
.nav-drawer__close:hover { background: rgba(255,255,255,0.10); }
.theme-light .nav-drawer__close:hover { background: rgba(41,41,50,0.08); }

.nav-drawer__links { display: flex; flex-direction: column; margin-top: 8px; }
.nav-drawer__link {
  font-size: 26px; font-weight: 500; line-height: 1;
  padding: 16px 0;
  opacity: var(--opacity-inactive);
  transition: opacity 220ms var(--ease-out-expo);
}
.nav-drawer__link:hover { opacity: 1; }
.nav-drawer__link.is-active { opacity: 1; font-weight: 700; }

.nav-drawer__linkedin {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 16px; opacity: 0.85;
  padding: 12px 0;
  transition: opacity 220ms var(--ease-out-expo);
}
.nav-drawer__linkedin:hover { opacity: 1; }

/* ----------------------------------------------------------
   Footer
   ---------------------------------------------------------- */
.footer {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--bleed-pad);
}
.footer__left { display: flex; align-items: center; gap: 40px; }
.footer__copy { font-size: 14px; }
@media (max-width: 640px) {
  .footer { height: auto; padding-block: 24px; flex-direction: column; gap: 24px; align-items: flex-start; }
  .footer__left { gap: 16px; flex-wrap: wrap; }
}

/* ----------------------------------------------------------
   Button
   ---------------------------------------------------------- */
.btn {
  height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  padding: 0 32px;
  border-radius: var(--radius-button);
  border: 0; background: transparent; color: inherit;
  font-family: inherit; font-size: 16px; font-weight: 400;
  position: relative;
  transition: background 280ms var(--ease-out-expo),
              color 280ms var(--ease-out-expo),
              border-color 280ms var(--ease-out-expo),
              transform 380ms var(--ease-out-expo),
              letter-spacing 280ms var(--ease-out-expo);
  white-space: nowrap;
  line-height: 0;
}
.btn .btn__icon { display: inline-flex; width: 24px; height: 24px; transform: rotate(0deg); transition: transform 0.5s ease-in-out; }
.btn:hover .btn__icon { transform: rotate(360deg); }

.btn--primary {
  background: var(--white); color: var(--dark-grey);
}
.btn--primary:hover { background: #ffffff; }

.theme-light .btn--primary {
  background: var(--dark-grey); color: var(--white);
}
.theme-light .btn--primary:hover { background: #000000; }

.btn--secondary {
  border: 1px solid var(--white); color: var(--white);
}
.btn--secondary:hover { background: var(--white); color: var(--dark-grey); }
.theme-light .btn--secondary { border-color: var(--dark-grey); color: var(--dark-grey); }
.theme-light .btn--secondary:hover { background: var(--primary-blue); color: var(--white); border-color: var(--primary-blue);}

.btn--text {
  padding-inline: 8px;
  color: var(--white);
}
.theme-light .btn--text { color: var(--dark-grey); }

.btn--text .__om-t {
  position:relative;
}

.btn--text .__om-t::after {
  content: ""; position: absolute; left: 0px; right: 0px; bottom: -6px;
  height: 1px; background: currentColor; opacity: 0;
  transform: scaleX(0.4); transform-origin: left;
  transition: opacity 280ms, transform 360ms var(--ease-out-expo);
}
.btn--text:hover .__om-t::after { opacity: 1; transform: scaleX(1); }

/* Icon rotation on hover (text & footer buttons) */
.btn--text .btn__icon { transition: transform 0.5s ease-in-out; }
.btn--text:hover .btn__icon { transform: rotate(360deg); }

/* Proportional button scaling (design-standard touch targets ≥ 44px) */
@media (max-width: 1024px) {
  .btn { height: 56px; font-size: 18px; padding: 0 34px; gap: 14px; }
  .btn .btn__icon { width: 22px; height: 22px; }
}
@media (max-width: 640px) {
  .btn { height: 50px; font-size: 16px; padding: 0 26px; gap: 12px; }
  .btn .btn__icon { width: 20px; height: 20px; }
}

/* Footer button (smaller) — matches .btn--text underline + icon rotation behavior */
.fbtn {
  position: relative;
  height: 44px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius-button);
  font-size: 14px;
  background: transparent;
  color: inherit;
  border: 0;
  transition: color 220ms;
}
.fbtn .fbtn__icon { display: inline-flex; transform: rotate(0deg); transition: transform 0.5s ease-in-out; }
.fbtn .__om-t {
  position: relative;
}
.fbtn .__om-t::after {
  content: ""; position: absolute; left: 0px; right: 0px; bottom: -6px;
  height: 1px; background: currentColor; opacity: 0;
  transform: scaleX(0.4); transform-origin: left;
  transition: opacity 280ms, transform 360ms var(--ease-out-expo);
}
.fbtn:hover .__om-t::after { opacity: 1; transform: scaleX(1); }
.fbtn:hover .fbtn__icon { transform: rotate(360deg); }
/* ----------------------------------------------------------
   Tag (CV/skills chip)
   ---------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center;
  height: 25px; padding: 0 8px;
  border-radius: var(--radius-tag);
  background: rgba(10,14,19,0.04);
  border: 1px solid rgba(10,14,19,0.06);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; color: var(--blueish-gray);
  white-space: nowrap;
}

/* ----------------------------------------------------------
   Page container + transitions
   ---------------------------------------------------------- */
main {
  padding-top: var(--header-h);
  min-height: 100vh;
  position: relative;
}
/* Three-phase route transition:
   1. .is-leaving  → existing content fades to 0 over 360ms (LEAVE_MS in app.jsx)
   2. (route + bg swap; wrap is remounted with key=route)
      .is-entering is on at mount → opacity stays at 0 while bg layers cross-fade (~700ms)
   3. .is-entering is removed → default transition (460ms) fades the new content to 1.
*/
.page { opacity: 1; transform: none; }
.page-wrap { opacity: 0; transition: opacity calc(460ms * var(--t-mult, 1)) ease-in-out; }
.page-wrap.is-entering { opacity: 1; transition: opacity calc(460ms * var(--t-mult, 1)) ease-in-out; }

/* ----------------------------------------------------------
   Scroll reveal — opt-in. Default is visible. JS adds
   .reveal--pending only to elements BELOW the viewport at mount,
   then removes it on intersection. Above-the-fold content never
   depends on a transition tick to be visible.
   ---------------------------------------------------------- */
.reveal { opacity: 1; transform: none; transition: opacity calc(760ms * var(--t-mult, 1)) var(--ease-out-expo), transform calc(760ms * var(--t-mult, 1)) var(--ease-out-expo); transition-delay: var(--reveal-delay, 0ms); }
.reveal.reveal--pending { opacity: 0; transform: translateY(28px); }

@media (max-width: 1024px) {
  
  .skills-grid .reveal:first-child { padding-inline: 0px; }
  .about-grid .reveal:nth-child(2) .about-col__label { padding-inline: 40px; }
}

@media (max-width: 900px) { .about-grid .reveal:first-child { padding-inline: 40px; } }

/* ----------------------------------------------------------
   Magnetic cursor
   ---------------------------------------------------------- */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: currentColor;
  color: var(--white);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 260ms var(--ease-out-expo),
              height 260ms var(--ease-out-expo),
              background 220ms,
              opacity 220ms,
              border-radius 240ms;
  mix-blend-mode: difference;
}
.cursor.is-hover {
  width: 56px; height: 56px;
  background: transparent;
  border: 1px solid currentColor;
  mix-blend-mode: difference;
}
.cursor.is-text  {
  width: 2px; height: 22px;
  border-radius: 1px;
  mix-blend-mode: difference;
}
.cursor.is-click { width: 36px; height: 36px; }
.theme-light .cursor { color: var(--dark-grey); }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
  body, a, button { cursor: auto !important; }
  .page, .reveal { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--white); color: var(--dark-grey);
  padding: 12px 16px; z-index: 100; border-radius: 8px;
}
.skip-link:focus { left: 16px; top: 16px; }

/* Focus styles */
:focus-visible { outline: 2px solid var(--white); outline-offset: 4px; border-radius: 4px; }
.theme-light :focus-visible { outline-color: var(--dark-grey); }
