:root {
  --ink: #000;
  --paper: #fff;
  --blue: #271ae9;
  --magenta: #f822e8;
  --gutter: 16px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.4 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { color: var(--blue); }
a:focus-visible { outline: 1px solid var(--blue); outline-offset: 3px; }

/* ── ticker ─────────────────────────────────────────── */

.ticker {
  overflow: hidden;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .01em;
  padding: 6px 0;
}

.ticker-track {
  display: inline-block;
  animation: ticker var(--ticker-dur, 40s) linear infinite;
  will-change: transform;
}

.ticker:hover .ticker-track { animation-play-state: paused; }

@keyframes ticker {
  to { transform: translateX(-50%); }
}

/* ── banner ─────────────────────────────────────────── */

.banner {
  position: relative;
  margin: 0 var(--gutter);
  height: clamp(140px, 19vw, 300px);
  background: var(--blue);
  overflow: hidden;
}

.banner canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.banner-pixels { image-rendering: pixelated; }

/* pixel banner palettes — read by main.js. Use 6-digit hex. */
.banner[data-style="pixel"] {
  --px-bg: #271ae9;
  --px-cloud: #ffffff; /* clouds fade from --px-bg half-way toward this */
  background: var(--px-bg);
}
.banner[data-style="pixel"][data-palette="mono"] {
  --px-bg: #000000;
}
/* white sky, whitish-grey clouds */
.banner[data-style="pixel"][data-palette="sky"] {
  --px-bg: #ffffff;
  --px-cloud: #8c8c8c;
}
.banner[data-palette="sky"] .banner-word {
  left: 0;
  bottom: 0;
  padding: 3px 7px;
  background: var(--ink);
}
.banner[data-palette="mono"] .banner-word {
  left: 0;
  bottom: 0;
  padding: 3px 7px;
  background: var(--paper);
  color: var(--ink);
}

.banner-word {
  position: absolute;
  left: 12px;
  bottom: 9px;
  color: var(--paper);
  letter-spacing: .08em;
  font-size: 12px;
}
.banner-word:hover { color: var(--paper); }

/* speakers: whole speakers spaced evenly across the strip, scaled with crisp pixels */
.banner[data-style="speakers"] {
  /* swap in assets/speaker.gif for the grey vibrating one */
  --speaker: url("assets/speaker-black.gif");
  height: clamp(84px, 19vw, 300px); /* shorter on phones so ~4 speakers still fit */
  background: var(--paper) var(--speaker) center / auto 100% space no-repeat;
  image-rendering: pixelated;
}
.banner[data-style="speakers"] canvas { display: none; }
.banner[data-style="speakers"] .banner-word {
  left: 0;
  bottom: 0;
  padding: 3px 7px;
  background: var(--ink);
}

/* ── nav ────────────────────────────────────────────── */

.nav {
  display: flex;
  justify-content: space-around;
  width: min(100% - 2 * var(--gutter), 900px);
  margin: 4px auto 0;
  text-transform: uppercase;
}

.nav a { padding: 4px 8px; }
.nav a[aria-current="page"] { color: var(--blue); }

/* ── views ──────────────────────────────────────────── */

main {
  flex: 1;
  padding: 72px var(--gutter) 96px;
}

.view { display: none; }
.view.is-active { display: block; animation: fade .4s ease both; }

@keyframes fade {
  from { opacity: 0; }
}

/* store */

.store-item + .store-item { margin-top: 128px; }
/* offset each product's fade so one star dims as the other brightens */
.store-item:nth-child(2) .rollover-star { animation-delay: -1.5s; }

.rollover {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: 966 / 617;
  margin: 0 auto;
}

.rollover img { position: absolute; display: block; }
.rollover-mark { inset: 0; width: 100%; height: 100%; }

/* numbers come from tools/make_logo.py (assets/rollover-star.json) */
.rollover-star {
  left: 68.53%;
  top: 6.483%;
  width: 17.598%;
  animation: twinkle 3s ease-in-out infinite;
}

/* a slow, soft fade out and back in */
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50%      { opacity: .12; }
}

.product {
  max-width: 420px;
  margin: 48px auto 0;
  text-align: center;
}

.product p { margin: 0 0 6px; }
.meta { text-transform: uppercase; font-size: 11px; }
.price { font-size: 15px; margin-top: 18px !important; }

.buy {
  display: inline-block;
  margin-top: 14px;
  padding: 9px 22px;
  border: 1px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .15s, color .15s, border-color .15s;
}
.buy:hover, .buy:focus-visible {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper);
}

/* free */

.list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 900px;
}

.list li {
  display: grid;
  /* fixed format/download columns so every row's text lines up */
  grid-template-columns: 1fr 2fr 9em 7em;
  gap: 24px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--ink);
}
.list li:last-child { border-bottom: 1px solid var(--ink); }

.list .name, .list a { text-transform: uppercase; }
.list .fmt { font-size: 11px; }
.list li > a { justify-self: end; }

.note {
  max-width: 900px;
  margin: 18px auto 0;
}

/* about */

.about {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}
.about-mark { display: block; margin: 0 auto 24px; image-rendering: pixelated; }

/* ── footer ─────────────────────────────────────────── */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 var(--gutter) 24px;
  text-transform: uppercase;
}
.footer small { font-size: 10px; }

.theme-toggle {
  font: inherit;
  font-size: 15px;
  line-height: 1;
  color: inherit;
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
}
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--blue); }

/* ── dark mode: invert everything ───────────────────── */
/* Each section is inverted on its own rather than the whole <html>, so the
   Lemon Squeezy checkout overlay (appended to <body>) stays un-inverted and
   still covers the viewport. hue-rotate keeps the blue accent blue. */

html.dark { color-scheme: dark; }
html.dark body { background: var(--ink); }
html.dark body > :is(.ticker, .banner, .nav, main, .footer) {
  filter: invert(1) hue-rotate(180deg);
}

/* ── small screens ──────────────────────────────────── */

@media (max-width: 600px) {
  main { padding-top: 48px; }
  .list li {
    grid-template-columns: 1fr auto;
    gap: 2px 16px;
  }
  .list .desc { grid-column: 1 / -1; grid-row: 2; }
  .list .fmt { grid-row: 1; grid-column: 2; }
  .list a { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track, .rollover-star, .view.is-active { animation: none; }
}
