/*
  Reverse Slope Games: staff-map look.
  Colours and type come from the game's own interface (apps/client/src/app.css in the game repo):
  paper, ink, thin rules, NATO blue. Night view is the same sheet under a red-shaded lamp.
*/

/* IBM Plex, self-hosted (SIL Open Font License, see assets/fonts). Latin range only. */
@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans Condensed';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-400-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  --page: #e9e3d0;
  --paper: #f3efe2;
  --paper-2: #e9e3d0;
  --ink: #2c2a25;
  --ink-2: #5f594f;
  --rule: #b9b09b;
  --blue: #1e3a5f;
  --on-blue: #f3efe2;
  --red: #a8322a;
  --ok: #2f6b3a;
  --focus: #1e3a5f;
  --band: #1e3a5f;
  --img-filter: none;

  --display: 'IBM Plex Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;

  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

/* Night view: chosen by the toggle, or by the system setting when nothing is chosen. */
:root[data-theme='dark'] {
  --page: #171613;
  --paper: #23211d;
  --paper-2: #1d1c18;
  --ink: #ece6d3;
  --ink-2: #aaa392;
  --rule: #4a463c;
  --blue: #8fb0dc;
  --on-blue: #14181f;
  --red: #e0776b;
  --ok: #8fcf99;
  --focus: #8fb0dc;
  --img-filter: brightness(0.84) saturate(0.92);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #171613;
    --paper: #23211d;
    --paper-2: #1d1c18;
    --ink: #ece6d3;
    --ink-2: #aaa392;
    --rule: #4a463c;
    --blue: #8fb0dc;
    --on-blue: #14181f;
    --red: #e0776b;
    --ok: #8fcf99;
    --focus: #8fb0dc;
    --img-filter: brightness(0.84) saturate(0.92);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img,
svg {
  display: block;
  max-width: 100%;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

a {
  color: inherit;
}

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

.sr-only {
  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: 12px;
  top: -80px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--blue);
  color: var(--on-blue);
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure {
  max-width: 62ch;
}

/* ---- Panels: paper laid on the map, thin rule, no glow ------------------------------------ */

.panel {
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgb(0 0 0 / 8%);
}

/* ---- Top bar: floats over everything, like the game's own ------------------------------- */

.topbar {
  position: fixed;
  z-index: 50;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px 24px;
  padding: 8px 14px;
}

.wordmark {
  margin-right: auto;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 4px 20px;
  font-family: var(--display);
  font-size: 0.98rem;
}

.nav a {
  text-decoration: none;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  border-bottom-color: var(--ink);
}

.theme,
.btn {
  font: inherit;
  font-family: var(--display);
  cursor: pointer;
}

.theme {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 3px 10px;
  font-size: 0.95rem;
}

.theme:hover {
  background: var(--paper-2);
}

.theme[aria-pressed='true'] {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--on-blue);
}

/* ---- Hero --------------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: clamp(660px, 100svh, 940px);
  overflow: hidden;
  background: var(--paper-2);
}

.hero-map {
  position: absolute;
  inset: 0;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: var(--img-filter);
}

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

.hero-panel {
  position: absolute;
  z-index: 2;
  left: 12px;
  top: 78px;
  width: min(480px, calc(100% - 24px));
  padding: 22px 26px 20px;
}

.hero-panel h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 5.4vw, 4.1rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
}

.lead {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.32rem;
  line-height: 1.3;
}

.state {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.92rem;
}

.hero-caption {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  max-width: 340px;
  margin: 0;
  padding: 8px 12px;
  color: var(--ink-2);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* The overlay: friendly graphics in staff blue, enemy in red, dashed where suspected. */

.acetate .phase-line {
  stroke: #1e3a5f;
  stroke-width: 6;
}

.acetate .axis {
  stroke: #a8322a;
  stroke-width: 8;
  stroke-dasharray: 26 14;
}

.acetate .axis-head {
  fill: #a8322a;
}

.acetate .contact {
  fill: rgb(168 50 42 / 14%);
  stroke: #a8322a;
  stroke-width: 5;
  stroke-dasharray: 10 7;
}

.acetate .contact-q {
  fill: #a8322a;
  font: 700 34px var(--display);
}

.acetate .chip rect {
  fill: #f3efe2;
  fill-opacity: 0.95;
  stroke: #b9b09b;
  stroke-width: 2;
}

.acetate .chip-title {
  fill: #2c2a25;
  font: 600 27px var(--display);
}

.acetate .chip-text {
  fill: #5f594f;
  font: 400 24px var(--body);
}

/* One orchestrated moment: the phase line appears, the axis draws on, then the contact shows. */

.acetate .reveal {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.4s cubic-bezier(0.3, 0.1, 0.2, 1) 0.8s forwards;
}

.acetate .after {
  opacity: 0;
  animation: appear 0.7s ease-out var(--d, 0s) forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes appear {
  to {
    opacity: 1;
  }
}

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

  .acetate .reveal {
    animation: none;
    stroke-dashoffset: 0;
  }

  .acetate .after {
    animation: none;
    opacity: 1;
  }
}

/* ---- Sign-up ------------------------------------------------------------------------------- */

.signup {
  margin: 18px 0 0;
}

.signup label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.98rem;
}

.signup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signup input {
  flex: 1 1 210px;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-2);
  border-radius: 0;
}

.signup input::placeholder {
  color: var(--ink-2);
  opacity: 0.8;
}

.btn {
  padding: 10px 16px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--on-blue);
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 0;
}

.btn:hover {
  filter: brightness(1.12);
}

.btn--on-dark {
  color: #1e3a5f;
  background: #f3efe2;
  border-color: #f3efe2;
}

.signup-status {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.signup-status:empty {
  display: none;
}

.signup-status[data-kind='error'] {
  color: var(--red);
  font-weight: 500;
}

.signup--dark label,
.signup--dark .signup-status {
  color: #f3efe2;
}

.signup--dark .signup-status[data-kind='error'] {
  color: #ffb4aa;
}

/* ---- Sections ------------------------------------------------------------------------------ */

.section {
  padding-block: clamp(56px, 9vw, 112px);
}

.section--tint {
  background: var(--paper-2);
  border-block: 1px solid var(--rule);
}

:root[data-theme='dark'] .section--tint {
  background: var(--paper);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .section--tint {
    background: var(--paper);
  }
}

h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
}

h1,
h2 {
  text-wrap: balance;
}

h2 {
  max-width: 26ch;
  margin: 0 0 0.55em;
  font-size: clamp(1.8rem, 3.4vw, 2.65rem);
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 0.35em;
  font-size: 1.3rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.split--wide-media {
  grid-template-columns: 7fr 5fr;
}

/* Let grid columns shrink below their content, so wide blocks scroll instead of overflowing. */
.split > *,
.versus > *,
.band-grid > *,
.footer-grid > * {
  min-width: 0;
}

.figure {
  margin: 0;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.figure img {
  width: 100%;
  height: auto;
  filter: var(--img-filter);
}

.figure figcaption {
  padding: 8px 4px 2px;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* How a turn works: a real sequence, so it is numbered. */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 4vw, 48px);
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding-top: 14px;
  border-top: 3px solid var(--ink);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 4px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--blue);
}

.steps p {
  max-width: 34ch;
}

/* Message traffic: the one place that looks like a typewritten document. */

.traffic {
  margin: 28px 0 0;
  padding: 16px 18px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.traffic-body {
  margin: 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

.traffic .prec {
  font-weight: 500;
  color: var(--red);
}

.traffic figcaption {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.82rem;
}

/* Versus: colour says which side, the same as on the game's map. */

.versus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 48px);
  margin-top: 40px;
}

.versus-side {
  padding: 18px 22px 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top-width: 5px;
  border-top-color: var(--rule);
}

/* Feature sections: status boxes, point lists and the escalation ladder */

.facts {
  margin: 24px 0 0;
  padding: 14px 16px 6px;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.5;
}

.facts > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 4px 14px;
  margin-bottom: 12px;
  align-items: baseline;
}

.facts dt,
.facts dd {
  margin: 0;
}

.facts dt .status {
  font-size: 0.9rem;
}

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

.points li {
  padding: 14px 0 12px;
  border-top: 1px solid var(--rule);
}

.points strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
}

.points-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(28px, 5vw, 64px);
}

.figure--strip {
  margin-top: 32px;
}

.small-note {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.small-note .status {
  margin-right: 8px;
}

.ladder td a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.rungs {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rung;
}

.rungs li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 2px 12px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  counter-increment: rung;
}

.rungs li::before {
  content: counter(rung);
  grid-row: span 2;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--ink-2);
}

.rungs strong {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
}

.rungs span {
  color: var(--ink-2);
}


.ladder--systems td:nth-child(2) {
  font-family: var(--body);
  font-weight: 400;
  font-size: 1rem;
}

.ladder--systems td:first-child {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
}

/* Scenario ladder */

.table-wrap {
  margin-top: 36px;
  overflow-x: auto;
}

.ladder {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.ladder th,
.ladder td {
  padding: 12px 14px 12px 0;
  text-align: left;
  vertical-align: baseline;
  border-bottom: 1px solid var(--rule);
}

.ladder thead th {
  padding-block: 8px;
  border-bottom: 2px solid var(--ink);
  color: var(--ink-2);
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.95rem;
}

.ladder tbody th {
  width: 2.5em;
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink-2);
}

.ladder td:nth-child(2) {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.status::before {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid currentcolor;
}

.status--playable {
  color: var(--ok);
}

.status--playable::before {
  background: currentcolor;
}

.status--building {
  color: var(--blue);
}

.status--building::before {
  background: linear-gradient(90deg, currentcolor 50%, transparent 50%);
}

.status--planned {
  color: var(--ink-2);
}

/* Dev log */

.log {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 4vw, 48px);
  margin-top: 36px;
}

.log-entry {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.ref {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* Studio and sign-up band */

.band {
  padding-block: clamp(56px, 8vw, 96px);
  background: var(--band);
  color: #f3efe2;
}

.band-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
}

.epigraph {
  margin: 0 0 24px;
}

.epigraph p {
  max-width: 24ch;
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.15;
}

.band-text {
  max-width: 56ch;
  color: #e4dfcf;
}

.band-text--small {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.band :focus-visible {
  outline-color: #f3efe2;
}

/* FAQ */

.faq {
  max-width: 760px;
  margin-top: 28px;
  border-bottom: 1px solid var(--rule);
}

.faq details {
  border-top: 1px solid var(--rule);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  flex: none;
  font-weight: 400;
}

.faq details[open] summary::after {
  content: '\2212';
}

.faq details p {
  max-width: 60ch;
  margin: 0 0 18px;
  color: var(--ink-2);
}

/* Footer */

.footer {
  padding-block: 48px 56px;
  border-top: 1px solid var(--rule);
}

.footer-grid {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: clamp(24px, 5vw, 64px);
}

.footer-name {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
}

.small {
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.credits-h {
  max-width: none;
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.credits ul {
  margin: 0;
  padding-left: 1.1em;
}

.credits li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

/* ---- Small screens ------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .split,
  .split--wide-media,
  .versus,
  .band-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .steps,
  .log {
    grid-template-columns: 1fr;
  }

  .points-grid {
    grid-template-columns: 1fr;
  }

  .facts > div {
    grid-template-columns: 1fr;
  }

  .split--media-first .figure {
    order: 2;
  }

  /* The map goes on top and the panel sits on it, instead of covering it. */
  .hero {
    min-height: 0;
    padding-bottom: 20px;
  }

  .hero-map {
    position: relative;
    height: clamp(300px, 70vw, 520px);
  }

  .hero-panel {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    margin: -36px 12px 0;
  }

  .hero-caption {
    position: static;
    max-width: none;
    margin: 12px 12px 0;
  }

  .acetate .chip {
    display: none;
  }

  .col-scope {
    display: none;
  }

  .traffic-body {
    font-size: 0.72rem;
  }
}

/* Honeypot field for the sign-up forms: invisible to people, tempting to bots. */

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

/* Plain text pages such as the privacy notice */

.prose {
  padding-top: 110px;
}

.prose h2 {
  max-width: none;
  margin-top: 1.6em;
  font-size: 1.5rem;
}

.prose h1 {
  margin: 0 0 0.4em;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

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