/* ==========================================================================
   nyteshift — 21st Polish Round
   One idea: a light crosses matter. It opens the page, passes over the work,
   and turns the world from carbon to paper. Everything else serves that.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("vendor/font/SpaceGrotesk-wght.ttf") format("truetype-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ── tokens ──────────────────────────────────────────────────────────── */
:root {
  /* approved identity palette — do not alter */
  --carbon: #171918;
  --paper: #F2EEE4;
  --sodium: #FFB35C;
  --field: #7C8478;

  /* derived, contrast-checked against their own ground (see NOTES.md) */
  --c-ink-1: #F2EEE4;   /* 15.25:1 on carbon */
  --c-ink-2: #B5B2AB;   /*  8.36:1 */
  --c-ink-3: #9F9D96;   /*  6.51:1 */
  --c-ink-4: #898882;   /*  4.96:1 — the quiet tone, still body-legible */
  --c-rule:  #2B2D2B;
  --c-rule-2:#3E3F3D;

  --p-ink-1: #171918;   /* 15.25:1 on paper */
  --p-ink-2: #50504D;   /*  6.95:1 */
  --p-ink-3: #6A6A66;   /*  4.69:1 */
  --p-rule:  #DCD8CE;
  --p-rule-2:#C6C3BB;
  --p-sheet: #F7F4EC;
  --burnt:   #7F5E37;   /*  5.07:1 on paper — sodium taken to a readable ink */

  /* type */
  --f: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-display: clamp(2.15rem, 4.42vw, 3.85rem);
  --t-say:     clamp(1.9rem, 3.7vw, 3.15rem);
  --t-h2:      clamp(1.55rem, 2.6vw, 2.25rem);
  --t-proj:    clamp(1.45rem, 2.15vw, 2rem);
  --t-lead:    clamp(1.0625rem, 1.18vw, 1.25rem);
  --t-body:    clamp(1rem, 1.02vw, 1.0625rem);
  --t-small:   0.8125rem;
  --t-label:   0.6875rem;

  /* space */
  --gut: clamp(1.4rem, 5vw, 4.5rem);
  --shell: 1180px;
  --sec: clamp(6rem, 6vw + 3vh, 12rem);
  --nav-h: 74px;

  /* motion */
  --e-out: cubic-bezier(.16, 1, .3, 1);
  --e-io: cubic-bezier(.6, 0, .2, 1);
  --d-fast: .22s;
  --d-mid: .42s;
  --d-slow: .8s;
}

/* ── world scopes ────────────────────────────────────────────────────── */
.world--carbon {
  --ink-1: var(--c-ink-1); --ink-2: var(--c-ink-2); --ink-3: var(--c-ink-3);
  --ink-4: var(--c-ink-4); --rule: var(--c-rule); --rule-2: var(--c-rule-2);
  --ground: var(--carbon); --accent: var(--sodium);
  color: var(--ink-1);
}
.world--paper {
  --ink-1: var(--p-ink-1); --ink-2: var(--p-ink-2); --ink-3: var(--p-ink-3);
  --ink-4: var(--p-ink-3); --rule: var(--p-rule); --rule-2: var(--p-rule-2);
  --ground: var(--paper); --accent: var(--burnt);
  color: var(--ink-1);
  background: var(--paper);
}

/* ── base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:target, section[id], main[id] { scroll-margin-top: calc(var(--nav-h) + clamp(1rem, 4vh, 2.5rem)); }
/* No CSS smooth-scroll: it also animates programmatic scrolls, which corrupts
   ScrollTrigger's measure-at-zero refresh. Anchors are eased in JS instead. */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--carbon);
  color: var(--c-ink-1);
  font-family: var(--f);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.028em; line-height: 1.06; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

::selection { background: var(--sodium); color: var(--carbon); }
.world--paper ::selection { background: var(--carbon); color: var(--paper); }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--sodium) 42%, transparent);
}

html { scrollbar-color: #3A3C3A var(--carbon); scrollbar-width: thin; }
html.at-paper { scrollbar-color: var(--p-rule-2) var(--paper); }
html.at-paper body { background: var(--paper); }

.u-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; top: 10px; left: 10px; z-index: 60;
  transform: translateY(-160%);
  background: var(--paper); color: var(--carbon);
  padding: 10px 16px; border-radius: 4px; font-size: var(--t-small); font-weight: 500;
  transition: transform var(--d-fast) var(--e-out);
}
.skip:focus-visible { transform: none; }

.shell {
  width: 100%; max-width: var(--shell);
  margin-inline: auto; padding-inline: var(--gut);
}

/* ── the light ───────────────────────────────────────────────────────── */
#horizon {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.world { position: relative; z-index: 2; }

/* ── navigation ──────────────────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: var(--nav-h);
  display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem);
  padding-inline: var(--gut);
  color: var(--c-ink-1);
  transition: color var(--d-mid) var(--e-io), background-color var(--d-mid) var(--e-io);
}
.nav::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 1px;
  background: currentColor; opacity: 0;
  transform: scaleX(.4); transform-origin: 0 50%;
  transition: opacity var(--d-mid) var(--e-io), transform 1.1s var(--e-out);
}
.nav.is-stuck::after { opacity: .14; transform: none; }
.nav.is-stuck { background: color-mix(in srgb, var(--carbon) 72%, transparent); backdrop-filter: blur(14px) saturate(1.1); }
.nav.is-paper { color: var(--p-ink-1); }
.nav.is-paper.is-stuck { background: color-mix(in srgb, var(--paper) 76%, transparent); }

.nav__mark { position: relative; display: block; margin-right: auto; line-height: 0; }
.nav__lock {
  width: clamp(126px, 11vw, 146px); height: auto;
  transition: opacity var(--d-mid) var(--e-io);
}
.nav__lock--day { position: absolute; inset: 0; opacity: 0; }
.nav.is-paper .nav__lock--night { opacity: 0; }
.nav.is-paper .nav__lock--day { opacity: 1; }
.nav__links { display: flex; gap: clamp(1.1rem, 2.4vw, 2.1rem); }
.nav__links a, .nav__cta { font-size: var(--t-small); letter-spacing: .005em; }
.nav__links a { color: color-mix(in srgb, currentColor 74%, transparent); position: relative; padding-block: 6px; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform .5s var(--e-out);
}
.nav__links a:hover { color: currentColor; }
.nav__links a:hover::after, .nav__links a:focus-visible::after { transform: none; transform-origin: 0 50%; }
.nav__links a.is-here { color: currentColor; }
.nav__links a.is-here::after { transform: none; background: var(--sodium); }
.nav.is-paper .nav__links a.is-here::after { background: var(--burnt); }

.nav__cta {
  border: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  border-radius: 999px; padding: .55rem 1.1rem; white-space: nowrap;
  transition: border-color var(--d-mid) var(--e-io), background-color var(--d-mid) var(--e-io), color var(--d-mid) var(--e-io);
}
.nav__cta:hover { border-color: var(--sodium); background: var(--sodium); color: var(--carbon); }
.nav.is-paper .nav__cta:hover { background: var(--carbon); border-color: var(--carbon); color: var(--paper); }

.nav__toggle { display: none; width: 44px; height: 44px; place-items: center; margin-right: -10px; }
.nav__toggle-bars { display: block; width: 22px; }
.nav__toggle-bars i {
  display: block; height: 1.5px; background: currentColor; border-radius: 2px;
  transition: transform .4s var(--e-out), opacity .3s;
}
.nav__toggle-bars i:first-child { margin-bottom: 6px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars i:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars i:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.sheet {
  position: fixed; inset: 0; z-index: 29; background: var(--carbon);
  display: grid; align-content: center; padding: var(--nav-h) var(--gut) 0;
  opacity: 0; transition: opacity .34s var(--e-io);
}
.sheet.is-open { opacity: 1; }
.sheet__inner { display: flex; flex-direction: column; gap: .35rem; }
.sheet__inner a {
  font-size: clamp(2rem, 9vw, 2.75rem); font-weight: 500; letter-spacing: -0.03em;
  color: var(--c-ink-1); padding: .5rem 0;
  opacity: 0; transform: translateY(14px);
  transition: opacity .5s var(--e-out), transform .5s var(--e-out);
}
.sheet.is-open .sheet__inner a { opacity: 1; transform: none; }
.sheet.is-open .sheet__inner a:nth-child(1) { transition-delay: .06s; }
.sheet.is-open .sheet__inner a:nth-child(2) { transition-delay: .11s; }
.sheet.is-open .sheet__inner a:nth-child(3) { transition-delay: .16s; }
.sheet.is-open .sheet__inner a:nth-child(4) { transition-delay: .21s; }
.sheet__cta { color: var(--sodium) !important; margin-top: 1.5rem; }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .7rem;
  font-size: var(--t-small); font-weight: 500; letter-spacing: .005em;
  padding: .95rem 1.45rem; border-radius: 999px; white-space: nowrap;
  position: relative; overflow: hidden; isolation: isolate;
  transition: color .4s var(--e-io), border-color .4s var(--e-io), transform .5s var(--e-out);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--sodium);
  transform: translateY(101%); transition: transform .52s var(--e-out);
}
.btn--primary { background: var(--paper); color: var(--carbon); }
.world--paper .btn--primary { background: var(--carbon); color: var(--paper); }
.btn--primary:hover, .btn--primary:focus-visible { color: var(--carbon); }
.btn--primary:hover::before, .btn--primary:focus-visible::before { transform: none; }
.btn--quiet { border: 1px solid color-mix(in srgb, currentColor 24%, transparent); color: var(--ink-2); }
.btn--quiet:hover, .btn--quiet:focus-visible { color: var(--ink-1); border-color: color-mix(in srgb, currentColor 55%, transparent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.linkish {
  color: inherit; text-decoration: underline; text-underline-offset: .22em;
  text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  cursor: pointer;
}
.linkish:hover { text-decoration-color: currentColor; }

/* ── 1. opening ──────────────────────────────────────────────────────── */
.hero {
  min-height: 100svh;
  display: grid; align-content: center;
  padding-block: calc(var(--nav-h) + 12vh) 14vh;
}
.hero__line {
  font-size: var(--t-display);
  line-height: 1.055;
  letter-spacing: -0.034em;
  max-width: 100%;
  text-wrap: initial;      /* the three breaks below are authored, not balanced */
}
.hero__line .w { display: inline-block; will-change: opacity, filter, transform; }
.hero__foot {
  margin-top: clamp(3.5rem, 8vh, 6.5rem);
  display: grid; gap: clamp(2rem, 4vw, 3rem);
  align-items: end;
}
.hero__body {
  font-size: var(--t-lead); line-height: 1.58; color: var(--ink-2);
  max-width: 46ch;
}
.hero__acts { display: flex; flex-wrap: wrap; gap: .8rem; }
@media (min-width: 940px) {
  .hero__foot { grid-template-columns: minmax(0, 1fr) auto; gap: clamp(2rem, 5vw, 5rem); }
  .hero__acts { justify-content: flex-end; }
}
.hero__scroll {
  position: absolute; left: var(--gut); bottom: 2.2rem;
  display: flex; align-items: center; gap: .8rem;
  font-size: var(--t-label); letter-spacing: .18em; text-transform: uppercase;
  color: var(--c-ink-3);
  mix-blend-mode: normal;
}
.hero__scroll::after {
  content: ""; width: 46px; height: 1px; background: currentColor;
  transform-origin: 0 50%; animation: draw 3.4s var(--e-io) infinite;
}
@keyframes draw {
  0%, 100% { transform: scaleX(.25); opacity: .5; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* ── 2. strip ────────────────────────────────────────────────────────── */
.strip {
  border-block: 1px solid var(--c-rule);
  overflow: hidden; padding-block: 1.55rem;
  --ink-4: var(--c-ink-4);
}
.strip__track { display: flex; width: max-content; will-change: transform; }
.strip__block { display: flex; align-items: center; flex: none; }
.strip__block span {
  font-size: var(--t-small); letter-spacing: .17em; text-transform: uppercase;
  color: var(--c-ink-3); padding-inline: clamp(1.4rem, 3vw, 2.6rem);
  white-space: nowrap;
}
.strip__block i { width: 4px; height: 4px; border-radius: 50%; background: var(--sodium); flex: none; opacity: .85; }

/* ── section heads ───────────────────────────────────────────────────── */
.sechead {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 2rem;
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}
.sechead h2 {
  font-size: var(--t-label); font-weight: 500; letter-spacing: .19em;
  text-transform: uppercase; color: var(--ink-3);
}
.sechead__note { font-size: var(--t-small); color: var(--ink-4); }

/* ── 3. work ─────────────────────────────────────────────────────────── */
.work { padding-block: var(--sec); }
.proj { margin-bottom: clamp(5.5rem, 11vh, 8.5rem); }
.proj:last-child { margin-bottom: 0; }

.still { margin: 0 auto; width: 100%; }
.still__frame {
  position: relative; overflow: hidden; border-radius: 3px;
  background: #0F1111;
  box-shadow: 0 34px 70px -46px rgba(0, 0, 0, .9);
  outline: 1px solid rgba(242, 238, 228, .08);
  outline-offset: -1px;
}
.still__frame img { width: 100%; will-change: transform; }
.still__sheen {
  position: absolute; inset: -12% -35%;
  background: linear-gradient(100deg,
    transparent 45%,
    color-mix(in srgb, var(--sodium) 17%, transparent) 50%,
    transparent 55%);
  mix-blend-mode: screen;
  transform: translateX(-100%); pointer-events: none; opacity: 0;
}

.proj__say { padding-top: clamp(1.5rem, 2.4vw, 2rem); }
.proj__tags {
  display: flex; flex-wrap: wrap; gap: .55rem 0;
  font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-4);
  padding-bottom: 1.15rem; margin-bottom: clamp(1.15rem, 2vw, 1.7rem);
  border-bottom: 1px solid var(--rule);
}
.proj__tags span { white-space: nowrap; }
.proj__tags span + span::before { content: "—"; padding-inline: .7rem; opacity: .6; }
.proj__title { font-size: var(--t-proj); line-height: 1.14; max-width: 22ch; }
.proj__note { font-size: var(--t-small); line-height: 1.7; color: var(--ink-3); max-width: 52ch; }
@media (min-width: 900px) {
  .proj__say {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    column-gap: clamp(2rem, 5vw, 5rem); row-gap: 0;
  }
  .proj__tags { grid-column: 1 / -1; }
  .proj__note { padding-top: .5rem; }
}

/* ── 7. start ────────────────────────────────────────────────────────── */
.start { padding-block: var(--sec); }
.start__shell { display: grid; gap: clamp(3rem, 7vw, 5.5rem); }
@media (min-width: 940px) {
  .start__shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}
.start__say h2 { font-size: var(--t-say); line-height: 1.1; max-width: 15ch; }
.start__say p { margin-top: clamp(1.5rem, 3vw, 2.2rem); font-size: var(--t-lead); line-height: 1.58; color: var(--p-ink-2); max-width: 44ch; }
.start__studio { font-size: var(--t-small) !important; line-height: 1.75; color: var(--p-ink-3) !important; padding-top: clamp(1.4rem, 3vw, 2rem); border-top: 1px solid var(--p-rule); }

.form { display: grid; gap: clamp(1.5rem, 3vw, 2rem); }
.field { display: grid; gap: .55rem; }
.field--pair { grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 2rem); }
.field--pair > div { display: grid; gap: .55rem; }
label {
  font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase;
  color: var(--p-ink-3);
  display: flex; align-items: baseline; gap: .6rem;
}
.opt { letter-spacing: .1em; opacity: .62; font-size: .625rem; }
input, textarea {
  font: inherit; font-size: var(--t-body); color: var(--p-ink-1);
  background: transparent; border: 0; border-bottom: 1px solid var(--p-rule-2);
  padding: .6rem 0; width: 100%; border-radius: 0;
  transition: border-color var(--d-mid) var(--e-io), background-color var(--d-mid) var(--e-io);
}
textarea { resize: vertical; line-height: 1.55; min-height: 3.2rem; }
input:hover, textarea:hover { border-color: var(--p-ink-3); }
input:focus, textarea:focus {
  outline: none; border-color: var(--p-ink-1);
  box-shadow: 0 1px 0 0 var(--sodium);
}
input:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 1px 0 0 var(--sodium); }
.field.is-bad input, .field.is-bad textarea { border-color: var(--burnt); }
.err {
  font-size: var(--t-small); color: var(--burnt); display: flex; align-items: center; gap: .5rem;
}
.err::before { content: ""; width: 12px; height: 1px; background: currentColor; flex: none; }

.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem 1.6rem; }
.form__status { font-size: var(--t-small); color: var(--p-ink-3); min-height: 1.2em; }
.form__status.is-live {
  background-image: linear-gradient(105deg, currentColor 0%, currentColor 38%, var(--sodium) 50%, currentColor 62%, currentColor 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-fill-color: transparent;
}
.form__honest { font-size: var(--t-small); color: var(--p-ink-3); opacity: .78; }

.done { display: grid; gap: 1.2rem; align-content: start; padding-top: .5rem; }
.done__mark { width: 46px; height: 2px; background: var(--sodium); }
.done h3 { font-size: var(--t-proj); line-height: 1.18; max-width: 22ch; }
.done p { font-size: var(--t-small); color: var(--p-ink-3); }

/* ── reveals (default resting state is always visible) ───────────────── */
.js .r-up { opacity: 0; transform: translateY(18px); }

/* ── narrow ──────────────────────────────────────────────────────────── */
/* below the authored three-line break, let the browser balance the rag */
@media (max-width: 859px) {
  .hero__line { text-wrap: balance; letter-spacing: -0.028em; }
  .hero__line .brk { display: none; }
}
@media (max-width: 780px) {
  :root { --nav-h: 64px; }
  .nav__links, .nav__cta { display: none; }
  .nav__toggle { display: grid; }
  .hero__scroll { display: none; }
  .field--pair { grid-template-columns: 1fr; }
  .proj__note { margin-top: 1rem; }
  .proj__title { max-width: none; }
  .still__sheen { display: none; }
}
@media (max-width: 420px) {
  .btn { width: 100%; justify-content: center; }
  .hero__acts { width: 100%; }
}

/* ── reduced motion: an authored mode, not an absence ────────────────── */
@media (prefers-reduced-motion: reduce) {
  html:not(.motion-full) .hero__scroll::after { animation: none; transform: scaleX(1); }
  html:not(.motion-full) *, html:not(.motion-full) *::before, html:not(.motion-full) *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
html.reduce .hero__scroll::after { animation: none; transform: scaleX(1); }
html.reduce .still { width: 100% !important; }
html.reduce .still__frame img { transform: none !important; }
html.reduce #horizon { position: absolute; top: 0; left: 0; height: 100svh; }
html.reduce .strip__track { transform: none !important; }
html.reduce .strip { display: flex; justify-content: center; }
html.reduce .strip__block:not(:first-child) { display: none; }
