/* Nike Air Archive. One family, four sizes, black/white + one yellow. */
:root {
  /* Atmosphere: 11 steps, equal OKLab lightness, #182026 → #CBD4DC.
     main.js reads these at boot to build the 256×1 gradient-map texture. */
  --atm-0: #182026; --atm-1: #272f36; --atm-2: #373f46; --atm-3: #475057;
  --atm-4: #596169; --atm-5: #6b737b; --atm-6: #7d868d; --atm-7: #9099a0;
  --atm-8: #a3acb4; --atm-9: #b7c0c8; --atm-10: #cbd4dc;

  --ink: #000;
  --paper: #fff;
  --glass: rgb(255 255 255 / 0.3);
  --accent: #f3ff00; /* fill only, always under black text */

  --fs-caption: 18px;
  --fs-body: 29px;
  --fs-list: 47px;
  --fs-display: 172px;
  --lead-poster: 0.8;
  --track-poster: -0.08em;

  --font: "Helvetica Neue", Helvetica, sans-serif;
}
.use-inter { --font: "Helvetica Neue", Inter, sans-serif; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
#scene, #hero a { touch-action: none; } /* swipes drive the zoom and the turn, never a browser pan */
body {
  background: var(--atm-5);
  color: var(--paper);
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--fs-caption);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, a { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cap { font-size: var(--fs-caption); line-height: 1; letter-spacing: 0; }
.body { font-size: var(--fs-body); }
.list { font-size: var(--fs-list); }
.display { font-size: var(--fs-display); }

/* ── Scene + grain ─────────────────────────────────────────── */
#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  filter: blur(8px); transform: scale(1.03);
  will-change: filter, transform;
}
#grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-size: 256px 256px;
  image-rendering: pixelated;
  mix-blend-mode: soft-light;
  opacity: 0.55;
}

/* ── Chrome ────────────────────────────────────────────────── */
#chrome { position: fixed; inset: 0 0 auto 0; z-index: 5; height: 0; }
.logo {
  position: fixed; top: 28px; left: 32px; display: flex;
  mix-blend-mode: difference;
}
.logo i { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); display: block; }
.logo i + i { margin-left: -6px; }
.top-right { position: fixed; top: 32px; right: 32px; display: flex; gap: 40px; }
.back { position: fixed; top: 80px; left: 32px; }
.back[hidden] { display: none; }

/* ── Hero poster ───────────────────────────────────────────── */
#hero { position: fixed; inset: 0; z-index: 3; pointer-events: none; scale: var(--poster-k, 1); } /* --poster-k: main.js fitPoster() */
#hero .layer {
  position: fixed; inset: 0;
  transform-origin: 50% 50%;
  will-change: transform, filter, opacity;
}
#hero a, #hero button { pointer-events: auto; }
#hero.is-gone a { pointer-events: none; }

.toprow, .name, .note, .chip, .pos {
  letter-spacing: var(--track-poster);
  line-height: var(--lead-poster);
}
.toprow {
  position: absolute; left: 50%; top: calc(50% - 250px); /* 47px clear of the two-line wordmark */
  translate: -50% 0; text-align: center; white-space: nowrap;
}
.name {
  position: absolute; left: 50%; top: 50%;
  translate: -50% -60%;
  display: flex; align-items: center; gap: 18px;
  font-size: var(--fs-display); font-weight: 500;
  white-space: nowrap;
}
.name .word { color: var(--glass); filter: url(#inner-shadow); }
/* "Air / Archive" stacks at display size so the wordmark keeps the poster's width;
   the mark sits on the first line's cap height instead of the block's middle. */
.name { align-items: flex-start; }
.name .word span { display: block; }
.name .mark { margin-top: 0.12em; }
.mark { display: flex; width: 90px; height: 45px; flex: none; }
.mark i {
  width: 45px; height: 45px; border-radius: 50%; display: block;
  background: var(--glass);
  box-shadow: inset 0 -5px 9px rgb(0 0 0 / 0.32);
}
.pos { position: absolute; left: calc(50% + var(--x)); top: calc(50% + var(--y)); white-space: nowrap; }
.chip { background: var(--accent); color: var(--ink); padding: 6px 10px 5px; }
.note { color: var(--paper); }
a.pos { text-decoration: underline; text-underline-offset: 4px; letter-spacing: 0; line-height: 1; }

/* Entrance: rise 16px out of a 12px blur, staggered 60ms (index set by main.js). */
.rise { opacity: 0; transform: translateY(16px); filter: blur(12px); }
.entered .rise {
  opacity: 1; transform: none; filter: blur(0);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1), filter .9s cubic-bezier(.2,.7,.2,1);
  transition-delay: calc(var(--i, 0) * 60ms);
}

/* ── Caption under the hem ─────────────────────────────────── */
.tag {
  position: fixed; left: 0; top: 0; z-index: 4; pointer-events: none;
  background: var(--accent); color: var(--ink);
  text-transform: uppercase; padding: 6px 8px 5px; white-space: nowrap;
  translate: -50% 0;
  transition: opacity .18s;
}
.tag[hidden] { display: block; opacity: 0; }

/* ── Tabs ──────────────────────────────────────────────────── */
#tabs {
  position: fixed; left: 50%; bottom: 0; z-index: 5;
  translate: -50% 100%;
  transition: translate .8s cubic-bezier(.2,.8,.2,1);
}
#tabs.is-in { translate: -50% 0; }
.tabrow { display: flex; }
.tab {
  height: 32px; padding: 0 14px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--ink); white-space: nowrap;
}
/* 453px from the spec; on a phone, shrink to leave room for the two inactive tabs (widest pair ≈157px). */
.tab.is-active { width: min(453px, calc(100vw - 170px)); }
#ink { position: absolute; top: 0; left: 0; height: 32px; width: 0; background: var(--ink); pointer-events: none; }
.ink-copy { position: absolute; inset: 0; pointer-events: none; }
.ink-copy .tab { background: transparent; color: var(--paper); }

/* ── Product detail ────────────────────────────────────────── */
/* Paper panel, black ink, the yellow kept for the one action. Desktop: a right-hand column.
   Phone: a bottom sheet (main.js frames the garment in whatever space the panel leaves). */
.pdp {
  --pdp-w: min(460px, 100vw);
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--pdp-w); z-index: 7;
  background: var(--paper); color: var(--ink);
  padding: 28px 32px 40px; overflow-y: auto; overscroll-behavior: contain;
  user-select: text;
  translate: 100% 0; transition: translate .55s cubic-bezier(.2,.8,.2,1);
}
.pdp.is-open { translate: 0 0; }
.pdp :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; } /* the yellow ring vanishes on paper */
.pdp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.pdp-top .cap:first-child { text-transform: lowercase; }
.pdp-name { font-size: var(--fs-list); font-weight: 500; line-height: 0.9; letter-spacing: -0.06em; }
.pdp-price { margin-top: 12px; letter-spacing: -0.04em; }
.pdp-was { opacity: 0.45; font-size: var(--fs-caption); letter-spacing: 0; margin-left: 6px; }
.pdp-views { display: flex; gap: 6px; margin: 28px 0 24px; }
.pdp-views button { flex: 1; aspect-ratio: 3 / 4; background: var(--atm-9); padding: 4px; border: 1px solid transparent; }
.pdp-views button[aria-pressed="true"] { border-color: var(--ink); }
.pdp-views img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.pdp-label { display: block; margin-bottom: 10px; }
.pdp-value { opacity: 0.6; margin-left: 8px; }
.pdp-sizes { border: 0; margin: 20px 0 0; padding: 0; }
.pdp-sizelist { display: flex; gap: 6px; flex-wrap: wrap; }
.pdp-sizelist label { position: relative; }
.pdp-sizelist input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pdp-sizelist span {
  display: grid; place-items: center; min-width: 56px; height: 48px; padding: 0 12px;
  border: 1px solid var(--ink); font-size: var(--fs-caption);
}
.pdp-sizelist input:checked + span { background: var(--ink); color: var(--paper); }
.pdp-sizelist input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.pdp-sizes.is-missing .pdp-sizelist span { border-color: var(--ink); border-width: 2px; }
.pdp-hint { margin-top: 10px; }
.pdp-hint[hidden] { display: none; }
.pdp-add {
  display: block; width: 100%; height: 56px; margin: 24px 0 28px;
  background: var(--accent); color: var(--ink); text-transform: uppercase;
  transition: background .15s, color .15s;
}
.pdp-add:hover, .pdp-add.is-added { background: var(--ink); color: var(--accent); }
.pdp-more { border-top: 1px solid var(--ink); padding: 14px 0; }
.pdp-more:last-of-type { border-bottom: 1px solid var(--ink); }
.pdp-more summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.pdp-more summary::-webkit-details-marker { display: none; }
.pdp-more summary::after { content: "+"; }
.pdp-more[open] summary::after { content: "–"; }
.pdp-more p { font-size: var(--fs-caption); line-height: 1.4; margin-top: 12px; max-width: 34ch; }

@media (max-width: 700px) {
  .pdp {
    top: auto; left: 0; width: 100%; max-height: 58vh; padding: 20px 16px 32px;
    translate: 0 100%;
  }
  .pdp-top { margin-bottom: 20px; }
}

.toast {
  position: fixed; top: 72px; right: 32px; z-index: 8; pointer-events: none;
  background: var(--accent); color: var(--ink); padding: 8px 10px 7px;
  opacity: 0; translate: 0 -6px; transition: opacity .2s, translate .2s;
}
.toast.is-on { opacity: 1; translate: 0 0; }
/* The panel covers the header's cart on desktop, so the toast moves into the room beside it. */
@media (min-width: 701px) { .pdp-open .toast { right: calc(min(460px, 100vw) + 32px); top: 32px; } }

/* ── Preloader ─────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--atm-0), var(--atm-1) 10%, var(--atm-2) 20%, var(--atm-3) 30%,
    var(--atm-4) 40%, var(--atm-5) 50%, var(--atm-6) 60%, var(--atm-7) 70%, var(--atm-8) 80%, var(--atm-9) 90%, var(--atm-10));
  transition: opacity .7s ease .55s;
}
#loader .ring, #loader .pct { grid-area: 1 / 1; }
.ring {
  width: 300px; height: 300px; border-radius: 50%;
  background: var(--glass);
  box-shadow: inset 0 -14px 28px rgb(0 0 0 / 0.28);
  transition: transform .6s cubic-bezier(.3,.7,.2,1), filter .6s, opacity .6s;
}
.pct { line-height: var(--lead-poster); letter-spacing: var(--track-poster); font-weight: 500; font-variant-numeric: tabular-nums; }
#loader.is-out .ring, #loader.is-out .pct { transform: scale(1.06); filter: blur(24px); opacity: 0; transition: transform .6s, filter .6s, opacity .6s; }
#loader.is-out { opacity: 0; pointer-events: none; }
/* Load failure: the counter stops, the ring dims, one line says what happened. */
/* Black ink: this line sits on the light end of the loader gradient (--atm-8/9), where white fails contrast. */
.load-fail { grid-area: 1 / 1; align-self: end; margin-bottom: 18vh; text-align: center; color: var(--ink); }
.load-fail a { text-decoration: underline; text-underline-offset: 3px; }
#loader.is-failed .ring { opacity: 0.35; }
#loader.is-failed .pct { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .entered .rise { transition-duration: .01s; transition-delay: 0s; }
}
