/* =====================================================
   SOMMAIRE DES TEXTES — style_sommaire.css
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=IM+Fell+English:ital@0;1&display=swap');

/* =====================================================
   RESET & VARIABLES
   ===================================================== */

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

:root {
    --ink:       #1a1208;
    --parch:     #f7f2e8;
    --cream:     #ede7d3;
    --gold:      #b8892a;
    --gold-lt:   #d4a84b;
    --grec:      #0e6e4a;
    --grec-lt:   #13976a;
    --latin:     #9e2035;
    --latin-lt:  #c72b44;
    --blue:      #3a5f72;
    --blue-lt:   #4e7d96;
    --rule:      rgba(26, 18, 8, 0.18);
    --shadow:    rgba(26, 18, 8, 0.08);
    --ink-faded: #7a6a50;
    --search-w:  280px;
}

html { scroll-behavior: smooth; }

/* =====================================================
   BODY & FOND
   ===================================================== */

body {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    background-color: var(--parch);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    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.045'/%3E%3C/svg%3E");
    opacity: 0.6;
}

/* =====================================================
   LIGNE DOREE HAUTE
   ===================================================== */

.top-rule {
    position: relative;
    z-index: 10;
    width: 100%;
    border: none;
    border-top: 3px double var(--gold);
    margin: 0;
}

/* =====================================================
   NAVIGATION
   ===================================================== */

nav {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: transparent;
}

.nav-btn {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.88em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 2px;
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.nav-btn.accueil {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.nav-btn.accueil:hover {
    background: var(--blue-lt);
    border-color: var(--blue-lt);
}

/* =====================================================
   BARRE DE RECHERCHE LATERALE
   ===================================================== */

.search-panel {
    position: fixed;
    right: 20px;
    width: 400px;
    /* Hauteur : du point de départ jusqu'en bas de la fenêtre */
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.search-panel-inner {
    background: white;
    border: 1px solid var(--cream);
    border-top: 3px solid var(--gold);
    border-radius: 4px;
    box-shadow: 0 4px 24px var(--shadow);
    padding: 18px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Occupe toute la hauteur du panel */
    height: 100%;
    overflow: hidden;
}

.search-label {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.82em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
}

.search-input {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1em;
    color: var(--ink);
    background: var(--parch);
    border: 1px solid var(--cream);
    border-radius: 2px;
    padding: 7px 10px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--gold);
    background: #fff;
}

.search-input::placeholder {
    color: var(--ink-faded);
    font-style: italic;
    font-size: 0.9em;
}

.search-hint {
    font-size: 0.78em;
    font-style: italic;
    color: var(--ink-faded);
    text-align: center;
}

.search-results {
    overflow-y: auto;
    flex: 1 1 0;        /* prend tout l'espace restant */
    min-height: 0;      /* essentiel pour que flex+overflow fonctionne */
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px; /* espace pour la scrollbar */
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: var(--parch); }
.search-results::-webkit-scrollbar-thumb { background: var(--cream); border-radius: 2px; }

.result-item {
    padding: 8px 10px;
    border-radius: 2px;
    border-left: 3px solid transparent;
    background: var(--parch);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-item.grec  { border-left-color: var(--grec); }
.result-item.latin { border-left-color: var(--latin); }

.result-item:hover {
    background: var(--cream);
}

.res-auteur {
    font-family: 'Playfair Display', serif;
    font-size: 0.82em;
    font-weight: 700;
    color: var(--ink);
}

.result-item.grec  .res-auteur { color: var(--grec); }
.result-item.latin .res-auteur { color: var(--latin); }

.res-oeuvre {
    font-size: 0.78em;
    font-style: italic;
    color: #3a2e1e;
}

.res-ref {
    font-size: 0.72em;
    font-weight: 600;
    color: var(--ink-faded);
}

.res-titre {
    font-size: 0.75em;
    font-style: italic;
    color: var(--ink-faded);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-result {
    font-style: italic;
    font-size: 0.85em;
    color: var(--ink-faded);
    text-align: center;
    padding: 8px 0;
}

/* =====================================================
   CONTENEUR PRINCIPAL
   ===================================================== */

.page-wrapper {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 60px 30px 100px;
    align-item: center;
}

/* =====================================================
   EN-TETE
   ===================================================== */

.som-header {
    text-align: center;
    }

.som-header::before {
    display: block;
    font-size: 1em;
    color: var(--gold);
    letter-spacing: 12px;
    margin-bottom: 20px;
    font-family: 'IM Fell English', serif;
    font-style: italic;
}

.som-header h1 {
	font-family: 'Playfair Display', serif;
	font-size: clamp(2.4em, 6vw, 4em);
	font-weight: 900;
	line-height: 1.1;
	text-align: center;
	color: var(--ink);
	margin-bottom: 4px;
}

.som-header .subtitle {
	font-family: 'IM Fell English', serif;
	font-style: italic;
	font-size: 1.15em;
	color: var(--gold);
	letter-spacing: 0.05em;
	margin-bottom: 28px;
}

/* =====================================================
   SEPARATEUR ORNEMENTAL
   ===================================================== */

.ornament {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 400px;
    margin: 0 auto 48px;
}

.ornament::before,
.ornament::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.ornament span {
    font-size: 1em;
    color: var(--gold);
    opacity: 0.7;
}

/* =====================================================
   SECTIONS GREC / LATIN — TOGGLE
   ===================================================== */

.som-section {
    margin-bottom: 60px;
}

.som-section-header {
    margin-bottom: 0;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 2px solid var(--rule);
    padding: 10px 4px 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s;
}

.som-section-header.grec  .toggle-btn { border-bottom-color: var(--grec); }
.som-section-header.latin .toggle-btn { border-bottom-color: var(--latin); }

.toggle-btn:hover {
    opacity: 0.85;
}

.toggle-icon {
    font-size: 3em;
    color: var(--gold);
    display: inline-block;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.som-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.som-section-title.grec  { color: var(--grec); }
.som-section-title.latin { color: var(--latin); }

.count-badge {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 1.2em;
    font-weight: 400;
    color: var(--ink-faded);
    letter-spacing: 0.02em;
    margin-left: 4px;
}

/* =====================================================
   TABLEAU — COLLAPSE
   ===================================================== */

.table-container {
    background: white;
    border: 1px solid var(--cream);
    border-radius: 0 0 2px 2px;
    overflow: hidden;
    box-shadow: 0 6px 30px var(--shadow), 0 1px 3px rgba(26, 18, 8, 0.05);
    /* Animation hauteur */
    max-height: 2000px;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 0;
}

.table-container.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}

.table-container.grec  { border-top: 3px solid var(--grec); }
.table-container.latin { border-top: 3px solid var(--latin); }

table {
    width: 100%;
    border-collapse: collapse;
}

/* En-tête : couleur par langue */
.grec-table  thead { background-color: var(--grec); }
.latin-table thead { background-color: var(--latin); }

thead th {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    padding: 12px 18px;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--cream);
    transition: background 0.18s ease;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:nth-child(even) {
    background-color: #fdfaf4;
}

tbody tr:hover {
    background-color: #f0e8d5;
}

tbody tr.highlighted {
    background-color: #fff3cd !important;
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}

td {
    padding: 11px 18px;
    vertical-align: top;
    line-height: 1.55;
    font-size: 1em;
    font-weight: 400;
    color: #2a1e0e;
}

/* Auteurs colorés par langue */
.grec-table  td.auteur {
    font-family: 'Playfair Display', serif;
    font-size: 0.92em;
    font-weight: 700;
    color: var(--grec);
    white-space: nowrap;
    width: 16%;
}

.latin-table td.auteur {
    font-family: 'Playfair Display', serif;
    font-size: 0.92em;
    font-weight: 700;
    color: var(--latin);
    white-space: nowrap;
    width: 16%;
}

td.oeuvre {
    font-style: italic;
    font-weight: 400;
    font-size: 0.97em;
    color: #3a2510;
    width: 26%;
}

td.ref {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
    width: 12%;
    color: var(--ink-faded);
}

td.titre {
    font-style: italic;
    font-weight: 400;
    font-size: 0.97em;
    color: #4a3820;
    width: 46%;
}


/* =====================================================
   LIENS DANS LES TITRES DE TEXTES
   ===================================================== */

td.titre a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.grec-table  td.titre a:hover { color: var(--grec);  border-bottom-color: var(--grec); }
.latin-table td.titre a:hover { color: var(--latin); border-bottom-color: var(--latin); }

/* =====================================================
   FOOTER
   ===================================================== */

.som-footer {
    margin-top: 60px;
    text-align: center;
    border-top: 1px solid var(--rule);
    padding-top: 24px;
}

.som-footer p {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.85em;
    color: var(--ink-faded);
    letter-spacing: 0.04em;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1100px) {
    :root { --search-w: 240px; }
}

@media (max-width: 800px) {
    .search-panel { display: none; }
    .page-wrapper {
        margin-right: auto;
        padding: 40px 18px 60px;
    }
    nav { padding: 14px 18px; flex-wrap: wrap; justify-content: center; }
    thead th { font-size: 0.65em; padding: 10px; }
    td { padding: 9px 10px; font-size: 0.9em; }
    td.auteur, td.ref { white-space: normal; }
}

/* =====================================================
   IMPRESSION
   ===================================================== */

@media print {
    body { background: white; }
    body::before { display: none; }
    .table-container { box-shadow: none; max-height: none !important; opacity: 1 !important; }
    .table-container.collapsed { max-height: none !important; opacity: 1 !important; }
    .search-panel, nav { display: none; }
    .page-wrapper { margin-right: auto; }
}
