/* === devere timeline dashboard === */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --paper: oklch(97% 0.012 85);
  --paper-2: oklch(94% 0.018 85);
  --paper-3: oklch(91% 0.022 82);
  --rule: oklch(82% 0.025 80);
  --ink: oklch(22% 0.015 60);
  --ink-2: oklch(38% 0.02 65);
  --ink-3: oklch(55% 0.018 70);
  --oxblood: oklch(45% 0.11 25);
  --oxblood-soft: oklch(58% 0.09 25);
  --oxblood-tint: oklch(92% 0.03 25);
  --indigo: oklch(42% 0.09 255);
  --indigo-soft: oklch(55% 0.08 255);
  --indigo-tint: oklch(92% 0.025 255);
  --gold: oklch(68% 0.13 75);
  --gold-deep: oklch(55% 0.13 70);
  --gold-tint: oklch(92% 0.05 80);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 19px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(ellipse at 20% 10%, oklch(94% 0.025 80) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 90%, oklch(94% 0.02 60) 0%, transparent 60%);
  min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* === HEADER === */
.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 28px 40px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
}

.mast-l { display: flex; flex-direction: column; gap: 4px; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow .sep { display: inline-block; margin: 0 8px; opacity: 0.5; }

.title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.masthead-portrait {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px var(--gold-deep),
    0 0 0 3px var(--paper-2),
    0 2px 10px oklch(22% 0.015 60 / 0.22);
}

h1.title {
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.05;
  font-style: italic;
  margin: 0;
}
h1.title b { font-style: normal; font-weight: 600; }

.subtitle {
  font-size: 17px;
  color: var(--ink-2);
  margin-top: 8px;
  max-width: 720px;
  font-style: italic;
}

.mast-r {
  display: flex;
  gap: 28px;
  align-items: end;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
}
.stat:first-child { border-left: none; padding-left: 0; }

.stat-num {
  font-family: 'EB Garamond', serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}
.stat-num.match { color: var(--gold-deep); }
.stat-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* === LAYOUT === */
.shell {
  display: grid;
  grid-template-columns: 270px 1fr 400px;
  height: calc(100vh - var(--mast-h, 172px) - var(--foot-h, 44px));
  min-height: 500px;
}

/* === SIDEBAR FILTERS === */
.sidebar {
  border-right: 1px solid var(--rule);
  padding: 24px 22px;
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow-y: auto;
}

.filter-group { display: flex; flex-direction: column; gap: 10px; }

.filter-h {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  transition: opacity 0.15s;
}
.filter-row.off { opacity: 0.42; }
.filter-row:hover { opacity: 1; }

.swatch {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--rule);
}
.swatch.life      { background: var(--oxblood); border-color: var(--oxblood); }
.swatch.education { background: var(--paper); border: 1px dashed var(--oxblood); }
.swatch.travel    { background: repeating-linear-gradient(45deg, var(--oxblood) 0 3px, var(--paper-2) 3px 6px); border-color: var(--oxblood); }
.swatch.literary  { background: var(--oxblood-tint); border: 1px solid var(--oxblood); }
.swatch.patronage { background: var(--paper); border: 2px solid var(--oxblood); }
.swatch.history { background: var(--indigo); border-color: var(--indigo); }
.swatch.comedy  { background: var(--paper); border: 1px dashed var(--indigo); }
.swatch.tragedy { background: var(--indigo-tint); border: 1px solid var(--indigo); }
.swatch.poem    { background: repeating-linear-gradient(45deg, var(--indigo) 0 3px, var(--paper-2) 3px 6px); border-color: var(--indigo); }
.swatch.match {
  background: var(--gold);
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px var(--gold-tint);
}

.filter-lbl {
  flex: 1;
  font-size: 16px;
  color: var(--ink);
}
.filter-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.search-box:focus-within { border-color: var(--ink-3); }
.search-box input {
  border: none; outline: none; background: transparent;
  font-family: 'EB Garamond', serif;
  font-size: 16.5px;
  color: var(--ink);
  width: 100%;
  font-style: italic;
}
.search-box input::placeholder { color: var(--ink-3); }

.year-range { display: flex; flex-direction: column; gap: 8px; }
.year-vals {
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-2);
}
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--rule);
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--ink);
  border-radius: 50%;
  cursor: pointer;
}

/* === Filter status & reset === */
.filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  margin-bottom: -8px;
}
.filter-status .fs-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px;
  color: var(--ink-2);
  font-style: italic;
}
.fs-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rule);
  flex-shrink: 0;
}
.fs-dot.on {
  background: var(--oxblood);
  box-shadow: 0 0 0 2px oklch(45% 0.11 25 / 0.15);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px oklch(45% 0.11 25 / 0.15); }
  50%      { box-shadow: 0 0 0 4px oklch(45% 0.11 25 / 0.05); }
}
.reset-btn {
  background: transparent;
  border: 1px solid var(--ink-2);
  color: var(--ink);
  padding: 5px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.reset-btn:hover { background: var(--ink); color: var(--paper); }
.reset-btn.disabled {
  border-color: var(--rule);
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: 0.55;
}
.reset-btn.disabled:hover { background: transparent; color: var(--ink-3); }

.active-pip {
  display: inline-block;
  margin-left: 6px;
  color: var(--oxblood);
  font-size: 7px;
  vertical-align: middle;
}

.legend-note {
  font-size: 14px;
  color: var(--ink-3);
  font-style: italic;
  line-height: 1.45;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}

/* === TIMELINE CENTRAL === */
.timeline-wrap {
  position: relative;
  padding: 28px 32px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.tl-title {
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}

.tl-title b { color: var(--ink); font-weight: 600; }

.tl-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.tl-toggle button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  border-right: 1px solid var(--rule);
}
.tl-toggle button:last-child { border-right: none; }
.tl-toggle button.on { background: var(--ink); color: var(--paper); }

/* === Timeline canvas === */
.timeline-canvas {
  position: relative;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
}

.lane {
  position: relative;
  padding: 20px 0;
}

.lane-head {
  position: sticky; top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  background: linear-gradient(180deg, var(--paper) 70%, transparent);
  z-index: 5;
}
.lane.left .lane-head { justify-content: flex-end; padding-right: 18px; }
.lane.right .lane-head { justify-content: flex-start; padding-left: 18px; }

.lane-title {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.lane-title b { font-style: normal; font-weight: 600; }

.lane-rule {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--rule);
}
.lane.left .lane-rule { right: 0; }
.lane.right .lane-rule { left: 0; }

.lane.left .lane-title::before {
  content: "";
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--oxblood) url('paintings/de-vere-cameo.jpg') center / cover no-repeat;
  margin-right: 10px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px var(--oxblood), 0 0 0 2px var(--paper-2);
}
.lane.right .lane-title::after {
  content: ""; display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--indigo);
  margin-left: 8px;
  vertical-align: middle;
}

/* Center year axis */
.axis {
  position: relative;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  background: var(--paper-2);
}

.axis-tick {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.axis-tick .yr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-3);
  background: var(--paper-2);
  padding: 2px 6px;
  letter-spacing: 0.05em;
}
.axis-tick.major .yr { color: var(--ink); font-weight: 500; font-size: 14px; }
.axis-tick::before, .axis-tick::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  opacity: 0.4;
}
.axis-tick.major::before, .axis-tick.major::after { opacity: 0.7; }

/* Event cards */
.evt {
  position: absolute;
  width: calc(100% - 24px);
  padding: 10px 13px 11px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 15px;
  line-height: 1.35;
}
.lane.left .evt { right: 18px; text-align: right; }
.lane.right .evt { left: 18px; }

.evt:hover {
  background: var(--paper);
  border-color: var(--ink-2);
  transform: translateX(0);
  z-index: 10;
  box-shadow: 0 4px 18px -8px oklch(22% 0.015 60 / 0.25);
}
.lane.left .evt:hover { transform: translateX(-2px); }
.lane.right .evt:hover { transform: translateX(2px); }

.evt.selected {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  z-index: 11;
}
.evt.dimmed { opacity: 0.18; filter: saturate(0.4); }
.evt.hidden { display: none; }

/* Focused state — gold halo for events in the currently-selected match */
.evt.focused {
  border-color: var(--gold-deep) !important;
  background: var(--gold-tint) !important;
  box-shadow: 0 0 0 2px var(--gold-deep), 0 6px 24px -6px oklch(55% 0.13 70 / 0.4);
  z-index: 12;
  transform: none !important;
}
.lane.left  .evt.focused { transform: translateX(-3px) !important; }
.lane.right .evt.focused { transform: translateX( 3px) !important; }
.evt.focused .evt-yr,
.evt.focused .evt-cat { color: var(--gold-deep); }

.evt-yr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 3px;
}

.evt-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.evt-cat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 5px;
}

/* category coloring */
.evt[data-cat="life"]      { border-left: 3px solid var(--oxblood); }
.evt[data-cat="education"] { border-left: 3px dashed var(--oxblood); }
.evt[data-cat="travel"]    { border-left: 3px double var(--oxblood); }
.evt[data-cat="literary"]  { border-left: 3px solid var(--oxblood); background: var(--oxblood-tint); }
.evt[data-cat="patronage"] { border-left: 3px solid var(--oxblood-soft); }

.evt[data-cat="history"]   { border-right: 3px solid var(--indigo); }
.evt[data-cat="comedy"]    { border-right: 3px dashed var(--indigo); }
.evt[data-cat="tragedy"]   { border-right: 3px solid var(--indigo); background: var(--indigo-tint); }
.evt[data-cat="poem"]      { border-right: 3px double var(--indigo); }

.lane.left .evt  { border-left-width: 3px; }
.lane.right .evt { border-right-width: 3px; }

/* match marker */
.evt.match::before {
  content: "✦";
  position: absolute;
  top: 8px;
  color: var(--gold-deep);
  font-size: 12px;
}
.lane.left .evt.match::before  { right: -10px; }
.lane.right .evt.match::before { left: -10px; }

.evt.match {
  border-color: var(--gold-deep);
  background: var(--gold-tint);
}

/* match connector lines (SVG overlay) */
.match-svg {
  position: absolute;
  top: 0;
  left: -18px;                /* extends 18px into each lane to reach card edges */
  width: calc(100% + 36px);
  height: 100%;               /* MUST be explicit — `bottom: 0` does not work on SVG */
  pointer-events: none;
  z-index: 2;
}
.match-svg line {
  stroke: var(--gold-deep);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.4;
  transition: opacity 0.2s, stroke-width 0.2s;
}
.match-svg line.dim {
  opacity: 0.08;
  stroke-dasharray: 2 4;
}
.match-svg line.active {
  stroke-width: 2;
  opacity: 1;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 6px oklch(68% 0.13 75 / 0.5));
}

/* === DETAIL PANEL === */
.detail {
  border-left: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 28px 28px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100%;
}

.detail-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.detail-h {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.15;
  font-family: 'EB Garamond', serif;
}

.detail-yr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--ink-2);
}

.detail-body {
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}
.detail-body em { color: var(--ink); }

.detail-tag {
  display: inline-block;
  padding: 4px 9px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-right: 6px;
}
.detail-tag.match { background: var(--gold-tint); border-color: var(--gold-deep); color: var(--gold-deep); }

.match-card {
  background: var(--paper);
  border: 1px solid var(--gold-deep);
  border-left: 4px solid var(--gold-deep);
  padding: 14px 16px;
  border-radius: 2px;
}
.match-card .mc-h {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.match-card .mc-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 6px;
}
.match-card .mc-body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}
.match-card .mc-refs {
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.match-card .mc-refs span {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
}
.match-card .mc-refs .vere { color: var(--oxblood); border-color: var(--oxblood); }
.match-card .mc-refs .canon { color: var(--indigo); border-color: var(--indigo); }

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--ink-3);
}
.empty-state .ornament {
  font-size: 22px;
  color: var(--gold-deep);
  margin-bottom: 12px;
  letter-spacing: 0.4em;
}
.empty-state h3 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-style: italic;
}
.empty-state p {
  font-size: 15.5px;
  line-height: 1.55;
  font-style: italic;
}

/* match button list in detail */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-pill {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
}
.match-pill:hover { border-color: var(--gold-deep); background: var(--gold-tint); }
.match-pill.active { border-color: var(--gold-deep); background: var(--gold-tint); }
.match-pill .star { color: var(--gold-deep); font-size: 13px; }
.match-pill .mp-title { flex: 1; font-size: 16px; }
.match-pill .mp-yrs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* footer */
.footer {
  border-top: 1px solid var(--rule);
  padding: 14px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper-2);
}
.footer .seal { color: var(--gold-deep); letter-spacing: 0.4em; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--rule); border: 2px solid var(--paper-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* === GALLERY TRIGGER (masthead) === */
.gallery-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 16px 10px 18px;
  margin-left: 4px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.gallery-btn:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -8px oklch(22% 0.015 60 / 0.4);
}
.gallery-btn:hover .gb-mark { color: var(--gold); }
.gallery-btn:hover .gb-sub { color: oklch(80% 0.012 80); }

.gb-mark {
  position: absolute;
  top: 8px; right: 10px;
  color: var(--gold-deep);
  font-size: 13px;
  transition: color 0.15s;
}
.gb-lbl {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.005em;
  font-style: italic;
  padding-right: 18px;
}
.gb-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.15s;
}

/* === GALLERY OVERLAY === */
.gallery-overlay {
  position: fixed;
  inset: 0;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 15% 8%, oklch(94% 0.03 80) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 95%, oklch(94% 0.022 60) 0%, transparent 60%);
  z-index: 1000;
  overflow-y: auto;
  animation: galleryFade 0.32s ease both;
}
@keyframes galleryFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gallery-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 40px 40px;
}

.gallery-head {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper) 78%, transparent 100%);
  padding: 24px 0 18px;
  z-index: 2;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.gh-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.gh-artist { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-left: 18px; }
.gh-name {
  font-family: 'EB Garamond', serif;
  font-size: 36px;
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.gh-email {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: var(--ink-3);
  text-decoration: none;
  letter-spacing: 0.05em;
  border-bottom: 1px dotted var(--ink-3);
  padding-bottom: 1px;
}
.gh-email:hover { color: var(--ink); border-bottom-color: var(--ink); }

.gallery-close {
  background: transparent;
  border: 1px solid var(--ink-2);
  color: var(--ink);
  padding: 7px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.gallery-close:hover { background: var(--ink); color: var(--paper); }

.gh-donations {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 1100px;
  padding: 10px 14px;
  background: var(--gold-tint);
  border-left: 3px solid var(--gold-deep);
  border-radius: 1px;
  margin-bottom: 12px;
}
.gh-donations b { color: var(--ink); font-weight: 600; }
.gh-society {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--gold-deep);
  padding-bottom: 1px;
  transition: all 0.15s;
}
.gh-society:hover { color: var(--gold-deep); border-bottom-width: 2px; }
.gh-society-email {
  color: var(--gold-deep);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14.5px;
  letter-spacing: 0.05em;
  border-bottom: 1px dotted var(--gold-deep);
}
.gh-society-email:hover { color: var(--ink); border-bottom-color: var(--ink); }

.gh-subtitle {
  font-size: 21px;
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  letter-spacing: 0.005em;
  margin-left: 18px;
}
.gh-subtitle em { color: var(--oxblood); font-weight: 600; }

/* Compact gallery header on phone — keeps the plates above the fold */
@media (max-width: 640px) {
  .gallery-inner { padding: 0 16px 24px; }

  .gallery-head {
    padding: 14px 0 10px;
    margin-bottom: 14px;
  }
  .gh-top { margin-bottom: 8px; gap: 10px; }
  .gh-artist { margin-left: 0; gap: 10px; }
  .gh-name { font-size: 22px; }
  .gh-email { font-size: 12px; }

  .gallery-close { padding: 5px 9px; font-size: 11px; gap: 0; }
  .gallery-close span { display: none; }

  .gh-donations {
    font-size: 12.5px;
    line-height: 1.4;
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  .gh-society-email { font-size: 11px; }

  .gh-subtitle {
    font-size: 14px;
    margin-left: 0;
    line-height: 1.35;
  }

  .gallery-foot { padding: 10px 0; font-size: 10px; }
}

/* === PLATES GRID === */
.plates-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px 22px;
  margin-bottom: 32px;
}
@media (max-width: 1100px) { .plates-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .plates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .plates-grid { grid-template-columns: 1fr; } }

.plate {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  transition: transform 0.18s ease;
}
.plate:hover { transform: translateY(-2px); }

.plate-frame {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 1px 3px oklch(22% 0.015 60 / 0.04);
  transition: all 0.18s ease;
}
.plate:hover .plate-frame {
  border-color: var(--ink);
  box-shadow: 0 8px 24px -10px oklch(22% 0.015 60 / 0.32);
}

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

.plate-num {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  opacity: 0.92;
}

.plate-caption { padding: 0 2px; }
.pc-title {
  font-size: 18.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 3px;
}
.pc-n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: var(--ink-3);
  font-weight: 500;
  margin-right: 4px;
}
.pc-cite {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.pc-quote {
  font-size: 16.5px;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.4;
}

/* === BIO PANEL (occupies one grid cell, spans on small screens) === */
.bio-panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink);
  padding: 18px 20px 20px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
}
@media (max-width: 540px) { .bio-panel { grid-column: 1 / -1; } }

.bp-h {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
}
.bp-mark { color: var(--gold-deep); font-size: 15px; letter-spacing: 0; }

.bp-body {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-2);
  font-style: italic;
  text-wrap: pretty;
}

/* === GALLERY FOOTER === */
.gallery-foot {
  border-top: 1px solid var(--rule);
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gallery-foot .seal { color: var(--gold-deep); letter-spacing: 0.4em; }

/* === LIGHTBOX === */
.lightbox {
  position: fixed;
  inset: 0;
  background: oklch(15% 0.01 60 / 0.94);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
  animation: lbFade 0.22s ease both;
}
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }

.lightbox-close {
  position: absolute;
  top: 20px; right: 24px;
  background: transparent;
  border: 1px solid oklch(70% 0.015 80);
  color: oklch(92% 0.012 80);
  width: 40px; height: 40px;
  font-size: 17px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 1;
}
.lightbox-close:hover {
  background: oklch(92% 0.012 80);
  color: oklch(15% 0.01 60);
}

/* Prev/next: hidden by default, fade in on lightbox hover */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: oklch(92% 0.012 80 / 0.08);
  border: 1px solid oklch(70% 0.015 80 / 0.5);
  color: oklch(96% 0.008 80);
  font-family: 'EB Garamond', serif;
  font-size: 38px;
  line-height: 1;
  padding: 0 0 4px;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.lightbox:hover .lightbox-nav,
.lightbox:focus-within .lightbox-nav {
  opacity: 1;
}
.lightbox-nav:hover {
  background: oklch(92% 0.012 80 / 0.95);
  color: oklch(15% 0.01 60);
  border-color: oklch(92% 0.012 80);
}
.lightbox-prev { left: 28px; }
.lightbox-next { right: 28px; }
.lightbox-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(2px); }

@media (max-width: 720px) {
  .lightbox-nav { width: 44px; height: 44px; font-size: 30px; }
  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }
}

/* Touch: there's no hover, so always show nav controls */
@media (hover: none) {
  .lightbox-nav { opacity: 1; }
}

.lightbox-inner {
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: default;
  position: relative;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  background: var(--paper-3);
  border: 1px solid oklch(40% 0.012 60);
  box-shadow: 0 24px 64px -16px oklch(0% 0 0 / 0.6);
  transition: opacity 0.2s ease;
}
.lightbox-img.is-loading { opacity: 0.18; }
.lightbox-img.is-loaded  { opacity: 1; }

.lightbox-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
}
.lb-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid oklch(40% 0.012 60 / 0.45);
  border-top-color: var(--gold-deep);
  animation: lbSpin 0.7s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }

.lightbox-caption {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold-deep);
  padding: 12px 18px;
  border-radius: 2px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 8px 18px;
  align-items: baseline;
}
@media (max-width: 720px) {
  .lightbox-caption { grid-template-columns: 1fr; gap: 4px; }
}

.lc-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.lc-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
}
.lc-cite {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.lc-quote {
  grid-column: 1 / -1;
  font-size: 18px;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: 2px;
}

/* Compact masthead button at narrow widths */
@media (max-width: 900px) {
  .gallery-btn .gb-sub { display: none; }
}

/* === CONCORDANCE VIEW (themed rows) ============================ */
.concord-view {
  padding: 8px 4px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.concord-intro {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 18px;
  background: var(--paper-2);
  border-left: 3px solid var(--gold-deep);
  font-style: italic;
  font-size: 16.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.ci-mark {
  font-style: normal;
  color: var(--gold-deep);
  font-size: 18px;
  flex-shrink: 0;
}

.ci-portrait {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 0 3px var(--paper-2), 0 2px 6px oklch(22% 0.015 60 / 0.18);
  align-self: center;
}

.concord-row {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 22px 24px 24px;
  position: relative;
}
.concord-row::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; bottom: -1px;
  width: 4px;
  background: var(--gold-deep);
}

.cr-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.cr-num {
  font-family: 'EB Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--gold-deep);
  letter-spacing: 0.05em;
  font-feature-settings: "lnum";
  flex-shrink: 0;
  width: 28px;
}
.cr-title {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 26px;
  color: var(--ink);
  margin: 0;
  flex: 1;
  line-height: 1.15;
}
.cr-count {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.cr-arrow { color: var(--gold-deep); padding: 0 4px; }

.cr-desc {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 12px 0 18px;
  text-wrap: pretty;
  max-width: 80ch;
  font-style: italic;
}

.cr-body {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 0;
  align-items: stretch;
}

.cr-col-h {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
}
.cr-left  .cr-col-h { text-align: right; }
.cr-right .cr-col-h { text-align: left;  }

.cr-cards { display: flex; flex-direction: column; gap: 8px; }
.cr-left  .cr-cards { align-items: flex-end;   }
.cr-right .cr-cards { align-items: flex-start; }

.cr-empty {
  font-style: italic;
  color: var(--ink-3);
  font-size: 14px;
  padding: 8px 0;
}

.cr-link {
  position: relative;
  color: var(--gold-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 28px;
}
.cr-link svg {
  position: absolute;
  inset: 28px 0 0;
  width: 100%;
  height: calc(100% - 28px);
  opacity: 0.55;
}
.cr-link-mark {
  position: relative;
  background: var(--paper);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 2;
}

.cc-card {
  width: 100%;
  max-width: 340px;
  padding: 9px 13px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.cc-card:hover { border-color: var(--ink-2); background: var(--paper-2); }
.cc-card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.cc-card[data-cat="life"]      { border-left: 3px solid  var(--oxblood); }
.cc-card[data-cat="education"] { border-left: 3px dashed var(--oxblood); }
.cc-card[data-cat="travel"]    { border-left: 3px solid  var(--oxblood-soft); }
.cc-card[data-cat="literary"]  { border-left: 3px solid  var(--oxblood); background: var(--oxblood-tint); }
.cc-card[data-cat="patronage"] { border-left: 3px double var(--oxblood); }
.cc-card[data-cat="history"]   { border-left: 3px solid  var(--indigo); }
.cc-card[data-cat="comedy"]    { border-left: 3px dashed var(--indigo); }
.cc-card[data-cat="tragedy"]   { border-left: 3px solid  var(--indigo); background: var(--indigo-tint); }
.cc-card[data-cat="poem"]      { border-left: 3px solid  var(--indigo); font-style: italic; }
.cc-card[data-cat="romance"]   { border-left: 3px dotted var(--indigo); }

.cc-yr {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.cc-title {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.25;
}
.cc-cat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

/* === RESPONSIVE LAYOUT ============================================
 * Desktop layout above is the canonical 3-column shell; everything
 * below adapts the layout for tablet (641-1023px) and phone (≤640px).
 * On phone we drop the filter sidebar entirely and the detail panel
 * becomes a full-screen overlay; on tablet, sidebar moves to a slide-in
 * drawer triggered by a "Filters" button in the timeline-head row.
 */

/* Filters toggle button — hidden on desktop, visible on tablet only.
 * Phone (≤640px) hides the button via a separate rule below. */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--ink-2);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  margin-right: 12px;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--ink); color: var(--paper); }
.sidebar-toggle .stb-pip {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--oxblood);
  margin-left: 8px;
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}

/* Tablet + phone shared layout: collapse 3-col shell, sidebar→drawer, detail→overlay */
@media (max-width: 1023px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - var(--mast-h, 172px) - var(--foot-h, 44px));
  }

  .sidebar {
    position: fixed;
    top: var(--mast-h, 172px);
    bottom: var(--foot-h, 44px);
    left: 0;
    width: 280px;
    max-width: 88vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 20px -8px oklch(22% 0.015 60 / 0.25);
    border-right: 1px solid var(--rule);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(15% 0.01 60 / 0.32);
    z-index: 49;
    animation: fadeIn 0.22s ease both;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .detail {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    border-left: none;
    z-index: 60;
    height: 100%;
    animation: galleryFade 0.28s ease both;
  }
  .detail:not(.detail-active) { display: none; }
}

/* Tablet only — show the Filters button */
@media (min-width: 641px) and (max-width: 1023px) {
  .sidebar-toggle { display: inline-flex; }

  .masthead { padding: 22px 24px 16px; }
  .mast-r { gap: 14px; }
  .stat { padding-left: 12px; }
  .stat-num { font-size: 28px; }
  .stat-lbl { font-size: 9.5px; }
  .gallery-btn { padding: 8px 14px; }

  .timeline-wrap { padding: 22px 24px; }
  .timeline-canvas { grid-template-columns: 1fr 64px 1fr; }
  .lane.left .evt  { right: 14px; }
  .lane.right .evt { left: 14px; }

  .cr-body { grid-template-columns: 1fr 48px 1fr; }
}

/* Phone (≤640px) — chronology only, no filter access, masthead trimmed */
@media (max-width: 640px) {
  .masthead {
    padding: 18px 18px 14px;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .mast-r {
    gap: 12px;
    justify-content: flex-end;
  }
  .mast-r .stat { display: none; }   /* per directive: drop the 3 counters on phone */

  .gallery-btn { padding: 8px 12px; }

  .eyebrow { font-size: 10px; letter-spacing: 0.14em; }
  .eyebrow .sep { margin: 0 6px; }

  .title-row { gap: 12px; }
  .masthead-portrait { width: 44px; height: 44px; }
  h1.title { font-size: 28px; line-height: 1.1; }
  .subtitle { font-size: 14px; max-width: 100%; }

  /* No filter access on phone — hide both sidebar and toggle button */
  .sidebar, .sidebar-backdrop, .sidebar-toggle { display: none !important; }

  .timeline-wrap { padding: 16px 12px; }
  .timeline-head { flex-wrap: wrap; gap: 8px; }
  .tl-title { font-size: 13px; }
  .tl-toggle button { padding: 6px 10px; font-size: 11px; }

  .timeline-canvas { grid-template-columns: 1fr 56px 1fr; }
  .lane.left  .evt { right: 10px; }
  .lane.right .evt { left: 10px; }
  .evt { padding: 9px 11px 10px; font-size: 13px; }
  .evt-title { font-size: 14px; }
  .evt-yr   { font-size: 10.5px; }
  .evt-cat  { font-size: 9.5px; }

  /* Concord rows: stack body so de Vere → medallion → canon flows vertically */
  .cr-body { grid-template-columns: 1fr; gap: 12px; }
  .cr-link { padding: 0; height: 32px; }
  .cr-link svg { display: none; }
  .cr-left  .cr-cards,
  .cr-right .cr-cards { align-items: stretch; }
  .cc-card { max-width: 100%; }

  .cr-head { flex-wrap: wrap; }
  .cr-title { font-size: 22px; }
  .cr-desc { font-size: 15px; }

  .footer { padding: 12px 16px; font-size: 10px; }
  .footer .seal { letter-spacing: 0.3em; }
}

/* Touch devices — disable hover transforms that confuse tap interactions */
@media (hover: none) {
  .evt:hover { transform: none; box-shadow: none; }
  .lane.left  .evt:hover,
  .lane.right .evt:hover { transform: none; }
  .plate:hover { transform: none; }
  .plate:hover .plate-frame {
    border-color: var(--rule);
    box-shadow: 0 1px 3px oklch(22% 0.015 60 / 0.04);
  }
  .cc-card:hover { background: var(--paper); border-color: var(--rule); }
}
