/* VideoKit — see DESIGN.md for the reasoning behind each token. */

/* Fonts are served from this site (SIL Open Font License), so no request goes to a third party. */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Theme-independent tokens. */
:root {
  --font-head: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: clamp(2.25rem, 4vw, 3.25rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --r-sm: 6px;
  --r-md: 10px;
  --wrap: 1180px;
  --gutter: 24px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

/*
 * Colour tokens: the site has one theme, light, whatever the visitor's system preference is (color-scheme: light
 * keeps native controls and scrollbars light too). Every colour used below this block must be one of these
 * variables; tests/design-lint.php enforces that and checks the contrast of each pair.
 * "viewer" is the work area (drop zone, preview, timeline, result).
 */
:root {
  color-scheme: light;
  --paper: #F3F5F7;           /* page background */
  --surface: #FFFFFF;         /* panels, inputs, menus */
  --surface-2: #E9EDF0;       /* subtle fills, chips */
  --line: #D3DAE0;            /* borders and dividers */
  --ink: #121619;             /* text and headings */
  --ink-2: #4A5660;           /* secondary text */
  --primary: #0A6B66;
  --primary-hover: #08544F;
  --primary-ink: #FFFFFF;
  --primary-soft: #DDF0EE;
  --success: #1F7A3A;
  --warning: #8A5A00;
  --danger: #B3261E;
  --success-soft: #E3F2E7;
  --warning-soft: #FBF0DA;
  --danger-soft: #FBE7E5;
  --shadow: 0 1px 2px rgba(18, 22, 25, .06), 0 8px 24px rgba(18, 22, 25, .08);
  --shadow-sm: 0 1px 2px rgba(18, 22, 25, .12);

  --marker: #B26B00;          /* in/out markers, accents on the work area */
  --marker-ink: #8F5600;      /* amber used as text */
  --marker-hover: #8F5600;
  --viewer: #E4E9EE;          /* work area background */
  --viewer-line: #C2CBD3;
  --viewer-dash: #75828E;     /* drop zone outline */
  --viewer-strong: #0B0F12;   /* strongest text on the work area */
  --viewer-ink: #1B2228;
  --viewer-ink-2: #4A5660;
  --track: #9AA8B4;           /* timeline bar */
  --v-ok: #17692F;            /* status colours on the work area */
  --v-err: #A5231B;
  --v-warn: #7A4F00;

  --logo-frame: #14191D;
  --logo-play: #FFFFFF;
  --logo-in: #E8A317;

  /* The editor is a dark studio inside the light site: video work reads better on a dark surround. */
  --studio: #12171B;          /* workspace background */
  --studio-2: #1B2228;        /* panels and bars */
  --studio-3: #263038;        /* raised controls, clips */
  --studio-line: #38454E;     /* borders in the studio */
  --studio-ink: #F1F5F8;      /* text on the studio */
  --studio-ink-2: #A9B6BF;    /* secondary text on the studio */
  --studio-accent: #55D6C6;   /* selection, playhead, primary action */
  --studio-accent-ink: #05221E;
  --studio-warm: #E8A317;     /* audio clips and markers */
  --studio-danger: #FF9A8F;
  --studio-ok: #86DFA0;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--fs-base)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, .h4 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 var(--s-4); color: var(--ink); }
h1 { font-size: var(--fs-3xl); line-height: 1.05; font-weight: 800; }
h2 { font-size: var(--fs-2xl); line-height: 1.2; }
h3 { font-size: var(--fs-xl); line-height: 1.3; }
.h4 { font-size: var(--fs-lg); line-height: 1.45; }
p { margin: 0 0 var(--s-4); }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-hover); }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon--sm { width: 16px; height: 16px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: var(--s-4); top: -60px; z-index: 50; background: var(--primary); color: var(--primary-ink); padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); }
.skip:focus { top: var(--s-2); }

.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(760px + 2 * var(--gutter)); }
.lead { font-size: var(--fs-lg); line-height: 1.5; color: var(--ink-2); max-width: 62ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5); border-radius: var(--r-sm);
  font: 600 var(--fs-sm)/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--ink-2); color: var(--ink); }
.btn--quiet { background: transparent; color: var(--primary); padding: 0 var(--s-3); }
.btn--quiet:hover { background: var(--primary-soft); }
.btn--ghost { background: transparent; color: var(--viewer-ink); border-color: var(--viewer-line); }
.btn--ghost:hover { border-color: var(--viewer-ink-2); color: var(--viewer-strong); }
.btn--sm { min-height: 36px; padding: 0 var(--s-4); }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(8px); }
.topbar__in { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--s-5); }
.logo { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; color: var(--ink); text-decoration: none; font: 800 1.1875rem/1 var(--font-head); letter-spacing: -0.02em; }
.logo:hover { color: var(--ink); }
.logo__mark { width: 30px; height: 30px; }
.logo__frame { fill: var(--logo-frame); }
.logo__play { fill: var(--logo-play); }
.logo__in { fill: var(--logo-in); }

.nav { position: relative; }
.nav__mobile { display: none; }
.nav__toggle::-webkit-details-marker, .nav__tools > summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.nav__panel { display: flex; align-items: center; gap: var(--s-2); }
.nav__panel > a, .nav__tools > summary {
  display: inline-flex; align-items: center; gap: var(--s-1); min-height: 40px; padding: 0 var(--s-3);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: var(--fs-sm); border-radius: var(--r-sm); cursor: pointer; list-style: none;
}
.nav__panel > a:hover, .nav__tools > summary:hover { background: var(--surface-2); color: var(--ink); }
.nav__panel > a[aria-current="page"] { color: var(--primary); }
.nav__panel > a.nav__cta { color: var(--primary-ink); margin-left: var(--s-2); }
.nav__panel > a.nav__cta:hover { background: var(--primary-hover); color: var(--primary-ink); }
.nav__tools { position: relative; }
.nav__tools[open] > summary .icon { transform: rotate(180deg); }
.megamenu {
  position: absolute; right: -180px; top: calc(100% + 8px); width: min(760px, 92vw);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: var(--s-5);
}
.megamenu__head { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin: 0 0 var(--s-2); }
.megamenu ul { list-style: none; margin: 0; padding: 0; }
.megamenu a { display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-2); margin: 0 calc(-1 * var(--s-2)); color: var(--ink); text-decoration: none; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.megamenu a:hover, .megamenu a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.megamenu .icon { color: var(--ink-2); }

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; list-style: none; font-weight: 500; font-size: var(--fs-sm); }
  .nav__mobile { display: block; }
  .nav__mobile:not([open]) + .nav__panel { display: none; }
  .nav__panel {
    position: absolute; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 32px));
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: var(--s-3);
    max-height: calc(100vh - 90px); overflow: auto;
  }
  .nav__panel > a, .nav__tools > summary { min-height: 44px; }
  .nav__panel > a.nav__cta { margin: var(--s-2) 0 0; }
  .megamenu { position: static; width: auto; grid-template-columns: 1fr; gap: var(--s-3); box-shadow: none; border: 0; padding: 0 var(--s-3) var(--s-3); }
}

/* ---------- breadcrumbs ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; margin: 0; padding: var(--s-4) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.crumbs li + li::before { content: "/"; margin-right: var(--s-2); color: var(--line); }
.crumbs a { color: var(--ink-2); }

/* ---------- sections ---------- */
.section { padding: var(--s-8) 0; }
.section--alt { background: var(--surface); border-block: 1px solid var(--line); }
.section--first { padding-top: var(--s-6); }
.section > .wrap > h2 { margin-bottom: var(--s-5); }

.hero { padding: var(--s-6) 0 var(--s-8); }
.hero__copy { margin-bottom: var(--s-5); max-width: 860px; }
.hero__copy h1 { margin-bottom: var(--s-3); }
.hero__copy .lead { margin: 0; }
.hero--tool { padding-top: var(--s-4); }

/* ---------- workbench (signature) ---------- */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
.viewer { background: var(--viewer); color: var(--viewer-ink); border: 1px solid var(--viewer-line); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 400px; }
.viewer__stage { flex: 1; display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); }
.viewer__status { display: flex; align-items: center; gap: var(--s-2); margin: 0; padding: var(--s-3) var(--s-4) var(--s-4); font-size: var(--fs-sm); color: var(--viewer-ink-2); font-variant-numeric: tabular-nums; }
.viewer__status.is-error { color: var(--v-err); }
.viewer__status.is-done { color: var(--v-ok); }

.drop {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s-2);
  border: 1.5px dashed var(--viewer-dash); border-radius: var(--r-sm); padding: var(--s-7) var(--s-5); cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--marker); background: color-mix(in srgb, var(--marker) 9%, transparent); }
.drop:focus-within { outline: 3px solid var(--marker); outline-offset: 2px; }
.drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop__icon { width: 36px; height: 36px; color: var(--marker); margin-bottom: var(--s-2); }
.drop__title { font: 700 var(--fs-xl)/1.2 var(--font-head); letter-spacing: -0.01em; color: var(--viewer-strong); }
.drop__or { color: var(--viewer-ink-2); }
.drop__btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); margin-left: var(--s-1); border-radius: var(--r-sm); background: var(--viewer-ink); color: var(--viewer); font-weight: 600; font-size: var(--fs-sm); }
.drop:hover .drop__btn { background: var(--viewer-strong); }
.drop__limits { margin-top: var(--s-3); font-size: var(--fs-xs); color: var(--viewer-ink-2); max-width: 46ch; }

.picked { flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--s-3); min-width: 0; }
.picked__video { width: 100%; max-height: 380px; background: #000; border-radius: var(--r-sm); }
.picked__list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s-2); counter-reset: clip; }
.picked__list li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border: 1px solid var(--viewer-line); border-radius: var(--r-sm); counter-increment: clip; font-size: var(--fs-sm); }
.picked__list li::before { content: counter(clip); font-weight: 700; color: var(--marker-ink); min-width: 1.2em; }
.picked__list .clip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked__list .clip__size { color: var(--viewer-ink-2); font-variant-numeric: tabular-nums; }
.picked__list button { background: none; border: 1px solid var(--viewer-line); color: var(--viewer-ink); border-radius: 4px; width: 32px; height: 32px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.picked__list button:hover:not(:disabled) { border-color: var(--viewer-ink-2); }
.picked__list button:disabled { opacity: .35; cursor: default; }
.picked__list .up .icon { transform: rotate(180deg); }
.picked__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.picked__name { margin: 0; font-weight: 600; color: var(--viewer-strong); overflow-wrap: anywhere; }
.picked__facts { margin: 0; flex: 1; font-size: var(--fs-sm); color: var(--viewer-ink-2); font-variant-numeric: tabular-nums; }

.timeline { position: relative; height: 26px; margin: 0 var(--s-4); touch-action: none; cursor: pointer; }
.timeline__track { position: absolute; left: 0; right: 0; top: 10px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.timeline__sel { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--marker) 30%, transparent); }
.timeline__fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--marker); transition: width .4s var(--ease); }
.timeline__head { position: absolute; top: 4px; width: 2px; height: 18px; margin-left: -1px; border-radius: 1px; background: var(--viewer-strong); opacity: .85; pointer-events: none; }
.timeline__in, .timeline__out {
  position: absolute; top: 3px; width: 6px; height: 20px; margin: 0 0 0 -3px; padding: 0; border: 0; border-radius: 3px;
  background: var(--marker); cursor: ew-resize; touch-action: none;
}
.timeline__in::after, .timeline__out::after { content: ""; position: absolute; inset: -6px -10px; }   /* larger grab area */
.timeline__in:hover, .timeline__out:hover { background: var(--marker-hover); }
.timeline__in:focus-visible, .timeline__out:focus-visible { outline: 3px solid var(--viewer-strong); outline-offset: 2px; }
.timeline__in:disabled, .timeline__out:disabled { cursor: default; opacity: .55; pointer-events: none; }
.timeline.is-working { cursor: default; }
.timeline.is-working .timeline__sel, .timeline.is-working .timeline__head, .timeline.is-working .timeline__in, .timeline.is-working .timeline__out { display: none; }
.timeline.is-indeterminate .timeline__fill { width: 30% !important; animation: slide 1.4s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.viewer__hint { display: flex; align-items: flex-start; gap: var(--s-2); margin: 0; padding: var(--s-1) var(--s-4) 0; font-size: var(--fs-sm); color: var(--viewer-ink-2); }
.viewer__hint .icon { margin-top: 3px; color: var(--marker); }

.result { flex: 1; display: grid; gap: var(--s-4); align-content: start; min-width: 0; }
.result__media { width: 100%; max-height: 360px; object-fit: contain; background: #000; border-radius: var(--r-sm); }
.result audio.result__media { background: transparent; }
.result__head { display: flex; align-items: center; gap: var(--s-2); margin: 0; font: 700 var(--fs-lg)/1.3 var(--font-head); color: var(--viewer-strong); }
.result__head .icon { color: var(--v-ok); }
.result__head.is-error .icon { color: var(--v-err); }
.compare { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: var(--s-1) var(--s-6); margin: 0; font-variant-numeric: tabular-nums; }
.compare dt { font-size: var(--fs-xs); color: var(--viewer-ink-2); }
.compare dd { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--viewer-strong); }
.compare dd.is-good { color: var(--v-ok); }
.compare dd.is-bad { color: var(--v-warn); }
.result__note { font-size: var(--fs-sm); color: var(--viewer-ink-2); margin: 0; }
.result__note.is-warn { color: var(--v-warn); }
.result__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.metatable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.metatable th, .metatable td { text-align: left; padding: var(--s-2) var(--s-3) var(--s-2) 0; border-bottom: 1px solid var(--viewer-line); vertical-align: top; }
.metatable th { color: var(--viewer-ink-2); font-weight: 500; width: 40%; }
.metatable td { color: var(--viewer-strong); }

.settings { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-5); display: grid; gap: var(--s-4); }
.settings__group { display: grid; gap: var(--s-4); }
.field { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 6px; }
.field > label, .field > legend { font-weight: 600; font-size: var(--fs-sm); padding: 0; }
.field legend { margin-bottom: 6px; }
.field--check label { display: flex; align-items: center; gap: var(--s-2); font-weight: 500; cursor: pointer; }
.field--check input { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { margin: 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-2); }
input[type="file"] { width: 100%; padding: 8px var(--s-3); border: 1px dashed var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2); font: 500 var(--fs-sm) var(--font-body); cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: var(--s-3); padding: 6px 12px; border: 0; border-radius: 6px;
  background: var(--surface-2); color: var(--ink); font: 600 var(--fs-sm) var(--font-body); cursor: pointer; }
input[type="file"]:focus { border-color: var(--primary); }
select, input[type="text"], input[type="number"], input[type="password"], input[type="email"], input[type="url"], textarea {
  width: 100%; min-height: 44px; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: 500 var(--fs-sm) var(--font-body); font-variant-numeric: tabular-nums;
}
select { appearance: none; padding-right: 36px; cursor: pointer;
  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='%234A5660' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select:focus, input:focus { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--danger); }
.time-row { display: flex; gap: var(--s-2); }
.time-row input { flex: 1; }
.time-row .btn { white-space: nowrap; }

.seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; background: var(--surface-2); }
.seg label { flex: 1 1 auto; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 var(--s-3); border-radius: 4px; font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 1px; }

.alert { margin: 0; padding: var(--s-3) var(--s-4); border-left: 3px solid; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--fs-sm); }
.alert--danger { border-color: var(--danger); background: var(--danger-soft); color: var(--ink); }
.alert--success { border-color: var(--success); background: var(--success-soft); color: var(--ink); }

@media (max-width: 920px) {
  .bench { grid-template-columns: 1fr; }
  .viewer { min-height: 320px; }
}

/* ---------- tool index ---------- */
.toolindex { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6) var(--s-5); }
.toolindex h3 { font-size: var(--fs-sm); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin-bottom: var(--s-3); }
.toolindex ul, .related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.toolrow { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s var(--ease); }
.toolrow:hover { border-color: var(--primary); color: var(--ink); }
.toolrow .icon { color: var(--primary); margin-top: 2px; }
.toolrow strong { display: block; font-weight: 600; font-size: var(--fs-sm); }
.toolrow strong + span { display: block; font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.45; }
.toolindex__group--feature .toolrow { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.toolindex__group--feature .toolrow strong { font-size: var(--fs-base); }
@media (max-width: 1000px) { .toolindex { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .toolindex { grid-template-columns: 1fr; } }

/* ---------- content layouts ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-7); align-items: start; }
.split--narrow { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
.cols h3 { font-size: var(--fs-lg); }
.cols h3 a { color: var(--ink); text-decoration: none; }
.cols h3 a:hover { color: var(--primary); text-decoration: underline; }
@media (max-width: 900px) { .split, .split--narrow, .cols { grid-template-columns: 1fr; gap: var(--s-5); } }

.prose { max-width: 68ch; }
.prose h2 { margin-top: var(--s-7); }
.prose h2:first-child, .prose h1 + .byline + .lead + h2 { margin-top: 0; }
.prose h3 { margin-top: var(--s-5); font-size: var(--fs-lg); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 var(--s-4); }
.prose li { margin-bottom: var(--s-2); }
.prose li::marker { color: var(--ink-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 var(--s-5); font-size: var(--fs-sm); display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: var(--s-2) var(--s-4) var(--s-2) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose thead th { font-weight: 600; border-bottom-color: var(--ink-2); }
.prose tbody th { font-weight: 600; }
.prose .btn { margin: 0 var(--s-2) var(--s-2) 0; }
.byline { font-size: var(--fs-sm); color: var(--ink-2); }
.note { padding: var(--s-3) var(--s-4); border-left: 3px solid var(--marker); background: var(--warning-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--fs-sm); }
.deflist dt { font-weight: 600; margin-top: var(--s-4); }
.deflist dd { margin: var(--s-1) 0 0; color: var(--ink-2); }

.article { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-8); align-items: start; }
.aside { display: grid; gap: var(--s-6); position: sticky; top: 88px; }
.specs dl { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.specs dl div { display: grid; grid-template-columns: 1fr 1.3fr; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.specs dt { color: var(--ink-2); }
.specs dd { margin: 0; font-weight: 500; }
.toolrow--sm { padding: var(--s-2) var(--s-3); }
.linklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.linklist a { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-sm); padding: 6px 0; }
.linklist .icon { margin-top: 3px; }
@media (max-width: 960px) { .article { grid-template-columns: 1fr; gap: var(--s-6); } .aside { position: static; } }

.sizes { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-5); }
.sizes figcaption { font-weight: 600; margin-bottom: var(--s-3); }
.sizes dl { margin: 0; display: grid; gap: var(--s-4); }
.sizes dt { font-weight: 600; font-size: var(--fs-sm); display: flex; align-items: center; gap: var(--s-2); }
.sizes dt::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--marker); }
.sizes dd { margin: var(--s-1) 0 0 12px; font-size: var(--fs-sm); color: var(--ink-2); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-5); counter-reset: step; }
.steps li { counter-increment: step; padding-top: var(--s-4); border-top: 2px solid var(--line); position: relative; }
.steps li::before { content: counter(step); position: absolute; top: -13px; left: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 700 var(--fs-xs)/24px var(--font-body); text-align: center; }
.steps h3 { font-size: var(--fs-lg); margin: var(--s-2) 0 var(--s-2); }
.steps p { font-size: var(--fs-sm); color: var(--ink-2); margin: 0; }
@media (max-width: 960px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.facts li { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--fs-sm); }
.facts .icon { color: var(--primary); margin-top: 2px; }

.guidelist { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.guidelist a { display: block; height: 100%; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); text-decoration: none; color: var(--ink); }
.section:not(.section--alt) .guidelist a { background: var(--surface); }
.guidelist a:hover { border-color: var(--primary); }
.guidelist strong { display: block; font-family: var(--font-head); font-size: var(--fs-lg); line-height: 1.3; letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.guidelist span { font-size: var(--fs-sm); color: var(--ink-2); }
.guidelist--stack { grid-template-columns: 1fr; margin-top: var(--s-6); }
@media (max-width: 900px) { .guidelist { grid-template-columns: 1fr; } }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); padding: var(--s-4) 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary:hover { color: var(--primary); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq__a { padding: 0 0 var(--s-4); color: var(--ink-2); max-width: 68ch; }
.faq__a p { margin: 0; }

.notfound { min-height: 50vh; text-align: center; }
.notfound .lead { margin-inline: auto; }

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); padding: var(--s-7) 0 var(--s-5); font-size: var(--fs-sm); }
.footer__grid { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr); gap: var(--s-5); }
.footer__brand p { color: var(--ink-2); margin-top: var(--s-3); max-width: 34ch; }
.footer__head { font-weight: 600; margin: 0 0 var(--s-2); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer ul a { color: var(--ink-2); text-decoration: none; }
.footer ul a:hover { color: var(--primary); text-decoration: underline; }
.footer__legal { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); color: var(--ink-2); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-2) var(--s-5); }
.footer__legal p { margin: 0; }
.footer__legal a { color: var(--ink-2); }
.footer__credit { font-size: var(--fs-xs); }
.footer__credit a { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: color .15s var(--ease), text-decoration-color .15s var(--ease); }
.footer__credit a:hover { color: var(--primary); text-decoration-color: currentColor; }
@media (max-width: 1000px) { .footer__grid { grid-template-columns: repeat(3, 1fr); } .footer__brand { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer__grid { grid-template-columns: 1fr 1fr; } }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  :root { --gutter: 16px; --fs-2xl: 1.625rem; --fs-xl: 1.3125rem; }
  .section { padding: var(--s-7) 0; }
  .hero { padding: var(--s-5) 0 var(--s-7); }
  .drop { padding: var(--s-6) var(--s-4); }
  .settings { padding: var(--s-4); }
  .compare { grid-template-columns: repeat(2, auto); }
}

/* Ad slots: rendered only when an AdSense ID and a slot ID are set; the ad script loads after consent. */
.ad { display: grid; gap: var(--s-1); margin-block: var(--s-6); justify-items: center; }
.aside .ad { margin-block: 0; }
.ad__label { font-size: var(--fs-xs); color: var(--ink-2); }
.ad__slot { display: block; width: 100%; max-width: 728px; min-height: 90px; }
.ad--rect .ad__slot { max-width: 336px; min-height: 250px; }

/* Consent banner */
.consent { position: fixed; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); z-index: 80; max-width: 560px; padding: var(--s-5); display: grid; gap: var(--s-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.consent[hidden] { display: none; }
.consent__title { margin: 0; font-size: var(--fs-lg); }
.consent__text { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.consent__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.footer__choices { padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; text-decoration: underline; cursor: pointer; }
.footer__choices:hover { color: var(--ink); }

/* Admin panel */
.admin { max-width: 760px; }
.admin__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); }
.admin__head h1, .admin__head form { margin: 0; }
.admin > .alert { margin-bottom: var(--s-4); }
.admin__form { display: grid; gap: var(--s-5); justify-items: start; }
.admin__panel { width: 100%; margin: 0; padding: var(--s-5); display: grid; gap: var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.admin__login { max-width: 420px; margin-top: var(--s-5); }
.admin__title { padding: 0 var(--s-2); margin-left: calc(-1 * var(--s-2)); font: 700 var(--fs-lg) var(--font-head); }
.admin__slots { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.admin textarea { min-height: 96px; padding: var(--s-2) var(--s-3); font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
.admin pre { overflow-x: auto; padding: var(--s-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.field__error { margin: 0; color: var(--danger); font-size: var(--fs-sm); }
textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 0; }
textarea[aria-invalid="true"] { border-color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- quick settings and batch results ---------- */
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.presets__label { font-size: var(--fs-sm); font-weight: 600; margin-right: var(--s-1); }
.chip {
  min-height: 36px; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  color: var(--ink); font: 500 var(--fs-sm)/1 var(--font-body); cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.drop__batch { margin-top: 0; }
.picked__list li.is-batch::before { content: none; }

.batch { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.batch__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border: 1px solid var(--viewer-line); border-radius: var(--r-sm); font-size: var(--fs-sm);
}
.batch__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--viewer-strong); font-weight: 500; }
.batch__info { color: var(--viewer-ink-2); font-variant-numeric: tabular-nums; }
.batch__info.is-done { color: var(--v-ok); }
.batch__info.is-error { color: var(--v-err); }
.batch__slot { min-height: 36px; display: inline-flex; align-items: center; }
@media (max-width: 640px) {
  .batch__row { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); }
}
