/* HaloBox — charte : crème #F3E9DB, noyer #2E201A, terracotta #C56A3D, chêne #D8A35B.
   Polices : Zilla Slab (titres), Outfit (texte). */
:root {
  --bg: #F3E9DB;
  --surface: #FFFDF8;
  --surface-muted: #EFE3D0;
  --text: #2E201A;
  --muted: #6E5B4E;
  --border: #DCC9AE;
  --accent: #C56A3D;
  --accent-soft: #F0D9C8;
  --gold: #D8A35B;
  --ok: #4E7A3A;
  --shadow: 0 2px 10px rgba(46, 32, 26, .10);
  --bar-h: 64px;
}
html[data-theme="dark"] {
  --bg: #241A14;
  --surface: #32241B;
  --surface-muted: #3B2A1F;
  --text: #F3E9DB;
  --muted: #C9B6A2;
  --border: #574233;
  --accent: #D98A5F;
  --accent-soft: #4A3222;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #241A14; --surface: #32241B; --surface-muted: #3B2A1F;
    --text: #F3E9DB; --muted: #C9B6A2; --border: #574233;
    --accent: #D98A5F; --accent-soft: #4A3222;
    --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding-top: var(--bar-h);
  background: var(--bg); color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif; font-size: 17px; line-height: 1.5;
}
h1, h2, h3 { font-family: 'Zilla Slab', Georgia, serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; }
a { color: var(--accent); }
img { max-width: 100%; }

/* ---- barre fixe ---- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.bar-inner {
  max-width: 1080px; margin: 0 auto; height: 100%; padding: 0 14px;
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); min-width: 0; }
.brand .logo { color: var(--text); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; }
.brand-text strong { font-family: 'Zilla Slab', serif; font-size: 1.15rem; }
.brand-text small { color: var(--muted); font-size: .68rem; }
#mainnav { display: flex; gap: 4px; margin-left: 8px; }
#mainnav a {
  color: var(--text); text-decoration: none; padding: 7px 10px; border-radius: 8px; font-weight: 500; white-space: nowrap;
}
#mainnav a:hover, #mainnav a.active { background: var(--surface-muted); }
#mainnav .count {
  background: var(--accent); color: #FFF7EC; border-radius: 999px;
  font-size: .72rem; padding: 1px 7px; margin-left: 4px; vertical-align: 2px;
}
.bar-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg button {
  border: 0; background: var(--surface); color: var(--muted); padding: 5px 10px;
  font: inherit; font-size: .82rem; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #FFF7EC; font-weight: 600; }

/* ---- boutons, cartes, formulaires ---- */
.btn {
  display: inline-block; background: var(--accent); color: #FFF7EC; border: 1px solid var(--accent);
  padding: 10px 18px; border-radius: 10px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2E201A; }
.btn.small, .btn-small { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: default; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow);
}
main { max-width: 1080px; margin: 0 auto; padding: 22px 14px 40px; }
section { margin: 0 0 34px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.product-card { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 120px; }
.product-card.focus-flash {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--accent-soft), 0 10px 24px rgba(46, 32, 26, .18);
}
.product-card .swatch {
  height: 110px; border-radius: 10px; display: flex; align-items: flex-end; padding: 10px;
  color: #FFF7EC; font-family: 'Zilla Slab', serif; font-size: 1.6rem; text-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.product-card .card-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
  border-radius: 10px; background: var(--surface-muted);
}
.product-card .kind { color: var(--muted); font-size: .85rem; }
.product-card p { margin: 0; }
.product-card .actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; background: var(--accent-soft); color: var(--text);
}
.product-card .actions .badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .88rem; padding: 6px 12px; line-height: 1.2; border-radius: 10px;
}
.badge.ok { background: #DCEBD2; color: #33511F; }
html[data-theme="dark"] .badge.ok, html[data-theme="auto"] .badge.ok { color: #33511F; }
.badge.lock { background: var(--surface-muted); color: var(--muted); }
.lock-note { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 6px; }
form .field { margin-bottom: 13px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 9px; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--accent); background: var(--accent-soft); }
.pw-toggle svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.pw-toggle .ic-eye-off { display: none; }
.pw-toggle.on .ic-eye { display: none; }
.pw-toggle.on .ic-eye-off { display: block; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
/* Le bloc « Ajouter un achat » est la cible du défilement après un clic
   « Je l'ai déjà acheté » : la marge évite qu'il se cache sous la barre fixe. */
#add-purchase { scroll-margin-top: calc(var(--bar-h) + 14px); }
.msg { border-radius: 10px; padding: 11px 14px; margin: 12px 0; }
.msg.ok { background: #DCEBD2; color: #33511F; }
.msg.warn { background: #F7E3C2; color: #6B4A12; }
.msg.err { background: #F6D5CB; color: #7A2715; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ---- accueil ---- */
.buyer-box { border: 2px solid var(--accent); }
.hero-card video { width: 100%; max-width: 720px; height: auto; display: block; margin: 16px auto 0; border-radius: 14px; box-shadow: var(--shadow); background: #000; }
.overline { color: var(--accent); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }
.hero-card .actions, .actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.review { font-style: italic; }
.review .who { font-style: normal; font-weight: 600; margin-top: 8px; }
details.faq { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 9px; }
details.faq summary { font-weight: 600; cursor: pointer; font-family: 'Zilla Slab', serif; }
details.faq p { margin: 8px 0 2px; }

/* ---- histoire ---- */
.board { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.day-tile {
  border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: var(--surface);
  text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 5px;
}
.day-tile img { border-radius: 8px; aspect-ratio: 1; object-fit: cover; width: 100%; filter: saturate(.25) brightness(1.06); opacity: .75; }
.day-tile.placed img { filter: none; opacity: 1; }
.day-tile.closed { opacity: .55; cursor: default; }
.day-tile .dnum { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.day-tile .dtitle { font-family: 'Zilla Slab', serif; font-size: .95rem; line-height: 1.2; }
.day-view h1 { margin: 6px 0 10px; }
/* Page d'histoire (maquette validée par David le 2026-11-29) : grande
   image à gauche, récit dans une carte à droite (repère de progression,
   titre, texte plein cadre, médaillon + bouton Poser en bas de carte),
   navigation précédent/suivant sous l'ensemble. */
.dv-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 22px; align-items: stretch; }
.dv-media img { border-radius: 14px; box-shadow: var(--shadow); width: 100%; height: 100%; max-height: calc(100dvh - 250px); object-fit: contain; display: block; }
.lien-retour { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); text-decoration: underline; cursor: pointer; }
.dv-toprow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dv-toprow .lang-pills { margin: 0; }
.dv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; display: flex; flex-direction: column; min-width: 0; }
.dv-progress span { font-weight: 700; }
.dv-bar { height: 10px; border-radius: 999px; background: var(--surface-muted); margin-top: 6px; overflow: hidden; }
.dv-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.dv-card h1 { margin: 12px 0 8px; }
.dv-text { margin: 0 0 16px; line-height: 1.55; }
.dv-actions { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.day-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
@media (max-width: 900px) {
  .dv-grid { grid-template-columns: 1fr; }
  .dv-media img { height: auto; max-height: 52dvh; }
}
.perso-line { font-weight: 600; font-size: 1.05rem; }
.perso-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #f7e8d2; border: 1px solid #d8c9ae; border-radius: 10px; padding: 8px 12px; }
.panneau-texte { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.panneau-texte .col-texte p { margin: 0; }
.medaillon { position: relative; flex: 0 0 124px; width: 124px; height: 124px; border-radius: 50%; background-color: #efe3cd; background-repeat: no-repeat; border: 3px solid #C56A3D; box-shadow: 0 2px 8px rgba(46,32,26,.25); }
.medaillon > img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.medaillon-cadre { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; display: block; }
.medaillon-cadre img { position: absolute; max-width: none; display: block; }
.medaillon-badge { position: absolute; right: -4px; bottom: -4px; background: #C56A3D; color: #fff; border-radius: 999px; min-width: 30px; height: 30px; line-height: 30px; text-align: center; font-weight: 700; font-size: .95rem; padding: 0 5px; }
@media (max-width: 900px) { .medaillon { flex-basis: 92px; width: 92px; height: 92px; } .medaillon-badge { min-width: 26px; height: 26px; line-height: 26px; font-size: .85rem; } }
@media (max-width: 560px) { .medaillon { flex-basis: 72px; width: 72px; height: 72px; } }
.lang-pills { display: flex; gap: 6px; margin: 10px 0; }
.lang-pills .pill { border: 1px solid #d8c9ae; background: #fffdf8; color: inherit; border-radius: 999px; padding: 4px 14px; cursor: pointer; font: inherit; }
.lang-pills .pill.on { background: #C56A3D; color: #fff; border-color: #C56A3D; }
/* Écrans bas en disposition empilée (téléphones, petites tablettes) :
   la page du jour doit tenir au complet dans l'écran, boutons compris,
   sans défilement. En disposition deux colonnes, c'est la règle
   max-height de .dv-media img qui garde tout dans l'écran. */
@media (max-height: 900px) and (max-width: 900px) {
  .dv-media img { max-height: 36dvh; }
  .day-view h1 { font-size: 1.3rem; margin: 2px 0 6px; }
  .day-nav { margin-top: 10px; }
}

/* ---- générateur ---- */
.banner-preview {
  background: var(--gold); color: #2E201A; border-radius: 12px; padding: 22px 14px;
  text-align: center; font-family: 'Zilla Slab', serif; font-weight: 700; font-size: clamp(1.2rem, 4.5vw, 2rem);
  border: 3px dashed rgba(46,32,26,.35);
}
.disc-preview {
  width: 150px; height: 150px; border-radius: 50%; background: var(--accent); color: #FFF7EC;
  display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto;
  font-family: 'Zilla Slab', serif;
}
.disc-preview .n { font-size: 3rem; line-height: 1; }
.candles { font-size: 1.7rem; letter-spacing: .2em; text-align: center; }

/* ---- tableaux Atelier ---- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: 'Zilla Slab', serif; }
.stats-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { background: var(--surface-muted); border-radius: 12px; padding: 12px 16px; min-width: 130px; }
.stat .n { font-family: 'Zilla Slab', serif; font-size: 1.6rem; display: block; }

/* ---- pied de page ---- */
#site-footer {
  border-top: 1px solid var(--border); padding: 20px 14px 30px; text-align: center; color: var(--muted);
}
#site-footer a { color: var(--accent); }

.legal h2 { margin-top: 26px; }
.welcome-code {
  font-family: 'Zilla Slab', serif; font-size: 1.7rem; letter-spacing: .08em;
  background: var(--surface-muted); border: 2px dashed var(--accent); border-radius: 10px;
  padding: 10px 16px; display: inline-block; margin: 6px 0;
}
@media (max-width: 720px) {
  :root { --bar-h: 106px; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 1.02rem; }
  .brand .logo svg { width: 29px; height: 29px; }
  .bar-inner { flex-wrap: wrap; gap: 5px 7px; padding: 6px 8px; align-content: center; }
  .bar-controls { gap: 6px; }
  .seg button { padding: 4px 7px; font-size: .78rem; }
  #nav-contact { padding: 5px 10px; font-size: .82rem; }
  #mainnav { order: 3; width: 100%; margin-left: 0; }
  #mainnav a { padding: 6px 7px; font-size: .92rem; }
}

/* Cadre uniforme des outils et des visionneuses : le bouton de retour est
   toujours exactement à la même place, quel que soit le produit. */
.tool-overlay { position: fixed; inset: 0; z-index: 200; background: #F7F0E4; display: flex; flex-direction: column; }
.tool-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.tool-bar .tool-back { text-decoration: none; display: inline-flex; align-items: center; padding: 8px 14px; background: #FFFFFF; color: #2E201A; border: 1px solid #D8CFC0; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.tool-bar .tool-name { font-weight: 700; color: #2E201A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-overlay iframe { flex: 1; width: 100%; border: 0; background: #FFFFFF; }
