/* Flippy Walls — un sol full d'estil, sense JS.
   Colors: els del joc (`src/game/theme.gd`): el tema r7 (cel, maó, lava) i els
   tokens d'interfície UI (tinta, targeta, or). La UI del joc és RETRO: cantons
   vius, contorn fosc gruixut, ombra dura, cap radi i cap degradat suau. */

:root {
  --sky-1: #2e86d8;
  --sky-2: #4a9ee0;
  --sky-3: #66b6e8;
  --sky-4: #82caf0;
  --sky-5: #9bdcf8;
  --paper: #fff4de;
  --surface: #fffaf0;
  --ink: #1a1420;
  --ink-soft: #5e5468;
  --line: #1a1420;
  --shadow: #1a0e08;
  --accent: #f8c800;
  --accent-ink: #2e1c00;
  --brick: #c84828;
  --brick-shade: #902820;
  --lava: #f03000;
  --lava-glow: #f87800;
  --lava-crest: #f8e800;
  --lava-deep: #8c0c00;
  --link: #0c3a58;
  --brick-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' shape-rendering='crispEdges'%3E%3Cpath fill='%23902820' d='M0 0h48v3H0zM0 24h48v3H0zM0 3h3v21H0zM24 27h3v21h-3z'/%3E%3C/svg%3E");
  --px-h1: 7px;
  --px-h2: 4px;
  --px-mark: 2.5px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-1: #08101e;
    --sky-2: #0a1a30;
    --sky-3: #0c2440;
    --sky-4: #0c2e4e;
    --sky-5: #0c3a58;
    --paper: #08101e;
    --surface: #1a1420;
    --ink: #fff4de;
    --ink-soft: #c8b8a0;
    --line: #fff4de;
    --shadow: #000000;
    --brick: #6e2418;
    --brick-shade: #4a140c;
    --link: #9bdcf8;
    --brick-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' shape-rendering='crispEdges'%3E%3Cpath fill='%234a140c' d='M0 0h48v3H0zM0 24h48v3H0zM0 3h3v21H0zM24 27h3v21h-3z'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  text-decoration-thickness: 3px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--ink);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 3px solid var(--line);
  font-weight: 700;
}

.skip:focus {
  top: 12px;
}

.shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

.shell-narrow {
  max-width: 760px;
}

@media (min-width: 700px) {
  .shell {
    padding: 0 32px;
  }
}

/* ------------------------------------------------------ lletra de píxels */

.ph {
  margin: 0 0 24px;
  line-height: 0;
}

/* Un mòdul del glif = 1em de l'SVG (vegeu scripts/lib/pixfont.mjs). */
.pix {
  display: block;
  font-size: var(--px-h2);
  max-width: 100%;
  height: auto;
  color: var(--ink);
}

.pix-h1 {
  font-size: var(--px-h1);
}

.pix-mark {
  font-size: var(--px-mark);
}

@media (min-width: 900px) {
  :root {
    --px-h1: 9px;
    --px-h2: 5px;
  }
}

/* ------------------------------------------------------------ capçalera */

.top {
  background: var(--sky-1);
  border-bottom: 4px solid var(--line);
}

/* Per sota de 900 px, una graella: logotip i idiomes sempre a la mateixa fila
   (el logotip cedeix si cal) i la barra de seccions a sota, a tota l'amplada. */
.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.masthead .wordmark {
  min-width: 0;
}

@media (min-width: 900px) {
  .masthead {
    display: flex;
    gap: 12px 24px;
  }
}

.wordmark {
  color: #fff4de;
  line-height: 0;
  text-decoration: none;
}

.wordmark .pix {
  color: #fff4de;
  filter: drop-shadow(2px 2px 0 #1a0e08);
}

/* Menú de seccions. En mòbil: una barra segmentada a tota l'amplada, com els
   controls segmentats del joc (contorn gruixut, ombra dura), amb cel·les de
   44 px com a mínim i totes del mateix ample. Cap JS ni hamburguesa: sempre a
   la vista. A partir de 900 px torna a ser una tira d'enllaços dins la
   capçalera. */
.sections {
  grid-column: 1 / -1;
  order: 3;
}

.sections ul {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff4de;
  border: 3px solid #1a1420;
  box-shadow: 4px 4px 0 #1a0e08;
}

.sections li + li {
  border-left: 3px solid #1a1420;
}

.sections a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 2px;
  color: #1a1420;
  font-weight: 800;
  /* Amb quatre entrades (quan hi ha captures) «Preguntes» és la més llarga:
     la lletra s'encongeix amb la pantalla perquè hi càpiga fins a 320 px. */
  font-size: clamp(12px, 3.6vw, 14px);
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.sections a:hover,
.sections a:active {
  background: #f8c800;
  color: #2e1c00;
}

.langs {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.langs a,
.langs .here {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 8px;
  color: #fff4de;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.langs a:hover {
  background: rgba(8, 16, 30, 0.35);
}

.langs .here {
  background: #fff4de;
  color: #1a1420;
}

.langs .sep {
  color: #fff4de;
  opacity: 0.6;
}

/* Telèfons estrets: logotip i idiomes més compactes perquè capin en una fila. */
@media (max-width: 399px) {
  :root {
    --px-mark: 2px;
  }

  .masthead {
    column-gap: 12px;
  }

  .langs a,
  .langs .here {
    padding: 0 6px;
  }
}

@media (min-width: 900px) {
  .sections {
    order: 0;
    width: auto;
    margin-left: auto;
  }

  .sections ul {
    display: flex;
    gap: 8px;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .sections li + li {
    border-left: 0;
  }

  .sections a {
    min-height: 0;
    padding: 6px 10px;
    color: #fff4de;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
  }

  .sections a:hover {
    background: rgba(8, 16, 30, 0.35);
    color: #fff4de;
  }

  .langs {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding: 40px 0 0;
  background: linear-gradient(
    to bottom,
    var(--sky-1) 0 20%,
    var(--sky-2) 20% 40%,
    var(--sky-3) 40% 60%,
    var(--sky-4) 60% 80%,
    var(--sky-5) 80% 100%
  );
}

.hero-grid {
  display: grid;
  gap: 24px;
  align-items: start;
  padding-bottom: 56px;
}

.hero-icon {
  width: 144px;
  height: 144px;
  border: 4px solid #1a1420;
  box-shadow: 6px 6px 0 #1a0e08;
  image-rendering: auto;
}

.hero-copy {
  background: var(--surface);
  border: 4px solid var(--line);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 24px 20px;
}

.eyebrow {
  margin: 0 0 16px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lead {
  margin: 0 0 20px;
  font-size: 20px;
  line-height: 1.45;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.badge-link {
  display: inline-block;
  line-height: 0;
}

.badge-link:hover .badge {
  opacity: 0.85;
}

.badge {
  display: block;
  width: 156px;
  height: 52px;
}

.note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

@media (min-width: 900px) {
  .hero {
    padding-top: 64px;
  }

  .hero-grid {
    grid-template-columns: 220px 1fr;
    gap: 40px;
    padding-bottom: 80px;
  }

  .hero-icon {
    width: 200px;
    height: 200px;
  }

  .hero-copy {
    padding: 36px 40px;
  }
}

/* La lava: una cresta esglaonada de píxels, com la del primer pou. */
.lava {
  height: 48px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'%3E%3Cpath fill='%23f8e800' d='M0 12h6V8h6V4h8v4h6v4h6v4H0z'/%3E%3Cpath fill='%23f87800' d='M0 16h32v4H0z'/%3E%3Cpath fill='%23f03000' d='M0 20h32v6H0z'/%3E%3Cpath fill='%238c0c00' d='M0 26h32v6H0z'/%3E%3C/svg%3E") 0 0 / 48px 48px repeat-x;
  border-bottom: 4px solid var(--line);
}

/* --------------------------------------------------------------- bandes */

.band {
  padding: 56px 0;
  border-bottom: 4px solid var(--line);
}

.band-first {
  padding-top: 56px;
  border-bottom: 0;
}

.band-sky {
  background: var(--sky-5);
}

.band-sky .pix {
  color: #1a1420;
}

.band-card {
  background: var(--surface);
  border-bottom: 0;
}

/* Maó: fileres de 24 px amb els junts decalats (una tessel·la de 48 × 48). */
.band-brick {
  background: var(--brick) var(--brick-tile) 0 0 / 48px 48px repeat;
}

.band-brick .ph .pix {
  color: #fff4de;
  filter: drop-shadow(3px 3px 0 #1a0e08);
}

@media (min-width: 900px) {
  .band {
    padding: 80px 0;
  }
}

.copy {
  margin: 0 0 16px;
}

.fine {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ captures */

.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0 0 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.shot {
  scroll-snap-align: start;
}

/* Captures de 921 × 2000: amb 260 px d'ample fan 565 d'alt i la fila hi cap. */
@media (min-width: 900px) {
  .shots {
    grid-auto-columns: 260px;
    gap: 32px;
  }
}

.shot img {
  display: block;
  width: 100%;
  border: 4px solid #1a1420;
  box-shadow: 6px 6px 0 #1a0e08;
}

/* --------------------------------------------------------------- punts */

.points {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.point {
  background: var(--surface);
  border: 4px solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 20px;
}

.point-key {
  display: inline-block;
  margin: 0 0 12px;
  padding: 2px 10px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 3px solid #1a1420;
  font-weight: 900;
}

.point-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.point .copy {
  margin: 0;
}

@media (min-width: 800px) {
  .points {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ----------------------------------------------------------- preguntes */

.qas {
  display: grid;
  gap: 0;
  border-top: 3px solid var(--line);
}

.qa {
  padding: 20px 0;
  border-bottom: 3px solid var(--line);
}

.qa-q {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.3;
}

.qa-a {
  margin: 0;
  max-width: 68ch;
}

@media (min-width: 900px) {
  .qas {
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
    border-top: 0;
  }

  .qa {
    border-top: 3px solid var(--line);
    border-bottom: 0;
  }
}

/* ------------------------------------------------------------- suport */

.split {
  display: grid;
  gap: 32px;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: 56px;
  }
}

.form {
  margin: 0;
}

.field {
  margin: 0 0 16px;
}

.field label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 0;
}

.field textarea {
  resize: vertical;
  min-height: 140px;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.button {
  display: inline-block;
  padding: 12px 28px;
  font: inherit;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border: 4px solid #1a1420;
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--shadow);
  cursor: pointer;
}

.button:hover {
  background: #ffd83a;
}

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

/* -------------------------------------------------- legals i gràcies */

.h1-text {
  margin: 0 0 24px;
  font-size: 34px;
  line-height: 1.15;
}

.prose {
  padding-bottom: 32px;
}

.prose h2 {
  margin: 40px 0 12px;
  font-size: 23px;
  line-height: 1.25;
}

.prose h3 {
  margin: 28px 0 8px;
  font-size: 19px;
}

.prose p,
.prose li {
  max-width: 72ch;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li {
  margin: 0 0 6px;
}

.prose code {
  font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
}

.prose table {
  border-collapse: collapse;
  min-width: 100%;
}

.prose th,
.prose td {
  padding: 8px 10px;
  border: 2px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface);
}

.thanks-icon {
  display: block;
  margin: 0 0 24px;
  border: 4px solid #1a1420;
  box-shadow: 5px 5px 0 #1a0e08;
}

.back {
  font-weight: 700;
}

/* ------------------------------------------------------------------ peu */

.foot {
  background: var(--ink);
  color: var(--paper);
  border-top: 4px solid var(--line);
  padding: 40px 0;
}

.foot a,
.foot .langs a {
  color: var(--paper);
}

.foot .langs {
  margin: 0;
}

.foot .langs .here {
  background: var(--paper);
  color: var(--ink);
}

.foot .langs .sep {
  color: var(--paper);
}

.foot-grid {
  display: grid;
  gap: 16px;
}

.foot-brand {
  margin: 0;
  font-weight: 900;
  font-size: 20px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-mail {
  margin: 0;
  overflow-wrap: anywhere;
}

.foot-fine {
  margin: 0;
  font-size: 14px;
  opacity: 0.85;
}
