/**
 * CAIRN — dark, one lit object, type kept quiet so the flask carries the page.
 *
 * Layout rule for the whole file: the canvas is fixed behind everything, each act is a tall
 * section whose `.stage` sticks for the length of it, and JS writes `--vis` (0 to 1) on the
 * stage so copy fades with the act instead of on an independent timer.
 */

:root {
  --bg: #07090a;
  --ink: #f2f1ed;
  --muted: #8e959b;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(9, 11, 12, 0.72);
  --amber: #ff7a33;
  --steel: #9aa3aa;
  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 5vw, 88px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px / 1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2 {
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0;
}
p {
  margin: 0;
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 60;
  background: var(--ink);
  color: #000;
  padding: 10px 16px;
  border-radius: 2px;
  font-size: 14px;
  text-decoration: none;
}
.skip:focus {
  left: 8px;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ stage */

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.poster {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: var(--gutter);
  text-align: center;
}
.poster[hidden] {
  display: none;
}
.poster svg {
  height: min(58vh, 460px);
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.7));
}
.poster p {
  color: var(--muted);
  font-size: 14px;
  max-width: 34ch;
  margin-inline: auto;
}

main {
  position: relative;
  z-index: 1;
}

.act {
  height: calc(var(--acts, 1) * 100vh);
  position: relative;
}
.act-end {
  height: auto;
  min-height: calc(var(--acts, 1) * 100vh);
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.stage > * {
  pointer-events: auto;
}

.stage-split {
  justify-content: flex-end;
}

/* The buy panel is taller than the others, so the last act flows instead of sticking. */
.act-end .stage {
  position: static;
  height: auto;
  min-height: 100vh;
  padding-block: 14vh;
}

/* ------------------------------------------------------------------ header */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px var(--gutter);
  mix-blend-mode: difference;
}
.wordmark {
  font-weight: 700;
  letter-spacing: 0.34em;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.bar-note {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bar-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  cursor: pointer;
  transition:
    border-color 0.25s,
    background 0.25s;
}
.bar-cart:hover {
  border-color: var(--ink);
}
.pill {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #000;
  font-family: var(--mono);
  font-size: 11px;
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------------ hero */

.stage-hero {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--steel);
}

.display {
  font-size: clamp(44px, 8vw, 116px);
  line-height: 0.9;
  letter-spacing: -0.05em;
  max-width: 14ch;
}
.display .line {
  display: block;
  overflow: hidden;
}
.display .line > span {
  display: block;
  transform: translateY(106%);
  animation: rise 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.display .line:nth-child(2) > span {
  animation-delay: 0.12s;
}

.lede {
  max-width: 42ch;
  color: var(--muted);
}

.cue {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--steel);
}
.cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 42px;
  margin-top: 10px;
  background: linear-gradient(var(--steel), transparent);
  animation: drop 2.1s ease-in-out infinite;
}

.reveal {
  opacity: 0;
  animation: fade 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}
.lede.reveal {
  animation-delay: 0.5s;
}
.cue.reveal {
  animation-delay: 0.8s;
}

@keyframes rise {
  to {
    transform: translateY(0);
  }
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes drop {
  0%,
  100% {
    transform: scaleY(0.3);
    transform-origin: top;
  }
  50% {
    transform: scaleY(1);
    transform-origin: top;
  }
}

/* ------------------------------------------------------------------ construction act */

#act-parts .stage {
  align-items: flex-start;
  padding-top: 14vh;
}
.act-head {
  max-width: 30ch;
  opacity: var(--vis, 1);
  transform: translateY(calc((1 - var(--vis, 1)) * 16px));
}
.act-head h2 {
  font-size: clamp(26px, 3.4vw, 44px);
  margin-top: 12px;
}

.leaders,
.callouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* An SVG is a replaced element, so inset alone leaves it at its default 300x150. */
.leaders {
  width: 100%;
  height: 100%;
}
.leaders line {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
}
.leaders circle {
  fill: var(--amber);
}

.callout {
  position: absolute;
  width: max-content;
  max-width: 24ch;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.callout[data-on="true"] {
  opacity: 1;
}
.callout[data-side="left"] {
  transform: translate(-100%, -50%);
  text-align: right;
}
.callout-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}
.callout-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 3px;
}

/* ------------------------------------------------------------------ panels */

.panel {
  width: min(440px, 100%);
  padding: clamp(20px, 3vw, 34px);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  opacity: var(--vis, 1);
  transform: translateY(calc((1 - var(--vis, 1)) * 20px));
}
.panel h2 {
  font-size: clamp(24px, 2.8vw, 36px);
  margin: 10px 0 14px;
}
.panel .body {
  color: var(--muted);
  font-size: 15px;
}

.readouts {
  display: grid;
  gap: 10px;
  margin: 22px 0 18px;
}
.readout {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.readout-label {
  font-size: 13px;
  color: var(--muted);
}
.readout-value {
  font-size: 26px;
  letter-spacing: -0.02em;
}
.readout.dim .readout-value {
  color: var(--amber);
}

.section {
  width: 100%;
  height: auto;
  overflow: visible;
}
.section .tick {
  fill: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scrub {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 14px;
  margin-top: 18px;
}
.scrub span {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.scrub output {
  font-size: 14px;
}
.scrub input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--amber);
}

.figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin: 24px 0 26px;
}
.figures div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.figures dt {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.figures dd {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.rule {
  position: relative;
  height: 3px;
  background: var(--line);
}
.rule-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: var(--ink);
}
.rule-tick {
  position: absolute;
  top: 12px;
  left: calc(var(--at) * 100%);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ buy */

.buy .price {
  font-size: 22px;
  margin-bottom: 20px;
}
.option {
  margin-bottom: 18px;
}
.option-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
  position: relative;
  background-clip: padding-box;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.swatch:hover {
  transform: scale(1.06);
}
.swatch[aria-pressed="true"] {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3px var(--ink);
}
.swatch[data-out="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}
.swatch[data-out="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--ink);
  transform: rotate(45deg);
}

.sizes {
  display: flex;
  gap: 8px;
}
.size {
  flex: 1;
  padding: 11px 8px;
  cursor: pointer;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.size:hover {
  border-color: var(--steel);
}
.size[aria-pressed="true"] {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

.stock {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.stock[data-tone="low"] {
  color: var(--amber);
}
.stock[data-tone="out"] {
  color: #ff5f5f;
}

.add {
  width: 100%;
  padding: 15px;
  cursor: pointer;
  background: var(--ink);
  color: #000;
  border: 0;
  font: 500 15px var(--sans);
  letter-spacing: 0.02em;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.add:hover {
  opacity: 0.85;
}
.add:active {
  transform: translateY(1px);
}
.add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.specs {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.specs li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.specs span:last-child {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

/* ------------------------------------------------------------------ colophon */

.colophon {
  position: relative;
  background: #050607;
  border-top: 1px solid var(--line);
  padding: clamp(48px, 9vh, 110px) var(--gutter);
  display: grid;
  gap: 16px;
}
.colophon > * {
  max-width: 74ch;
}
.colophon h2 {
  font-size: 20px;
}
.colophon p {
  color: var(--muted);
  font-size: 15px;
}
.colophon code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}

/* ------------------------------------------------------------------ bag */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.6);
  animation: fade 0.25s ease forwards;
}
.backdrop[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(420px, 100%);
  background: #0b0d0e;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  animation: slide 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.drawer[hidden] {
  display: none;
}
@keyframes slide {
  from {
    transform: translateX(100%);
  }
  to {
    transform: none;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gutter-in, 24px);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  font-size: 17px;
  letter-spacing: 0.04em;
}
.icon {
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.empty {
  color: var(--muted);
  font-size: 14px;
}

.item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: start;
}
.item-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.item-title {
  font-size: 15px;
}
.item-variant {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}
.qty {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.qty button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.qty button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.qty span {
  font-family: var(--mono);
  font-size: 13px;
  min-width: 14px;
  text-align: center;
}
.item-price {
  font-family: var(--mono);
  font-size: 14px;
}
.remove {
  display: block;
  margin-top: 8px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.drawer-foot {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  display: grid;
  gap: 14px;
}
.ship {
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 7px;
}
.ship-bar {
  height: 2px;
  background: var(--line);
}
.ship-bar i {
  display: block;
  height: 100%;
  background: var(--amber);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform 0.4s ease;
}
.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
}
.fine {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 55;
  transform: translate(-50%, 14px);
  background: var(--ink);
  color: #000;
  padding: 11px 18px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
}
.toast[data-show="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 860px) {
  .stage-split {
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 6vh;
  }
  .panel {
    width: 100%;
  }
  #act-parts .stage {
    padding-top: 11vh;
  }
  .callout {
    max-width: 17ch;
  }
  .callout-note {
    display: none;
  }
  .bar-note {
    display: none;
  }
}

/* Reduced motion drops the scroll choreography: the acts become ordinary stacked blocks
   in front of one still frame of the flask. */
body[data-motion='off'] .act { height: auto; min-height: 0; }
body[data-motion='off'] .stage { position: static; height: auto; padding: 14vh var(--gutter); }
body[data-motion='off'] .stage-hero { min-height: 100vh; justify-content: center; }
body[data-motion='off'] .leaders,
body[data-motion='off'] .callouts { display: none; }

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .display .line > span {
    transform: none;
  }
  .reveal {
    opacity: 1;
  }
  .panel,
  .act-head {
    opacity: 1;
    transform: none;
  }
  .callout {
    opacity: 1;
  }
}
