/* ============================================================
   SAMIUL HOSSAIN — editorial portfolio
   Single long scroll + isolated project detail overlay.
   Themeable: themes override the BASE tokens via JS; everything
   else is derived with color-mix. Default = Ember (dark).
   ============================================================ */

:root {
  /* ---- BASE THEME TOKENS (overridden per-theme by app.js) ----
     A theme sets: --bg, --bg-soft, --bg-elev, --ink, --ink-dim,
     --accent, --accent-2, --ok, plus --field-opacity & --mode.    */
  --bg:          #0c0a08;
  --bg-soft:     #131009;
  --bg-elev:     #161208;
  --ink:         #f0e6d2;
  --ink-dim:     #8a7f6a;
  --accent:      #e0a45c;
  --accent-2:    #c2622d;
  --ok:          #9bc08a;
  --field-opacity: 0.9;
  --mode: dark;                       /* dark | matte — drives field veil */

  /* ---- DERIVED TOKENS (computed from base via color-mix) ---- */
  --ink-2:       color-mix(in srgb, var(--ink) 78%, var(--bg));
  --ink-faint:   color-mix(in srgb, var(--ink-dim) 55%, var(--bg));
  --line:        color-mix(in srgb, var(--accent) 14%, transparent);
  --line-strong: color-mix(in srgb, var(--accent) 32%, transparent);
  --surface:     color-mix(in srgb, var(--ink) 6%, transparent);
  --surface-2:   color-mix(in srgb, var(--ink) 11%, transparent);
  --header-bg:   color-mix(in srgb, var(--bg) 78%, transparent);

  /* ---- NON-THEME TOKENS ---- */
  --serif: 'Fraunces', 'Times New Roman', serif;
  --sans:  'Inter', system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  /* aliases so legacy selectors keep working */
  --amber: var(--accent);
  --ember: var(--accent-2);
  --rust:  var(--accent-2);
  --sage:  var(--ok);

  --maxw: 1240px;
  --pad: clamp(20px, 5vw, 80px);
  --header-h: 68px;

  --ease: cubic-bezier(0.65, 0.05, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* smooth theme transitions */
  --theme-t: 0.5s;
}

/* theme transition: animate color/background changes site-wide */
html.theming,
html.theming body,
html.theming .header,
html.theming .field-veil,
html.theming .footer,
html.theming .detail {
  transition:
    background-color var(--theme-t) var(--ease),
    color var(--theme-t) var(--ease),
    border-color var(--theme-t) var(--ease);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: none; text-align: left; }
@media (pointer: coarse) { button { cursor: pointer; } }
ul { list-style: none; }
em { font-style: italic; }

.mono { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; }
.dim  { color: var(--ink-dim); }
.accent { color: var(--amber); font-style: italic; }
.ok   { color: var(--ok); }

/* ============================================================
   BACKGROUND FIELD + VEIL
   ============================================================ */
#field {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.field-veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, transparent 35%, color-mix(in srgb, var(--bg) 60%, transparent) 100%),
    radial-gradient(ellipse 70% 50% at 50% 110%, transparent 35%, color-mix(in srgb, var(--bg) 65%, transparent) 100%);
  /* matte themes: slightly stronger veil so text stays legible over the field */
  opacity: var(--veil-strength, 1);
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; }
.cursor__dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber); transform: translate(-50%, -50%);
}
.cursor__ring {
  position: absolute; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              border-color 0.3s, background 0.3s;
}
.cursor.is-hover .cursor__ring {
  width: 64px; height: 64px;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.cursor.is-down .cursor__ring { width: 28px; height: 28px; }
.cursor-label {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  padding: 4px 9px; border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 90%, transparent); border-radius: 2px;
  opacity: 0; transform: translate(-50%, 28px);
  transition: opacity 0.25s; white-space: nowrap;
}
.cursor-label.show { opacity: 1; }
@media (pointer: coarse) { .cursor, .cursor-label { display: none; } }

/* ============================================================
   PRELOADER
   ============================================================ */
.loader {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { width: min(320px, 70vw); }
.loader__count {
  font-size: 1rem; color: var(--ink); margin-bottom: 14px;
  display: flex; align-items: baseline; gap: 2px;
}
.loader__count #loader-num { font-size: 2.4rem; font-weight: 300; }
.loader__bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
#loader-fill {
  position: absolute; top: 0; left: 0; height: 100%; width: 0;
  background: var(--amber);
}
.loader__label { margin-top: 12px; }

/* ============================================================
   PAGE TRANSITION OVERLAY
   ============================================================ */
.transition {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  display: flex;
}
.transition__panel {
  flex: 1; background: var(--bg-elev);
  transform: scaleY(0); transform-origin: bottom;
  will-change: transform;
}

/* ============================================================
   HEADER — solid background, no blend-mode overlap bug
   ============================================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  padding: 0 var(--pad);
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--line);
  transition: transform 0.4s var(--ease-out);
}
.header.is-hidden { transform: translateY(-100%); }
.header__brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.02rem; font-weight: 500;
  letter-spacing: -0.01em; white-space: nowrap;
}
.brand-mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber);
  animation: brandPulse 3s ease-in-out infinite;
}
@keyframes brandPulse { 50% { opacity: 0.35; } }
.nav { display: flex; gap: clamp(16px, 2vw, 32px); }
.nav__link {
  font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.06em; text-transform: lowercase;
  color: var(--ink-2); transition: color 0.3s; position: relative;
  padding: 4px 0;
}
.nav__link::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--amber);
  transform: scaleX(0); transform-origin: right; transition: transform 0.4s var(--ease-out);
}
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav__link.is-active { color: var(--ink); }
.header__meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.7rem; color: var(--ink-dim); white-space: nowrap;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: brandPulse 2s infinite;
}

/* ============================================================
   PAGE / SECTION SHELL
   ============================================================ */
.page {
  position: relative; z-index: 2;
  padding-top: var(--header-h);
}
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(80px, 14vh, 160px) var(--pad);
  border-top: 1px solid var(--line);
}
.section:first-of-type { border-top: none; }
.section__head {
  display: flex; align-items: flex-start; gap: 24px;
  margin-bottom: clamp(40px, 6vh, 72px);
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.section__num { color: var(--amber); font-size: 0.82rem; padding-top: 6px; }
.section__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1; letter-spacing: -0.03em;
}
.section__sub { display: block; margin-top: 8px; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
  padding: clamp(40px, 8vh, 90px) var(--pad) 40px;
  display: flex; flex-direction: column; justify-content: center;
}
.hero__eyebrow {
  margin-bottom: 32px; color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: 12px;
  max-width: max-content;
}
.hero__eyebrow::before { content: ''; width: 32px; height: 1px; background: var(--amber); }
.hero__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.6rem, 8.5vw, 7.5rem);
  line-height: 0.98; letter-spacing: -0.035em;
  margin-bottom: 48px;
}
.hero__title .accent { color: var(--amber); }
.hero__lower {
  display: grid; grid-template-columns: 1.4fr auto;
  gap: 48px; align-items: end; margin-bottom: 64px;
}
.hero__lede {
  max-width: 540px; font-size: 1.12rem; line-height: 1.7;
  color: var(--ink-2); font-weight: 300;
}
.hero__lede em { color: var(--amber); font-style: italic; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; font-family: var(--mono); font-size: 0.76rem;
  letter-spacing: 0.05em; text-transform: lowercase;
  border: 1px solid var(--line-strong); border-radius: 2px;
  transition: all 0.4s var(--ease-out); white-space: nowrap;
}
.btn__arrow { transition: transform 0.4s var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--solid:hover { background: var(--amber); border-color: var(--amber); }
.btn--ghost:hover { border-color: var(--amber); color: var(--amber); }

/* marquee */
.hero__marquee {
  overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 14px 0; margin: 0 calc(-1 * var(--pad));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: inline-flex; gap: 28px; white-space: nowrap;
  animation: marquee 38s linear infinite;
  color: var(--ink-dim);
}
.marquee__track span:nth-child(2n) { color: var(--amber); opacity: 0.6; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============================================================
   WORK LIST
   ============================================================ */
.work-list { display: flex; flex-direction: column; }
.work-row {
  display: grid;
  grid-template-columns: 48px 1.3fr 1.4fr 32px;
  gap: 28px; align-items: center;
  padding: clamp(28px, 4vh, 44px) 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.5s var(--ease-out);
}
.work-row:first-child { border-top: 1px solid var(--line); }
.work-row:hover { padding-left: 18px; }
.work-row__num { color: var(--ink-faint); }
.work-row__body h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.5rem, 3.5vw, 2.4rem); letter-spacing: -0.02em;
  transition: color 0.4s; line-height: 1.1;
}
.work-row:hover .work-row__body h3 { color: var(--amber); }
.work-row__sub { display: block; margin-top: 8px; }
.work-row__desc { color: var(--ink-dim); font-size: 0.96rem; line-height: 1.5; }
.work-row__arrow {
  font-size: 1.5rem; color: var(--ink-faint);
  transition: all 0.4s var(--ease-out); justify-self: end;
}
.work-row:hover .work-row__arrow { transform: translateX(8px); color: var(--amber); }

/* ============================================================
   MANIFESTO
   ============================================================ */
.section--manifesto { padding-block: clamp(100px, 18vh, 180px); }
.manifesto__inner { max-width: 920px; }
.manifesto__quote {
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.8rem, 5vw, 3.4rem); line-height: 1.15;
  letter-spacing: -0.02em; margin: 20px 0 40px;
}
.manifesto__quote em { color: var(--amber); }
.manifesto__text {
  font-size: 1.1rem; line-height: 1.8; color: var(--ink-2); max-width: 680px;
  margin-bottom: 20px;
}
.manifesto__text:last-child { margin-bottom: 0; }
.manifesto__text strong { color: var(--ink); font-weight: 500; }

/* ============================================================
   APPROACH / STEPS
   ============================================================ */
.steps {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.step {
  background: var(--bg);
  padding: clamp(32px, 4vw, 48px);
  transition: background 0.4s;
}
.step:hover { background: var(--bg-soft); }
.step__num { color: var(--amber); display: block; margin-bottom: 20px; }
.step__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.step__head h3 {
  font-family: var(--serif); font-weight: 400; font-size: 1.6rem; letter-spacing: -0.02em;
}
.step__tag {
  padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 2px;
  color: var(--ink-dim); font-size: 0.66rem;
}
.step p { color: var(--ink-2); font-size: 1rem; line-height: 1.65; margin-bottom: 20px; }
.step__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.step__chips span {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 2px;
  color: var(--ink-dim); font-size: 0.66rem;
}

/* ============================================================
   CAPABILITIES
   ============================================================ */
.caps {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(28px, 4vw, 48px);
}
.cap {
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.cap__label { display: block; margin-bottom: 16px; }
.cap__items { display: flex; flex-wrap: wrap; gap: 10px; }
.cap__items span {
  font-family: var(--serif); font-size: 1.1rem; color: var(--ink);
  padding: 6px 0; transition: color 0.3s;
}
.cap__items span:hover { color: var(--amber); }

/* ============================================================
   WRITING — collapsible essays
   ============================================================ */
.essays { display: flex; flex-direction: column; }
.essay { border-bottom: 1px solid var(--line); }
.essay:first-child { border-top: 1px solid var(--line); }
.essay__head {
  display: grid;
  grid-template-columns: 70px 1fr auto 32px;
  gap: 24px; align-items: center;
  width: 100%;
  padding: clamp(24px, 3.5vh, 36px) 0;
  transition: padding 0.4s var(--ease-out);
}
.essay__head:hover { padding-left: 14px; }
.essay__num { color: var(--amber); }
.essay__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem); letter-spacing: -0.02em;
  transition: color 0.3s; line-height: 1.2;
}
.essay__head:hover .essay__title { color: var(--amber); }
.essay__status { text-align: right; color: var(--ink-faint); text-transform: uppercase; }
.essay__toggle {
  color: var(--ink-dim); font-size: 1.3rem; justify-self: end;
  transition: transform 0.4s var(--ease-out), color 0.3s;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.essay.is-open .essay__toggle { transform: rotate(45deg); color: var(--amber); }

.essay__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.55s var(--ease-out);
}
.essay.is-open .essay__body { grid-template-rows: 1fr; }
.essay__inner {
  overflow: hidden;
  max-width: 720px;
  padding: 0 0 clamp(28px, 4vh, 44px) 94px;
}
.essay.is-open .essay__inner { overflow: visible; }
.essay__inner p {
  color: var(--ink-2); font-size: 1.05rem; line-height: 1.8; margin-bottom: 20px;
}
.essay__inner p:last-child { margin-bottom: 0; }
.essay__inner strong { color: var(--ink); font-weight: 500; }
.essay__inner em { color: var(--amber); }

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: clamp(40px, 6vw, 80px); align-items: start;
}
.contact__lede {
  font-size: 1.15rem; line-height: 1.7; color: var(--ink-2);
  max-width: 520px; margin-bottom: 36px;
}
.contact__links { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.contact-link {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); backdrop-filter: blur(6px);
  transition: all 0.4s var(--ease-out);
}
.contact-link:hover { border-color: var(--amber); transform: translateY(-2px); }
.contact-link .mono { min-width: 64px; color: var(--ink-dim); }
.contact-link > span:nth-child(2) {
  flex: 1; font-family: var(--serif); font-size: 1.1rem; color: var(--ink);
}
.contact-link__arrow { color: var(--amber); transition: transform 0.4s; }
.contact-link:hover .contact-link__arrow { transform: translate(3px, -3px); }

.contact__card {
  background: var(--surface); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 3px; padding: 32px;
}
.contact__card-line {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.contact__card-line:last-child { border-bottom: none; }
.contact__card-line .dim { min-width: 56px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px var(--pad);
}
.footer__row {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ============================================================
   PROJECT DETAIL OVERLAY
   ============================================================ */
.detail {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden;
  visibility: hidden; opacity: 0;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.detail.is-open { visibility: visible; opacity: 1; }
.detail__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(var(--header-h) + 40px) var(--pad) 80px;
}

.project__back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.76rem; color: var(--ink-dim);
  margin-bottom: 60px; transition: color 0.3s;
}
.project__back:hover { color: var(--amber); }
.project__head { margin-bottom: 48px; padding-bottom: 48px; border-bottom: 1px solid var(--line); }
.project__meta { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.project__meta span {
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-dim);
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 2px;
}
.project__title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.6rem, 9vw, 7rem); line-height: 0.95; letter-spacing: -0.04em;
}
.project__tagline {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  color: var(--ink-2); margin-top: 24px; max-width: 760px; line-height: 1.35;
}
.project__hero {
  height: clamp(260px, 42vh, 440px); margin: 56px 0;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 3px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.project__hero-glyph {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(7rem, 20vw, 16rem); color: var(--ink-faint); opacity: 0.4;
}
.project__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  margin-bottom: 64px;
}
.fact { background: var(--bg); padding: 28px 24px; }
.fact .mono { color: var(--ink-dim); display: block; margin-bottom: 10px; }
.fact strong { font-family: var(--serif); font-weight: 400; font-size: 1.2rem; color: var(--ink); }
.fact em { color: var(--amber); }
.project__body {
  display: grid; grid-template-columns: 220px 1fr; gap: 60px;
  margin-bottom: 64px;
}
.project__body-nav { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
.project__body-nav .mono { color: var(--ink-dim); display: block; margin-bottom: 16px; }
.project__body-nav ul { display: flex; flex-direction: column; gap: 8px; }
.project__body-nav a {
  font-family: var(--serif); font-size: 1.02rem; color: var(--ink-2);
  transition: color 0.3s;
}
.project__body-nav a:hover { color: var(--amber); }
.project__prose h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.8rem;
  letter-spacing: -0.02em; margin: 40px 0 16px;
}
.project__prose h2:first-child { margin-top: 0; }
.project__prose p { color: var(--ink-2); font-size: 1.05rem; line-height: 1.8; margin-bottom: 18px; }
.project__prose strong { color: var(--ink); font-weight: 500; }
.project__prose code {
  font-family: var(--mono); font-size: 0.9em; color: var(--amber);
  background: color-mix(in srgb, var(--accent) 8%, transparent); padding: 1px 6px; border-radius: 2px;
}
.project__stack { margin-bottom: 56px; }
.project__stack h3 {
  font-family: var(--mono); font-size: 0.74rem; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 20px;
}
.stack-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.stack-grid span {
  padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 2px;
  font-family: var(--mono); font-size: 0.76rem; color: var(--ink);
  transition: all 0.3s;
}
.stack-grid span:hover { border-color: var(--amber); color: var(--amber); }
.project__gallery {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 72px;
}
.gallery-tile {
  aspect-ratio: 4 / 3; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 2px; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-style: italic; color: var(--ink-faint);
  transition: all 0.4s var(--ease-out); position: relative;
}
.gallery-tile:hover { border-color: var(--line-strong); color: var(--amber); }
.gallery-tile::before {
  content: attr(data-label); position: absolute; bottom: 12px; left: 14px;
  font-family: var(--mono); font-style: normal; font-size: 0.62rem; color: var(--ink-dim);
}
.project__next {
  border-top: 1px solid var(--line); padding-top: 40px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
}
.project__next .label { display: block; margin-bottom: 6px; }
.project__next a.next-link {
  font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 400;
  color: var(--ink); transition: color 0.3s; display: inline-flex; align-items: center; gap: 14px;
}
.project__next a.next-link:hover { color: var(--amber); }

/* ============================================================
   REVEAL / ANIMATION UTILITIES
   ============================================================ */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }

/* split-anim words start hidden, JS animates them in */
.split-anim { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .split-anim { opacity: 1 !important; transform: none !important; transition: none !important; }
  .marquee__track, .brand-mark, .status-dot { animation: none !important; }
}

/* ============================================================
   RESPONSIVE — scales gracefully down to phone
   ============================================================ */
@media (max-width: 980px) {
  .work-row { grid-template-columns: 40px 1fr 28px; }
  .work-row__desc { display: none; }
  .hero__lower { grid-template-columns: 1fr; gap: 32px; }
  .steps { grid-template-columns: 1fr; }
  .caps { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .project__body { grid-template-columns: 1fr; gap: 32px; }
  .project__body-nav { position: static; }
  .essay__head { grid-template-columns: 60px 1fr 28px; }
  .essay__status { display: none; }
  .essay__inner { padding-left: 0; }
}
@media (max-width: 680px) {
  :root { --pad: 18px; --header-h: 60px; }
  .nav { gap: 12px; }
  .nav__link { font-size: 0.66rem; }
  .header__meta #clock, .header__meta .status-dot { display: none; }
  .header__brand .brand-text { display: none; }
  .section__head { flex-direction: column; gap: 8px; }
  .section__num { padding-top: 0; }
  .project__gallery { grid-template-columns: 1fr; }
  .contact-link { padding: 18px; gap: 12px; }
  .contact-link > span:nth-child(2) { font-size: 0.95rem; }
  .theme-toggle__name { display: none; }
}
@media (max-width: 420px) {
  .nav__link { font-size: 0.6rem; }
  .nav { gap: 8px; }
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 250;
  height: 2px; width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: width 0.1s linear;
}

/* ============================================================
   THEME TOGGLE (in header)
   ============================================================ */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 2px;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: var(--ink-2); transition: all 0.3s var(--ease-out);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle__swatch {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--accent); border: 1px solid var(--line-strong);
  flex-shrink: 0;
}
.theme-toggle__name { white-space: nowrap; }

/* ============================================================
   STATS BAND
   ============================================================ */
.stats-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.stats-band__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(36px, 6vh, 64px) var(--pad);
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(20px, 4vw, 48px);
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat__num {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1;
  color: var(--accent); letter-spacing: -0.03em;
}
.stat__plus, .stat__suffix {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.6rem, 3vw, 2.4rem); color: var(--accent);
  display: inline-block;
}
.stat__label { font-size: 0.72rem; line-height: 1.4; }

/* ============================================================
   PRINCIPLES — horizontal scroll pin
   ============================================================ */
.principles {
  position: relative;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.principles__intro {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(48px, 8vh, 90px) var(--pad) 0;
  display: flex; justify-content: space-between; align-items: baseline;
}
.principles__hint { letter-spacing: 0.1em; text-transform: uppercase; }
.principles__viewport {
  /* height is set by JS to create the pin scroll length */
  position: relative;
}
.principles__track {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; align-items: center;
  padding: 0 var(--pad);
  gap: clamp(20px, 4vw, 48px);
  will-change: transform;
}
.principle {
  flex: 0 0 clamp(280px, 38vw, 460px);
  height: clamp(320px, 60vh, 480px);
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(4px);
  padding: clamp(32px, 4vw, 48px);
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 16px;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s, background 0.4s;
}
.principle:hover { border-color: var(--accent); }
.principle::before {
  content: ''; position: absolute; top: 0; left: 0; height: 100%; width: 2px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform 0.6s var(--ease-out);
}
.principle:hover::before { transform: scaleY(1); }
.principle__num { color: var(--accent); font-size: 0.78rem; }
.principle__title {
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem); line-height: 1.05; letter-spacing: -0.02em;
  color: var(--ink);
}
.principle__text { color: var(--ink-2); font-size: 1rem; line-height: 1.6; }
.principle--end { border-style: dashed; }

/* horizontal-pin mobile fallback: stack vertically, no pin */
@media (max-width: 768px) {
  .principles__viewport { height: auto !important; }
  .principles__track {
    position: static; height: auto;
    flex-direction: column; padding-block: clamp(32px, 6vh, 56px);
    transform: none !important;
  }
  .principle { flex: 0 0 auto; width: 100%; height: auto; min-height: 200px; }
  .principles__hint { display: none; }
}

/* ============================================================
   THEME MODAL
   ============================================================ */
.theme-modal {
  position: fixed; inset: 0; z-index: 8000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--pad);
  visibility: hidden; opacity: 0;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.theme-modal.is-open { visibility: visible; opacity: 1; }
.theme-modal__backdrop {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
}
.theme-modal__panel {
  position: relative; z-index: 1;
  width: min(820px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong); border-radius: 4px;
  padding: clamp(24px, 4vw, 40px);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.4s var(--ease-out);
}
.theme-modal.is-open .theme-modal__panel { transform: none; }
.theme-modal__head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.theme-modal__title {
  font-family: var(--serif); font-weight: 400; font-size: 1.6rem;
  letter-spacing: -0.02em; margin-right: auto;
}
.theme-modal__tabs { display: flex; gap: 4px; }
.theme-tab {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 0.66rem; letter-spacing: 0.04em; color: var(--ink-dim);
  transition: all 0.3s;
}
.theme-tab:hover { border-color: var(--accent); color: var(--ink); }
.theme-tab.is-active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.theme-modal__close {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 0.9rem; color: var(--ink-dim); transition: all 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.theme-modal__close:hover { border-color: var(--accent); color: var(--accent); }
.theme-modal__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.theme-swatch {
  position: relative; cursor: none;
  border: 1px solid var(--line); border-radius: 3px;
  overflow: hidden; text-align: left; padding: 0;
  transition: transform 0.3s var(--ease-out), border-color 0.3s;
}
@media (pointer: coarse) { .theme-swatch { cursor: pointer; } }
.theme-swatch:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.theme-swatch.is-active { border-color: var(--accent); }
.theme-swatch.is-active::after {
  content: '✓'; position: absolute; top: 8px; right: 10px;
  font-size: 0.8rem; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.theme-swatch__colors {
  height: 72px; display: flex;
}
.theme-swatch__colors span { flex: 1; }
.theme-swatch__meta {
  padding: 10px 12px; border-top: 1px solid var(--line);
}
.theme-swatch__name { display: block; font-family: var(--serif); font-size: 0.95rem; color: var(--ink); }
.theme-swatch__kind { display: block; font-family: var(--mono); font-size: 0.6rem; color: var(--ink-dim); margin-top: 2px; }
.theme-modal__note { padding-top: 16px; border-top: 1px solid var(--line); }

/* ============================================================
   PREMIUM SCROLL ANIMATION HOOKS
   ============================================================ */
/* parallax targets — JS sets transforms via ScrollTrigger scrub */
.hero { will-change: transform; }
.manifesto__quote { will-change: opacity, transform; }

/* when premium motion is off (reduced motion), keep content visible */
@media (prefers-reduced-motion: reduce) {
  .principles__track { transform: none !important; }
}

