html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: #EFEBD8; 
  background-image: 
    radial-gradient(circle at 2px 2px, rgba(225, 218, 178, 0.1) 1px, transparent 0),
    linear-gradient(120deg, rgba(228, 216, 154, 0.2) 0%, transparent 50%),
    linear-gradient(240deg, rgba(255, 255, 214, 0.3) 0%, transparent 50%);
  background-size: 6px 6px, 100% 100%, 100% 100%;
  background-attachment: fixed;
}

hr {
  height: 5px;
  background-color: #8B3A3A;
  border: none;
}


ul.index_ul {
  width: 80%;
  margin: 20px auto;
  padding: 0;
}


ul.index_ul li {
  list-style-type: circle;
  text-align: justify;
}

ul.index_ul li::marker {
  color: #8B3A3A;
}

/* ===== PEEK HEADER ===== */
.site-header {
  position: relative;
  z-index: 999;
  width: 100%;
}

.site-header.header-fixed {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateY(-100%);
}

.site-header.header-animate {
  transition: transform 0.3s ease;
}

.site-header.header-visible {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.main_title {
  width: 100%;
  text-align: center;
  padding: 30px 10px 5px 10px;
  color: #8B3A3A;
  font-family: 'Cardo', serif;
  background-color: #EFEBD8;
  border-color: #8B3A3A;
  box-sizing: border-box;
  margin: 0;
}

.main_subtitle {
  width: 100%;
  text-align: center;
  padding: 0 10px 15px 10px;
  color: #6D2D2D;
  font-family: 'Cardo', serif;
  font-size: 1.1rem;
  font-style: italic;
  font-weight: normal;
  background-color: #EFEBD8;
  box-sizing: border-box;
  margin: 0;
}

/* ===== LINKS ===== */

a {
  color: #8B3A3A;
  font-weight: bold;
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
  color: #CD5C5C;
  text-decoration: underline;
}

a:visited {
  color: #49085E;
  font-weight: bold;
  text-decoration: none;
}

/* ===== CONTEXT PAGES DL ===== */
main > dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 24px;
  text-align: left;
  max-width: 850px;
  margin: 20px auto;
  padding: 0;
}

main > dl dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  padding-top: 2px;
  border-right: 2px solid rgba(139, 58, 58, 0.2);
  padding-right: 16px;
}

main > dl dd {
  margin: 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.6;
  text-align: justify;
}

.navbar {
  width: 100%;
  background-color: #8B3A3A;
  border-bottom: 3px solid #6D2D2D;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

.menu > li {
  position: relative;
}

.menu a {
  display: block;
  padding: 14px 16px;
  color: #FDFaf0;
  text-decoration: none;
  text-align: center;
  font-family: 'Cardo', serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

.menu a:hover, .menu li:hover > a {
  background-color: #6D2D2D;
  color: #fff;
}

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #8B3A3A;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 200px;
  z-index: 1000;
  border-bottom: 3px solid #6D2D2D;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.submenu li {
  width: 100%;
}

.submenu a {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.menu li:hover > .submenu {
  display: block;
}

/* ===== MAIN CONTENT ===== */
main {
  flex: 1 0 auto;
  padding: 40px 20px;
  max-width: 950px;
  margin: 20px auto;
  background-color: rgba(255, 255, 252, 0.85); 
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  width: 90%;
  box-sizing: border-box;
  border-radius: 2px;
  text-align: center; 
}

main h1, main h2, main h3, main h4, main h5 {
    text-align: center;
    color: #8B3A3A;
    font-family: 'Cardo', serif;
}

main p {
  text-align: justify;
  max-width: 800px;
  margin: 10px auto;
}

/* ===== LOCATION & DATABASES (always visible top section) ===== */
.location_databases {
  max-width: 900px;
  margin: 30px auto;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.repository,
.external_databases {
  background-color: rgba(255, 255, 252, 0.6);
  border-left: 5px solid #8B3A3A;
  padding: 20px;
}

.location_databases dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  text-align: left;
  max-width: 800px;
  margin: 15px auto;
}

.location_databases dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.location_databases dd {
  margin: 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.5;
}

/* ===== COLLAPSIBLE SECTIONS (all <details>) ===== */
details.metadata,
details.physical_description,
details.palaeography,
details.apparatus,
details.translation,
details.commentary,
details.people {
    max-width: 900px;
    margin: 30px auto;
    text-align: left;
    border-left: 5px solid #8B3A3A;
    background-color: rgba(255, 255, 252, 0.6);
    padding: 20px;
}

details.metadata summary,
details.physical_description summary,
details.palaeography summary,
details.apparatus summary,
details.translation summary,
details.commentary summary,
details.people summary {
    list-style: none;
    color: #8B3A3A;
    font-family: 'Cardo', serif;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

details.metadata summary::-webkit-details-marker,
details.physical_description summary::-webkit-details-marker,
details.palaeography summary::-webkit-details-marker,
details.apparatus summary::-webkit-details-marker,
details.translation summary::-webkit-details-marker,
details.commentary summary::-webkit-details-marker,
details.people summary::-webkit-details-marker {
    display: none;
}

details.metadata summary::marker,
details.physical_description summary::marker,
details.palaeography summary::marker,
details.apparatus summary::marker,
details.translation summary::marker,
details.commentary summary::marker,
details.people summary::marker {
    display: none;
}

details.metadata summary::after,
details.physical_description summary::after,
details.palaeography summary::after,
details.apparatus summary::after,
details.translation summary::after,
details.commentary summary::after,
details.people summary::after {
    content: " ▾";
    font-size: 1.8rem;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

details.metadata[open] summary::after,
details.physical_description[open] summary::after,
details.palaeography[open] summary::after,
details.apparatus[open] summary::after,
details.translation[open] summary::after,
details.commentary[open] summary::after,
details.people[open] summary::after {
    content: " ▴";
    font-size: 1.8rem;
}

details.translation p,
details.palaeography p,
details.commentary p {
    margin: 10px 0;
    font-style: italic;
    text-align: justify;
}

/* ===== METADATA DETAILS (findspot, chronology, autopsy) ===== */
.findspot,
.chronology,
.autopsy {
  background-color: rgba(255, 255, 252, 0.6);
  border-left: 5px solid #8B3A3A;
  padding: 20px;
  margin-bottom: 20px;
}

details.metadata dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  text-align: left;
  max-width: 800px;
  margin: 15px auto;
}

details.metadata dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

details.metadata dd {
  margin: 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.5;
}

details.metadata p {
  text-align: left;
  max-width: 800px;
  margin: 10px auto;
}

/* ===== PHYSICAL DESCRIPTION ===== */
.physical_description {
  border-top: 2px solid rgba(139, 58, 58, 0.2);
}

.physical_description h2 {
  margin-top: 0;
}

.physical_description dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  text-align: left;
  margin: 15px auto;
}

.physical_description dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.physical_description dd {
  margin: 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.5;
}

/* Nested palaeography inside physical_description */
details.palaeography {
  border-left: none;
  padding: 10px;
  margin: 15px 0 0 0;
  max-width: none;
}

/* ===== DROPDOWNS ===== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown .dropdown-content {
  display: none !important;
  position: absolute;
  background-color: #8B3A3A;
  min-width: 200px;
  box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
  z-index: 1000;
  border: 1px solid #6D2D2D;
  top: 100%;
  left: 0;
}

.dropdown .dropdown-content a {
  color: #FDFaf0;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-family: 'Cardo', serif;
  font-size: 0.85rem;
  white-space: nowrap;
}

.dropdown .dropdown-content a:hover {
  background-color: #6D2D2D;
}

.dropdown:hover .dropdown-content {
  display: block !important;
}

.dropdown .dropbtn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.dropdown .dropbtn:hover {
  text-decoration-style: solid;
}

/* ===== WORD REFERENCES ===== */
.word-with-refs {
  display: inline;
  padding: 0;
  background: none;
  border: none;
  color: #8B3A3A;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: bold;
}

.word-with-refs:hover {
  background-color: rgba(139, 58, 58, 0.1);
}

.dual-reference {
  display: inline-block;
}

/* ===== INSCRIPTION LIST ===== */
.inscription-list {
  list-style-type: none;
  padding: 0;
  text-align: left;
}

.inscription-list li {
  margin: 10px 0;
  padding: 15px;
  background-color: rgba(239, 235, 216, 0.3);
  border-left: 4px solid #8B3A3A;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.inscription-list a {
  text-decoration: none;
  font-weight: bold;
  color: #2c3e50;
  word-break: break-word;
}

/* ===== TRANSCRIPTION ===== */
.transcription {
  font-family: 'Cardo', serif;
  line-height: 1.8;
  max-width: 900px;
  margin: 20px auto;
  text-align: center;
  overflow-x: auto;
}

.transcription a {
  color: #8B3A3A;
  text-decoration: none;
  font-weight: bold;
}

.transcription a:hover {
  background-color: rgba(139, 58, 58, 0.1);
}

.textpart {
  margin: 30px 0;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.ab-content {
  display: inline-block;
  text-align: left;
  position: relative;
  padding-left: 50px; 
}

.line {
  display: block;
  white-space: nowrap;
  position: relative;
  min-height: 1.8em;
}

.line[n="5"]::before,
.line[n="10"]::before,
.line[n="15"]::before,
.line[n="20"]::before,
.line[n="25"]::before,
.line[n="30"]::before {
  content: attr(n);
  position: absolute;
  left: -50px;
  width: 40px;
  text-align: right;
  color: #8B3A3A;
  font-size: 0.85em;
  font-weight: bold;
  opacity: 0.6;
}

div[data-location="lid"] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  border-bottom: 2px solid #333;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

div[data-location="lid"] > h4 {
  flex-basis: 100%;
}

div[data-location="lid"] .ab-content {
  text-align: center;
  padding-left: 0; 
}

div[data-location="lid"] .line::before {
  display: none; 
}

div[data-location="acroterion"] {
  flex: 0 1 auto;
  min-width: 200px;
}

div[data-location="chest"] {
  width: 100%;
  margin-top: 20px;
}

/* ===== APPARATUS ===== */
.apparatus .app-line {
    display: block;
    margin-bottom: 10px;
}

/* ===== FIGURES ===== */
figure {
  margin: 20px auto;
  padding: 10px;
  max-width: 400px; 
  width: 100%;
  background-color: #fff;
  border: 1px solid #ddd;
  text-align: left;
  box-sizing: border-box;
}

figure img {
  width: 100%;
  height: auto;
  display: block;
}

figcaption {
  font-size: 0.8rem;
  margin-top: 8px;
  color: #666;
}

.disclaimer {
    display: block;
    font-size: 0.5rem;
    color: #666;
    line-height: 1.4;
    margin-top: 10px;
    font-style: normal;
    border-top: 1px solid #eee;
    padding-top: 5px;
}

.reference {
  font-size: 0.8rem;
}

.context_text-with-figure {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 350px);
  gap: 30px;
  align-items: start;
}

.context_text-with-figure figure {
  width: 100%;
}

.context_text-with-figure figure img {
  width: 100%;
  height: auto;
}

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* ===== FOOTER ===== */
footer {
  flex-shrink: 0;
  font-size: 10px;
  text-align: center;
  color: #555;
  border-top: 1px solid rgba(0,0,0,0.05);
  padding: 20px 0;
  width: 100%;
}

footer p {
  margin: 5px 0;
  text-align: center;
}

/* ===== BIBLIOGRAPHY ===== */
.bibliography {
  max-width: 900px;
  margin: 30px auto;
  text-align: left;
}

.bibliography h2 {
  text-align: center;
  font-family: 'Cardo', serif;
  color: #8B3A3A;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.1rem;
  margin-bottom: 25px;
}

/* --- Standard references (table > tr > a) --- */
.bibliography table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.bibliography table tr {
  display: block;
  background-color: rgba(255, 255, 252, 0.6);
  border-left: 4px solid #8B3A3A;
  padding: 14px 20px;
  margin-bottom: 8px;
  font-family: 'Cardo', serif;
  font-size: 0.92rem;
  color: #2c3e50;
  line-height: 1.6;
  transition: transform 0.2s ease, background-color 0.2s ease, border-left-color 0.2s ease;
}

.bibliography table tr:hover {
  transform: translateX(5px);
  background-color: rgba(255, 255, 252, 0.95);
  border-left-color: #6D2D2D;
}

.bibliography table tr a {
  color: #2c3e50;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.bibliography table tr a:hover {
  color: #8B3A3A;
  border-bottom-color: #8B3A3A;
}

.bibliography table tr a em {
  color: #8B3A3A;
  font-weight: 600;
}

/* --- Database entries (dl) --- */
.bibliography dl {
  display: block;
  background-color: rgba(255, 255, 252, 0.6);
  border-left: 4px solid #8B3A3A;
  padding: 18px 20px;
  margin-top: 20px;
  margin-bottom: 8px;
  transition: transform 0.2s ease, background-color 0.2s ease, border-left-color 0.2s ease;
}

.bibliography dl:hover {
  transform: translateX(5px);
  background-color: rgba(255, 255, 252, 0.95);
  border-left-color: #6D2D2D;
}

.bibliography dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #fff;
  background-color: #8B3A3A;
  padding: 2px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-top: 10px;
}

.bibliography dt:first-of-type {
  margin-top: 0;
}

.bibliography dd {
  margin: 4px 0 0 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.5;
  font-size: 0.92rem;
}

.bibliography dd h5 {
  margin: 0;
  text-align: left;
  font-size: 1rem;
}

.bibliography dd h5 a {
  color: #8B3A3A;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

.bibliography dd h5 a:hover {
  border-bottom-color: #8B3A3A;
}

/* ===== PEOPLE ===== */
.people {
  margin-top: 30px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.person_record, .person {
  background-color: rgba(255, 255, 252, 0.6);
  border-left: 5px solid #8B3A3A;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  transition: transform 0.2s ease, background-color 0.2s ease;
  display: block; 
  text-align: left;
}

.person_record:hover, .person:hover {
  transform: translateX(5px);
  background-color: rgba(255, 255, 252, 0.9);
}

.person img {
  width: 75px; 
  height: 75px;
  object-fit: contain; 
  flex-shrink: 0;
  background-color: #fff;
  border: 1px solid rgba(139, 58, 58, 0.15);
  border-radius: 4px;
  padding: 5px;
  filter: sepia(0.2) contrast(0.9);
  float: right; 
  margin-left: 20px;
}

.person h3, .person_record h3 {
  margin: 0 0 15px 0;
  font-family: 'Cardo', serif;
  color: #6D2D2D;
  font-size: 1.4rem;
  border-bottom: 1px solid rgba(139, 58, 58, 0.2);
  padding-bottom: 5px;
  text-align: left;
}

.person dl, .person_record dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  margin: 0;
  gap: 8px 20px;
}

.person dt, .person_record dt {
  font-family: 'Cardo', serif;
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
}

.person dd, .person_record dd {
  margin: 0;
  font-family: 'Cardo', serif;
  color: #2c3e50;
  line-height: 1.5;
}

.person dd a, .person_record dd a {
  color: #8B3A3A;
  font-weight: bold;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border 0.2s ease;
}

.person dd a:hover, .person_record dd a:hover {
  border-bottom: 1px solid #8B3A3A;
}

/* ===== NOTES SECTION ===== */
.notes {
  max-width: 800px;
  margin: 40px auto 20px auto;
  text-align: left;
  border-top: 2px solid rgba(139, 58, 58, 0.25);
  padding-top: 20px;
}

.notes h2 {
  text-align: left;
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.notes ol {
  padding-left: 30px;
  margin: 0;
}

.notes li {
  font-family: 'Cardo', serif;
  font-size: 0.85rem;
  color: #2c3e50;
  line-height: 1.6;
  margin-bottom: 4px;
  text-align: left;
}

.notes li:target {
  background-color: rgba(139, 58, 58, 0.08);
  border-radius: 2px;
  padding: 2px 4px;
}

a.note-ref {
  color: #8B3A3A;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.8em;
  vertical-align: super;
  line-height: 0;
  transition: color 0.2s ease;
}

a.note-ref:hover {
  color: #6D2D2D;
  text-decoration: underline;
}

/* ===== CORPORA & DATABASES ===== */
.epigraphic_corpora,
.prosopographical_corpora,
.databases {
  max-width: 800px;
  margin: 30px auto;
  text-align: left;
}

.epigraphic_corpora h2,
.prosopographical_corpora h2,
.databases h2 {
  text-align: left;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid rgba(139, 58, 58, 0.25);
  padding-bottom: 8px;
  margin-bottom: 15px;
}

.epigraphic_corpora table,
.prosopographical_corpora table,
.databases table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cardo', serif;
}

.epigraphic_corpora tr,
.prosopographical_corpora tr,
.databases tr {
  border-bottom: 1px solid rgba(139, 58, 58, 0.1);
  transition: background-color 0.15s ease;
}

.epigraphic_corpora tr:hover,
.prosopographical_corpora tr:hover,
.databases tr:hover {
  background-color: rgba(139, 58, 58, 0.04);
}

.epigraphic_corpora td,
.prosopographical_corpora td,
.databases td {
  padding: 10px 12px;
  vertical-align: top;
  font-size: 0.9rem;
  color: #2c3e50;
  line-height: 1.5;
}

.epigraphic_corpora td:first-child,
.prosopographical_corpora td:first-child,
.databases td:first-child {
  white-space: nowrap;
  width: 80px;
  color: #8B3A3A;
  font-size: 0.95rem;
}

.databases td a {
  color: #8B3A3A;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  word-break: break-all;
}

.databases td a:hover {
  border-bottom-color: #8B3A3A;
}

/* ===== INDEX RECORDS TABLE ===== */
table.index_records {
  width: 80%;
  margin-left:10%; 
  margin-right:10%;
  border-collapse: collapse;
  font-family: 'Cardo', serif;
  border-bottom: 1px solid #ddd;
}

table.index_records tr th {
  font-size: 20px;
  color: white;
  background-color: #8B3A3A;
  padding: 12px 16px;
  text-align: center;
}

table.index_records tr {
  border-bottom: 2px solid #8B3A3A;
}

td.record_section {
  color: #8B3A3A;
  background-color: rgba(139, 58, 58, 0.1);
  padding: 14px 16px;
  vertical-align: middle;
}

table.index_records td {
  padding: 14px 16px;
  vertical-align: top;
  line-height: 1.6;
}

table.index_records td:not(.record_section) {
  text-align: justify;
}

table.index_records tr:hover td:not(.record_section) {
  background-color: rgba(139, 58, 58, 0.06);
}

/* ===== CONVENTIONS TABLE ===== */
.conventions-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 30px auto;
}

table.conventions {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cardo', serif;
  font-size: 0.88rem;
  line-height: 1.5;
}

table.conventions thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

table.conventions thead th {
  background-color: #8B3A3A;
  color: #FDFaf0;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.78rem;
  padding: 12px 10px;
  text-align: left;
  border-bottom: 3px solid #6D2D2D;
  white-space: nowrap;
}

table.conventions tbody tr {
  border-bottom: 1px solid rgba(139, 58, 58, 0.12);
  transition: background-color 0.15s ease;
}

table.conventions tbody tr:nth-child(even) {
  background-color: rgba(239, 235, 216, 0.25);
}

table.conventions tbody tr:hover {
  background-color: rgba(139, 58, 58, 0.06);
}

table.conventions td {
  padding: 10px;
  vertical-align: top;
  color: #2c3e50;
}

table.conventions td.col-siglum80,
table.conventions td.col-siglum91 {
  font-weight: bold;
  color: #6D2D2D;
  white-space: nowrap;
  font-size: 0.92rem;
}

table.conventions td.col-description {
  min-width: 180px;
}

table.conventions td.col-epidoc {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  background-color: rgba(239, 235, 216, 0.2);
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

table.conventions td.col-example {
  font-style: italic;
  font-size: 0.82rem;
  color: #555;
  min-width: 200px;
}

table.conventions td.col-example em {
  font-style: normal;
  font-weight: bold;
}

table.conventions tr.section-header td {
  background-color: rgba(139, 58, 58, 0.08);
  font-weight: bold;
  color: #8B3A3A;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.78rem;
  padding: 8px 10px;
  border-top: 2px solid rgba(139, 58, 58, 0.25);
  border-bottom: 2px solid rgba(139, 58, 58, 0.25);
}

table.conventions td.empty {
  color: #bbb;
  font-style: italic;
}

/* Ligature arc: curved border spanning connected letters */
.ligature-arc {
  display: inline-block;
  border-top: 1.5px solid currentColor;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  padding-top: 2px;
  line-height: 1.1;
}

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

/* --- Tablet --- */
@media (max-width: 768px) {
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  
  .ab-content {
    padding-left: 40px;
  }

  .line[n="5"]::before,
  .line[n="10"]::before,
  .line[n="15"]::before,
  .line[n="20"]::before,
  .line[n="25"]::before,
  .line[n="30"]::before {
    left: -40px;
    width: 30px;
  }

  .main_title {
    padding: 20px 10px 3px 10px;
  }

  .main_subtitle {
    padding: 0 10px 10px 10px;
    font-size: 0.95rem;
  }

  .menu a {
    padding: 12px 12px;
    font-size: 0.8rem;
  }

  table.conventions {
    font-size: 0.8rem;
  }
  table.conventions thead th {
    font-size: 0.7rem;
    padding: 8px 6px;
  }
  table.conventions td {
    padding: 8px 6px;
  }
  table.conventions td.col-epidoc {
    font-size: 0.72rem;
  }
}

/* --- Small tablets / large phones --- */
@media (max-width: 650px) {
  .person, .person_record {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }

  .person img {
    float: none;
    margin: 0 0 15px 0;
    width: 100px;
    height: 100px;
  }

  .person dl, .person_record dl {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .person dt, .person_record dt {
    margin-top: 10px;
    border-bottom: 1px solid rgba(139, 58, 58, 0.1);
    justify-content: center;
  }

  .person dd, .person_record dd {
    text-align: center;
  }

  .person h3, .person_record h3 {
    text-align: center;
  }
}

/* --- Phones --- */
@media (max-width: 600px) {
  .main_title {
    padding: 12px 10px 2px 10px;
    font-size: 0.9em;
  }

  .main_subtitle {
    padding: 0 10px 8px 10px;
    font-size: 0.8rem;
  }

  .main_title h1 {
    font-size: 1.2rem;
    margin: 0;
  }

  .menu {
    flex-wrap: wrap;
    justify-content: center;
  }

  .menu a {
    padding: 10px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
  }

  .transcription {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .textpart {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .ab-content {
    padding-left: 30px; 
    min-width: 0;
  }

  .line[n="5"]::before,
  .line[n="10"]::before,
  .line[n="15"]::before,
  .line[n="20"]::before,
  .line[n="25"]::before,
  .line[n="30"]::before {
    left: -30px;
    width: 25px;
    font-size: 0.75em;
  }

  .inscription-list li {
    padding: 12px 10px;
    font-size: 0.9rem;
  }
  
  .location_databases dl,
  details.metadata dl {
    grid-template-columns: 1fr;
  }
  
  .location_databases dt,
  details.metadata dt {
    margin-top: 10px;
  }
  
  .physical_description dl {
    grid-template-columns: 1fr;
  }
  
  .physical_description dt {
    margin-top: 10px;
  }

  .biblio-item dl, .bibliography dl {
    grid-template-columns: 1fr;
  }

  .biblio-item dt, .bibliography dt {
    margin-top: 10px;
    display: inline-block;
  }

  main {
    padding: 20px 12px;
    margin: 10px auto;
    width: 95%;
  }

  details.metadata,
  details.physical_description,
  details.palaeography,
  details.apparatus,
  details.translation,
  details.commentary,
  details.people {
    padding: 12px;
    margin: 20px auto;
  }

  div[data-location="lid"] {
    gap: 20px;
  }

  div[data-location="acroterion"] {
    min-width: 150px;
  }
}

/* --- Very small phones --- */
@media (max-width: 400px) {
  .main_title {
    padding: 8px 5px 2px 5px;
  }

  .main_subtitle {
    padding: 0 5px 6px 5px;
    font-size: 0.7rem;
  }

  .main_title h1 {
    font-size: 1rem;
  }

  .menu a {
    padding: 8px 6px;
    font-size: 0.7rem;
    letter-spacing: 0;
  }

  main {
    padding: 15px 8px;
    width: 98%;
  }

  .ab-content {
    padding-left: 25px;
  }

  .line[n="5"]::before,
  .line[n="10"]::before,
  .line[n="15"]::before,
  .line[n="20"]::before,
  .line[n="25"]::before,
  .line[n="30"]::before {
    left: -25px;
    width: 20px;
    font-size: 0.7em;
  }
  main > dl {
  grid-template-columns: 1fr;
  }

  main > dl dt {
    border-right: none;
    border-bottom: 1px solid rgba(139, 58, 58, 0.15);
    padding-right: 0;
    padding-bottom: 4px;
    margin-top: 12px;
  }
}
