/* Temple mémoriel — module indépendant (structure type carte / entraide) */
:root {
  --ink: #1f2d3d;
  --muted: #5c6b7a;
  --line: #d9d3c7;
  --paper: #f6f4ef;
  --surface: #fff;
  --green: #1a6b3c;
  --green-soft: #e8f5ee;
  --red: #c41e3a;
  --gold: #ca8a04;
  --gold-soft: #fef3c7;
  --shadow: 0 10px 28px rgba(31, 45, 61, 0.08);
  --radius: 14px;
  --stage-bg: #020617;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(900px 420px at 8% -8%, #d8f0e2 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #f8d6db 0%, transparent 48%),
    radial-gradient(600px 300px at 50% 100%, #efe6c8 0%, transparent 50%),
    var(--paper);
  line-height: 1.5;
  font-size: 16px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 72px;
}

.nav-local {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.nav-local a {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
}
.nav-local a:hover { border-color: var(--green); color: var(--green); }
.nav-local a.is-active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.nav-local a.nav-back {
  background: linear-gradient(135deg, #1a6b3c, #1e3a5f);
  color: #fff;
  border-color: transparent;
}
.nav-local a.nav-back:hover {
  background: linear-gradient(135deg, #145730, #8b1e2d);
  color: #fff;
}

.banner {
  --bronze: #854d0e;
  --bronze-light: #c9a227;
  position: relative;
  overflow: hidden;
  color: #f8f4ec;
  border-radius: 4px 4px 18px 18px;
  padding: 0;
  margin-bottom: 18px;
  text-align: center;
  isolation: isolate;
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow:
    0 0 0 1px rgba(2, 6, 23, 0.5),
    0 22px 48px rgba(2, 6, 23, 0.45);
  background: #020617;
}
.banner-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 244, 210, 0.85), transparent 2px),
    radial-gradient(1px 1px at 28% 48%, rgba(255, 255, 255, 0.7), transparent 2px),
    radial-gradient(1.2px 1.2px at 46% 18%, rgba(255, 236, 179, 0.75), transparent 2px),
    radial-gradient(1px 1px at 62% 58%, rgba(255, 255, 255, 0.55), transparent 2px),
    radial-gradient(1.4px 1.4px at 78% 30%, rgba(255, 244, 210, 0.8), transparent 2px),
    radial-gradient(1px 1px at 88% 70%, rgba(255, 255, 255, 0.5), transparent 2px),
    radial-gradient(1.2px 1.2px at 18% 78%, rgba(255, 236, 179, 0.6), transparent 2px),
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(14, 165, 233, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 0%, rgba(133, 77, 14, 0.35), transparent 60%),
    linear-gradient(180deg, #020617 0%, #0b1224 55%, #111827 100%);
  animation: banner-twinkle 8s ease-in-out infinite alternate;
}
.banner-beams {
  position: absolute;
  inset: -20% 10% auto;
  height: 90%;
  z-index: 0;
  background:
    linear-gradient(185deg, transparent 20%, rgba(255, 231, 160, 0.07) 45%, transparent 70%),
    linear-gradient(175deg, transparent 25%, rgba(253, 230, 138, 0.09) 50%, transparent 72%),
    linear-gradient(195deg, transparent 22%, rgba(255, 244, 208, 0.06) 48%, transparent 68%);
  background-size: 40% 100%, 36% 100%, 34% 100%;
  background-position: 30% 0, 50% 0, 70% 0;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  animation: banner-beams 10s ease-in-out infinite alternate;
  pointer-events: none;
}
.banner-inner {
  position: relative;
  z-index: 1;
  padding: clamp(36px, 6vw, 56px) clamp(20px, 4vw, 36px) clamp(28px, 4vw, 40px);
}
.banner-kicker {
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bronze-light);
  margin: 0 0 14px;
  opacity: 0.95;
}
.banner .brand {
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin-bottom: 10px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}
.banner .brand .red { color: #f87171; }
.banner .brand .green { color: #4ade80; }
.banner h1 {
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e7e5e4;
  margin-bottom: 14px;
}
.banner-inner > p {
  font-size: 0.98rem;
  color: rgba(248, 244, 236, 0.82);
  max-width: 32rem;
  margin: 0 auto 22px;
  line-height: 1.55;
}
.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.banner-pediment {
  position: relative;
  z-index: 1;
  height: 14px;
  margin-top: 4px;
  background:
    linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.55) 20%, rgba(248, 244, 236, 0.35) 50%, rgba(201, 162, 39, 0.55) 80%, transparent);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  opacity: 0.85;
}
@keyframes banner-twinkle {
  from { filter: brightness(0.95); }
  to { filter: brightness(1.08); }
}
@keyframes banner-beams {
  from { opacity: 0.55; transform: translateY(0); }
  to { opacity: 0.95; transform: translateY(-6px); }
}

.btn,
.banner .btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #fff;
  color: var(--green);
}
.banner .btn {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 2px;
  background: linear-gradient(180deg, #c9a227 0%, #854d0e 100%);
  color: #faf6eb;
  box-shadow: 0 6px 18px rgba(133, 77, 14, 0.45);
  line-height: 1.25;
  text-align: center;
}
.banner .btn:hover {
  filter: brightness(1.08);
}
.btn:hover { filter: brightness(0.97); }
.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
}
.banner .btn-secondary {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 2px;
  background: transparent;
  color: #f8f4ec;
  border: 1px solid rgba(201, 162, 39, 0.65);
  box-shadow: none;
}
.banner .btn-secondary:hover {
  background: rgba(201, 162, 39, 0.12);
  filter: none;
}
.panel .btn {
  background: linear-gradient(135deg, #1a6b3c, #1e3a5f);
  color: #fff;
  margin-top: 8px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}
.section-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 4px;
}
.hint {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 14px;
}

/* Charte */
.charte-article {
  position: relative;
  padding-left: 22px;
  border-left: 3px solid #854d0e;
}
.charte-num {
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #854d0e;
  margin-bottom: 6px;
}
.charte-article h2 {
  font-family: Cinzel, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2.4vw, 1.28rem);
  margin-bottom: 10px;
  color: var(--ink);
}
.charte-article p {
  font-size: 1.02rem;
  line-height: 1.65;
  color: #3a4553;
  margin: 0;
}
.panel-charte-cta {
  text-align: left;
}
.charte-section-head {
  background: transparent;
  box-shadow: none;
  border: none;
  padding-bottom: 0;
  margin-bottom: -4px;
}
.charte-section-head h2 {
  font-family: Cinzel, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  margin-bottom: 0;
  color: #854d0e;
}
.charte-list {
  margin: 0.5rem 0 0 1.2rem;
  color: var(--muted);
  line-height: 1.55;
}
.charte-list li { margin-bottom: 0.55rem; }
.charte-list strong { color: var(--ink); }
.charte-list a,
.panel .hint a {
  color: #854d0e;
  font-weight: 600;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.step {
  background: var(--paper);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--line);
}
.step-num {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.step strong { display: block; margin-bottom: 4px; }
.step p { font-size: 0.9rem; color: var(--muted); }

/* Formulaire — même principe que la carte (CTA coloré, replié) */
.panel-form-cta {
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(26, 107, 60, 0.35);
  background:
    radial-gradient(circle at 12% 0%, rgba(29, 185, 84, 0.22), transparent 42%),
    radial-gradient(circle at 90% 100%, rgba(229, 36, 63, 0.2), transparent 40%),
    linear-gradient(135deg, #127a3f 0%, #1a4d7a 50%, #b01830 100%);
  box-shadow: 0 16px 40px rgba(26, 35, 48, 0.16);
}
.panel-form-cta .share-flag {
  display: flex;
  width: 96px;
  height: 5px;
  margin: 14px auto 0;
  border-radius: 999px;
  overflow: hidden;
}
.panel-form-cta .share-flag span { flex: 1; }
.panel-form-cta .share-flag span:nth-child(1) { background: #1db954; }
.panel-form-cta .share-flag span:nth-child(2) { background: #fff; }
.panel-form-cta .share-flag span:nth-child(3) { background: #e5243f; }

.form-details {
  padding: 10px 16px 16px;
}
.form-details > summary {
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  color: #fff;
  padding: 10px 4px 12px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}
.form-details > summary::-webkit-details-marker { display: none; }
.form-details > summary::after {
  content: "+";
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #b01830;
  line-height: 1;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.form-details[open] > summary::after { content: "−"; }
.form-summary-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.form-summary-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #127a3f;
  background: #fff;
  padding: 4px 9px;
  border-radius: 999px;
}
.form-details-body {
  margin-top: 4px;
  padding: 16px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #e8f8ee 0%, #fff 30%, #fff8f4 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 28px rgba(12, 22, 34, 0.18);
}
.panel-form-cta .hint {
  color: #3a4553;
  margin-bottom: 12px;
}
.formbricks-embed {
  margin-top: 8px;
}
.formbricks-embed iframe {
  display: block;
  width: 100%;
  min-height: 780px;
  border: 0;
  border-radius: 12px;
  background: #fff;
}
.formbricks-embed-fallback {
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: #555;
  text-align: center;
  line-height: 1.45;
}
.formbricks-embed-fallback a {
  color: #127a3f;
}
@media (max-width: 640px) {
  .formbricks-embed iframe { min-height: 880px; }
}

.hint-mobile { display: none; }

.panel-stage .stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.stage-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 420px;
}
.stage-search input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 16px; /* évite le zoom iOS */
}
.stage-search .btn-ghost {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  min-height: 36px;
}
.stage-views,
.stage-zoom {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-ghost,
.btn-zoom {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}
.btn-zoom {
  min-width: 48px;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
}
.btn-ghost:hover,
.btn-zoom:hover {
  border-color: var(--gold);
  color: #854d0e;
  background: var(--gold-soft);
}

.alpha-scroll {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.alpha-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  min-width: min-content;
}
.alpha-btn {
  min-width: 2.25rem;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.alpha-btn:hover:not(:disabled) {
  background: var(--gold-soft);
  border-color: rgba(202, 138, 4, 0.35);
  color: #854d0e;
}
.alpha-btn.is-active {
  background: linear-gradient(135deg, #1a6b3c, #1e3a5f);
  color: #fff;
  border-color: transparent;
}
.alpha-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}
.alpha-btn[data-letter=""] {
  min-width: auto;
  padding-left: 12px;
  padding-right: 12px;
}
.alpha-hint {
  margin: -4px 0 12px;
}

.stage-block {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 14px;
}

.stage-shell {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid #1e293b;
  /* Hauteur fluide selon l’écran */
  height: clamp(360px, 72dvh, 900px);
  min-height: clamp(300px, 50dvh, 520px);
  touch-action: none;
  overscroll-behavior: contain;
}

.canvas-container {
  position: absolute;
  inset: 0;
  touch-action: none;
}
.canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.glass-panel {
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(234, 179, 8, 0.28);
  color: #f8fafc;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.detail-card {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: clamp(14px, 2.5vw, 18px) clamp(14px, 3vw, 20px);
  z-index: 2;
  border-radius: 16px;
  border: 1px solid rgba(234, 179, 8, 0.28);
  height: auto;
  max-height: none;
  overflow: visible;
}
.detail-card[hidden] { display: none !important; }
.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #0f172a;
  color: #94a3b8;
  cursor: pointer;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding-right: 28px;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fcd34d;
}
.badge-muted {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
  font-family: ui-monospace, monospace;
}
.detail-card h3 {
  font-family: Cinzel, Georgia, serif;
  font-size: 1.15rem;
  color: #fde68a;
  margin-bottom: 4px;
}
.detail-route {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 10px;
}
.detail-body {
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}
.detail-body .label { color: #94a3b8; margin-right: 6px; }
.detail-story {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #1e293b;
  font-style: italic;
  color: #e2e8f0;
  line-height: 1.45;
}
.detail-foot {
  font-size: 0.75rem;
  color: #94a3b8;
}

.foot {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 20px;
  line-height: 1.6;
}
.badge-foot {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eee;
  color: var(--muted);
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  background: linear-gradient(135deg, #fbbf24, #ca8a04);
  color: #1f2d3d;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s, transform 0.3s;
}
.toast[hidden] { display: none !important; }
.toast.is-out {
  opacity: 0;
  transform: translateX(20px);
}

/* ——— Tablette ——— */
@media (max-width: 900px) {
  .wrap { padding: 16px 16px 56px; }
  .stage-block { gap: 12px; }
  .stage-shell {
    height: clamp(340px, 66dvh, 780px);
  }
  .stage-search { max-width: none; flex: 1 1 100%; }
}

/* ——— Mobile ——— */
@media (max-width: 720px) {
  .wrap {
    padding: 12px 12px 40px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .banner {
    border-radius: 4px 4px 14px 14px;
  }
  .banner-inner {
    padding: 28px 16px 22px;
  }
  .banner-inner > p { font-size: 0.92rem; margin-bottom: 14px; }
  .banner-actions { gap: 8px; }
  .banner-actions .btn,
  .banner-actions .btn-secondary {
    flex: 1 1 auto;
    text-align: center;
    min-height: 44px;
    padding: 12px 14px;
  }

  .panel {
    padding: 16px 14px;
    border-radius: 12px;
  }
  .steps { grid-template-columns: 1fr; gap: 10px; }

  .hint-desktop { display: none; }
  .hint-mobile { display: block; }

  .panel-stage .stage-toolbar {
    gap: 8px;
    margin-bottom: 10px;
  }
  .stage-views { flex: 1 1 auto; }
  .stage-views .btn-ghost { flex: 1; justify-content: center; }
  .stage-zoom { margin-left: auto; }

  .alpha-scroll { margin-bottom: 8px; }
  .alpha-bar {
    flex-wrap: nowrap;
    padding: 8px 10px;
    gap: 3px;
  }
  .alpha-btn {
    flex: 0 0 auto;
    min-width: 2.4rem;
    min-height: 42px;
  }

  .stage-block {
    width: 100%;
    gap: 12px;
  }

  .stage-shell {
    width: 100%;
    border-radius: 14px;
    height: clamp(320px, 62dvh, 720px);
    min-height: 300px;
  }

  .detail-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 14px;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .detail-card h3 { font-size: 1.05rem; }
  .detail-close {
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
    font-size: 1.1rem;
  }

  .toast {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    text-align: center;
  }
  .toast.is-out { transform: translateY(12px); }
}

@media (max-width: 420px) {
  .stage-shell {
    height: clamp(280px, 58dvh, 620px);
  }
  .stage-views .btn-ghost {
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .stage-block { gap: 10px; }
  .stage-shell {
    height: clamp(160px, 52dvh, 320px);
    min-height: 140px;
  }
}
