/* Layout: floating panes over a backdrop taken from the selected event's own picture.
   Three looks share one structure and differ only in the tokens below. */
:root {
  --ui: "Anek Latin", "Segoe UI", system-ui, sans-serif;
  --read: Literata, "Source Serif 4", Georgia, serif;
  --deva: "Anek Devanagari", "Nirmala UI", "Noto Sans Devanagari", sans-serif;

  /* Glass (default) */
  --ground: #0a0c11;
  --panel: rgba(13, 15, 21, .5);
  --panel-solid: #14161d;
  --raise: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .13);
  --text: #f3f1ec;
  --muted: rgba(243, 241, 236, .66);
  --accent: #ffc861;
  --on-accent: #1b1404;
  --sel: rgba(255, 255, 255, .14);
  --blur: blur(30px) saturate(150%);
  --edge: 1px solid var(--line);
  --sheen: inset 0 1px 0 rgba(255, 255, 255, .09);
  --gap: 10px;
  --r: 16px;
  --r-s: 7px;
  --mark-filter: none;
  --scene: radial-gradient(60% 70% at 18% 20%, #1f4a57 0%, transparent 70%),
           radial-gradient(55% 60% at 85% 75%, #7a3b1d 0%, transparent 70%),
           radial-gradient(40% 50% at 60% 10%, #3a2a5e 0%, transparent 70%), #0d1118;
  color-scheme: dark;
}
:root[data-look="indigo"] {
  --ground: #2f376d;
  --panel: #191e44;
  --panel-solid: #1e2450;
  --raise: #262d60;
  --line: #2f376d;
  --text: #eef0fa;
  --muted: #a9b0d8;
  --accent: #f2b84b;
  --on-accent: #1d1503;
  --sel: #2d3672;
  --blur: none;
  --edge: 0;
  --sheen: none;
  --gap: 1px;
  --r: 0px;
  --r-s: 4px;
}
:root[data-look="stone"] {
  --ground: #cbc8c1;
  --panel: #f3f2ef;
  --panel-solid: #f8f7f5;
  --raise: #e6e4df;
  --line: #cbc8c1;
  --text: #1b2040;
  --muted: #5c5f78;
  --accent: #a8281f;
  --on-accent: #fff;
  --sel: #dedbd4;
  --blur: none;
  --edge: 0;
  --sheen: none;
  --gap: 1px;
  --r: 0px;
  --r-s: 4px;
  --mark-filter: saturate(1.5) brightness(.68);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; padding: var(--gap);
  background: var(--ground); color: var(--text);
  font: 400 15px/1.5 var(--ui);
  display: flex; flex-direction: column; gap: var(--gap);
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[lang="sa"] { font-family: var(--deva); }

.panel {
  background: var(--panel); border: var(--edge); border-radius: var(--r);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--sheen);
  position: relative; z-index: 1;
}

/* ── Backdrop (Glass only) ───────────────────────────── */
.backdrop { position: fixed; inset: 0; overflow: hidden; z-index: 0; display: none; }
:root[data-look="glass"] .backdrop { display: block; }
.backdrop div {
  position: absolute; inset: -90px; background-size: cover; background-position: center;
  filter: blur(46px) saturate(1.35); opacity: 0; transition: opacity .9s ease;
}
.backdrop div.none { background-image: var(--scene) !important; filter: none; inset: 0; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 9, 13, .34), rgba(8, 9, 13, .12) 45%, rgba(8, 9, 13, .4)); }

/* ── Top bar ─────────────────────────────────────────── */
.top { display: flex; align-items: center; gap: 8px 18px; padding: 9px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--text); text-decoration: none; }
.brand-name { font: 600 21px/1 var(--ui); font-stretch: 88%; letter-spacing: .1px; }
.brand-sub { font-size: 14px; color: var(--muted); }

.search {
  flex: 1 1 200px; max-width: 340px; min-width: 170px; height: 34px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--raise); border-radius: var(--r-s);
}
.search:focus-within { outline: 1.5px solid var(--accent); }
.search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; }
.search input::placeholder { color: var(--muted); }
.search kbd, .hint kbd { font: 11px var(--ui); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

.tools { display: flex; align-items: center; gap: 6px 14px; margin-left: auto; flex-wrap: wrap; }
.seg { display: flex; background: var(--raise); border-radius: var(--r-s); padding: 2px; }
.seg button { padding: 4px 11px; border-radius: calc(var(--r-s) - 2px); font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--panel-solid); font-weight: 550; }
.link { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
a.link { text-decoration: none; }
.link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.look { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.look select { background: var(--raise); border: 0; border-radius: var(--r-s); padding: 5px 6px; color: var(--text); }
.look option { background: var(--panel-solid); color: var(--text); }

/* ── Band: ruler of ages + filters ───────────────────── */
.band { overflow: hidden; }
.ribbon { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.ribbon::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.era {
  flex: 1 0 98px; min-width: 98px; text-align: left; padding: 8px 10px 0;
  border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px;
  color: var(--muted); position: relative;
}
.era:first-child { border-left: 0; }
.era:hover { color: var(--text); background: var(--raise); }
.era[aria-current="true"] { color: var(--text); background: var(--sel); }
.era[disabled] { opacity: .35; cursor: default; }
.era-name { font: 550 13.5px/1.2 var(--ui); font-stretch: 90%; min-height: 2.4em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.era-sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.era-dots { position: relative; height: 13px; margin: 4px -10px 0; }
.era-dots i { position: absolute; bottom: 0; width: 2px; height: 7px; background: var(--c); filter: var(--mark-filter); transform: translateX(-50%); }
.era-dots i.sel { height: 13px; width: 3px; background: var(--text); filter: none; }

.chips { display: flex; gap: 2px; padding: 5px 8px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-s); font-size: 13px; color: var(--muted); white-space: nowrap; }
.chip[data-cat]:not([data-cat=""])::before { content: ""; width: 7px; height: 7px; background: var(--c); filter: var(--mark-filter); }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); background: var(--sel); font-weight: 550; }
.chip .n { font-size: 11.5px; opacity: .7; font-variant-numeric: tabular-nums; font-weight: 400; }

/* ── Main two-pane ───────────────────────────────────── */
main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(310px, 430px) 1fr; gap: var(--gap); }
.list { overflow-y: auto; padding-bottom: 30px; outline: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.era-head {
  position: sticky; top: 0; z-index: 2; padding: 12px 16px 6px;
  background: var(--panel-solid); border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
:root[data-look="glass"] .era-head { background: rgba(17, 19, 26, .82); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.era-head h2 { margin: 0; font: 600 15px var(--ui); font-stretch: 90%; }
.era-head span { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.row {
  display: grid; grid-template-columns: 104px 7px 1fr; gap: 10px; align-items: baseline;
  width: calc(100% - 12px); margin: 1px 6px; padding: 7px 10px; text-align: left; border-radius: var(--r-s);
}
.row:hover { background: var(--raise); }
.row[aria-current="true"] { background: var(--sel); }
.row .when { font-size: 12px; line-height: 1.3; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.row .mark { width: 7px; height: 7px; background: var(--c); filter: var(--mark-filter); align-self: start; margin-top: 7px; }
.row .ttl { font: 450 15px/1.3 var(--ui); min-width: 0; }
.row[aria-current="true"] .ttl { font-weight: 600; }
.row[aria-current="true"] .when { color: var(--text); }
.row.here .ttl { color: var(--accent); font-weight: 600; }
.empty { padding: 40px 24px; color: var(--muted); text-align: center; }
.empty button { margin-top: 12px; background: var(--raise); border-radius: var(--r-s); padding: 6px 14px; color: var(--text); }

/* ── Detail ──────────────────────────────────────────── */
.detail { overflow-y: auto; padding: 30px clamp(18px, 4.5vw, 60px) 48px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.detail-inner { max-width: 640px; margin: 0 auto; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .detail-inner { animation: none; } .backdrop div { transition: none; } }
.back { display: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.meta .kind::before { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--c); filter: var(--mark-filter); margin-right: 7px; vertical-align: 1px; }
.meta .basis { border-bottom: 1px dotted var(--muted); cursor: help; }
.meta .sep { opacity: .5; }
.date { font: 500 clamp(19px, 2.2vw, 23px)/1.25 var(--ui); font-stretch: 92%; color: var(--accent); margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.detail h1 { font: 600 clamp(27px, 3.4vw, 40px)/1.08 var(--ui); font-stretch: 86%; letter-spacing: -.2px; margin: 0; text-wrap: balance; }
.detail .sk { font-size: 19px; color: var(--muted); margin-top: 6px; }
.alt { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.alt b { color: var(--text); font-weight: 550; }
.pic { margin: 20px 0 0; }
/* Every picture sits whole inside the same 16:10 frame; the space around it is a blurred copy of itself. */
.pic .frame { display: block; position: relative; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; overflow: hidden; cursor: zoom-in; border-radius: min(calc(var(--r-s) + 3px), 22px); background: var(--raise); isolation: isolate; }
.pic .frame::before { content: ""; position: absolute; inset: -40px; z-index: -1; background: var(--u) center / cover; filter: blur(26px) brightness(.62) saturate(1.2); }
.pic .frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pic .frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#dlg-zoom { width: fit-content; height: fit-content; margin: auto; max-width: none; max-height: none; padding: 0; border: 0; background: none; box-shadow: none; overflow: visible; -webkit-backdrop-filter: none; backdrop-filter: none; }
#dlg-zoom::backdrop { background: rgba(4, 5, 9, .86); }
#dlg-zoom .zoom-close { display: block; padding: 0; border: 0; background: none; cursor: zoom-out; }
#dlg-zoom img { display: block; width: min(calc(100vw - 24px), calc((100vh - 84px) * var(--ar, 1.5)), 1280px); height: auto; max-width: none; border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
#dlg-zoom p { font: 400 12px var(--ui); color: rgba(245, 245, 247, .75); margin: 8px 2px 0; max-width: none; }
#dlg-zoom p a { color: inherit; }
.pic figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.body { font: 400 17px/1.68 var(--read); margin: 20px 0 24px; }
.facts { display: flex; flex-wrap: wrap; margin: 0 0 24px; border-block: 1px solid var(--line); }
.facts div { padding: 9px 22px 9px 0; margin-right: 22px; border-right: 1px solid var(--line); }
.facts div:last-child { border-right: 0; margin-right: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; font-variant-numeric: tabular-nums; }
.srcs h3 { font: 550 13px var(--ui); color: var(--muted); margin: 0 0 4px; }
.srcs ul { margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.srcs li { margin: 2px 0; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); }
.pn button { text-align: left; min-width: 0; color: var(--text); }
.pn button:last-child { text-align: right; }
.pn button:hover span { text-decoration: underline; text-underline-offset: 3px; }
.pn small { display: block; font-size: 12px; color: var(--muted); }
.pn span { font-weight: 550; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ── Dialogs ─────────────────────────────────────────── */
dialog {
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); border-radius: max(var(--r), 8px);
  padding: 26px clamp(18px, 4vw, 34px); width: min(840px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
:root[data-look="glass"] dialog { background: rgba(20, 22, 30, .86); -webkit-backdrop-filter: blur(34px); backdrop-filter: blur(34px); }
dialog::backdrop { background: rgba(6, 7, 12, .55); }
dialog h2 { font: 600 28px/1.1 var(--ui); font-stretch: 86%; margin: 0 0 8px; }
dialog h3 { font: 600 16px var(--ui); margin: 22px 0 6px; }
dialog p { font: 400 15.5px/1.6 var(--read); margin: 0 0 10px; max-width: 68ch; }
dialog .lede { color: var(--muted); margin-bottom: 18px; }
dialog .close { position: absolute; top: 10px; right: 14px; font-size: 26px; color: var(--muted); line-height: 1; }
.cycles { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 28px; align-items: center; }
#cy-svg svg { width: 100%; height: auto; display: block; }
#cy-legend { list-style: none; margin: 0; padding: 0; }
#cy-legend li { display: grid; grid-template-columns: 9px 1fr auto; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 8px 0; }
#cy-legend li:last-child { border-bottom: 0; }
#cy-legend i { width: 9px; height: 9px; background: var(--c); filter: var(--mark-filter); align-self: center; }
#cy-legend b { font-weight: 600; display: block; }
#cy-legend small { color: var(--muted); font-size: 13px; }
#cy-legend em { font: 600 19px var(--ui); font-style: normal; font-variant-numeric: tabular-nums; }
.basis-list { margin: 0; padding: 0; list-style: none; }
.basis-list li { display: grid; grid-template-columns: 170px 1fr; gap: 14px; font-size: 14.5px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.basis-list li:last-child { border-bottom: 0; }
.basis-list b { font-weight: 550; }
.src-list { padding-left: 18px; font-size: 14.5px; margin: 0 0 12px; }
.src-list li { margin: 6px 0; }
.src-list small { color: var(--muted); display: block; }

/* ── Small screens ───────────────────────────────────── */
@media (max-width: 860px) {
  body { overflow: auto; height: auto; }
  html { height: auto; }
  .top { padding: 9px 12px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .tools { margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%; order: 6; }
  .tools > * { flex: none; }
  main { display: block; flex: none; }
  .list { overflow: visible; }
  .row { grid-template-columns: 92px 7px 1fr; }
  .detail {
    position: fixed; inset: 0; z-index: 20; border-radius: 0; border: 0; background: var(--panel-solid);
    transform: translateY(100%); transition: transform .25s ease; visibility: hidden; padding-top: 14px;
  }
  :root[data-look="glass"] .detail { background: rgba(14, 16, 22, .88); }
  body.reading .detail { transform: none; visibility: visible; }
  body.reading { overflow: hidden; }
  .back { display: inline-block; margin-bottom: 16px; background: var(--raise); border-radius: var(--r-s); padding: 6px 12px; font-size: 13.5px; }
  .hint { display: none; }
  .cycles { grid-template-columns: 1fr; }
  .basis-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ── Glass refinements ───────────────────────────────── */
:root[data-look="glass"] .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .015) 38%), var(--panel);
  border-color: rgba(255, 255, 255, .15) rgba(255, 255, 255, .09) rgba(255, 255, 255, .06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 14px 44px rgba(0, 0, 0, .3);
}
:root[data-look="glass"] .detail { --panel: rgba(12, 14, 20, .64); }
:root[data-look="glass"] .backdrop div:not(.none) { filter: blur(46px) saturate(1.35) brightness(.74); animation: drift 48s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.12) translate(-2.5%, 2%); } }
/* fine grain so the blurred colour does not band */
.backdrop::before {
  content: ""; position: absolute; inset: 0; z-index: 1; opacity: .11; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-look="glass"] .search { background: rgba(0, 0, 0, .24); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09); }
:root[data-look="glass"] .seg, :root[data-look="glass"] .look select { background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
:root[data-look="glass"] .seg button[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: #14161d; box-shadow: 0 1px 6px rgba(0, 0, 0, .3); }
:root[data-look="glass"] .row[aria-current="true"],
:root[data-look="glass"] .era[aria-current="true"] { background: rgba(255, 255, 255, .15); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
:root[data-look="glass"] .chip[aria-pressed="true"] { background: rgba(255, 255, 255, .15); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
:root[data-look="glass"] .pic .frame { box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 16px 44px rgba(0, 0, 0, .4); }
:root[data-look="glass"] .list, :root[data-look="glass"] .detail { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
:root[data-look="glass"] dialog { border-color: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 30px 90px rgba(0, 0, 0, .55); }
:root[data-look="glass"] dialog::backdrop { background: rgba(6, 7, 12, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (prefers-reduced-motion: reduce) { :root[data-look="glass"] .backdrop div:not(.none) { animation: none; } }

/* ── Family trees ────────────────────────────────────── */
/* A line of descent is a vertical rail. Each child of .tl draws its own piece of the rail,
   so the rail starts at the first person's dot and stops at the last. */
#tr-tabs { display: inline-flex; margin: 2px 0 18px; }
.tr-head h3 { margin: 0 0 4px; font-size: 19px; }
.tr-head h3 span { font: 400 15px var(--deva, var(--ui)); color: var(--muted); margin-left: 6px; }
.tr-head p { font: 400 14px/1.55 var(--ui); color: var(--muted); max-width: 74ch; margin: 0 0 8px; }
.tr-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px !important; margin: 0 0 18px !important; }
.tr-key .k { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); margin-left: 10px; }
.tr-key .k:first-child { margin-left: 0; }
.tr-key .k.on { background: var(--accent); border-color: var(--accent); }
.tl { --rail: 5px; }
.tl > * { position: relative; padding-left: 26px; }
.tl > *::before { content: ""; position: absolute; left: var(--rail); top: 0; bottom: 0; border-left: 1.5px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.tl > :first-child::before { top: 13px; }
.tl > :last-child::before { bottom: auto; height: 13px; }
.tl > :first-child:last-child::before { display: none; }
.tp { padding-top: 3px; padding-bottom: 9px; }
.tp::after { content: ""; position: absolute; left: calc(var(--rail) - 4px); top: 9px; width: 9px; height: 9px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--muted); background: var(--panel-solid); }
.tp.on::after { background: var(--accent); border-color: var(--accent); }
.th { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 9px; }
.tn { font: 600 16px/1.35 var(--ui); color: var(--text); padding: 0; text-align: left; }
button.tn { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
button.tn:hover { color: var(--accent); }
.tsk { font: 400 13.5px var(--deva, var(--ui)); color: var(--muted); }
.tp p { font: 400 13.5px/1.45 var(--ui); color: var(--muted); margin: 1px 0 0; max-width: 62ch; }
.tgo { font: 500 12.5px var(--ui); color: var(--accent); padding: 2px 0 0; }
.tgo:hover { text-decoration: underline; text-underline-offset: 3px; }
.tp.gap { padding-top: 2px; padding-bottom: 8px; }
.tp.gap::before { border-left-style: dashed; }
.tp.gap::after { display: none; }
.tp.gap span { font: italic 400 12.5px var(--ui); color: var(--muted); }
/* a side branch: set in from the rail and joined to it by a short elbow */
.tb { padding-left: 30px !important; }
.tb::after { content: ""; position: absolute; left: var(--rail); top: 13px; width: 30px; border-top: 1.5px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.tr-src { font: 400 12.5px var(--ui) !important; color: var(--muted); margin: 18px 0 0 !important; }
.tr-src a { color: inherit; }
@media (max-width: 560px) { .tb { padding-left: 18px !important; } .tb::after { width: 18px; } .tn { font-size: 15px; } }

/* ── Display menu (look and Devanagari typeface) ─────── */
.disp { position: relative; font-size: 13.5px; }
.disp summary { list-style: none; cursor: pointer; color: var(--muted); white-space: nowrap; padding: 5px 10px; border-radius: var(--r-s); background: var(--raise); }
.disp summary::-webkit-details-marker { display: none; }
.disp summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 2px 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.disp[open] summary, .disp summary:hover { color: var(--text); }
.disp-pop { position: absolute; right: 0; top: calc(100% + 12px); z-index: 40; width: 270px; display: grid; gap: 10px; padding: 14px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: min(var(--r), 16px); box-shadow: 0 18px 50px rgba(0, 0, 0, .4); }
.disp-pop label { display: grid; gap: 4px; color: var(--muted); font-size: 12.5px; }
.disp-pop select { background: var(--raise); border: 0; border-radius: min(var(--r-s), 10px); padding: 7px 8px; color: var(--text); font-size: 14px; width: 100%; }
.disp-pop option { background: var(--panel-solid); color: var(--text); }
@media (max-width: 860px) { .disp { position: static; } .disp-pop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }

/* ── Explore menu ────────────────────────────────────── */
.disp-pop.menu { gap: 1px; padding: 8px; width: 280px; }
.disp-pop.menu a, .disp-pop.menu button { display: block; text-align: left; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 14px; }
.disp-pop.menu a:hover, .disp-pop.menu button:hover { background: var(--raise); }
.disp-pop.menu button:first-of-type { margin-top: 6px; }

/* ── Save, share and print ───────────────────────────── */
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; }
.acts button, .share-row button { font-size: 13px; padding: 5px 12px; border-radius: var(--r-s); background: var(--raise); color: var(--text); }
.acts button:hover, .share-row button:hover { background: var(--sel); }
.acts button[aria-pressed="true"] { color: var(--accent); }
.row .star { font-style: normal; color: var(--accent); font-size: .8em; }
.chip.saved { --c: var(--accent); }
.lang-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 -6px; }
.print-url { display: none; }
#dlg-share { width: min(680px, calc(100vw - 24px)); }
#share-card { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); margin: 10px 0 12px; background: #14161d; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.share-row input { flex: 1 1 220px; min-width: 0; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--raise); font-size: 13px; }
.share-row button:disabled { opacity: .5; cursor: default; }
#share-msg { font-size: 13px; color: var(--muted); }
dialog .share-note { font: 400 12.5px/1.5 var(--ui); color: var(--muted); margin: 6px 0 0; }

/* ── Print: one event on plain paper ─────────────────── */
@media print {
  :root, :root[data-look] { --ground: #fff; --panel: #fff; --panel-solid: #fff; --raise: #fff; --text: #000; --muted: #444; --accent: #6b4a00; --line: #bbb; color-scheme: light; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body { display: block !important; padding: 0 !important; }
  .backdrop, .top, .band, .list, dialog, .acts, .pn, .hint, .back, .lang-note, .alt b + *:empty { display: none !important; }
  main { display: block !important; position: static !important; inset: auto !important; }
  .detail { position: static !important; display: block !important; overflow: visible !important; padding: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important;
    -webkit-mask-image: none !important; mask-image: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transform: none !important; }
  .detail-inner { max-width: none !important; margin: 0 !important; }
  .detail h1 { font-size: 26pt; }
  .detail .body { font-size: 11.5pt; line-height: 1.55; }
  .pic .frame { aspect-ratio: auto; max-height: 90mm; background: none; box-shadow: none !important; border: 0; }
  .pic .frame::before { display: none; }
  .pic .frame img { height: auto; max-height: 90mm; width: auto; max-width: 100%; margin: 0; }
  .pic, .facts, .srcs li { break-inside: avoid; }
  .srcs a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #444; word-break: break-all; }
  .print-url { display: block; margin-top: 14pt; padding-top: 6pt; border-top: 1px solid #bbb; font-size: 9pt; color: #444; }
  a { color: #000; }
}
