/* Global GUI settings (admin /admin/gui, migration 0013, app/src/GuiSettings.php).
   The server puts a class on <html> for each setting that is on, so nothing here applies by default.
   The font setting is one font plus two switches: gui-ui-<font> is on <html> when the font is used for
   the interface, gui-story-<font> when it is used for the story. Only one font is chosen at a time, so
   there is no precedence between fonts. Fonts that are not licensed for publishing (preview fonts) are
   not here: their rules and files come only to the owner, from /admin/fonts.css
   (app/fonts-restricted/gui-preview.css); see GuiSettings::FONTS.
   Fonts are self-hosted, SIL Open Font License (see /assets/fonts/*-OFL.txt); they load only when a
   rule using them applies. Glyphs a font lacks (Silkscreen has no w or y with a circumflex, for the
   Welsh) fall back to the next family in the stack, one character at a time. */

@font-face {
  font-family: "BG Silkscreen";
  src: url("/assets/fonts/silkscreen.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BG Pixelify Sans";
  src: url("/assets/fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BG IM Fell English";
  src: url("/assets/fonts/im-fell-english.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BG IM Fell English";
  src: url("/assets/fonts/im-fell-english-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Pixel font for the interface: everything set in the site's mono and sans faces (menus, buttons,
   labels, panels, tabs, chips, the landing page and the game's chrome). The story keeps --story-font. */
html.gui-ui-pixel {
  --font-mono: "BG Silkscreen", "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", ui-monospace, monospace;
  --font-sans: "BG Silkscreen", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Pixel type is drawn on a grid: no smoothing games, and no synthetic bold or italic. */
html.gui-ui-pixel body { font-synthesis: none; }
/* The face is wide: tighten the tracking where a row of labels must fit (the panel tabs). */
html.gui-ui-pixel .side-tabs button[data-tab] { letter-spacing: 0.02em; }

/* Map lettering for the interface: the parchment map's lettering (the site's serif) for everything
   set in the mono and sans faces. The monospace look used wide tracking and capitals; the serif keeps
   the capitals but needs less tracking to read well. */
html.gui-ui-map {
  --font-mono: var(--font-serif);
  --font-sans: var(--font-serif);
}
html.gui-ui-map body { font-variant-numeric: oldstyle-nums; }
html.gui-ui-map .side-tabs button[data-tab] { letter-spacing: 0.08em; }

/* Pixel font for the story. The reading settings set --story-font (and size and leading) on the root
   element as inline style, so this needs !important to win; the size and leading are scaled from what
   the player chose. */
html.gui-story-pixel {
  --story-font: "BG Pixelify Sans", Georgia, "Times New Roman", serif !important;
}
html.gui-story-pixel .story-inner {
  font-size: calc(var(--story-size) * 1.08);
  line-height: calc(var(--story-leading) + 0.12);
  letter-spacing: 0.01em;
  font-synthesis: none;
}

/* IM Fell English (old English printing, not blackletter; SIL OFL). Covers the Welsh circumflexes,
   curly quotes, the em and en dash, the middle dot and the ellipsis; it lacks arrows (U+2192), which
   fall back to the next family one character at a time. For the interface: Fell has a small x-height,
   so font-size-adjust lifts it to read at the site's small label sizes; the tracking meant for a
   monospace is eased on the tabs. */
html.gui-ui-oldworld {
  --font-mono: "BG IM Fell English", Georgia, "Times New Roman", serif;
  --font-sans: "BG IM Fell English", Georgia, "Times New Roman", serif;
}
html.gui-ui-oldworld body { font-size-adjust: 0.5; }
html.gui-ui-oldworld .side-tabs button[data-tab] { letter-spacing: 0.05em; }
/* For the story: a little larger and looser than the chosen reading size (the x-height is small).
   --story-font needs !important as for the pixel story. */
html.gui-story-oldworld {
  --story-font: "BG IM Fell English", Georgia, "Times New Roman", serif !important;
}
html.gui-story-oldworld .story-inner {
  font-size: calc(var(--story-size) * 1.1);
  line-height: calc(var(--story-leading) + 0.06);
  letter-spacing: 0.005em;
}

/* The landing wordmark is sized to the viewport width (9.5vw) for a monospace; a serif is a little wider
   and overflowed a phone screen by 2 or 3 pixels, so it is sized slightly smaller under this font. */
html.gui-ui-oldworld .series-title .glass,
html.gui-ui-pixel .series-title .glass { font-size: clamp(2rem, 9vw, 5.6rem); }

/* The JOURNEY COMPLETE display keeps its own lettering (the default monospace) under the fonts that
   change the interface's look. (The pixel and map-lettering choices always restyled it; unchanged.) */
html.gui-ui-oldworld .lcd-menu {
  --font-mono: "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", ui-monospace, monospace;
  font-size-adjust: none;
}

/* Reduced motion for everyone (BG-159, Admin → GUI settings; app/src/GuiTheme.php): the same as base.css's
   prefers-reduced-motion rule, for every visitor while the owner has it on. Scripts read it through
   public/js/shell/gui-settings.js reducedMotion(). Never on /admin pages (app/views/layout.php). */
html.gui-reduce-motion *, html.gui-reduce-motion *::before, html.gui-reduce-motion *::after {
  animation-duration: 0.01ms !important; transition-duration: 0.01ms !important;
}
