/* Switzer by Indian Type Foundry, from fontshare.com */
@font-face { font-family: "Switzer"; src: url("fonts/switzer-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("fonts/switzer-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("fonts/switzer-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("fonts/switzer-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  color-scheme: dark;
  --bg: #050506;
  --ink: #eef0f2;
  --muted: #8d9096;
  --glass: rgba(18, 19, 21, .94);
  --line: rgba(255, 255, 255, .1);
  --accent: #7cc7ff;
  --font: "Switzer", system-ui, sans-serif;   /* the one typeface; the fallback shows only if it cannot load */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --panel: clamp(360px, 31vw, 460px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
body { background: radial-gradient(110% 90% at 52% 44%, #111215 0%, var(--bg) 66%); }
#web { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#web.dragging { cursor: grabbing; }
#web.pointing { cursor: pointer; }

button, input { font: inherit; color: inherit; }
button {
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
  transition: transform .25s var(--ease), background .2s, border-color .2s, box-shadow .25s;
}
button:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(255,255,255,.28); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
button:active:not(:disabled) { transform: scale(.95); }
button:disabled { opacity: .35; cursor: default; }
button[aria-pressed="true"] { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top {
  position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 20px; align-items: flex-start;
  padding: 18px 20px; pointer-events: none; animation: drop .8s var(--ease) both;
}
.top > * { pointer-events: auto; }
.brand h1 { font: 600 26px/1.1 var(--font); letter-spacing: -.01em; }
.brand p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.search { position: relative; display: flex; align-items: center; margin-left: 8px; }
.search-toggle { position: relative; z-index: 1; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; flex: none; }
.search input#search {
  width: 0; margin-left: 0; padding: 9px 0; opacity: 0; pointer-events: none; border-width: 0;
  transition: width .45s var(--ease), margin .45s var(--ease), padding .45s var(--ease), opacity .25s, box-shadow .25s;
}
.search.open input#search { width: min(280px, calc(100vw - 90px)); margin-left: 8px; padding: 9px 16px; opacity: 1; pointer-events: auto; border-width: 1px; }
.search .results { left: 48px; width: min(300px, calc(100vw - 90px)); right: auto; }
.search input, .path input {
  width: 100%; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
 transition: border-color .2s, box-shadow .25s;
}
.search input:focus, .path input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124,199,255,.18); }
.results {
  position: absolute; z-index: 5; top: calc(100% + 8px); left: 0; right: 0; list-style: none; max-height: 320px; overflow: auto;
  background: #121316; border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.5);
  animation: pop .25s var(--ease);
}
.results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.results li.active, .results li:hover { background: rgba(255,255,255,.09); }
.results small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #cfd2d8; flex: none; }
.dot.learned { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.legend {
  position: fixed; left: 14px; top: 92px; bottom: 92px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; scrollbar-width: none;
}
.legend button {
  display: flex; align-items: center; gap: 10px; border-color: transparent; background: transparent;
 color: var(--muted); font-size: 12.5px; padding: 3px 12px 3px 9px; min-height: 26px; text-align: left; flex: none;
  animation: slide-in .6s var(--ease) both; animation-delay: calc(var(--n) * 45ms + .5s);
}
.legend button:hover:not(:disabled) { color: var(--ink); transform: translateX(4px); background: var(--glass); }
.legend button[aria-pressed="true"] { color: var(--accent); background: var(--glass); border-color: rgba(124,199,255,.5); }
.legend p { flex: none; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8d9096; padding: 7px 12px 1px; }

.panel {
  position: fixed; top: 14px; right: 14px; bottom: 14px; width: var(--panel); display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;

  transform: translateX(calc(100% + 30px)); opacity: 0; visibility: hidden;
  transition: transform .55s var(--ease), opacity .35s, visibility 0s .55s;
}
.panel.open { transform: none; opacity: 1; visibility: visible; transition: transform .55s var(--ease), opacity .35s; }
.panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c, var(--accent)); box-shadow: 0 0 30px 6px var(--c, var(--accent)); transition: background .4s, box-shadow .4s; }
.panel-bar { display: flex; justify-content: space-between; padding: 14px 14px 0; }
.panel-body { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; padding: 16px 22px 28px; }
.panel-body > * { animation: rise .5s var(--ease) both; animation-delay: calc(var(--n, 0) * 55ms); }
.tag { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.panel h2 { font: 600 34px/1.12 var(--font); letter-spacing: -.015em; margin: 8px 0 12px; overflow-wrap: break-word; }
.def { font-size: 15.5px; line-height: 1.65; color: #dcdee2; }
.panel h3 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; font-weight: 600; }
.panel section p { font-size: 14px; line-height: 1.65; color: #d2d4d9; }
.panel section p.example { padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.055); border-left: 3px solid var(--c); }
.panel section p.mistake { padding: 12px 14px; border-radius: 12px; background: rgba(255,110,110,.09); border-left: 3px solid #ff6b6b; }
.demo { padding: 16px; border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid var(--line); text-align: center; overflow: hidden; }
.demo figcaption { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.links { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.links li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.links li > span { font-size: 12.5px; color: var(--muted); padding-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; font-size: 13px;
  background: rgba(255,255,255,.05); animation: pop .4s var(--ease) both; animation-delay: calc(var(--k) * 22ms + .2s);
}
.chip:hover { background: color-mix(in srgb, var(--c) 22%, transparent); border-color: var(--c); }
.chip.seen::after { content: "✓"; font-size: 10px; color: var(--muted); }
.path { position: relative; }
.path ul { position: static; margin-top: 8px; max-height: 220px; box-shadow: none; }
.trail { list-style: none; margin-top: 12px; }
.trail li { position: relative; padding: 0 0 10px 22px; animation: rise .45s var(--ease) both; animation-delay: calc(var(--k) * 90ms); }
.trail li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.trail li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: -3px; width: 1px; background: var(--line); }
.trail button { border: 0; background: none; padding: 0; border-radius: 4px; }

.dock { position: fixed; left: 50%; bottom: 18px; translate: -50% 0; display: flex; gap: 22px; white-space: nowrap; animation: rise .8s var(--ease) .6s both; transition: left .55s var(--ease); }
body.has-panel .dock { left: calc(50% - (var(--panel) + 14px) / 2); }
.progress { position: fixed; left: 20px; bottom: 20px; font-size: 12px; color: var(--muted); width: 150px; }
.bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .8s var(--ease); }

.tooltip {
  position: fixed; z-index: 6; pointer-events: none; max-width: 260px; padding: 10px 13px; border-radius: 12px;
  background: rgba(14,15,17,.95); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); animation: pop .2s var(--ease);
}
.tooltip b { display: block; color: var(--ink); font: 600 16px var(--font); margin-bottom: 2px; }
.hint { position: fixed; bottom: 68px; left: 50%; translate: -50% 0; color: var(--muted); font-size: 12.5px; text-align: center; width: max-content; max-width: 90vw; pointer-events: none; transition: opacity 1s; animation: fade 1s 1.4s both; }
.hint.gone { opacity: 0 !important; animation: none; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-18px); } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 1180px) and (min-width: 761px) {
  .progress { bottom: 68px; }
  .legend { bottom: 128px; }
}
.dock .group { display: flex; gap: 6px; }
#browse { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.legend small { font-size: 10.5px; color: var(--accent); border: 1px solid rgba(124,199,255,.4); border-radius: 99px; padding: 0 7px; line-height: 17px; }
.legend.more { -webkit-mask-image: linear-gradient(#000 calc(100% - 46px), transparent); mask-image: linear-gradient(#000 calc(100% - 46px), transparent); }
button.tag { background: none; border: 0; padding: 4px 0; min-height: 24px; }
button.tag:hover { color: var(--ink); text-decoration: underline; box-shadow: none; }
.panel-body > .jump { position: sticky; top: -16px; z-index: 2; display: flex; gap: 6px; margin: 14px -22px 0; padding: 8px 22px; background: rgba(18,19,21,.97); animation: none; }
.jump button { font-size: 12.5px; padding: 5px 12px; }
.progress span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; border: 1.5px solid var(--accent); }
@media (max-width: 760px) {
  .top { padding: 12px 14px; }
  .brand h1 { font-size: 20px; }
  .search { position: absolute; top: 12px; right: 14px; margin: 0; flex-direction: row-reverse; }
  .search.open input#search { margin: 0 8px 0 0; width: calc(100vw - 76px); background: #121316; }
  .search .results { left: auto; right: 0; width: calc(100vw - 28px); }
  .legend { top: auto; bottom: 66px; left: 10px; right: 10px; max-height: 56vh; padding: 10px; background: #121316; border: 1px solid var(--line); border-radius: 18px; z-index: 5; visibility: hidden; opacity: 0; translate: 0 14px; }
  body.browse .legend { visibility: visible; opacity: 1; translate: 0 0; }
  .legend button { min-height: 36px; font-size: 14px; }
  #browse { display: block; }
  .dock .label { display: none; }
  .dock { gap: 12px; }
  .dock button { min-width: 38px; min-height: 38px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 58%; transform: translateY(calc(100% + 30px)); z-index: 4; }
  .panel h2 { font-size: 27px; }
  .dock { bottom: 14px; max-width: calc(100vw - 12px); }
  .dock button { padding: 7px 9px; font-size: 14px; }
  .dock .group { gap: 4px; }
  body.has-panel .dock { left: 50%; }
  .progress, .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* On smaller desktop widths the open panel and its constellation need the legend's space. */
.legend { transition: opacity .4s, translate .55s var(--ease), visibility 0s; }
@media (min-width: 761px) and (max-width: 1700px) {
  body.has-panel .legend { opacity: 0; visibility: hidden; translate: -30px 0; transition: opacity .4s, translate .55s var(--ease), visibility 0s .5s; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  body.has-panel .dock button { padding: 7px 9px; font-size: 12px; }
  body.has-panel .progress { opacity: 0; }
}
/* Fade the tree out behind the side list so zoomed-in leaves never fight with it. */
@media (min-width: 761px) {
  #web { -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.1) 130px, #000 250px); mask-image: linear-gradient(90deg, rgba(0,0,0,.1) 130px, #000 250px); }
  body.has-panel #web { -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  body.has-panel .dock { gap: 8px; }
  body.has-panel .dock .label { display: none; }
}

/* While the tree is still growing, neither it nor its controls respond to the pointer. */
body.growing #web, body.growing .dock, body.growing .legend, body.growing .search { pointer-events: none; }
body.growing .dock button, body.growing .legend button, body.growing .search button { pointer-events: none; }

/* Switch for marking opened terms. */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.progress .switch { margin-top: 8px; padding: 4px 0; min-height: 28px; background: none; border: 0; border-radius: 6px; color: var(--muted); font-size: 12px; }
.progress .switch:hover { transform: none; box-shadow: none; color: var(--ink); }
.switch i { position: relative; width: 30px; height: 18px; flex: none; border-radius: 99px; background: rgba(255,255,255,.18); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: translate .25s var(--ease); }
.switch[aria-checked="true"] i { background: var(--accent); }
.switch[aria-checked="true"] i::after { translate: 12px 0; background: #050506; }
.legend .switch.in-sheet { display: none; }
body.no-marks .dot.learned { background: #cfd2d8; box-shadow: none; }
body.no-marks .chip.seen::after { content: none; }
body.no-marks .progress span::before { border-color: var(--muted); }
@media (max-width: 760px) { .legend .switch.in-sheet { display: flex; flex: none; min-height: 40px; margin-top: 6px; } }
@media (min-width: 761px) and (max-width: 1180px) {
  .progress { bottom: 68px; }
  .legend { bottom: 164px; }
}
@media (min-width: 1181px) { .legend { bottom: 104px; } }

/* Author credit under the title; the summary line heads the side list. */
.brand .credit { color: var(--muted); font-size: 12px; margin-top: 3px; }
.credit b { color: var(--ink); font-weight: 600; }
.legend p.summary { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; color: var(--ink); padding: 0 12px 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.loading { color: var(--muted); }

/* Solid panel: without the blur, anything behind it would show through. */
.panel { background: #121316; }
