:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e8eef5;
  --muted: #8b9aab;
  --accent: #3d8fd1;
  --accent-hover: #5aa8e6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--panel);
  border-radius: 6px;
}

header {
  background: var(--panel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.25rem 1.5rem;
  flex-shrink: 0;
}

header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 600;
}

header .subtitle {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 500;
  color: #c5d4e3;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.meta-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.65rem;
}

.meta-tools span {
  cursor: default;
}

.meta-tools span:not(:last-child)::after {
  content: " ·";
  color: var(--muted);
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-tabs a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.profile-tabs a:hover {
  color: var(--accent-hover);
}

.header-lead {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  text-decoration: none;
}

/* Scrollable archives body — same role as former doc-index strip */
.archives-scroll {
  background: var(--panel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.5rem 1.25rem;
  max-height: min(42vh, 28rem);
  overflow-y: auto;
  flex-shrink: 0;
}

.archives-scroll section {
  margin-bottom: 1.75rem;
  scroll-margin-top: 0.5rem;
}

.archives-scroll section:last-child {
  margin-bottom: 0;
}

.archives-scroll h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #c5d4e3;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.archives-scroll h3 {
  margin: 1rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #d0dce8;
}

.archives-scroll p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.archives-scroll p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.ref-pending {
  color: var(--accent);
}

dl.membership {
  margin: 0.35rem 0 0.75rem;
}

dl.membership dt {
  float: left;
  clear: left;
  width: 4.5rem;
  margin: 0;
  padding: 0.15rem 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

dl.membership dd {
  margin: 0 0 0 5rem;
  padding: 0.15rem 0;
  font-size: 0.9rem;
}

.loans-list,
.event-list,
.report-list,
.newsletter-list {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.loans-list li {
  padding: 0.2rem 0;
  font-size: 0.9rem;
}

.event-list li,
.report-list li,
.newsletter-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
}

.event-list li:last-child,
.report-list li:last-child,
.newsletter-list li:last-child {
  border-bottom: none;
}

.event-list .title,
.report-list .title {
  display: block;
  margin-bottom: 0.12rem;
  color: var(--text);
}

.event-list time,
.report-list time {
  font-size: 0.82rem;
  color: var(--muted);
}

.newsletter-list .source {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.newsletter-list .headline {
  display: block;
  color: var(--text);
}

.viewer-wrap {
  flex: 1;
  padding: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer-wrap iframe {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 320px;
  border: none;
  background: #111;
}

.fallback {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.fallback a {
  color: var(--accent);
}

@media (max-width: 640px) {
  .archives-scroll {
    max-height: 38vh;
  }

  .viewer-wrap iframe {
    min-height: 280px;
  }

  dl.membership dt {
    float: none;
    width: auto;
  }

  dl.membership dd {
    margin-left: 0;
    margin-bottom: 0.25rem;
  }
}
