/* ============================================================================
   Page chrome: header, hero, progress, tiers, steps, FAQ, footer
   Every section does exactly one job.
   ========================================================================= */

/* ---------------------------------------------------------------- Header */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  transition: border-color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: 100%;
}

/* The logo, rebuilt in CSS so it inherits the theme instead of shipping two
   files. Nine squares, the claimed one in accent — same mark as assets/logo.svg. */
.brandmark {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brandmark__glyph {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  width: 21px;
  height: 21px;
  flex: none;
}

.brandmark__glyph i {
  display: block;
  border-radius: 1.5px;
  background: var(--ink);
}

/* The centre square is the one somebody bought. */
.brandmark__glyph i:nth-child(5) {
  background: var(--accent);
}

.nav {
  display: flex;
  gap: var(--sp-5);
  margin-inline-start: var(--sp-3);
}

.nav a {
  font-size: var(--step--1);
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease);
}

.nav a:hover {
  color: var(--ink);
}

.header__right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-inline-start: auto;
}

/* Countdown never leaves the viewport — it is the scarcity signal. */
.countdown {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.32em 0.7em;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.countdown__label {
  color: var(--ink-3);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* Sun in light mode, moon in dark. */
.icon-btn .moon {
  display: none;
}
:root[data-theme='dark'] .icon-btn .moon {
  display: block;
}
:root[data-theme='dark'] .icon-btn .sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-btn .moon {
    display: block;
  }
  :root:not([data-theme='light']) .icon-btn .sun {
    display: none;
  }
  :root[data-theme='light'] .icon-btn .moon {
    display: none;
  }
  :root[data-theme='light'] .icon-btn .sun {
    display: block;
  }
}

@media (max-width: 900px) {
  .nav {
    display: none;
  }
}

@media (max-width: 560px) {
  .header__right .btn {
    display: none;
  }
  .brandmark span {
    display: none;
  }
}

/* ------------------------------------------------------------------ Hero */

.hero {
  padding-block: clamp(var(--sp-7), 8vw, var(--sp-9)) var(--sp-6);
  text-align: center;
}

.hero__eyebrow {
  margin-inline: auto;
}

.hero h1 {
  margin-top: var(--sp-5);
  font-size: var(--step-4);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero h1 span {
  display: block;
  color: var(--accent-text);
}

.hero__lead {
  max-width: 52ch;
  margin: var(--sp-5) auto 0;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-2);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.hero__specs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero__specs b {
  color: var(--ink);
  font-weight: 550;
}

/* -------------------------------------------------------------- Progress */

.progress {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.progress__money {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
}

.progress__raised {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.progress__of {
  font-size: var(--step--1);
  color: var(--ink-3);
}

.progress__counts {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--step--1);
  color: var(--ink-2);
}

.progress__counts b {
  font-family: var(--font-mono);
  font-weight: 550;
  color: var(--ink);
}

.bar {
  position: relative;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 1.1s var(--ease);
}

/* One sheen pass across the fill, slow enough to read as "live". */
.bar__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: sheen 3.6s var(--ease) infinite;
}

@keyframes sheen {
  0% {
    transform: translateX(-100%);
  }
  55%,
  100% {
    transform: translateX(200%);
  }
}

/* ----------------------------------------------------------- Grid section */

.gridsec {
  padding-block: var(--sp-6) clamp(var(--sp-7), 7vw, var(--sp-9));
}

.gridsec__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-block: var(--sp-5) var(--sp-4);
}

.gridsec__hint {
  font-size: var(--step--1);
  color: var(--ink-3);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
}

.segmented button {
  padding: 0.42em 1.05em;
  border-radius: var(--r-pill);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease), background-color var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease);
}

.segmented button[aria-selected='true'] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ----------------------------------------------------- Tier legend + feed */

.gridsec__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.tiers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.tiers button {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  padding: 0.4em 0.85em;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--step--2);
  color: var(--ink-2);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.tiers button:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.tiers button:disabled {
  cursor: default;
  opacity: 0.5;
}

.tiers b {
  font-family: var(--font-mono);
  font-weight: 550;
  color: var(--ink);
}

.tiers span {
  color: var(--ink-3);
}

.feed {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 20px;
  font-size: var(--step--2);
  color: var(--ink-3);
}

.feed__text {
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}

.feed__text.is-out {
  opacity: 0;
  transform: translateY(-4px);
}

.feed__text b {
  font-weight: 550;
  color: var(--ink-2);
}

/* ----------------------------------------------------------------- Steps */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-5);
  counter-reset: step;
}

.step {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

.step::before {
  counter-increment: step;
  content: '0' counter(step);
  display: block;
  margin-bottom: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--accent-text);
}

.step h3 {
  margin-bottom: var(--sp-2);
  font-size: var(--step-1);
}

.step p {
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* ------------------------------------------------------------------- FAQ */

.faq {
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-5);
  font-size: var(--step-1);
  font-weight: 550;
  letter-spacing: -0.02em;
  cursor: pointer;
  list-style: none;
  transition: color var(--t-fast) var(--ease);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary:hover {
  color: var(--accent-text);
}

.faq summary::after {
  content: '';
  width: 11px;
  height: 11px;
  flex: none;
  background: currentColor;
  transition: transform var(--t-base) var(--ease);
  clip-path: polygon(45% 0, 55% 0, 55% 45%, 100% 45%, 100% 55%, 55% 55%, 55% 100%, 45% 100%, 45% 55%, 0 55%, 0 45%, 45% 45%);
}

.faq details[open] summary::after {
  transform: rotate(135deg);
}

.faq p {
  max-width: 62ch;
  padding-bottom: var(--sp-5);
  color: var(--ink-2);
}

/* ------------------------------------------------------------- Close/CTA */

.close-cta {
  padding-block: clamp(var(--sp-7), 7vw, var(--sp-9));
  border-top: 1px solid var(--line);
  text-align: center;
}

.close-cta h2 {
  font-size: var(--step-3);
}

.close-cta p {
  max-width: 46ch;
  margin: var(--sp-4) auto var(--sp-6);
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- Footer */

.footer {
  padding-block: var(--sp-6);
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--step--2);
  color: var(--ink-3);
}

.footer a {
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease);
}

.footer a:hover {
  color: var(--accent-text);
}

.footer__admin {
  opacity: 0.55;
}

.footer__admin:hover {
  opacity: 1;
}

/* --------------------------------------------------------------- Toast
   Return trip from Stripe Checkout. No sensitive detail lives in it — the
   database, updated by the webhook, is the source of truth — this is just an
   acknowledgement that fades on its own. */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  z-index: 110;
  max-width: min(420px, calc(100vw - var(--sp-6)));
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--step--1);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}

.toast.is-in {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ------------------------------------------------------- Scroll reveal
   One reveal for the whole page, applied by js/motion.js. */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .bar__fill,
  .bar__fill::after {
    transition: none;
    animation: none;
  }
  .dot::after {
    animation: none;
  }
}
