/*
 * Shared styles for every page on flagkeeper.app. Colours are copied by hand from
 * src/ui/tokens/design-tokens.json: this site is not app code, so the token classes don't apply.
 * Fonts are the app's three families, served from this site (fonts/), so no page asks a third
 * party for anything. Dark is the default, as in the app; light follows the system setting.
 */
@font-face {
  font-family: 'Libre Caslon Display';
  src: url('/fonts/LibreCaslonDisplay_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/HankenGrotesk_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/HankenGrotesk_500Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/HankenGrotesk_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0e1420;
  --surface: #161e2d;
  --surface2: #1d2638;
  --plate: #0a0f18;
  --line: rgba(236, 232, 223, 0.08);
  --line2: rgba(236, 232, 223, 0.2);
  --text: #ece8df;
  --text2: #8b93a3;
  --text3: #c9cdd5;
  --accent: #7fd1be;
  --accentText: #7fd1be;
  --onaccent: #0b1d1a;
  --accentSoft: rgba(127, 209, 190, 0.14);
  --wrong: #e58aa6;
  --wrongText: #e58aa6;
  --onwrong: #2a0e17;
  --wrongSoft: rgba(229, 138, 166, 0.12);
  --streak: #f0a044;
  --streakText: #f2b266;
  --streakBg: transparent;
  --streakLine: rgba(240, 170, 80, 0.45);
  --freeze: #9cb4d8;
  --learning: #3e6f68;
  --new: #253047;
  --due: #b9a7e8;
  --flagline: rgba(255, 255, 255, 0.22);
  --shadow: 0 0 0 0 transparent;
  --navbg: rgba(14, 20, 32, 0.72);
  --glow: rgba(127, 209, 190, 0.1);

  --display: 'Libre Caslon Display', 'Big Caslon', 'Iowan Old Style', Georgia, serif;
  --ui: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 20px;
  --max: 1180px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f1ea;
    --surface: #fcfbf8;
    --surface2: #f0ece3;
    --plate: #ede9df;
    --line: rgba(18, 24, 38, 0.08);
    --line2: rgba(18, 24, 38, 0.18);
    --text: #121826;
    --text2: #5d6575;
    --text3: #3a4150;
    --accent: #1e6b5e;
    --accentText: #1e6b5e;
    --onaccent: #ffffff;
    --accentSoft: #e3f0ec;
    --wrong: #b23a5e;
    --wrongText: #b23a5e;
    --onwrong: #ffffff;
    --wrongSoft: #f7e6eb;
    --streak: #e08a2c;
    --streakText: #8a4b0c;
    --streakBg: #fae9d2;
    --streakLine: transparent;
    --freeze: #4a6a98;
    --learning: #8dc2b6;
    --new: #e2ddd1;
    --due: #6a55b8;
    --flagline: rgba(0, 0, 0, 0.14);
    --shadow: 0 10px 28px -14px rgba(18, 24, 38, 0.22);
    --navbg: rgba(244, 241, 234, 0.78);
    --glow: rgba(30, 107, 94, 0.08);
  }
}
@media (max-width: 480px) {
  :root {
    --gutter: 16px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img,
svg {
  display: block;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accentText);
  text-underline-offset: 3px;
}
strong {
  font-weight: 600;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.label {
  font: 400 12px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 12px;
}

/* DS §01 lockup: a ball and a pole in the text colour, a 3:2 flag in the accent colour. */
.lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
}
.lockup svg {
  width: 28px;
  height: 28px;
  flex: none;
}
.lockup .pole {
  fill: var(--text);
}
.lockup .flag {
  fill: var(--accent);
}
.lockup span {
  font: 400 23px/1 var(--display);
}

/* Header */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navbg);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled {
  border-bottom-color: var(--line);
}
.nav .wrap {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links {
  display: flex;
  gap: 28px;
  margin-left: auto;
}
.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover {
  color: var(--text);
}
.nav .lockup + .btn {
  margin-left: auto;
}
@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
  .nav .btn {
    margin-left: auto;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  font: 600 15px/1 var(--ui);
  text-decoration: none;
  background: var(--accent);
  color: var(--onaccent);
  border: 0;
  cursor: pointer;
  transition:
    transform 0.2s,
    filter 0.2s;
}
.btn:hover {
  filter: brightness(1.06);
}
.btn:active {
  transform: scale(0.98);
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2);
}

/* Store buttons. data-stores="soon" on <html> shows "Coming soon" and makes them inert. */
.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 22px 0 18px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.store:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.5);
}
.store svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex: none;
}
.store span {
  display: flex;
  flex-direction: column;
  font: 600 19px/1.05 var(--ui);
  letter-spacing: -0.01em;
}
.store small {
  font: 500 11px/1.2 var(--ui);
  letter-spacing: 0.02em;
  opacity: 0.75;
}
[data-stores='soon'] .store {
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2);
}
[data-stores='soon'] .store .live,
[data-stores='live'] .store .soon {
  display: none;
}

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  margin-top: 96px;
  padding: 40px 0 48px;
  color: var(--text2);
  font-size: 15px;
}
.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-left: auto;
}
.foot nav a {
  color: var(--text2);
  text-decoration: none;
}
.foot nav a:hover {
  color: var(--text);
}
.foot small {
  flex-basis: 100%;
  font-size: 13px;
}

/* Text pages: privacy, terms, support, account deletion, puzzle links */
.doc {
  max-width: 44rem;
  margin: 0 auto;
  padding: 56px var(--gutter) 0;
}
.doc h1 {
  font: 400 clamp(38px, 6vw, 52px) / 1.05 var(--display);
  margin: 12px 0 16px;
  letter-spacing: -0.01em;
}
.doc h2 {
  font: 600 20px/1.3 var(--ui);
  margin: 0 0 10px;
}
.doc h3 {
  font-size: 17px;
  margin: 18px 0 4px;
}
.doc p,
.doc ol,
.doc ul {
  margin: 0 0 12px;
}
.doc li {
  margin-bottom: 6px;
}
.doc section {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1px var(--line),
    var(--shadow);
  border-radius: 20px;
  padding: 24px;
  margin-top: 16px;
}
.doc section > :last-child {
  margin-bottom: 0;
}
.doc .lead {
  font-size: 19px;
  color: var(--text3);
}
.doc .note {
  color: var(--text2);
}
