/*
 * Studiolo by Ninth Orbit Software: a calm, professional studio look. Neutral charcoal surfaces, soft rounded
 * corners, sentence case, Manrope throughout, and the Studiolo amber-to-rose gradient kept for the brand and
 * the main action only. Orbitron is used for the Studiolo wordmark (and stays loaded for the ad templates).
 * Loaded after css/styles.css on every page, so it re-sets tokens and adds the shell (top bar, tool switcher).
 * One deliberate dark look: js/theme.js always sets data-theme="dark".
 */
@font-face { font-family: 'Orbitron'; font-weight: 700; font-display: swap; src: url(../fonts/ui/orbitron-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 900; font-display: swap; src: url(../fonts/ui/orbitron-latin-900-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 600; font-display: swap; src: url(../fonts/ui/chakra-petch-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 700; font-display: swap; src: url(../fonts/ui/chakra-petch-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url(../fonts/ui/manrope-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url(../fonts/ui/manrope-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url(../fonts/ui/manrope-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 800 900; font-display: swap; src: url(../fonts/ui/manrope-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(../fonts/ui/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

:root, :root[data-theme="dark"] {
  --bg: #0f1014;
  --bg-2: #14161b;
  --bg-glow: rgba(255, 140, 70, 0.06);
  --panel: #17191f;
  --panel-2: #1d2027;
  --panel-3: #252932;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ededf0;
  --muted: #9da3ae;
  --amber: #ffb547;
  --rose: #ff4d8d;
  --ice: #8ab4ff;
  --accent: #ff8a3d;
  --accent-2: #ff5a7a;
  --accent-soft: rgba(255, 138, 61, 0.12);
  --accent-text: #1d0f04;
  --grad: linear-gradient(120deg, #ffc35c 0%, #ff7a3d 50%, #ff4d8d 100%);
  --grad-full: linear-gradient(90deg, #ffb547 0%, #ff7a3d 50%, #ff4d8d 100%);
  --logo-a: #ffb547;
  --logo-b: #ff4d8d;
  --danger: #ff7a6b;
  --ok: #4ade80;
  --checker-a: #1a1c21;
  --checker-b: #22252b;
  --stage: #0b0c0f;
  --radius: 12px;
  --r: 10px;
  --cut: inset(0 round 10px);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --brand: 'Orbitron', 'Segoe UI', sans-serif;
  --display: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --ui: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Manrope', 'Segoe UI', system-ui, sans-serif; /* numbers and readouts: same face, tabular figures */
  --code: 'IBM Plex Mono', Consolas, monospace;
  color-scheme: dark;
}

body {
  font-family: var(--body);
  background: radial-gradient(ellipse 70% 40% at 80% -10%, rgba(255, 122, 61, 0.05), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-family: var(--ui); font-weight: 700; letter-spacing: 0; color: var(--muted); }
.btn, .format-btn, .chip, .seg button, .tab, .tabs button { font-family: var(--ui); letter-spacing: 0; }
.btn.primary { background: var(--grad); color: var(--accent-text); border-radius: var(--r); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.panel { background: var(--panel); }
.dropzone { border-color: var(--border-strong) !important; }
.dropzone:hover, .dropzone.over, .dropzone.drag { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent) inset; background-color: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
::selection { background: rgba(255, 122, 61, 0.35); }

/* Panel numbers and codes (01, 1.1, C-01, SEL…) are decoration from the console look; the clean look hides them. */
.deck-tab > i, .look-code, .gcode, .bt-step, .sec-code, .start-code, .sec h3 > span:first-child { display: none !important; }

/* The old pill dock, light/dark switch and per-page text nav are replaced by the top bar. */
.dock, .theme-toggle, .appnav, .topbar .brand .logo, .home-link { display: none !important; }

/* ---------- top bar (js/shell.js) ---------- */
.flight {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left));
  background: rgba(15, 16, 20, 0.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.fl-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.fl-mark { width: 28px; height: 28px; flex: none; border-radius: 7px; }
.fl-name { display: flex; flex-direction: column; line-height: 1; }
.fl-name b { font-family: var(--brand); font-weight: 900; font-size: 14px; letter-spacing: 0.08em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fl-name small { font-family: var(--ui); font-weight: 600; font-size: 10.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.fl-sep { width: 1px; height: 22px; background: var(--border-strong); }
.fl-tool { display: flex; align-items: center; gap: 9px; min-width: 0; font-family: var(--ui); font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.fl-tool .code { display: none; }
.fl-tool .tname { overflow: hidden; text-overflow: ellipsis; }
.fl-space { flex: 1; }
.fl-live { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.fl-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.fl-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  background: var(--panel-2); border: 0; box-shadow: inset 0 0 0 1px var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--ui); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none;
}
.fl-btn:hover { background: var(--panel-3); }
.fl-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fl-btn kbd { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; }

/* ---------- tool switcher: every tool, searchable (js/shell.js) ---------- */
.bay { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(8, 9, 11, 0.7); backdrop-filter: blur(10px); overflow-y: auto; overscroll-behavior: contain; }
.bay.open { display: block; animation: bay-in 0.18s ease-out; }
@keyframes bay-in { from { opacity: 0; } }
.bay-in { width: min(1100px, 100%); margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-left)) 40px; }
.bay-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.bay-search { flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 12px; }
.bay-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.bay-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-family: var(--ui); font-size: 16.5px; }
.bay-close { width: 48px; height: 48px; border: 0; background: var(--panel); box-shadow: inset 0 0 0 1px var(--border-strong); border-radius: 12px; color: var(--text); font-size: 22px; cursor: pointer; }
.bay-group { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; }
.bay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bay-foot { margin-top: 30px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Tool cards: shared by the tool switcher and the home page. */
.mod {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px;
  background: var(--panel); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--border); color: var(--text); text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}
.mod:hover, .mod:focus-visible, .mod.sel { transform: translateY(-2px); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow); outline: none; }
.mod-top { display: flex; align-items: center; gap: 10px; }
.mod-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--accent-soft); border-radius: 10px; }
.mod-ico svg { width: 21px; height: 21px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mod-code { display: none; }
.mod-title { font-family: var(--ui); font-weight: 700; font-size: 17px; }
.mod-text { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.mod-feats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 4px; }
.mod-feats span { font-size: 11.5px; font-weight: 600; color: #c9ccd3; padding: 2px 8px; background: rgba(255, 255, 255, 0.05); border-radius: 999px; }
.mod-new { position: absolute; right: 14px; top: 18px; font-size: 11px; font-weight: 700; color: var(--rose); }

/* Credit strip (home, about, tool switcher). */
.credit { font-family: var(--ui); font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.credit img { width: 34px; height: auto; }

/* Shared progress card used by the on-device cutout and long jobs. */
.job { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; width: min(420px, calc(100% - 24px)); padding: 14px 16px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-lg); border-radius: 12px; }
.job b { font-family: var(--ui); font-size: 13.5px; }
.job p { margin: 4px 0 8px; font-size: 12.5px; color: var(--muted); }
.job .bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.job .bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.2s; }

@media (max-width: 760px) {
  .flight { height: 52px; gap: 10px; }
  .fl-name small, .fl-live, .fl-btn kbd, .fl-btn .lbl { display: none; }
  .fl-tool { font-size: 13px; }
  .fl-btn { padding: 0 12px; height: 42px; min-width: 44px; }
  .bay-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
