/* ============================================================
   MYTHÉO — Design system
   Variables, réinitialisation, typographie, boutons, accessibilité.
   Partagé par le portail et l'explorateur.
   ============================================================ */

:root {
  --bg: #080b18;
  --bg-raised: #10152b;
  --bg-raised-2: #171d3a;
  --line: #262d4e;
  --text: #f3f5fb;
  --text-dim: #aab0cc;
  --text-faint: #7a80a0;

  --accent: #8fa4ff;
  --accent-strong: #b6c3ff;
  --accent-ink: #0c1030;

  --danger: #ff7a7a;
  --danger-ink: #2a0808;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-round: 999px;

  --touch: 48px;
  --gap: 16px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --shadow-1: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);

  color-scheme: dark;
}

/* --- thèmes par mythologie (posés sur les cartes / le corps de l'explorateur) --- */
[data-theme="amber"]    { --accent: #e9b64f; --accent-strong: #ffd680; --accent-ink: #241703; }
[data-theme="teal"]     { --accent: #4fd6c8; --accent-strong: #8bf0e4; --accent-ink: #04211d; }
[data-theme="crimson"]  { --accent: #e2685f; --accent-strong: #ff9a92; --accent-ink: #2a0a08; }
[data-theme="ice"]      { --accent: #7fb8e9; --accent-strong: #bfe0ff; --accent-ink: #071a2a; }
[data-theme="saffron"]  { --accent: #e28f3f; --accent-strong: #ffbd77; --accent-ink: #2a1503; }

/* --- réinitialisation --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button, input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}
a { color: var(--accent-strong); text-decoration-thickness: 1px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* --- accessibilité --- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- boutons --- */
.btn {
  min-height: var(--touch);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-raised-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-round);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.primary:hover { background: var(--accent-strong); }

.danger-btn {
  min-height: var(--touch);
  padding: 0 18px;
  border-radius: var(--radius-round);
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
}
.danger-btn:hover { background: var(--danger-ink); }

/* --- anneau de progression (portail + explorateur) --- */
.ring {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.ring circle.track { stroke: var(--line); }
.ring circle.val {
  stroke: var(--accent);
  stroke-dasharray: 125.6;
  stroke-dashoffset: 125.6;
  transition: stroke-dashoffset .5s ease;
}
.ring b {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* --- détails / accordéon --- */
details > summary {
  cursor: pointer;
  min-height: var(--touch);
  display: flex;
  align-items: center;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }

/* --- toast --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-raised-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-2);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 80;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
