/* Styles dedies aux pages d'histoire */

body.story-page {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(110, 48, 113, 0.16), transparent 30%),
    radial-gradient(circle at 88% 2%, rgba(225, 177, 77, 0.2), transparent 26%),
    linear-gradient(180deg, #f6f4f9 0%, #f0edf5 45%, #f5f2ec 100%);
}

.story-page .container {
  max-width: 1920px;
  padding: 1.1rem 1.1rem 2.2rem;
}

.story-page .page-topbar {
  margin-bottom: 1.1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(110, 48, 113, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(110, 48, 113, 0.08), rgba(255, 255, 255, 0.75));
  box-shadow: 0 8px 22px rgba(47, 48, 49, 0.08);
  backdrop-filter: blur(2px);
}

.story-page h1 {
  margin-bottom: 0.7rem;
  border-bottom-width: 3px;
}

.story-page h1 + p {
  margin-top: 0;
  margin-bottom: 1.15rem;
  padding: 0.6rem 0.78rem;
  border-radius: 12px;
  border: 1px solid rgba(110, 48, 113, 0.2);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(223, 213, 235, 0.42));
}

.story-page .event:nth-child(2) { animation-delay: 40ms; }
.story-page .event:nth-child(3) { animation-delay: 80ms; }
.story-page .event:nth-child(4) { animation-delay: 120ms; }
.story-page .event:nth-child(5) { animation-delay: 160ms; }
.story-page .event:nth-child(6) { animation-delay: 200ms; }

.story-page .event h3 {
  font-size: 25px;
  letter-spacing: 0.01em;
  margin-top: 0px;
}

.story-page .arc-table-card {
  overflow-x: auto;
}

.story-page .arc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0.2rem;
  border: 1px solid rgba(110, 48, 113, 0.22);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.story-page .arc-table th,
.story-page .arc-table td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(110, 48, 113, 0.14);
}

.story-page .arc-table tr:last-child th,
.story-page .arc-table tr:last-child td {
  border-bottom: 0;
}

.story-page .arc-table th {
  width: 30%;
  font-weight: 700;
  color: var(--couleur-coeur-mystique);
  background: linear-gradient(120deg, rgba(223, 213, 235, 0.45), rgba(255, 255, 255, 0.4));
}

.story-page .arc-table td {
  color: var(--couleur-texte-principal);
}

.story-page .coherence-card p {
  margin-bottom: 0.55rem;
}

.story-page .coherence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.story-page .coherence-links a {
  display: inline-block;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  border: 1px dashed rgba(110, 48, 113, 0.36);
  background: rgba(225, 177, 77, 0.08);
  color: var(--couleur-coeur-mystique);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.story-page .coherence-links a:hover {
  border-style: solid;
  background: rgba(225, 177, 77, 0.16);
}

.story-page .event p a,
.story-page p > a {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 48, 113, 0.26);
  background: rgba(110, 48, 113, 0.06);
  color: var(--couleur-coeur-mystique);
  text-decoration: none;
}

.story-page .event p a:hover,
.story-page p > a:hover {
  background: rgba(110, 48, 113, 0.12);
  text-decoration: none;
}

.story-page .writing-challenges-card {
  overflow: hidden;
}

.story-page .challenge-toolbar {
  margin-top: 0.9rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(110, 48, 113, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(223, 213, 235, 0.26));
}

.story-page .challenge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.story-page .challenge-filter {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 190px;
  font-size: 0.92rem;
  color: var(--couleur-coeur-mystique);
  font-weight: 600;
}

.story-page .challenge-filter select {
  appearance: none;
  border: 1px solid rgba(110, 48, 113, 0.3);
  border-radius: 10px;
  padding: 0.42rem 0.62rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--couleur-texte-principal);
  font: inherit;
}

.story-page .challenge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.story-page .challenge-btn {
  border: 1px solid rgba(110, 48, 113, 0.4);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: rgba(110, 48, 113, 0.14);
  color: var(--couleur-coeur-mystique);
  font-weight: 700;
  cursor: pointer;
}

.story-page .challenge-btn:hover {
  background: rgba(110, 48, 113, 0.2);
}

.story-page .challenge-btn-secondary {
  background: rgba(255, 255, 255, 0.7);
}

.story-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.story-page .challenge-status {
  margin: 0.72rem 0 0;
  font-size: 0.95rem;
  color: var(--couleur-coeur-mystique);
  font-weight: 600;
}

.story-page .challenge-json-help {
  margin: 0.75rem 0 0.95rem;
  border: 1px solid rgba(110, 48, 113, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
}

.story-page .challenge-json-help summary {
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  color: var(--couleur-coeur-mystique);
}

.story-page .challenge-json-help p {
  margin: 0.25rem 0.9rem 0.6rem;
}

.story-page .challenge-json-sample {
  margin: 0.15rem 0.9rem 0.9rem;
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(110, 48, 113, 0.16);
  background: rgba(244, 242, 248, 0.95);
  font-size: 0.87rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}

.story-page .writing-challenges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  margin: 1rem 0 1rem;
}

.story-page .writing-challenge {
  position: relative;
  padding: 1rem 1rem 0.95rem;
  border: 1px solid rgba(110, 48, 113, 0.18);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(223, 213, 235, 0.36));
  box-shadow: 0 10px 22px rgba(47, 48, 49, 0.06);
}

.story-page .writing-challenge.is-hidden {
  display: none;
}

.story-page .writing-challenge.is-picked {
  border-color: rgba(225, 177, 77, 0.95);
  box-shadow: 0 0 0 3px rgba(225, 177, 77, 0.25), 0 12px 26px rgba(47, 48, 49, 0.12);
  animation: challenge-pulse 600ms ease;
}

.story-page .writing-challenge h4 {
  margin: 0.35rem 0 0.45rem;
  font-size: 1.08rem;
  color: var(--couleur-coeur-mystique);
}

.story-page .writing-challenge p {
  margin: 0 0 0.55rem;
}

.story-page .challenge-level {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-page .challenge-level-quick {
  background: rgba(225, 177, 77, 0.18);
  color: #8b5a0c;
}

.story-page .challenge-level-focus {
  background: rgba(110, 48, 113, 0.14);
  color: #58235a;
}

.story-page .challenge-level-creative {
  background: rgba(62, 109, 140, 0.14);
  color: #2f5771;
}

.story-page .challenge-arc {
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.18rem 0.56rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(110, 48, 113, 0.2);
  background: rgba(255, 255, 255, 0.7);
  color: #59455f;
}

.story-page .challenge-meta {
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(110, 48, 113, 0.18);
  color: var(--couleur-texte-principal);
  font-size: 0.95rem;
}

.story-page .scene-bank {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  margin: 1rem 0 1rem;
}

.story-page .scene-card {
  position: relative;
  padding: 1rem 1rem 0.95rem;
  border: 1px solid rgba(110, 48, 113, 0.18);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(223, 213, 235, 0.28));
  box-shadow: 0 10px 22px rgba(47, 48, 49, 0.06);
}

.story-page .scene-card.is-hidden {
  display: none;
}

.story-page .scene-card.is-picked {
  border-color: rgba(225, 177, 77, 0.95);
  box-shadow: 0 0 0 3px rgba(225, 177, 77, 0.25), 0 12px 26px rgba(47, 48, 49, 0.12);
  animation: challenge-pulse 600ms ease;
}

.story-page .scene-card h4 {
  margin: 0.35rem 0 0.45rem;
  font-size: 1.08rem;
  color: var(--couleur-coeur-mystique);
}

.story-page .scene-card p {
  margin: 0 0 0.55rem;
}

.story-page .scene-details {
  margin: 0.35rem 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(110, 48, 113, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.story-page .scene-details p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.story-page .scene-details p + p {
  margin-top: 0.35rem;
}

.story-page .scene-pitch {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #5a5661;
}

.story-page .scene-pitch strong {
  color: var(--couleur-coeur-mystique);
}

.story-page .scene-tone {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-page .scene-tone-tension {
  background: rgba(225, 177, 77, 0.2);
  color: #8b5a0c;
}

.story-page .scene-tone-emotion {
  background: rgba(110, 48, 113, 0.14);
  color: #58235a;
}

.story-page .scene-tone-reveal {
  background: rgba(62, 109, 140, 0.14);
  color: #2f5771;
}

.story-page .scene-arc {
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.18rem 0.56rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(110, 48, 113, 0.2);
  background: rgba(255, 255, 255, 0.7);
  color: #59455f;
}

.story-page .scene-meta {
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(110, 48, 113, 0.18);
  color: var(--couleur-texte-principal);
  font-size: 0.95rem;
}

.story-page .scene-copy-btn {
  border: 1px solid rgba(110, 48, 113, 0.35);
  border-radius: 999px;
  padding: 0.36rem 0.82rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--couleur-coeur-mystique);
  font-weight: 700;
  cursor: pointer;
}

.story-page .scene-copy-btn:hover {
  background: rgba(110, 48, 113, 0.12);
}

.story-page .challenge-list {
  margin: 0;
  padding-left: 1.2rem;
}

.story-page .challenge-list li + li {
  margin-top: 0.3rem;
}

@keyframes challenge-pulse {
  from {
    transform: scale(0.985);
  }
  to {
    transform: scale(1);
  }
}

.story-page .cycle-link {
  display: block;
  margin-bottom: 1rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(110, 48, 113, 0.28);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(223, 213, 235, 0.42));
  box-shadow: 0 8px 20px rgba(47, 48, 49, 0.08);
  color: inherit;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.story-page .cycle-link p {
  color: var(--couleur-texte-principal);
}

.story-page .cycle-link p strong {
  color: inherit;
}

.story-page .cycle-link:hover h3 {
  color: #58235a;
}

.story-page .cycle-link:hover {
  border-color: rgba(110, 48, 113, 0.44);
}

.story-page .cycle-link:focus-visible {
  outline: 3px solid rgba(225, 177, 77, 0.5);
  outline-offset: 3px;
  border-color: rgba(110, 48, 113, 0.52);
}

.story-page .timeline + .timeline {
  margin-top: 1.7rem;
}

/* ── Boite à idées ─────────────────────────────────── */
.story-page .ideas-section {
  margin-bottom: 2.6rem;
}

.story-page .ideas-section::after {
  background: linear-gradient(180deg, rgba(225, 177, 77, 0.9), rgba(225, 140, 40, 0.65));
}

.story-page .idea-link {
  display: block;
  padding: 1.35rem 1.45rem;
  border-width: 2px;
  border-radius: 18px;
  text-decoration: none;
  border-color: rgba(225, 177, 77, 0.5);
  background: linear-gradient(145deg, #fffdf5 0%, rgba(255, 240, 190, 0.45) 100%);
  border-style: dashed;
  box-shadow: 0 16px 34px rgba(225, 177, 77, 0.14);
}

.story-page .idea-link::before {
  background: #e1b14d;
  box-shadow: 0 0 0 3px rgba(225, 177, 77, 0.28);
}

.story-page .idea-link::after {
  background: linear-gradient(90deg, rgba(225, 177, 77, 0.95), rgba(225, 120, 30, 0.85));
}

.story-page .idea-link:hover {
  border-color: rgba(225, 177, 77, 0.75);
  border-style: solid;
  box-shadow: 0 14px 28px rgba(225, 177, 77, 0.18);
}

.story-page .idea-link:hover h3 {
  color: #a06a10;
}

.story-page .idea-link h3 {
  color: #b07820;
  margin-bottom: 0.65rem;
}

.story-page .idea-link p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--couleur-texte-principal);
}

.story-page .idea-link p strong {
  color: #8a5c10;
}

.story-page .ideas-section + .timeline {
  position: relative;
  margin-top: 3.2rem;
  padding-top: 2.1rem;
}

.story-page .timeline-heading {
  position: relative;
  margin: 0 0 1.4rem;
  padding: 1rem 1.5rem 1rem 1.9rem;
  border-left: 5px solid var(--couleur-coeur-mystique);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(120deg, rgba(110, 48, 113, 0.1), rgba(223, 213, 235, 0.28) 60%, transparent);
  color: var(--couleur-coeur-mystique);
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-page .timeline-heading::before {
  content: "—";
  margin-right: 0.55rem;
  opacity: 0.55;
  font-weight: 300;
}

.story-page .timeline-heading::after {
  content: "—";
  margin-left: 0.55rem;
  opacity: 0.55;
  font-weight: 300;
}

.story-page .ideas-section + .timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: min(220px, calc(100% - 1.45rem));
  height: 1px;
  background: linear-gradient(90deg, rgba(225, 177, 77, 0.95), rgba(110, 48, 113, 0.38), transparent);
}

.story-page .ideas-section + .timeline::after {
  top: 2.1rem;
}
/* ─────────────────────────────────────────────────── */

@keyframes story-reveal {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-page .event {
    animation: none;
    transition: none;
  }
}

@media (max-width: 720px) {
  .story-page .container {
    padding: 0.8rem 0.55rem 1.4rem;
  }

  .story-page .page-topbar {
    padding: 0.55rem 0.6rem;
  }

  .story-page .timeline {
    margin-left: 0.28rem;
    padding-left: 1.05rem;
  }

  .story-page .timeline::after {
    left: 2px;
  }

  .story-page .event::before {
    left: -1.86rem;
    top: 0.9rem;
  }

  .story-page .writing-challenges {
    grid-template-columns: 1fr;
  }

  .story-page .scene-bank {
    grid-template-columns: 1fr;
  }

  .story-page .challenge-filter {
    min-width: 100%;
  }

  .story-page h1 + p {
    padding: 0.5rem 0.62rem;
  }

  .story-page .timeline-heading {
    gap: 0.55rem;
    font-size: 1.2rem;
  }

  .story-page .arc-table th,
  .story-page .arc-table td {
    display: block;
    width: 100%;
  }

  .story-page .arc-table th {
    border-bottom: 0;
    padding-bottom: 0.2rem;
  }

  .story-page .arc-table td {
    padding-top: 0.2rem;
  }
}
