/* =============================================
   Stella Jun · Portfolio
   Cinematic black aesthetic + liquid glass
   ============================================= */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
img, video, svg { display: block; max-width: 100%; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ---------- TOKENS ---------- */
:root {
  --bg: #0a0a0a;
  --bg-soft: #131313;
  --ink: #f1ede4;       /* warm off-white */
  --ink-dim: #8c877d;
  --ink-faint: #3a3833;
  --accent: #c9a86a;    /* warm amber */
  --accent-cool: #6a8bc9;
  --line: rgba(241, 237, 228, 0.12);

  --f-display: "Fraunces", "Times New Roman", serif;
  --f-body: "Inter", -apple-system, "Helvetica Neue", "PingFang SC", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-pad: clamp(5rem, 12vh, 9rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.76, 0, 0.24, 1);

  /* card gradients — overridden per theme */
  --card-bg: linear-gradient(180deg, #131211 0%, #0c0b0a 100%);
  --orb-warm: rgba(201, 168, 106, 0.55);
  --orb-cool: rgba(106, 139, 201, 0.45);
  --orb-opacity: 0.32;
  --grain-opacity: 0.06;
  --grain-blend: overlay;
  --rim-color: 255, 255, 255;  /* RGB triplet used in .lg/.lg-strong rim gradient */

  /* body text alphas — adapt per theme so rgba(...) doesn't lock to one mode */
  --ink-soft: rgba(241, 237, 228, 0.86);   /* body paragraphs */
  --ink-mute: rgba(241, 237, 228, 0.72);   /* secondary copy */
  --body-weight: 300;

  /* Hero massive title gradient stops */
  --massive-1: rgba(241, 237, 228, 0.45);
  --massive-2: rgba(241, 237, 228, 0.95);
}

/* ===== LIGHT THEME ===== */
:root[data-theme="light"] {
  --bg: #f1ede4;             /* warm cream */
  --bg-soft: #e8e3d5;
  --ink: #15130f;             /* warm near-black, slightly darker for solid look */
  --ink-dim: #4a463d;         /* darker — was #6b6660, now passes WCAG easily */
  --ink-faint: #847c6e;       /* darker — was #c8c2b3 */
  --accent: #7a5a1f;          /* deeper amber for contrast on cream */
  --accent-cool: #234478;
  --line: rgba(21, 19, 15, 0.16);

  --card-bg: linear-gradient(180deg, #f5f1e6 0%, #ebe6d5 100%);
  --orb-warm: rgba(201, 168, 106, 0.32);
  --orb-cool: rgba(106, 139, 201, 0.18);
  --orb-opacity: 0.55;
  --grain-opacity: 0.05;
  --grain-blend: multiply;
  --rim-color: 21, 19, 15;

  --ink-soft: rgba(21, 19, 15, 0.86);
  --ink-mute: rgba(21, 19, 15, 0.66);
  --body-weight: 400;         /* serif needs more weight on cream */

  --massive-1: rgba(21, 19, 15, 0.35);
  --massive-2: rgba(21, 19, 15, 0.92);
}

/* ---------- BASE ---------- */
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: var(--body-weight);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  cursor: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.5s ease;
}
em { font-style: italic; color: var(--accent); font-weight: 400; }
strong { font-weight: 500; color: var(--ink); }

/* ---------- LIQUID GLASS ---------- */
/* Two variants: subtle (.lg) for chips/nav and stronger (.lg-strong) for CTAs/cards */
.lg, .lg-strong {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.012);
  background-blend-mode: luminosity;
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.10);
  -webkit-backdrop-filter: blur(8px) saturate(125%);
          backdrop-filter: blur(8px) saturate(125%);
}
.lg-strong {
  background: rgba(255, 255, 255, 0.018);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(36px) saturate(150%);
          backdrop-filter: blur(36px) saturate(150%);
}
/* Refractive highlight rim — top + bottom of element catch the light */
.lg::before, .lg-strong::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(180deg,
    rgba(var(--rim-color), 0.42) 0%,
    rgba(var(--rim-color), 0.14) 22%,
    rgba(var(--rim-color), 0)    44%,
    rgba(var(--rim-color), 0)    56%,
    rgba(var(--rim-color), 0.14) 78%,
    rgba(var(--rim-color), 0.42) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.lg-strong::before {
  background: linear-gradient(180deg,
    rgba(var(--rim-color), 0.55) 0%,
    rgba(var(--rim-color), 0.18) 22%,
    rgba(var(--rim-color), 0)    44%,
    rgba(var(--rim-color), 0)    56%,
    rgba(var(--rim-color), 0.18) 78%,
    rgba(var(--rim-color), 0.55) 100%);
}

/* ---------- GRAIN OVERLAY ---------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  animation: grainShift 0.8s steps(4) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, 1%); }
  50%  { transform: translate(1%, -1%); }
  75%  { transform: translate(-1%, 2%); }
  100% { transform: translate(2%, -2%); }
}

/* Soft color blobs behind hero — give liquid-glass something to blur on a black canvas */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-orbs::before, .bg-orbs::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: var(--orb-opacity);
  transition: opacity 0.5s ease;
}
.bg-orbs::before {
  width: 55vw; height: 55vw;
  top: -18%; left: -8%;
  background: radial-gradient(circle, var(--orb-warm), transparent 65%);
}
.bg-orbs::after {
  width: 45vw; height: 45vw;
  bottom: 8%; right: -10%;
  background: radial-gradient(circle, var(--orb-cool), transparent 65%);
}

/* ---------- CURSOR ---------- */
/* Color is always white. mix-blend-mode: difference inverts it against the
   underlying pixels — guaranteed high contrast in both themes:
     white ⊕ dark-bg  ≈ white  (visible on black)
     white ⊕ light-bg ≈ near-black (visible on cream) */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 32px; height: 32px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--ease-out), height 0.4s var(--ease-out),
              border-color 0.3s, background 0.3s;
  mix-blend-mode: difference;
}
.cursor-dot {
  position: fixed; top: 0; left: 0;
  width: 5px; height: 5px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor.is-hover {
  width: 64px; height: 64px;
  background: rgba(255, 255, 255, 0.12);
}
@media (hover: none) { .cursor, .cursor-dot { display: none; } body { cursor: auto; } }

/* ---------- PRELOADER ---------- */
.preloader {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--gutter);
}
.preloader-inner {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex: 1;
}
.preloader-label {
  display: flex; flex-direction: column; gap: 0.25rem;
  font-family: var(--f-mono); font-size: 0.7rem;
  color: var(--ink-dim); letter-spacing: 0.2em;
}
.preloader-count {
  font-family: var(--f-display);
  font-size: clamp(4rem, 14vw, 12rem);
  line-height: 0.9;
  font-weight: 300;
  display: flex; align-items: flex-end;
}
.preloader-count span:last-child { font-size: 0.35em; margin-bottom: 0.5em; color: var(--ink-dim); }
.preloader-bar {
  height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: left;
}

/* ---------- NAV ---------- */
.nav {
  position: fixed; top: 1rem; left: 0; right: 0;
  z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--gutter);
  opacity: 0;
  gap: 1rem;
}
.nav-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 999px;
  font-family: var(--f-display); font-size: 1.25rem; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.nav-logo .dot { color: var(--accent); margin: 0 0.1em; }
.nav-menu {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-radius: 999px;
}
.nav-menu a {
  position: relative;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-family: var(--f-mono); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink);
  transition: background 0.3s, color 0.3s;
}
.nav-menu a:hover { background: rgba(255, 255, 255, 0.06); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.7rem 1.1rem 0.7rem 1.25rem;
  border-radius: 999px;
  font-family: var(--f-mono); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink);
}
.nav-cta .arrow { transition: transform 0.4s var(--ease-out); }
.nav-cta:hover .arrow { transform: translate(3px, -3px); }

.nav-right {
  display: flex; align-items: center; gap: 0.6rem;
}

/* Theme toggle button — circular glass, sun/moon icons */
.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.012);
  color: var(--ink);
  cursor: none;
  position: relative;
  overflow: hidden;
}
.theme-toggle svg {
  width: 18px; height: 18px;
  position: absolute;
  transition: transform 0.5s var(--ease-out), opacity 0.4s ease;
}
.theme-toggle .icon-sun  { opacity: 1;  transform: rotate(0) scale(1); }
.theme-toggle .icon-moon { opacity: 0;  transform: rotate(-90deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle:hover { background: rgba(127, 127, 127, 0.08); }

@media (max-width: 720px) {
  .nav-menu { display: none; }
  .theme-toggle { width: 38px; height: 38px; }
}

/* ---------- HERO — massive title + centered orb portrait ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--gutter) * 2.5) var(--gutter) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  z-index: 1;
}

/* Top mono labels — unchanged */
.hero-meta {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 0.72rem;
  color: var(--ink-dim); letter-spacing: 0.15em; text-transform: uppercase;
}

/* Stage — massive title and portrait stacked in same grid cell */
.hero-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  place-items: center;
  position: relative;
}
.hero-stage > * { grid-area: 1 / 1; }

/* Massive italic title — gradient text, fills width, sits behind portrait */
.hero-massive {
  font-family: var(--f-display);
  font-weight: 800;
  font-style: italic;
  text-align: center;
  text-transform: uppercase;
  line-height: 0.86;
  letter-spacing: -0.045em;
  width: 100%;
  z-index: 1;
  background: linear-gradient(180deg, var(--massive-1) 0%, var(--massive-2) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  user-select: none;
}
.hero-massive .m-line-1 {
  display: block;
  font-size: clamp(0.85rem, 1.6vw, 1.4rem);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 0.4em;
  color: var(--ink-dim);
  -webkit-text-fill-color: var(--ink-dim);
}
.hero-massive .m-line-2 {
  display: block;
  font-size: clamp(3.5rem, 16vw, 16rem);
  white-space: nowrap;
}

/* Portrait — central orb with monogram, sits on top of title */
.hero-portrait {
  z-index: 2;
  width: clamp(180px, 26vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: none;
  will-change: transform;
}
.portrait-orb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.55) 0%, transparent 38%),
    radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.55) 0%, transparent 55%),
    linear-gradient(140deg, var(--accent) 0%, #3a2410 100%);
  box-shadow:
    inset -22px -32px 70px rgba(0, 0, 0, 0.5),
    inset 18px 18px 30px rgba(255, 255, 255, 0.18),
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    0 12px 30px -8px rgba(201, 168, 106, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.portrait-orb::before {
  content: "";
  position: absolute;
  top: 8%; left: 14%;
  width: 60%; height: 30%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.55), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
}
.portrait-orb .monogram {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.6rem, 5.5vw, 4.8rem);
  color: #f7f1e3;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.25);
  letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 0.12em;
  position: relative; z-index: 1;
}
.portrait-orb .monogram i {
  font-style: normal;
  color: rgba(247, 241, 227, 0.5);
  font-size: 0.7em;
  margin-bottom: 0.2em;
}

/* When the orb has a real image (Stella's 3D portrait), drop the gradient bg
   and gloss overlay — the image already brings its own lighting from generation. */
.portrait-orb.has-image {
  background: #0a0a0a;
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    0 12px 30px -8px rgba(201, 168, 106, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.portrait-orb.has-image::before { display: none; }
.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: inherit;
}
.portrait-caption {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
}

/* Bottom row: live badge + tagline on left, CTA pill on right */
.hero-bottom-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: end;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.hero-bottom-left {
  display: flex; flex-direction: column;
  gap: 0.9rem;
  max-width: 42ch;
}
.hero-live-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-family: var(--f-mono); font-size: 0.66rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink);
  align-self: flex-start;
}
.hero-live-badge .badge-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.hero-tagline {
  font-family: var(--f-display);
  font-size: clamp(0.95rem, 1.4vw, 1.25rem);
  font-weight: var(--body-weight);
  line-height: 1.45;
  color: var(--ink);
}
.hero-cta-pill {
  display: inline-flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.85rem 0.7rem 1.4rem;
  border-radius: 999px;
  font-family: var(--f-mono); font-size: 0.75rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.hero-cta-pill .cta-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.95rem;
  transition: transform 0.45s var(--ease-out);
}
.hero-cta-pill:hover .cta-dot { transform: rotate(45deg) scale(1.06); }

@media (max-width: 720px) {
  .hero-bottom-bar { grid-template-columns: 1fr; gap: 1.2rem; }
  .hero-portrait { width: clamp(150px, 40vw, 220px); }
  .hero-massive .m-line-1 { font-size: 0.78rem; letter-spacing: 0.2em; }
  .portrait-caption { font-size: 0.55rem; }
  .hero-cta-pill { align-self: flex-start; }
}

/* ---------- SECTIONS ---------- */
.section {
  position: relative;
  padding: var(--section-pad) var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--bg);
  z-index: 2;
}
.section-meta {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--f-mono); font-size: 0.72rem;
  color: var(--ink-dim); letter-spacing: 0.2em; text-transform: uppercase;
  margin-bottom: clamp(3rem, 7vh, 6rem);
}
.section-meta-line {
  flex: 1; max-width: 220px;
  height: 1px; background: var(--line);
}
.section-title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 4rem;
}
.section-title .line { display: block; overflow: hidden; padding-bottom: 0.05em; }
.section-title .line-italic { font-style: italic; font-weight: 400; padding-left: 0.4em; }

/* ---------- ABOUT ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.about-body {
  display: flex; flex-direction: column; gap: 1.5rem;
  max-width: 52ch;
  font-size: clamp(1rem, 1.15vw, 1.15rem);
  line-height: 1.7;
}
.about-body p { color: var(--ink-soft); }
.skills {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1.5rem;
}
.skills li {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--f-mono); font-size: 0.7rem;
  letter-spacing: 0.08em; color: var(--ink-dim);
  text-transform: uppercase;
  transition: border-color 0.3s, color 0.3s;
}
.skills li:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 880px) {
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* Character-level scroll reveal */
.char-reveal { display: inline; }
.char-reveal .char {
  display: inline-block;
  opacity: 0.16;
  transform: translateY(0);
  transition: opacity 0.18s linear;
  white-space: pre;
}

/* ---------- WORK · STICKY STACK ---------- */
.work-stack {
  position: relative;
}
.stack-card {
  position: sticky;
  top: clamp(2rem, 8vh, 6rem);
  min-height: 72vh;
  margin-bottom: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card-bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.5rem;
  transform-origin: center top;
  will-change: transform;
  transition: background 0.5s ease;
}
.stack-card .card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  font-family: var(--f-mono); font-size: 0.72rem;
  color: var(--ink-dim); letter-spacing: 0.15em; text-transform: uppercase;
}
.stack-card .card-num {
  font-family: var(--f-display); font-style: italic;
  font-size: 1rem; color: var(--accent);
  letter-spacing: 0;
}
.stack-card .card-media {
  position: relative;
  border-radius: 16px;
  min-height: 280px;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
}
.stack-card .card-media .media-tag {
  font-family: var(--f-mono); font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.7); letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 999px;
}
.stack-card[data-stack="01"] .card-media { background: linear-gradient(135deg, #c9a86a 0%, #6b4f23 100%); }
.stack-card[data-stack="02"] .card-media { background: linear-gradient(135deg, #6a8bc9 0%, #2b3f63 100%); }
.stack-card[data-stack="03"] .card-media {
  /* cc desktop pet — warm peach pixel-art vibe */
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #e8a583 0%, #6b3d2a 100%);
}
.stack-card[data-stack="04"] .card-media { background: linear-gradient(135deg, #8bc96a 0%, #3a5e26 100%); }
.stack-card[data-stack="05"] .card-media {
  /* moment-tracker — dusky purple for "time" feel */
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 12px),
    linear-gradient(135deg, #8b6ac9 0%, #2c2147 100%);
}

.stack-card .card-foot {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: end;
}
.stack-card .card-name {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.stack-card .card-name em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.stack-card .card-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-mute);
  max-width: 38ch;
}
.stack-card .card-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.35rem 0 0.4rem;
  font-family: var(--f-mono); font-size: 0.68rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
  width: fit-content;
  transition: color 0.3s, border-color 0.3s;
  cursor: none;
}
.stack-card .card-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.stack-card .card-link .arrow {
  display: inline-block;
  transition: transform 0.35s var(--ease-out);
}
.stack-card .card-link:hover .arrow { transform: translate(3px, -3px); }
@media (max-width: 720px) {
  .stack-card { min-height: 70vh; padding: 1.25rem; gap: 1rem; }
  .stack-card .card-foot { grid-template-columns: 1fr; gap: 1rem; }
  .stack-card .card-media { min-height: 200px; }
}

/* ---------- PROCESS MARQUEE ---------- */
.process-marquee {
  position: relative;
  padding: clamp(4rem, 10vh, 7rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
  z-index: 2;
}
.process-marquee .pm-label {
  position: absolute;
  top: 1.5rem;
  left: var(--gutter);
  font-family: var(--f-mono); font-size: 0.7rem;
  color: var(--ink-dim); letter-spacing: 0.2em; text-transform: uppercase;
}
.process-marquee .pm-label-right {
  left: auto; right: var(--gutter);
}
.pm-row {
  display: flex;
  gap: 1rem;
  will-change: transform;
  padding: 0 1rem;
}
.pm-row + .pm-row { margin-top: 1rem; }
.pm-tile {
  flex: 0 0 auto;
  width: clamp(220px, 24vw, 340px);
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  padding: 1.1rem;
  display: flex; flex-direction: column; justify-content: space-between;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  position: relative;
}
.pm-tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.pm-tile .pm-tag {
  position: relative; z-index: 1;
  font-family: var(--f-mono); font-size: 0.62rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.pm-tile .pm-name {
  position: relative; z-index: 1;
  font-family: var(--f-display); font-style: italic;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  letter-spacing: -0.01em; line-height: 1.05;
}
.pm-tile.c1 { background: linear-gradient(135deg, #c9a86a 0%, #8b6a3a 100%); }
.pm-tile.c2 { background: linear-gradient(135deg, #6a8bc9 0%, #3a5a8b 100%); }
.pm-tile.c3 { background: linear-gradient(135deg, #c96a8b 0%, #8b3a5a 100%); }
.pm-tile.c4 { background: linear-gradient(135deg, #8bc96a 0%, #5a8b3a 100%); }
.pm-tile.c5 {
  background:
    radial-gradient(circle at 30% 20%, rgba(127, 127, 127, 0.08), transparent 60%),
    var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
}
.pm-tile.c5 .pm-tag { color: var(--ink-dim); }
.pm-tile.c5::after { display: none; }

/* ---------- EXPERIENCE ---------- */
.timeline {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
}
.timeline-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 3rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--line);
}
.time-year {
  font-family: var(--f-mono); font-size: 0.78rem;
  color: var(--ink-dim); letter-spacing: 0.12em;
  padding-top: 0.4rem;
}
.time-body h4 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.time-body p {
  font-size: 0.95rem;
  color: var(--ink-mute);
  max-width: 56ch;
}
@media (max-width: 720px) {
  .timeline-item { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* ---------- CONTACT ---------- */
.contact-title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(3rem, 11vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin-bottom: 4rem;
}
.contact-title .line { display: block; overflow: hidden; padding-bottom: 0.05em; }
.contact-title .line-italic { font-style: italic; padding-left: 0.4em; color: var(--accent); }

.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 4rem;
  align-items: end;
  margin-bottom: 5rem;
}
.contact-email {
  display: inline-flex; align-items: center; gap: 1rem;
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 2.5vw, 2rem);
  font-style: italic;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.3s, color 0.3s;
}
.contact-email .arrow {
  font-style: normal;
  transition: transform 0.5s var(--ease-out);
}
.contact-email:hover { color: var(--accent); border-color: var(--accent); }
.contact-email:hover .arrow { transform: translate(6px, -4px); }

.contact-socials {
  display: flex; flex-direction: column; gap: 0.6rem;
}
.contact-socials a {
  display: inline-block;
  font-family: var(--f-mono); font-size: 0.82rem;
  color: var(--ink-dim); letter-spacing: 0.1em;
  padding: 0.3rem 0;
  transition: color 0.3s, transform 0.4s var(--ease-out);
}
.contact-socials a:hover { color: var(--ink); transform: translateX(8px); }
@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* marquee on contact (CSS-only, keeps things lively at the end) */
.contact-marquee {
  margin-top: 4rem;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 2rem 0;
}
.marquee-track {
  display: flex; white-space: nowrap;
  font-family: var(--f-display);
  font-size: clamp(2rem, 6vw, 5rem);
  font-style: italic;
  font-weight: 300;
  color: var(--ink);
  animation: marquee 25s linear infinite;
}
.marquee-track span { padding-right: 1rem; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-25%); }
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 2rem var(--gutter);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 2;
  background: var(--bg);
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 0.72rem;
  color: var(--ink-dim); letter-spacing: 0.1em;
}
.footer-inner em { color: var(--accent); font-style: italic; }
@media (max-width: 720px) {
  .footer-inner { flex-direction: column; gap: 0.6rem; text-align: center; }
}

/* ---------- MOBILE REFINEMENTS ---------- */
/* ≤720px : phones + small tablets — most layout already collapses here; this
   block tightens spacing, compacts the nav CTA, and fixes wrap issues that
   only show up on narrow viewports. */
@media (max-width: 720px) {
  :root {
    --gutter: 1.1rem;
    --section-pad: 3.5rem;
  }

  /* Compact nav — turn the "Say Hi" CTA into an icon-only round button */
  .nav { gap: 0.5rem; }
  .nav-cta {
    padding: 0;
    width: 42px; height: 42px;
    justify-content: center;
    gap: 0;
  }
  .nav-cta span:not(.arrow) {
    /* hide "Say Hi" label, keep only the arrow icon */
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
  }
  .nav-cta .arrow { font-size: 1rem; }
  .nav-logo { width: 42px; height: 42px; }

  /* Hero meta — let the two labels stack if needed */
  .hero-meta {
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.62rem;
  }

  /* Hero badge — let it wrap onto two lines instead of overflowing */
  .hero-badge {
    flex-wrap: wrap;
    font-size: 0.6rem;
    padding: 0.4rem 0.7rem;
    line-height: 1.2;
  }
  .hero-badge .badge-pill { font-size: 0.55rem; padding: 0.15rem 0.45rem; }

  /* Hero bottom is already 1-col here; reduce gap */
  .hero-bottom { gap: 1.2rem; padding-top: 1.5rem; }
  .hero-tag { font-size: 0.62rem; }
  .scroll-cue { font-size: 0.58rem; align-self: flex-start; }

  /* Section meta — wrap & smaller */
  .section-meta {
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.62rem;
    margin-bottom: 2.5rem;
  }
  .section-meta-line { max-width: 80px; }

  /* Stack card — head wraps, meta text smaller */
  .stack-card .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.6rem;
  }
  .stack-card .card-num { font-size: 0.85rem; }
  .stack-card .card-desc { font-size: 0.88rem; }

  /* Timeline year smaller */
  .time-year { font-size: 0.68rem; }
  .time-body h4 { font-size: 1.15rem; }

  /* Process marquee — hide the right-side hint label to avoid overlap */
  .process-marquee .pm-label-right { display: none; }
  .process-marquee .pm-label { font-size: 0.6rem; top: 1rem; }
  .pm-tile { width: 200px; padding: 0.85rem; }
  .pm-tile .pm-name { font-size: 1.05rem; }

  /* Contact email smaller, socials denser */
  .contact-email { font-size: 1.2rem; gap: 0.6rem; }
  .contact-socials a { font-size: 0.75rem; }
  .contact-marquee { padding: 1.2rem 0; margin-top: 2.5rem; }

  /* Footer mono labels smaller */
  .footer-inner { font-size: 0.65rem; }
}

/* ≤480px : iPhone SE / older Android — squeeze further */
@media (max-width: 480px) {
  :root {
    --gutter: 0.85rem;
    --section-pad: 3rem;
  }
  .hero { padding-top: calc(var(--gutter) * 4); }
  .hero-title { line-height: 0.92; }
  .stack-card { min-height: 62vh; padding: 1rem; gap: 0.85rem; border-radius: 18px; }
  .stack-card .card-media { min-height: 160px; padding: 1rem; }
  .stack-card .card-name { font-size: 1.7rem; }
  .pm-tile { width: 180px; aspect-ratio: 5 / 4; }
}

/* ---------- ACCESSIBILITY ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .char-reveal .char { opacity: 1 !important; }
}
