/* ==========================================================================
   LCL portal: base layer (tokens, fonts, type, controls)
   Shared by every page. Brand: Lightning Command Lines LLC.
   ========================================================================== */

/* ---- Fonts (self-hosted, SIL OFL 1.1: see assets/fonts/*-OFL.txt) ---- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/Inter-Bold.woff") format("woff"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/JetBrainsMono-Medium.woff") format("woff"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/JetBrainsMono-SemiBold.woff") format("woff"); }

/* ---- Tokens: light (default) ---- */
:root {
  --black: #05070D;
  --ink: #0B0F19;
  --blue: #0A84FF;
  --blue-deep: #0B4FD9;
  --sky: #39B6FF;
  --paper: #F7F9FC;
  --hairline: #D9DEE7;
  --slate: #5B6475;

  --c-quasar: #0A84FF;
  --c-almanac: #F5A524;
  --c-soroban: #12B76A;
  --c-uplink: #7C5CFF;

  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F7;
  --line: #D9DEE7;
  --line-soft: #E6EAF0;
  --text: #0B0F19;
  --text-2: #5B6475;
  --text-3: #8790A2;
  --link: #0B4FD9;
  --accent: #0A84FF;
  --accent-hover: #0B4FD9;
  --accent-soft: rgba(10, 132, 255, 0.10);
  --accent-line: rgba(10, 132, 255, 0.35);
  --ok: #0E8F55;
  --ok-soft: rgba(18, 183, 106, 0.12);
  --warn: #A86500;
  --warn-soft: rgba(245, 165, 36, 0.16);
  --danger: #D12F3A;
  --danger-soft: rgba(229, 72, 77, 0.10);
  --neutral-soft: #EEF1F5;
  --shadow-sm: 0 1px 2px rgba(11, 15, 25, 0.05);
  --shadow-md: 0 1px 2px rgba(11, 15, 25, 0.04), 0 6px 18px -6px rgba(11, 15, 25, 0.10);
  --shadow-lg: 0 2px 4px rgba(11, 15, 25, 0.04), 0 18px 48px -12px rgba(11, 15, 25, 0.22);
  --focus: 0 0 0 3px rgba(10, 132, 255, 0.28);
  --lcl-accent: #0A84FF;
  --band-border: #0B0F19;
  --skeleton: #E9EDF3;
  --skeleton-hi: #F4F6F9;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* ---- Tokens: dark (system preference unless the user chose light) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05070D; --surface: #0B0F19; --surface-2: #0E1320; --surface-3: #141A29;
    --line: #222A3B; --line-soft: #1A2131; --text: #EEF2F8; --text-2: #A0A9BB; --text-3: #6E788C;
    --link: #39B6FF; --accent: #0A84FF; --accent-hover: #2A95FF; --accent-soft: rgba(57, 182, 255, 0.12); --accent-line: rgba(57, 182, 255, 0.4);
    --ok: #3DD68C; --ok-soft: rgba(18, 183, 106, 0.16); --warn: #F5B544; --warn-soft: rgba(245, 165, 36, 0.14);
    --danger: #FF6B72; --danger-soft: rgba(229, 72, 77, 0.16); --neutral-soft: #161C2A;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 56px -12px rgba(0, 0, 0, 0.75);
    --focus: 0 0 0 3px rgba(57, 182, 255, 0.35); --lcl-accent: #39B6FF; --band-border: #222A3B; --skeleton: #131927; --skeleton-hi: #1A2132;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #05070D; --surface: #0B0F19; --surface-2: #0E1320; --surface-3: #141A29;
  --line: #222A3B; --line-soft: #1A2131; --text: #EEF2F8; --text-2: #A0A9BB; --text-3: #6E788C;
  --link: #39B6FF; --accent: #0A84FF; --accent-hover: #2A95FF; --accent-soft: rgba(57, 182, 255, 0.12); --accent-line: rgba(57, 182, 255, 0.4);
  --ok: #3DD68C; --ok-soft: rgba(18, 183, 106, 0.16); --warn: #F5B544; --warn-soft: rgba(245, 165, 36, 0.14);
  --danger: #FF6B72; --danger-soft: rgba(229, 72, 77, 0.16); --neutral-soft: #161C2A;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 56px -12px rgba(0, 0, 0, 0.75);
  --focus: 0 0 0 3px rgba(57, 182, 255, 0.35); --lcl-accent: #39B6FF; --band-border: #222A3B; --skeleton: #131927; --skeleton-hi: #1A2132;
  color-scheme: dark;
}

/* Logo swap: light artwork vs on-dark artwork */
.on-dark-only { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-light-only { display: none !important; }
  :root:not([data-theme="light"]) .on-dark-only { display: inline-block !important; }
}
:root[data-theme="dark"] .on-light-only { display: none !important; }
:root[data-theme="dark"] .on-dark-only { display: inline-block !important; }

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: -0.015em; font-weight: 600; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(10, 132, 255, 0.22); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); font-weight: 500; }
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---- Icons ---- */
.ico { width: 20px; height: 20px; flex: none; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 24px; height: 24px; }

/* ---- Type helpers ---- */
.eyebrow { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); }
.mono { font-family: var(--mono); font-feature-settings: normal; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }

/* ---- LCL lockup ---- */
.lockup { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none !important; }
.lockup img { height: 26px; width: auto; }
.labs-tag {
  font-family: var(--mono); font-weight: 600; font-size: 10.5px; line-height: 1; letter-spacing: 0.22em;
  padding: 5px 5px 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--link);
  text-transform: uppercase; white-space: nowrap;
}
.lockup.dark .labs-tag { border-color: #2A3242; color: var(--sky); }
.lockup.lg img { height: 34px; }
.lockup.lg .labs-tag { font-size: 12px; padding: 6px 6px 6px 9px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 500; font-size: 14px; line-height: 1; white-space: nowrap; text-decoration: none !important;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn .ico { width: 18px; height: 18px; margin-left: -2px; }
.btn-primary { background: var(--accent); color: #fff; --lcl-accent: #fff; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--text-3); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--link); font-weight: 500; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn-danger:hover { border-color: var(--danger); }
.btn-dark { background: #fff; color: var(--ink); }
.btn-dark:hover { background: #E8EEF7; }
.btn-outline-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.28); }
.btn-outline-dark:hover { border-color: #fff; background: rgba(255,255,255,.06); }
.btn-block { width: 100%; height: 42px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }

/* ---- Form controls ---- */
.field { display: grid; gap: 6px; align-content: start; }
.field + .field { margin-top: 16px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
label, .label { font-weight: 500; font-size: 13.5px; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238790A2' stroke-width='2'%3E%3Cpath d='M5 8.5L12 15.5L18.5 9.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--danger); font-weight: 500; }
.field-error:empty { display: none; }
.field-error .ico { width: 14px; height: 14px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 64px; }
.input-wrap .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 28px; padding: 0 8px; border: 0; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 500; border-radius: 4px; }
.input-wrap .reveal:hover { color: var(--text); background: var(--surface-3); }
.input-wrap .reveal:focus-visible { outline: none; box-shadow: var(--focus); }

.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 400; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--text-3); border-radius: 4px; background: var(--surface); display: grid; place-items: center; flex: none; transition: background .15s, border-color .15s; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.check input:focus-visible { outline: none; box-shadow: var(--focus); }
.check input[aria-invalid="true"] { border-color: var(--danger); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .18s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---- Alerts ---- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; border: 1px solid; }
.alert .ico { width: 18px; height: 18px; margin-top: 1px; }
.alert-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); --lcl-accent: var(--accent); }
.alert-info .ico { color: var(--link); }
.alert-error { background: var(--danger-soft); border-color: rgba(229,72,77,.4); color: var(--text); }
.alert-error .ico { color: var(--danger); }
.alert-ok { background: var(--ok-soft); border-color: rgba(18,183,106,.4); }
.alert-ok .ico { color: var(--ok); }

/* ---- Pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--link); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.plain::before { display: none; }

/* ---- Toasts ---- */
.toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--ink); color: #EEF2F8; box-shadow: var(--shadow-lg); font-size: 13.5px; border: 1px solid #1E2535; --lcl-accent: var(--sky); animation: toast-in .22s var(--ease); }
.toast .ico { width: 18px; height: 18px; color: var(--sky); margin-top: 1px; }
.toast.ok .ico { color: #3DD68C; }
.toast b { font-weight: 600; }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: #8790A2; padding: 0; height: 18px; }
.toast .toast-close .ico { color: inherit; width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Skeleton ---- */
.skel { display: block; border-radius: 4px; background: linear-gradient(90deg, var(--skeleton) 0, var(--skeleton-hi) 40%, var(--skeleton) 80%); background-size: 300% 100%; animation: skel 1.4s ease-in-out infinite; height: 12px; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---- Demo badge ---- */
.demo-badge { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .14em; padding: 3px 6px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
