/* ~/lab shared base: the portfolio's palette, run as a terminal. Everything is monospace here.
   Used by the lab index and every app under /lab/. */
:root {
  --bg: #050b12;
  --panel: rgba(12, 26, 36, 0.72);
  --line: rgba(52, 224, 234, 0.16);
  --text: #e2eef3;
  --mist: #b3c7d0;
  --dim: #7f9aa6;
  --accent: #34e0ea;
  --accent-d: #0891b2;
  --blue: #60a5fa;
  --mint: #86efac;
  --white: #ffffff;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(8, 145, 178, 0.14), transparent 60%),
              radial-gradient(900px 600px at -10% 40%, rgba(56, 189, 248, 0.07), transparent 60%),
              var(--bg);
  color: var(--text); font-family: var(--mono); font-size: 14px; line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--white); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.p { color: var(--accent); }
.b { color: var(--blue); }
.mint { color: var(--mint); }
::selection { background: var(--accent-d); color: var(--white); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 6px;
  background: var(--accent); color: var(--bg);
}
.skip:focus { left: 12px; }
.skip:hover { color: var(--bg); }

/* the ASCII rain behind every lab page (rain.js), under the window and the footer */
#rain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0.6; }

/* ---------- window ---------- */
.win {
  position: relative; z-index: 2; /* above .foot, so dropdowns can hang past the window's bottom edge */
  width: min(1120px, 100% - 2 * clamp(12px, 3vw, 40px)); margin: 64px auto 0;
  background: rgba(7, 16, 24, 0.82); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}
.win.wide { width: min(1320px, 100% - 2 * clamp(12px, 3vw, 40px)); }
.win-bar, .card-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--dim);
}
.win-bar { border-radius: var(--radius) var(--radius) 0 0; }
.win-bar i, .card-bar i { width: 11px; height: 11px; border-radius: 50%; flex: none; background: #2b4552; }
.win-bar i:nth-child(1) { background: #34e0ea; }
.win-bar i:nth-child(2) { background: #60a5fa; }
.win-bar i:nth-child(3) { background: #e2eef3; }
.win-title { margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home {
  margin-left: auto; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--text); white-space: nowrap; transition: border-color 0.2s, color 0.2s;
}
.home:hover { border-color: var(--accent); color: var(--white); }

.eyebrow { color: var(--accent); margin: 0 0 6px; font-size: 13px; }
h1 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; margin: 0 0 14px; color: var(--white); font-weight: 700; }
.lede { color: var(--mist); margin: 0 0 16px; max-width: 620px; }

/* status colours: mint is the only "live" signal */
.st { white-space: nowrap; }
.st.live { color: var(--mint); }
.st.building { color: var(--blue); }
.st.planned { color: var(--dim); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { font-size: 12px; color: var(--blue); background: rgba(96, 165, 250, 0.08); padding: 3px 8px; border-radius: 6px; }

/* ---------- controls shared by the apps ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 13px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); color: var(--text); background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn:hover { border-color: var(--accent); color: var(--white); }
.btn.primary { background: linear-gradient(90deg, #0e7490, #2563eb); border-color: transparent; color: var(--white); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(8, 145, 178, 0.4); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
input[type="text"], input[type="number"], select, textarea {
  font: inherit; font-size: 13px; color: var(--white); background: rgba(5, 11, 18, 0.7);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }
label { cursor: pointer; }

/* a sub-pane inside the window, with a shell-style heading */
.pane { border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 11, 18, 0.55); min-width: 0; }
.pane-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
  border-radius: 10px 10px 0 0; font-size: 13px; color: var(--mist);
}
.pane-head h2, .pane-head h3 { margin: 0; font-size: 13px; font-weight: 400; color: var(--mist); min-width: 0; overflow-wrap: anywhere; }
.pane-head .right { margin-left: auto; min-width: 0; overflow-wrap: anywhere; }
.pane-body { padding: 14px; }

/* ---------- app pages: intro, file drop zone, help, facts and bars (profiler, x-ray) ---------- */
.app-intro { padding: clamp(22px, 3.5vw, 36px) clamp(18px, 4vw, 40px) 6px; }
:not(pre) > code { font-family: var(--mono); font-size: 0.95em; color: var(--white); background: rgba(8, 145, 178, 0.12); padding: 1px 5px; border-radius: 6px; }
.intake, .results > .pane, .method { margin: 16px clamp(18px, 4vw, 40px) 0; }
.results { padding-bottom: 22px; }
.drop {
  margin: 14px; padding: clamp(22px, 4vw, 38px) 18px; text-align: center;
  border: 1px dashed rgba(52, 224, 234, 0.35); border-radius: 10px; transition: border-color 0.2s, background 0.2s;
}
.drop.over { border-color: var(--accent); background: rgba(8, 145, 178, 0.1); }
.drop-main { margin: 0 0 10px; font-size: 15px; color: var(--white); }
.drop-main .btn { margin-left: 6px; font-size: 14px; }
.drop-safe { margin: 0 auto; max-width: 62ch; font-size: 12px; color: var(--mist); }
.status { margin: 12px 0 0; min-height: 1.6em; font-size: 13px; color: var(--accent); }
.status.err { color: var(--white); }
.status.err::before { content: "! "; color: var(--accent); font-weight: 700; }
.intake.compact .drop { padding: 12px 18px; }
.intake.compact .drop-safe { display: none; }
.help { padding: 0 14px 14px; }
.help > summary {
  list-style: none; cursor: pointer; width: max-content; max-width: 100%; font-size: 13px; color: var(--text);
  padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
}
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: "+ "; color: var(--accent); }
.help[open] > summary::before { content: "- "; }
.help > summary:hover { border-color: var(--accent); }
.help-body { font-size: 13px; color: var(--mist); max-width: 80ch; }
.help-body ol { padding-left: 22px; }
.help-body li { margin: 4px 0; }
.help-body b { color: var(--white); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0 0 14px; font-size: 13px; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 5.5ch; gap: 4px 10px; align-items: center; }
.bars .bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.bars .bar-val { text-align: right; color: var(--white); font-variant-numeric: tabular-nums; }
.bars .bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: rgba(52, 224, 234, 0.1); overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: #0e8d96; border-radius: 999px; }
.bars .main .bar i { background: var(--accent); }
.method { font-size: 12px; color: var(--mist); max-width: 100ch; line-height: 1.6; }
.method .src { margin: 0 2px; }

/* ---------- status bar (vim/tmux style) ---------- */
.statusbar {
  display: flex; align-items: stretch; font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--line); background: rgba(5, 11, 18, 0.6);
  border-radius: 0 0 var(--radius) var(--radius); overflow: hidden;
}
.statusbar > span { padding: 5px 12px; white-space: nowrap; }
.mode { background: var(--accent); color: var(--bg); font-weight: 700; letter-spacing: 0.06em; }
.sb-path { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.sb-keys { margin-left: auto; }
.sb-pos { border-left: 1px solid var(--line); color: var(--text); }

.foot { position: relative; z-index: 1; text-align: center; margin: 22px 0 40px; font-size: 13px; color: var(--dim); }

@media (max-width: 900px) {
  .win { margin-top: 52px; }
  .sb-keys { display: none; }
  .sb-pos { margin-left: auto; }
}
@media (max-width: 640px) {
  .win-title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
