/* DomiFrame — styled after the frame itself: an E Ink Spectra 6 panel. The page is the panel's
   white with its pixel grid, text is its black ink, the accent its red. Everything is flat and
   1-bit; where a screen would use a soft shadow or a tint, this uses dithering, the way the
   panel fakes every color it doesn't have. Ink values match PALETTE in dither.js. */

:root {
  --ink-black: #191e21;
  --ink-white: #e8e8e8;
  --ink-yellow: #efde44;
  --ink-red: #b21318;
  --ink-blue: #2157ba;
  --ink-green: #125f20;

  --bg: var(--ink-white);
  --surface: #f4f4f1;
  --ink: var(--ink-black);
  --muted: #5c6166;
  --line: var(--ink-black);
  --soft-line: #b9bcbe;
  --accent: var(--ink-red);
  --accent-ink: #fff;
  --ok: var(--ink-green);
  --mat: #fbfbf8;
  --frame: var(--ink-black);
  --grid: rgba(25, 30, 33, .07);
  --field: var(--mat); /* inputs and list rows inside cards */
  --card: var(--surface); /* virtual frame page */

  --sans: "IBM Plex Sans", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", sans-serif-condensed, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: var(--display); /* older names in the pages */
  color-scheme: light;
}
/* The panel inverted: white ink on black. Follows the system setting unless the theme
   button (theme.js) picked one; the two blocks must match. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416;
    --surface: #191e21;
    --ink: var(--ink-white);
    --muted: #9ba1a6;
    --line: var(--ink-white);
    --soft-line: #3b4247;
    --accent: #e0454a;
    --accent-ink: #fff;
    --ok: #6fbf7e;
    --mat: #e8e8e8;
    --frame: #000;
    --grid: rgba(232, 232, 232, .05);
    --field: var(--bg);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111416;
  --surface: #191e21;
  --ink: var(--ink-white);
  --muted: #9ba1a6;
  --line: var(--ink-white);
  --soft-line: #3b4247;
  --accent: #e0454a;
  --accent-ink: #fff;
  --ok: #6fbf7e;
  --mat: #e8e8e8;
  --frame: #000;
  --grid: rgba(232, 232, 232, .05);
  --field: var(--bg);
  color-scheme: dark;
}

/* ---- Dithered shadows -------------------------------------------------------- */
/* A hard shadow filled with a 50% checkerboard of ink (1 CSS px per dot), clipped to the part
   outside the box so it never needs to sit behind anything. --sh: depth, --bw: border width. */
.card::after, .print::after, .queue .pick::before {
  content: ""; position: absolute; pointer-events: none;
  top: calc(var(--sh) - var(--bw)); left: calc(var(--sh) - var(--bw));
  right: calc(-1 * var(--sh) - var(--bw)); bottom: calc(-1 * var(--sh) - var(--bw));
  clip-path: polygon(calc(100% - var(--sh)) 0, 100% 0, 100% 100%, 0 100%, 0 calc(100% - var(--sh)),
                     calc(100% - var(--sh)) calc(100% - var(--sh)));
  background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 2px 2px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  background-color: var(--bg);
  /* the panel's pixel grid, faintly */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 6px 6px;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
canvas.dithered { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

.wrap { max-width: 600px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---- Type --------------------------------------------------------------------- */

h1, h2, .section-title {
  font-family: var(--display); font-weight: 700; letter-spacing: -.01em; text-transform: none;
}
h2 { font-size: 32px; line-height: 1.05; margin: 0; }
.section-title { font-size: 22px; margin: 0; text-transform: uppercase; letter-spacing: .02em; }
h3, .eyebrow {
  font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin: 0;
}
.meta { font: 12px/1.6 var(--mono); color: var(--muted); margin: 4px 0 0; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.tip { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
code { font: 90% var(--mono); }

/* ---- Masthead ------------------------------------------------------------------- */

.brand { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; flex-wrap: wrap; }
.brand h1 { font-size: 34px; line-height: 1; margin: 0; }
/* Replaced by a dithered test strip (brand.js); a plain ink bar until then */
.mark {
  width: 96px; height: 8px; display: inline-block; flex: none; line-height: 0;
  background: linear-gradient(90deg, var(--ink-black) 0 16.66%, var(--ink-blue) 0 33.33%, var(--ink-green) 0 50%,
                                      var(--ink-yellow) 0 66.66%, var(--ink-red) 0 83.33%, var(--ink-white) 0);
  outline: 1px solid var(--line); outline-offset: 1px;
}
.mark:has(canvas) { background: none; }

/* ---- Sections: flat panels with a dithered shadow ------------------------------ */

.card {
  --sh: 8px; --bw: 2px;
  position: relative;
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 22px 18px;
  margin: 0 8px 28px 0;
}
.title-block { margin-bottom: 20px; }
.title-block .eyebrow { margin-bottom: 6px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 16px; }
.section-head .meta { margin: 0; }
.section-head.compact { margin: 0 0 10px; }
.foot { text-align: center; margin-top: 12px; font: 12px/1.6 var(--mono); color: var(--muted); }

/* ---- Prints: the picture in the frame's white border and black bezel ------------- */

.print {
  --sh: 8px; --bw: 5px;
  position: relative;
  background: var(--mat);
  padding: clamp(8px, 3%, 22px);
  border: 5px solid var(--frame);
  line-height: 0;
}
.print img, .print canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }

.now { display: grid; gap: 26px; }
.current { margin: 0; min-width: 0; }
.current .print { margin-right: 8px; }
.hint { font: 13px/1.5 var(--mono); color: var(--muted); margin: 16px 0 0; }

/* The frame's spec sheet beside the picture: label and value rows over dotted rules */
.spec dl, dl.spec { margin: 0; border-top: 2px solid var(--line); }
.spec dl > div, dl.spec > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0;
  background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 100% / 4px 2px repeat-x;
}
.spec dt { font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); flex: none; }
.spec dd { margin: 0; font: 13px/1.4 var(--mono); text-align: right; display: flex; align-items: center; gap: 10px; }
/* Battery as a 1-bit icon: an outline with a nub, filled in whole segments; red when low */
.gauge {
  --pct: 0; position: relative; width: 44px; height: 14px; border: 2px solid var(--ink); padding: 1px; flex: none;
  margin-right: 4px;
}
.gauge::before {
  content: ""; display: block; height: 100%; width: calc(var(--pct) * 1%);
  background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 4px);
}
.gauge::after { content: ""; position: absolute; right: -6px; top: 2px; width: 3px; height: 6px; background: var(--ink); }
.gauge.low { border-color: var(--accent); }
.gauge.low::before { background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 4px); }
.gauge.low::after { background: var(--accent); }

/* ---- Buttons and form controls ------------------------------------------------- */

button { font: inherit; color: inherit; }
button.primary, .chip, .seg span, .tabs button, .presets button, .picker span {
  font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em;
}
button.primary {
  position: relative; display: block; width: 100%; padding: 17px; margin-top: 16px;
  border: 2px solid var(--ink); border-radius: 0;
  background: var(--ink); color: var(--surface); cursor: pointer; font-size: 13px; letter-spacing: .12em;
}
button.primary::after { content: " ▸"; }
/* Hover: the fill dithers to red */
button.primary:hover {
  border-color: var(--accent);
  background: conic-gradient(var(--accent) 25%, var(--ink) 0 50%, var(--accent) 0 75%, var(--ink) 0) 0 0 / 2px 2px;
}
button.primary:active { background: var(--accent); }
button.primary:disabled { opacity: .5; cursor: wait; }

.chip {
  position: relative; padding: 9px 12px; border-radius: 0; border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
/* Hover: a 25% dot screen behind the label */
.chip:hover { background: var(--surface) radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 3px 3px; }
.chip.on { background: var(--ink); color: var(--surface); }
.chip.danger { color: var(--accent); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
a.chip { text-decoration: none; display: inline-block; }
.frame-switch { max-width: 100%; }

/* Theme button: a square half ink, half paper, like the panel inverted */
.theme-toggle {
  margin-left: auto; flex: none; width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 0; background: var(--surface); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface) radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 3px 3px; }
.theme-toggle i { width: 14px; height: 14px; border: 1.5px solid var(--ink); background: linear-gradient(90deg, var(--ink) 50%, var(--bg) 0); }
.site-head .site-tabs { margin-left: auto; }
.site-head .theme-toggle { margin-left: 0; }
.frame-switch select { max-width: 100%; }
select.chip { width: auto; display: inline-block; margin: 0; padding: 8px 10px; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; }

button.link {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
button.link:hover { text-decoration-thickness: 2px; }

.seg { display: flex; border: 1.5px solid var(--ink); margin: 0 0 10px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 11px 6px; text-align: center; cursor: pointer; }
.seg label + label span { border-left: 1.5px solid var(--ink); }
.seg label:hover span { background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 3px 3px; }
.seg input:checked + span { background: var(--ink); color: var(--surface); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }
/* Which corner the picture's label goes in: laid out like the corners themselves */
.seg.corners { display: grid; grid-template-columns: 1fr 1fr; }
.seg.corners label:nth-child(odd) + label span { border-left: 1.5px solid var(--ink); }
.seg.corners label:nth-child(3) span { border-left: 0; }
.seg.corners label:nth-child(n+3) span { border-top: 1.5px solid var(--ink); }
.label-where { margin: 18px 0 8px; }

.slider { display: block; font-size: 14px; color: var(--muted); margin: 16px 0; }
.slider output { float: right; color: var(--ink); font: 12px/1.8 var(--mono); }
input.text, .slider select, .card select:not(.chip) {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 15px; padding: 10px 12px;
  border-radius: 0; border: 1.5px solid var(--ink); background: var(--field); color: var(--ink);
}
input.text:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 12px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; border-radius: 0; }

/* Range: a dotted track, like a row of pixels, with a square handle */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 6px 0 0;
  background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 2px 2px;
}
input[type=range]::-moz-range-track {
  height: 4px; background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 2px 2px;
}
input[type=range]::-moz-range-progress { height: 4px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 18px; margin-top: -7px; border-radius: 0;
  background: var(--surface); border: 2px solid var(--ink);
}
input[type=range]::-moz-range-thumb { width: 10px; height: 14px; border-radius: 0; background: var(--surface); border: 2px solid var(--ink); }
input[type=range]:active::-webkit-slider-thumb { background: var(--accent); border-color: var(--accent); }
input[type=range]:active::-moz-range-thumb { background: var(--accent); border-color: var(--accent); }
/* Color-balance tracks dither between the two inks each slider pushes toward */
.balance.warm::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--ink-blue), transparent 40% 60%, var(--ink-yellow)); }
.balance.tint::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--ink-green), transparent 40% 60%, var(--ink-red)); }
.balance.warm::-moz-range-track { background: linear-gradient(90deg, var(--ink-blue), transparent 40% 60%, var(--ink-yellow)); }
.balance.tint::-moz-range-track { background: linear-gradient(90deg, var(--ink-green), transparent 40% 60%, var(--ink-red)); }
.balance::-moz-range-progress { background: transparent; }

.msg { min-height: 1.5em; margin: 14px 0 0; font: 14px/1.5 var(--mono); }
/* No message, no gap at the bottom of the card */
.msg:empty { min-height: 0; margin: 0; }
.msg:not(:empty)::before { content: "> "; color: var(--muted); }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--accent); }
.warn { color: var(--accent); }

.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.row.between { justify-content: space-between; align-items: center; margin: 0 0 12px; }
.stack { display: grid; gap: 16px; }
.stack > .slider { margin: 0; }
.stack > button.primary { margin-top: 8px; }

/* ---- Adding pictures ----------------------------------------------------------- */

.pickers { display: flex; gap: 12px; }
.picker { flex: 1; display: block; cursor: pointer; }
.picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picker span {
  display: grid; place-items: center; gap: 8px; min-height: 120px; padding: 20px;
  border: 2px dashed var(--ink); text-align: center; color: var(--muted);
  background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 4px 4px;
}
.picker span em { font: 700 24px/1 var(--display); font-style: normal; text-transform: none; letter-spacing: 0; color: var(--ink); }
.picker span small { font-size: 11px; }
.picker:hover span {
  border-style: solid; color: var(--ink);
  background: radial-gradient(var(--ink) .8px, transparent 1px) 0 0 / 3px 3px;
}
.picker:hover span em { background: var(--surface); padding: 2px 6px; }
.picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.picker.off { cursor: not-allowed; opacity: .45; }
.picker.off:hover span { border-style: dashed; color: var(--muted); background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 4px 4px; }
.picker.off:hover span em { background: none; padding: 0; }

/* Opening photos: a tiny frame whose screen shows the six inks in bands, sliding across. Every
   few seconds they stop, the lines between them dither into blends and back, and they move on.
   Drawn dot by dot in upload.js (drawOpening); all in steps, never smooth: e-paper can't fade. */
.pickers:has(+ .opening:not([hidden])) { display: none; }
.opening {
  display: flex; align-items: center; gap: 24px; min-height: 120px; padding: 20px;
  border: 2px solid var(--ink);
  background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 4px 4px;
}
.opening[hidden] { display: none; }
.opening-frame {
  flex: none; width: 112px; height: 80px; padding: 8px; background: var(--ink-black);
  border: 2px solid var(--ink);
}
/* Inside the bezel, the panel's gray edge that never changes, so the black and the white ink bands
   both show against it in either theme */
.opening-screen { box-sizing: border-box; display: block; width: 100%; height: 100%; border: 3px solid #9ba1a6; image-rendering: pixelated; background: var(--ink-white); }
.opening-text { min-width: 0; }
.opening-text p { margin: 0; }
.opening-title { font: 700 24px/1.15 var(--display); margin-bottom: 8px !important; }
.opening-note { font: 12px/1.5 var(--mono); color: var(--muted); max-width: 46ch; }
.opening-note:empty { display: none; }
.opening-note b { color: var(--ink); font-weight: 600; }
#opening-stop { margin-top: 6px; }
/* Thumbnails still coming in for a big set */
.thumbs-left { font: 500 11px/1 var(--mono); color: var(--muted); letter-spacing: .04em; margin-left: 8px; white-space: nowrap; }

/* ---- Editor -------------------------------------------------------------------- */

#editor { margin-top: 24px; }
.stage {
  position: sticky; top: 0; z-index: 3; background: var(--surface);
  padding: 8px 0 12px; border-bottom: 2px solid var(--line);
}
.editor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
#batch-count { font: 700 20px/1.2 var(--display); }
.editor-head .link { font-size: 14px; }
.edit-banner { font-size: 14px; border-left: 4px solid var(--accent); padding: 4px 12px; margin: 0 0 12px; color: var(--muted); }
.stage .print { width: fit-content; max-width: calc(100% - 8px); margin: 0 auto; }
.stage .preview { width: auto; max-width: 100%; max-height: 42vh; }
.preview.draggable { cursor: grab; touch-action: none; }
.preview.draggable:active { cursor: grabbing; }
.hint { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.hint .link { font: 12px var(--mono); margin-left: auto; }
.preview-note { margin-top: 8px; font-size: 12px; }

/* Filmstrip: uniform frames, like a contact strip */
.filmstrip { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; }
.filmstrip .arrow {
  flex: none; width: 32px; height: 64px; border: 1.5px solid var(--ink); border-radius: 0;
  background: var(--surface); cursor: pointer; font: 700 18px/1 var(--mono);
}
.filmstrip .arrow:hover:not(:disabled) { background: var(--ink); color: var(--surface); }
.filmstrip .arrow:disabled { opacity: .25; cursor: default; }
.strip {
  flex: 1; display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
}
.shot { position: relative; flex: 0 0 auto; scroll-snap-align: center; }
.shot > button:first-child {
  display: block; padding: 0; border: 0; background: var(--mat); cursor: pointer;
  outline: 1.5px solid var(--soft-line); opacity: .7;
}
.shot > button:first-child:hover { opacity: 1; }
.shot img { display: block; width: 58px; height: 58px; object-fit: cover; }
.shot.active > button:first-child { outline: 3px solid var(--accent); opacity: 1; }
.strip.linked .shot > button:first-child { opacity: 1; outline-color: var(--ink); }
.strip.linked .shot.active > button:first-child { outline: 3px solid var(--accent); }
.strip:not(.linked) .shot:not(.active) > button:first-child { opacity: .45; }
.shot.custom::after {
  content: ""; position: absolute; left: 4px; bottom: 4px; width: 8px; height: 8px;
  background: var(--accent); box-shadow: 0 0 0 1.5px var(--mat);
}
.shot.broken img { opacity: .25; }
.shot .del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 0; border: 0; padding: 0;
  background: var(--ink-black); color: #fff; font: 12px/18px var(--mono); cursor: pointer;
  opacity: 0;
}
.shot:hover .del, .shot .del:focus-visible { opacity: 1; }
@media (hover: none) { .shot .del { opacity: .85; } }
.shot .del:hover { background: var(--accent); }
.strip-pos { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 0; font: 11px/1.4 var(--mono); color: var(--muted); }
@media (hover: none) { .keys-tip { display: none; } }
#editor.sending .filmstrip, #editor.sending .strip-pos { pointer-events: none; opacity: .5; }

#editor:not(.batch) .batch-only { display: none; }

.batch-box { border-left: 4px solid var(--ink); padding: 2px 0 2px 14px; margin: 20px 0 22px; }
.batch-box p { margin: 0; font-size: 14px; color: var(--muted); }
.batch-box .check { margin: 8px 0 0; font-size: 14px; }

/* Which photos a change affects */
.scope { margin: 0 0 22px; }
.scope h3 { margin-bottom: 10px; }
.scope-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scope-seg label { position: relative; cursor: pointer; }
.scope-seg input { position: absolute; opacity: 0; }
.scope-seg span {
  display: grid; gap: 4px; padding: 14px 14px 12px 38px; border: 1.5px solid var(--soft-line);
  position: relative; height: 100%;
}
.scope-seg span::before {
  content: ""; position: absolute; left: 14px; top: 16px; width: 12px; height: 12px;
  border: 2px solid var(--muted);
}
.scope-seg b { font: 700 18px/1.1 var(--display); }
.scope-seg small { font: 11px/1.3 var(--mono); color: var(--muted); }
.scope-seg label:hover span { border-color: var(--ink); }
.scope-seg input:checked + span { border: 2px solid var(--ink); padding: 13.5px 13.5px 11.5px 37.5px; }
.scope-seg input:checked + span::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.scope-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-diff { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.look-diff span { flex-basis: 100%; }
.look-diff span::before {
  content: ""; display: inline-block; width: 8px; height: 8px; background: var(--accent);
  margin-right: 8px; vertical-align: 0;
}

/* "Just this photo": an accent rule down the adjustments, so the scope is always in view */
.adjust { transition: padding .15s; }
#editor.batch .adjust.scope-this { box-shadow: inset 4px 0 0 var(--accent); padding-left: 16px; }
#editor.batch .adjust.scope-this .section-head.compact h3::after { content: " · this photo only"; color: var(--accent); }
#editor.batch .adjust:not(.scope-this) .section-head.compact h3::after { content: " · all photos"; }

/* Looks: each swatch dithered in the inks it favors */
.presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.presets button {
  display: grid; justify-items: center; gap: 8px; padding: 10px 4px; cursor: pointer; font-size: 10px;
  border: 1.5px solid var(--soft-line); border-radius: 0; background: var(--surface); color: var(--ink);
}
.presets button:hover { border-color: var(--ink); }
.sw {
  display: block; width: 100%; max-width: 44px; aspect-ratio: 1; image-rendering: pixelated;
  outline: 1.5px solid var(--ink);
}
/* Two inks checkerboarded over a third: a tiny dithered swatch */
.sw-default { background: conic-gradient(var(--ink-blue) 25%, var(--ink-yellow) 0 50%, var(--ink-red) 0 75%, var(--ink-white) 0) 0 0 / 4px 4px; }
.sw-natural { background: conic-gradient(var(--ink-green) 25%, var(--ink-white) 0 50%, var(--ink-blue) 0 75%, var(--ink-yellow) 0) 0 0 / 4px 4px; }
.sw-vivid { background: conic-gradient(var(--ink-red) 25%, var(--ink-yellow) 0 50%, var(--ink-blue) 0 75%, var(--ink-red) 0) 0 0 / 4px 4px; }
.sw-soft { background: conic-gradient(var(--ink-white) 25%, var(--ink-yellow) 0 50%, var(--ink-white) 0 75%, var(--ink-blue) 0) 0 0 / 4px 4px; }
.sw-mono { background: conic-gradient(var(--ink-black) 25%, var(--ink-white) 0 50%, var(--ink-black) 0 75%, var(--ink-white) 0) 0 0 / 2px 2px; }

/* Tabs for the adjustment groups */
.tabs { display: flex; gap: 18px; margin: 24px 0 4px; box-shadow: inset 0 -2px 0 var(--soft-line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 10px 0; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { padding-top: 8px; }
.panel > .chip { margin-top: 4px; }
.panel .seg:first-child { margin-top: 12px; }
.orient-note { margin: 12px 0 14px; }

.send-box { margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--line); }
.send-box .slider:first-child { margin-top: 0; }

/* ---- Collection ---------------------------------------------------------------- */

.cycle { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin: 0 0 18px; }
.cycle .slider { flex: 1; min-width: 200px; max-width: 420px; margin: 0; }
.cycle .check { margin: 0 0 10px; }

/* Folders as text tabs */
.folders { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 6px; border-bottom: 2px solid var(--soft-line); }
.folders .chip {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 0; margin-bottom: -2px;
  background: none; color: var(--muted);
}
.folders .chip:hover { color: var(--ink); background: none; }
.folders .chip.on { color: var(--ink); background: none; border-bottom-color: var(--accent); }
.folders .chip:last-child { color: var(--accent); }
.folder-actions { display: flex; gap: 16px; margin: 10px 0 0; font-size: 13px; }

.bulkbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 16px;
  position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 12px 0;
}
.bulkbar #sel-count { margin-right: auto; font: 12px var(--mono); }

/* Contact sheet: every picture a small framed print */
.queue { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 24px 18px; }
.queue li { display: grid; gap: 8px; align-content: start; }
.queue .pick {
  --sh: 6px; --bw: 3px;
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 8px; position: relative;
  background: var(--mat); border: 3px solid var(--frame); cursor: pointer;
  outline: 3px solid transparent; outline-offset: 3px;
}
.queue .pick:hover { --sh: 9px; transform: translate(-2px, -2px); }
.queue .pick img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; image-rendering: pixelated; }
.queue li.selected .pick { outline-color: var(--accent); }
.queue li.selected .pick::after {
  content: "✓"; position: absolute; top: -10px; right: -10px; width: 24px; height: 24px;
  background: var(--accent); color: var(--accent-ink); font: 700 13px/24px var(--mono); text-align: center;
}
.queue li > span { font: 11px/1.5 var(--mono); color: var(--muted); }
.queue li.badged > span::first-line { color: var(--accent); }
/* Recently removed: the prints faded, as if half the ink were gone */
.in-trash .queue .pick img { opacity: .55; }

/* Undo after removing: a note with a red rule, like the orientation warning */
.undo-bar {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 14px; margin: 0 0 16px;
  padding: 8px 12px; border: 1.5px solid var(--ink); border-left-width: 6px; background: var(--field);
}

/* Invite: the frame's link as a QR code */
.title-block .invite { margin-top: 12px; }
.invite-box { display: grid; justify-items: center; gap: 14px; margin: 0 0 16px; }
.qr { width: min(240px, 100%); height: auto; image-rendering: pixelated; border: 2px solid var(--ink); }

/* Dialogs with extra content */
.ask-body { margin: 0 0 16px; }
.day-pick .slider { margin-top: 0; }
.day-pick .seg { margin: 12px 0 0; }

/* ---- Frame settings ------------------------------------------------------------ */

details > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "[+]"; font: 500 14px/1 var(--mono); color: var(--muted); }
details[open] > summary::before { content: "[–]"; }
details > summary .meta { margin: 0; }
#settings-card details[open] summary { margin-bottom: 12px; }
.quiet-hours { margin: 0; }
.quiet-hours .slider { flex: 1; margin: 0; }

/* ---- Home -------------------------------------------------------------------------- */

.home-link { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.site-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 30px; }
.site-head .brand { margin: 0; }
.site-tabs { display: flex; border: 2px solid var(--ink); background: var(--surface); }
.site-tabs button {
  font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em;
  padding: 12px 16px; border: 0; background: none; color: var(--ink); cursor: pointer;
}
.site-tabs button + button { border-left: 2px solid var(--ink); }
.site-tabs button:hover { background: radial-gradient(var(--soft-line) .8px, transparent 1px) 0 0 / 3px 3px; }
.site-tabs button[aria-selected=true] { background: var(--ink); color: var(--surface); }

.intro-grid { display: grid; gap: 34px; margin: 0 0 40px; align-items: center; }
.headline { font-size: 40px; line-height: 1.02; margin: 10px 0 16px; letter-spacing: -.015em; }
.lede { font-size: 17px; line-height: 1.6; margin: 0; max-width: 58ch; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-top: 24px; }
.cta button.primary { width: auto; margin: 0; padding: 16px 22px; }
.cta .chip { display: flex; align-items: center; min-height: 48px; padding: 0 18px; border-width: 2px; }
.sample { margin: 0; }
.sample .print { margin-right: 8px; }
.sample figcaption { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; font: 12px/1.5 var(--mono); color: var(--muted); }
.ink-dots { display: inline-flex; gap: 3px; flex: none; }
.ink-dots i { width: 8px; height: 8px; outline: 1px solid var(--ink); }
.ink-dots i:nth-child(1) { background: var(--ink-black); }
.ink-dots i:nth-child(2) { background: var(--ink-white); }
.ink-dots i:nth-child(3) { background: var(--ink-red); }
.ink-dots i:nth-child(4) { background: var(--ink-yellow); }
.ink-dots i:nth-child(5) { background: var(--ink-blue); }
.ink-dots i:nth-child(6) { background: var(--ink-green); }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 22px; }
.steps li { counter-increment: step; padding-top: 14px; border-top: 2px solid var(--line); }
.steps li::before {
  content: counter(step, decimal-leading-zero); display: block; margin-bottom: 8px;
  font: 700 12px/1 var(--mono); letter-spacing: .1em; color: var(--accent);
}
.steps b { font: 700 20px/1.2 var(--display); }
.steps p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

.app-points { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.app-points + .cta { margin-top: 18px; }
.about-grid { display: grid; gap: 28px; }
.about-grid dd { max-width: 60%; }
.notes h3 { margin: 0 0 6px; }
.notes p { margin: 0 0 18px; font-size: 15px; }

.open-card { max-width: 560px; margin-left: auto; margin-right: auto; }
.open-card h2 { margin: 6px 0 22px; }
.open-card h3 { margin: 0 0 10px; }
.saved-frames { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 8px; }
.saved-frames li { display: flex; align-items: center; gap: 14px; }
.saved-open {
  flex: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px;
  border: 2px solid var(--ink); color: var(--ink); text-decoration: none; background: var(--field);
}
.saved-open b { font: 700 18px/1.2 var(--display); }
.saved-open span { font: 12px var(--mono); color: var(--muted); }
.saved-open span::after { content: "  ▸"; color: var(--ink); }
.saved-open:hover { background: var(--ink); color: var(--surface); }
.saved-open:hover span, .saved-open:hover span::after { color: var(--surface); }
.saved-frames .link { font-size: 13px; }
.open-form .slider:first-of-type { margin-top: 0; }
.code-input { font: 500 18px/1.3 var(--mono) !important; letter-spacing: .12em; text-transform: uppercase; }
.code-input::placeholder { letter-spacing: .12em; color: var(--soft-line); }

.also-send { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.also-send legend { font: 600 13px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0; }
.also-send .check { margin: 8px 0; }
.also-send .check small { font: 12px var(--mono); color: var(--muted); }
.device-access { margin-top: 28px; padding-top: 20px; border-top: 2px solid var(--line); }
.device-access h3 { margin: 0 0 6px; }
.device-access dl.spec { margin: 12px 0 0; }
.device-access dd { font-size: 15px; letter-spacing: .06em; user-select: all; }

@media (min-width: 1000px) {
  .intro-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; margin-bottom: 56px; }
  .headline { font-size: 56px; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .about-grid { grid-template-columns: 1.2fr 1fr; gap: 48px; }
}

/* ---- Admin --------------------------------------------------------------------- */

.brand #signout { font-size: 14px; }
.frames { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.frames li { border: 1.5px solid var(--ink); padding: 16px; display: grid; gap: 6px; background: var(--field); }
.frame-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.frame-head strong { font: 700 22px/1.1 var(--display); }
.frame-head .muted { font: 12px var(--mono); }
.frame-head .badge { margin-left: auto; }
.frames li > p { font-family: var(--mono); font-size: 12px; }
.frames li > .chips { margin-top: 8px; }
.badge { font: 12px var(--mono); padding: 3px 8px; border: 1.5px solid var(--ink); }
.badge.warn { border-color: var(--accent); color: var(--accent); }
.copy-row { display: flex; gap: 6px; margin-top: 6px; }
.copy-row input { margin: 0; font: 13px/1.4 var(--mono); }
.qr svg { width: 180px; height: 180px; background: #fff; padding: 6px; display: block; border: 2px solid var(--ink); }
.admin h2 { font-size: 26px; }
.admin .card > h2 { margin: 0 0 16px; }

/* ---- Wide screens: the print on the left, the controls beside it --------------- */

@media (min-width: 1000px) {
  .wrap:not(.admin) { max-width: 1240px; padding: 36px 40px 72px; }
  .card { padding: 30px 34px; }
  h2 { font-size: 42px; }
  .brand h1 { font-size: 40px; }
  .title-block { display: flex; align-items: baseline; gap: 6px 20px; flex-wrap: wrap; }
  .title-block .eyebrow { flex-basis: 100%; }
  .title-block .invite { margin: 0 0 0 auto; align-self: center; }

  /* Now showing: the print, its spec sheet beside it */
  .now { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }

  #editor:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 48px; align-items: start;
  }
  .stage { position: sticky; top: 20px; border: 0; padding: 0; background: none; }
  .stage .preview { max-height: calc(100vh - 300px); }
  #editor.batch .stage .preview { max-height: calc(100vh - 380px); }
  .controls > :first-child { margin-top: 0; }
  .adjust > .section-head.compact:first-child { margin-top: 0; }
  .batch-box { margin: 0 0 20px; }
  .shot img { width: 64px; height: 64px; }
  .print { border-width: 8px; --bw: 8px; --sh: 10px; }
  .queue { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 30px 24px; }
}

@media (max-width: 480px) {
  h2 { font-size: 28px; }
  .hero h1 { font-size: 52px; }
  .pickers { flex-direction: column; }
  .opening { gap: 16px; padding: 16px; }
  .opening-frame { width: 84px; height: 62px; padding: 6px; }
  .opening-title { font-size: 20px; }
  .picker span { min-height: 88px; }
  .presets { gap: 4px; }
  .presets button { font-size: 9px; letter-spacing: .04em; }
  /* Keep the wordmark, strip and theme button on one line */
  .mark { width: 64px; }
  .admin .brand h1 { font-size: 30px; }
  .admin .brand .mark { display: none; }
}
.print:has(> img[hidden]) { display: none; }

/* Privacy, terms and help: plain reading pages */
.prose .headline { margin-bottom: 18px; }
.prose h3 { margin: 28px 0 8px; }
.prose p, .prose li { font-size: 15px; line-height: 1.65; max-width: 68ch; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 0 0 8px; }
.prose .lede { margin-bottom: 10px; }
.prose a, .foot a, .tip a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover, .foot a:hover, .tip a:hover { color: var(--accent); }
.legal-links { margin-top: 4px; }


/* How the frame hangs */
.hang { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 18px; }
.hang .eyebrow { grid-column: 1 / -1; margin-bottom: 2px; }
.hang label { position: relative; cursor: pointer; }
.hang input { position: absolute; opacity: 0; }
.hang label span {
  display: flex; justify-content: center; align-items: center; gap: 8px; padding: 7px 12px 7px 10px; border: 1.5px solid var(--soft-line);
  font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.hang label:hover span { border-color: var(--ink); color: var(--ink); }
.hang input:checked + span { border-color: var(--ink); color: var(--surface); background: var(--ink); }
.hang input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hang-icon { display: inline-block; border: 2px solid currentColor; }
.hang-icon.wide { width: 16px; height: 10px; }
.hang-icon.tall { width: 10px; height: 16px; }
/* Upside down: a thick edge on top, where the chin is when the frame is turned over */
.hang .hang-flip { grid-column: 1 / -1; }
.hang-icon.flip { border-top-width: 4px; }
.hang input:checked + span .hang-icon {
  border-color: var(--ink-red);
  background: conic-gradient(var(--ink-red) 25%, transparent 0 50%, var(--ink-red) 0 75%, transparent 0) 0 0 / 2px 2px;
}
.hang-mismatch {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 14px; margin: 0 0 16px;
  padding: 8px 12px; border: 1.5px solid var(--accent); border-left-width: 6px; background: var(--field);
}

/* In-page dialogs (browsers can block their own confirm/prompt) */
dialog.ask {
  width: min(440px, calc(100vw - 32px)); padding: 24px 22px 20px; border: 2px solid var(--ink); border-radius: 0;
  background: var(--surface); color: var(--ink);
  box-shadow: 8px 8px 0 -2px var(--surface), 8px 8px 0 0 var(--ink);
}
dialog.ask::backdrop {
  background: conic-gradient(rgba(0,0,0,.55) 25%, transparent 0 50%, rgba(0,0,0,.55) 0 75%, transparent 0) 0 0 / 2px 2px;
}
.ask-title { font: 700 24px/1.1 var(--display); margin: 0 0 10px; }
.ask-message { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.ask-input { margin: 0 0 16px; }
.ask-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.ask-buttons .ask-ok { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ask-buttons .ask-ok.danger { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ask-buttons .ask-ok:disabled { opacity: .35; cursor: not-allowed; }

/* Upload page: a frame code that stopped working, and the code a frame had before */
.code-gone { margin-top: 14px; max-width: 520px; }
.code-gone p { margin: 0 0 10px; }
.code-value { font-family: var(--mono); letter-spacing: .08em; white-space: nowrap; }
