/* Dr. Rami Shaheen Labs — one theme for both labs, in the ramishaheen.cloud style:
   warm studio white and ink, cyan signal accents, Geist / Archivo / Geist Mono, pill buttons.
   Every colour, radius and shadow is a token. Labs and simulations read colours from these
   tokens (canvas code uses getComputedStyle), so changing them restyles everything. */

@font-face { font-family: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/geist-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/geist-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/geist-mono-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/geist-mono-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/archivo-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(../vendor/fonts/archivo-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Archivo", "Arial Narrow", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;
  --gap: 16px;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* dark: ink black with cyan signal */
  --bg: #0b0b0b;
  --bg-2: #0f0f0e;
  --surface: #121211;
  --surface-2: #1a1a18;
  --surface-3: #262624;
  --line: #262624;
  --line-2: #3a3a37;
  --text: #f2f2f2;
  --text-2: #bdbdb7;
  --text-3: #8a8a85;
  --accent: #3fe0ff;
  --accent-2: #89cff0;
  --accent-ink: #0b0b0b;
  --accent-soft: rgba(63, 224, 255, .12);
  --amber: #f5c542;
  --amber-ink: #141005;
  --amber-soft: rgba(245, 197, 66, .15);
  --teal: #3fe0ff;
  --green: #4ade80;
  --red: #ff6b6b;
  --orange: #fb923c;
  --violet: #b4a2ff;
  --pink: #f472b6;
  --grid: rgba(242, 242, 242, .05);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --focus: 0 0 0 3px rgba(63, 224, 255, .4);
  color-scheme: dark;
}

/* light: the studio white of ramishaheen.cloud */
:root[data-theme="light"] {
  --bg: #f8f8f6;
  --bg-2: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f2f2f0;
  --surface-3: #e6e6e1;
  --line: #dcdcd6;
  --line-2: #bdbdb7;
  --text: #0b0b0b;
  --text-2: #4a4a46;
  --text-3: #77776f;
  --accent: #0b0b0b;
  --accent-2: #1e6e96;
  --accent-ink: #f8f8f6;
  --accent-soft: rgba(30, 110, 150, .10);
  --amber: #e9b114;
  --amber-ink: #1a1405;
  --amber-soft: rgba(233, 177, 20, .16);
  --teal: #1e6e96;
  --green: #15803d;
  --red: #d92d20;
  --orange: #c2410c;
  --violet: #6d4fd8;
  --pink: #be185d;
  --grid: rgba(11, 11, 11, .05);
  --shadow: 0 10px 30px rgba(11, 11, 11, .08);
  --shadow-sm: 0 2px 8px rgba(11, 11, 11, .06);
  --focus: 0 0 0 3px rgba(30, 110, 150, .3);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-2); }
:root[data-theme="light"] a:not([class]) { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 37px; flex: 0 0 auto; color: var(--text); }
.brand-mark .mk-eye { fill: var(--accent); }
:root[data-theme="light"] .brand-mark .mk-eye { fill: var(--accent-2); }
.wm { display: grid; line-height: 1; }
.wm-name { font: 800 17px/0.95 var(--font-display); letter-spacing: -.01em; text-transform: uppercase; }
.wm-tag { margin-top: 4px; font: 600 9.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.wm-tag b { color: var(--accent-2); font-weight: 700; }
.lab-tabs { display: flex; gap: 6px; margin-left: 12px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); }
.lab-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--r-pill); border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px;
}
.lab-tab:hover { color: var(--text); background: var(--surface-2); }
.lab-tab[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.lab-tab[data-lab="rover"][aria-current="page"] { background: var(--amber); color: var(--amber-ink); }
.header-spacer { flex: 1; }
.header-slot { display: flex; align-items: center; gap: 8px; }

/* ---------- generic components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.outline { background: transparent; border-color: var(--accent); color: var(--accent-2); }
:root[data-theme="light"] .btn.outline { color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.lg { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.btn.icon { padding: 0; width: 38px; }
.btn.block { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text-2); font-size: 12px; font-weight: 600; background: var(--surface-2);
}
.chip.accent { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.chip.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 50%, transparent); background: var(--amber-soft); }
:root[data-theme="light"] .chip.amber { color: #8a5a00; }
.chip.green { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.chip.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.eyebrow { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.kbd { font: 600 11px var(--font-mono); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text-2); background: var(--surface-2); }

/* segmented control */
.seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--r-pill); overflow: hidden; background: var(--surface); }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 500; border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg.compact button { padding: 6px 10px; font-size: 13px; flex: 0 0 auto; }

/* slider */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--pct, 50%), var(--surface-3) var(--pct, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }

/* toggle */
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .15s; pointer-events: none; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform .15s var(--ease), background .15s; }
.toggle input:checked + span { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + span::after { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible + span { box-shadow: var(--focus); }

/* stepper */
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper .btn { width: 40px; height: 40px; padding: 0; font-size: 18px; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-size: 17px; }

/* inputs */
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
}
textarea.input { resize: vertical; min-height: 90px; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px; animation: toast-in .2s var(--ease); max-width: 360px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { width: min(640px, 100%); max-height: 86vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.modal h2 { font-size: 20px; margin-bottom: 12px; }

/* ---------- home (lab chooser) ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 56px 20px 80px; }
.home-hero { text-align: center; max-width: 760px; margin: 0 auto 44px; }
.home-hero h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 850; letter-spacing: -.03em; }
.home-hero h1 .grad { background: linear-gradient(90deg, var(--text) 10%, var(--accent-2) 70%, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero h1 { text-transform: uppercase; letter-spacing: -.02em; line-height: .98; }
.home-by { margin-top: 18px; font: 600 12px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.home-by a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.home-by a:hover { border-color: var(--accent-2); }
.rain { position: fixed; inset: var(--header-h) 0 0 0; z-index: 0; pointer-events: none; opacity: .55; }
.home { position: relative; z-index: 1; }
.home-hero p { margin-top: 16px; font-size: 18px; color: var(--text-2); }
.lab-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.lab-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px;
  padding: 28px; border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface);
  text-align: left; cursor: pointer; color: var(--text); text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.lab-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lab-card[data-lab="rover"]:hover { border-color: var(--amber); }
.lab-card[data-lab="systems"]:hover { border-color: var(--accent); }
.lab-card .art { height: 190px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.lab-card .art svg { width: 100%; height: 100%; display: block; }
.lab-card h2 { font-size: 28px; font-weight: 800; }
.lab-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--text-2); font-size: 14px; }
.lab-card li::before { content: "✓"; color: var(--green); font-weight: 700; margin-right: 8px; }
.lab-card .go { margin-top: auto; align-self: flex-start; }
.home-foot { margin-top: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- loading / errors ---------- */
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--text-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { max-width: 640px; margin: 60px auto; padding: 20px; border: 1px solid var(--red); border-radius: var(--r-md); background: var(--surface); }

@media (max-width: 860px) {
  .lab-cards { grid-template-columns: 1fr; }
  .lab-tab .label-long { display: none; }
  .app-header { padding: 0 12px; gap: 8px; }
  .brand .wm { display: none; }
  .lab-tabs { margin-left: 0; }
}
@media (max-width: 560px) {
  .app-header { gap: 6px; padding: 0 8px; }
  /* one button that cycles Auto → Light → Dark */
  #theme-seg button { padding: 6px 9px; }
  #theme-seg button[aria-pressed="false"] { display: none; }
  #theme-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
  .lab-tab { padding: 7px 10px; }
  .lab-tab svg { display: none; }
  .brand-mark { width: 28px; height: 31px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
