/* ============================================================
   FREE·LLM·EXPLORER — light "blueprint / instrument" theme
   Pale paper, deep-teal ink accent, Martian Mono readouts,
   HUD targeting brackets, radar sweep, blueprint grid + grain.
   ============================================================ */

:root {
  --bg: #e8ece8;          /* pale sage paper */
  --panel: #f5f7f3;       /* card */
  --panel-2: #eef1ec;
  --line: #cdd8d0;        /* soft border */
  --line-bright: #9fb1a7;
  --txt: #16231e;         /* deep ink-green */
  --muted: #5c6f68;
  --muted-2: #8a988f;
  --phosphor: #0b8f7b;    /* deep radar teal accent */
  --phosphor-dim: #2f9183;
  --green: #1f9b55;
  --amber: #b9791a;
  --red: #d23a47;
  --violet: #6a4fd0;
  --blue: #2b7ec9;

  --font-display: 'Martian Mono', ui-monospace, 'SFMono-Regular', monospace;
  --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }

html { scrollbar-color: var(--line-bright) var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; position: relative; }

/* ---------- atmosphere layers (fixed, non-interactive) ---------- */
.fx-grid, .fx-scan, .fx-grain, .fx-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.fx-grid {
  /* blueprint grid in faint teal-ink */
  background-image:
    linear-gradient(rgba(11,143,123,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11,143,123,0.10) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.7;
  mask-image: radial-gradient(ellipse 95% 75% at 50% 28%, #000 35%, transparent 92%);
}
.fx-scan {
  /* faint engineering rules (static, paper texture) */
  background: repeating-linear-gradient(0deg, rgba(22,35,30,0.025) 0 1px, transparent 1px 4px);
  opacity: 0.6;
}
.fx-grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.045; mix-blend-mode: multiply;
}
.fx-vignette {
  background: radial-gradient(ellipse 120% 95% at 50% 0%, transparent 58%, rgba(22,35,30,0.07) 100%);
}

header, main, footer { position: relative; z-index: 1; }

/* ---------- header + radar ---------- */
header { border-bottom: 1px solid var(--line); padding: 30px 0 20px; overflow: hidden; }

.radar {
  position: absolute; top: -90px; right: 4%; width: 360px; height: 360px;
  border-radius: 50%; z-index: 0; opacity: 0.65;
  mask-image: radial-gradient(circle at center, #000 60%, transparent 72%);
}
.radar-ring { position: absolute; inset: 0; border: 1px solid var(--phosphor); border-radius: 50%; opacity: 0.28; }
.radar-ring.r2 { inset: 25%; }
.radar-ring.r3 { inset: 50%; }
.radar-cross { position: absolute; background: var(--phosphor); opacity: 0.2; }
.radar-cross.v { left: 50%; top: 0; bottom: 0; width: 1px; }
.radar-cross.h { top: 50%; left: 0; right: 0; height: 1px; }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(11,143,123,0.30), rgba(11,143,123,0.05) 60deg, transparent 110deg);
  animation: sweep 4.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.brand-tag {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.32em; color: var(--phosphor); text-transform: uppercase;
  display: inline-block; padding-left: 2px;
}
h1 {
  margin: 4px 0 0; font-family: var(--font-display); font-weight: 600;
  font-size: 30px; letter-spacing: -0.01em; color: var(--txt);
}
.lang-btn {
  background: transparent; color: var(--phosphor); border: 1px solid var(--line-bright);
  border-radius: 0; padding: 7px 14px; font-family: var(--font-display); font-size: 12px;
  font-weight: 500; letter-spacing: 0.12em; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.lang-btn:hover { background: var(--phosphor); color: #fff; border-color: var(--phosphor); }

.tag { color: var(--muted); margin: 14px 0 14px; max-width: 760px; font-size: 14px; }

.disclaimer {
  position: relative; background: rgba(210,58,71,0.07); border: 1px solid rgba(210,58,71,0.35);
  color: #9c2e39; border-radius: 0; padding: 10px 14px 10px 34px; font-size: 12.5px;
  margin: 0 0 18px; max-width: 920px; line-height: 1.5;
}
.disclaimer::before {
  content: ''; position: absolute; left: 14px; top: 14px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 6px rgba(210,58,71,0.7); animation: blink 1.4s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- stat readouts ---------- */
.stats { display: flex; gap: 0; flex-wrap: wrap; border: 1px solid var(--line); background: var(--panel); }
.stats .pill {
  font-family: var(--font-display); font-size: 11px; letter-spacing: 0.06em; color: var(--muted);
  padding: 10px 16px; border: none; border-right: 1px solid var(--line); text-transform: uppercase;
  display: flex; gap: 8px; align-items: baseline; background: transparent; cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s;
}
.stats .pill b { color: var(--txt); font-size: 15px; font-weight: 600; }
.stats .pill:hover { background: var(--panel-2); color: var(--txt); }
.stats .pill.active { color: var(--phosphor); background: rgba(11,143,123,0.08); box-shadow: inset 0 -2px 0 var(--phosphor); }
.stats .pill.active b { color: var(--phosphor); }
.stats .pill:focus-visible { outline: 2px solid var(--phosphor); outline-offset: -2px; }

/* ---------- controls ---------- */
.listbar { display: flex; align-items: center; gap: 14px; margin: 26px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.listbar label.inline { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 10px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.listbar select { background: var(--panel); color: var(--txt); border: 1px solid var(--line-bright); border-radius: 0; padding: 6px 10px; font-family: var(--font-body); font-size: 13px; cursor: pointer; }
.listbar select:focus { outline: none; border-color: var(--phosphor); }
.pill.stale { color: #fff !important; background: var(--amber); border-color: var(--amber) !important; }
.pill.stale b { color: #fff !important; }
.card:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.close:focus-visible, .lang-btn:focus-visible, .footnav a:focus-visible, .listbar select:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 26px 0 18px; }
.ctrl-label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.2em; color: var(--phosphor-dim); align-self: center; }
.controls label { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-display); font-size: 10px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.controls select {
  background: var(--panel); color: var(--txt); border: 1px solid var(--line-bright); border-radius: 0;
  padding: 8px 12px; font-family: var(--font-body); font-size: 13px; min-width: 130px; cursor: pointer;
}
.controls select:focus { outline: none; border-color: var(--phosphor); }
.controls .toggle { flex-direction: row; align-items: center; gap: 8px; color: var(--txt); font-size: 11px; cursor: pointer; }
.controls .toggle input { accent-color: var(--phosphor); width: 14px; height: 14px; }
.spacer { flex: 1; }
.count { font-family: var(--font-display); color: var(--phosphor); font-size: 12px; letter-spacing: 0.1em; }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(345px, 1fr)); gap: 16px; padding-bottom: 56px; }

.card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  padding: 18px 18px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .18s, transform .08s, box-shadow .18s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 10px -8px rgba(22,35,30,0.25);
  animation: bootIn .5s cubic-bezier(.2,.7,.3,1) both;
}
/* HUD targeting brackets (top-left + bottom-right) */
.card::before, .card::after {
  content: ''; position: absolute; width: 12px; height: 12px; transition: all .18s; opacity: 0.55;
}
.card::before { top: -1px; left: -1px; border-top: 2px solid var(--phosphor); border-left: 2px solid var(--phosphor); }
.card::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--phosphor); border-right: 2px solid var(--phosphor); }
.card:hover { border-color: var(--line-bright); transform: translateY(-2px); box-shadow: 0 14px 34px -18px rgba(11,143,123,0.45); }
.card:hover::before, .card:hover::after { opacity: 1; width: 18px; height: 18px; }

@keyframes bootIn { from { opacity: 0; transform: translateY(10px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0 0); } }
.card:nth-child(1){animation-delay:.02s}.card:nth-child(2){animation-delay:.06s}.card:nth-child(3){animation-delay:.10s}
.card:nth-child(4){animation-delay:.14s}.card:nth-child(5){animation-delay:.18s}.card:nth-child(6){animation-delay:.22s}
.card:nth-child(7){animation-delay:.26s}.card:nth-child(8){animation-delay:.30s}.card:nth-child(9){animation-delay:.34s}
.card:nth-child(10){animation-delay:.38s}.card:nth-child(11){animation-delay:.42s}.card:nth-child(12){animation-delay:.46s}

.card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.card-head a.host {
  font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  color: var(--phosphor); text-decoration: none; word-break: break-all; transition: color .15s;
}
.card-head a.host:hover { color: var(--txt); text-decoration: underline; }
.card .from { color: var(--muted-2); font-family: var(--font-display); font-size: 10px; letter-spacing: 0.1em; margin-top: 5px; text-transform: uppercase; }

.card-body { display: flex; flex-direction: column; gap: 8px; }
.frow { display: grid; grid-template-columns: 68px 1fr; gap: 10px; font-size: 13px; align-items: baseline; }
.frow .flabel { font-family: var(--font-display); color: var(--muted); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; padding-top: 2px; }
.frow .fval { color: #2c3b35; word-break: break-word; line-height: 1.5; }
.muted { color: var(--muted-2); }

/* badges */
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-family: var(--font-display); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--line-bright); background: var(--panel-2); color: var(--muted);
  white-space: nowrap;
}
.badge.verified { color: var(--green); border-color: rgba(31,155,85,0.5); background: rgba(31,155,85,0.07); }
.badge.down { color: var(--red); border-color: rgba(210,58,71,0.45); }
.badge.risky { color: #fff; border-color: var(--red); background: var(--red); }
.badge.candidate { color: var(--amber); border-color: rgba(185,121,26,0.45); }
.badge.prov { color: var(--muted); border-style: dashed; }
.badge.cat-free-relay { color: var(--green); border-color: rgba(31,155,85,0.5); background: rgba(31,155,85,0.07); }
.badge.cat-free-product { color: var(--phosphor); border-color: var(--phosphor); background: rgba(11,143,123,0.07); }
.badge.cat-commercial-aggregator { color: var(--violet); border-color: rgba(106,79,208,0.45); }
.badge.cat-first-party-free { color: var(--blue); border-color: rgba(43,126,201,0.45); }
.badge.cat-monitor-directory { color: var(--amber); border-color: rgba(185,121,26,0.45); }
.badge.cat-other { color: var(--muted-2); }

/* reputation readout + risk LED */
.rep { display: flex; align-items: center; gap: 10px; }
.score {
  font-family: var(--font-display); font-weight: 700; font-size: 17px; min-width: 44px; height: 44px; padding: 0 6px;
  display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-bright); color: var(--muted);
}
.score.s-high { color: var(--green); border-color: var(--green); background: rgba(31,155,85,0.08); }
.score.s-mid { color: var(--amber); border-color: rgba(185,121,26,0.6); background: rgba(185,121,26,0.07); }
.score.s-low { color: var(--red); border-color: rgba(210,58,71,0.6); background: rgba(210,58,71,0.06); }
.score.s-na { color: var(--muted-2); }
.risk-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.risk-low { background: var(--green); box-shadow: 0 0 6px rgba(31,155,85,0.6); }
.risk-medium { background: var(--amber); box-shadow: 0 0 6px rgba(185,121,26,0.6); }
.risk-high { background: var(--red); box-shadow: 0 0 7px rgba(210,58,71,0.75); animation: blink 1.2s steps(1) infinite; }
.risk-na { background: var(--muted-2); }

.models-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.04em; background: var(--panel-2); border: 1px solid var(--line); padding: 2px 7px; color: var(--muted); }

/* ---------- drawer / modal ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer.hidden { display: none; }
.drawer-bg { position: absolute; inset: 0; background: rgba(22,35,30,0.34); backdrop-filter: blur(3px); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(580px, 94vw);
  background: var(--panel); border-left: 1px solid var(--line-bright); padding: 28px; overflow-y: auto;
  box-shadow: -30px 0 60px -30px rgba(22,35,30,0.3);
  animation: slideIn .28s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer h2 { margin: 2px 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 21px; word-break: break-all; color: var(--txt); }
.drawer a { color: var(--phosphor); }
.drawer .sec { margin-top: 16px; }
.drawer .sec h3 { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--phosphor-dim); margin: 0 0 8px; }
.drawer .sec h3::before { content: '▸ '; color: var(--phosphor); }
.drawer ul { margin: 0; padding-left: 18px; }
.drawer li { margin: 4px 0; }
.flag { color: var(--red); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv .k { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.glance { border: 1px solid var(--line); background: var(--panel-2); padding: 14px; }
.glance .kv .k { color: var(--phosphor-dim); }
.mention { border-left: 2px solid var(--line-bright); padding: 5px 0 5px 11px; margin: 9px 0; font-size: 13px; color: #2c3b35; }
.mention .src { font-family: var(--font-display); color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.close { position: absolute; top: 16px; right: 20px; cursor: pointer; color: var(--muted); font-size: 26px; line-height: 1; transition: color .15s; }
.close:hover { color: var(--phosphor); }

details.sec { border: 1px solid var(--line); background: var(--panel-2); padding: 10px 14px; }
details.sec > summary { cursor: pointer; font-family: var(--font-display); color: var(--phosphor); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; user-select: none; list-style: none; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: '[+] '; }
details.sec[open] > summary::before { content: '[−] '; }
details.sec[open] > summary { margin-bottom: 8px; }

.modal-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(700px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-bright); padding: 30px 32px;
  box-shadow: 0 30px 80px -30px rgba(22,35,30,0.4);
}
.modal-panel h2 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: 0.02em; }
.modal-panel h2::before { content: '// '; color: var(--phosphor); }
.modal-panel p { color: #2c3b35; font-size: 14px; line-height: 1.7; }
.modal-panel strong { color: var(--txt); }

/* ---------- footer ---------- */
footer {
  color: var(--muted); font-size: 11.5px; padding: 22px 24px 48px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; max-width: 1240px; margin: 0 auto;
}
.footnav { display: flex; gap: 20px; }
.footnav a { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--phosphor-dim); text-decoration: none; }
.footnav a:hover { color: var(--phosphor); }

.empty { grid-column: 1/-1; color: var(--muted); padding: 60px 0; text-align: center; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.12em; }

@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .risk-high, .disclaimer::before, .card { animation: none !important; }
}

@media (max-width: 640px) {
  .radar { width: 240px; height: 240px; top: -70px; right: -30px; }
  h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
}
