/* SideQuestr website — pixel style matching the app (same colours and font).
   No external resources: fonts, sprites and screenshots are served by us. */

@font-face {
  font-family: 'PixelOperator';
  src: url('/fonts/PixelOperator8.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'PixelOperatorBold';
  src: url('/fonts/PixelOperator8-Bold.ttf') format('truetype');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-alt: #0f3460;
  --primary: #7c3aed;
  --primary-light: #9d5cf5;
  --gold: #fbbf24;
  --gold-dark: #d97706;
  --green: #22c55e;
  --red: #ef4444;
  --text: #f9fafb;
  --muted: #9ca3af;
  --grey: #6b7280;
  --border: #374151;
  --shadow: #0a0a16;
  --max: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.7 'PixelOperator', ui-monospace, monospace;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
}

h1,
h2,
h3,
.brand,
.button,
.tag,
nav a {
  font-family: 'PixelOperatorBold', 'PixelOperator', ui-monospace, monospace;
  font-weight: normal;
  letter-spacing: 0.06em;
}

a {
  color: var(--primary-light);
}

img,
.sprite {
  image-rendering: pixelated;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
}

.brand img {
  width: 28px;
  height: 28px;
}

.site-head nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  flex-wrap: wrap;
}

.site-head nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.site-head nav a:hover {
  color: var(--text);
}

.site-head nav a.play {
  color: var(--text);
  background: var(--primary);
  border: 2px solid var(--primary-light);
  padding: 4px 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.lang {
  font-size: 12px;
  color: var(--muted);
}

.lang a,
.lang span {
  color: var(--muted);
  text-decoration: none;
  padding: 2px 6px;
  border: 2px solid transparent;
}

.lang span[aria-current] {
  color: var(--gold);
  border-color: var(--gold);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.button {
  display: inline-block;
  padding: 12px 22px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 0.05s;
}

.button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--shadow);
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary-light);
}

.button.gold {
  background: var(--gold-dark);
  border-color: var(--gold);
}

/* ─── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 56px 0 40px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  color: var(--primary-light);
  border: 2px solid var(--primary);
  padding: 2px 10px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.2;
  margin: 18px 0;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--shadow);
}

.hero p {
  color: var(--muted);
  font-size: 16px;
  max-width: 34em;
}

.cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 12px;
}

.small {
  font-size: 12px;
}

.muted {
  color: var(--grey);
}

.party {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin-top: 26px;
}

/* Idle animation of the 4-frame 16 px hero strips, scaled ×4. */
.sprite {
  display: inline-block;
  width: 64px;
  height: 64px;
  background-repeat: no-repeat;
  background-size: 256px 64px;
  animation: idle4 0.6s steps(4) infinite;
}

.sprite.rogue { background-image: url('/img/heroes/rogue.png'); }
.sprite.fighter { background-image: url('/img/heroes/fighter.png'); animation-delay: -0.15s; }
.sprite.bard { background-image: url('/img/heroes/bard.png'); animation-delay: -0.3s; }
.sprite.gladiator { background-image: url('/img/heroes/gladiator.png'); animation-delay: -0.45s; }
.sprite.wolfrider { background-image: url('/img/heroes/wolfrider.png'); }

/* The demon: 6 frames of 24 px, scaled ×3. */
.sprite.demon {
  width: 72px;
  height: 72px;
  background-image: url('/img/heroes/demon.png');
  background-size: 432px 72px;
  animation-name: idle6;
  animation-duration: 0.8s;
  animation-timing-function: steps(6);
}

/* Spinning coin: 12 frames of 16 px. */
.coin {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  background: url('/img/coin.png') 0 0 / 288px 24px no-repeat;
  image-rendering: pixelated;
  animation: coin 0.9s steps(12) infinite;
}

@keyframes idle4 { to { background-position: -256px 0; } }
@keyframes idle6 { to { background-position: -432px 0; } }
@keyframes coin { to { background-position: -288px 0; } }

@media (prefers-reduced-motion: reduce) {
  .sprite,
  .coin {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

.phone {
  justify-self: center;
  width: min(100%, 300px);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow);
  background: var(--bg);
}

.phone img {
  display: block;
  width: 100%;
  height: auto;
}

/* ─── Sections ────────────────────────────────────────────────────────────── */

section {
  padding: 48px 0;
}

section + section {
  border-top: 2px dashed var(--border);
}

section h2 {
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--text);
}

section .lead {
  color: var(--muted);
  margin: 0 0 28px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 18px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.card h3 {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--gold);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.download .card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.download .card .button {
  margin-top: auto;
}

.download .card p {
  margin-bottom: 16px;
}

.wide-shot {
  margin: 28px 0 0;
}

.wide-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 4px solid var(--border);
  box-shadow: 6px 6px 0 var(--shadow);
}

.wide-shot figcaption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.party-head {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.party-head .party {
  margin: 0 0 6px auto;
}

.card .icon {
  font-size: 20px;
  margin-bottom: 6px;
  display: block;
}

.steps {
  counter-reset: step;
}

.steps .card h3::before {
  counter-increment: step;
  content: counter(step);
  display: inline-block;
  width: 26px;
  height: 26px;
  line-height: 24px;
  text-align: center;
  margin-right: 10px;
  background: var(--primary);
  border: 2px solid var(--primary-light);
  color: var(--text);
}

.shots {
  /* Equal columns: a long caption must not widen its screenshot's column. */
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px));
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
}

.shots figure {
  margin: 0;
  min-width: 0;
  scroll-snap-align: start;
}

.shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 4px solid var(--border);
  box-shadow: 6px 6px 0 var(--shadow);
}

.shots figcaption {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}

.badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.badges span {
  font-size: 12px;
  color: var(--green);
  border: 2px solid var(--green);
  padding: 2px 10px;
}


.final {
  text-align: center;
}

.final .party {
  justify-content: center;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.site-foot {
  border-top: 2px solid var(--border);
  background: var(--surface);
  padding: 22px 0;
  font-size: 12px;
  color: var(--grey);
}

.site-foot .wrap {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.site-foot a {
  color: var(--muted);
}

.site-foot .right {
  margin-left: auto;
}

/* ─── Legal pages ─────────────────────────────────────────────────────────── */

.doc {
  max-width: 760px;
  padding: 40px 16px 64px;
  margin: 0 auto;
}

.doc h1 {
  color: var(--gold);
  font-size: 26px;
}

.doc h2 {
  font-size: 16px;
  margin-top: 30px;
  color: var(--primary-light);
}

.doc p,
.doc li,
.doc dd {
  color: #d1d5db;
}

.doc dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 18px;
}

.doc dt {
  color: var(--muted);
}

.doc dd {
  margin: 0;
}

.doc .updated {
  color: var(--grey);
  font-size: 12px;
}

/* ─── Small screens ───────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .hero,
  .split {
    grid-template-columns: 1fr;
  }
  .hero {
    padding-top: 32px;
  }
  .site-head nav {
    gap: 12px;
    margin-left: 0;
    width: 100%;
    padding-bottom: 8px;
  }
  .site-head nav a:not(.play) {
    display: none;
  }
  .site-head nav .lang {
    margin-left: auto;
  }
  /* Phones: swipe through equally wide screenshots. */
  .shots {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 62%;
    justify-content: start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .doc dl {
    grid-template-columns: 1fr;
  }
  .doc dd {
    margin-bottom: 8px;
  }
}

/* Even rows: 8 features / 4 steps in 4 columns, 3 cards in 3. */
.grid.four {
  grid-template-columns: repeat(4, 1fr);
}
.grid.three {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 960px) {
  .grid.four,
  .grid.three {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .grid.four,
  .grid.three {
    grid-template-columns: 1fr;
  }
}
