/* ==========================================================================
   UnmarkAI — "Obsidian Emerald"
   Design tokens, layout primitives, components.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.9rem);
  --step-0: clamp(0.96rem, 0.92rem + 0.2vw, 1.06rem);
  --step-1: clamp(1.14rem, 1.06rem + 0.4vw, 1.35rem);
  --step-2: clamp(1.4rem, 1.24rem + 0.8vw, 1.85rem);
  --step-3: clamp(1.75rem, 1.45rem + 1.5vw, 2.6rem);
  --step-4: clamp(2.2rem, 1.6rem + 2.9vw, 4.1rem);

  --shell: 1220px;
  --shell-pad: clamp(1.15rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 9vw, 8rem);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 140ms var(--ease);
  --t-mid: 260ms var(--ease);
  --t-slow: 520ms var(--ease);
}

/* Dark — the default identity. */
[data-theme='dark'] {
  --bg: #070b0a;
  --bg-deep: #040706;
  --surface: #0c1310;
  --surface-2: #111b17;
  --surface-3: #17231e;
  --border: rgba(180, 235, 215, 0.1);
  --border-strong: rgba(180, 235, 215, 0.2);

  --text: #e9f2ee;
  --text-dim: #a7bab3;
  --text-mute: #748981;

  --brand: #00d992;
  --brand-hi: #2bf5b0;
  --brand-lo: #00a874;
  --cyan: #29d8f0;
  --gold: #f7bd45;
  --danger: #ff6b6b;

  --brand-soft: rgba(0, 217, 146, 0.13);
  --brand-line: rgba(0, 217, 146, 0.32);
  --on-brand: #04120d;

  --grad: linear-gradient(115deg, #00d992 0%, #29d8f0 52%, #8af7cd 100%);
  --grad-text: linear-gradient(100deg, #6ff2c4 0%, #29d8f0 48%, #f7bd45 105%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 40px 90px -34px rgba(0, 0, 0, 0.9);
  --glow: 0 0 0 1px var(--brand-line), 0 18px 50px -20px rgba(0, 217, 146, 0.45);

  --glass: rgba(12, 19, 16, 0.72);
  --grid-line: rgba(140, 220, 195, 0.055);
}

/* Light — same identity, re-weighted for contrast on white. */
[data-theme='light'] {
  --bg: #f4f7f6;
  --bg-deep: #e9efec;
  --surface: #ffffff;
  --surface-2: #f5f9f7;
  --surface-3: #ecf3f0;
  --border: rgba(8, 40, 32, 0.11);
  --border-strong: rgba(8, 40, 32, 0.2);

  --text: #08150f;
  --text-dim: #40554d;
  --text-mute: #64786f;

  --brand: #00915f;
  --brand-hi: #00a86e;
  --brand-lo: #007a50;
  --cyan: #0d8ba3;
  --gold: #a9700a;
  --danger: #c62f2f;

  --brand-soft: rgba(0, 145, 95, 0.1);
  --brand-line: rgba(0, 145, 95, 0.3);
  --on-brand: #ffffff;

  --grad: linear-gradient(115deg, #00915f 0%, #0d8ba3 52%, #22b98a 100%);
  --grad-text: linear-gradient(100deg, #00815440 0%, #0d8ba3 45%, #a9700a 105%);
  --grad-text: linear-gradient(100deg, #008154 0%, #0d8ba3 45%, #a9700a 105%);

  --shadow-sm: 0 1px 2px rgba(8, 40, 32, 0.07);
  --shadow-md: 0 12px 30px -14px rgba(8, 40, 32, 0.24);
  --shadow-lg: 0 36px 80px -36px rgba(8, 40, 32, 0.3);
  --glow: 0 0 0 1px var(--brand-line), 0 16px 42px -20px rgba(0, 145, 95, 0.35);

  --glass: rgba(255, 255, 255, 0.78);
  --grid-line: rgba(8, 60, 45, 0.045);
}

/* --- Reset -------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--t-mid), color var(--t-mid);
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p { text-wrap: pretty; }
code, kbd, samp { font-family: var(--font-mono); font-size: 0.9em; }

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

::selection { background: var(--brand); color: var(--on-brand); }

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

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 200;
  transform: translate(-50%, -120%);
  padding: 0.7rem 1.2rem;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 600;
  transition: transform var(--t-fast);
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Ambient background ------------------------------------------------- */

.bg-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 78%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: drift 26s var(--ease-in-out) infinite alternate;
}
[data-theme='light'] .bg-glow { opacity: 0.3; filter: blur(80px); }

.bg-glow--a {
  width: 46vw; height: 46vw;
  top: -14vw; left: -6vw;
  background: radial-gradient(circle, rgba(0, 217, 146, 0.42), transparent 68%);
}
.bg-glow--b {
  width: 40vw; height: 40vw;
  top: -6vw; right: -8vw;
  background: radial-gradient(circle, rgba(41, 216, 240, 0.32), transparent 68%);
  animation-delay: -9s;
}
.bg-glow--c {
  width: 34vw; height: 34vw;
  top: 46vh; left: 42vw;
  background: radial-gradient(circle, rgba(247, 189, 69, 0.16), transparent 70%);
  animation-delay: -17s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3vw, 5vh, 0) scale(1.14); }
}

/* --- Layout ------------------------------------------------------------- */

.shell {
  width: min(100% - (var(--shell-pad) * 2), var(--shell));
  margin-inline: auto;
}

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--divide { border-top: 1px solid var(--border); }

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: var(--step-3); margin-block: 0.75rem 1rem; }
.section-head p { color: var(--text-dim); font-size: var(--step-1); line-height: 1.6; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.section-head--center .eyebrow::after {
  content: '';
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ico { flex: none; }

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform var(--t-fast), box-shadow var(--t-mid),
              background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn--sm { padding: 0.58rem 1.05rem; font-size: 0.86rem; }
.btn--lg { padding: 1.05rem 2rem; font-size: 1.03rem; }
.btn--block { width: 100%; }

.btn--primary {
  position: relative;
  background: var(--grad);
  color: var(--on-brand);
  box-shadow: 0 10px 30px -12px rgba(0, 217, 146, 0.6);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px -14px rgba(0, 217, 146, 0.7);
}

.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-3); border-color: var(--brand-line); }

.btn--quiet { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn--quiet:hover { color: var(--text); border-color: var(--border-strong); }

.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.icon-btn__sun, .icon-btn__moon { display: grid; place-items: center; }
[data-theme='dark'] .icon-btn__moon { display: none; }
[data-theme='light'] .icon-btn__sun { display: none; }

/* --- Header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-block: 0.85rem;
  background: transparent;
  transition: background var(--t-mid), border-color var(--t-mid), padding var(--t-mid);
  border-bottom: 1px solid transparent;
}
.site-header.is-stuck {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom-color: var(--border);
  padding-block: 0.6rem;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.9rem, 0.78rem + 0.5vw, 1.1rem);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

/* The brand is a long compound word; below this it would push the nav controls
   off the bar, so only the mark is kept. */
@media (max-width: 420px) {
  .brand__text { display: none; }
}
/*
 * The logo carries its own gradient, so it sits bare — no tinted plate behind
 * it. A background here would fight the mark's own colours and box in a shape
 * that is meant to read as free-standing.
 */
.brand__mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: none;
}
@media (max-width: 640px) {
  .brand__mark { width: 30px; height: 30px; }
}

.site-nav {
  display: flex;
  gap: 0.35rem;
  margin-inline-start: auto;
}
.site-nav__link {
  padding: 0.5rem 0.85rem;
  border-radius: var(--r-pill);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color var(--t-fast), background var(--t-fast);
}
.site-nav__link:hover { color: var(--text); background: var(--surface-2); }
.site-nav__link.is-active { color: var(--brand); background: var(--brand-soft); }

.site-header__actions { display: flex; align-items: center; gap: 0.6rem; }
.nav-toggle { display: none; }

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: '';
  display: block;
  width: 17px;
  height: 1.8px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.nav-toggle__bars::before { transform: translateY(-5.5px); }
.nav-toggle__bars::after { transform: translateY(3.7px); }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::after { transform: rotate(-45deg) translateY(0); }

@media (max-width: 900px) {
  .nav-toggle { display: grid; }
  .site-nav {
    position: fixed;
    inset: 68px 0 auto;
    flex-direction: column;
    gap: 0;
    padding: 1rem var(--shell-pad) 1.5rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-block: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .site-nav__link { padding: 0.8rem 0.6rem; font-size: 1rem; border-radius: var(--r-sm); }
  .site-header__actions .btn { display: none; }
}

/* --- Hero --------------------------------------------------------------- */

/*
 * The hero and the uploader are one unit, sized so the drop target lands inside
 * the first screenful. Everything here is deliberately tight: the point of the
 * page is the tool, and a visitor should not have to scroll to find it.
 */
.hero {
  position: relative;
  padding-block: clamp(2rem, 5vw, 3.25rem) 0;
}

.hero__inner { max-width: 54rem; margin-inline: auto; text-align: center; }

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.42rem 0.42rem 0.9rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.6rem;
}
.hero__pill b { color: var(--text); font-weight: 600; }
.hero__pill span.tag {
  padding: 0.16rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.hero__sub {
  font-size: clamp(0.98rem, 0.94rem + 0.25vw, 1.15rem);
  color: var(--text-dim);
  max-width: 38rem;
  margin-inline: auto;
  line-height: 1.6;
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.7rem;
  margin-top: 1.5rem;
}

/* --- Mode tabs ---------------------------------------------------------- */

.mode-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem;
  margin-top: 1.5rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-mute);
  transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.mode-tab:hover { color: var(--text); }
.mode-tab.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--brand-line);
}

/* --- Hero decoration ---------------------------------------------------- */

.hero-decor {
  position: absolute;
  top: 3.5rem;
  width: 10rem;
  height: 13rem;
  border-radius: var(--r-lg);
  border: 5px solid var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0.85;
  pointer-events: none;
}
.hero-decor--left {
  left: 1rem;
  rotate: -7deg;
  background:
    radial-gradient(circle at 30% 25%, rgba(41, 216, 240, 0.85), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(247, 189, 69, 0.8), transparent 55%),
    linear-gradient(150deg, #00d992, #0b6b8f);
}
.hero-decor--right {
  right: 1rem;
  rotate: 7deg;
  background:
    radial-gradient(circle at 65% 30%, rgba(138, 247, 205, 0.8), transparent 55%),
    radial-gradient(circle at 25% 75%, rgba(41, 216, 240, 0.75), transparent 60%),
    linear-gradient(200deg, #0f2f2a, #00a874);
}

/*
 * The shell is 1220px wide and centred, so the side margin only clears a 10rem
 * card once the viewport passes ~1600px. Below that these would sit on top of
 * the headline, so they are dropped entirely rather than shrunk into confetti.
 */
@media (max-width: 1599px) {
  .hero-decor { display: none; }
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-dim);
}
.badge .ico { color: var(--brand); }

/* --- Workspace (the tool) ----------------------------------------------- */

/* Sits directly under the hero as one continuous block, not a separate band. */
.workspace {
  scroll-margin-top: 92px;
  padding-block: clamp(1.25rem, 3vw, 2rem) clamp(3rem, 6vw, 4.5rem);
}

.panel {
  position: relative;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-line) 25%, var(--brand-line) 75%, transparent);
}

.panel__bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.panel__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
}
.panel__title .ico { color: var(--brand); }
.panel__bar-spacer { margin-inline-start: auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mute);
}
.chip--ok { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.chip--warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.chip--live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.panel__body { padding: clamp(1.1rem, 2.5vw, 1.9rem); }

/* Drop zone */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 1rem;
  min-height: clamp(190px, 26vw, 250px);
  padding: clamp(1.5rem, 3vw, 2.25rem) 1.5rem;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--border-strong);
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, var(--brand-soft), transparent 70%),
    var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.dropzone:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.dropzone.is-dragging {
  border-color: var(--brand);
  border-style: solid;
  box-shadow: var(--glow);
  transform: scale(1.005);
}
.dropzone input[type='file'] { display: none; }

/* A span, not a button — the whole dropzone is the control, so a nested button
   would be a second tab stop that does the same thing. */
.dropzone__cta { pointer-events: none; }
.dropzone:hover .dropzone__cta {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px -14px rgba(0, 217, 146, 0.7);
}

.dropzone__title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  font-weight: 650;
}
.dropzone__hint { color: var(--text-dim); max-width: 34rem; font-size: 0.9rem; }
.dropzone__formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.dropzone__formats .chip { font-size: 0.68rem; }

/* Stage: before/after */
.stage { display: none; }
.stage.is-visible { display: block; }

/*
 * The frame shrink-wraps the media rather than filling the panel, so a tall or
 * large video cannot push the controls off-screen. Wrapping exactly is also what
 * keeps the "after" layer registered against the "before" one — both are inset:0
 * of this box, so it has to match the media's real displayed size, not the
 * column width.
 */
.compare {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    conic-gradient(from 45deg, var(--surface-3) 0 25%, var(--surface-2) 0 50%) 0 0 / 22px 22px;
  border: 1px solid var(--border);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.compare__media { position: relative; display: block; }
.compare__media > * {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(64vh, 560px);
}

.compare__after {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 0 0 var(--split, 50%));
}
.compare__after > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split, 50%);
  width: 2px;
  margin-left: -1px;
  background: var(--brand);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 24px rgba(0, 217, 146, 0.7);
  cursor: ew-resize;
}
.compare__grip {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  display: grid;
  grid-auto-flow: column;
  gap: 2px;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.compare__grip::before, .compare__grip::after {
  content: '';
  width: 0; height: 0;
  border-block: 5px solid transparent;
}
.compare__grip::before { border-right: 6px solid currentColor; }
.compare__grip::after { border-left: 6px solid currentColor; }

.compare__tag {
  position: absolute;
  top: 0.75rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--r-pill);
  background: rgba(4, 8, 7, 0.72);
  backdrop-filter: blur(8px);
  color: #e9f2ee;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}
.compare__tag--before { left: 0.75rem; }
.compare__tag--after { right: 0.75rem; color: var(--brand-hi); }

/* Detection marker drawn over the source */
.detect-box {
  position: absolute;
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(4, 8, 7, 0.35);
  pointer-events: none;
  animation: sweep 1.5s var(--ease) infinite;
}
@keyframes sweep { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Stage layout ----------------------------------------------------------- */

/*
 * `minmax(0, 1fr)` rather than `1fr`: a grid track's default minimum is its
 * content, so a large canvas would otherwise refuse to shrink and blow the
 * column out sideways.
 */
.stage__grid {
  display: grid;
  gap: clamp(1rem, 2.2vw, 1.75rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 960px) {
  .stage__grid { grid-template-columns: minmax(0, 1fr) 20rem; }
  /* The rail follows a tall preview instead of stranding the buttons below it. */
  .stage__side { position: sticky; top: 92px; }
}

.stage__main { min-width: 0; }

.stage__side {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.stage__block {
  padding: 0.95rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.stage__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.stage__label .ico { color: var(--brand); }

/* Key/value readout — the numbers the tool actually decided on. */
.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem 0.9rem;
  margin: 0;
  font-size: 0.84rem;
}
.kv dt { color: var(--text-mute); white-space: nowrap; }
.kv dd {
  margin: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.kv dd.is-good { color: var(--brand); }
.kv dd.is-soft { color: var(--gold); }

.stage__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-dim);
  cursor: pointer;
}
.stage__toggle input { accent-color: var(--brand); }

.stage__actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

#videoOutWrap { margin-top: 1.25rem; }
#videoOut {
  display: block;
  margin-inline: auto;
  max-width: 100%;
  max-height: min(56vh, 480px);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #000;
}

/* Outline of the box the detector settled on, drawn over the preview. */
.detect-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* Progress */
.progress {
  display: none;
  margin-top: 1.1rem;
}
.progress.is-visible { display: block; }
.progress__track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 180ms linear;
}
.progress__label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-mute);
}

/* Alerts */
.alert {
  display: none;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.alert.is-visible { display: flex; }
.alert .ico { margin-top: 2px; }
.alert--warn { border-color: color-mix(in srgb, var(--gold) 38%, transparent); background: color-mix(in srgb, var(--gold) 9%, transparent); }
.alert--warn .ico { color: var(--gold); }
.alert--error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.alert--error .ico { color: var(--danger); }
.alert--ok { border-color: var(--brand-line); background: var(--brand-soft); }
.alert--ok .ico { color: var(--brand); }
.alert b { color: var(--text); font-weight: 600; }

/* Manual brush mode */
.brush-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  font-size: 0.86rem;
}
.brush-bar.is-visible { display: flex; }

/* Anything that sends a file off-device is warned in gold, never in brand green. */
.brush-bar--warn {
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.brush-bar--warn .ico { color: var(--gold); }
.brush-bar--warn small { color: var(--text-mute); font-family: var(--font-mono); font-size: 0.72rem; }
.brush-bar label { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text-dim); }
.brush-bar input[type='range'] { width: 130px; accent-color: var(--brand); }

.brush-layer,
.select-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

/* Area picker sits above the compare handle so dragging selects, not splits. */
.select-layer { z-index: 5; }

/* --- Cards -------------------------------------------------------------- */

.grid { display: grid; gap: clamp(1rem, 2vw, 1.5rem); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.card {
  position: relative;
  padding: clamp(1.4rem, 2.4vw, 1.9rem);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: transform var(--t-mid), border-color var(--t-mid), box-shadow var(--t-mid);
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--brand-line), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--t-mid);
  pointer-events: none;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card:hover::after { opacity: 1; }

.card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
}
.card h3 { font-size: var(--step-1); margin-bottom: 0.6rem; }
.card p { color: var(--text-dim); font-size: 0.94rem; line-height: 1.62; }

/* Numbered steps */
.step { position: relative; }
.step__num {
  position: absolute;
  top: clamp(1.4rem, 2.4vw, 1.9rem);
  right: clamp(1.4rem, 2.4vw, 1.9rem);
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  opacity: 0.07;
}

/* --- Sources / formats -------------------------------------------------- */

.source-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.source-row:hover { border-color: var(--brand-line); background: var(--surface-2); }
.source-row__dot {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}
.source-row__name { font-family: var(--font-display); font-weight: 600; font-size: 0.96rem; }
.source-row__hint { font-size: 0.8rem; color: var(--text-mute); }
.source-row__kind {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.format-block { margin-top: 1.5rem; }
.format-block h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 0.7rem;
}
.format-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* --- Comparison table --------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
table.cmp {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.cmp th, table.cmp td {
  padding: 0.95rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.cmp tbody tr:last-child td { border-bottom: 0; }
table.cmp thead th {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--surface-2);
  white-space: nowrap;
}
table.cmp thead th.is-ours { color: var(--brand); }
table.cmp tbody td:not(:first-child) { text-align: center; width: 1%; white-space: nowrap; }
table.cmp tbody tr:hover { background: var(--surface-2); }
.cmp-yes { color: var(--brand); }
.cmp-no { color: var(--text-mute); opacity: 0.65; }

/* --- Privacy split ------------------------------------------------------ */

.split {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}

.proof {
  padding: clamp(1.5rem, 3vw, 2.2rem);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.proof__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.proof__head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.proof__head .dot:nth-child(2) { background: var(--gold); }
.proof__head .dot:nth-child(3) { background: var(--brand); }
.proof__head span:last-child { margin-inline-start: auto; }

pre.code {
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.85;
  color: var(--text-dim);
  tab-size: 2;
}
pre.code .c { color: var(--text-mute); font-style: italic; }
pre.code .k { color: var(--cyan); }
pre.code .s { color: var(--brand); }
pre.code .n { color: var(--gold); }

.check-list { display: grid; gap: 0.85rem; margin-top: 1.75rem; }
.check-list li { display: flex; gap: 0.75rem; align-items: flex-start; color: var(--text-dim); }
.check-list .ico { color: var(--brand); margin-top: 3px; }
.check-list b { color: var(--text); font-weight: 600; }

/* --- FAQ ---------------------------------------------------------------- */

.faq { max-width: 52rem; margin-inline: auto; display: grid; gap: 0.7rem; }

.faq__item {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.faq__item[open] { border-color: var(--brand-line); background: var(--surface-2); }

.faq__q {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q .ico {
  margin-inline-start: auto;
  color: var(--brand);
  transition: transform var(--t-mid);
}
.faq__item[open] .faq__q .ico { transform: rotate(180deg); }

.faq__a {
  padding: 0 1.3rem 1.25rem;
  color: var(--text-dim);
  font-size: 0.94rem;
  line-height: 1.68;
}
.faq__a code {
  padding: 0.12em 0.42em;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--cyan);
  white-space: nowrap;
}

/* --- CTA band ----------------------------------------------------------- */

.cta {
  position: relative;
  padding: clamp(2.75rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3.5rem);
  border-radius: var(--r-xl);
  border: 1px solid var(--brand-line);
  background:
    radial-gradient(ellipse 80% 120% at 50% 0%, var(--brand-soft), transparent 70%),
    var(--surface);
  text-align: center;
  overflow: hidden;
}
.cta h2 { font-size: var(--step-3); margin-bottom: 1rem; }
.cta p { color: var(--text-dim); font-size: var(--step-1); max-width: 38rem; margin: 0 auto 2rem; }
.cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

/* --- Prose (legal / article pages) -------------------------------------- */

.prose { max-width: 46rem; }
.prose > * + * { margin-top: 1.15rem; }
.prose h2 { font-size: var(--step-2); margin-top: 2.75rem; scroll-margin-top: 100px; }
.prose h3 { font-size: var(--step-1); margin-top: 2rem; }
.prose p, .prose li { color: var(--text-dim); line-height: 1.75; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul { display: grid; gap: 0.6rem; padding-left: 1.2rem; list-style: disc; }
.prose ol { display: grid; gap: 0.6rem; padding-left: 1.35rem; list-style: decimal; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.prose code {
  padding: 0.14em 0.45em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--cyan);
}
.prose .callout {
  padding: 1.15rem 1.35rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  background: var(--surface);
}
.prose .callout p { margin: 0; }
.prose .callout p + p { margin-top: 0.7rem; }

.page-head { padding-block: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-head h1 { font-size: var(--step-3); margin-block: 0.7rem 0.9rem; }
.page-head p { color: var(--text-dim); font-size: var(--step-1); max-width: 44rem; }

/* --- Footer ------------------------------------------------------------- */

.site-footer {
  margin-top: var(--section-y);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
}

.site-footer__top {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  grid-template-columns: minmax(min(100%, 20rem), 1.6fr) repeat(auto-fit, minmax(9rem, 1fr));
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.site-footer__blurb {
  margin-top: 1rem;
  max-width: 30rem;
  color: var(--text-dim);
  font-size: 0.91rem;
  line-height: 1.65;
}
.site-footer__note {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.83rem;
  color: var(--text-mute);
  max-width: 30rem;
}
.site-footer__note .ico { color: var(--gold); margin-top: 2px; }

.site-footer__heading {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 1rem;
}
.site-footer__col ul { display: grid; gap: 0.6rem; }
.site-footer__col a {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: color var(--t-fast);
}
.site-footer__col a:hover { color: var(--brand); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem 2rem;
  padding-top: 1.75rem;
  font-size: 0.82rem;
  color: var(--text-mute);
}
.site-footer__built { font-family: var(--font-mono); font-size: 0.76rem; }

/* --- Scroll reveal ------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
