/* ============================================================
   ADLER — CSS Textes
   Notes en pop-up, notice rétractable, bicolonne biligue
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Cormorant+SC:wght@400;500;600&family=Cormorant+Infant:ital,wght@0,300;0,400;1,300;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --cream:       #f5f0e8;
  --cream-dark:  #ede6d6;
  --ink:         #1a1612;
  --ink-mid:     #3d3530;
  --ink-light:   #7a6f65;
  --red:         #8b2020;
  --gold:        #b8944a;
  --border:      #c8bfb0;
  --latin-bg:    #f0ece2;

  --font-title:  'Cormorant SC', serif;
  --font-body:   'EB Garamond', serif;
  --font-sub:    'Cormorant Infant', serif;
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ── Header / nav ───────────────────────────────────────────── */
header {
  background-color: var(--ink);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav ul.menu {
  list-style: none;
  display: flex;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

nav ul.menu li a {
  display: block;
  font-family: var(--font-title);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dark);
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid rgba(255,255,255,0.08);
}

nav ul.menu li a:hover {
  background: var(--red);
  color: #fff;
}

/* ── H1 titre ───────────────────────────────────────────────── */
h1 {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-align: center;
  padding: 2.5rem 2rem 1rem;
  color: var(--ink);
}

h1::after {
  content: '';
  display: block;
  width: 3rem;
  height: 2px;
  background: var(--gold);
  margin: 0.8rem auto 0;
}

/* ── Notice rétractable ─────────────────────────────────────── */
#notice {
  border: 1px solid var(--border) !important;
  border-left: 4px solid var(--gold) !important;
  padding: 0 !important;
  margin: 1.5rem 5% 2rem !important;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  box-shadow: 0 2px 10px rgba(26,22,18,0.05);
  overflow: hidden;
}

#notice-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  border-bottom: 1px solid transparent;
  transition: background 0.15s, border-color 0.2s;
}

#notice-toggle:hover {
  background: rgba(184,148,74,0.07);
}

#notice-toggle.open {
  border-bottom-color: var(--border);
}

#notice-toggle .toggle-icon {
  font-size: 1.1rem;
  color: var(--gold);
  transition: transform 0.25s ease;
  line-height: 1;
}

#notice-toggle.open .toggle-icon {
  transform: rotate(180deg);
}

#notice-body {
  padding: 1.2rem 1.5rem 1.4rem;
  display: none;
  font-size: 0.93rem;
  color: var(--ink-mid);
  line-height: 1.7;
}

#notice-body.visible { display: block; }

#notice-body h2 { display: none; } /* remplacé par le bouton */

#notice-body p,
#notice-body ul { margin-bottom: 0.8rem; }

#notice-body span.font-weight-bold {
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#notice-body ul {
  list-style: none;
  padding-left: 1rem;
}

#notice-body ul li {
  position: relative;
  padding-left: 0.8rem;
  margin-bottom: 0.3rem;
}

#notice-body ul li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--gold);
}

#notice-body a {
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid rgba(139,32,32,0.3);
  transition: border-color 0.15s;
}

#notice-body a:hover { border-color: var(--red); }

#notice-body .fa-link { font-size: 0.75em; margin-left: 0.25em; }

#translation { font-style: italic; color: var(--ink-light); font-size: 0.88rem; }

/* ── Tableau biligue ────────────────────────────────────────── */
#texte {
  padding: 0 3% 4rem !important;
  margin: 0 !important;
}

#texte > table {
  border: none !important;
  border-collapse: collapse;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto !important;
}

#texte > table colgroup col:nth-child(1) { width: 44%; }
#texte > table colgroup col:nth-child(2) { width: 4%; }
#texte > table colgroup col:nth-child(3) { width: 44%; }

#texte > table tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

#texte > table tr:last-child { border-bottom: none; }
#texte > table tr:hover { background: rgba(184,148,74,0.05); }

#texte > table td {
  vertical-align: top !important;
  padding: 1rem 0.8rem !important;
  font-size: 0.96rem;
  line-height: 1.8;
}

/* Colonne latine */
#texte > table td:nth-child(1) {
  font-style: italic;
  color: var(--ink-mid);
  border-right: 1px solid var(--border);
  background: rgba(240,236,226,0.4);
}

/* Colonne séparateur */
#texte > table td:nth-child(2) { padding: 0 !important; }

/* Colonne française */
#texte > table td:nth-child(3) {
  color: var(--ink);
}

/* ── Numéros de ligne / pagination ──────────────────────────── */
#texte span[title] {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  vertical-align: middle;
  margin: 0 0.1em;
}

/* ── Segments annotés ───────────────────────────────────────── */
span[data-type="segment"] {
  border-bottom: 1px dotted var(--gold);
  transition: background 0.15s;
}

span[data-type="segment"]:hover {
  background: rgba(184,148,74,0.12);
  border-bottom-style: solid;
}

/* ── Appels de notes (sup) ──────────────────────────────────── */
sup[data-type="note"] {
  position: relative;
  display: inline-block;
}

sup[data-type="note"] a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  font-family: var(--font-title);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  text-decoration: none;
  vertical-align: super;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
  cursor: pointer;
  /* Annuler le comportement ancre natif */
  pointer-events: auto;
}

sup[data-type="note"] a:hover {
  background: var(--gold);
  transform: scale(1.2);
  color: var(--ink);
}

/* ── Séparateur avant notes de bas ─────────────────────────── */
#texte hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0 1.5rem;
}

/* Notes de bas de page (cachées visuellement, utilisées pour le popup) */
div.note {
  display: none;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 780px) {
  #texte { padding: 0 1rem 3rem !important; }

  #texte > table,
  #texte > table tbody,
  #texte > table tr { display: block; }

  #texte > table colgroup { display: none; }

  #texte > table td { display: block; width: 100% !important; padding: 0.6rem 0 !important; }
  #texte > table td:nth-child(2) { display: none; }
  #texte > table td:nth-child(1) {
    border-right: none;
    border-bottom: 1px dashed var(--border);
    background: none;
    padding-bottom: 0.5rem !important;
  }
  #texte > table td:nth-child(3) { padding-top: 0.5rem !important; }

  

  #notice { margin: 1rem 0.5rem 1.5rem !important; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cream-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── Panneau note popup ─────────────────────────────────────── */
#note-panel {
  position: absolute;
  z-index: 900;
  width: 380px;
  max-width: calc(100vw - 2rem);
  background: #1a1612;
  color: #f5f0e8;
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  line-height: 1.65;
  padding: 1rem 1.1rem 1rem 1.1rem;
  border-radius: 3px;
  border-left: 4px solid #b8944a;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 3px 10px rgba(0,0,0,0.25);
  display: none;
}

#note-panel.visible { display: block; }

#note-panel-num {
  font-family: 'Cormorant SC', serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8944a;
  margin-bottom: 0.5rem;
}

#note-panel-body { }
#note-panel-body i { font-style: italic; color: rgba(245,240,232,0.75); }
#note-panel-body a { color: #b8944a; text-decoration: underline; }

#note-panel-close {
  float: right;
  background: none;
  border: none;
  color: rgba(245,240,232,0.45);
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0.3rem 0.5rem;
  transition: color 0.15s;
}
#note-panel-close:hover { color: #b8944a; }

/* Appel de note actif */
sup[data-type="note"] a.active-note {
  background: #b8944a !important;
  color: #1a1612 !important;
}
