/* Cairnheim — feuille de style du site vitrine.
   Parti pris : parchemin. L'art du jeu est ensoleillé et saturé ; la page emprunte sa lumière
   plutôt que de le poser sur un fond d'application technique. Palette tirée des couleurs réelles
   du jeu (prototype/src/config.ts) : herbe, route, bois, or. */

:root {
  /* Couleurs du jeu */
  --grass: #3a7d44;
  --grass-deep: #2c5e34;
  --road: #c9a26b;
  --wood: #9c7b4e;
  --wood-deep: #6b5334;

  /* Parchemin */
  --paper: #f2e6cf;
  --paper-hi: #f8f0de;      /* sections claires, cartes */
  --paper-lo: #ebdcc0;      /* sections en creux */
  --paper-card: #fbf5e8;

  /* Encre */
  --ink: #33281c;
  --ink-soft: #6b5a44;
  --ink-faint: #786751;     /* légendes, mentions — 4,8:1 sur carte claire */

  /* Accents */
  --gold: #b8862b;          /* aplats, filets, puces */
  --gold-text: #7c5510;     /* texte sur parchemin — 5,3:1, lisible en petit corps gras */
  --line: #ddcbaa;
  --line-strong: #c9b28a;

  --shadow-s: 0 2px 6px rgba(74, 54, 28, .07);
  --shadow-m: 0 10px 24px -12px rgba(74, 54, 28, .32);
  --shadow-l: 0 28px 60px -28px rgba(74, 54, 28, .55);

  --radius: 12px;
  --maxw: 1160px;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* Deux voiles très légers : le parchemin n'est jamais parfaitement uniforme. */
  background:
    radial-gradient(1200px 600px at 15% -5%, rgba(255, 252, 240, .85), transparent 60%),
    radial-gradient(900px 500px at 95% 8%, rgba(201, 162, 107, .16), transparent 62%),
    var(--paper);
  background-attachment: fixed;
}

img { max-width: 100%; display: block; }
a { color: var(--gold-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--grass-deep); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.18; margin: 0 0 .5em; color: var(--ink); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); letter-spacing: -.005em; }
h3 { font-size: 1.26rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  font-family: var(--sans); font-size: .76rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text);
  margin: 0 0 .9em; display: flex; align-items: center; gap: 10px;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.hero-inner .eyebrow { justify-content: center; }
.hero-inner .eyebrow::after { display: none; }

.lede { font-size: 1.14rem; color: var(--ink-soft); max-width: 64ch; }
.muted { color: var(--ink-soft); }
.small { font-size: .92rem; }

/* ---------- Barre de navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 240, 222, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--shadow-s);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.24rem; color: var(--ink); text-decoration: none; }
.brand .mark {
  width: 24px; height: 24px; flex: none;
  background: linear-gradient(160deg, #b9bfc4, #6c7177);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6);
}
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: .95rem; text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
/* Le bouton de la barre est aussi un `.nav-links a` : sans ces règles plus spécifiques, la couleur
   des liens de nav l'emporte et on obtient du texte brun sur fond vert. */
.nav-links a.btn-primary, .nav-links a.btn-primary:hover { color: #f7f2e4; }
.nav-links a.btn-ghost, .nav-links a.btn-ghost:hover { color: var(--ink); }
.nav-toggle { display: none; background: var(--paper-card); border: 1px solid var(--line-strong); color: var(--ink); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 9px;
  font-weight: 650; font-size: .97rem; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(180deg, #4c9a56, var(--grass-deep));
  color: #f7f2e4; border-color: #24512b;
  box-shadow: 0 6px 16px -8px rgba(44, 94, 52, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { color: #fff; box-shadow: 0 10px 22px -8px rgba(44, 94, 52, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-ghost { background: var(--paper-card); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-s); }
.btn-ghost:hover { border-color: var(--wood); color: var(--ink); }
.btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 76px 0 0; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% -20% auto -20%; height: 560px;
  background: radial-gradient(55% 60% at 50% 0%, rgba(58, 125, 68, .16), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; text-align: center; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.5rem); letter-spacing: -.015em; margin-bottom: .3em; }
.hero h1 span { color: var(--grass-deep); }
.hero .lede { margin: 0 auto 2em; text-align: center; font-size: 1.2rem; color: var(--ink-soft); }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.hero-note { font-size: .87rem; color: var(--ink-soft); }

/* Captures : cadre bois, comme une planche encadrée. */
.shot {
  margin: 48px 0 0; border-radius: var(--radius); overflow: hidden;
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-l);
}
.shot img { width: 100%; height: auto; border-bottom: 3px solid var(--wood-deep); }
.shot figcaption { padding: 12px 18px; font-size: .87rem; color: var(--ink-faint); }

/* ---------- Sections ---------- */
section { padding: 88px 0; position: relative; }
section + section { border-top: 1px solid var(--line); }
/* Une section sur deux repose sur un parchemin légèrement plus profond. */
#loop, #world, #roadmap { background: linear-gradient(180deg, rgba(235, 220, 192, .55), rgba(235, 220, 192, .25)); }
.section-head { max-width: 66ch; margin-bottom: 44px; }

.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow-s);
}
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
.card p { color: var(--ink-soft); }
.card .ico { font-size: 1.7rem; line-height: 1; margin-bottom: 14px; display: block; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split.reverse > :first-child { order: 2; }

/* ---------- Chaînes de production ---------- */
.chain {
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: var(--radius); background: var(--paper-card);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-s);
}
.chain h3 {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gold-text); margin-bottom: 14px;
}
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.node {
  display: flex; align-items: center; gap: 9px;
  background: var(--paper-hi); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 13px 7px 9px; font-size: .93rem; white-space: nowrap;
}
.node img { width: 28px; height: 28px; object-fit: contain; }
.node.b { border-color: var(--line-strong); background: linear-gradient(180deg, #fdf8ec, #f1e5cb); font-weight: 600; }
.arrow { color: var(--wood-deep); font-size: 1.05rem; }

/* ---------- Galerie de bâtiments ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 14px; }
.tile {
  background: linear-gradient(180deg, rgba(58, 125, 68, .13), rgba(251, 245, 232, .9));
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 10px 12px; text-align: center; box-shadow: var(--shadow-s);
}
.tile img { height: 84px; width: auto; margin: 0 auto 10px; object-fit: contain; }
.tile span { font-size: .82rem; color: var(--ink-soft); display: block; }

/* ---------- Feuille de route ---------- */
.road { position: relative; padding-left: 34px; }
.road::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line-strong); }
.step { position: relative; padding-bottom: 34px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: ""; position: absolute; left: -30px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line-strong);
}
.step.done::before { background: var(--grass); border-color: var(--grass-deep); }
.step.now::before { background: var(--gold); border-color: #8a6317; box-shadow: 0 0 0 5px rgba(184, 134, 43, .2); }
.step h3 { margin-bottom: .2em; }
.step .tag { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.step.done .tag { color: var(--grass-deep); }
.step.now .tag { color: var(--gold-text); }

/* ---------- FAQ ---------- */
details.faq { border-bottom: 1px solid var(--line); padding: 18px 0; }
details.faq summary { cursor: pointer; font-family: var(--display); font-size: 1.15rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--gold-text); font-size: 1.35rem; line-height: 1; }
details.faq[open] summary::after { content: "−"; }
details.faq p { margin: 14px 0 0; color: var(--ink-soft); }

/* ---------- Bandeau d'appel ---------- */
.cta-band {
  text-align: center;
  background: linear-gradient(180deg, rgba(58, 125, 68, .16), rgba(242, 230, 207, 0));
}
.cta-band h2 { margin-bottom: .3em; }

/* ---------- Pied de page ---------- */
footer {
  background: #2b2318; color: #c7b79c;
  padding: 44px 0; font-size: .9rem;
  border-top: 3px solid var(--wood-deep);
}
.foot { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.foot a { color: #e3d3b4; }
.foot a:hover { color: #fff; }

/* ---------- Documentation ---------- */
.docs { display: grid; grid-template-columns: 250px 1fr; gap: 56px; align-items: start; padding: 48px 0 96px; }
.toc { position: sticky; top: 88px; max-height: calc(100vh - 120px); overflow-y: auto; font-size: .93rem; }
.toc strong { display: block; font-family: var(--sans); font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-faint); margin: 22px 0 8px; }
.toc strong:first-child { margin-top: 0; }
.toc a { display: block; color: var(--ink-soft); padding: 5px 0 5px 12px; border-left: 2px solid var(--line-strong); text-decoration: none; }
.toc a:hover { color: var(--ink); background: rgba(251, 245, 232, .7); }
.toc a.active { color: var(--gold-text); border-left-color: var(--gold); font-weight: 650; background: rgba(251, 245, 232, .9); }

.doc-body { min-width: 0; }
.doc-body section { padding: 0 0 56px; border: 0; background: none; }
.doc-body h2 { scroll-margin-top: 88px; padding-top: 8px; }
.doc-body h3 { margin-top: 1.8em; }
.doc-body ul, .doc-body ol { padding-left: 22px; margin: 0 0 1em; }
.doc-body li { margin-bottom: .45em; }
.doc-body li::marker { color: var(--gold); }
.doc-body code { font-family: var(--mono); font-size: .88em; background: var(--paper-hi); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
/* Bloc de code (formules du whitepaper). `overflow-x` est OBLIGATOIRE : une ligne monospace ne se
   coupe pas, et sans conteneur qui defile elle elargit la PAGE ENTIERE — mesure sur mobile, 798 px
   pour un ecran de 375. Le double `code` neutralise le fond et la bordure de la regle ci-dessus,
   qui est faite pour du code INLINE et ferait un cadre dans un cadre. */
.doc-body pre { overflow-x: auto; background: var(--paper-hi); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 1.6em; }
.doc-body pre code { background: none; border: 0; padding: 0; font-size: .86em; }

/* ---------------------------------------------------------------------------
   RÉPARTITION DU SUPPLY — la barre proportionnelle de #tokenomics.
   Les largeurs sont posées en style inline par site.js depuis les données
   générées ; ici on ne fait que la forme et les couleurs. Quatre teintes du
   même parchemin plutôt qu'une palette : c'est un partage d'un même tout, pas
   quatre catégories sans rapport.
   --------------------------------------------------------------------------- */
.tok-bar { display: flex; height: 34px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-s); margin: 0 0 1.2em; }
.tok-seg { display: block; height: 100%; }
.tok-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px;
  border: 1px solid rgba(74, 54, 28, .25); vertical-align: baseline; }
.tok-seg-0 { background: #b8862b; }   /* vente publique — l'or franc, la part qui circule */
.tok-seg-1 { background: #8c6a2c; }
.tok-seg-2 { background: #6b5a44; }
.tok-seg-3 { background: #c9b28a; }
#tokenomics .card h3 { font-size: 1.5rem; color: var(--gold-text); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.6em; background: var(--paper-card); box-shadow: var(--shadow-s); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; min-width: 520px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #ecdfc4; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
tbody tr:nth-child(even) { background: rgba(242, 230, 207, .45); }
tbody tr:last-child td { border-bottom: 0; }
td img { width: 22px; height: 22px; object-fit: contain; display: inline-block; vertical-align: -5px; margin-right: 6px; }

.note {
  border-left: 3px solid var(--gold); background: rgba(184, 134, 43, .09);
  padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 0 0 1.6em;
}
.note.green { border-left-color: var(--grass); background: rgba(58, 125, 68, .1); }
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--ink); }

/* ---------- Utilitaires ----------
   Le site sert sous une CSP stricte (`style-src 'self'`, sans 'unsafe-inline'), qui bloque aussi
   les attributs style="" — d'où ces quelques classes plutôt que du style en ligne. */
.shot--flush { margin-top: 0; }
.wrap--narrow { max-width: 820px; }
.center-lede { margin: 0 auto 26px; }
.h-gallery { margin: 52px 0 18px; }
.doc-h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.soon { font-size: .55em; color: var(--ink-faint); font-family: var(--sans); letter-spacing: .04em; }
.gallery--sm { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.gallery--sm .tile img { height: 40px; }

/* ---------- Adaptatif ---------- */
@media (max-width: 900px) {
  body { font-size: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 28px; }
  .split.reverse > :first-child { order: 0; }
  .docs { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; margin-bottom: 40px; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; align-items: stretch;
    background: var(--paper-hi); border-bottom: 1px solid var(--line-strong); padding: 10px 24px 18px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; }
  .nav-toggle { display: block; margin-left: auto; }
  section { padding: 64px 0; }
  .hero { padding-top: 48px; }
}


/* ---- Calculateur de Pioche + liens communauté (08/08) ---- */
.calc { border: 1px solid var(--line-strong); border-radius: 14px; padding: 22px; background: var(--paper-hi); }
.calc-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.calc-in label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.calc-in label small { font-weight: 700; color: var(--accent); }
.calc-in select, .calc-in input[type=number] {
  padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--paper); color: inherit; font: 600 16px inherit;
}
.calc-in input[type=range] { width: 100%; accent-color: var(--accent); height: 26px; }
.calc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.calc-out .co { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.calc-out .co b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.calc-out .co span { font-size: 13.5px; color: var(--mut); }
.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding-top: 14px; }
.links .lnk { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: 14.5px; font-weight: 600; text-decoration: none; }
.links .lnk:hover { border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}
