/* LISOAC — Livre sonore actif */

:root {
  --red: #c41e1e;
  --red-deep: #9a1414;
  --red-glow: #e83535;
  --gold: #c9a227;
  --gold-light: #e8c84a;
  --ink: #1a1210;
  --ink-soft: #3d3530;
  --paper: #faf6f0;
  --paper-warm: #f3ebe0;
  --shadow: 0 8px 32px rgba(26, 18, 16, 0.12);
  --radius: 12px;
  --font-serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-sans: 'Source Sans 3', system-ui, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ——— Landing ——— */

#landing {
  background: linear-gradient(165deg, var(--red) 0%, var(--red-deep) 55%, #6b0f0f 100%);
  color: #fff;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem 2rem;
  text-align: center;
  gap: clamp(1rem, 2.5vh, 1.75rem);
  overflow: hidden;
}

.landing-header {
  width: 100%;
  max-width: 920px;
  flex-shrink: 0;
}

.landing-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3.8vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-presentation {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0;
  background: none;
  border: none;
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1.9vw, 1.35rem);
  line-height: 1.4;
  color: var(--gold-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(232, 200, 74, 0.45);
  transition: color 0.2s, text-decoration-color 0.2s;
}

.btn-presentation:hover {
  color: #fff;
  text-decoration-color: var(--gold-light);
}

.landing-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  width: 100%;
  max-width: 920px;
  flex: none;
}

.landing-cover {
  margin: 0;
  max-width: clamp(220px, 28vw, 300px);
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.32);
  transition: transform 0.35s ease;
}

.landing-cover:hover {
  transform: scale(1.02);
}

.landing-cover img {
  display: block;
  width: 100%;
  height: auto;
}

.landing-actions {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
}

.sequence-nav {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
  margin: 0;
}

.seq-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.seq-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gold-light);
  transform: translateX(4px);
}

.seq-btn img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.seq-label {
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.landing-footer {
  width: 100%;
  max-width: 920px;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  flex-shrink: 0;
}

.credits-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.5rem;
  margin-bottom: 1rem;
  text-align: left;
}

.credit-line {
  margin: 0;
}

.credit-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 0.35rem;
}

.credit-value {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
}

.landing-footer a {
  color: var(--gold-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 200, 74, 0.45);
  transition: border-color 0.2s;
}

.landing-footer a:hover {
  border-bottom-color: var(--gold-light);
}

.partners-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.logo-chip {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.12);
}

.logo-chip img {
  display: block;
  height: 34px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.logo-chip-wide img {
  height: 32px;
  max-width: min(100%, 420px);
}

.logo-chip-crest {
  padding: 0.35rem 0.55rem;
}

.logo-chip-crest img {
  height: 48px;
}

.institution {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  line-height: 1.4;
  color: var(--gold-light);
  margin: 0;
}

.btn-enter {
  padding: 0.85rem 2rem;
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
  width: 100%;
}

@media (max-width: 640px) {
  #landing {
    overflow-y: auto;
    justify-content: flex-start;
    padding: 1.25rem 1.25rem;
  }

  .landing-main {
    flex-direction: column;
  }

  .landing-cover {
    max-width: 220px;
  }

  .credits-block {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}

@media (max-width: 520px) {
  .partners-strip {
    gap: 0.35rem;
  }

  .logo-chip-wide {
    width: 100%;
  }
}

.btn-enter:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

/* ——— Reader ——— */

#reader {
  flex-direction: column;
  background: var(--paper);
}

.reader-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-warm);
  border: none;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-icon:hover { background: #e8dfd2; }
.btn-icon svg { width: 20px; height: 20px; }

.reader-title {
  flex: 1;
  min-width: 160px;
}

.reader-title .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red);
  font-weight: 600;
}

.reader-title strong {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mode-tab {
  padding: 0.45rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mode-tab:hover {
  background: var(--paper-warm);
  color: var(--ink);
}

.mode-tab.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Search */

.search-bar {
  padding: 0.75rem 1.25rem;
  background: var(--paper-warm);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: #999;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: transparent;
  min-width: 0;
}

.btn-voice {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.btn-voice:hover { background: var(--red-glow); transform: scale(1.05); }
.btn-voice.listening {
  animation: pulse 1.2s infinite;
  background: var(--gold);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(201, 162, 39, 0); }
}

.btn-voice svg { width: 18px; height: 18px; }

.search-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  margin: 0.4rem 0 0;
}

.search-hint.voice-active { color: var(--red); font-weight: 500; }

/* Body layout */

.reader-body {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  flex: 1;
  min-height: 0;
}

@media (max-width: 900px) {
  .reader-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

.panel-nav {
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  max-height: calc(100dvh - 180px);
  background: #fff;
}

.panel-content {
  padding: 1rem;
}

.panel-player {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Navigation lists */

.nav-section {
  margin-bottom: 1.25rem;
}

.nav-section h3 {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red);
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--paper-warm);
}

.nav-letter {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0.75rem 0 0.35rem;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.2rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.35;
}

.nav-item:hover { background: var(--paper-warm); }
.nav-item.active { background: rgba(196, 30, 30, 0.1); color: var(--red-deep); font-weight: 500; }

.nav-item .meta {
  display: block;
  font-size: 0.72rem;
  color: #888;
  margin-top: 0.15rem;
}

.nav-track {
  border-left: 2px solid var(--paper-warm);
  margin-left: 0.5rem;
  padding-left: 0.75rem;
}

.chapter-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.chapter-link:hover { color: var(--red); background: var(--paper-warm); }
.chapter-link .time { color: #aaa; font-variant-numeric: tabular-nums; margin-right: 0.4rem; }

.keyword-ref {
  font-size: 0.75rem;
  color: #888;
}

/* Player card */

.player-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 640px;
}

.player-visual {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--ink);
  overflow: hidden;
}

.player-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.player-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.track-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 4px;
}

.player-info {
  padding: 1.25rem 1.25rem 0.5rem;
}

.player-info h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  line-height: 1.25;
}

.chapter-meta {
  font-size: 0.82rem;
  color: #888;
  margin: 0;
}

.chapter-markers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem 0.75rem;
}

.marker {
  padding: 0.3rem 0.65rem;
  background: var(--paper-warm);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-soft);
}

.marker:hover, .marker.active {
  background: rgba(196, 30, 30, 0.12);
  border-color: var(--red);
  color: var(--red-deep);
}

/* Transport */

.transport {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem 0.75rem;
}

.time {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: #888;
  min-width: 2.5rem;
}

.progress-wrap { flex: 1; }

#progress {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--paper-warm);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--red);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}

#progress::-webkit-slider-thumb:hover { transform: scale(1.2); }

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1.25rem 1.25rem;
}

.ctrl {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-warm);
  border: none;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.ctrl:hover { background: #e8dfd2; transform: scale(1.05); }
.ctrl svg { width: 22px; height: 22px; }

.ctrl-main {
  width: 56px;
  height: 56px;
  background: var(--red);
  color: #fff;
}

.ctrl-main:hover { background: var(--red-glow); }

.format-note {
  font-size: 0.72rem;
  color: #999;
  text-align: center;
  padding: 0 1.25rem 1rem;
  margin: 0;
}

/* Playlist */

.playlist-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  max-width: 640px;
  border: 1px solid rgba(196, 30, 30, 0.12);
}

.playlist-panel h3 {
  font-family: var(--font-serif);
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

#playlist-items {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

#playlist-items li {
  margin-bottom: 0.35rem;
  cursor: pointer;
  color: var(--ink-soft);
}

#playlist-items li:hover { color: var(--red); }

.playlist-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-secondary, .btn-ghost {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: var(--red);
  color: #fff;
  border: none;
}

.btn-secondary:hover { background: var(--red-glow); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid #ddd;
}

.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* Carte mode checkboxes */
.carte-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--paper-warm);
}

.carte-item input { margin-top: 0.2rem; accent-color: var(--red); }
.carte-item label { font-size: 0.88rem; cursor: pointer; flex: 1; }
.carte-item .refs { font-size: 0.72rem; color: #888; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #999;
  font-size: 0.9rem;
}

/* Keyword reference picker */
.keyword-item {
  margin-bottom: 0.15rem;
}

.keyword-item.expanded .keyword-toggle {
  background: rgba(196, 30, 30, 0.08);
  color: var(--red-deep);
}

.keyword-refs {
  margin: 0.25rem 0 0.5rem 0.75rem;
  padding-left: 0.65rem;
  border-left: 2px solid var(--gold);
}

.ref-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.25rem;
  background: var(--paper-warm);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.ref-link:hover {
  border-color: var(--red);
  background: rgba(196, 30, 30, 0.06);
}

.ref-time {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--red);
}

.ref-detail {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.keyword-refs-panel {
  padding: 0 1.25rem 0.75rem;
}

.keyword-refs-panel h3 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--red-deep);
  margin: 0 0 0.5rem;
}

.keyword-refs-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.keyword-refs-list .ref-link {
  margin-bottom: 0;
}

/* ——— Présentation modal ——— */

.presentation-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.presentation-modal[hidden] {
  display: none;
}

.presentation-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 18, 16, 0.72);
  backdrop-filter: blur(4px);
}

.presentation-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85dvh, 820px);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.presentation-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-warm);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.presentation-modal-close:hover {
  background: var(--red);
  color: #fff;
}

.presentation-modal-body {
  overflow-y: auto;
  padding: 2.25rem 2rem 2rem;
  text-align: justify;
}

.presentation-modal-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--red-deep);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.presentation-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  font-style: italic;
  font-weight: 400;
  text-align: center;
  color: var(--ink);
  margin: 0 0 1.5rem;
}

.presentation-modal-body p {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.55vw, 1.15rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 1rem;
}

.presentation-modal-body strong {
  font-weight: 700;
  color: var(--ink);
}

.presentation-modal-body em {
  font-style: italic;
}

.presentation-modal-body p.presentation-emphasis {
  font-weight: 700;
}

.presentation-modal-body p.presentation-closing {
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  margin-top: 1.75rem !important;
  margin-bottom: 0 !important;
}
