/* Encyclopedia styles — extends memorial.css custom properties */

/* ---------- Header ---------- */

.enc-header {
  background: var(--memorial-surface);
  border-bottom: 1px solid var(--memorial-border);
  padding: 0.75rem 1.5rem;
}

.enc-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.enc-back-link {
  color: var(--memorial-teal-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.enc-back-link:hover { text-decoration: underline; }

.enc-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--memorial-text);
}

/* ---------- Layout ---------- */

.enc-layout {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  min-height: calc(100vh - 200px);
}

.enc-main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 760px;
}

/* ---------- Sidebar ---------- */

.enc-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #e8e4d8;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--memorial-border);
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.enc-sidebar-header {
  font-weight: 600;
  font-size: 0.7rem;
  color: #666;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.enc-sidebar-period {
  margin-bottom: 0.25rem;
}

.enc-sidebar-period-toggle {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.enc-sidebar-period--expanded > .enc-sidebar-period-toggle {
  color: var(--memorial-teal);
  font-weight: 600;
}

.enc-sidebar-years {
  font-weight: 400;
  opacity: 0.7;
}

.enc-sidebar-entries {
  display: none;
  padding-left: 0.75rem;
  border-left: 2px solid var(--memorial-teal);
  margin-left: 0.5rem;
  margin-bottom: 0.5rem;
}

.enc-sidebar-period--expanded .enc-sidebar-entries {
  display: block;
}

.enc-sidebar-entry {
  display: block;
  font-size: 0.78rem;
  color: #666;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  margin-bottom: 0.15rem;
  border-radius: 3px;
}

.enc-sidebar-entry:hover {
  background: rgba(63, 160, 167, 0.1);
}

.enc-sidebar-entry--active {
  background: var(--memorial-teal);
  color: #fff;
  margin-left: -0.4rem;
  padding-left: 0.5rem;
}

/* ---------- Entry content ---------- */

.enc-entry-title {
  font-size: 1.75rem;
  color: var(--memorial-text);
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.enc-entry-meta {
  font-size: 0.9rem;
  color: var(--memorial-text-muted);
  margin: 0 0 1.5rem;
}

/* ---------- Entry images ---------- */

.enc-entry-images {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.enc-entry-image {
  margin: 0;
  max-width: 300px;
}

.enc-entry-image img {
  width: 100%;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--memorial-border);
}

.enc-entry-image figcaption {
  font-size: 0.8rem;
  color: var(--memorial-text-muted);
  margin-top: 0.35rem;
  font-style: italic;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.enc-image-counter {
  font-style: normal;
  white-space: nowrap;
  opacity: 0.7;
}

/* ---------- Entry body ---------- */

.enc-entry-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--memorial-text);
  margin-bottom: 2rem;
}

.enc-entry-body p {
  margin-bottom: 1rem;
  max-width: 65ch;
}

/* ---------- Key details ---------- */

.enc-key-details {
  background: #f0ece2;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.enc-key-details-header {
  font-weight: 600;
  font-size: 0.7rem;
  color: #666;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.enc-key-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
  margin: 0;
}

.enc-key-details-grid dt {
  color: var(--memorial-text-muted);
  font-weight: 400;
}

.enc-key-details-grid dd {
  margin: 0;
  color: var(--memorial-text);
}

/* ---------- Sources ---------- */

.enc-sources {
  margin-bottom: 2rem;
}

.enc-sources-header {
  font-weight: 600;
  font-size: 0.7rem;
  color: #666;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.enc-sources-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.enc-source-card {
  display: block;
  background: var(--memorial-surface);
  border: 1px solid var(--memorial-border);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: inherit;
}

a.enc-source-card:hover {
  border-color: var(--memorial-teal);
  cursor: pointer;
}

.enc-source-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--memorial-text);
}

.enc-source-date {
  font-size: 0.8rem;
  color: var(--memorial-text-muted);
}

/* ---------- Entry navigation ---------- */

.enc-entry-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--memorial-border);
  padding-top: 1.25rem;
  margin-top: 1rem;
}

.enc-nav-prev,
.enc-nav-next {
  color: var(--memorial-teal-dark);
  text-decoration: none;
  font-size: 0.9rem;
}

.enc-nav-prev:hover,
.enc-nav-next:hover {
  text-decoration: underline;
}

.enc-nav-spacer {
  flex: 1;
}

/* ---------- Landing page ---------- */

.enc-landing-intro {
  max-width: 65ch;
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.enc-landing-periods {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.enc-landing-period {
  background: var(--memorial-surface);
  border: 1px solid var(--memorial-border);
  border-left: 3px solid var(--memorial-teal);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--memorial-text);
  display: block;
}

.enc-landing-period:hover {
  border-color: var(--memorial-teal);
}

.enc-landing-period-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.enc-landing-period-years {
  color: var(--memorial-text-muted);
  font-size: 0.85rem;
}

.enc-landing-period-count {
  color: var(--memorial-text-muted);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .enc-layout {
    flex-direction: column;
  }

  .enc-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--memorial-border);
    padding: 1rem;
  }

  .enc-main {
    padding: 1.5rem 1rem;
    max-width: 100%;
  }

  .enc-entry-images {
    flex-direction: column;
  }

  .enc-entry-image {
    max-width: 100%;
  }

  .enc-key-details-grid {
    grid-template-columns: 1fr;
  }
}
