/* ==========================================================================
   QuitStreak — "Ember Shrine" on the web.
   Tokens mirror DESIGN.md so the site and the app read as one object.
   No frameworks, no build step, no JavaScript.
   ========================================================================== */

@font-face {
  font-family: "Jersey 10";
  src: url("jersey10.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --void:  #0B0A14;
  --forge: #171226;
  --core:  #FF8A00;
  --hot:   #FF4D2E;
  --gold:  #FFD37A;
  --tide:  #3FB8AF;
  --text:  #F3EEE4;
  --muted: #9B93AD;

  --edge: rgba(243, 238, 228, .10);
  --edge-warm: rgba(255, 138, 0, .22);

  --display: "Jersey 10", "Courier New", monospace;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --gut: clamp(20px, 5vw, 40px);
  --shell: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--core); text-underline-offset: 3px; }
a:hover { color: var(--gold); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: var(--gut); }

/* Utility HUD label — the app's uppercase caption, verbatim. */
.hud {
  font: 600 11.5px/1 var(--body);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.display { font-family: var(--display); font-weight: 400; line-height: .92; letter-spacing: .01em; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--forge); color: var(--text);
  padding: 10px 16px; border-radius: 0 0 10px 0; z-index: 99;
}
.skip:focus { left: 0; }

/* ==========================================================================
   Header
   ========================================================================== */

.top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 27px;
  letter-spacing: .04em;
  color: var(--text);
  text-decoration: none;
}
.mark:hover { color: var(--text); }
.mark img { width: 26px; height: 26px; border-radius: 7px; image-rendering: pixelated; }

.langs { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.langs a {
  display: block;
  padding: 5px 11px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font: 600 11.5px/1.3 var(--body);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  background: rgba(23, 18, 38, .6);
}
.langs a:hover { color: var(--text); border-color: var(--edge-warm); }
.langs a[aria-current="true"] {
  color: var(--void);
  background: var(--core);
  border-color: var(--core);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  isolation: isolate;
  /* Wins over the generic `section` rhythm: the hero opens tight under the
     header so the odometer lands inside the first screen. */
  padding-block: 0 clamp(44px, 6vw, 80px);
  overflow: hidden;
}

/* Radial heat from the mascot, washing the whole first screen. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(30% 22% at 50% 21%, rgba(255, 138, 0, .20), transparent 72%),
    radial-gradient(16% 12% at 50% 20%, rgba(255, 77, 46, .22), transparent 74%);
  pointer-events: none;
}

/* Dither: the 2×2 pixel checkerboard from the app, at 4% so it reads as grain. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(45deg, rgba(243, 238, 228, .045) 25%, transparent 25%, transparent 75%, rgba(243, 238, 228, .045) 75%),
    linear-gradient(45deg, rgba(243, 238, 228, .045) 25%, transparent 25%, transparent 75%, rgba(243, 238, 228, .045) 75%);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
  mask-image: radial-gradient(46% 34% at 50% 24%, #000, transparent 78%);
  pointer-events: none;
}

.hero-inner {
  display: grid;
  gap: clamp(20px, 2.6vw, 30px);
  justify-items: center;
  text-align: center;
  padding-top: clamp(12px, 2vw, 26px);
}

/* --- Mascot ------------------------------------------------------------- */

.shrine { position: relative; display: grid; place-items: center; }

.shrine .halo {
  position: absolute;
  width: clamp(190px, 26vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 0, .30), rgba(255, 77, 46, .10) 45%, transparent 68%);
  animation: breathe 4.4s ease-in-out infinite alternate;
}

.shrine .ring {
  position: absolute;
  width: clamp(158px, 21vw, 208px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 138, 0, .26);
  border-top-color: rgba(255, 211, 122, .7);
  border-right-color: rgba(255, 138, 0, .55);
}

.shrine img {
  position: relative;
  width: clamp(108px, 14vw, 140px);
  height: auto;
  image-rendering: pixelated;
  animation: hover-float 4.4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 28px rgba(255, 138, 0, .42));
}

@keyframes breathe {
  from { opacity: .72; transform: scale(.96); }
  to   { opacity: 1;   transform: scale(1.06); }
}
@keyframes hover-float {
  from { transform: translateY(3px); }
  to   { transform: translateY(-7px); }
}

/* --- Rising embers ------------------------------------------------------ */

.embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.embers i {
  position: absolute;
  bottom: 12%;
  left: var(--x);
  width: var(--s, 3px);
  height: var(--s, 3px);
  background: var(--core);
  box-shadow: 0 0 7px rgba(255, 138, 0, .85);
  opacity: 0;
  animation: rise var(--t, 11s) linear var(--d, 0s) infinite;
}
.embers i:nth-child(3n)   { background: var(--gold); box-shadow: 0 0 7px rgba(255, 211, 122, .8); }
.embers i:nth-child(4n+1) { background: var(--hot);  box-shadow: 0 0 8px rgba(255, 77, 46, .7); }

@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
  12%  { opacity: .9; }
  70%  { opacity: .5; }
  100% { transform: translate3d(var(--drift, 20px), -76vh, 0) scale(.3); opacity: 0; }
}

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

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(42px, 6.5vw, 76px);
  line-height: .96;
  letter-spacing: .005em;
  max-width: 21ch;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--core);
  text-shadow: 0 0 26px rgba(255, 138, 0, .32);
}

.lede {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(16px, 1.9vw, 18.5px);
  line-height: 1.62;
}

/* ==========================================================================
   The odometer — the signature. CSS-only, mirrors the in-app money machine.
   ========================================================================== */

.odo-block {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: clamp(20px, 3.4vw, 30px) clamp(20px, 4vw, 38px);
  border-radius: 20px;
  border: 1px solid var(--edge-warm);
  background:
    radial-gradient(120% 130% at 50% -20%, rgba(255, 138, 0, .12), transparent 60%),
    linear-gradient(180deg, #1d1631, #120e21);
  box-shadow: 0 26px 60px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 211, 122, .12);
}

.odo {
  --dh: clamp(46px, 8vw, 68px);
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, .7vw, 6px);
  font-family: var(--display);
  color: var(--gold);
}

.odo .cur {
  font-size: calc(var(--dh) * .46);
  line-height: 1;
  padding-bottom: calc(var(--dh) * .14);
  color: var(--muted);
  letter-spacing: .02em;
}

.odo .sep {
  font-size: calc(var(--dh) * .6);
  line-height: 1;
  padding-bottom: calc(var(--dh) * .06);
  color: rgba(255, 211, 122, .75);
}

/* One physical digit cell: dark metal face, warm light from above. */
.odo .cell {
  position: relative;
  overflow: hidden;
  width: calc(var(--dh) * .62);
  height: var(--dh);
  border-radius: calc(var(--dh) * .1);
  border: 1px solid rgba(255, 211, 122, .16);
  background: linear-gradient(180deg, #2a2040 0%, #120d1f 52%, #221a35 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 211, 122, .22),
    inset 0 -6px 12px -6px rgba(0, 0, 0, .9);
  font-size: calc(var(--dh) * .78);
  line-height: var(--dh);
  text-align: center;
  text-shadow: 0 0 16px rgba(255, 211, 122, .5);
}
/* Glass glare across the top third of every cell. */
.odo .cell::after {
  content: "";
  position: absolute;
  inset: 0 0 62% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), transparent);
  pointer-events: none;
}

.odo .cell b { font-weight: 400; display: block; }

/* Cents run smaller and cooler, exactly as in the app. */
.odo .cents { --dh: clamp(30px, 5.2vw, 44px); display: flex; gap: 3px; align-items: flex-end; }
.odo .cents .cell { color: #F0C271; }

.reel { display: block; }
.reel i { display: block; height: var(--dh); font-style: normal; }

/* Units of a cent: one clean notch per 0.8s — an odometer, not a slot machine.
   The static transform is what shows when motion is reduced or CSS animation
   is unavailable, so the number still reads 411,84 either way. */
.reel--fast {
  transform: translateY(calc(var(--dh) * -4));
  animation: reel-notch 8s steps(10, end) infinite;
}
/* Tens of a cent: one notch per full turn of the digit to its right, and this
   one you catch mid-roll. */
.reel--slow {
  transform: translateY(calc(var(--dh) * -8));
  animation: reel-glide 80s linear infinite;
}

@keyframes reel-notch {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(var(--dh) * -10)); }
}
@keyframes reel-glide {
  0%,  9%  { transform: translateY(0); }
  10%, 19% { transform: translateY(calc(var(--dh) * -1)); }
  20%, 29% { transform: translateY(calc(var(--dh) * -2)); }
  30%, 39% { transform: translateY(calc(var(--dh) * -3)); }
  40%, 49% { transform: translateY(calc(var(--dh) * -4)); }
  50%, 59% { transform: translateY(calc(var(--dh) * -5)); }
  60%, 69% { transform: translateY(calc(var(--dh) * -6)); }
  70%, 79% { transform: translateY(calc(var(--dh) * -7)); }
  80%, 89% { transform: translateY(calc(var(--dh) * -8)); }
  90%, 99% { transform: translateY(calc(var(--dh) * -9)); }
  100%     { transform: translateY(calc(var(--dh) * -10)); }
}

.odo-foot { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; text-align: center; max-width: 42ch; }
.odo-foot strong { color: var(--text); font-weight: 600; }

/* --- Store badge -------------------------------------------------------- */

.cta { display: grid; gap: 12px; justify-items: center; }

.badge-store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px 13px 18px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 211, 122, .38);
  background: rgba(255, 138, 0, .06);
  color: var(--gold);
  font: 600 15px/1.2 var(--body);
  letter-spacing: .01em;
}
.badge-store img { width: 32px; height: 32px; border-radius: 9px; image-rendering: pixelated; }
.badge-store small {
  display: block;
  font: 600 10.5px/1.4 var(--body);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.jump {
  font: 600 13.5px/1 var(--body);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.jump:hover { color: var(--core); }

/* ==========================================================================
   Sections
   ========================================================================== */

section { padding-block: clamp(56px, 7vw, 92px); }

.eyebrow { margin: 0 0 12px; }

h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 5.4vw, 56px);
  line-height: .98;
  letter-spacing: .01em;
  text-wrap: balance;
}

.section-head { max-width: 36rem; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head p { color: var(--muted); margin: 0; }

/* --- Stage ladder ------------------------------------------------------- */

.ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ladder li {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  text-align: center;
  padding: 22px 12px 20px;
  border-radius: 16px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(23, 18, 38, .95), rgba(11, 10, 20, .6));
}
.ladder img {
  width: 76px;
  height: 76px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 14px rgba(255, 138, 0, .3));
}
.ladder .day {
  font-family: var(--display);
  font-size: 19px;
  color: var(--core);
  letter-spacing: .06em;
}
.ladder .name { font-family: var(--display); font-size: 26px; letter-spacing: .02em; }
.ladder .tag { font-size: 13.5px; color: var(--muted); line-height: 1.45; }

/* Heat rises left to right along the ladder, like the app's stage tint. */
.ladder li:nth-child(1) .day { color: #C9A227; }
.ladder li:nth-child(2) .day { color: var(--core); }
.ladder li:nth-child(3) .day { color: var(--core); }
.ladder li:nth-child(4) .day { color: var(--hot); }
.ladder li:nth-child(5) .day { color: var(--gold); }
.ladder li:nth-child(5) { border-color: var(--edge-warm); }

/* --- Feature rows ------------------------------------------------------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .78fr);
  align-items: center;
  gap: clamp(32px, 6vw, 76px);
}
.feature + .feature { margin-top: clamp(64px, 9vw, 120px); }
.feature.flip > .shot { order: -1; }

.feature h3 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1;
}
.feature p { margin: 0 0 14px; color: var(--muted); }
.feature p:last-child { margin-bottom: 0; }
.feature strong { color: var(--text); font-weight: 600; }

/* Phone plate: a dark slab with a warm rim, no fake device chrome. */
.shot {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 320px;
  border-radius: 30px;
  padding: 8px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(255, 211, 122, .10), rgba(23, 18, 38, .5));
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 1);
}
.shot img { border-radius: 23px; width: 100%; height: auto; }
.shot::before {
  content: "";
  position: absolute;
  inset: -14% -18%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 0, .18), transparent 66%);
  filter: blur(10px);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.stat-row li { display: grid; gap: 3px; }
.stat-row b { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--gold); line-height: 1; }

/* The SOS row drops the fire entirely — same inversion the app makes. */
.feature--tide { --core: var(--tide); --gold: var(--tide); }
.feature--tide h3 { color: var(--tide); }
.feature--tide .shot {
  background: linear-gradient(180deg, rgba(63, 184, 175, .16), rgba(12, 22, 30, .6));
  border-color: rgba(63, 184, 175, .22);
}
.feature--tide .shot::before { background: radial-gradient(circle, rgba(63, 184, 175, .2), transparent 66%); }
.feature--tide .stat-row b { color: var(--tide); }

/* --- Relapse note ------------------------------------------------------- */

.note {
  border: 1px solid var(--edge);
  border-left: 3px solid var(--tide);
  border-radius: 0 18px 18px 0;
  background: linear-gradient(90deg, rgba(63, 184, 175, .07), transparent 60%);
  padding: clamp(26px, 4vw, 38px) clamp(24px, 4vw, 42px);
  max-width: 62ch;
}
.note h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(27px, 3.6vw, 38px);
  line-height: 1.02;
  color: var(--tide);
}
.note p { margin: 0; color: var(--muted); }

/* --- Habit chips -------------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(23, 18, 38, .8);
  font-size: 14.5px;
  color: var(--muted);
}
.chips li.own { border-color: var(--edge-warm); color: var(--gold); }

/* --- Pro ---------------------------------------------------------------- */

.pro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.pro-list li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; color: var(--muted); }
.pro-list li::before {
  content: "";
  width: 9px; height: 9px;
  margin-top: 9px; margin-left: 6px;
  background: var(--core);
  box-shadow: 0 0 10px rgba(255, 138, 0, .8);
}
.pro-list b { color: var(--text); font-weight: 600; }

.fineprint {
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--edge);
  font-size: 13.5px;
  line-height: 1.6;
  color: #7f7894;
  max-width: 52ch;
}

/* --- Privacy strip ------------------------------------------------------ */

.vault {
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(23, 18, 38, .7), transparent);
}
.vault h2 { max-width: 20ch; }
.vault .nos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.vault .nos li {
  font-family: var(--display);
  font-size: 25px;
  letter-spacing: .02em;
  color: var(--muted);
  padding: 6px 16px;
  border: 1px solid var(--edge);
  border-radius: 10px;
}
.vault p { color: var(--muted); max-width: 56ch; }

/* --- Closer ------------------------------------------------------------- */

.closer { text-align: center; display: grid; justify-items: center; gap: 26px; }
/* Direct child only — the store badge nested below has its own 32px icon. */
.closer > img { width: 108px; height: 108px; image-rendering: pixelated; filter: drop-shadow(0 0 24px rgba(255, 138, 0, .45)); }
.closer h2 { max-width: 18ch; }

/* ==========================================================================
   Footer
   ========================================================================== */

.foot {
  border-top: 1px solid var(--edge);
  padding-block: 40px 56px;
  color: var(--muted);
  font-size: 14px;
}
.foot-inner { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: baseline; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--edge); }
.foot a:hover { color: var(--core); border-color: var(--edge-warm); }
.foot .fine { width: 100%; margin: 22px 0 0; font-size: 12.5px; color: #6d6683; max-width: 70ch; line-height: 1.6; }

/* ==========================================================================
   Legal pages (privacy.html / terms.html) — same shell, quiet body.
   ========================================================================== */

.legal { max-width: 45rem; margin-inline: auto; padding-bottom: 40px; }
.legal-head { padding: clamp(30px, 5vw, 52px) 0 8px; }
.legal h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(42px, 7vw, 62px);
  line-height: .96;
}
.legal h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 38px);
  margin: 60px 0 6px;
  padding-top: 28px;
  border-top: 1px solid var(--edge);
  color: var(--core);
}
.legal h3 { font: 600 1.02rem/1.4 var(--body); margin: 30px 0 6px; letter-spacing: .005em; color: var(--text); }
.legal p, .legal li { color: var(--text); }
.legal .lede { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.legal .meta { color: var(--muted); font-size: .88rem; margin: 0 0 4px; }
/* Scoped to the document body so the language pills keep their own reset. */
.legal section { padding-block: 0; }
.legal section ul { padding-left: 1.15rem; }
.legal section li { margin: 6px 0; }
.legal .callout {
  background: linear-gradient(180deg, rgba(23, 18, 38, .95), rgba(11, 10, 20, .6));
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 22px 0;
}
.legal .callout p { margin: 0; }
.legal .langs { margin: 20px 0 0; padding-left: 0; }
.legal .langs a { font-size: 11.5px; letter-spacing: .06em; }
.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--forge);
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; gap: 32px; }
  .feature.flip > .shot { order: 0; }
  .shot { max-width: 290px; }
  .ladder { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .top { padding-block: 16px; }
  .mark { font-size: 23px; }
  .odo-block { width: 100%; }
  .vault .nos li { font-size: 21px; padding: 5px 12px; }
  .ladder { grid-template-columns: repeat(2, 1fr); }
  .ladder li:last-child { grid-column: span 2; }
}

/* ==========================================================================
   Reduced motion — the app's own rule: particles freeze, the odometer
   stops rolling and simply states the number.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .embers { display: none; }
  .shrine .halo,
  .shrine img,
  .reel--fast,
  .reel--slow { animation: none !important; }
  .shrine .halo { opacity: .9; }
  * { transition: none !important; }
}
