/* Dark only: the fire reads best on it. Tokens follow the app's dark theme (crates/ui/src/theme.rs). */
:root {
  color-scheme: dark;
  --bg: hsl(29 4% 8%);
  --card: hsl(25 2% 12.5%);
  --text: hsl(0 0% 96%);
  --muted: hsl(230 4% 60%);
  --border: rgb(255 255 255 / 0.08);
  --track: rgb(255 255 255 / 0.07);
  --hover: rgb(255 255 255 / 0.14);
  --rim: hsl(32 50% 85% / 0.3);
  --highlight: rgb(255 255 255 / 0.09);
  --button: hsl(0 0% 96%);
  --on-button: hsl(240 5% 12%);
  --glass: hsl(25 3% 15% / 0.72);
  --glass-edge: rgb(255 255 255 / 0.14);
  --glass-shine: rgb(255 255 255 / 0.28);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); overflow-x: clip; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The icon and name, in the header and the footer. */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
/* The icon's own margin makes it look inset: pull it back so it lines up with the edge. */
.brand img { display: block; margin-left: -3px; }

.bar nav { display: flex; align-items: center; gap: 18px; }
.bar nav > a { color: var(--muted); font-size: 15px; text-decoration: none; transition: color 0.12s; }
.bar nav > a:hover { color: var(--text); }

/* A full-width glass bar that stays on top while the page (and the fire) scrolls under it. Its content lines up
   with the page's columns. */
.bar {
  --side: max(24px, (100% - 1032px) / 2);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* The glass runs up under the notch and the status bar (viewport-fit=cover), with the content below them. */
  padding:
    calc(10px + env(safe-area-inset-top))
    calc(var(--side) + env(safe-area-inset-right))
    10px
    calc(var(--side) + env(safe-area-inset-left));
  background: linear-gradient(180deg, rgb(255 255 255 / 0.09), rgb(255 255 255 / 0.03));
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  box-shadow: inset 0 -1px 0 var(--border), inset 0 1px 0 rgb(255 255 255 / 0.06);
}

/* The fire is a canvas around the window, in the page's flow, so it scrolls with the window (also while
   the page rubber-bands) instead of being pinned to the screen. */
.stage {
  position: relative;
  width: min(880px, 100%);
  margin: clamp(70px, 10vw, 120px) auto 0;
}

/* A soft wallpaper behind the window, in the fire's colors: depth, and a reason for the window's glass.
   Below the fire (it comes first in the stage). */
.glow {
  position: absolute;
  inset: -80px -150px -90px;
  background:
    radial-gradient(60% 70% at 18% 75%, hsl(14 75% 30% / 0.6), transparent 70%),
    radial-gradient(55% 60% at 85% 30%, hsl(18 80% 42% / 0.45), transparent 70%),
    radial-gradient(50% 50% at 55% 100%, hsl(22 85% 34% / 0.5), transparent 70%);
  filter: blur(50px);
  opacity: 0.8;
  pointer-events: none;
}

#fire {
  position: absolute;
  left: -220px;
  top: -320px;
  width: calc(100% + 440px);
  height: calc(100% + 540px);
  pointer-events: none;
}

main, footer { position: relative; }

/* The fire and the glow reach past the page on purpose: clip them here, or phones scroll sideways. */
main { padding: 0 24px; overflow-x: clip; }

.hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 88px 0 0;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 650;
  text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, hsl(30 12% 74%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  margin: 20px auto 0;
  max-width: 30em;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 20px);
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  background: var(--button);
  color: var(--on-button);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 6px 24px rgb(0 0 0 / 0.35);
  transition: opacity 0.12s;
}
.button.small { padding: 7px 16px; font-size: 14px; }
.button:hover { opacity: 0.85; }
.button:active { opacity: 0.7; }
/* Until there is a download: a quiet glass capsule that does nothing. */
.button:disabled {
  border: 0;
  font-family: inherit;
  cursor: default;
  background: var(--glass);
  color: var(--muted);
  opacity: 1;
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 var(--glass-shine);
}

/* The app window: a screenshot with its own rounded corners, with the fire drawn behind it by fire.js. */
.window {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8.6px; /* the screenshot's corners, read by fire.js for the edge of the flames */
  filter: drop-shadow(0 40px 60px rgb(0 0 0 / 0.5));
}

/* Below the hero: a lighter sheet that rises over it, one scene per feature. Each scene is a centered headline and a
   piece of the app, with no boxes round it. Flat colors, no gradients. */
.sheet {
  --round: 36px;
  position: relative;
  z-index: 1; /* above the band that follows, which starts behind its rounded corners */
  margin-top: 120px;
  padding: 120px 24px;
  border-radius: var(--round);
  background: hsl(28 5% 11%);
  box-shadow: inset 0 1px 0 var(--highlight);
  overflow-x: clip; /* the fire reaches past the page */
}

/* The tour: a flat band in a cooler color, tucked behind the sheet above, so the two read as separate sections. */
.sheet.band {
  z-index: 0;
  margin-top: calc(-1 * var(--round));
  padding-top: calc(var(--round) + 88px);
  padding-bottom: 96px;
  border-radius: 0;
  background: hsl(225 20% 10%);
  box-shadow: none;
}
.band .shots::before { display: none; }

.features { display: grid; gap: 160px; width: min(1032px, 100%); margin: 0 auto; scroll-margin-top: 40px; }

.scene { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
.scene h2 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 44px);
  line-height: 1.08;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, hsl(30 12% 74%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scene p { max-width: 32em; margin: 16px 0 0; color: var(--muted); font-size: clamp(17px, 2.2vw, 20px); text-wrap: balance; }
.scene .visual { position: relative; width: 100%; margin-top: 56px; }

/* The compact scenes: the text beside its graphic, alternating sides. */
.scene.split { grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; text-align: left; }
.scene.split .copy { justify-self: start; max-width: 440px; }
.scene.split.flip .copy { order: 2; justify-self: end; text-align: right; }
.scene.split.flip p { margin-left: auto; }
/* Both pieces of a scene sit against the page's edges, so the whole stays balanced. */
.scene.split .rules { margin-left: 0; }
.scene.split:not(.flip) .prompt-stage { margin-right: 0; }
.scene.split p { margin-left: 0; }
.scene.split .visual { margin-top: 0; }

/* A hand-drawn style arrow from the title down to the window. Only where there is room beside the title. */
.tour h2 { position: relative; }
.arrow { position: absolute; left: calc(100% + 16px); top: 6px; width: 180px; height: 130px; fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1000px) { .arrow { display: none; } }

/* 4. The tour: quiet tabs (a chip like the app's sidebar icons and a name) over the app's pages, crossfading. */
.tour .visual { margin-top: 32px; }
.tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s, background-color 0.12s;
}
.tabs button:hover { color: var(--text); background: var(--track); }
.tabs button:active { background: var(--hover); }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--hover); }
.tabs i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(160deg, var(--a), var(--b)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3); }
.tabs svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* The screenshots lie on top of each other; the chosen one shows. The first shows without script. */
.shots { position: relative; width: min(720px, 100%); margin: 0 auto; }
.shots::before { /* a warm light behind the window */
  content: "";
  position: absolute;
  inset: 8% -6% -10%;
  background: radial-gradient(60% 60% at 50% 50%, hsl(18 80% 42% / 0.3), transparent 70%);
  filter: blur(40px);
}
.shots img { position: absolute; inset: 0; display: block; width: 100%; height: auto; opacity: 0; filter: drop-shadow(0 30px 50px rgb(0 0 0 / 0.5)); transition: opacity 0.4s; }
.shots img:first-child { position: relative; } /* gives the stack its size */
.shots:not(.live) img:first-child { opacity: 1; }
.shots img.on { opacity: 1; }

/* The last call, on the plain background again. */
.cta { padding: 120px 24px 0; }
.cta img { margin-bottom: 28px; filter: drop-shadow(0 12px 30px hsl(18 80% 45% / 0.35)); }
.cta .button { margin-top: 32px; }

/* 1. A cut out of the screenshot (the top apps list), large, fading out at the bottom. Its box has the cut's shape. */
.crop-wrap { position: relative; }
.crop-wrap::before { /* a warm light behind the cut */
  content: "";
  position: absolute;
  inset: 10% -4% -10%;
  background: radial-gradient(60% 60% at 50% 50%, hsl(18 80% 42% / 0.35), transparent 70%);
  filter: blur(40px);
}
.crop {
  --x: 0.2; --y: 0.55; --w: 0.77; --h: 0.44;
  position: relative;
  aspect-ratio: 1355 / 512; /* the cut's width and height in the screenshot's pixels (w and h above) */
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 0 0 1px var(--glass-edge);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.crop img {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / var(--w));
  max-width: none;
  transform: translate(calc(var(--x) * -100%), calc(var(--y) * -100%));
}
/* Icon tiles, like the app's: a gradient and a lift. */
.tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  background: linear-gradient(160deg, var(--a), var(--b));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 4px 12px rgb(0 0 0 / 0.3);
}
.tile svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* The app's own icon, as on the real prompt. */
.app-icon { flex: none; width: 70px; height: 70px; margin: -7px; /* the icon's art has 10% margin: its visible size matches the 56px tile */ filter: drop-shadow(0 4px 8px rgb(0 0 0 / 0.35)); }

/* 2. The approval prompt, with the same fire around it as the real one. The canvas reaches past it, for the flames. */
.prompt-stage { position: relative; width: min(400px, 100%); margin: 70px auto 0; }
.prompt-stage canvas { position: absolute; left: -140px; top: -170px; width: calc(100% + 280px); height: calc(100% + 290px); pointer-events: none; }
.prompt {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border-radius: 28px;
  text-align: left;
  background:
    linear-gradient(180deg, hsl(25 95% 55% / 0.16), transparent 100px),
    hsl(230 6% 13%);
  box-shadow: 0 0 0 1px hsl(32 50% 85% / 0.25), inset 0 1px 0 var(--highlight), 0 30px 70px rgb(0 0 0 / 0.55);
}
.prompt .route { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.prompt .dashes { flex: 1; height: 2px; border-radius: 1px; background: repeating-linear-gradient(90deg, rgb(255 255 255 / 0.28) 0 6px, transparent 6px 12px); }
.prompt strong { font-size: 17px; line-height: 1.3; font-weight: 700; }
.prompt code { color: var(--muted); font: 11px/1.4 Menlo, ui-monospace, monospace; }
.answers { display: flex; gap: 8px; margin-top: 18px; }
/* Pill buttons, both alike, as on the real prompt. */
.answers span {
  flex: 1;
  padding: 11px 0;
  border-radius: 999px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  background: rgb(255 255 255 / 0.12);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1);
}
.answers .primary { font-weight: 600; }

/* 3. The rules page: the app, where it connects, the shield with what happens. One shield keeps flipping. */
.rules {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 4px;
  text-align: left;
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--border), inset 0 1px 0 var(--highlight), 0 30px 80px rgb(0 0 0 / 0.5);
}
.rules-head, .rule { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 96px; align-items: center; gap: 12px; padding: 0 14px; }
.rules-head { padding-top: 10px; padding-bottom: 6px; color: var(--muted); font-size: 12px; }
.rules-head span:nth-child(3) { text-align: right; }
.rule { min-height: 56px; border-radius: 8px; }
.rule + .rule { box-shadow: inset 0 1px 0 var(--border); }
.app { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; }
.app img { flex: none; width: 36px; height: 36px; }
.app b { display: block; font-weight: 500; }
.app small { display: none; }
.dest { color: var(--muted); font-size: 14px; }
.act { display: grid; justify-items: end; }

/* The shield of the app: its outline and what it does (a tick, a slash), lit in the color of the action. */
.shield { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.shield svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 8.5; stroke-linecap: round; stroke-linejoin: round; }
.shield.allow { color: hsl(137 55% 62%); background: hsl(137 55% 62% / 0.12); }
.shield.block { color: hsl(0 72% 64%); background: hsl(0 72% 64% / 0.12); }
.swap { display: grid; justify-items: end; }
.swap .shield { grid-area: 1 / 1; }
.swap .block { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .swap .allow { animation: allowed 6s ease-in-out infinite; }
  .swap .block { animation: blocked 6s ease-in-out infinite; }
}
@keyframes allowed { 0%, 38% { opacity: 1; } 46%, 88% { opacity: 0; } 96%, 100% { opacity: 1; } }
@keyframes blocked { 0%, 38% { opacity: 0; } 46%, 88% { opacity: 1; } 96%, 100% { opacity: 0; } }


footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(1032px, 100% - 48px);
  margin: 120px auto 0;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
footer .brand { color: var(--muted); font-weight: 400; gap: 8px; }
footer .brand img { margin-left: -2px; }
footer a { color: var(--muted); text-decoration: none; transition: color 0.12s; }
footer a:hover { color: var(--text); }

/* One quiet entrance, for the text only: the window stays put, as the fire follows its position. */
@media (prefers-reduced-motion: no-preference) {
  h1, .lead, .actions { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .lead { animation-delay: 0.08s; }
  .actions { animation-delay: 0.16s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 720px) {
  body { font-size: 16px; }
  main { padding: 0 20px; }
  .bar { --side: 20px; }
  .bar .button { display: none; } /* the hero button is right below */
  footer { width: calc(100% - 40px); margin-top: 88px; }
  .hero { padding-top: 80px; }
  h1 { font-size: 46px; line-height: 1.05; }
  .lead { margin-top: 18px; font-size: 18px; line-height: 1.45; }
  .actions { margin-top: 28px; }
  .stage { margin-top: 150px; }
  .glow { inset: -60px -40px -70px; }
  .window { border-radius: calc((100vw - 40px) * 0.0098); }
  .sheet { --round: 28px; margin-top: 80px; padding: 72px 20px; }
  .cta { padding: 96px 20px 0; }
  .tabs { justify-content: flex-start; margin: 0 -20px 24px; padding: 0 20px; }
  .sheet.band { padding-top: calc(var(--round) + 64px); padding-bottom: 56px; }
  .features { gap: 104px; }
  .scene.split, .scene.split.flip { grid-template-columns: minmax(0, 1fr); gap: 0; text-align: center; }
  .scene.split .copy, .scene.split.flip .copy { order: 0; justify-self: center; text-align: center; }
  .scene.split .rules { margin-left: auto; }
  .scene.split:not(.flip) .prompt-stage { margin-right: auto; }
  .scene.split p { margin-left: auto; }
  .scene.split .visual { margin-top: 40px; }
  .rules-head { display: none; }
  .rule { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 0 10px; }
  .rule .dest { display: none; }
  .app small { display: block; color: var(--muted); font-size: 12px; }
  .shield { padding: 0 8px 0 6px; font-size: 13px; }
  .scene .visual { margin-top: 40px; }
  .crop-wrap { margin: 40px -8px 0; width: calc(100% + 16px); }
  /* A narrower cut, so the rows stay readable (the activity charts are left out). */
  .crop { --w: 0.5; aspect-ratio: 880 / 512; }
  .prompt-stage { margin-top: 90px; }
  .prompt-stage canvas { left: -60px; width: calc(100% + 120px); }
}
