/* Constelia — feuille de style unique (site public et admin).
   Mobile d'abord : la mise en page large arrive à partir de 700 px. */

@font-face {
  font-family: "Alegreya";
  src: url("../fonts/alegreya-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("../fonts/alegreya-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("../fonts/alegreya-sc-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("../fonts/alegreya-sc-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --parchment: #F2E6CC;
  --parchment-light: #F7EFDD;
  --parchment-dark: #E4D2AA;
  --wood: #3B2A1A;
  --wood-soft: #5A3E22;
  --gold: #E8C46A;
  --gold-deep: #B8904A;
  --text: #3B2A1A;
  --muted: #6E5536;
  --on-wood: #F0DCA8;
  --line: #D6C08F;
  --terre: #6E4420;
  --feu: #D8382A;
  --eau: #2F7FD8;
  --air: #3FA83A;
  --ok: #4F7A2A;
  --alert: #C8321E;
  --radius: 8px;
  --shadow: 0 1px 0 rgba(59, 42, 26, .08), 0 10px 24px -14px rgba(59, 42, 26, .45);
  --title: "Alegreya SC", Georgia, "Times New Roman", serif;
  --body: "Alegreya", Georgia, "Times New Roman", serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: var(--title);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: .01em;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

a { color: #7A4A1C; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--wood); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.muted { color: var(--muted); }
.lead { font-size: 1.25rem; color: var(--muted); max-width: 46rem; }

/* ------------------------------------------------------------ en-tête */

.site-header {
  background: var(--wood);
  border-bottom: 3px solid var(--gold);
  box-shadow: inset 0 -5px 0 -4px rgba(232, 196, 106, .35);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-family: var(--title);
  font-weight: 700;
  font-size: 1.6rem;
  text-decoration: none;
  letter-spacing: .03em;
}
.brand:hover { color: #F3D68A; }
.brand small { font-size: .9rem; color: var(--on-wood); font-weight: 400; }

.logo-star { width: 26px; height: 26px; fill: var(--gold); flex: none; }

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.nav-links a, .linklike {
  color: var(--on-wood);
  text-decoration: none;
  font-size: 1.05rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--gold); }
.nav-links a[aria-current="page"] { color: var(--gold); border-bottom-color: var(--gold); }

.nav-links .nav-beta {
  background: var(--gold);
  color: var(--wood);
  border: 0;
  border-radius: 6px;
  padding: 3px 12px;
  font-weight: 700;
}
.nav-links .nav-beta:hover, .nav-links .nav-beta[aria-current="page"] { background: #F3D68A; color: var(--wood); }

.nav-links .nav-discord {
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
  padding: 2px 11px;
}
.nav-links .nav-discord:hover { border-color: var(--gold); }

.count {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 .4em;
  border-radius: 1em;
  background: rgba(232, 196, 106, .2);
  font-size: .85em;
  text-align: center;
}

@media (min-width: 700px) {
  .nav { flex-wrap: nowrap; justify-content: space-between; padding: 12px 24px; }
  .nav-links { width: auto; justify-content: flex-end; gap: 4px 22px; }
}

/* ------------------------------------------------------------ mise en page */

/* Pied de page en bas de l'écran même quand la page est courte. */
body:not(.admin) { min-height: 100vh; display: flex; flex-direction: column; }
body:not(.admin) > main { flex: 1 0 auto; }
main { display: block; }

.section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 16px;
}
.section.narrow { max-width: 760px; }
.section + .section { padding-top: 8px; }

.section-head { max-width: 46rem; margin-bottom: 24px; }
.section-head p { color: var(--muted); }

.page-title {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 16px 8px;
}

.eyebrow {
  font-family: var(--title);
  color: var(--gold-deep);
  font-size: 1rem;
  letter-spacing: .08em;
  margin: 0 0 .3em;
}

.divider {
  border: 0;
  height: 1px;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--line);
}

.grid { display: grid; gap: 20px; }
.grid-2, .grid-3 { grid-template-columns: 1fr; }

@media (min-width: 700px) {
  h1 { font-size: 2.8rem; }
  h2 { font-size: 1.9rem; }
  .section { padding: 56px 24px; }
  .page-title { padding: 56px 24px 8px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--parchment-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }

/* Cadre « fenêtre du jeu » : bois, filet or intérieur. */
.frame {
  display: block;
  border: 3px solid var(--wood);
  border-radius: var(--radius);
  outline: 1px solid var(--gold);
  outline-offset: -6px;
  background: var(--wood);
}

figure { margin: 0; }
figcaption {
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  margin-top: 8px;
}

/* ------------------------------------------------------------ accueil */

.hero { position: relative; background: var(--wood); }
.hero-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 50%;
}
.hero-text {
  background: var(--parchment-light);
  border-bottom: 1px solid var(--line);
  padding: 24px 16px 28px;
}
.hero-text h1 { margin-bottom: .2em; }
.hero-text .tagline { font-size: 1.2rem; color: var(--muted); }

.badge {
  display: inline-block;
  font-family: var(--title);
  font-size: .95rem;
  letter-spacing: .06em;
  color: var(--wood);
  background: var(--gold);
  border-radius: 4px;
  padding: 1px 10px;
  margin-bottom: 10px;
}

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

@media (min-width: 700px) {
  .hero-img { aspect-ratio: 16 / 7.6; min-height: 420px; }
  .hero-text {
    position: absolute;
    left: 32px;
    bottom: 32px;
    max-width: 540px;
    border: 3px solid var(--wood);
    border-radius: var(--radius);
    outline: 1px solid var(--gold-deep);
    outline-offset: -7px;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .65);
    padding: 28px 30px 30px;
  }
}

.pillar h3 { display: flex; align-items: center; gap: 10px; }
.pillar .pip {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 2px var(--parchment-light), 0 0 0 3px currentColor;
  background: currentColor;
}
.pillar img { margin-bottom: 14px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; }

.pip-air { color: var(--air); }
.pip-feu { color: var(--feu); }
.pip-eau { color: var(--eau); }
.pip-terre { color: var(--terre); }

/* Pastilles des quatre éléments */
.elements {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.element {
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #FFF8E8;
  border: 1px solid rgba(0, 0, 0, .15);
}
.element strong { display: block; font-family: var(--title); font-size: 1.25rem; }
.element span { font-size: .98rem; opacity: .95; }
.el-terre { background: var(--terre); }
.el-feu { background: var(--feu); }
.el-eau { background: var(--eau); }
.el-air { background: var(--air); }
@media (min-width: 700px) {
  .elements { grid-template-columns: repeat(4, 1fr); }
}

.class-teaser { text-align: center; text-decoration: none; color: inherit; display: block; }
.class-teaser:hover { border-color: var(--gold-deep); }
.class-teaser .portraits { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.class-teaser img { width: 96px; height: 96px; border-radius: 50%; background: var(--parchment-dark); border: 2px solid var(--wood); }
.class-teaser .role { color: var(--muted); margin: 0; }

.band {
  background: var(--wood);
  color: var(--on-wood);
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
}
.band h2 { color: var(--gold); }
.band a:not(.btn) { color: var(--gold); }

/* ------------------------------------------------------------ pages de contenu */

.feature {
  display: grid;
  gap: 20px;
  align-items: center;
  grid-template-columns: 1fr;
}
.feature + .feature { margin-top: 40px; }
@media (min-width: 700px) {
  .feature { grid-template-columns: 1.15fr 1fr; gap: 36px; }
  .feature.reverse > figure { order: 2; }
}

.facts { list-style: none; padding: 0; margin: 0 0 1em; }
.facts li { padding-left: 1.4em; position: relative; margin-bottom: .45em; }
.facts li::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 9px; height: 9px;
  background: var(--gold-deep);
  transform: rotate(45deg);
}

.gallery { display: grid; gap: 16px; grid-template-columns: 1fr; }
.gallery-after { margin-top: 28px; }
@media (min-width: 700px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery-2 { grid-template-columns: repeat(2, 1fr); }
}

.anchors { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.anchors a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--parchment-light);
  border-radius: 999px;
  padding: 2px 14px;
  font-size: 1rem;
}
.anchors a:hover { border-color: var(--gold-deep); }

/* Classes */
.class-block { scroll-margin-top: 16px; }
.class-block + .class-block { margin-top: 32px; }
.class-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .class-grid { grid-template-columns: 300px 1fr; gap: 32px; }
}
.class-art {
  background: var(--parchment-dark);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  justify-items: center;
  align-self: start;
}
.class-art img { width: 120px; height: 120px; }
.class-art .portrait { border-radius: 50%; background: var(--parchment-light); border: 2px solid var(--wood); }
.class-art figcaption { grid-column: 1 / -1; margin: 0; text-align: center; }
.class-title { display: flex; align-items: center; gap: 12px; }
.class-title img { width: 48px; height: 48px; }
.class-title h2 { margin: 0; }
.class-role { font-family: var(--title); color: var(--gold-deep); margin: 4px 0 12px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.stat-row li {
  background: var(--parchment-dark);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 1rem;
}
.spell-list { columns: 1; margin: 0 0 1em; padding-left: 1.2em; }
.class-block h3 { margin-top: .8em; }
@media (min-width: 700px) { .spell-list { columns: 2; } }

/* ------------------------------------------------------------ notes de version */

.notes-layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
.notes-index h2 { font-size: 1.15rem; margin-bottom: .4em; }
.notes-index ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.notes-index a {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--parchment-light);
  padding: 4px 10px;
  font-size: 1rem;
}
.notes-index .v { font-weight: 700; }
.notes-index .d { color: var(--muted); }
@media (min-width: 900px) {
  .notes-layout { grid-template-columns: 220px 1fr; padding: 32px 24px 64px; }
  .notes-index { position: sticky; top: 16px; align-self: start; }
  .notes-index ul { display: block; }
  .notes-index li + li { margin-top: 6px; }
}

.note { scroll-margin-top: 16px; }
.note + .note { margin-top: 24px; }
.note-head { border-bottom: 1px solid var(--line); margin-bottom: 16px; padding-bottom: 8px; }
.note-meta { margin: 0 0 .2em; color: var(--muted); font-size: 1rem; }
.note-anchor { color: var(--gold-deep); font-weight: 700; text-decoration: none; }
.note-anchor:hover { text-decoration: underline; }

.prose h2 { font-size: 1.3rem; margin-top: 1.2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.1rem; margin-top: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .3em; }
.prose code {
  font-size: .9em;
  background: var(--parchment-dark);
  border-radius: 4px;
  padding: 0 4px;
}
.prose pre { overflow-x: auto; background: var(--parchment-dark); padding: 12px; border-radius: 6px; }
.prose blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--gold-deep); color: var(--muted); }
.prose table { border-collapse: collapse; margin-bottom: 1em; }
.prose th, .prose td { border: 1px solid var(--line); padding: 4px 8px; }

.sec { padding-left: 12px; border-left: 5px solid var(--wood-soft); }
.sec-nouveautes { border-left-color: var(--air); }
.sec-ameliorations { border-left-color: var(--eau); }
.sec-equilibrage { border-left-color: var(--terre); }
.sec-corrections { border-left-color: var(--feu); }
.sec-problemes { border-left-color: var(--muted); }

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

/* ------------------------------------------------------------ formulaires et boutons */

.btn {
  display: inline-block;
  font-family: var(--title);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  color: var(--on-wood);
  background: var(--wood);
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
  padding: 10px 18px;
}
.btn:hover { color: var(--gold); border-color: var(--gold); }
.btn-gold { background: var(--gold); color: var(--wood); border-color: var(--gold-deep); }
.btn-gold:hover { background: #F3D68A; color: var(--wood); }
.btn-ghost { background: transparent; color: var(--wood); border-color: var(--wood); }
.btn-ghost:hover { background: var(--wood); color: var(--gold); }
.btn-red { background: var(--alert); color: #FFF4E6; border-color: #8E2214; }
.btn-red:hover { background: #A82A18; color: #FFF4E6; }
.btn-small { font-size: .95rem; padding: 5px 12px; }

.linklike {
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.linklike:hover { color: var(--gold); }

.inline { display: inline; margin: 0; }

.form .field { margin-bottom: 18px; border: 0; padding: 0; }
.form label, .form legend, .form .label {
  display: block;
  font-family: var(--title);
  font-weight: 700;
  margin-bottom: 6px;
}
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="date"], .form input:not([type]), .form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #FFFCF4;
  border: 1px solid #C9B184;
  border-radius: 6px;
  padding: 10px 12px;
}
.form textarea { font-family: Consolas, "Courier New", monospace; font-size: .95rem; line-height: 1.5; resize: vertical; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--gold); border-color: var(--wood); }
.form-note { font-size: .98rem; color: var(--muted); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-family: var(--body) !important;
  font-weight: 400 !important;
  background: #FFFCF4;
  border: 1px solid #C9B184;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  margin: 0 !important;
}
.choice:has(input:checked) { border-color: var(--wood); background: var(--parchment-dark); box-shadow: inset 0 0 0 1px var(--wood); }
.choice input { accent-color: var(--wood); margin: 0; }

/* Champ piège pour les robots : hors de l'écran. */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.notice {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 20px;
  border: 1px solid;
}
.notice h2 { font-size: 1.3rem; }
.notice ul { margin: .3em 0 0; padding-left: 1.2em; }
.notice p:last-child { margin-bottom: 0; }
.notice-ok { background: #E6EFD3; border-color: #9DB774; color: #2F4A14; }
.notice-error { background: #F6DCD3; border-color: #D99A88; color: #6E1C0E; }

/* ------------------------------------------------------------ pied de page */

.site-footer {
  background: var(--wood);
  color: var(--on-wood);
  border-top: 3px solid var(--gold);
}
main > .section:last-child { padding-bottom: 64px; }
.band + .site-footer, main:has(> .band:last-child) + .site-footer { border-top-width: 0; }
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 16px 32px;
}
.footer-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--title); font-size: 1.4rem; color: var(--gold); margin-bottom: .3em;
}
.footer-links { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: var(--gold); }
.footer-small { font-size: .95rem; opacity: .8; margin: 0; }

/* ------------------------------------------------------------ admin */

.admin-main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.admin-main h1 { font-size: 1.9rem; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login h1 { font-size: 1.8rem; }

.table-wrap { overflow-x: auto; margin: 16px 0 28px; }
.table { width: 100%; border-collapse: collapse; background: var(--parchment-light); border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--title); background: var(--parchment-dark); }
@media (max-width: 699px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 2px solid var(--line); padding: 8px 0; }
  .table td { border: 0; padding: 4px 12px; }
  .table td[data-label]::before { content: attr(data-label) " : "; font-weight: 700; }
}

.tag { display: inline-block; font-size: .85rem; font-family: var(--body); font-weight: 700; border-radius: 4px; padding: 0 8px; vertical-align: middle; }
.tag-draft { background: var(--gold); color: var(--wood); }
.tag-published { background: var(--air); color: #fff; }
.tag-refused { background: var(--alert); color: #fff; }

.editor-meta { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.editor-meta .field-wide { grid-column: 1 / -1; }
.editor-panes { display: grid; gap: 16px; grid-template-columns: 1fr; }
.preview {
  background: #FFFCF4;
  border: 1px solid #C9B184;
  border-radius: 6px;
  padding: 14px 16px;
  min-height: 200px;
  max-height: 640px;
  overflow: auto;
}
.preview[data-error]::before { content: attr(data-error); display: block; color: var(--alert); }
@media (min-width: 900px) {
  .editor-meta { grid-template-columns: 160px 200px 1fr; }
  .editor-meta .field-wide { grid-column: auto; }
  .editor-panes { grid-template-columns: 1fr 1fr; }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.danger-zone { display: grid; gap: 16px; margin-top: 20px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .danger-zone { grid-template-columns: 1fr 1fr; } }
.preview-card { margin-bottom: 12px; }
.preview-card summary { cursor: pointer; font-family: var(--title); font-weight: 700; }
.preview-card .prose { margin-top: 12px; }

/* 404 */
.not-found { text-align: center; padding: 80px 16px; }
.not-found .lead { margin: 0 auto 1em; }
.cta-center { justify-content: center; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
