/* Équinoxe — shared design tokens and resets. hud.css (app) and screens.css (screens) build on these. */

/* Self-hosted fonts (SIL OFL 1.1, see ../fonts/OFL.txt): latin subset, variable weight, nothing from a third party. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500 900;
  font-display: swap;
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/nunito-latin.woff2') format('woff2');
}

:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: #0e141b;
  --panel: rgba(17, 23, 31, 0.86);
  --panel-solid: #17202a;
  --panel-raised: #1f2a36;
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f4efe4;
  --text-dim: #b9b2a4;
  --text-faint: #7f7a70;
  --accent: #f0b54a;      /* ambre */
  --accent-strong: #ffcf6e;
  --good: #6fd08c;
  --bad: #ef6a5a;
  --info: #7fb8ff;

  --spring: #8fd694;
  --summer: #ffd25e;
  --autumn: #f08a4b;
  --winter: #a9d8ff;

  --tribe-verdants: #2fb969;
  --tribe-solaires: #f2b417;
  --tribe-ocres: #d8452b;
  --tribe-boreaux: #3a8ef0;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --blur: blur(10px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Safe areas (notch, home indicator, rounded corners). 0 where the platform has none. */
  --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);
}

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

/* Mobile shell: the page itself never scrolls, bounces, refreshes or zooms. */
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  /* No double-tap zoom, panning stays possible inside scrollers (menus, modals). */
  touch-action: manipulation;
}
body {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

/* The toasts stay inside the safe area. The HUD handles it rule by rule (its bottom sheet reaches the
   edge of the screen), and so do the modals (#screens). */
#toasts {
  position: fixed;
  inset: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  pointer-events: none;
}
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#screens {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#hud > *, #screens > *, #toasts > * { pointer-events: auto; }
#hud { z-index: 10; }
#screens { z-index: 20; }
#toasts { z-index: 30; }

/* Text can be selected where it is meant to be read or typed. */
input, textarea, [contenteditable='true'], .eq-selectable {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
img, svg, canvas { -webkit-user-drag: none; }

button { font-family: inherit; color: inherit; }

/* ------------------------------------------------------------------ */
/* PWA: update toast (src/pwa/index.ts)                                */
/* ------------------------------------------------------------------ */
.eq-update {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translate(-50%, 20px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--panel-border));
  box-shadow: var(--shadow);
  color: var(--text);
  font: 700 14px/1.25 var(--font-ui);
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.eq-update.is-in { opacity: 1; transform: translate(-50%, 0); }
.eq-update-text { min-width: 0; }
.eq-update-go, .eq-update-later {
  flex: none;
  min-height: 36px;
  border-radius: 999px;
  border: 0;
  font: 800 14px/1 var(--font-ui);
  cursor: pointer;
}
.eq-update-go { padding: 0 16px; background: linear-gradient(180deg, var(--accent-strong), var(--accent)); color: #2b1b02; }
.eq-update-later { width: 36px; padding: 0; background: rgba(255, 255, 255, 0.08); color: var(--text-dim); font-size: 18px; }
.eq-update button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
@media (max-width: 480px) {
  .eq-update { left: 12px; right: 12px; max-width: none; transform: translateY(20px); flex-wrap: wrap; justify-content: center; border-radius: 18px; padding: 10px 12px; }
  .eq-update.is-in { transform: none; }
  .eq-update-text { flex: 1 1 100%; text-align: center; }
  .eq-update-go { flex: 1; }
}

/* ------------------------------------------------------------------ */
/* PWA: install screen (src/ui/screens/install.ts)                     */
/* ------------------------------------------------------------------ */
.eq-install .eq-panel { width: min(540px, 100%); }
.eq-install-head { align-items: flex-start; }
.eq-install-titles { flex: 1; min-width: 0; }
.eq-install-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 15px;
  line-height: 1.5;
}
.eq-install-main, .eq-install-dl-slot { display: flex; flex-direction: column; gap: 14px; }
.eq-install-dl-slot:empty { display: none; }
.eq-install-dl { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-top: 1px solid var(--panel-border); }
.eq-install-dl .eq-section { margin: 12px 0 2px; }
.eq-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: eq-step; }
.eq-step {
  position: relative;
  min-height: 30px;
  padding: 3px 0 0 42px;
  counter-increment: eq-step;
  color: var(--text);
}
.eq-step::before {
  content: counter(eq-step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--accent-strong);
  font: 800 14px/1 var(--font-ui);
}
.eq-step strong { color: var(--accent-strong); font-weight: 800; }
.eq-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.4em;
  margin: 0 0.1em;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.09);
  font: 800 0.95em/1 var(--font-ui);
  vertical-align: -0.35em;
}
.eq-key.eq-key-ico { width: 1.7em; height: 1.7em; padding: 0.28em; box-sizing: border-box; }
.eq-key.eq-key-ico svg { width: 100%; height: 100%; }
.eq-install-note { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.eq-install-ok {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--good) 50%, transparent);
  background: color-mix(in srgb, var(--good) 13%, transparent);
  color: var(--text);
}
.eq-install-ok strong { color: var(--good); }
.eq-install .eq-btn { text-decoration: none; }
@media (max-width: 720px) {
  .eq-install.eq-backdrop { padding: max(14px, var(--safe-top)) max(14px, var(--safe-right)) max(14px, var(--safe-bottom)) max(14px, var(--safe-left)); }
  .eq-install .eq-panel { border-radius: 20px; border: 1px solid var(--panel-border); }
  .eq-install-body { padding: 12px 16px 18px; }
}
#screens .eq-install .eq-panel:focus { outline: none; }
