:root {
  --paper: #f1eee6; --wash: #e8e3d7; --card: #fbfaf6;
  --ink: #1d1a14; --muted: #685f4d; --line: #d6cfbf; --axis: #8d8470;
  --green: #2448d8; --blue: #b4471f; --orange: #b4471f; --gold: #8a6512;
  --lab-bg: #e2ddd0; --outbreak-bg: #e2ddd0; --award-bg: #e8dfc8; --thai-bg: #e2ddd0; --false: #b3261e; --ethics: #7b3f8f;
  --serif: "Fraunces", "IBM Plex Sans Thai", Georgia, serif;
  --sans: "IBM Plex Sans", "IBM Plex Sans Thai", system-ui, sans-serif;
  --gutter: 20px; --story-w: clamp(300px, 27vw, 400px);
  --radius-control: 999px; --radius-card: 12px; --track-label: .08em;
}
:root[data-theme="dark"] {
  --paper: #12110e; --wash: #1b1915; --card: #1f1d18;
  --ink: #f1ece0; --muted: #b4aa95; --line: #36322a; --axis: #6d6656;
  --green: #8ea4ff; --blue: #ef9a76; --orange: #ef9a76; --gold: #d9bc6e;
  --lab-bg: #24221d; --outbreak-bg: #24221d; --award-bg: #2b2414; --thai-bg: #24221d; --false: #ff8a80; --ethics: #d2a8e3;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--sans); height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; top: -100px; left: 12px; z-index: 100; background: var(--card); padding: 12px; }
.skip:focus { top: 8px; }
.topbar { display: flex; gap: 16px; align-items: center; padding: 8px var(--gutter) 4px; }
.back { text-decoration: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
h1 { font: 800 20px/1.2 var(--serif); letter-spacing: -.01em; margin: 0 auto 0 0; }
h1 small { font: 500 13px/1.4 var(--sans); color: var(--muted); margin-left: 8px; }
.pill, .icon-button { min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 600; line-height: 1.4; }
.icon-button { width: 32px; padding: 0; flex: none; font-size: 18px; display: inline-grid; place-items: center; }
.icon-button svg { width: 16px; height: 16px; }
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }
#filtBtn, #notesBtnPhone, .lead, .era-h { display: none; }
.pill:hover, .icon-button:hover { border-color: var(--axis); }
.tools { padding: 4px var(--gutter) 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px 16px; flex-wrap: wrap; }
.filters, .search-row { display: flex; align-items: center; gap: 6px; }
.filter { white-space: nowrap; color: var(--muted); }
.filter::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.filter[data-filter="outbreak"]::before { background: var(--orange); }
.filter[data-filter="nobel"]::before { background: var(--gold); }
.filter[data-filter="thai"]::before { background: var(--blue); }
.filter[data-filter="context"]::before { background: var(--axis); }
.filter[data-filter="ethics"]::before { background: var(--ethics); }
.filter[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
#search { width: 200px; min-width: 0; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 13px; }
.focusbar { display: flex; gap: 28px; align-items: center; padding: 10px var(--gutter); border-bottom: 1px solid var(--line); background: var(--wash); }
.focus-date { flex: none; min-width: 92px; }
.focus-date span { display: block; text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.focus-date strong { font: 800 30px/1 var(--serif); }
.focusbar p { margin: 0; font-size: 13px; color: var(--muted); }
.focusbar .scale-note { font-size: 12px; }
.timeline-shell { position: relative; flex: 1; min-height: 0; background: var(--wash); }
.timeline { position: absolute; inset: 0 0 0 var(--story-w); display: flex; gap: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 32px calc(50% - var(--story-w) / 2 - 80px); overscroll-behavior-x: contain; }
.timeline::-webkit-scrollbar { display: none; }
.timeline-shell::after { content: ""; position: absolute; top: 50%; left: var(--story-w); right: 0; height: 3px; background: linear-gradient(90deg, var(--green), var(--blue)); opacity: .5; pointer-events: none; }
.column { --lane-color: var(--green); flex: 0 0 176px; display: grid; grid-template-rows: minmax(0, 1fr) 96px minmax(0, 1fr); position: relative; }
.column.thai { --lane-color: var(--blue); }
.column.context { --lane-color: var(--muted); }
.column.ethics { --lane-color: var(--ethics); }
.column:has(.focused) .axis-year::after { background: var(--lane-color); }
.column::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px solid var(--green); opacity: .5; }
.axis-year { grid-row: 2; position: relative; }
.axis-year::after { content: ""; position: absolute; top: calc(50% - 6px); left: 52px; width: 12px; height: 12px; border: 2px solid var(--lane-color); border-radius: 50%; background: var(--paper); z-index: 1; }
.card { display: flex; flex-direction: column; align-items: flex-start; width: 156px; position: relative; padding: 6px 8px; text-decoration: none; border-radius: 10px; color: var(--ink); }
.card:hover, .card.focused { background: color-mix(in srgb, var(--card) 80%, transparent); }
.world .card { grid-row: 1; align-self: end; }
.thai .card { grid-row: 3; align-self: start; }
.card::after { content: ""; position: absolute; left: 58px; height: 48px; border-left: 1px dashed var(--lane-color); opacity: .7; }
.world .card::after { top: 100%; }
.thai .card::after { bottom: 100%; }
.card-body { display: contents; }
.card-title { order: 1; font: 700 14px/1.25 var(--sans); margin: 0; }
.card-date { order: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font: 800 22px/1 var(--serif); color: var(--lane-color); margin: 4px 0; }
.card-date small { font: 600 10px/1.2 var(--sans); color: var(--muted); }
.lane-flag { display: inline-flex; background: var(--lane-color); color: var(--paper); padding: 3px 5px; border-radius: 4px; font: 700 10px/1 var(--sans); letter-spacing: .04em; }
.art { order: 3; position: relative; width: clamp(64px, 11vh, 104px); height: clamp(64px, 11vh, 104px); margin: 6px 0 4px 6px; flex: none; color: var(--lane-color); }
.art::before { content: ""; position: absolute; width: 58%; height: 58%; background: var(--lane-color); border-radius: 50%; top: -6%; right: -14%; }
.art img, .art svg { position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--lab-bg); box-shadow: 0 0 0 4px var(--paper); filter: grayscale(1) contrast(1.05); transition: transform .2s, filter .2s; }
.card.focused .art img, .card.focused .art svg { transform: scale(1.1); filter: none; box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--lane-color); }
.card:hover .art img, .card:hover .art svg { filter: none; }
.thai .art { order: 1; }
.thai .card-title { order: 3; }
.thai .art::before { top: auto; right: auto; bottom: -6%; left: -14%; }
.card-meta, .card-desc, .card-arrow, .crossnote, .nobel-medallion, .lane-labels { display: none; }
#story { position: absolute; inset: 0 auto 0 0; width: var(--story-w); overflow: hidden; display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--line); border-top: 4px solid var(--green); z-index: 3; overscroll-behavior: contain; }
#story[data-lane="thai"] { border-top-color: var(--blue); }
.story-art { flex: none; height: min(36vh, 360px); background: var(--lab-bg); color: var(--green); }
#story[data-lane="thai"] .story-art { color: var(--blue); }
.story-art svg, .story-art img { width: 100%; height: 100%; display: block; object-fit: contain; }
.story-art img { object-fit: cover; }
.story-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px;
  /* Fade the last lines so it is clear the story continues below. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
.story-actions { flex: none; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--card); }
.story-actions .pill { margin: 0; }
.story-body h2 { font: 800 21px/1.2 var(--serif); margin: 6px 0; }
.story-body p { font-size: 14px; margin: 8px 0; }
.story-body .story-meta, .story-body .story-sources, .story-body .story-credit { color: var(--muted); font-size: 12px; }
.story-body .story-native { color: var(--blue); }
.edge { position: absolute; top: calc(50% - 24px); width: 44px; height: 48px; border: 0; font-size: 36px; color: var(--ink); z-index: 2; background: linear-gradient(90deg, var(--wash), transparent); }
.previous { left: var(--story-w); }
/* Drag handle on the story panel's right edge; width is stored as --story-w on .timeline-shell. */
.story-grip { position: absolute; top: 0; bottom: 0; left: calc(var(--story-w) - 6px); width: 12px; cursor: col-resize; z-index: 4; touch-action: none; outline: none; }
.story-grip::before { content: ""; position: absolute; inset: 0 5px; background: var(--green); opacity: 0; transition: opacity .15s; }
.story-grip:hover::before, .story-grip:focus-visible::before, .story-grip.dragging::before { opacity: .55; }
.grip-tab { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 24px; height: 60px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); box-shadow: 0 1px 4px rgb(0 0 0 / .18); transition: color .15s, border-color .15s, width .15s; }
.grip-tab svg { width: 16px; height: 16px; }
.grip-tip { position: absolute; top: 30%; left: 20px; transform: translateY(-50%); padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font: 600 12px/1.2 var(--sans); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.story-grip:hover .grip-tab, .story-grip:focus-visible .grip-tab, .story-grip.dragging .grip-tab { color: var(--green); border-color: var(--green); width: 28px; }
.story-grip:hover .grip-tip, .story-grip:focus-visible .grip-tip { opacity: 1; }
.story-grip.dragging .grip-tip { opacity: 0; }
@keyframes grip-nudge { 0%, 100% { transform: translate(-50%, -50%); } 30% { transform: translate(-20%, -50%); } 60% { transform: translate(-70%, -50%); } }
.story-grip.hint .grip-tab { animation: grip-nudge 1.2s ease-in-out 2; color: var(--green); border-color: var(--green); }
.story-grip.hint .grip-tip { opacity: 1; }
.resizing, .resizing * { cursor: col-resize !important; user-select: none !important; }
.next { right: 0; transform: none; background: linear-gradient(270deg, var(--wash), transparent); }
.eras { height: 64px; flex: none; display: flex; background: var(--wash); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.era { flex: 1 0 0; min-width: 140px; position: relative; height: 64px; border: 0; border-left: 1px solid var(--line); padding: 4px 8px; background: transparent; text-align: left; color: var(--muted); }
.era:hover, .era[aria-current="true"] { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.era-name { display: block; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.era small { display: block; font-size: 10px; margin-top: 27px; }
.mini-events { position: absolute; left: 8px; right: 8px; top: 22px; height: 22px; }
.mini-events i { position: absolute; width: 2px; height: 8px; background: var(--green); top: 0; }
.mini-events i.thai { top: 12px; background: var(--blue); }
.era[aria-current="true"]::after { content: ""; position: absolute; inset: 19px 4px 16px; border: 1px solid var(--axis); border-radius: 4px; pointer-events: none; }
.empty {
  padding: 64px var(--gutter);
  text-align: center;
}
.empty h2 {
  font: 36px/1.2 var(--serif);
  margin: 0;
}
.empty p {
  color: var(--muted);
}
dialog {
  margin: 0 0 0 auto;
  inset: 0;
  width: min(660px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #081e1866;
  backdrop-filter: blur(3px);
}
.dialog-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  z-index: 2;
}
.dialog-bar .eyebrow {
  margin: 0;
}
#detailBody {
  padding: 24px 32px 48px;
}
.detail-art {
  height: 220px;
  border-radius: var(--radius-card);
  background: var(--lab-bg);
  color: var(--green);
  overflow: hidden;
  margin-bottom: 24px;
}
.detail-art svg,
.detail-art img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.detail-date {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px;
}
.detail-title {
  font: 40px/1.1 var(--serif);
  letter-spacing: -0.035em;
  margin: 0 0 24px;
}
.detail-summary {
  font-size: 18px;
  line-height: 1.65;
}
.detail-copy {
  font-size: 16px;
  color: var(--muted);
}
.small-title {
  font-size: 12px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  margin: 32px 0 12px;
}
.evidence,
.related,
.glossary,
.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.evidence li,
.related li,
.glossary li,
.source-list li {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.evidence p,
.source-list p,
.glossary p {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 0;
}
.source-list h3,
.glossary h3 {
  font: 22px/1.2 var(--serif);
  margin: 0;
}
.source-list a {
  font-size: 14px;
}
.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.tag {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 4px 12px;
  font-size: 12px;
}
.related a {
  font: 21px/1.3 var(--serif);
}
.connection {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--green);
  background: var(--wash);
  font-size: 15px;
}
.notes-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.notes-tabs button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.diagram-caption {
  color: var(--muted);
  font-size: 12px;
  margin: -12px 0 24px;
}
.lineage {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  margin: 24px 0;
}
.lineage ol {
  padding-left: 24px;
  margin: 0;
}
.lineage li {
  padding: 8px 0 8px 8px;
}
.lineage b {
  display: block;
}
.lineage span {
  font-size: 14px;
  color: var(--muted);
}
.field-intro {
  font: 22px/1.6 var(--serif);
}
.noscript {
  padding: 24px;
}
.detail-art.nobel { background: var(--award-bg); color: var(--gold); }
.detail-art.context, .story-art.context { background: var(--lab-bg); color: var(--muted); }
.detail-art.outbreak { background: var(--outbreak-bg); color: var(--orange); }
[id^="term-"], [id^="ref-"] { scroll-margin-top: 96px; }
.reading { height: auto; }
.reading main { display: flex; }
.reading #story, .reading .story-grip, .reading .edge, .reading .timeline-shell::after { display: none; }
.reading .timeline-shell { flex: auto; }
.reading .timeline { position: static; display: block; padding: 20px; max-width: 1000px; margin: auto; overflow: visible; }
.reading .column { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto; gap: 32px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.reading .column::before, .reading .card::after, .reading .axis-year { display: none; }
.reading .column .card { grid-row: 1; grid-column: 1; align-self: start; width: 100%; }
.reading .column.thai .card { grid-column: 2; }
.reading .card-title { font-size: 20px; }
.reading .card-desc { display: block; order: 4; font-size: 14px; }
.reading .eras { order: -1; position: sticky; top: 0; z-index: 4; }
@media (max-width: 1100px) { h1 small { display: none; } }
/* Short desktop windows: tighten the two lanes so cards stay inside the timeline instead of running under the era bar. */
@media (min-width: 761px) and (max-height: 860px) {
  .eras, .era { height: 52px; }
  .era { padding: 3px 8px; }
  .era-name { line-height: 14px; }
  .mini-events { top: 18px; height: 16px; }
  .mini-events i { height: 6px; }
  .mini-events i.thai { top: 9px; }
  .era small { margin-top: 17px; line-height: 14px; }
  .era[aria-current="true"]::after { inset: 15px 4px 16px; }
  .story-art { height: min(30vh, 250px); }
  .focusbar { padding-top: 6px; padding-bottom: 6px; }
  .focus-date strong { font-size: 26px; }
  .timeline { padding-top: 10px; padding-bottom: 10px; }
  .column { grid-template-rows: minmax(0, 1fr) 40px minmax(0, 1fr); }
  .card::after { height: 20px; }
  .card { padding: 4px 6px; }
  .card-title { font-size: 13px; }
  .card-date { font-size: 18px; margin: 2px 0; }
  .art { width: clamp(44px, 8.5vh, 80px); height: clamp(44px, 8.5vh, 80px); margin: 4px 0 2px 6px; }
}
@media (min-width: 761px) and (max-height: 680px) {
  .focusbar .scale-note { display: none; }
  .art { width: clamp(40px, 7vh, 60px); height: clamp(40px, 7vh, 60px); }
  .card-date small { display: none; }
}
@media (max-width: 760px) {
  /* Phones follow the reference: one compact header row, a pinned focus strip and a vertical centre spine. */
  body { height: auto; background: var(--wash); }
  main { display: flex; }
  .topbar { position: sticky; top: 0; z-index: 6; height: 48px; padding: 8px 12px; gap: 10px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .back { font-size: 18px; line-height: 1; color: var(--ink); }
  .back-t, .topbar #notesBtn, h1 small { display: none; }
  h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #filtBtn { display: inline-grid; position: relative; }
  #filtBtn[aria-expanded="true"] { border-color: var(--ink); }
  #filtBtn.active::after { content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--paper); }
  .icon-button { width: 32px; height: 32px; min-height: 32px; }
  .tools { display: none; position: fixed; top: 48px; left: 0; right: 0; z-index: 6; padding: 10px 12px 12px; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 14px 30px rgba(0, 0, 0, .14); }
  .tools-open .tools { display: flex; }
  .filters { width: 100%; flex-wrap: wrap; }
  .search-row { width: 100%; order: -1; }
  #search { flex: 1; width: auto; height: 36px; }
  #viewBtn { display: none; }
  #notesBtnPhone { display: inline-block; }
  .pill { min-height: 36px; }
  .focusbar { position: sticky; top: 48px; z-index: 5; height: 60px; padding: 0 16px; gap: 16px; }
  .focus-date strong { font-size: 24px; }
  .focusbar .scale-note { display: none; }
  .focusbar p { font-size: 12px; }
  .timeline-shell { flex: auto; }
  #story, .story-grip, .edge, .timeline-shell::after, .eras, .reading .eras { display: none; }
  .lead { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 42vh; padding: 24px; text-align: center; background: var(--paper); color: var(--muted); }
  .lead[hidden] { display: none; }
  .lead b { font: 800 30px/1.1 var(--serif); color: var(--ink); }
  .lead span { font-size: 14px; }
  .lead svg { width: 30px; height: 30px; margin: 12px 0 4px; color: var(--ink); animation: nudge-y 1.4s ease-in-out infinite; }
  .lead small { font-size: 12px; font-weight: 600; line-height: 1.5; }
  .lane-labels { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; margin: 0; padding: 12px 12px 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); }
  .lane-labels span:first-child { text-align: right; }
  .lane-labels span:last-child { color: color-mix(in srgb, var(--blue) 86%, #000); }
  .timeline, .reading .timeline { position: relative; inset: auto; display: block; overflow: visible; padding: 0 12px 40vh; }
  .timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%); background: var(--line); }
  .era-h { display: block; position: sticky; top: 108px; z-index: 4; margin: 0 -12px; padding: 7px 12px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .column, .reading .column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto; column-gap: 28px; padding: 14px 0 0; border: 0; scroll-margin-top: 152px; }
  .column::before, .column .axis-year { display: none; }
  .column .card, .reading .column .card { --ph: 64px; grid-row: 1; width: auto; max-width: 100%; display: grid; grid-template-columns: var(--ph) minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 4px; }
  .column.world .card { grid-column: 1; justify-self: end; grid-template-columns: minmax(0, 1fr) var(--ph); text-align: right; }
  .column.thai .card { grid-column: 2; justify-self: start; }
  .card .art, .thai .card .art { grid-row: 1 / 3; width: var(--ph); height: var(--ph); margin: 0; }
  .world .card .art { grid-column: 2; }
  .thai .card .art { grid-column: 1; }
  .card-date { grid-row: 1; align-self: end; margin: 0 0 3px; font-size: 19px; }
  .card-title { grid-row: 2; align-self: start; font-size: 13px; overflow-wrap: break-word; }
  .world .card-date, .world .card-title { grid-column: 1; }
  .world .card-date { justify-content: flex-end; }
  .thai .card-date, .thai .card-title { grid-column: 2; }
  .card .lane-flag { display: none; }
  .card.focused .art img, .card.focused .art svg { transform: scale(1.06); box-shadow: 0 0 0 1.5px var(--paper), 0 0 0 4px var(--lane-color); }
  /* Stems run sideways to the spine, ending in its dot. */
  .card::after, .reading .card::after { display: block; top: 50%; height: 0; width: 14px; border-left: 0; border-top: 1.5px dashed var(--lane-color); }
  .world .card::after { top: 50%; left: 100%; }
  .thai .card::after { top: 50%; left: auto; right: 100%; bottom: auto; }
  .card::before { content: ""; position: absolute; top: calc(50% - 6px); width: 12px; height: 12px; border: 2px solid var(--lane-color); border-radius: 50%; background: var(--wash); box-sizing: border-box; z-index: 1; }
  .world .card::before { left: calc(100% + 8px); }
  .thai .card::before { left: -20px; }
  .card.focused::before { background: var(--lane-color); }
  .detail-title { font-size: 30px; }
  #detailBody { padding: 20px; }
}
@keyframes nudge-y { 50% { transform: translateY(5px); } }

/* Thai political context: the year in focus, reign and premier rows, and forms of government */
.focus-thai { display: grid; gap: 2px; min-width: 0; font-size: 12px; line-height: 1.3; color: var(--ink); border-left: 1px solid var(--line); padding-left: 16px; }
.focus-thai:empty { display: none; }
.focus-thai span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-thai b { display: inline-block; min-width: 104px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.focus-thai i { font-style: normal; color: var(--muted); }
.timeline { padding-bottom: 82px; }
.pol-row { position: absolute; left: 0; width: 0; height: 18px; z-index: 2; }
.pol-row.gov { bottom: 52px; }
.pol-row.reign { bottom: 30px; }
.pol-row.pm { bottom: 8px; }
.pol { position: absolute; top: 0; height: 18px; border-radius: 4px; background: color-mix(in srgb, var(--blue) 22%, var(--wash)); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); overflow: clip; box-sizing: border-box; }
.pol.alt { background: color-mix(in srgb, var(--blue) 12%, var(--wash)); }
.pm .pol { background: color-mix(in srgb, var(--axis) 18%, var(--wash)); border-color: color-mix(in srgb, var(--axis) 35%, transparent); }
.pm .pol.alt { background: color-mix(in srgb, var(--axis) 8%, var(--wash)); }
.gov .pol { background: color-mix(in srgb, var(--blue) 6%, var(--paper)); border-style: dashed; }
.pol i { font-style: normal; color: var(--muted); margin-left: 4px; }
.pol span { display: block; position: sticky; left: 8px; width: max-content; max-width: 100%; box-sizing: border-box; padding: 0 6px; font: 600 11px/16px var(--sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.regime { position: absolute; top: calc(50% + 6px); bottom: 76px; z-index: 0; border-top: 2px solid color-mix(in srgb, var(--blue) 45%, transparent); color: var(--muted); }
.regime.r0 { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--blue) 7%, transparent) 0 2px, transparent 2px 12px); }
.regime.r1 { background: color-mix(in srgb, var(--blue) 4%, transparent); }
.regime .band-label { font-size: clamp(14px, 1.9vh, 20px); }
/* Key milestones get a larger figure */
.column.key { flex-basis: 212px; }
.column.key .art { width: clamp(88px, 15vh, 144px); height: clamp(88px, 15vh, 144px); }
.column.key .card-title { font: 700 17px/1.2 var(--serif); }
.column.key .card-date { font-size: 28px; }
.column.key .card .art img { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--lane-color); }
@media (max-width: 760px) { .pol-row, .regime { display: none; } .focus-thai { display: none; } .timeline { padding-bottom: 10px; } }
.reading .pol-row, .reading .regime { display: none; }

/* World-context periods drawn behind the stories they span */
.column { z-index: 1; }
.band { position: absolute; top: 14px; bottom: 14px; z-index: 0; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 12px; box-sizing: border-box; border-radius: 14px; text-decoration: none; color: var(--muted);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--axis) 13%, transparent) 0 2px, transparent 2px 11px), color-mix(in srgb, var(--axis) 9%, transparent);
  border: 1px dashed color-mix(in srgb, var(--axis) 45%, transparent); }
.band::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, transparent 38%, var(--wash) 50%, transparent 62%); opacity: .55; pointer-events: none; }
.band-label, .band-span { position: sticky; left: 12px; display: block; width: max-content; max-width: calc(100% - 24px); padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-label { margin-top: 10px; font: italic 700 clamp(18px, 2.4vh, 26px)/1.1 var(--serif); letter-spacing: .01em; color: color-mix(in srgb, var(--muted) 80%, transparent); }
.band-span { margin-top: 2px; font: 700 11px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.band:hover { border-color: var(--axis); color: var(--ink); }
.band:not(.lane-world) { bottom: 86px; justify-content: flex-start; padding-bottom: 0; }
.band.lane-world { padding-bottom: 40px; bottom: calc(50% + 2px); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.band.lane-world::before { display: none; }
.band.long .band-label { font-size: clamp(22px, 3vh, 34px); }
.evidence { list-style: none; margin: 0; padding: 0; }
.evidence li { position: relative; padding-left: 40px; outline: none; border-radius: 8px; transition: background-color .6s; }
.ref-n { position: absolute; left: 4px; top: 16px; font: 700 13px/1.4 var(--sans); color: var(--green); }
.ref-loc { color: var(--ink) !important; }
.evidence li.flash { animation: ref-flash 2.4s ease-out; }
.evidence li:focus-visible { box-shadow: 0 0 0 2px var(--green); }
@keyframes ref-flash { 0%, 30% { background: color-mix(in srgb, var(--green) 16%, transparent); } 100% { background: transparent; } }
.cited-by { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cited-by a { font-size: 13px; }
@media (max-width: 760px) { .band { display: none; } .timeline-shell { overflow-x: clip; } }
.reading .band { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } .story-grip.hint .grip-tab, .evidence li.flash { animation: none; } .evidence li.flash { background: color-mix(in srgb, var(--green) 12%, transparent); } }
.apa { margin: 0; font-size: 14px; line-height: 1.55; padding-left: 1.5em; text-indent: -1.5em; overflow-wrap: anywhere; }
.apa a { color: inherit; }

/* Debunked claims: a stamp on the card and a warning at the top of the story. */
.false-stamp { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg); padding: 3px 9px; border: 3px solid #b3261e; border-radius: 4px; background: #fff; color: #b3261e; font: 700 15px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; pointer-events: none; box-shadow: 0 2px 6px rgb(0 0 0 / .25); }
.art:has(.false-stamp) img { box-shadow: 0 0 0 4px #b3261e; }
/* False-claim warning: fixed red with white text so it reads the same in both themes. */
.story-art, .detail-art { position: relative; }
.is-false { box-shadow: inset 0 0 0 5px #b3261e; }
.is-false img { filter: grayscale(.7) brightness(.8); }
.false-over { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-10deg); display: grid; justify-items: center; gap: 2px; padding: 8px 18px 7px; border: 4px solid #b3261e; border-radius: 6px; background: rgb(255 255 255 / .94); color: #b3261e; text-transform: uppercase; box-shadow: 0 6px 18px rgb(0 0 0 / .35); pointer-events: none; }
.false-over b { font: 700 clamp(22px, 2.4vw, 32px)/1 var(--sans); letter-spacing: .12em; }
.false-over small { font: 700 12px/1.2 var(--sans); letter-spacing: .16em; }
.false-note { margin: 10px 0; padding: 0; overflow: hidden; border: 2px solid #b3261e; border-radius: 8px; color: var(--ink); background: color-mix(in srgb, #b3261e 10%, var(--card)); }
.false-note b { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #b3261e; color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.false-note b::before { content: "!"; display: grid; place-items: center; width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; font-size: 12px; line-height: 1; }
.false-note span { display: block; padding: 8px 12px 10px; font-weight: 500; }

/* Short desktop screens: keep key figures, politics rows and the focus line compact */
@media (min-width: 761px) and (max-height: 860px) {
  .column.key .art { width: clamp(52px, 10vh, 92px); height: clamp(52px, 10vh, 92px); }
  .column.key .card-title { font-size: 14px; }
  .column.key .card-date { font-size: 21px; }
  .timeline { padding-bottom: 46px; }
  .pol-row.gov { display: none; }
  .pol-row.reign { bottom: 24px; }
  .pol-row.pm { bottom: 4px; }
  .pol-row, .pol { height: 16px; }
  .pol span { line-height: 14px; font-size: 10.5px; }
  .regime { bottom: 44px; }
  .focus-thai { grid-auto-flow: column; gap: 2px 18px; }
  .focus-thai b { min-width: 0; margin-right: 4px; }
}
@media (min-width: 761px) and (max-height: 680px) {
  .column.key .art { width: clamp(48px, 9vh, 76px); height: clamp(48px, 9vh, 76px); }
  .column.key .card-title { font-size: 13px; }
  .column.key .card-date { font-size: 18px; }
  .column.key .art { width: clamp(44px, 8vh, 64px); height: clamp(44px, 8vh, 64px); }
  .focus-thai span:nth-child(3) { display: none; }
}
@media (max-width: 760px) { .timeline { padding-bottom: 40vh; } }
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 680px) { .focus-thai { display: none; } }
@media (min-width: 761px) and (max-height: 680px) { .timeline { padding-bottom: 24px; } .pol-row.pm, .pol-row.gov { display: none; } .pol-row.reign { bottom: 4px; } .regime { bottom: 24px; } }
/* Band labels sit as a small tab on the band's top edge, clear of the cards */
.band, .band:not(.lane-world), .band.lane-world { display: block; padding: 0; }
.band-label, .band.long .band-label { position: sticky; left: 12px; display: inline-flex; gap: 8px; align-items: baseline; margin: -10px 0 0 12px; padding: 3px 10px; border-radius: 999px; background: var(--paper); border: 1px dashed color-mix(in srgb, var(--axis) 60%, transparent); font: italic 700 14px/1.1 var(--serif); color: var(--ink); max-width: none; }
.band-span { display: none; }
.band-label small { font: 700 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; font-style: normal; color: var(--muted); }
.band { top: 18px; }
@media (min-width: 761px) and (min-height: 861px) { .timeline { padding-top: 66px; } .band { top: 24px; } .band .band-label { margin-top: -12px; } }
@media (min-width: 761px) and (max-height: 860px) { .band-label { display: none; } .band { top: 6px; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.filters { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tools > * { min-width: 0; }
@media (min-width: 761px) and (max-height: 680px) { .column.key .card-title { font: 700 13px/1.2 var(--sans); } }
/* Keep the toolbar on one row on desktop: the search narrows first, then the filters scroll with an edge fade. */
@media (min-width: 761px) {
  .tools { flex-wrap: nowrap; }
  .filters { flex: 0 1 auto; }
  .filters.scrolls { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .search-row { flex: none; }
}
@media (min-width: 761px) and (max-width: 1279px) { #search { width: 150px; } }
