/* ----------------------------------------------------------
   GLOBAL RESET & BASE
---------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "Inter", "Merriweather", Georgia, serif;
  line-height: 1.75;
  background: linear-gradient(180deg, #f8f9fb 0%, #eef0f4 100%);
  color: #111;
  -webkit-font-smoothing: antialiased;
}

body.has-fixed-header {
  padding-top: 130px;
}


/* ----------------------------------------------------------
   INDEX PAGE
---------------------------------------------------------- */
.index-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  backdrop-filter: blur(24px) saturate(220%) brightness(105%);
  -webkit-backdrop-filter: blur(24px) saturate(220%) brightness(105%);
  background: linear-gradient(120deg, rgba(255,255,255,0.8), rgba(255,255,255,0.15));
  border-bottom: 1px solid rgba(0,122,255,0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), inset 0 0 10px rgba(255,255,255,0.1);
  text-align: center;
  padding: 25px 24px;
  z-index: 1000;
  pointer-events: auto;
  transition: all 0.4s ease;
}

.index-header h1 {
  font-size: 2.1em;
  font-weight: 700;
  margin: 0;
  padding: 0;
  color: #111;
  text-align: center;
  position: relative;
}

.index-header h1 .subtitle {
  display: block;
  margin-top: 5px;
  font-size: 0.5em;
  font-weight: 400;
  font-style: italic;
  color: #888;
}

.overview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 30px 0 20px 0;
  width: 100%;
}

.overview {
  display: inline-block;
  margin: 15px auto;
  padding: 24px;
  border-radius: 16px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-left: 4px solid rgba(0,122,255,0.25);
  transition: all 0.35s ease;
  width: 100%;
  max-width: 1200px;
  text-align: left;
}

.overview:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-left-color: rgba(0,122,255,0.45);
}

.overview a {
  text-decoration: none;
  font-weight: 500;
  color: #007acc !important;
  border-bottom: 1px dashed rgba(0, 122, 255, 0.4);
}

.overview a:hover {
  color: #005fa3 !important;
  border-bottom-color: #005fa3;
}

.overview p {
  margin: 0.8rem 0 0.8rem 0;
  color: #222;
}

.overview ul {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
  color: #222;
}

.overview li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
  color: #222;
}

.expand {
  margin-bottom: 1rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 1rem;
}

.expand:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.expand h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin: 0;
  font-size: 1.4rem;
  padding: 0.5rem 0;
  user-select: none;
}

.expand h2 .arrow {
  transition: transform 0.3s ease;
  font-size: 1rem;
}

.expand-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.35s ease;
}

.expand.open .expand-content {
  max-height: 2000px;
  opacity: 1;
}

.expand.open h2 .arrow {
  transform: rotate(180deg);
}

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: rgba(0, 122, 255, 0.05);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0. ninerem;
  color: #007acc;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.license {
  margin-top: 1.5em;
  text-align: center;
}

.license a {
  display: block;
  border-bottom: none !important;
  text-decoration: none !important;
}

.license img {
  width: 88px;
  height: 31px;
  border: 0;
  vertical-align: middle;
}

code:hover {
  background: rgba(0, 122, 255, 0.1);
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 30px 0 20px 0;
  padding: 8px 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: rgba(0, 122, 255, 0.75);
  letter-spacing: 1px;
  text-align: center; 
  user-select: none;
  position: relative;
  background: none;
}

.group-heading::before,
.group-heading::after {
  content: '';
  flex: 1;
  height: 3px;
}

.group-heading::before {
  background: linear-gradient(90deg, rgba(0,122,255,0.2) 0%, rgba(0,122,255,0) 100%);
}

.group-heading::after {
  background: linear-gradient(90deg, rgba(0,122,255,0) 0%, rgba(0,122,255,0.2) 100%);
}

.cards-group-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.cards-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  width: 100%;
  max-width: 1400px;
  padding: 0 24px;
}

.card {
  display: inline-block;
  margin-top: 15px;
  margin-bottom: 15px;
  padding: 24px;
  border-radius: 16px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-left: 4px solid rgba(0,122,255,0.25);
  transition: all 0.35s ease;
  width: 100%;
  text-align: left;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-left-color: rgba(0,122,255,0.45);
}

.card[data-state="complete"] {
  border-left-color: rgba(40, 200, 120, 0.45);
}

.card[data-state="complete"]:hover {
  border-left-color: rgba(40, 200, 120, 0.7);
}

.card[data-state="incomplete"] {
  border-left-color: rgba(170, 170, 170, 0.25);
  opacity: 0.9;
}

.card[data-state="incomplete"]:hover {
  border-left-color: rgba(170, 170, 170, 0.45);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.6em;
  margin-bottom: 0 !important;
  color: #222;
}

.folio-range {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(0, 122, 255, 0.7);
  background: rgba(0, 122, 255, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  margin-left: 15px;
}

.card a {
  text-decoration: none;
  color: #222;
  transition: color 0.35s ease, border-bottom-color 0.35s ease;
}

.card a:hover {
  color: #000;
  border-bottom-color: rgba(0,122,255,0.45);
}

.card-summary {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 15px;
  line-height: 1.5;
  font-style: italic;
}

.card-warning {
  margin-top: 15px;
  margin-bottom: 15px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.5;  
  background-color: rgba(255, 193, 7, 0.15);
  color: #a87e00;
  border: 1px solid rgba(255, 193, 7, 0.4);  
  font-style: italic;
  font-weight: 500;  
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.1);
  display: flex;
  align-items: center; 
  gap: 10px;
}

.card-warning::before {
  content: '⚠️';
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1; 
}

.edition-link-container {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 12px;
}

.edition-link {
  font-weight: 500;
  color: #007acc !important;
  border-bottom: 1px dashed rgba(0, 122, 255, 0.4);
}

.edition-link:hover {
  color: #005fa3 !important;
  border-bottom-color: #005fa3;
}

.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1rem;
}

.link-buttons a {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: #000;
  background: rgba(0,122,255,0.3);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.35s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.link-buttons a:hover {
  background: rgba(0, 123, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.link-buttons button.disabled {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: #888;
  background: rgba(170, 170, 170, 0.15);
  border-radius: 12px;
  border: none;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.7;
  transition: none;
}

.link-buttons button.disabled:hover {
  transform: none;
  box-shadow: none;
  background: rgba(170, 170, 170, 0.15);
}

.arlima-button {
  background: rgba(113, 152, 152, 0.5) !important;
  color: #000 !important;
  box-shadow: 0 4px 12px rgba(113, 152, 152, 0.15) !important;
}

.arlima-button:hover {
  background: rgba(113, 152, 152, 0.9) !important;
  box-shadow: 0 6px 18px rgba(113, 152, 152, 0.2);
}


/* ----------------------------------------------------------
   EDITION PAGE
---------------------------------------------------------- */
/* Page-level elements */
.split {
  display: flex;
  height: 100vh;
  width: 100%;
  padding: 24pt;
}

.left {
  border-right: 1px solid #ccc; 
  position: relative;
  margin-right: 0.2rem;
}

.right {
  background: #f4f4f4;
  margin-left: 0.2rem;
  max-width: 40%;
}

.left, .right {
  flex: 1;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-left: 4px solid rgba(0,122,255,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.35s ease,
              border-left-color 0.35s ease;
}

.left:hover, .right:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  border-left-color: rgba(0,122,255,0.45);
}

#scroll-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
}

#scroll-container > div:last-child {
  min-height: 60vh;
}

#mirador-viewer {
  flex: 1;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.right > div:last-child {
  padding: 12px 18px;
  font-size: 0.9rem;
  color: #444;
  background: rgba(255,255,255,0.65);
  border-top: 1px solid rgba(0,122,255,0.15);
}

/* Header */
.meta {
  margin-bottom: 20px;
  padding: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  border-left: 3px solid transparent;
  transition: all 0.35s ease;
}

.meta:hover {
  border-left-color: rgba(0,122,255,0.45);
}

.meta div {
  margin-bottom: 6px;
  line-height: 1.5;
}

.meta strong {
  color: #111;
}

.meta h1 {
  font-size: 1.8rem;
  margin-top: 1.5rem;
  color: #111;
}

.meta p {
  margin: 1.5rem 0 0.5rem 0;
  font-size: 0.95rem;
  color: #555;
}

.header-buttons {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  z-index: 50;
}

.back-button,
.switch-button {
  transition: all 0.35s ease;
  z-index: 50;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: #007acc;
  transition: all 0.35s ease;
}

.back-button:hover,
.switch-button:hover {
  color: #005fa3;
}

/* Text and lines */
#text {
  padding-right: 6px;
  font-size: 1rem;
  line-height: 1.75;
}

#text a {
  color: #222;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0,122,255,0.3);
}

#text a:hover {
  color: #000;
  border-bottom-color: rgba(0,122,255,0.55);
}

.folio-block {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
  width: 100%;
}

.text-col {
  flex: 1;
  min-width: 0;
}

.lg-group {
  padding: 4px;
  border-left: 3px solid transparent;
  transition: all 0.35s ease;
  margin-bottom: 12px;
  border-radius: 4px;
}

.lg-group:hover {
  border-left-color: rgba(0,122,255,0.45);
  transform: translateX(3px);
}

.line {
  padding: 0;
  margin-bottom: 0.15rem;
  line-height: 1.25;
  display: flex;
  gap: 0.5rem;
}

.line-text {
  flex: 1;
}

/* Folio markers */
.folio-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  clear: both;
  margin: 12px 0;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
  background: none;
  transition: all 0.35s ease;
  border-left: 3px solid transparent;
  border-radius: 4px;
}

.folio-marker:hover {
  padding: 8px 8px;
  background: rgba(0, 122, 255, 0.15);
  color: rgba(0,122,255,1);
  border-left-color:rgba(0,122,255,0.4);
  box-shadow: inset 0 0 8px rgba(0,122,255,0.1);
}

.folio-marker::before,
.folio-marker::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,122,255,0.2) 0%, rgba(0,122,255,0) 100%);
}

.folio-marker::after {
  background: linear-gradient(90deg, rgba(0,122,255,0) 0%, rgba(0,122,255,0.2) 100%);
}

.folio-label {
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(0,122,255,0.75);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

/* Speaker label */
.speaker-label {
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: rgba(0,122,255,0.8);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Line number */
.ln {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  text-align: right;
  align-self: center;
  color: #999;
  margin-right: 0.25rem;
  flex-shrink: 0;
  opacity: 0.8;
  min-width: 1.5rem;
}


/* ----------------------------------------------------------
   RESPONSIVE
---------------------------------------------------------- */
@media (max-width: 768px) {
  .split {
    flex-direction: column;
    height: auto;
  }

  .left, .right {
    height: auto;
  }

  .folio-block {
    flex-direction: column;
    gap: 0;
  }

  #mirador-viewer {
    height: 400px;
  }
}