/* Halawi Film Atlas v2.2.0. Solid Halawi accents, neutral light mode, true neutral dark mode. */
:root {
  --purple: #9437FF; --magenta: #BF52B0; --coral: #E96D5C;
  --bg: #F3F3F5; --panel: #FFFFFF; --panel2: #F7F7F8; --raised: #FFFFFF; --hover: rgba(0,0,0,.045); --press: rgba(0,0,0,.08);
  --line: #E4E4E8; --line2: #D2D2D8; --text: #141417; --mute: #585861; --faint: #8B8B94;
  --accent: #9437FF; --accent-text: #7E22E8; --accent-soft: rgba(148,55,255,.09); --accent-line: rgba(148,55,255,.45);
  --ok: #17804A; --warn: #B4610F; --no: #8B8B94;
  --shadow: 0 1px 2px rgba(16,16,24,.05), 0 2px 10px rgba(16,16,24,.05);
  --pop: 0 16px 48px rgba(16,16,24,.18), 0 0 0 1px rgba(16,16,24,.07);
  --glass: rgba(255,255,255,.86);
  --r: 12px; --ease: cubic-bezier(.2,.8,.2,1);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bar: 58px;
}
[data-theme="dark"] {
  --bg: #0B0B0B; --panel: #141414; --panel2: #191919; --raised: #1E1E1E; --hover: rgba(255,255,255,.06); --press: rgba(255,255,255,.1);
  --line: #242424; --line2: #333333; --text: #ECECEC; --mute: #A6A6A6; --faint: #727272;
  --accent-text: #B987FF; --accent-soft: rgba(148,55,255,.16); --accent-line: rgba(148,55,255,.65);
  --ok: #4BC384; --warn: #E6A456; --no: #7A7A7A;
  --shadow: 0 1px 2px rgba(0,0,0,.6);
  --pop: 0 18px 50px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08);
  --glass: rgba(22,22,22,.88);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: rgba(148,55,255,.28); }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.012em; }
p { margin: 0; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.ic.sm { width: 14px; height: 14px; }
.mute { color: var(--mute); } .faint { color: var(--faint); }
kbd { font: 600 10.5px/1 var(--font); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line2); color: var(--mute); background: var(--panel2); }

/* App bar */
.appbar { height: var(--bar); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 40; }
.brand { line-height: 0; flex: none; padding: 4px; border-radius: 8px; }
.brand img { height: 24px; width: auto; display: block; }
.product { font-weight: 650; font-size: 15px; white-space: nowrap; padding: 0 14px 0 12px; border-left: 1px solid var(--line2); line-height: 22px; }
.mainnav { display: flex; gap: 2px; align-items: center; min-width: 0; }
.mainnav a { position: relative; padding: 7px 11px; border-radius: 8px; color: var(--mute); font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
.mainnav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.mainnav a.on { color: var(--text); }
.mainnav a.on::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -11px; height: 2px; border-radius: 2px; background: var(--purple); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.searchbtn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 11px; min-width: 300px; border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; color: var(--faint); text-align: left; transition: border-color .15s; }
.searchbtn:hover { border-color: var(--line2); color: var(--mute); }
.sb-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chipbtn { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 9px 0 10px; border: 1px solid var(--line); background: transparent; border-radius: 10px; font-weight: 550; white-space: nowrap; }
.chipbtn:hover { background: var(--hover); }
.chipbtn #homeLabel { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; background: transparent; border-radius: 10px; color: var(--text); }
.iconbtn:hover { background: var(--hover); text-decoration: none; }
.badge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }

main { position: relative; height: calc(100% - var(--bar)); }
.view { position: absolute; inset: 0; display: none; }
.view.on { display: block; }
.page { overflow-y: auto; overflow-x: hidden; }
.wrap-page { max-width: 1240px; margin: 0 auto; padding: 28px 28px 80px; }

/* Map view */
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map.drag { cursor: grabbing; }
#map.pointer { cursor: pointer; }
.mapui { position: absolute; inset: 0; pointer-events: none; }
.mapui > * { pointer-events: auto; }
.mpanel { position: absolute; top: 14px; left: 14px; width: 272px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mp-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: none; border: 0; font-weight: 650; text-align: left; }
.mp-sum { flex: 1; color: var(--mute); font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpanel.closed .mp-body { display: none; } .mpanel.closed .chev { transform: rotate(-90deg); }
.mp-body { padding: 0 12px 12px; max-height: calc(100vh - 170px); overflow-y: auto; }
.mp-sec { padding-top: 10px; }
.mp-sec + .mp-sec { border-top: 1px solid var(--line); margin-top: 10px; }
.mp-label { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
.layerlist { display: grid; gap: 2px; }
.layerlist button { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--mute); font-weight: 520; }
.layerlist button:hover { background: var(--hover); color: var(--text); }
.layerlist button.on { background: var(--accent-soft); color: var(--text); }
.layerlist .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line2); flex: none; }
.layerlist button.on .dot { border-color: var(--purple); background: var(--purple); }
.layerlist .sub { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1 1 auto; border: 0; background: none; padding: 5px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 560; color: var(--mute); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
.toggles { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.mpanel .toggles { flex-direction: column; align-items: flex-start; gap: 8px; }
.tg { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 520; color: var(--mute); user-select: none; }
.tg input { display: none; }
.tg span { width: 28px; height: 16px; border-radius: 8px; background: var(--line2); position: relative; transition: background .15s; }
.tg span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); }
.tg input:checked + span { background: var(--purple); }
.tg input:checked + span::after { transform: translateX(12px); }
.legend { position: absolute; left: 14px; bottom: 14px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow); min-width: 220px; max-width: 320px; font-size: 12px; }
.legend h4 { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.legend .lg-sub { color: var(--faint); font-size: 11.5px; margin-bottom: 8px; }
.lg-ramp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.lg-ramp i { flex: 1; }
.lg-ticks { display: flex; justify-content: space-between; color: var(--mute); margin-top: 4px; font-variant-numeric: tabular-nums; }
.lg-cats { display: grid; gap: 4px; }
.lg-cats div { display: flex; align-items: center; gap: 8px; color: var(--mute); }
.lg-cats i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.zoomctl { position: absolute; right: 14px; bottom: 14px; display: grid; background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 3px; }
.zoomctl .iconbtn { width: 34px; height: 34px; border-radius: 8px; }
.attrib { position: absolute; right: 64px; bottom: 16px; font-size: 11px; color: var(--faint); pointer-events: none; }

/* Hover card */
.hovercard { position: absolute; width: 320px; pointer-events: none; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--pop); padding: 14px 15px 12px; z-index: 20; }
.hc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hc-name { font-size: 16px; font-weight: 700; }
.hc-region { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.hc-names { color: var(--accent-text); font-size: 12.5px; font-weight: 560; margin-top: 1px; }
.hc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 11px 0 10px; background: var(--line); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.hc-stats div { background: var(--panel2); padding: 7px 8px; }
.hc-stats b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-stats span { display: block; font-size: 10.5px; color: var(--faint); line-height: 1.3; }
.hc-row { display: grid; grid-template-columns: 76px 1fr; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.hc-row dt { color: var(--faint); }
.hc-row dd { margin: 0; color: var(--text); }
.hc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.hc-foot { margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 560; background: var(--panel2); border: 1px solid var(--line); color: var(--mute); white-space: nowrap; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.no { color: var(--no); }
.chip.acc { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }

/* Quick view panel */
.quick { position: absolute; top: 14px; right: 14px; bottom: 14px; width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--pop); display: flex; flex-direction: column; overflow: hidden; z-index: 25; }
.q-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.q-head .row { display: flex; align-items: flex-start; gap: 8px; }
.q-head h2 { font-size: 20px; }
.q-body { overflow-y: auto; padding: 14px 16px 16px; flex: 1; }
.q-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.q-sec { margin-top: 16px; }
.q-sec h4 { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 650; margin-bottom: 6px; }
.q-sec ul { margin: 0; padding: 0; list-style: none; }
.q-sec li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.q-sec li:last-child { border-bottom: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel); font-weight: 580; white-space: nowrap; color: var(--text); }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn.primary:hover { background: #8327EE; }
.btn.on { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn .ic { width: 16px; height: 16px; }

/* Page headers */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.ph h1 { font-size: 28px; font-weight: 720; }
.ph p { color: var(--mute); margin-top: 4px; max-width: 720px; }
.eyebrow { font-size: 11.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.field { height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel); min-width: 0; }
.field:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
select.field { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.count { color: var(--faint); font-size: 13px; }

/* Countries grid */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ccard { padding: 15px 15px 13px; display: flex; flex-direction: column; gap: 8px; color: var(--text); transition: border-color .15s, transform .15s var(--ease); }
.ccard:hover { border-color: var(--accent-line); text-decoration: none; transform: translateY(-1px); }
.ccard .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ccard h3 { font-size: 16px; }
.ccard .nm { color: var(--accent-text); font-size: 12.5px; font-weight: 560; }
.ccard .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ccard .kv b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.ccard .kv span { font-size: 11px; color: var(--faint); }
.ccard .chips { display: flex; gap: 5px; flex-wrap: wrap; }

/* Profile */
.prof { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; }
.p-hero .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.toc { position: sticky; top: 24px; align-self: start; display: grid; gap: 1px; }
.toc a { padding: 6px 10px; border-radius: 7px; color: var(--mute); font-size: 13px; font-weight: 520; border-left: 2px solid transparent; }
.toc a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.toc a.on { color: var(--text); border-left-color: var(--purple); background: var(--hover); border-radius: 0 7px 7px 0; }
.p-hero { padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.p-hero h1 { font-size: 34px; font-weight: 740; }
.p-hero .nm { color: var(--accent-text); font-weight: 600; margin-top: 2px; }
.p-hero .lead { color: var(--mute); margin-top: 10px; max-width: 820px; font-size: 14.5px; }
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); font-size: 13px; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 18px; }
.tile { padding: 11px 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; }
.tile .k { font-size: 11.5px; color: var(--faint); }
.tile .v { font-size: 16px; font-weight: 680; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tile .y { font-size: 11px; color: var(--faint); margin-top: 2px; }
.psec { padding: 26px 0 6px; scroll-margin-top: 10px; }
.psec > h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.psec > .sd { color: var(--mute); margin-bottom: 14px; font-size: 13.5px; }
.sub-h { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 18px 0 8px; }
.orgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.org { display: block; padding: 11px 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; color: var(--text); transition: border-color .15s; }
.org:hover { border-color: var(--accent-line); text-decoration: none; }
.org .on { font-weight: 620; display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }
.org .on .ic { width: 14px; height: 14px; color: var(--faint); margin-top: 3px; }
.org .or { color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.org .od { color: var(--faint); font-size: 11.5px; margin-top: 4px; word-break: break-all; }
.na { color: var(--faint); font-style: italic; font-size: 13px; padding: 4px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.fact { padding: 13px 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; }
.fact h4 { font-size: 13px; font-weight: 650; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.fact p, .fact li { font-size: 13.5px; color: var(--mute); }
.fact .src, .srcline { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.fact .src a, .srcline a { color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
.fact .src a:hover, .srcline a:hover { color: var(--accent-text); }
.fact ul { margin: 4px 0 0; padding-left: 18px; }
.stats { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stats td, .stats th { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.stats tr:last-child td { border-bottom: 0; }
.stats th { font-size: 11.5px; color: var(--faint); font-weight: 600; background: var(--panel2); }
.stats td:first-child { color: var(--mute); width: 34%; }
.stats .yr { color: var(--faint); white-space: nowrap; }
.homebox { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.homebox .k { font-size: 11.5px; color: var(--mute); }
.homebox .v { font-weight: 650; margin-top: 2px; }
.treaties { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 16px; font-size: 13.5px; color: var(--mute); }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--purple); }
.timeline b { color: var(--text); }
.srclist { margin: 0; padding-left: 20px; font-size: 12.5px; color: var(--mute); columns: 2; column-gap: 28px; }
.srclist li { break-inside: avoid; padding: 2px 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; }
.regtbl td:first-child { width: 24%; }

/* Planner */
.plan { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { padding: 16px; position: sticky; top: 0; display: grid; gap: 16px; }
.filters label.fl { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--mute); }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--purple); margin-top: 3px; }
.range { accent-color: var(--purple); width: 100%; }
.results { display: grid; gap: 10px; }
.res { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.res h3 { font-size: 16px; }
.res .meta { color: var(--mute); font-size: 13px; }
.res .why { display: flex; flex-wrap: wrap; gap: 5px; grid-column: 1 / -1; }
.res .acts { display: flex; gap: 6px; align-items: start; }
.score { font-size: 12px; font-weight: 650; color: var(--accent-text); }

/* Compare */
.cmp-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cmp { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
.cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp thead th { position: sticky; top: 0; background: var(--panel2); font-size: 15px; }
.cmp tbody th { width: 170px; color: var(--mute); font-weight: 560; background: var(--panel2); font-size: 12.5px; }
.cmp .grp th { background: var(--panel); color: var(--accent-text); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; padding-top: 14px; }
.cmp td.best { color: var(--accent-text); font-weight: 650; }

/* Directory */
.dtbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dtbl th, .dtbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dtbl th { font-size: 11.5px; color: var(--faint); font-weight: 600; position: sticky; top: 0; background: var(--panel2); z-index: 1; }
.dtbl td.n { font-weight: 600; }
.dtbl td .u { display: block; font-size: 11.5px; color: var(--faint); font-weight: 400; word-break: break-all; }
.facets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.facet { border: 1px solid var(--line); background: var(--panel); padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 560; color: var(--mute); }
.facet:hover { color: var(--text); }
.facet.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.facet .n { opacity: .65; margin-left: 4px; }
.more-row { text-align: center; padding: 14px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.mon { padding: 14px; }
.mon.now { border-color: var(--accent-line); }
.mon h3 { font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mon h3 span { font-size: 12px; color: var(--faint); font-weight: 500; }
.ev { display: grid; grid-template-columns: 8px 1fr; gap: 9px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ev i { width: 8px; height: 8px; border-radius: 2px; margin-top: 6px; }
.ev .c { color: var(--faint); font-size: 12px; }
.ev a { color: var(--text); font-weight: 580; }

/* Learn */
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.nick { padding: 13px 14px; }
.nick b { font-size: 16px; color: var(--accent-text); }
.nick .ind { font-weight: 600; font-size: 13px; }
.nick p { font-size: 12.5px; color: var(--mute); margin-top: 4px; }
.gloss { display: grid; gap: 10px; }
.gloss .fact h4 { font-size: 15px; }

/* Saved */
.svtbl td, .svtbl th { white-space: normal; }

/* Palette and dialogs */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding-top: 10vh; }
.palette { width: min(640px, calc(100vw - 24px)); background: var(--raised); border-radius: 14px; box-shadow: var(--pop); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pal-in input { flex: 1; border: 0; background: none; height: 52px; font-size: 16px; outline: none; }
.pal-res { overflow-y: auto; padding: 6px; }
.pal-g { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.pal-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pal-i .t { font-weight: 580; }
.pal-i .s { color: var(--faint); font-size: 12.5px; margin-left: auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pal-i.sel { background: var(--accent-soft); }
.pal-i .tag { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--panel2); color: var(--mute); border: 1px solid var(--line); flex: none; }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.pal-empty { padding: 26px; text-align: center; color: var(--faint); }
.dialog { width: min(460px, calc(100vw - 24px)); background: var(--raised); border-radius: 14px; box-shadow: var(--pop); padding: 18px; display: grid; gap: 12px; max-height: 76vh; grid-template-rows: auto auto minmax(0, 1fr); }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; }
.dlg-head h3 { font-size: 17px; }
.dlg-head p { font-size: 13px; margin-top: 2px; }
.homelist { overflow-y: auto; display: grid; gap: 1px; }
.homelist button { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; }
.homelist button:hover { background: var(--hover); }
.homelist button.on { background: var(--accent-soft); font-weight: 650; }
.homelist .r { color: var(--faint); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-weight: 560; z-index: 120; box-shadow: var(--pop); }

/* Mobile tab bar and sheet */
.tabbar { display: none; }
.sheet { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; }
.sheet-card { width: 100%; background: var(--panel); border-radius: 16px 16px 0 0; padding: 10px 10px calc(70px + env(safe-area-inset-bottom)); display: grid; gap: 2px; }
.sheet-card a { display: flex; gap: 12px; align-items: center; padding: 13px 12px; border-radius: 10px; color: var(--text); font-weight: 560; }
.sheet-card a:hover { background: var(--hover); text-decoration: none; }

@media (max-width: 1280px) { .searchbtn { min-width: 0; } .sb-label { display: none; } .searchbtn { width: 36px; padding: 0; justify-content: center; } .sb-kbd { display: none; } }
@media (max-width: 1020px) {
  .product { display: none; }
  .mainnav a { padding: 7px 8px; }
  .prof { grid-template-columns: minmax(0, 1fr); } .toc { display: none; }
  .plan { grid-template-columns: 1fr; } .filters { position: static; }
}
@media (max-width: 820px) {
  :root { --bar: 52px; }
  .appbar { padding: 0 10px; gap: 6px; }
  .mainnav { display: none; }
  .product { display: block; font-size: 14px; padding: 0 0 0 10px; }
  .chipbtn #homeLabel { max-width: 84px; }
  .chipbtn .ic.sm, #savedBtn { display: none; }
  .appbar { overflow: hidden; }
  main { height: calc(100% - var(--bar) - 60px - env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); z-index: 95; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 580; color: var(--faint); border: 0; background: none; }
  .tabbar a.on, .tabbar button.on { color: var(--accent-text); }
  .tabbar a:hover { text-decoration: none; }
  .wrap-page { padding: 18px 14px 40px; }
  .ph h1 { font-size: 23px; } .p-hero h1 { font-size: 27px; }
  .mpanel { top: 10px; left: 10px; right: 10px; width: auto; }
  .mpanel .mp-body { max-height: 52vh; }
  .legend { left: 10px; bottom: 10px; min-width: 200px; max-width: calc(100vw - 80px); padding: 8px 10px; }
  .stats { display: block; overflow-x: auto; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 15px; word-break: break-word; }
  .zoomctl { right: 10px; bottom: 10px; }
  .quick { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72%; border-radius: 16px 16px 0 0; }
  .hovercard { display: none !important; }
  .srclist { columns: 1; }
  .orgs, .facts { grid-template-columns: 1fr; }
  .dtbl .hide-m { display: none; }
}
@media (max-width: 380px) { .product { display: none !important; } }

@media print {
  body { overflow: visible; background: #fff; color: #000; }
  .appbar, .tabbar, .toc, .noprint, .backlink, .overlay, .sheet, .toast { display: none !important; }
  main { height: auto; } .view { position: static; } .page { overflow: visible; }
  .view:not(.on) { display: none !important; }
  .wrap-page { max-width: none; padding: 0; }
  .prof { display: block; }
  .card, .org, .fact, .tile, .stats { box-shadow: none; border-color: #ccc; background: #fff; }
  a { color: #000; }
  .org .od { color: #444; }
  .psec { break-inside: auto; }
}

/* v2.1: style popover (bottom right, beside zoom) */
.zoomstack { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.stylepop-wrap { position: relative; }
.stylebtn { width: 40px; height: 40px; border-radius: 10px; background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); display: grid; place-items: center; }
.stylebtn.on, .stylebtn[aria-expanded="true"] { border-color: var(--purple); color: var(--accent-text); }
.stylepop { position: absolute; right: 0; bottom: 48px; width: 280px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop); padding: 12px; z-index: 40; }
.stylepop[hidden] { display: none; }
.stylepop h4 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.stylepop .proj-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.stylepop .proj-thumbs button { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 8px 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; color: var(--mute); font-size: 11px; font-weight: 600; }
.stylepop .proj-thumbs button.on { border-color: var(--purple); color: var(--text); background: var(--accent-soft); }
.stylepop .proj-thumbs svg { width: 72px; height: 40px; }
.stylepop .seg { margin-bottom: 10px; flex-wrap: wrap; }
.stylepop .tgrow { display: flex; flex-direction: column; gap: 6px; }
.zoomctl { position: static; }

/* Studio listing CTA */
.studio-cta { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 12px; }
.studio-cta p { margin: 0; font-size: 13.5px; color: var(--text); }
.studio-cta p + p { margin-top: 8px; }
.studio-cta a { font-weight: 650; }

/* Filmmaker help */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.help-card { padding: 14px; }
.help-card h3 { font-size: 14px; margin: 0 0 6px; }
.help-card p { font-size: 13px; color: var(--mute); }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--faint); margin-bottom: 14px; }
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }

/* Learn redesign */
.learn-hero { display: grid; gap: 8px; margin-bottom: 22px; }
.learn-lead { font-size: 16px; color: var(--mute); max-width: 62ch; }
.learn-search { display: flex; gap: 8px; margin: 16px 0 22px; }
.learn-search input { flex: 1; min-width: 0; }
.learn-sec { margin-bottom: 36px; }
.learn-sec > h2 { font-size: 22px; margin: 0 0 6px; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.nick-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; min-height: 0; color: var(--text); text-decoration: none; overflow: visible; }
a.nick-card:hover { text-decoration: none; border-color: var(--accent-line); }
.nick-card .kicker { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nick-card h3 { font-size: 20px; margin: 0; color: var(--accent-text); line-height: 1.15; }
.nick-card .ind { font-weight: 600; font-size: 13.5px; color: var(--text); }
.nick-card p { font-size: 13px; color: var(--mute); margin: 0; flex: 1; }
.nick-card .soon { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--mute); border: 1px solid var(--line); width: fit-content; }
.gloss-list { display: grid; gap: 12px; }
.gloss-item { padding: 16px 18px; }
.gloss-item h3 { font-size: 17px; margin: 0 0 6px; }
.gloss-item p { margin: 0; color: var(--mute); font-size: 14px; }

/* Related / region lists */
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.rel-card { padding: 14px; color: var(--text); }
.rel-card:hover { text-decoration: none; border-color: var(--accent-line); }
.rel-card h3 { margin: 0 0 4px; font-size: 16px; }
.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.subnav a { font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--mute); }
.subnav a:hover, .subnav a.on { text-decoration: none; border-color: var(--purple); color: var(--text); background: var(--accent-soft); }


/* Footer */
.sitefoot {
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 13.5px;
  flex: none;
}
.foot-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 28px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px 28px;
  align-items: start;
}
.foot-logo { display: inline-block; line-height: 0; }
.foot-logo img { height: 26px; width: auto; display: block; }
.foot-blurb { margin-top: 12px; max-width: 28ch; color: var(--mute); line-height: 1.55; }
.foot-made { margin-top: 10px; font-weight: 650; color: var(--text); }
.foot-col h2 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-col a, .sitefoot a { color: var(--text); font-weight: 550; }
.foot-col a:hover, .sitefoot a:hover { color: var(--accent-text); text-decoration: none; }
.foot-bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12.5px;
}
.sitefoot-compact { padding: 0; }
.foot-compact {
  display: flex;
  align-items: center;
  gap: 16px 22px;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  min-height: 48px;
}
.foot-compact p { margin: 0; color: var(--mute); font-weight: 550; }
.foot-compact nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-left: auto; }
.foot-compact nav a { color: var(--text); font-weight: 550; }

body.page-doc { overflow: auto; height: auto; min-height: 100%; display: flex; flex-direction: column; }
body.page-doc main { height: auto; flex: 1 0 auto; position: relative; }
body.page-doc .view { position: static; display: block; overflow: visible; }
body.page-doc .view.page { overflow: visible; }

body.map-doc { overflow: hidden; display: flex; flex-direction: column; height: 100%; }
body.map-doc main { flex: 1 1 auto; height: auto; min-height: 0; position: relative; }
body.map-doc .sitefoot-compact { flex: 0 0 auto; }

@media (max-width: 820px) {
  .foot-inner { grid-template-columns: 1fr 1fr; padding: 28px 16px 16px; gap: 24px 20px; }
  .foot-blurb { max-width: none; }
  .foot-bar { padding: 12px 16px 16px; }
  body.page-doc .sitefoot { padding-bottom: calc(8px + 60px + env(safe-area-inset-bottom)); }
  body.map-doc { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .foot-compact { padding: 10px 16px; }
  .foot-compact nav { margin-left: 0; width: 100%; }
}
@media (max-width: 520px) {
  .foot-inner { grid-template-columns: 1fr; }
  .foot-bar { flex-direction: column; gap: 4px; }
}
