/* The Indo-European Stemma — the page IS the poster. Chrome stays at the family's
   weight: one link row, one control bar, one dialog; the title lives inside
   the SVG so the exported image is self-contained. Shares the Descent of
   Letters stylesheet almost exactly, so the two posters read as a pair. */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
}

.sites {
  position: fixed; top: 16px; right: 18px; z-index: 100;
  display: flex; gap: 14px;
  font-size: 10px; letter-spacing: 0.5px;
  padding: 6px 10px; border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
}
.sites a { color: var(--ink-muted); text-decoration: none; transition: color 0.15s; }
.sites a:hover { color: var(--ink-bright); }

.sheet {
  width: min(1900px, 100vw);
  margin: 0 auto;
  padding: 8px 12px 96px;
}
#poster { display: block; width: 100%; height: auto; }

.tip {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 10px 13px; max-width: 320px;
  pointer-events: none; opacity: 0; transition: opacity 0.1s;
  z-index: 1000; backdrop-filter: blur(10px); color: var(--ink);
  font-size: 12px; line-height: 1.5;
}
.tip.show { opacity: 1; }
.tip strong { display: block; color: var(--ink-bright); font-size: 14px; font-weight: 600; }
.tip .src { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 10px; }

.ctrl {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 6px; z-index: 100;
  max-width: calc(100vw - 16px);
}
.ctrl button, .ctrl select {
  background: var(--btn-bg); border: 1px solid var(--btn-border);
  color: var(--ink); padding: 6px 12px; border-radius: 4px;
  font-size: 13px; cursor: pointer; backdrop-filter: blur(6px);
  transition: all 0.15s; letter-spacing: 0.3px; min-width: 0;
}
.ctrl button:hover, .ctrl select:hover {
  background: var(--surface); color: var(--ink-bright); border-color: var(--border);
}
.ctrl button[disabled] { opacity: 0.5; cursor: wait; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 6px; flex-shrink: 0; color: var(--ink);
  background: none; border: none; cursor: pointer;
}
.icon-btn:hover { color: var(--ink-bright); background: none; border: none; }
.icon-btn svg { display: block; }
.branches--unused {
  position: fixed; left: 18px; bottom: 16px; z-index: 100;
  display: flex; flex-wrap: wrap; gap: 3px 12px; max-width: 34vw;
  font-size: 10px; color: var(--ink-muted); pointer-events: none;
}
.branches span { display: inline-flex; align-items: center; gap: 5px; }
.branches i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.sep { width: 1px; background: var(--btn-border); margin: 0 3px; align-self: stretch; }

#loading {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; flex-direction: column;
  background: var(--bg); z-index: 2000; transition: opacity 0.4s;
}
#loading.hide { opacity: 0; pointer-events: none; visibility: hidden; }
.spinner {
  width: 28px; height: 28px; border: 2px solid var(--btn-border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300; font-size: 28px; letter-spacing: 4px; color: var(--ink-bright);
}
#loading p { font-size: 13px; color: var(--ink-muted); margin-top: 5px; }

dialog {
  max-width: 480px; width: calc(100vw - 32px); padding: 20px 22px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  backdrop-filter: blur(18px);
  margin: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 24px; color: var(--ink-bright);
}
dialog p { margin: 10px 0; font-size: 12px; line-height: 1.6; }
dialog .key { color: var(--ink-muted); }
dialog .fine { color: var(--ink-muted); font-size: 11px; }
dialog ul { margin: 8px 0 8px 18px; font-size: 12px; line-height: 1.6; }
dialog strong { color: var(--ink-bright); }

/* SVG interaction states, applied via class on column groups */
#poster .col { transition: opacity 0.25s; }
#poster.focused .col { opacity: 0.13; }
#poster.focused .col.is-focus { opacity: 1; }
#poster .hit { cursor: pointer; }

@media (max-width: 700px) {
  .sites { display: none; }
  .branches { display: none; }
  .ctrl button, .ctrl select { padding: 10px 8px; font-size: 13px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  #loading, #poster .col { transition: none; }
}

/* Index and bucket views: HTML, not SVG. A list of families is a list, and a
   filing bucket is a flat set — neither is a tree, so neither is drawn as one. */
.sheet-html { padding: 26px 30px 110px; user-select: text; max-width: 1180px; margin: 0 auto; }
.idx-head { margin-bottom: 30px; }
.idx-head h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300; font-size: 46px; letter-spacing: 6px;
  text-transform: uppercase; color: var(--ink-bright);
}
.idx-sub { margin-top: 6px; color: var(--ink); font-size: 13px; letter-spacing: 0.6px; }
.idx-note { margin-top: 10px; color: var(--ink-muted); font-size: 12px; line-height: 1.6; max-width: 74ch; }
.idx-note a { color: var(--accent); text-decoration: none; }
.idx-note a:hover { text-decoration: underline; }
.crumb { margin-bottom: 10px; font-size: 11px; }
.crumb a { color: var(--ink-muted); text-decoration: none; }
.crumb a:hover { color: var(--ink-bright); }
.idx-sec { margin-top: 34px; }
.idx-sec h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 23px; color: var(--ink-bright);
  border-bottom: 1px solid var(--border); padding-bottom: 7px;
}
.idx-sec h2 small { font-family: system-ui, sans-serif; font-size: 11px; font-weight: 400; color: var(--ink-muted); margin-left: 10px; letter-spacing: 0.4px; }
.fam-grid { display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); margin-top: 14px; }
.fam-grid--tight { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.fam {
  display: block; padding: 9px 12px; border: 1px solid var(--btn-border);
  border-radius: 5px; background: var(--btn-bg); text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.fam:hover { border-color: var(--accent); background: var(--surface); }
.fam-name { display: block; color: var(--ink-bright); font-size: 14px; }
.fam-meta { display: block; color: var(--ink-muted); font-size: 10.5px; margin-top: 3px; }
.fam--bucket { border-style: dashed; }
.chips { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 14px; }
.chip { color: var(--ink); font-size: 12px; padding: 2px 8px; border: 1px solid var(--btn-border); border-radius: 999px; }
.chips--bucket .chip { border-color: transparent; padding: 1px 5px; }
.chip--extinct { color: var(--ink-muted); font-style: italic; }

/* Cross-links live in the help dialog, not over the drawing. */
.sees { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
.sees a { color: var(--accent); text-decoration: none; }
.sees a:hover { text-decoration: underline; }
