/* Museum-grade Chronological Timeline view (replaces the Guide placeholder). */
#screen > .library-screen.codex-timeline-screen {
  display: block;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px clamp(20px, 4vw, 56px) 64px;
  color: var(--ink, #f3f5f4);
  scrollbar-gutter: stable;
}

.ct-wrap {
  max-width: 1380px;
  margin: 0 auto;
}

/* Header */
.ct-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 32px;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(243, 245, 244, 0.16);
}

.ct-kicker {
  font-family: Interface, sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #99b9bb;
  margin: 0 0 8px;
}

.ct-title {
  font-family: Display, Reading, Georgia, serif;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.06;
  margin: 0;
  color: var(--white, #f6f6f1);
}

.ct-sub {
  font-family: Reading, Georgia, serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted, #b6c0c5);
  margin: 10px 0 0;
  max-width: 72ch;
}

.ct-head-stats {
  display: flex;
  gap: 24px;
  align-items: baseline;
  flex-wrap: wrap;
}

.ct-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ct-stat-val {
  font-family: Display, Reading, serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--white, #f6f6f1);
}

.ct-stat-lbl {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #b6c0c5);
}

/* Era selector strip */
.ct-eras {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.ct-era-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(32, 34, 36, 0.72);
  border: 1px solid rgba(243, 245, 244, 0.14);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.ct-era-btn:hover {
  border-color: rgba(153, 185, 187, 0.55);
  background: rgba(40, 44, 47, 0.9);
}

.ct-era-btn[aria-pressed="true"] {
  border-color: #99b9bb;
  background: rgba(153, 185, 187, 0.14);
  box-shadow: inset 0 2px 0 #99b9bb;
}

.ct-era-span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #99b9bb;
}

.ct-era-name {
  font-family: Display, Reading, serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--white, #f6f6f1);
  line-height: 1.2;
}

.ct-era-count {
  font-size: 12px;
  color: var(--muted, #b6c0c5);
  margin-top: 2px;
}

/* Interactive Half-Century Density Histogram */
.ct-chart-panel {
  margin-top: 18px;
  padding: 18px 20px 14px;
  background: rgba(24, 26, 28, 0.86);
  border: 1px solid rgba(243, 245, 244, 0.14);
}

.ct-chart-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ct-chart-heading {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted, #b6c0c5);
}

.ct-chart-note {
  font-size: 12px;
  color: rgba(182, 192, 197, 0.78);
}

.ct-bars {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  height: 132px;
  padding-top: 22px;
  border-bottom: 1px solid rgba(243, 245, 244, 0.22);
}

.ct-bar-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.ct-bar-num {
  font-size: 11px;
  color: var(--muted, #b6c0c5);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  transition: color 140ms ease;
}

.ct-bar-fill {
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, rgba(153, 185, 187, 0.72) 0%, rgba(153, 185, 187, 0.26) 100%);
  border-top: 2px solid #99b9bb;
  transition: background 140ms ease, opacity 140ms ease;
}

.ct-bar-btn:hover .ct-bar-fill {
  background: linear-gradient(180deg, rgba(214, 196, 152, 0.85) 0%, rgba(153, 185, 187, 0.42) 100%);
  border-top-color: #e4d4ad;
}

.ct-bar-btn:hover .ct-bar-num {
  color: var(--white, #f6f6f1);
}

.ct-bar-btn[aria-pressed="true"] .ct-bar-fill {
  background: linear-gradient(180deg, #d8c393 0%, rgba(216, 195, 147, 0.35) 100%);
  border-top-color: #f3e6c6;
}

.ct-bar-btn[aria-pressed="true"] .ct-bar-num {
  color: #f3e6c6;
  font-weight: 700;
}

.ct-bar-btn.is-dimmed .ct-bar-fill {
  opacity: 0.28;
}

.ct-axis {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.ct-axis-lbl {
  font-size: 11px;
  text-align: center;
  color: var(--muted, #b6c0c5);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Era Context + Key Benchmarks Band */
.ct-context {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 24px;
  margin-top: 18px;
  padding: 18px 20px;
  background: rgba(32, 34, 36, 0.54);
  border: 1px solid rgba(243, 245, 244, 0.12);
}

.ct-context-title {
  font-family: Display, Reading, serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--white, #f6f6f1);
}

.ct-context-desc {
  font-family: Reading, Georgia, serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted, #b6c0c5);
  margin: 0 0 12px;
}

.ct-provinces {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ct-prov-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 5px 10px;
  background: rgba(17, 19, 20, 0.78);
  border: 1px solid color-mix(in srgb, var(--ct-loc-color, #99b9bb) 42%, rgba(243, 245, 244, 0.16));
  color: var(--ink, #f3f5f4);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.ct-prov-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ct-loc-color, #99b9bb);
  flex: 0 0 auto;
}

.ct-prov-chip:hover {
  border-color: var(--ct-loc-color, #99b9bb);
  background: color-mix(in srgb, var(--ct-loc-color, #99b9bb) 16%, rgba(17, 19, 20, 0.85));
}

.ct-prov-chip[aria-pressed="true"] {
  border-color: var(--ct-loc-color, #99b9bb);
  background: color-mix(in srgb, var(--ct-loc-color, #99b9bb) 28%, rgba(17, 19, 20, 0.9));
  color: #ffffff;
}

.ct-prov-cnt {
  color: var(--muted, #b6c0c5);
  font-variant-numeric: tabular-nums;
}

.ct-bench-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #99b9bb;
  margin: 0 0 10px;
}

.ct-bench-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ct-bench-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  text-decoration: none;
  background: rgba(17, 19, 20, 0.78);
  border: 1px solid rgba(243, 245, 244, 0.13);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.ct-bench-card:hover {
  border-color: #d8c393;
  background: rgba(28, 31, 34, 0.96);
}

.ct-bench-thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  background: #0d0f10;
  display: block;
}

.ct-bench-meta {
  min-width: 0;
}

.ct-bench-date {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #d8c393;
  font-variant-numeric: tabular-nums;
}

.ct-bench-title {
  font-family: Reading, Georgia, serif;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--white, #f6f6f1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

.ct-bench-place {
  font-size: 11px;
  color: var(--muted, #b6c0c5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Filter toolbar */
.ct-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 12px 0;
  border-top: 1px solid rgba(243, 245, 244, 0.12);
  border-bottom: 1px solid rgba(243, 245, 244, 0.12);
}

.ct-toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ct-pill {
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  background: rgba(32, 34, 36, 0.7);
  border: 1px solid rgba(243, 245, 244, 0.18);
  color: var(--muted, #b6c0c5);
  cursor: pointer;
}

.ct-pill:hover {
  border-color: rgba(153, 185, 187, 0.6);
  color: var(--white, #f6f6f1);
}

.ct-pill[aria-pressed="true"] {
  border-color: #99b9bb;
  background: rgba(153, 185, 187, 0.2);
  color: var(--white, #f6f6f1);
}

.ct-right-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ct-search {
  width: 240px;
  max-width: 100%;
  padding: 7px 11px;
  font-size: 13px;
  background: rgba(17, 19, 20, 0.85);
  border: 1px solid rgba(243, 245, 244, 0.2);
  color: var(--ink, #f3f5f4);
}

.ct-search:focus {
  outline: none;
  border-color: #99b9bb;
}

.ct-sort {
  padding: 7px 10px;
  font-size: 13px;
  background: rgba(17, 19, 20, 0.85);
  border: 1px solid rgba(243, 245, 244, 0.2);
  color: var(--ink, #f3f5f4);
}

.ct-showing {
  font-size: 12px;
  color: var(--muted, #b6c0c5);
  margin: 14px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ct-clear-btn {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(216, 195, 147, 0.45);
  color: #d8c393;
  cursor: pointer;
}

.ct-clear-btn:hover {
  background: rgba(216, 195, 147, 0.14);
}

/* Artifact Grid */
.ct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.ct-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: rgba(26, 28, 30, 0.9);
  border: 1px solid rgba(243, 245, 244, 0.13);
  transition: border-color 140ms ease, transform 140ms ease, background-color 140ms ease;
  overflow: hidden;
}

.ct-card:hover {
  border-color: #99b9bb;
  background: rgba(34, 37, 40, 0.96);
  transform: translateY(-1px);
}

.ct-card-media {
  position: relative;
  height: 168px;
  background: #0d0f10;
  overflow: hidden;
  border-bottom: 1px solid rgba(243, 245, 244, 0.08);
}

.ct-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ct-card-noimg {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 20% 20%, rgba(153, 185, 187, 0.08), rgba(13, 15, 16, 0.96));
}

.ct-card-noimg-type {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #99b9bb;
  margin-bottom: 6px;
}

.ct-card-noimg-title {
  font-family: Reading, Georgia, serif;
  font-size: 15px;
  line-height: 1.35;
  color: rgba(243, 245, 244, 0.78);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ct-date-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  background: rgba(11, 13, 14, 0.86);
  border: 1px solid rgba(216, 195, 147, 0.55);
  color: #e8d8b2;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.ct-mc-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 7px;
  background: rgba(11, 13, 14, 0.84);
  border: 1px solid rgba(243, 245, 244, 0.22);
  color: var(--ink, #f3f5f4);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.ct-card-body {
  padding: 13px 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.ct-card-title {
  font-family: Display, Reading, serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--white, #f6f6f1);
  margin: 0;
}

.ct-card-place {
  font-size: 12px;
  color: #99b9bb;
  line-height: 1.35;
}

.ct-card-datenote {
  font-family: Reading, Georgia, serif;
  font-size: 13px;
  line-height: 1.42;
  color: var(--muted, #b6c0c5);
  margin-top: auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ct-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.ct-more-btn {
  padding: 11px 28px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(32, 34, 36, 0.85);
  border: 1px solid rgba(153, 185, 187, 0.55);
  color: var(--white, #f6f6f1);
  cursor: pointer;
}

.ct-more-btn:hover {
  background: rgba(153, 185, 187, 0.2);
}

.ct-empty {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed rgba(243, 245, 244, 0.2);
  color: var(--muted, #b6c0c5);
  font-family: Reading, Georgia, serif;
  font-size: 16px;
}

@media (max-width: 1080px) {
  .ct-eras {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ct-context {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ct-head {
    grid-template-columns: 1fr;
  }
  .ct-head-stats {
    justify-content: flex-start;
  }
  .ct-stat {
    align-items: flex-start;
  }
  .ct-eras {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ct-bench-grid {
    grid-template-columns: 1fr;
  }
  .ct-axis-lbl {
    font-size: 9.5px;
  }
}
