/* SpriteFall - site styles. Hand written, no framework, no build step, no CDN.
 *
 * The app is pixel art, so the page is built out of hard edges: 2px borders, no
 * blur on any shadow, 2px corner radii, and a stepped "pixel rule" instead of an
 * <hr>. Art is `image-rendering: pixelated` everywhere so a 128px-wide render
 * blown up to 400px still lands on whole pixels - a smoothed pixel scene is the
 * one thing that would make the site lie about the product.
 *
 * Headings use the system monospace stack. There is no webfont on purpose: a
 * genuine pixel face would be either a licence problem or a 30KB download, and
 * the monospace stack already reads as "made of a grid" on every platform.
 */

/* ---------- tokens ---------- */
:root {
  color-scheme: dark light;

  /* The palette is the app's own "Hollow" palette, read out of Palette.kt:
     the night sky it starts the day in, the lamp light in the windows, the
     terracotta roof, the hills and the trees. */
  --sky-night:  #0b1026;
  --sky-low:    #1b2a4a;
  --lamp:       #ffd98a;
  --sky-day:    #6fbee3;
  --terracotta: #e0725c;
  --wall:       #d9c7a8;
  --hill:       #6b8a86;
  --tree:       #3f6b42;

  --radius: 2px;
  --maxw:   1120px;
  --gap:    clamp(18px, 3vw, 28px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  /* dark is the default: a wallpaper app is looked at in the dark */
  --bg:        #0b1026;
  --bg-soft:   #111833;
  --bg-card:   #161f3d;
  --bg-sunk:   #080c1d;
  --line:      #27325e;
  --line-soft: #1b2446;
  --text:      #e9eefa;
  --muted:     #9cabcc;
  --accent:    #ffd98a;
  --on-accent: #1d1403;
  --accent-2:  #6fbee3;
  --accent-3:  #ff8e74;
  --shadow:    4px 4px 0 #050812;
  --shadow-lg: 8px 8px 0 #050812;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Paper and ink: the same scene drawn at midday. */
    --bg:        #f6f2e7;
    --bg-soft:   #ece5d4;
    --bg-card:   #fffdf7;
    --bg-sunk:   #e2d9c4;
    --line:      #c9bda2;
    --line-soft: #ded3bb;
    --text:      #1a2033;
    --muted:     #58607a;
    --accent:    #9a4526;
    --on-accent: #fff6ec;
    --accent-2:  #1f6a90;
    --accent-3:  #8c3f28;
    --shadow:    4px 4px 0 #c9bda2;
    --shadow-lg: 8px 8px 0 #c9bda2;
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img, svg, canvas, video { max-width: 100%; display: block; }
/* every bit of art in here is pixel art, including the icon */
img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
/* ...except art that is deliberately smooth (the Play badge is vector-ish) */
img.smooth { image-rendering: auto; }

a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--mono);
  line-height: 1.1;
  margin: 0 0 .6em;
  font-weight: 700;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2rem, 7vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: 1.12rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
p { margin: 0 0 1em; }

code, kbd, .mono {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--bg-sunk);
  border: 1px solid var(--line-soft);
  padding: .1em .38em;
  border-radius: var(--radius);
}
pre { overflow-x: auto; background: var(--bg-sunk); border: 2px solid var(--line); padding: 14px 16px; }
pre code { background: none; border: 0; padding: 0; }

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

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 740px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

section { padding: clamp(48px, 7vw, 86px) 0; }
section.tight { padding: clamp(32px, 4vw, 54px) 0; }
section.alt { background: var(--bg-soft); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }

.section-head { max-width: 680px; margin: 0 auto clamp(28px, 4vw, 46px); text-align: center; }
.section-head p { color: var(--muted); margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border: 2px solid var(--text); font-family: var(--mono);
}
.skip-link:focus { top: 12px; }

/* A stepped divider: eight blocks, like a sprite edge. */
.pixel-rule {
  border: 0; height: 8px; margin: clamp(32px, 5vw, 58px) auto;
  max-width: 320px;
  background-image:
    linear-gradient(90deg, var(--line) 25%, transparent 25% 50%, var(--line) 50% 75%, transparent 75%);
  background-size: 16px 4px;
  background-repeat: repeat-x;
  background-position: 0 0, 4px 4px;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) {
  .nav { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); }
}
.nav-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-weight: 700; color: var(--text); text-decoration: none;
}
.nav-logo img { width: 28px; height: 28px; border: 1px solid var(--line); }
.nav-links { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); font-size: .94rem; text-decoration: none; font-family: var(--mono); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-toggle {
  display: none; margin-left: auto; cursor: pointer;
  background: none; border: 2px solid var(--line); color: var(--text);
  border-radius: var(--radius); padding: 6px 11px; font-size: 1rem;
}
@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; align-items: stretch;
    background: var(--bg-soft); border-bottom: 2px solid var(--line); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 20px; border-top: 1px solid var(--line-soft); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono); font-weight: 700; font-size: 1rem; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--text);
  box-shadow: var(--shadow);
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--bg-sunk); text-decoration: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--bg-sunk); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { border-color: var(--text); box-shadow: var(--shadow); }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover, .btn:active { transform: none; }
}

/* The Play badge is Google's artwork, reproduced here as an inline SVG so the
   page keeps its promise of no third-party requests. */
.play-badge { height: 56px; width: auto; border: 0; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 2px solid var(--line); min-height: min(90vh, 820px); display: grid; align-items: center; }
.hero-art { position: absolute; inset: 0; z-index: 0; }
.hero-art img, .hero-art canvas { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  /* Always a dark scrim, in both colour schemes: the art underneath is a night
     sky and the copy on top of it is light. Only the last tenth fades to the
     page colour so the hero does not stop on a hard edge. */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(125% 80% at 50% 26%, rgba(5,8,20,.12) 0%, rgba(5,8,20,.55) 66%, rgba(5,8,20,.8) 100%),
    linear-gradient(to bottom, rgba(5,8,20,.55) 0%, rgba(5,8,20,.05) 26%,
                    rgba(5,8,20,.05) 66%, rgba(5,8,20,.55) 90%, var(--bg) 100%);
}
.hero-inner {
  /* the art underneath is a night sky in either colour scheme, so this subtree
     keeps the dark-mode tokens and everything inside it follows */
  --text: #e9eefa;
  --muted: #c9d4ea;
  --accent: #ffd98a;
  --on-accent: #1d1403;
  --line: rgba(233,238,250,.34);
  --bg-card: rgba(8,11,26,.5);
  color: var(--text);
  position: relative; z-index: 2; text-align: center;
  /* 20px sides, not 0: this element also carries .wrap, and a `padding`
     shorthand here would wipe the wrap's horizontal padding out. */
  padding: clamp(56px, 10vw, 110px) 20px clamp(40px, 6vw, 72px);
}
.hero h1 { margin-bottom: .3em; text-shadow: 3px 3px 0 rgba(0,0,0,.55); }
.hero .kicker {
  font-family: var(--mono); font-size: .82rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1.2em;
}
.hero-sub {
  max-width: 44ch; margin: 0 auto 1.8em;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  text-shadow: 2px 2px 0 rgba(0,0,0,.45);
}
.hero-note { margin: 1.6em 0 0; font-size: .85rem; color: var(--muted); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.pill {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .06em;
  padding: 5px 10px; border: 2px solid var(--line); background: var(--bg-card); color: var(--muted);
  border-radius: var(--radius);
}

/* ---------- cards + grids ---------- */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }

.card {
  background: var(--bg-card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { margin-bottom: .35em; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .ico {
  font-family: var(--mono); font-size: 1.1rem; line-height: 1;
  width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 14px;
  border: 2px solid var(--line); background: var(--bg-sunk); color: var(--accent);
}
.card .pro-tag {
  float: right; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
  padding: 3px 7px; border: 2px solid var(--accent); color: var(--accent); border-radius: var(--radius);
}

.split { display: grid; gap: clamp(26px, 5vw, 56px); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 880px) { .split { grid-template-columns: 1.05fr .95fr; } }

.ticks { list-style: none; padding: 0; margin: 0 0 1.4em; }
.ticks li { position: relative; padding-left: 28px; margin-bottom: .5em; }
.ticks li::before {
  content: "▪"; position: absolute; left: 6px; top: 0;
  color: var(--accent); font-family: var(--mono);
}
.ticks li.no { color: var(--muted); }
.ticks li.no::before { content: "·"; color: var(--muted); }

/* A canvas inserted by js/site.js lies exactly over the <img> it replaces.
   The image stays in the flow (visibility: hidden) so the box keeps its size
   whether or not the renderer ever ran. */
.sf-live { position: absolute; inset: 0; width: 100%; height: 100%; }
.tile-art, .phone-screen { position: relative; }
.tile-art img { width: 100%; height: auto; display: block; }

/* ---------- scene showcase ---------- */
.scene-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.scene-tile { margin: 0; border: 2px solid var(--line); background: var(--bg-sunk); border-radius: var(--radius); }
.scene-tile img { width: 100%; height: auto; }
.scene-tile figcaption {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-family: var(--mono); font-size: .82rem;
  padding: 9px 11px; border-top: 2px solid var(--line); background: var(--bg-card);
}
.scene-tile figcaption b { font-weight: 700; }
.scene-tile figcaption span { color: var(--muted); font-size: .72rem; letter-spacing: .08em; }

/* A phone-ish frame, drawn in CSS - no device photos to licence. */
.phone {
  width: min(300px, 78vw); margin: 0 auto;
  border: 3px solid var(--text); border-radius: 18px; padding: 8px;
  background: var(--bg-sunk); box-shadow: var(--shadow-lg);
}
.phone-screen { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 9 / 19.5; background: #000; }
.phone-screen img, .phone-screen canvas { width: 100%; height: 100%; object-fit: cover; }
.phone-notch {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50%; background: #05070d; z-index: 3;
}
.phone-ui {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--mono); color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.6);
}
.phone-ui .status { width: 100%; display: flex; justify-content: space-between; padding: 6px 12px; font-size: .58rem; opacity: .9; }
.phone-ui .clock { margin-top: 14%; text-align: center; }
.phone-ui .clock b { display: block; font-size: 2rem; line-height: 1; }
.phone-ui .clock span { font-size: .6rem; opacity: .85; }
.phone-ui .dock { margin-top: auto; display: flex; gap: 10px; padding-bottom: 14px; }
.phone-ui .dock i { width: 22px; height: 22px; border-radius: 5px; background: rgba(255,255,255,.26); border: 1px solid rgba(255,255,255,.3); }

/* ---------- compare table ---------- */
.compare { width: 100%; border-collapse: collapse; font-size: .95rem; }
.compare caption { text-align: left; color: var(--muted); font-size: .88rem; padding-bottom: 10px; }
.compare th, .compare td { border: 2px solid var(--line); padding: 11px 13px; text-align: left; vertical-align: top; }
.compare thead th { background: var(--bg-sunk); font-family: var(--mono); font-size: .86rem; }
.compare tbody th { font-weight: 600; background: var(--bg-card); }
.compare td { background: var(--bg-card); }
.compare .y { color: var(--accent); font-family: var(--mono); font-weight: 700; }
.compare .n { color: var(--muted); font-family: var(--mono); }
.compare-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.price-card { background: var(--bg-card); border: 2px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; }
.price-card.featured { border-color: var(--accent); box-shadow: var(--shadow); }
.price-card .price { font-family: var(--mono); font-size: 2.1rem; font-weight: 700; margin: 0 0 .1em; }
.price-card .price-note { color: var(--muted); font-size: .88rem; margin-bottom: 1.2em; }

/* ---------- faq ---------- */
.faq { border: 2px solid var(--line); border-radius: var(--radius); background: var(--bg-card); margin-bottom: 12px; }
.faq summary {
  cursor: pointer; padding: 14px 16px; font-family: var(--mono); font-weight: 700; font-size: .98rem;
  list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq[open] summary::after { content: "\2212"; }
.faq > *:not(summary) { padding: 0 16px; }
.faq > p:last-child { padding-bottom: 14px; margin-bottom: 0; }

/* ---------- prose pages ---------- */
.page-head { border-bottom: 2px solid var(--line); background: var(--bg-soft); padding: clamp(34px, 6vw, 62px) 0 clamp(26px, 4vw, 40px); }
/* the prose pages are a 70ch column; the page title lines up with it */
.page-head .wrap { max-width: min(var(--maxw), 70ch); }
.page-head h1 { margin-bottom: .2em; }
.page-meta { color: var(--muted); font-family: var(--mono); font-size: .85rem; margin: 0; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 2em; font-size: 1.35rem; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .94rem; }
.prose th, .prose td { border: 2px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-sunk); font-family: var(--mono); font-size: .88rem; }
.callout {
  border: 2px solid var(--accent); border-left-width: 8px; background: var(--bg-card);
  padding: 14px 18px; margin: 1.6em 0; border-radius: var(--radius);
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- press kit ---------- */
.copyblock {
  position: relative; background: var(--bg-sunk); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px;
  font-family: var(--mono); font-size: .92rem; white-space: pre-wrap;
}
.copyblock .len {
  position: absolute; top: -11px; right: 10px;
  background: var(--bg); border: 2px solid var(--line); padding: 0 7px;
  font-size: .68rem; letter-spacing: .08em; color: var(--muted);
}
.asset-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.asset { border: 2px solid var(--line); background: var(--bg-card); border-radius: var(--radius); padding: 12px; }
.asset img { width: 100%; height: auto; border: 1px solid var(--line-soft); margin-bottom: 9px; background: var(--bg-sunk); }
.asset b { display: block; font-family: var(--mono); font-size: .82rem; }
.asset span { color: var(--muted); font-size: .76rem; font-family: var(--mono); }

/* ---------- 404 ---------- */
.lost { min-height: 62vh; display: grid; place-items: center; text-align: center; }
.lost .code { font-family: var(--mono); font-size: clamp(3.4rem, 16vw, 7rem); line-height: 1; color: var(--accent); margin: 0; }

/* ---------- footer ---------- */
footer { border-top: 2px solid var(--line); background: var(--bg-soft); padding: 46px 0 30px; font-size: .94rem; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: .45em; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  color: var(--muted); font-family: var(--mono); font-size: .8rem;
}

/* ---------- scanline overlay: the app's own CRT look, used sparingly ----------
   The host must already be positioned. This rule deliberately does NOT set
   `position: relative` itself: .hero-art is absolute, and a later single-class
   rule setting it back to relative is exactly what dropped the hero copy out
   from over the art. */
.scanlines::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ---------- small utilities (so the pages carry no inline style attribute,
   which lets the CSP stay `style-src 'self'` with no unsafe-inline) ---------- */
.mt-1 { margin-top: 14px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 26px; }
.m0   { margin: 0; }
.col-narrow { max-width: 760px; margin: 28px auto 0; }
.footer-blurb { max-width: 320px; margin-top: 12px; font-size: .92rem; }
.copy-btn { margin: -8px 0 20px; padding: 6px 12px; font-size: .78rem; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
