@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300..800&family=Geist+Mono:wght@400;500&display=swap');

/* ==========================================================================
   VectaraSpace — Design System
   A polished, monochrome "creative tool" system (inspired by basement.studio's
   shader-lab / the Geist look): a near-black canvas with a soft radial glow,
   translucent glass panels with hairline borders, Geist Sans everywhere and
   Geist Mono for numeric values — with a single warm accent (#ff4d00).
   Every page — landing and every tool — shares this one dark theme and the
   same persistent sidebar, so the whole site reads as one app.
   ========================================================================== */

:root {
  /* ---- single brand accent ---- */
  --accent: #ff4d00;
  --accent-soft: rgba(255, 77, 0, 0.16);
  --magenta: var(--accent);      /* legacy alias — kept so older rules still work */

  /* ---- secondary hues (used only inside tool output, not chrome) ---- */
  --cyan: #00AEEF;
  --yellow: #F2C200;
  --key: #080808;

  /* ---- type ---- */
  --font-display: "Geist", system-ui, sans-serif;
  --font-body: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  /* ---- scale ---- */
  --radius: 8px;            /* control */
  --radius-panel: 12px;
  --radius-sm: 6px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --max: 1180px;
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 76px;

  /* default (light fallback — every page actually runs the dark theme below) */
  --bg: #F2EFE8;
  --bg-soft: #E9E4D8;
  --surface: #FBFAF6;
  --line: rgba(20, 19, 26, 0.13);
  --line-strong: rgba(20, 19, 26, 0.28);
  --text: #14131A;
  --text-mute: rgba(20, 19, 26, 0.62);
}

[data-theme="dark"] {
  --bg: #080808;                                /* canvas */
  --bg-soft: rgba(255, 255, 255, 0.04);         /* subtle inset surface */
  --surface: rgba(18, 18, 22, 0.55);            /* glass panel (pair with blur) */
  --surface-solid: #121216;                     /* opaque panel where blur won't work */
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --text-mute: rgba(255, 255, 255, 0.50);
  --glass-blur: blur(24px);
}

/* ---- reset ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 38%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.05; letter-spacing: -0.03em; font-weight: 700; }
.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---- registration mark (brand signature) ----
   Four overlapping, slightly mis-registered dots in C/M/Y/K — the literal
   printer's registration target used to align colour separations. */
.mark { width: 28px; height: 28px; flex-shrink: 0; object-fit: contain; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-size: 0.8rem; min-width: 0; }
.brand-word { white-space: nowrap; }
.sidebar-top .brand { font-size: 0.8rem; }
.sidebar-top .brand-word { font-size: inherit; }

/* ==========================================================================
   App shell — persistent sidebar + main content, used on every page
   ========================================================================== */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  overflow-y: auto;
  padding: 1.2rem 0.9rem;
  transition: width 0.18s ease;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-word,
.sidebar.collapsed .side-section-title,
.sidebar.collapsed .side-label,
.sidebar.collapsed .side-seeall,
.sidebar.collapsed .sidebar-foot-text { display: none; }
.sidebar.collapsed .side-link { justify-content: center; padding: 0.6rem; }
.sidebar.collapsed .sidebar-top { justify-content: center; }
.sidebar.collapsed .brand { justify-content: center; }

.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0 0.3rem; margin-bottom: 1.5rem;
}
.collapse-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: transparent; color: var(--text-mute); cursor: pointer;
}
.collapse-btn:hover { color: var(--text); border-color: var(--text); }
.collapse-btn svg { width: 15px; height: 15px; }

/* mobile hamburger button — hidden on desktop, shown in the mobile media query */
.sidebar-burger {
  display: none; width: 34px; height: 34px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: transparent; color: var(--text); cursor: pointer;
}
.sidebar-burger svg { width: 18px; height: 18px; }
.sidebar-burger .ic-close { display: none; }
.sidebar.menu-open .sidebar-burger .ic-open { display: none; }
.sidebar.menu-open .sidebar-burger .ic-close { display: block; }

/* wrapper is layout-transparent on desktop; becomes the floating drawer on mobile */
.sidebar-menu { display: contents; }

.side-section { margin-bottom: 1.5rem; }
.side-section-title {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--text-mute);
  padding: 0 0.6rem; margin-bottom: 0.45rem;
}
.side-link {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0.6rem; border-radius: 4px;
  font-size: 0.85rem; color: var(--text-mute);
  white-space: nowrap; overflow: hidden;
}
.side-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.side-label { overflow: hidden; text-overflow: ellipsis; }
.side-link:hover { background: var(--bg-soft); color: var(--text); }
.side-link.active { background: var(--text); color: var(--bg); }
.side-link-soon { cursor: default; }
.side-link-soon .side-label { color: var(--text-mute); }
.side-link-soon:hover { background: transparent; }
/* keep the sparkles icon fully visible & orange even on the locked item */
.side-ic-accent { display: inline-flex; flex-shrink: 0; color: var(--accent); }
.side-badge {
  margin-left: auto; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.08em;
  padding: 0.1rem 0.32rem; border-radius: 3px;
  background: var(--accent); color: #fff;
}
.side-link.active .side-badge { background: var(--bg); color: var(--text); }

/* "See all →" link under each sidebar group */
.side-seeall {
  display: flex; align-items: center; gap: 0.4rem;
  margin: 0.25rem 0 0; padding: 0.4rem 0.6rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: var(--text-mute); border-radius: 4px;
}
.side-seeall svg { width: 12px; height: 12px; transition: transform .15s ease; }
.side-seeall:hover { color: var(--accent); }
.side-seeall:hover svg { transform: translateX(3px); }

.sidebar-foot {
  margin-top: auto; padding: 0.9rem 0.6rem 0; border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--text-mute); line-height: 1.45;
}

.main-content { flex: 1; min-width: 0; }

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto;
    position: sticky; top: 0; z-index: 30;
    flex-direction: column; align-items: stretch; overflow: visible;
    padding: 0.55rem 1rem;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .sidebar.collapsed { width: 100%; }
  .sidebar-top { margin-bottom: 0; }
  .collapse-btn { display: none; }       /* desktop collapse is not used on phones */
  .sidebar-burger { display: flex; }

  /* nav + footer live in a FLOATING drawer that overlays the page,
     instead of pushing the page content down */
  .sidebar-menu {
    display: block;
    position: absolute; top: 100%; left: 0; right: 0;
    max-height: calc(100vh - 3.5rem); overflow-y: auto;
    padding: 0.4rem 1rem 1rem;
    background: var(--surface-solid, #121216);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-8px); opacity: 0;
    pointer-events: none; visibility: hidden;
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
  }
  .sidebar.menu-open .sidebar-menu {
    transform: translateY(0); opacity: 1; pointer-events: auto; visibility: visible;
  }
  .sidebar-menu .side-section { margin: 0.9rem 0 0; }
  .sidebar-menu .side-section-title { display: block; }
  .sidebar-menu .sidebar-foot { display: block; margin-top: 1rem; padding-top: 0.9rem; }
  .sidebar-menu .side-link { padding: 0.6rem 0.7rem; }
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.03em;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer; background: transparent; color: var(--text);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--text); }
.btn-solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-solid:hover { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--line); padding: 2.2rem var(--gutter) 2.6rem; margin-top: 3rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: space-between; align-items: center; }
.foot-note { font-size: 0.78rem; color: var(--text-mute); }

/* ==========================================================================
   Landing page
   ========================================================================== */
.hero { padding: 4rem 0 3.5rem; }
.hero .wrap { display: grid; gap: 2.6rem; }
.hero-kicker { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; }
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 4.1rem); max-width: 17ch; }
.hero h1 .accent-c { color: var(--cyan); }
.hero h1 .accent-m { color: var(--magenta); }
.hero h1 .accent-y { color: var(--yellow); }
.hero p.lede { font-size: 1.05rem; color: var(--text-mute); max-width: 46ch; margin-top: 1.1rem; }
.hero-actions { display: flex; gap: 0.9rem; margin-top: 1.8rem; flex-wrap: wrap; }

/* live demo stage */
.demo-stage { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.demo-stage-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-mute);
}
.demo-canvas-wrap { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.demo-canvas-wrap canvas { width: 100%; height: 100%; position: absolute; inset: 0; }
.demo-tag {
  position: absolute; top: 0.6rem; z-index: 5;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75); background: rgba(0,0,0,0.35); padding: 0.2rem 0.45rem; border-radius: 2px;
}
.demo-tag.left { left: 0.6rem; } .demo-tag.right { right: 0.6rem; }
.demo-slider {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-appearance: none; -moz-appearance: none; appearance: none; background: transparent; margin: 0; cursor: ew-resize;
  accent-color: transparent;
}
.demo-slider::-webkit-slider-runnable-track { background: transparent; }
/* thumb is an invisible wide grab area — the visible divider is .split-handle */
.demo-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 40px; height: 40px; background: transparent; cursor: ew-resize;
}
.demo-slider::-moz-range-track { background: transparent; border: none; }
.demo-slider::-moz-range-thumb { width: 40px; height: 40px; background: transparent; border: none; cursor: ew-resize; }

/* draggable split-compare handle: full divider line + centred round knob */
.split-handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 0;
  transform: translateX(-50%); pointer-events: none; z-index: 6;
}
.split-line {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  transform: translateX(-50%); background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.split-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
}
.split-knob svg { width: 12px; height: 12px; }
.demo-caption {
  display: flex; justify-content: space-between; padding: 0.7rem 1rem;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-mute);
  border-top: 1px solid var(--line);
}

/* plate grid (tool cards on landing) */
.section { padding: 3.2rem 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 1.1rem;
}
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }

.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 1000px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-card {
  background: var(--surface-solid, #121216);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  overflow: hidden;
  padding: 1.6rem; display: flex; flex-direction: column; gap: 1rem; min-height: 270px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--line-strong); background: #17171c; }
/* thumbnail bleeds to the full card width, flush with the top edge */
.tool-swatch { margin: -1.6rem -1.6rem 0; aspect-ratio: 16/9; overflow: hidden; border-bottom: 1px solid var(--line); }
.tool-swatch canvas, .tool-swatch img { width: 100%; height: 100%; object-fit: cover; }
/* icon-based swatch for category catalogue cards (no live canvas) */
.cat-swatch {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 30% 20%, var(--bg-soft), transparent 70%), #101015;
}
.cat-swatch svg { width: 40px; height: 40px; color: var(--text-mute); opacity: 0.9; }
.cat-swatch.accent svg { color: var(--accent); opacity: 1; }
.tool-card:hover .cat-swatch svg { color: var(--text); }
.tool-card-soon { cursor: default; }
.tool-card-soon:hover { transform: none; border-color: var(--line); background: transparent; }
.tool-link-soon { color: var(--accent); }
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { font-size: 0.86rem; color: var(--text-mute); margin: 0; flex-grow: 1; }
.tool-link { font-family: var(--font-mono); font-size: 0.76rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.tool-link svg { width: 13px; height: 13px; transition: transform .15s ease; }
.tool-card:hover .tool-link svg { transform: translateX(3px); }

/* why-strip */
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
@media (max-width: 760px) { .why-grid { grid-template-columns: 1fr; gap: 2.2rem; } }
.why-item .eyebrow { margin-bottom: 0.6rem; }
.why-item h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.why-item p { color: var(--text-mute); font-size: 0.9rem; margin: 0; }

/* faq */
.faq-item { border-bottom: 1px solid var(--line); padding: 1.3rem 0; }
.faq-q { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-family: var(--font-display); font-size: 1rem; gap: 1rem; }
.faq-q .plus { font-family: var(--font-mono); transition: transform .2s ease; color: var(--text-mute); }
.faq-item[open] .faq-q .plus { transform: rotate(45deg); }
.faq-a { color: var(--text-mute); font-size: 0.92rem; margin-top: 0.8rem; max-width: 64ch; }

/* ==========================================================================
   Tool workshop pages
   ========================================================================== */
.tool-header { padding: 1.5rem 0 1.1rem; border-bottom: 1px solid var(--line); }
.tool-header .wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.tool-back { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-mute); display: inline-flex; gap: 0.4rem; align-items: center; }
.tool-back:hover { color: var(--text); }
.tool-title { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; }
.tool-title h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.tool-title .num { font-family: var(--font-mono); color: var(--text-mute); font-size: 0.85rem; }
.tool-desc { color: var(--text-mute); font-size: 0.92rem; max-width: 64ch; }

.workshop { padding: 2.2rem 0 4rem; }
.workshop-grid { display: grid; grid-template-columns: 280px 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 760px) { .workshop-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Shared studio chrome — every tool page (.tool-page) adopts the Halftone
   look: orange process accent, compact title, full-bleed framed work area.
   ========================================================================== */
.tool-page { --magenta: var(--accent); }            /* single brand accent */

.tool-page .tool-header { padding: 1.1rem 0 0.9rem; border-bottom: none; }
.tool-page .tool-header .wrap { max-width: none; padding: 0 var(--gutter); }
.tool-page .tool-desc { display: none; }            /* keep the header compact */

/* ----------------------------------------------------------------------
   Adaptive app shell: each tool fills the viewport with NO page scrollbar.
   The header (+ toolbar) stay fixed; the work area flexes to fill the rest.
   When a control panel is taller than the viewport, only that panel scrolls
   internally — never the whole page.
   ---------------------------------------------------------------------- */
.tool-page .main-content { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.tool-page .tool-header,
.tool-page .ht-toolbar { flex: 0 0 auto; }
.tool-page .site-footer { display: none; }   /* app pages have no page footer */

.tool-page .workshop { flex: 1 1 auto; min-height: 0; padding: 0 var(--gutter) var(--gutter); }
.tool-page .workshop .wrap { max-width: none; padding: 0; height: 100%; }

/* unified card for the two-pane tools (controls + stage) */
.tool-page .workshop-grid {
  border-radius: var(--radius-panel); overflow: hidden;
  height: 100%; min-height: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* internal scroll: only the control panels scroll, the stage stays put */
.tool-page .ht-shell { height: 100%; min-height: 0; }
.tool-page .controls,
.tool-page .ht-panel,
.tool-page .ht-presets { overflow-y: auto; min-height: 0; }
.tool-page .stage { min-height: 0; }
.tool-page .ht-stage-area { min-height: 0; }

/* Phone / portrait-tablet: the fixed-height app shell doesn't fit a narrow
   screen, so revert to a normally-scrolling, single-column stacked layout. */
@media (max-width: 880px) {
  .tool-page .main-content { height: auto; overflow: visible; }
  .tool-page .workshop { flex: none; min-height: 0; padding: 0 var(--gutter) var(--gutter); }
  .tool-page .workshop .wrap { height: auto; }
  .tool-page .ht-shell,
  .tool-page .workshop-grid { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .tool-page .ht-panel,
  .tool-page .ht-presets,
  .tool-page .controls { overflow: visible; }
  .tool-page .ht-stage-area { min-height: 240px; }
  .tool-page .site-footer { display: block; }   /* footer is reachable again */
  .tool-page .ht-toolbar { flex-wrap: wrap; gap: 0.6rem; }
}

/* translucent glass for every tool panel surface */
.controls, .stage, .ht-panel, .ht-presets, .ht-toolbar, .ht-stage-area,
.demo-stage {
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}

.controls { background: var(--surface); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.4rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }
/* sub-section label — the quieter, lower tier of the label hierarchy */
.field-label {
  display: flex; justify-content: space-between; font-family: var(--font-mono);
  font-size: 0.68rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.04em;
}
.field-label span.val { color: var(--text); font-size: 0.72rem; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--line-strong); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--magenta); cursor: pointer; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--magenta);
  cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong);
}

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button {
  flex: 1; background: transparent; border: none; padding: 0.5rem 0.4rem; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-mute);
  border-right: 1px solid var(--line-strong);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--text); color: var(--bg); }

.upload-zone {
  border: 1.5px dashed var(--line-strong); border-radius: 4px;
  padding: 1.4rem; text-align: center; cursor: pointer;
  font-size: 0.84rem; color: var(--text-mute);
  display: flex; flex-direction: column; gap: 0.4rem; align-items: center;
}
.upload-zone:hover { border-color: var(--magenta); color: var(--text); }
.upload-zone input { display: none; }
.upload-zone svg { width: 22px; height: 22px; opacity: 0.7; }

.stage { background: var(--bg-soft); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; min-height: 480px; }
.stage-canvas-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px; background: var(--surface);
  overflow: hidden; min-height: 360px; position: relative;
}
.stage-canvas-area canvas { max-width: 100%; max-height: 100%; }
.stage-empty { color: var(--text-mute); font-size: 0.88rem; text-align: center; padding: 2rem; }
.stage-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem; font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-mute); }
.stage-stats { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.stage-stats b { color: var(--text); }
.stage-actions { display: flex; gap: 0.6rem; }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 0; border: 1px solid var(--line); }
.swatch { aspect-ratio: 1; display: flex; align-items: flex-end; padding: 0.5rem; cursor: pointer; border-right: 1px solid rgba(0,0,0,.08); border-bottom: 1px solid rgba(0,0,0,.08); position: relative; }
.swatch .hex { font-family: var(--font-mono); font-size: 0.7rem; background: rgba(255,255,255,.85); padding: 0.15rem 0.35rem; border-radius: 2px; color: #14131A; }
.swatch:hover::after {
  content: "Click to copy"; position: absolute; top: 0.4rem; right: 0.5rem;
  font-family: var(--font-mono); font-size: 0.62rem; background: rgba(255,255,255,.85); padding: 0.1rem 0.3rem; border-radius: 2px;
}

.toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--key); color: #fff; font-family: var(--font-mono); font-size: 0.78rem;
  padding: 0.65rem 1.1rem; border-radius: 4px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Halftone Studio — preset rail + stage + accordion control panel
   ========================================================================== */
.ht-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem var(--gutter); border-bottom: 1px solid var(--line);
  gap: 1rem; flex-wrap: wrap;
}
.ht-zoom { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-mute); }
.ht-icon-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: transparent; color: var(--text-mute); cursor: pointer;
}
.ht-icon-btn:hover { color: var(--text); border-color: var(--text); }
.ht-icon-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.ht-icon-btn svg { width: 14px; height: 14px; }
.ht-zoom-val { min-width: 3.2em; text-align: center; }
.ht-view-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.ht-shell { display: grid; grid-template-columns: 208px 1fr 300px; gap: 1px; background: var(--line); border: 1px solid var(--line); min-height: 600px; }
@media (max-width: 1180px) { .ht-shell { grid-template-columns: 190px 1fr 280px; } }
@media (max-width: 920px) { .ht-shell { grid-template-columns: 1fr; } }

.ht-presets { background: var(--surface); padding: 1.1rem 0.8rem; display: flex; flex-direction: column; gap: 1.3rem; }
.ht-presets-title { padding: 0 0.4rem; }
.ht-preset-list { display: flex; flex-direction: column; gap: 0.15rem; }
.ht-preset-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.55rem; border-radius: 4px; border: none; background: transparent;
  font-size: 0.83rem; color: var(--text-mute); cursor: pointer; text-align: left;
  font-family: var(--font-body);
}
.ht-preset-item:hover { background: var(--bg-soft); color: var(--text); }
.ht-preset-item.active { background: var(--text); color: var(--bg); }
.ht-preset-glyph { font-size: 1rem; width: 1.1em; text-align: center; flex-shrink: 0; color: var(--magenta); }
.ht-preset-item.active .ht-preset-glyph { color: var(--bg); }
.ht-preset-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ht-preset-remove { opacity: 0; flex-shrink: 0; font-family: var(--font-mono); font-size: 0.78rem; padding: 0 0.2rem; }
.ht-preset-item:hover .ht-preset-remove { opacity: 0.7; }
.ht-preset-remove:hover { opacity: 1 !important; color: var(--magenta); }
.ht-user-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0.4rem; }
.ht-user-empty { font-size: 0.78rem; color: var(--text-mute); padding: 0.3rem 0.55rem; line-height: 1.5; }
.ht-new-preset-row { display: flex; gap: 0.4rem; padding: 0 0.2rem; }
.ht-new-preset-row input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 4px;
  color: var(--text); font-family: var(--font-body); font-size: 0.82rem; padding: 0.4rem 0.5rem;
}

.ht-panel { background: var(--surface); display: flex; flex-direction: column; }
.ht-section { border-bottom: 1px solid var(--line); }
/* section ("hero") label — the dominant, upper tier of the label hierarchy */
.ht-section-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1.1rem; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text);
}
.ht-section-head::-webkit-details-marker { display: none; }
.ht-section-head:hover { color: var(--accent); }
.ht-section-head .chev { transition: transform 0.18s ease; color: var(--text-mute); }
.ht-section[open] .ht-section-head .chev { transform: rotate(180deg); }
.ht-section-body { padding: 0 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 1.1rem; }

.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-strong); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg-grid button { background: var(--surface); border: none; padding: 0.55rem 0.3rem; cursor: pointer; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-mute); }
.seg-grid button.active { background: var(--text); color: var(--bg); }

.ht-color-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.ht-color-row .field-label { flex: 1; margin: 0; }
input[type="color"] { width: 36px; height: 28px; flex-shrink: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: none; padding: 2px; cursor: pointer; }

.ht-stage-area.zoomable { overflow: auto; }
.ht-stage-area .zoom-target { transition: transform 0.1s ease; transform-origin: center center; }
.split-wrap { position: relative; width: 100%; }
.split-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.split-wrap .demo-tag { font-size: 0.6rem; }

.ht-checkerboard {
  background-color: #2a2a2d;
  background-image:
    linear-gradient(45deg, #3a3a3d 25%, transparent 25%, transparent 75%, #3a3a3d 75%),
    linear-gradient(45deg, #3a3a3d 25%, transparent 25%, transparent 75%, #3a3a3d 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
