/*
 * heropuzzles.com – one stylesheet for every page (plan 04).
 * Layout: a sunny station front. Rays turn slowly behind the game's logo like on the app's home
 * screen, then the game is laid out like a level card: copy beside a solved board.
 * Colors are the app's palette (apps/traintracks/src/theme/colors.ts); text and link colors are
 * darkened a step in light mode so body text keeps 4.5:1 contrast. No scripts, no third parties.
 */

@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito-900.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-muted: #e6ebf2;
  --ink: #22304a;
  --ink-muted: #56637b;
  --line: #c9d3e0;
  --link: #1d62c4;
  --accent: #2f80ed;
  --accent-ink: #ffffff;
  --highlight: #ffc93c;
  --highlight-ink: #3a2a00;
  --train: #e5484d;
  --ray: rgba(255, 255, 255, 1);
  /* The brand mark's star sits on yellow in both themes, like the star in the logo. */
  --star: #1f2b45;

  /* The board drawing */
  --board-edge: #4b5b77;
  --grid: #d3dbe6;
  --given: #e4ebf5;
  --rail: #2b3a55;
  --sleeper: #d9a066;
  --ballast: #edeae5;
  --clue: #22304a;

  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  --step-4: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);

  --radius: 18px;
  --shadow: 0 1px 2px rgba(34, 48, 74, 0.08), 0 8px 24px rgba(34, 48, 74, 0.08);
  --measure: 66ch;
  --wide: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111723;
    --surface: #1c2435;
    --surface-muted: #273147;
    --ink: #eef2f8;
    --ink-muted: #a3afc4;
    --line: #33405a;
    --link: #7fb2ff;
    --accent: #5b9dff;
    --accent-ink: #0d1420;
    --highlight: #ffcf4d;
    --highlight-ink: #2a1f00;
    --train: #ff6b6b;
    --ray: rgba(28, 36, 53, 0.9);
    --board-edge: #4a5872;
    --grid: #2c374d;
    --given: #33425f;
    --rail: #e4eaf4;
    --sleeper: #a8703f;
    --ballast: #2b3345;
    --clue: #eef2f8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #111723;
  --surface: #1c2435;
  --surface-muted: #273147;
  --ink: #eef2f8;
  --ink-muted: #a3afc4;
  --line: #33405a;
  --link: #7fb2ff;
  --accent: #5b9dff;
  --accent-ink: #0d1420;
  --highlight: #ffcf4d;
  --highlight-ink: #2a1f00;
  --train: #ff6b6b;
  --ray: rgba(28, 36, 53, 0.9);
  --board-edge: #4a5872;
  --grid: #2c374d;
  --given: #33425f;
  --rail: #e4eaf4;
  --sleeper: #a8703f;
  --ballast: #2b3345;
  --clue: #eef2f8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-x: hidden;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}
a:hover {
  text-decoration-thickness: 0.14em;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
h1 {
  font-weight: 900;
  font-size: var(--step-4);
  letter-spacing: -0.01em;
}
h2 {
  font-weight: 900;
  font-size: var(--step-3);
}
h3 {
  font-weight: 700;
  font-size: var(--step-1);
}
p,
ul,
ol {
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: max(16px, env(safe-area-inset-left, 0px));
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 10px;
}

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* --- Header --- */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
}
.brand svg {
  width: 30px;
  height: 30px;
  flex: none;
}
.brand-mark-ring {
  fill: var(--highlight);
  stroke: var(--star);
  stroke-width: 2.5;
}
.brand-mark-star {
  fill: var(--star);
}
.site-nav {
  display: flex;
  gap: 4px;
}
.site-nav a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
}
.site-nav a:hover {
  background: var(--surface-muted);
}
.site-nav a[aria-current='page'] {
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* --- Home: intro --- */

.intro {
  padding-block: clamp(24px, 4vw, 48px) clamp(20px, 3vw, 32px);
  display: grid;
  gap: 14px;
}
.intro h1 {
  max-width: 18ch;
}
.lede {
  font-size: var(--step-1);
  color: var(--ink-muted);
  max-width: 46ch;
}

/* --- Home: the game's stage with the sun rays --- */

.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-block: clamp(40px, 7vw, 88px);
}
.rays {
  /* Masked by an ellipse that doesn't turn, so the rays fade out before every edge of the band. */
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse closest-side, #000 25%, transparent 100%);
}
.rays::before {
  /* 18 comic rays round the logo, turning once in two minutes like the app's home screen. */
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2400px;
  height: 2400px;
  margin: -1200px 0 0 -1200px;
  background: repeating-conic-gradient(from 0deg, var(--ray) 0deg 10deg, transparent 10deg 20deg);
  animation: turn 120s linear infinite;
}
@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rays::before {
    animation: none;
  }
}
.stage .wrap {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}
.stage h2 {
  width: 100%;
  display: grid;
  justify-items: center;
}
.stage-logo {
  width: 560px;
  max-width: 100%;
  height: auto;
}
.tagline {
  font-weight: 900;
  font-size: var(--step-2);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.status::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--highlight);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--highlight) 35%, transparent);
}

/* --- Home: the game card --- */

.game {
  padding-block: clamp(32px, 5vw, 56px);
}
.game-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  background: var(--surface);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 44px);
}
.game-copy {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.game-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  flex: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
}
.game-head p {
  color: var(--ink-muted);
  font-size: var(--step--1);
  font-weight: 700;
}
.steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
  counter-reset: step;
}
.steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--highlight);
  color: var(--highlight-ink);
  font-weight: 900;
  font-size: var(--step--1);
  margin-top: 1px;
}
.board-figure {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  min-width: 0;
}
.board {
  width: min(360px, 100%);
  height: auto;
}
.board-figure figcaption {
  color: var(--ink-muted);
  font-size: var(--step--1);
  text-align: center;
  max-width: 34ch;
}
.b-face {
  fill: var(--surface);
}
.b-edge {
  fill: none;
  stroke: var(--board-edge);
  stroke-width: 2;
}
.b-given {
  fill: var(--given);
}
.b-grid {
  fill: none;
  stroke: var(--grid);
  stroke-width: 1;
}
.t-bed,
.t-sleepers,
.t-rails {
  fill: none;
  stroke-linejoin: round;
}
.t-bed {
  stroke: var(--ballast);
  stroke-linecap: butt;
}
.t-sleepers {
  stroke: var(--sleeper);
  stroke-linecap: butt;
}
.t-rails {
  stroke: var(--rail);
}
.b-clue {
  fill: var(--clue);
  font-family: var(--font);
  font-weight: 900;
  font-size: 17px;
  text-anchor: middle;
  dominant-baseline: central;
}

/* --- Home: what you get --- */

.features {
  padding-block: 0 clamp(40px, 6vw, 72px);
}
.features h2 {
  margin-bottom: 20px;
}
.feature-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 32px;
}
.feature-list li {
  display: grid;
  gap: 4px;
  align-content: start;
  padding-top: 14px;
  border-top: 3px solid var(--line);
}
.feature-list strong {
  font-weight: 900;
  font-size: var(--step-1);
}
.feature-list span {
  color: var(--ink-muted);
}
.first-note {
  margin-top: 28px;
  color: var(--ink-muted);
}

/* --- Document pages: privacy, support, 404 --- */

.doc {
  padding-block: clamp(20px, 4vw, 48px) clamp(40px, 6vw, 72px);
}
.doc-body {
  max-width: var(--measure);
  display: grid;
  gap: 14px;
}
.doc-body h1 {
  font-size: var(--step-3);
}
.doc-body h2 {
  font-size: var(--step-2);
  margin-top: 22px;
}
.doc-body h3 {
  margin-top: 10px;
}
.doc-body ul {
  padding-left: 1.25em;
  display: grid;
  gap: 6px;
}
.meta {
  color: var(--ink-muted);
  font-size: var(--step--1);
  font-weight: 700;
}
.summary {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  font-size: var(--step-1);
}
.contact-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 8px;
}
.contact-card .label {
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.contact-card .address {
  font-weight: 900;
  font-size: clamp(1.125rem, 0.8rem + 2.2vw, 1.5rem);
  overflow-wrap: anywhere;
}
.faq {
  display: grid;
  gap: 4px;
}
.faq h3 {
  margin-top: 18px;
}
.lost {
  display: grid;
  gap: 16px;
  justify-items: start;
  padding-block: clamp(40px, 8vw, 96px);
}
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--line);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-block: 24px 32px;
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.site-footer a {
  color: var(--ink-muted);
  font-weight: 700;
}

/* --- Narrow screens --- */

@media (max-width: 820px) {
  .game-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .feature-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .brand {
    font-size: 1.125rem;
    gap: 8px;
  }
  .brand svg {
    width: 26px;
    height: 26px;
  }
  .site-nav {
    gap: 0;
  }
  .site-nav a {
    padding: 6px 9px;
  }
}
