/* Digital Edition Stylesheet */

:root { 
  --text-primary: #2c3e50;
  --text-secondary: #34495e;
  --text-muted: #7f8c8d;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-accent: #ecf0f1;
  --border-light: #e1e8ed;
  --border-medium: #bdc3c7;
  --accent-blue: #3498db;
  --accent-red: #e74c3c;
  --accent-green: #27ae60;
  --accent-orange: #f39c12;
  --accent-purple: #9b59b6;
  --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.15);
  --radius-small: 4px;
  --radius-medium: 8px;
  --font-size-small: 0.875rem;
  --font-size-base: 1rem;
  --font-size-large: 1.125rem;
  --line-height-base: 1.6;
  --line-height-tight: 1.4;
}

/* Base typography and layout */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Layout containers */
header, nav, main, footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header and navigation */
header {
  background: var(--bg-primary);
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  gap: 2rem;
}

nav {
  padding: 0;
}

nav a {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  margin-right: 2rem;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

nav a:hover,
nav a:focus {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* Headings */
h1 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-primary);
  margin: 0 0 1.5rem 0;
  line-height: var(--line-height-tight);
}

h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-size-large);
  font-weight: 500;
  color: var(--text-secondary);
  margin: 2rem 0 1rem 0;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

/* Main content area */
main {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-light);
  margin-bottom: 3rem;
}

.diary-text p,
.diary-scroll p {
  margin-bottom: 1.5rem;
  text-align: justify;
  hyphens: auto;
}

/* Toggle modes */
body.mode-reading .textcrit.del {
  display: none;
}

body.mode-reading .pb {
  display: none;
}

body.mode-diplomatic .reading-only {
  display: none;
}

/* Mode toggle button */
button.toggle {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-medium);
  background: var(--bg-primary);
  color: var(--accent-blue);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-light);
}

button.toggle:hover {
  background: var(--accent-blue);
  color: var(--bg-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

/* Entity references */
a.person {
  color: #8e44ad; 
  text-decoration: none;
  border-bottom: 1px solid rgba(142, 68, 173, 0.3);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

a.person:hover {
  background: rgba(142, 68, 173, 0.1);
  border-bottom-color: #8e44ad;
}

a.place {
  color: var(--accent-green);
  text-decoration: none;
  border-bottom: 1px solid rgba(39, 174, 96, 0.3);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

a.place:hover {
  background: rgba(39, 174, 96, 0.1);
  border-bottom-color: var(--accent-green);
}

a.org {
  color: var(--accent-blue); 
  text-decoration: none;
  border-bottom: 1px solid rgba(52, 152, 219, 0.3);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

a.org:hover {
  background: rgba(52, 152, 219, 0.1);
  border-bottom-color: var(--accent-blue);
}

a.work {
  color: var(--accent-orange);
  text-decoration: none;
  border-bottom: 1px solid rgba(243, 156, 18, 0.3);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

a.work:hover {
  background: rgba(243, 156, 18, 0.1);
  border-bottom-color: var(--accent-orange);
}

/* Text-critical apparatus */
.textcrit.del,
.textcrit.add {
  position: relative;
  display: inline-block;
}

/* Diplomatic mode */
body.mode-diplomatic .textcrit.add .add-text {
  background: linear-gradient(120deg, rgba(39, 174, 96, 0.15) 0%, rgba(39, 174, 96, 0.08) 100%);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-small);
  border-left: 2px solid rgba(39, 174, 96, 0.4);
}

/* Reading mode: additions */
body.mode-reading .textcrit.add {
  position: static;
}

body.mode-reading .textcrit.add .add-text {
  color: inherit;
  background: none;
  padding: 0;
  border: none;
}

body.mode-reading .popup-add {
  display: none !important;
}

/* Diplomatic mode: deletions */
body.mode-diplomatic .textcrit.del .del-text {
  text-decoration: line-through;
  color: var(--accent-red);
  opacity: 0.7;
  cursor: pointer;
}

/* Base popup styling */
.popup-add,
.popup-del,
.popup-commentary,
.popup-author {
  display: none;
  position: absolute;
  z-index: 1000;
  background: var(--bg-primary);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-medium);
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  font-size: var(--font-size-small);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  line-height: var(--line-height-base);
  white-space: normal;
  word-wrap: break-word;
  hyphens: auto;
  lang: de;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
}

/* Commentary popups */
.popup-commentary {
  max-width: 480px;
  min-width: 300px;
  border-left: 4px solid var(--accent-blue);
  background: var(--bg-primary);
}

/* Author note popups */
.popup-author {
  max-width: 350px;
  min-width: 250px;
  border-left: 4px solid var(--accent-red);
  background: var(--bg-primary);
}

/* Add/Del popups - compact for short editorial notes */
.popup-add,
.popup-del {
  max-width: 280px;
  min-width: 200px;
  background: var(--bg-primary);
}

.popup-add {
  border-left: 4px solid var(--accent-green);
}

.popup-del {
  border-left: 4px solid var(--accent-red);
}

/* Close button for all popups */
.popup-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.popup-close:hover {
  color: var(--text-primary);
}

/* Remove arrow indicators */
.popup-add::before,
.popup-del::before,
.popup-commentary::before,
.popup-author::before {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .popup-commentary {
    max-width: 90vw;
    min-width: 280px;
    left: 5%;
    right: 5%;
    transform: none;
    top: 20%;
  }
  
  .popup-author {
    max-width: 85vw;
    min-width: 260px;
    left: 7.5%;
    right: 7.5%;
    transform: none;
    top: 20%;
  }
  
  .popup-add,
  .popup-del {
    max-width: 80vw;
    min-width: 240px;
    left: 10%;
    right: 10%;
    transform: none;
    top: 25%;
  }
}

/* Ensure the note containers have relative positioning */
.note.commentary,
.note.author {
  display: inline-block;
  position: relative;
}

/* Note toggles */
.note-toggle,
.note-author {
  background: none;
  border: none;
  color: var(--accent-blue);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-small);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
}

.note-toggle:hover,
.note-author:hover {
  background: rgba(52, 152, 219, 0.1);
  color: var(--text-primary);
}

.note-author {
  color: var(--accent-red);
}

.note-author:hover {
  background: rgba(231, 76, 60, 0.1);
}

/* Author note popups */
.note.author .popup-author {
  border-left: 4px solid var(--accent-red);
  background: var(--bg-primary); /* Solid white background */
}

/* Page breaks */
.page-break {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 3rem 0;
}

.pb {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-size-small);
  color: var(--text-muted);
  margin: 2rem 0 1rem 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-medium);
  text-align: center;
}

.pb a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
}

.pb a:hover {
  text-decoration: underline;
}

/* Entry headers */
.entry-head {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-size-large);
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.entry-head-inline {
  font-weight: 400;
  display: inline;
}

.entry-head-inline::after {
  content: " ";
}

/* Index pages */
ul {
  list-style: none;
  padding: 0;
}

li {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-medium);
  transition: all 0.2s ease;
}

li:hover {
  background: var(--bg-accent);
  border-color: var(--border-medium);
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
}

li strong {
  color: var(--text-primary);
  font-weight: 600;
}

li small {
  color: var(--text-muted);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

li small a {
  color: var(--accent-blue);
  text-decoration: none;
  margin-right: 0.5rem;
}

li small a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  header, nav, main, footer {
    padding: 0 1rem;
  }
  
  .topbar {
    flex-direction: column;
    gap: 1rem;
  }
  
  nav a {
    margin-right: 1rem;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .popup-add,
  .popup-del,
  .popup-commentary,
  .popup-author {
    max-width: 280px;
    font-size: 0.8rem;
  }
}

/* Print styles */
@media print {
  .topbar,
  .toggle,
  .pb,
  .popup-add,
  .popup-del,
  .popup-commentary,
  .popup-author {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
}
/* Show popups on hover for add/del elements */
.textcrit.add:hover .popup-add,
.textcrit.del:hover .popup-del {
  display: inline-block;
}

/* But hide add popups in reading mode */
body.mode-reading .textcrit.add:hover .popup-add {
  display: none !important;
}
/* About page styling */
.metadata dl,
.manuscript dl,
.publication dl,
.statistics dl,
.technical dl {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.5rem 1rem;
  margin-bottom: 2rem;
}

.metadata dt,
.manuscript dt,
.publication dt,
.statistics dt,
.technical dt {
  font-weight: 600;
  color: var(--text-secondary);
}

.metadata dd,
.manuscript dd,
.publication dd,
.statistics dd,
.technical dd {
  margin: 0;
}

.technical ul {
  list-style: disc;
  padding-left: 1.5rem;
}

.technical li {
  background: none;
  border: none;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

section {
  margin-bottom: 3rem;
}
/* Timeline styling with uniform colors - replace in your style.css */

.timeline {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-medium);
  border: 1px solid var(--border-light);
  margin-bottom: 3rem;
}

.timeline h2 {
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.timeline-container {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
}

/* Vertical line */
.timeline-container::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-blue);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 80px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

/* Timeline dots - all the same blue color */
.timeline-item::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--accent-blue);
  z-index: 1;
}

.timeline-date {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.timeline-content {
  background: var(--bg-primary);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.timeline-content:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-1px);
}

.timeline-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.timeline-title a {
  color: inherit;
  text-decoration: none;
}

.timeline-title a:hover {
  color: var(--accent-blue);
}

.timeline-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.timeline-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Responsive design */
@media (max-width: 768px) {
  .timeline-container::before {
    left: 15px;
  }
  
  .timeline-item {
    padding-left: 50px;
  }
  
  .timeline-item::before {
    left: 7px;
    width: 14px;
    height: 14px;
  }
  
  .timeline-content {
    padding: 0.75rem 1rem;
  }
  
  .timeline-title {
    font-size: 0.9rem;
  }
  
  .timeline-excerpt {
    font-size: 0.8rem;
  }
}