/*
 * Buccaneer's Horizon website: one style sheet for the landing page, the legal pages and the 404
 * page. Colours come from the game's palette (BuccaneersHorizon/core/.../ui/Palette.kt), fonts are
 * the game's own (Sancreek for titles, Fira Sans for text), self-hosted under the SIL OFL as WOFF
 * (the TTF tables zlib-compressed, font data unchanged; see Server/web/README.md). Every browser takes
 * the WOFF; the TTF after it is only a fallback that is never downloaded when WOFF is supported.
 * Rules (Server/legal/README.md): no @import, url() only to files under /assets/.
 * Contrast: every text colour pair below is >= 4.5:1 (WCAG AA) in both colour schemes.
 */

@font-face {
  font-family: "Sancreek";
  src: url("/assets/fonts/Sancreek-Regular.woff?v=866facef3a") format("woff"), url("/assets/fonts/Sancreek-Regular.ttf?v=8f87c42f6e") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/FiraSans-SemiBold.woff?v=e9f49bb849") format("woff"), url("/assets/fonts/FiraSans-SemiBold.ttf?v=db0321f83e") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/FiraSans-Bold.woff?v=de31f5dfa8") format("woff"), url("/assets/fonts/FiraSans-Bold.ttf?v=a4d8e149ec") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  /* Palette.kt */
  --hud-navy: #0f2c40;
  --sea-deep: #0e4c6e;
  --sea: #1b7fa6;
  --turquoise: #2ec4c6;
  --wood-dark: #6d4b27;
  --wood: #a3703a;
  --parchment: #fff1d2;
  --ink: #3b2a1a;
  --ink-muted: #7a5c3a;
  --cream: #fff8e7;
  --cream-muted: #b9d3e0;
  --loot: #f2c230;
  --info-ink: #1e6a92;
  --info-light: #8fcdee;

  /* Roles (light) */
  --bg: var(--cream);
  --surface: var(--parchment);
  --surface-edge: #e2cfa6;
  --text: var(--ink);
  --muted: var(--ink-muted);
  --link: var(--info-ink);
  --heading: var(--ink);
  --header-bg: var(--hud-navy);
  --footer-bg: var(--hud-navy);
  --focus: var(--sea);
  --badge-bg: var(--loot);
  --badge-text: var(--ink);
  --shadow: 0 10px 24px rgba(59, 42, 26, 0.18);

  --radius: 14px;
  --wrap: 72rem;
  --font-text: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: "Sancreek", "Fira Sans", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b2131;
    --surface: var(--hud-navy);
    --surface-edge: #23465f;
    --text: var(--cream);
    --muted: var(--cream-muted);
    --link: var(--info-light);
    --heading: var(--cream);
    --header-bg: #08192a;
    --footer-bg: #08192a;
    --focus: var(--turquoise);
    --shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 600 1.0625rem/1.6 var(--font-text);
  overflow-wrap: break-word;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

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

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

h1,
h2,
h3 {
  line-height: 1.2;
  color: var(--heading);
}

h2 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  letter-spacing: 0.01em;
  margin: 0 0 0.75rem;
}

h3 {
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 0.4rem;
}

strong {
  font-weight: 700;
}

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

@media (min-width: 40rem) {
  .wrap {
    padding: 0 1.5rem;
  }
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--loot);
  color: var(--ink);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

/* Draft banner (staging, or before the owner's details are filled in). */
.draft-banner {
  background: var(--loot);
  color: var(--ink);
  padding: 0.6rem 1rem;
  text-align: center;
}

/* Header and navigation */
.site-header {
  background: var(--header-bg);
  color: var(--cream);
  border-bottom: 4px solid var(--wood-dark);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
  min-height: 4rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  margin-right: auto;
  color: var(--cream);
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 1.35rem;
  line-height: 1.1;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.site-nav a {
  display: inline-block;
  min-height: 48px;
  line-height: 48px;
  color: var(--cream);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--loot);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.35em;
}

/* Buttons */
.button {
  display: inline-block;
  min-height: 48px;
  padding: 0.7rem 1.3rem;
  border-radius: 12px;
  border: 3px solid var(--wood-dark);
  background: var(--loot);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--wood-dark);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--wood-dark);
}

.button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--wood-dark);
}

.button-ghost {
  background: transparent;
  color: var(--cream);
  border-color: var(--cream-muted);
  box-shadow: none;
}

.button-ghost:hover,
.button-ghost:active {
  box-shadow: none;
  background: rgba(255, 248, 231, 0.08);
}

.small-print {
  font-size: 0.92rem;
}

/* Hero: night-blue sky over the deep sea, waves at the bottom edge (CSS only). */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 85% 0%, rgba(46, 196, 198, 0.22), transparent 70%),
    linear-gradient(180deg, var(--hud-navy) 0%, var(--sea-deep) 100%);
  color: var(--cream);
  padding: 2.25rem 0 4.5rem;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  pointer-events: none;
  /* front wave in the page colour, a lighter wave behind it, offset by half a crest */
  background:
    radial-gradient(circle at 24px 36px, var(--bg) 35.5px, transparent 36px) 0 100% / 48px 16px repeat-x,
    radial-gradient(circle at 24px 36px, rgba(46, 196, 198, 0.45) 35.5px, transparent 36px) 24px 0 / 48px 16px repeat-x;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 56rem) {
  .hero-grid {
    grid-template-columns: 5fr 7fr;
    gap: 3rem;
  }
}

.hero h1 {
  margin: 0 0 1rem;
  color: var(--cream);
}

.wordmark {
  display: block;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(2.5rem, 9vw, 4.4rem);
  line-height: 1.05;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.tagline {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-text);
  font-weight: 700;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  line-height: 1.35;
  color: var(--loot);
}

.lead {
  font-size: 1.18rem;
  margin: 0 0 1.5rem;
  max-width: 36rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0 0 1rem;
}

.hero .small-print {
  color: var(--cream-muted);
  margin: 0;
}

.hero-shot {
  margin: 0;
}

.hero-shot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 5px solid var(--wood);
  box-shadow: 0 0 0 3px var(--wood-dark), 0 16px 32px rgba(0, 0, 0, 0.4);
  background: var(--sea-deep);
}

/* Sections */
.voyage,
.features,
.fair,
.play {
  padding: 3.25rem 0;
}

.section-intro {
  margin: 0 0 1.75rem;
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.12rem;
}

/* The core loop: numbered cards */
.loop {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 38rem) {
  .loop {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 62rem) {
  .loop {
    grid-template-columns: repeat(3, 1fr);
  }
}

.loop li {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--surface-edge);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.1rem 4.25rem;
  min-height: 5.5rem;
}

.loop li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 2px solid var(--wood-dark);
  font-family: var(--font-title);
  font-size: 1.3rem;
  line-height: 2.1rem;
  text-align: center;
}

.loop h3 {
  font-size: 1.15rem;
}

.loop p {
  margin: 0;
}

/* Features: screenshot + text, alternating on wide screens */
.features h2 {
  margin-bottom: 1.75rem;
}

.feature-list {
  display: grid;
  gap: 2.5rem;
}

.feature {
  display: grid;
  gap: 1rem 2.5rem;
  align-items: center;
}

@media (min-width: 52rem) {
  .feature {
    grid-template-columns: 7fr 5fr;
  }

  .feature:nth-child(even) .feature-media {
    order: 2;
  }
}

.feature-media {
  margin: 0;
}

.feature-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 4px solid var(--wood);
  box-shadow: var(--shadow);
  background: var(--sea-deep);
}

.feature-text h3 {
  font-size: 1.35rem;
}

.feature-text p {
  margin: 0;
}

/* Fair by design: a parchment notice with compass-diamond bullets */
.fair {
  background: var(--surface);
  border-top: 1px solid var(--surface-edge);
  border-bottom: 1px solid var(--surface-edge);
}

.fair-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 50rem;
}

.fair-list li {
  position: relative;
  margin: 0.85rem 0;
  padding-left: 2rem;
}

.fair-list li::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.45em;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--loot);
  border: 2px solid var(--wood-dark);
  transform: rotate(45deg);
}

/* Coming soon */
.play-card {
  max-width: 52rem;
}

.play-card p {
  max-width: 44rem;
}

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

/* Legal pages */
.legal {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.legal h1 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 2.7rem);
  margin: 1rem 0 1.25rem;
}

.legal h2 {
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0;
  margin: 2.25rem 0 0.6rem;
}

.legal h3 {
  font-size: 1.12rem;
  margin: 1.6rem 0 0.4rem;
}

.legal ul,
.legal ol {
  padding-left: 1.4rem;
}

.legal li {
  margin: 0.35rem 0;
}

.legal table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  max-width: 100%;
  margin: 1rem 0;
}

.legal caption {
  text-align: left;
  font-weight: 700;
  padding: 0 0 0.4rem;
  color: var(--muted);
}

.legal th,
.legal td {
  border: 1px solid var(--surface-edge);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

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

.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.legal blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--wood);
  background: var(--surface);
}

.legal small {
  color: var(--muted);
}

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: var(--cream-muted);
  border-top: 4px solid var(--wood-dark);
  padding: 2rem 0 2.5rem;
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--cream);
}

.site-footer p {
  margin: 0.5rem 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-nav a {
  display: inline-block;
  min-height: 48px;
  line-height: 48px;
}

.footer-nav a[aria-current="page"] {
  text-decoration-color: var(--loot);
  text-decoration-thickness: 3px;
}

/* Legal pages: the server adds the effective date as the footer's last paragraph. */
.site-footer > .effective-date {
  max-width: var(--wrap);
  margin: 0.5rem auto 0;
  padding: 0 1rem;
  color: var(--cream);
}

@media (min-width: 40rem) {
  .site-footer > .effective-date {
    padding: 0 1.5rem;
  }
}

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

  .button,
  .button:hover,
  .button:active {
    transition: none;
    transform: none;
  }
}
