/* Text pages beside the game; colours and fonts follow the tokens in src/ui/styles.css. */
/* Baloo 2 ships with the game (assets/fonts, SIL OFL), so the title font needs no network. */
@font-face {
  font-family: 'Baloo 2';
  src: url('/fonts/Baloo2-VariableFont_wght.ttf') format('truetype');
  font-weight: 700 800;
  font-display: swap;
}

:root {
  --ink: #1f1640;
  --cream: #fff5e1;
  --surface: #ffffff;
  --link: #0b7a73;
  --cta: #d93a1a;
  --rule: rgba(31, 22, 64, 0.16);
  --title-font: 'Baloo 2', ui-rounded, system-ui, sans-serif;
  --text-font: ui-rounded, 'SF Pro Rounded', -apple-system, system-ui, sans-serif;
  --measure: 720px;
  --tap: 44px;
  --gutter: 20px;
  /* The pages run edge to edge (viewport-fit=cover), so text keeps clear of the notch and home indicator. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --band-right: max(calc(var(--gutter) + var(--safe-right)), calc((100% - var(--measure)) / 2 + var(--gutter)));
  --band-left: max(calc(var(--gutter) + var(--safe-left)), calc((100% - var(--measure)) / 2 + var(--gutter)));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 17px/1.6 var(--text-font);
}

/* The app turns off the web view's own scrolling for the game, so the body scrolls in its place. */
html.in-app { height: 100%; overflow: hidden; }
.in-app body {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

a { color: var(--link); text-underline-offset: 2px; }
a:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }

/* The way back to the game from every text page, in a browser tab or inside the app. */
.back-to-game {
  display: flex;
  align-items: center;
  min-height: calc(var(--tap) + var(--safe-top));
  padding: var(--safe-top) var(--band-right) 0 var(--band-left);
  border-bottom: 1px solid rgba(255, 245, 225, 0.16);
  background: var(--ink);
  color: var(--cream);
  font: 700 16px/1 var(--title-font);
  text-decoration: none;
}
.back-to-game:hover { text-decoration: underline; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 24px;
  padding: 8px var(--band-right) 8px var(--band-left);
  background: var(--ink);
}
.site-header a { color: var(--cream); }
.brand { font: 800 26px/var(--tap) var(--title-font); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; column-gap: 16px; }
.site-header nav a, .site-footer a { display: inline-block; line-height: var(--tap); font-size: 15px; }

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 32px calc(var(--gutter) + var(--safe-right)) 48px calc(var(--gutter) + var(--safe-left));
}

h1, h2, h3 { font-family: var(--title-font); font-weight: 800; line-height: 1.2; }
h1 { margin: 0 0 12px; font-size: clamp(34px, 6vw, 46px); }
h2 { margin: 36px 0 8px; font-size: 25px; }
h3 { margin: 20px 0 6px; font-size: 19px; }
p, ul, dl, table { margin: 0 0 14px; }
li { margin-bottom: 6px; }
.lead { font-size: 19px; }
.updated { font-size: 15px; opacity: 0.75; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 9px 12px; border: 1px solid var(--rule); text-align: left; vertical-align: top; }

dt { margin-top: 12px; font-weight: 700; }
dd { margin: 0; }

.cta { margin: 40px 0 0; }
.play {
  display: inline-block;
  padding: 0 28px;
  border-radius: 14px;
  background: var(--cta);
  color: #fff;
  font: 800 21px/52px var(--title-font);
  text-decoration: none;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 12px calc(var(--gutter) + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
  border-top: 1px solid var(--rule);
}

/* Opened from the iPhone app: no way back into the web game, since closing the sheet returns to it. */
html.in-app .back-to-game, html.in-app .cta { display: none; }
html.in-app .brand { pointer-events: none; }
