/* Layout: grading-suite workbench. Controls rail on the left, a neutral-gray viewing stage on the right, the Lightroom round trip underneath. */
:root {
  --bg: #e8e9eb;
  --panel: #f7f7f8;
  --ink: #16171a;
  --muted: #595c64;
  --line: #cdd0d5;
  --accent: #2f4fc4;
  --accent-ink: #ffffff;
  --accent-soft: #e0e6fb;
  --stage: #77787b;
  --err: #b3261e;
  --warn: #855000;
  --ch-r: #d0342c;
  --ch-g: #23904a;
  --ch-b: #2d5fd2;
  --grid: rgba(20, 22, 30, 0.09);
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1c1f; --panel: #242529; --ink: #ebecef; --muted: #a3a6ae; --line: #383a40;
    --accent: #9db0ff; --accent-ink: #11131a; --accent-soft: #2a3050; --stage: #46474b;
    --err: #ff8a80; --warn: #f2b660; --ch-r: #ff6f66; --ch-g: #62d483; --ch-b: #7aa3ff;
    --grid: rgba(255, 255, 255, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c1f; --panel: #242529; --ink: #ebecef; --muted: #a3a6ae; --line: #383a40;
  --accent: #9db0ff; --accent-ink: #11131a; --accent-soft: #2a3050; --stage: #46474b;
  --err: #ff8a80; --warn: #f2b660; --ch-r: #ff6f66; --ch-g: #62d483; --ch-b: #7aa3ff;
  --grid: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(28px, env(safe-area-inset-top, 0px)) max(48px, env(safe-area-inset-bottom, 0px));
}
img { max-width: 100%; }
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.min0 { min-width: 0; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 760; font-stretch: 112%; letter-spacing: -0.01em; line-height: 1.05; }
h2 { font-size: 19px; font-weight: 700; font-stretch: 105%; }
h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-family: var(--f-body); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 24px; }
header.top .lede { max-width: 62ch; color: var(--muted); margin-top: 8px; }
header.top .private { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
header.top .private::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ch-g); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  grid-template-areas: "source stage" "settings stage";
  grid-template-rows: auto 1fr;
  gap: 18px;
  align-items: start;
}
.area-source { grid-area: source; }
.area-settings { grid-area: settings; }
.area-stage { grid-area: stage; }
@media (max-width: 880px) {
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "source" "stage" "settings"; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Drop zones */
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center; padding: 22px 14px; border: 1.5px dashed var(--line); border-radius: 8px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop strong { font-weight: 600; }
.drop .link { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.file { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; }
.thumb { width: 64px; height: 64px; border-radius: 6px; background: var(--stage); object-fit: cover; display: block; }
.file .name { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.file .meta { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.badge.exact { background: var(--ink); color: var(--panel); }
.error { color: var(--err); font-size: 13.5px; }
.note { font-size: 13px; color: var(--muted); }

/* Settings lists */
.settings.dim .lists { opacity: .45; }
.lists { display: flex; flex-direction: column; gap: 14px; }
.group { display: flex; flex-direction: column; gap: 4px; }
dl.rows { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; }
dl.rows dt { color: var(--ink); }
dl.rows dd { margin: 0; font-family: var(--f-mono); font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
ul.out { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ul.out li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding-left: 10px; border-left: 2px solid var(--warn); }
ul.out .v { font-family: var(--f-mono); font-size: 13.5px; text-align: right; }
ul.out .why { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.sep { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Stage */
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.viewer { position: relative; background: var(--stage); border-radius: var(--r); overflow: hidden; line-height: 0; padding: 18px; }
.viewer .frame { position: relative; }
.viewer canvas { width: 100%; height: auto; display: block; border-radius: 3px; }
.viewer input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.viewer:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #ffffff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.tag { position: absolute; top: 10px; font-size: 11.5px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: #ffffff; background: rgba(0,0,0,.55); padding: 5px 8px; border-radius: 4px; pointer-events: none; }
.tag.before { left: 10px; } .tag.after { right: 10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13.5px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 5px 12px; border-radius: 99px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip:focus-visible, .btn:focus-visible, .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.output { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 20px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .lbl { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 12px; font-size: 13.5px; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--panel); }
.seg input:disabled + span { color: var(--muted); cursor: not-allowed; }
input[type="range"].strength { width: 100%; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-weight: 600; font-size: 14.5px; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.status { font-size: 13px; color: var(--muted); min-height: 1.5em; }
.status.err { color: var(--err); }

.details { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 18px; }
@media (max-width: 620px) { .details { grid-template-columns: minmax(0, 1fr); } }
.graph { width: 100%; max-width: 260px; aspect-ratio: 1; display: block; }
.legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.legend .sw-r { background: var(--ch-r); }
.legend .sw-g { background: var(--ch-g); }
.legend .sw-b { background: var(--ch-b); }
pre.cube { margin: 0; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.55; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; color: var(--ink); }
pre.cube .c { color: var(--muted); }

/* Exact section */
.exact { display: flex; flex-direction: column; gap: 16px; }
.exact .intro { max-width: 70ch; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
.steps li h3 { color: var(--ink); font-size: 14.5px; text-transform: none; letter-spacing: 0; font-family: var(--f-display); font-stretch: 105%; display: flex; gap: 8px; align-items: baseline; }
.steps li h3::before { content: counter(step); font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.steps p { font-size: 13.5px; color: var(--muted); }
.steps .drop { padding: 16px 12px; }

footer { font-size: 13px; color: var(--muted); max-width: 80ch; }
textarea.fallback { width: 100%; height: 120px; font-family: var(--f-mono); font-size: 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }

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