/* ==========================================================================
   CARTAGENAE REI PUBLICÆ — DEDICATED STYLESHEET
   ========================================================================== */

/* --- Design Tokens & Variables --- */
:root {
  --bg-color: #111111;
  --surface-color: #1a1a1a;
  --surface-light: #222222;
  --border-color: #333333;
  --border-highlight: #444444;
  --border-subtle: #555555;
  --border-popup: #666666;

  --text-white: #ffffff;
  --text-main: #eeeeee;
  --text-heading-sub: #dcdcdc;
  --text-muted: #aaaaaa;
  --text-subtle: #888888;

  --accent-red: #ff4040;
  --accent-link: #9ecbff;
  --accent-visited: #cc66ff;

  --font-serif: "Copperplate", Georgia, "Times New Roman", serif;
}

/* --- Global Reset & Box Sizing --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* --- Base Body & Typography --- */
body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-serif);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-link);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

a:hover {
  text-decoration: underline;
}

a:visited {
  color: var(--accent-visited);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-red);
  outline-offset: 2px;
}

/* --- Layout Container --- */
.container {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
  font-size: 1.031rem; /* Equivalent to ~16.5px base */
}

/* --- Top Navigation & Language Switcher --- */
.top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 25px;
  margin-bottom: 15px;
}

.lang-switcher {
  font-size: 0.9em;
  letter-spacing: 1px;
  color: var(--text-subtle);
  text-align: center;
}

.lang-btn {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-subtle);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  padding: 2px 8px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-white);
}

.lang-btn.active {
  color: var(--accent-red);
  font-weight: 600;
  border-bottom-color: var(--accent-red);
}

/* --- Headings --- */
h1.main-title {
  margin: 15px 20px 5px;
  color: var(--text-white);
  font-size: 2.375rem; /* 38px */
  font-weight: normal;
  letter-spacing: 3px;
  text-align: center;
}

h1.main-title span.subtitle {
  display: block;
  margin-top: 6px;
  color: var(--text-heading-sub);
  font-size: 1.375rem; /* 22px */
  font-style: italic;
  letter-spacing: 2px;
}

h2, h3, h4 {
  font-weight: normal;
  letter-spacing: 1px;
  text-align: center;
}

h2.section-heading {
  margin-top: 50px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--accent-red);
}

/* --- Parallax Hero Section --- */
.hero-wrapper {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 400px;
    background-image: url('../images/FraMauroRzplita_z.jpg');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.hero-caption {
    width: 100%;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    padding: 1.5rem 2rem;
    text-align: center;
}

/* --- Bibliographical Popups --- */
.bib-popup {
  color: var(--accent-link);
  cursor: pointer;
  text-decoration: underline;
}

.bib-popup-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  padding: 18px 24px;
  background: var(--surface-light);
  border: 1px solid var(--border-popup);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
  color: var(--text-main);
  direction: ltr; /* Keeps citations formatted correctly regardless of page language */
  z-index: 10000;
}

.bib-popup-popup button {
  margin-top: 12px;
  padding: 4px 12px;
  background: var(--border-color);
  border: 1px solid var(--border-popup);
  color: var(--text-white);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}

.bib-popup-popup button:hover {
  background: var(--border-highlight);
}

/* --- Data Tables --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.seminar-table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  color: inherit;
  font-family: inherit;
}

.seminar-table th,
.seminar-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-highlight);
  text-align: left;
  vertical-align: top;
}

.seminar-table th {
  background: var(--surface-color);
  color: var(--text-white);
  font-weight: normal;
  text-align: center;
}

/* --- Participant Listings --- */
.participant-list {
  margin: 20px 0;
  padding: 0;
  list-style-type: none;
}

.participant-list li {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dotted var(--border-color);
}

.participant-name {
  color: var(--text-white);
  font-weight: bold;
}

.participant-affiliation {
  color: var(--text-muted);
  font-size: 0.95em;
  font-style: italic;
}

/* --- Dividers & Footer --- */
hr.half {
  width: 50%;
  margin: 45px auto;
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

.footer {
  margin-top: 60px;
  margin-bottom: 30px;
  color: var(--text-subtle);
  font-size: 0.833rem; /* ~10pt */
  font-style: italic;
  text-align: right;
}

/* --- Multilingual Toggle Mechanics --- */
[data-lang] {
  display: none !important;
}

/* Display rules for Active Language */
body.lang-en [data-lang="en"],
body.lang-pl [data-lang="pl"],
body.lang-lt [data-lang="lt"],
body.lang-uk [data-lang="uk"],
body.lang-be [data-lang="be"],
body.lang-he [data-lang="he"] {
  display: block !important;
}

body.lang-en span[data-lang="en"],
body.lang-pl span[data-lang="pl"],
body.lang-lt span[data-lang="lt"],
body.lang-uk span[data-lang="uk"],
body.lang-be span[data-lang="be"],
body.lang-he span[data-lang="he"] {
  display: inline !important;
}

body.lang-en tr[data-lang="en"],
body.lang-pl tr[data-lang="pl"],
body.lang-lt tr[data-lang="lt"],
body.lang-uk tr[data-lang="uk"],
body.lang-be tr[data-lang="be"],
body.lang-he tr[data-lang="he"] {
  display: table-row !important;
}

/* --- Hebrew (RTL) Context Overrides --- */
body.lang-he {
  direction: rtl;
  text-align: right;
}

body.lang-he .seminar-table th,
body.lang-he .seminar-table td {
  text-align: right;
}

body.lang-he .footer {
  text-align: left;
}

/* --- Dynamic Map Viewer -------------------------------------------------- */

#cartagenea-map-viewer {
width: 100%;
height: 70vh;
min-height: 400px;
margin: 30px auto;
border: 1px solid var(--border-highlight);
background: #000000;
position: relative;
}

/* Keep the OpenSeadragon navigator small, fixed in the upper-right,
and permanently visible. */
#cartagenea-map-viewer .navigator {
border: 1px solid var(--border-highlight) !important;
background: rgba(0, 0, 0, 0.75) !important;
}

#cartagenea-map-viewer .displayregion {
border: 1px solid var(--accent-red) !important;
}

.map-reference {
margin: 20px auto 10px;
text-align: center;
color: var(--text-main);
}

.map-reference a {
color: var(--accent-link);
}

@media screen and (max-width: 600px) {
#cartagenea-map-viewer {
height: 55vh;
min-height: 300px;
}
}

/* --- Mobile Responsiveness --- */
@media screen and (max-width: 600px) {
  h1.main-title {
    font-size: 1.75rem; /* 28px */
  }

  h1.main-title span.subtitle {
    font-size: 1rem; /* 16px */
  }

  .top-bar {
    margin-top: 15px;
    margin-bottom: 10px;
  }

  .hero-wrapper {
    height: 40vh;
  }

  .hero-caption {
    bottom: 15px;
    font-size: 1rem; /* 16px */
  }

  .seminar-table th,
  .seminar-table td {
    padding: 8px 6px;
    font-size: 0.875rem; /* 14px */
  }
}