/* fonts: data/fonts.css (inlined, works from file://) */

:root {
  --bg: #0b1015;
  --panel: rgba(15, 21, 27, 0.84);
  --panel-line: rgba(255, 255, 255, 0.08);
  --ink: #efe7d4;
  --ink-soft: rgba(239, 231, 212, 0.72);
  --ink-mute: rgba(239, 231, 212, 0.48);
  --accent: #e3c58a;
  --hover: rgba(255, 255, 255, 0.05);
  --serif: 'EB Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; }
#app { position: fixed; inset: 0; }
#gl, #ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { cursor: grab; }
#gl.dragging { cursor: grabbing; }
#ov { pointer-events: none; }

.title { position: absolute; top: 22px; left: 28px; pointer-events: none; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }
.kicker { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-mute); font-weight: 600; }
.title h1 { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1; margin: 8px 0 4px; letter-spacing: 0.005em; }
.title h1 em { font-style: italic; font-weight: 400; color: var(--ink-soft); }
.subtitle { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ink-soft); transition: opacity 0.3s; }

.panel { position: absolute; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 8px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; color: var(--ink-soft); }
.muted { color: var(--ink-mute); }
.small { font-size: 10px; letter-spacing: 0.08em; text-transform: none; font-weight: 500; }

/* legend */
.legend { left: 18px; top: 150px; width: 296px; max-height: calc(100vh - 210px); overflow-y: auto; scrollbar-width: thin; }
.legend ul { list-style: none; margin: 0; padding: 0 6px 6px; }
.lg-row { border-radius: 9px; }
.lg-main { display: grid; grid-template-columns: 14px 1fr auto 22px; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; cursor: pointer; border-radius: 9px; }
.lg-main:hover { background: var(--hover); }
.lg-row.focus > .lg-main { background: rgba(255, 255, 255, 0.08); }
.dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset; }
.lg-name { font-size: 14px; font-weight: 500; }
.lg-pct { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-soft); }
.lg-bar { grid-column: 2 / 4; height: 2px; background: rgba(255, 255, 255, 0.06); border-radius: 2px; overflow: hidden; margin-top: -2px; }
.lg-bar i { display: block; height: 100%; opacity: 0.85; transition: width 0.6s; }
.chev { width: 22px; height: 22px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--ink-mute); display: grid; place-items: center; transition: transform 0.25s, background 0.2s; }
.chev:hover { background: var(--hover); color: var(--ink); }
.lg-row.open .chev { transform: rotate(90deg); }
.lg-subs { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.lg-row.open .lg-subs { grid-template-rows: 1fr; }
.lg-subs > div { overflow: hidden; }
.lg-sub { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 5px 10px 5px 32px; font-size: 13px; color: var(--ink-soft); cursor: pointer; border-radius: 8px; }
.lg-sub:hover { background: var(--hover); color: var(--ink); }
.lg-sub.focus { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.lg-sub .dot { width: 9px; height: 9px; }
.lg-sub.nomap { cursor: default; padding-left: 52px; grid-template-columns: 1fr; font-size: 12px; color: var(--ink-mute); }
.lg-sub.nomap:hover { background: none; color: var(--ink-mute); }
.legend-foot { padding: 8px 16px 14px; font-size: 11.5px; line-height: 1.45; color: var(--ink-mute); border-top: 1px solid var(--panel-line); }
.legend-foot .hatch { display: inline-block; width: 22px; height: 12px; vertical-align: -2px; margin-right: 6px; border-radius: 3px; }
.ramp { height: 8px; border-radius: 4px; margin: 6px 0 3px; }
.ramp-scale { display: flex; justify-content: space-between; font-size: 10.5px; }

/* controls */
.controls { right: 18px; top: 18px; width: 252px; padding: 12px 14px 10px; }
.ctl { margin-bottom: 10px; }
.ctl-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); font-weight: 600; margin-bottom: 5px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(0, 0, 0, 0.28); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--ink-soft); transition: background 0.2s, color 0.2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: rgba(255, 255, 255, 0.1); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.toggles { border-top: 1px solid var(--panel-line); padding-top: 9px; display: grid; gap: 6px; }
.toggles label { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.toggles input { appearance: none; width: 28px; height: 16px; border-radius: 9px; background: rgba(255, 255, 255, 0.12); position: relative; cursor: pointer; transition: background 0.2s; margin: 0; flex: none; }
.toggles input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #cfc7b5; transition: transform 0.2s; }
.toggles input:checked { background: rgba(227, 197, 138, 0.6); }
.toggles input:checked::after { transform: translateX(12px); background: #fff6e2; }

/* drawer */
.drawer { position: absolute; right: 18px; top: 286px; width: 340px; max-height: calc(100vh - 286px - 170px); overflow-y: auto; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); padding: 18px 18px 16px; transform: translateX(calc(100% + 30px)); opacity: 0; transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), opacity 0.3s; scrollbar-width: thin; }
.drawer.open { transform: none; opacity: 1; }
.drawer .close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: var(--ink-mute); font-size: 20px; cursor: pointer; }
.drawer .close:hover { background: var(--hover); color: var(--ink); }
.d-kicker { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.d-title { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.05; margin: 6px 0 2px; padding-right: 24px; }
.d-sub { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--ink-soft); }
.d-text { font-family: var(--serif); font-size: 16.5px; line-height: 1.45; color: rgba(239, 231, 212, 0.9); margin: 12px 0; }
.d-stats { display: flex; gap: 22px; margin: 12px 0 4px; }
.d-stat b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.d-stat span { font-size: 11px; color: var(--ink-mute); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; margin: 10px 0 6px; }
.facts dt { color: var(--ink-mute); }
.facts dd { margin: 0; color: var(--ink); }
.d-section { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); font-weight: 600; margin: 16px 0 8px; }
details.subg { border-top: 1px solid var(--panel-line); padding: 2px 0; }
details.subg summary { list-style: none; display: grid; grid-template-columns: 10px 1fr auto 12px; gap: 10px; align-items: center; padding: 8px 2px; cursor: pointer; font-size: 13.5px; }
details.subg summary::-webkit-details-marker { display: none; }
details.subg summary::after { content: '›'; color: var(--ink-mute); transition: transform 0.2s; }
details.subg[open] summary::after { transform: rotate(90deg); }
details.subg summary .dot { width: 9px; height: 9px; }
details.subg p { margin: 0 0 10px 20px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.more { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); color: var(--ink-soft); }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 12px 0 10px; background: rgba(255, 255, 255, 0.05); }
.stack i { display: block; height: 100%; transition: width 0.5s; }
.comp { display: grid; grid-template-columns: 10px 1fr auto; gap: 6px 10px; align-items: center; font-size: 13px; }
.comp .v { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.comp .dot { width: 9px; height: 9px; }
.comp .indent { padding-left: 14px; color: var(--ink-soft); font-size: 12.5px; }
.note { font-size: 11.5px; color: var(--ink-mute); line-height: 1.45; margin-top: 12px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 12.5px; }
.sources li { font-size: 12.5px; line-height: 1.45; margin-bottom: 6px; color: var(--ink-soft); }
.sources a { color: var(--accent); }

/* misc */
.zoom { position: absolute; right: 18px; bottom: 46px; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 4px; backdrop-filter: blur(14px); }
.zoom button { width: 34px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 17px; color: var(--ink-soft); }
.zoom button:hover { background: var(--hover); color: var(--ink); }
.credits { position: absolute; left: 22px; bottom: 14px; font-size: 11px; color: var(--ink-mute); display: flex; gap: 14px; align-items: center; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.credits button { background: none; border: 0; color: var(--ink-soft); cursor: pointer; padding: 0; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(239, 231, 212, 0.3); }
.tip { position: absolute; pointer-events: none; background: rgba(12, 17, 22, 0.94); border: 1px solid var(--panel-line); border-radius: 10px; padding: 9px 11px; font-size: 12px; min-width: 170px; opacity: 0; transition: opacity 0.12s; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); z-index: 5; }
.tip.on { opacity: 1; }
.tip b { font-family: var(--serif); font-size: 16px; font-weight: 500; display: block; }
.tip .r { color: var(--ink-mute); font-size: 11px; margin-bottom: 6px; }
.tip .row { display: grid; grid-template-columns: 9px 1fr auto; gap: 7px; align-items: center; margin-top: 3px; }
.tip .row .dot { width: 8px; height: 8px; }
.tip .row span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); color: var(--ink-soft); font-family: var(--serif); font-style: italic; font-size: 18px; transition: opacity 0.6s; z-index: 10; }
.loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(227, 197, 138, 0.2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .title h1 { font-size: 32px; }
  .legend { top: auto; bottom: 40px; left: 10px; width: calc(100% - 80px); max-height: 38vh; }
  .controls { right: 10px; top: 10px; width: 200px; }
  .drawer { right: 10px; left: 10px; width: auto; top: auto; bottom: 40px; max-height: 60vh; }
  .zoom { right: 10px; bottom: 40px; }
  .credits span { display: none; }
}
