/* Encre sobre: the shared foundation of every page that links it. Tokens, the Inter face,
   the type scale (13 px floor), flat surfaces and one layout container, so the bar and
   the content share the same edges. Game screens add their own rules on top. */

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Colours. Surfaces are flat: no gradient, grain, blur or glow. */
  --bg: #11131d;
  --surface: #1a1e2b;
  --raised: #272d3e;
  --line: #262b3a;
  --line-2: #3a4155;
  --text: #f7f8fc;
  --text-2: #acb4c8;
  --text-3: #9098ad;
  --lime: #d7f879;
  --on-lime: #172016;
  --cyan: #76e4d2;
  --on-cyan: #0d2b27;
  --gold: #e9bf66;
  --on-gold: #2a1e00;

  /* Type. No text is smaller than --fs-13; tests/site-foundation.test.ts holds the floor. */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-17: 17px;
  --fs-18: 18px;
  --fs-22: 22px;
  --fs-24: 24px;
  --fs-28: 28px;
  --fs-36: 36px;

  /* Spacing. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-14: 56px;

  /* Radii: badges, tiles and keys, buttons, cards. */
  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Layout: one container on every page. */
  --max: 1120px;
  --gutter: 16px;
  --bar: 56px;
  --target: 44px;
}
@media (min-width: 720px) {
  :root {
    --gutter: 32px;
    --bar: 64px;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-16) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}
/* Hover only where a pointer hovers: on a touch screen it would stay lit after the tap. */
@media (hover: hover) {
  button:hover {
    filter: brightness(1.1);
  }
}
/* Pressed: what the finger or the pointer holds answers at once. The transition has zero
   specificity, so a game's own keeps priority; while pressed, the scale and darkening (0,2,0)
   win over a game's plain class rule. Disabled controls, and those a game marks
   `aria-disabled`, do not move. */
:where(button, .btn, summary) {
  transition:
    transform 80ms ease-out,
    filter 80ms ease-out;
}
:where(button, .btn, summary):active:not(:disabled, [aria-disabled='true']) {
  filter: brightness(0.9);
  transform: scale(0.97);
}
:where(a):active {
  filter: brightness(0.9);
}
[hidden] {
  display: none !important;
}

/* The container: the bar and the content share its edges. Pages declare
   `viewport-fit=cover`, so a phone held sideways keeps both clear of its notch. */
.wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  padding-inline: max(var(--gutter), env(safe-area-inset-left))
    max(var(--gutter), env(safe-area-inset-right));
}

/* Top bar. */
.bar {
  border-bottom: 1px solid var(--line);
}
.bar-in {
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--target);
  text-decoration: none;
  font-size: var(--fs-17);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
}
.brand-mark i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--lime);
}
.brand-mark i:nth-child(2) {
  background: var(--cyan);
}
.brand-mark i:nth-child(3) {
  background: #6b76b0;
}

/* Buttons and badges. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-16);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--lime);
  color: var(--on-lime);
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge-gold {
  background: var(--gold);
  color: var(--on-gold);
}

/* Footer. */
.foot {
  margin-top: var(--space-14);
  border-top: 1px solid var(--line);
}
.foot-in {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--fs-14);
  color: var(--text-3);
}

/* Footer links: the data page, and the profile on pages that have it. The site's name keeps
   its line; the links wrap first. */
.foot-in > span {
  flex: none;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  column-gap: var(--space-4);
}
.foot-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--text-2);
  font-size: var(--fs-15);
  font-weight: 600;
  text-decoration: none;
}
@media (hover: hover) {
  .foot-link:hover {
    color: var(--text);
  }
}

/* Forced colours (Windows contrast themes) replace every colour with the system's: give an
   edge to what only a fill told apart, keep the brand mark's squares, and draw the focus
   ring and disabled controls in the system's own colours. */
@media (forced-colors: active) {
  .btn,
  .badge {
    border: 1px solid ButtonText;
  }
  .brand-mark i {
    background: CanvasText;
  }
  button:focus-visible,
  a:focus-visible {
    outline-color: Highlight;
  }
  button:disabled,
  .btn:disabled {
    border-color: GrayText;
    color: GrayText;
  }
}

/* Le Mot keeps its animations whatever this preference says (#65); elsewhere a press keeps
   its darkening and loses its movement. */
@media (prefers-reduced-motion: reduce) {
  /* (0,3,0), above the press rule's (0,2,0): the scale goes, the darkening stays. */
  :where(body:not(.le-mot)) :where(button):active:not(:disabled):not([aria-disabled='true']) {
    transform: none;
  }
  :where(body:not(.le-mot)) :where(.btn):active:not(:disabled):not([aria-disabled='true']) {
    transform: none;
  }
  :where(body:not(.le-mot)) :where(summary):active:not(:disabled):not([aria-disabled='true']) {
    transform: none;
  }
  :where(body:not(.le-mot)),
  :where(body:not(.le-mot)) *,
  :where(body:not(.le-mot)) *:before,
  :where(body:not(.le-mot)) *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
