/*
 * Le socle du site et de l'espace connecté, aux couleurs de l'appli (thème « Guilde ») : ambre sur parchemin en clair,
 * ambre sur encre en sombre. Le thème suit l'appareil (Auto) ; data-theme sur <html> force clair ou sombre.
 */

@font-face {
  font-family: "Cinzel";
  src: url("/assets/cinzel-563de74d.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/source_sans_3-e2993176.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F3ECDF;
  --bg2: #EDE4D3;
  --card: #FFFDF8;
  --line: #E0D2BB;
  --ink: #2A2218;
  --mute: #675946;
  --acc: #8F5712;
  --on-acc: #FFFFFF;
  --wash: #F2E1C2;
  --outline: #94805F;
  --copper: #A0522D;
  --gold: #8C6D00;
  --gain: #1C5622;
  --loss: #B22C22;
  --bezel: #14110D;
  --glow: rgba(143, 87, 18, .12);
  --bubble-bg: #F3ECDF;
  --shadow: 0 1px 2px rgba(42, 34, 24, .06), 0 14px 34px -14px rgba(42, 34, 24, .25);
  --shadow-lg: 0 2px 4px rgba(42, 34, 24, .08), 0 36px 70px -30px rgba(42, 34, 24, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --serif: "Cinzel", "Trajan Pro", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Le sombre, deux fois : choisi par l'appareil (Auto), ou forcé. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    color-scheme: dark;
    --bg: #171410;
    --bg2: #120F0C;
    --card: #211C16;
    --line: #40372A;
    --ink: #F3EAD8;
    --mute: #BDB098;
    --acc: #E2A140;
    --on-acc: #171410;
    --wash: #4D3C1F;
    --outline: #8E8068;
    --copper: #E8915F;
    --gold: #E8C547;
    --gain: #9EDB9B;
    --loss: #F0806F;
    --bezel: #050403;
    --glow: rgba(226, 161, 64, .16);
    --bubble-bg: #1D1914;
    --shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 20px 40px -20px rgba(0, 0, 0, .9);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 40px 80px -30px rgba(0, 0, 0, .9);
  }
  :root:not([data-theme="clair"]) .th-light { display: none; }
  :root:not([data-theme="clair"]) .th-dark { display: block; }
}

:root[data-theme="sombre"] {
  color-scheme: dark;
  --bg: #171410;
  --bg2: #120F0C;
  --card: #211C16;
  --line: #40372A;
  --ink: #F3EAD8;
  --mute: #BDB098;
  --acc: #E2A140;
  --on-acc: #171410;
  --wash: #4D3C1F;
  --outline: #8E8068;
  --copper: #E8915F;
  --gold: #E8C547;
  --gain: #9EDB9B;
  --loss: #F0806F;
  --bezel: #050403;
  --glow: rgba(226, 161, 64, .16);
  --bubble-bg: #1D1914;
  --shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 20px 40px -20px rgba(0, 0, 0, .9);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 40px 80px -30px rgba(0, 0, 0, .9);
}
:root[data-theme="sombre"] .th-light { display: none; }
:root[data-theme="sombre"] .th-dark { display: block; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
  interpolate-size: allow-keywords;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--acc); }
a:hover { color: var(--ink); }
h1, h2, h3, h4, p { overflow-wrap: break-word; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--wash); color: var(--ink); }

svg.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg.f { flex: none; fill: currentColor; }
.th-dark { display: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--acc);
  color: var(--on-acc);
  font-weight: 600;
  text-decoration: none;
  transition: top .2s;
}
.skip:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Boutons : plein ambre pour l'action principale, contour pour le reste. */
.btn, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 1.2px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s, filter .2s, background-color .25s, color .25s, border-color .25s;
}
.btn {
  border: 0;
  background: var(--acc);
  color: var(--on-acc);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc) 50%, transparent), 0 14px 30px -14px var(--acc);
}
.btn:hover { color: var(--on-acc); transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 15.5px; }
.ghost {
  border: 1.5px solid color-mix(in srgb, var(--acc) 60%, transparent);
  background: transparent;
  color: var(--acc);
}
.ghost:hover { border-color: var(--acc); background: var(--acc); color: var(--on-acc); }
.ghost.big { min-height: 56px; padding: 0 28px; font-size: 15.5px; }
.ghost.small, .btn.small { min-height: 40px; padding: 0 16px; font-size: 13px; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  color: var(--acc);
  text-decoration: none;
}
.link:hover { color: var(--acc); text-decoration: underline; text-underline-offset: 4px; }

/* Le choix du thème : Auto, Clair, Sombre, comme dans l'appli. */
.theme-menu { position: relative; }
.theme-menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--mute);
  list-style: none;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.theme-menu summary::-webkit-details-marker { display: none; }
.theme-menu summary:hover, .theme-menu[open] summary { background: var(--wash); color: var(--ink); }
.theme-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  display: grid;
  gap: 2px;
  min-width: 168px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  animation: pop-in .22s var(--ease) both;
  transform-origin: top right;
}
.theme-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 600 15.5px var(--sans);
  text-align: left;
  cursor: pointer;
}
.theme-pop button:hover { background: var(--bg); }
.theme-pop button[aria-pressed="true"] { background: var(--wash); }
.theme-pop button[aria-pressed="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--acc);
}

.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-weight: 600;
  animation: rise .4s var(--ease) both;
}
.flash.ok { border-color: color-mix(in srgb, var(--gain) 40%, var(--line)); color: var(--gain); }
.flash.ko { border-color: color-mix(in srgb, var(--loss) 40%, var(--line)); color: var(--loss); }

@keyframes rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: none; } }
@keyframes pop-in { from { opacity: 0; scale: .92; } to { opacity: 1; scale: 1; } }

/* Les blocs apparaissent en glissant quand on les fait défiler (navigateurs qui le savent ; les autres les montrent). */
@supports (animation-timeline: view()) {
  .rv { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }
}

/* Le changement de thème se fait en fondu, là où le navigateur sait le faire. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

@media (max-width: 880px) {
  .wrap { padding: 0 18px; }
  body { font-size: 16.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
