/* Descent of Tongues — 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(1500px, 100vw);
  margin: 0 auto;
  padding: 8px 12px 96px;
}
#poster { display: block; width: 100%; height: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.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 {
  position: fixed; left: 18px; bottom: 62px; z-index: 100;
  display: flex; flex-wrap: wrap; gap: 3px 12px; max-width: 26vw;
  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; }
#poster .leaf-mark {
  transition: opacity 0.16s, filter 0.16s;
}
#poster .leaf-mark.is-hover {
  filter: saturate(1.16) brightness(1.08) drop-shadow(0 2px 2px rgba(45, 31, 21, 0.28));
}
#poster .tree-wood,
#poster .tree-foliage,
#poster .sapwood { transition: opacity 0.28s; }

@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, #poster .leaf-mark,
  #poster .tree-wood, #poster .tree-foliage, #poster .sapwood { transition: none; }
}

/* 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; }
