/* SpotLite viewer: one dark look, on purpose. */
:root {
  --bg: #070b12;
  --glass: rgba(10, 15, 24, 0.78);
  --glass-strong: rgba(9, 13, 21, 0.93);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --text: #e8eef8;
  --text-2: #aab6c8;
  --muted: #7d8a9e;
  --dim: #56637a;
  --ident: #79c4ff;
  --dark: #ffb547;
  --det: #8fe3d0;
  --ais: #8d9db5;
  --accent: #79c4ff;
  --radius: 14px;
  --panel-w: 400px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 13px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font-family: inherit; }
#map { position: fixed; inset: 0; background: var(--bg); }
.maplibregl-canvas:focus { outline: none; }

/* ---- cards ------------------------------------------------------------- */
.card {
  position: fixed; z-index: 5;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
#hdr { top: 18px; left: 18px; width: 356px; padding: 16px 18px 14px; }
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--text-2);
}
.brand .mark { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
h1 { margin: 9px 0 2px; font-size: 21px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; }
.sub { color: var(--text-2); font-size: 12.5px; }
.sub span { display: block; }
.sub .sub2 { color: var(--muted); font-size: 12px; margin-top: 1px; }

.seg {
  display: flex; margin-top: 14px; padding: 3px; gap: 3px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.03);
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 500 12px/1 var(--font); padding: 8px 4px; border-radius: 7px;
  display: flex; justify-content: center; align-items: baseline; gap: 6px;
  transition: background .18s, color .18s;
}
.seg button b { font-weight: 600; color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.seg button[data-f="identified"] b { color: var(--ident); }
.seg button[data-f="dark"] b { color: var(--dark); }
.seg button[data-f="detected"] b { color: var(--det); }

.search { position: relative; margin-top: 10px; }
.search input {
  width: 100%; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--text); font: 13px var(--font); padding: 8px 10px 8px 31px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: rgba(121, 196, 255, 0.5); box-shadow: 0 0 0 3px rgba(121, 196, 255, 0.12); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search > svg { position: absolute; left: 10px; top: 9px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search ul {
  list-style: none; margin: 6px 0 0; padding: 4px; position: absolute; left: 0; right: 0; z-index: 3;
  background: var(--glass-strong); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 320px; overflow: auto;
}
.search li { padding: 6px 9px 7px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.search li:hover, .search li.on { background: rgba(255, 255, 255, 0.07); }
.search li .n { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search li .s { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search li .s i { font-style: normal; color: var(--c, var(--muted)); }

/* ---- tools ------------------------------------------------------------- */
#tools { position: fixed; top: 18px; right: 18px; z-index: 5; display: flex; gap: 8px; transition: right .38s var(--ease); }
.tool {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); color: var(--text-2); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.tool svg { width: 17px; height: 17px; }
.tool:hover { color: var(--text); border-color: var(--line-2); }
body.panel-open #tools { right: calc(var(--panel-w) + 18px); }

/* ---- legend ------------------------------------------------------------ */
#legend { left: 18px; bottom: 18px; width: 356px; padding: 12px 16px 13px; }
.lg-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); padding: 3px 0; }
.lg-row b { font-weight: 500; color: var(--text); }
.lg-row span { color: var(--muted); }
.sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 9px var(--c); flex: none; }
.sw.ring { background: transparent; border: 1.5px solid var(--c); box-shadow: none; }
.lg-hint { color: var(--dim); font-size: 11px; margin-top: 5px; line-height: 1.4; }
.toggles { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.toggles button {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer;
  font: 500 11.5px var(--font); padding: 6px 11px; border-radius: 999px; transition: all .15s;
}
.toggles button.on { color: var(--text); border-color: rgba(121, 196, 255, 0.45); background: rgba(121, 196, 255, 0.1); }
.toggles button:hover { color: var(--text); }

/* ---- scale + attribution ---------------------------------------------- */
.maplibregl-ctrl-bottom-right { right: 18px; bottom: 42px; transition: right .38s var(--ease); }
body.panel-open .maplibregl-ctrl-bottom-right, body.panel-open #attr { right: calc(var(--panel-w) + 18px); }
.maplibregl-ctrl-scale {
  background: transparent; border: 1px solid var(--dim); border-top: 0; color: var(--muted);
  font: 10.5px var(--font); padding: 1px 6px 0; box-sizing: border-box;
}
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0; }
#attr {
  position: fixed; right: 18px; bottom: 18px; z-index: 4; text-align: right;
  font-size: 10.5px; color: var(--dim); transition: right .38s var(--ease); white-space: nowrap; line-height: 1.4;
}
#attr a { color: inherit; text-decoration: none; }

/* ---- hint --------------------------------------------------------------- */
#hint {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 5;
  padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  color: var(--text-2); font-size: 12px; transition: opacity .7s; box-shadow: var(--shadow);
}
#hint.gone { opacity: 0; pointer-events: none; }

/* ---- tooltip ----------------------------------------------------------- */
#tip {
  position: fixed; z-index: 8; pointer-events: none; max-width: 300px;
  background: var(--glass-strong); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 8px 11px 9px; box-shadow: var(--shadow);
}
#tip .n { font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; }
#tip .n i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
#tip .n em { font-style: normal; font-weight: 500; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
#tip .s { color: var(--text-2); font-size: 12px; margin-top: 3px; }

/* ---- panel ------------------------------------------------------------- */
#panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 6;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-left: 1px solid var(--line); transform: translateX(100%);
  transition: transform .4s var(--ease); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent;
}
#panel.open { transform: none; }
.p-in { padding: 18px 22px 30px; }
.p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; border: 1px solid; display: inline-flex; gap: 6px; align-items: center;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.identified { color: var(--ident); border-color: rgba(121, 196, 255, .35); background: rgba(121, 196, 255, .08); }
.pill.dark { color: var(--dark); border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .09); }
.pill.detected { color: var(--det); border-color: rgba(143, 227, 208, .35); background: rgba(143, 227, 208, .08); }
.pill.ais { color: var(--ais); border-color: rgba(141, 157, 181, .35); background: rgba(141, 157, 181, .08); }
.x {
  border: 0; background: rgba(255, 255, 255, .05); color: var(--text-2); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.x:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.p-title { font-size: 22px; font-weight: 600; margin: 16px 0 5px; letter-spacing: -0.012em; line-height: 1.15; overflow-wrap: anywhere; }
.p-title small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .04em; margin-top: 3px; font-family: var(--mono); }
.p-title a.mt { color: inherit; text-decoration: none; }
.p-title a.mt:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.p-title a.mt svg { width: 13px; height: 13px; margin-left: 8px; vertical-align: 1px; color: var(--muted); transition: color .12s; }
.p-title a.mt:hover svg { color: var(--text); }
.p-reg { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.flag { height: 14px; border-radius: 2px; border: 1px solid var(--line-2); flex: none; }

.crops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.crop { margin: 0; position: relative; border-radius: 11px; overflow: hidden; border: 1px solid var(--line-2); background: #000; cursor: zoom-in; }
.crop img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.crop figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255, 255, 255, .8); background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}

.sec {
  margin-top: 22px; font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
  font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sec span { color: var(--dim); font-weight: 500; letter-spacing: .04em; text-transform: none; }

.cmp { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cmp th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: right; padding: 4px 0 6px; }
.cmp th:first-child { text-align: left; }
.cmp th.img { color: var(--accent); }
.cmp td { padding: 7px 0; border-top: 1px solid var(--line); text-align: right; font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.cmp td:first-child { text-align: left; color: var(--text-2); font-weight: 400; font-size: 12.5px; }
.cmp td small { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 4px; }
.cmp td.ais { color: var(--text-2); font-weight: 400; }
.cmp td .na { color: var(--dim); font-weight: 400; font-size: 12px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 12px; }
.fact.wide { grid-column: 1 / -1; }
.fact .k { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.fact .v { font-size: 13.5px; font-weight: 500; margin-top: 2px; line-height: 1.35; }
.fact .v small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.fact .v .mono { font-family: var(--mono); font-size: 12.5px; }
.bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 2px; }

.spec-wrap { margin-top: 10px; }
.spec { width: 100%; height: auto; display: block; }
.spec path.line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.spec path.area { fill: url(#specfill); }
.spec text { fill: var(--dim); font: 9.5px var(--font); text-anchor: middle; }
.spec line { stroke: var(--line); }

.idrow { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.idrow span b { color: var(--muted); font-weight: 500; margin-right: 5px; font-family: var(--font); font-size: 10.5px; letter-spacing: .08em; }
.note { margin-top: 10px; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.note b { color: var(--text); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 11px; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255, 181, 71, .35); color: var(--dark); background: rgba(255, 181, 71, .07); }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.thumb {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 9px; padding: 0;
  cursor: zoom-in; overflow: hidden; color: var(--text-2); font: 11px var(--font); text-align: left; transition: border-color .15s, color .15s;
}
.thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top left; background: #fff; opacity: .92; }
.thumb span { display: block; padding: 6px 8px 7px; }
.thumb:hover { border-color: var(--line-2); color: var(--text); }

.actions { display: flex; gap: 8px; margin-top: 20px; }
.btn {
  flex: 1; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--text); cursor: pointer;
  font: 500 12.5px var(--font); padding: 10px 12px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: rgba(255, 255, 255, .08); }
.btn.primary { border-color: rgba(121, 196, 255, .5); background: rgba(121, 196, 255, .12); color: #cfe9ff; }
.btn.primary:hover { background: rgba(121, 196, 255, .2); }
.btn svg { width: 14px; height: 14px; }
.p-foot { margin-top: 18px; color: var(--dim); font-size: 11px; line-height: 1.5; }
.p-nav { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; margin-top: 14px; }
.p-nav kbd { font: 10.5px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; }

/* ---- lightbox ---------------------------------------------------------- */
#lightbox {
  position: fixed; inset: 0; z-index: 20; background: rgba(4, 7, 12, .88);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
}
#lightbox img { max-width: min(92vw, 1500px); max-height: 84vh; border-radius: 10px; box-shadow: 0 30px 90px rgba(0, 0, 0, .65); background: #fff; }
.lb-cap { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: var(--text-2); font-size: 12.5px; }
.lb-cap b { color: var(--text); font-weight: 600; margin-right: 8px; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(10, 15, 24, .75); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .12); }
.lb-prev { left: 22px; } .lb-next { right: 22px; }
.lb-close { top: 22px; right: 22px; transform: none; font-size: 26px; }

@media (max-width: 900px) {
  #hdr { width: calc(100vw - 36px); }
  #legend { display: none; }
  #panel { width: 100vw; }
  body.panel-open #tools, body.panel-open .maplibregl-ctrl-bottom-right, body.panel-open #attr { right: 18px; }
}

/* ---- scene switcher ------------------------------------------------------- */
.title-btn {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px; margin: 0 -6px; padding: 0 6px; max-width: 100%;
}
.title-btn:hover { background: rgba(255, 255, 255, .06); }
.title-btn:focus-visible { box-shadow: 0 0 0 3px rgba(121, 196, 255, .25); }
.title-btn svg { width: 15px; height: 15px; color: var(--muted); flex: none; transition: transform .2s; }
.title-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
#scene-list {
  list-style: none; margin: 0; padding: 5px; position: absolute; left: 12px; right: 12px; top: 98px; z-index: 4;
  background: var(--glass-strong); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
}
#scene-list li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; align-items: baseline;
}
#scene-list li:hover { background: rgba(255, 255, 255, .06); }
#scene-list li.on { background: rgba(121, 196, 255, .1); }
#scene-list .n { font-weight: 600; font-size: 13.5px; }
#scene-list .m { color: var(--muted); font-size: 11.5px; text-align: right; white-space: nowrap; }
#scene-list .c { grid-column: 1 / -1; color: var(--text-2); font-size: 11.5px; }
#scene-list .c i { font-style: normal; font-weight: 600; }

/* Airborne contacts: their own pill, matching the map marker. */
.pill.air{background:rgba(224,110,192,.14);color:#e06ec0}
.pill.air i{background:#e06ec0}
.lg-row .sw[style*="e06ec0"]{border-radius:2px;transform:rotate(45deg)}
/* The aircraft track panel is 10:4 and is the evidence itself, so it
   spans the panel and keeps its shape: cropped square to a thumbnail, the
   band separation it exists to show is the part that gets cut. */
.crops.one { grid-template-columns: 1fr; }
.crop.wide img { aspect-ratio: 1122 / 484; object-fit: contain; background: #0b0f16; }

/* The airframe photograph and its route leg. The photo is hot-linked
   from planespotters, so it is given a fixed frame and a credit line
   their terms ask for. */
.plane { margin: 14px 0 0; border-radius: 11px; overflow: hidden; border: 1px solid var(--line-2); background: #0b0f16; }
.plane img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.plane figcaption { padding: 6px 9px 7px; font-size: 10.5px; color: var(--muted); }
.plane figcaption a { color: var(--text-2); }
.leg { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.leg b { color: var(--text); font-size: 13.5px; letter-spacing: .02em; }
.leg i { font-style: normal; color: var(--muted); padding: 0 2px; }
.sec .tag { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 10px; margin-left: 6px; }
