/* Снимци — a contact sheet for X posts.
   Quiet paper and ink; the one bold thing is the film strip (progress)
   and the numbered frames of a report. */

:root {
  color-scheme: light;
  --paper: #eef1f4;
  --surface: #ffffff;
  --ink: #18212b;
  --ink-2: #4a5562;
  --muted: #6b7682;
  --rule: #cfd6dd;
  --rule-strong: #9aa5b1;
  --accent: #0f6b5a;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ec;
  --amber: #a85f00;
  --amber-soft: #fbefdc;
  --bad: #a4262c;
  --bad-soft: #fbe9ea;
  --film: #1d2530;
  --film-hole: #eef1f4;
  --frame-bg: #f6f8fa;
  /* chart */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --grid: #e3e8ed;
  --saved: #8a96a3;
  --radius: 6px;
  --focus: 0 0 0 3px rgba(15, 107, 90, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #12171d;
    --surface: #1a2129;
    --ink: #e3e8ee;
    --ink-2: #b9c3cd;
    --muted: #9aa6b2;
    --rule: #2c3640;
    --rule-strong: #4a5764;
    --accent: #3fb59a;
    --accent-ink: #0b1a16;
    --accent-soft: #163a32;
    --amber: #e3a33b;
    --amber-soft: #3a2c14;
    --bad: #e5636a;
    --bad-soft: #3c1d20;
    --film: #0b0f13;
    --film-hole: #2c3640;
    --frame-bg: #151b22;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --grid: #26303a;
    --saved: #6d7a87;
    --focus: 0 0 0 3px rgba(63, 181, 154, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #12171d; --surface: #1a2129; --ink: #e3e8ee; --ink-2: #b9c3cd; --muted: #9aa6b2;
  --rule: #2c3640; --rule-strong: #4a5764; --accent: #3fb59a; --accent-ink: #0b1a16; --accent-soft: #163a32;
  --amber: #e3a33b; --amber-soft: #3a2c14; --bad: #e5636a; --bad-soft: #3c1d20; --film: #0b0f13; --film-hole: #2c3640;
  --frame-bg: #151b22; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --grid: #26303a; --saved: #6d7a87;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; margin-top: 2rem; }
h3 { font-size: 1.05rem; font-weight: 650; margin-top: 1.5rem; }
code { font-size: .95em; background: var(--frame-bg); border: 1px solid var(--rule); border-radius: 4px; padding: 0 .3em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }

/* ── top bar ───────────────────────────────────────────── */
.top {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .75rem max(16px, calc((100vw - 1120px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 22px; height: 16px; border-radius: 2px; background: var(--film);
  /* a frame of film: two rows of sprocket holes */
  background-image:
    radial-gradient(circle, var(--film-hole) 1px, transparent 1.5px),
    radial-gradient(circle, var(--film-hole) 1px, transparent 1.5px);
  background-size: 5px 16px, 5px 16px;
  background-position: 1px -6px, 1px 6px;
  background-repeat: repeat-x;
}
.brand-sub { font-weight: 500; color: var(--muted); font-size: .9rem; margin-left: .15rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .35rem .6rem; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--paper); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: .75rem; color: var(--ink-2); font-size: .95rem; }
.who-client { color: var(--muted); }
.who form { margin: 0; }

.main { max-width: 1120px; margin: 0 auto; padding: 1.75rem 16px 4rem; }
.lead { color: var(--ink-2); margin: 0 0 1.25rem; max-width: 65ch; }
.hint { color: var(--muted); font-size: .9rem; display: block; font-weight: 400; }
.sub { color: var(--muted); font-size: .9rem; }
.strong { font-weight: 650; }
.empty { color: var(--ink-2); background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 1rem 1.25rem; }
.crumbs { margin: 0 0 .75rem; }
.tag { display: inline-block; font-size: .78rem; padding: 0 .4rem; border-radius: 4px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); vertical-align: middle; font-weight: 500; }
.err, .warn, .ok { border-radius: var(--radius); padding: .65rem .9rem; margin: 0 0 1rem; }
.err { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.warn { background: var(--amber-soft); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.ok { background: var(--accent-soft); color: var(--accent); }
.bad { color: var(--bad); }
.tech { margin-top: .5rem; color: var(--ink-2); }
.tech pre { white-space: pre-wrap; word-break: break-word; font-size: .85rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .5rem; }

/* ── forms ─────────────────────────────────────────────── */
form { margin: 0; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .95rem; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input:not([type]), select {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: .5rem .65rem; min-height: 2.6rem; width: 100%;
}
input[aria-invalid="true"] { border-color: var(--bad); }
.field-err { color: var(--bad); font-weight: 500; font-size: .9rem; }
button, .btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.6rem; padding: .45rem 1rem; border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--accent); }
button.small { min-height: 2.1rem; padding: .25rem .65rem; font-size: .9rem; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.with-btn { display: flex; gap: .5rem; }
.with-btn input { flex: 1; min-width: 0; }
label.check, label.radio { flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: 600; }
label.check input, label.radio input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--accent); flex: none; }
label.check .hint, label.radio .hint { font-weight: 400; }
fieldset.when { border: 0; padding: 0; margin: 0; background: none; gap: .3rem; min-width: 0; }
fieldset.when legend { padding: 0; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.dt { display: flex; gap: .5rem; flex-wrap: wrap; }
.dt .date { flex: 1 1 11rem; min-width: 0; position: relative; }
.dt input.time { flex: 0 1 8rem; min-width: 6.5rem; font-variant-numeric: tabular-nums; }
button.icon { padding: .45rem .6rem; }
button.icon svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
/* The browser's date picker, used only for its calendar: kept under the button. */
input.picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }
.submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.submit-row .hint { display: inline; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.25rem 1.25rem; margin: 0 0 1.25rem; display: flex; flex-direction: column; gap: .9rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.settings > button { margin-top: .25rem; }
.inline { display: inline-flex; gap: .35rem; align-items: center; }
.inline input { min-height: 2.1rem; padding: .25rem .5rem; width: 15rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter { display: flex; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filter label { min-width: 16rem; }

.login { max-width: 26rem; margin: 3rem auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.75rem; }
.new { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem 1.5rem 1.5rem; }
.new h1 { font-size: 1.4rem; }
.password-once { max-width: 40rem; }
.secret { font-size: 1.15rem; padding: .15rem .45rem; user-select: all; }

/* ── the film strip: progress ──────────────────────────── */
progress.film {
  appearance: none; -webkit-appearance: none; display: block;
  width: 100%; max-width: 22rem; height: 18px; border: 0; border-radius: 3px;
  background: var(--film);
  /* sprocket holes along both edges */
  background-image:
    linear-gradient(90deg, var(--film-hole) 3px, transparent 3px),
    linear-gradient(90deg, var(--film-hole) 3px, transparent 3px);
  background-size: 8px 3px, 8px 3px;
  background-position: 2px 2px, 2px 13px;
  background-repeat: repeat-x;
  overflow: hidden;
}
progress.film::-webkit-progress-bar { background: transparent; }
progress.film::-webkit-progress-value {
  background: linear-gradient(var(--amber), var(--amber)) 0 6px / 100% 6px no-repeat;
  transition: width .4s ease;
}
progress.film::-moz-progress-bar { background: linear-gradient(var(--amber), var(--amber)) 0 6px / 100% 6px no-repeat; }
progress.film:indeterminate::-webkit-progress-bar { background: transparent; }
progress.film:indeterminate {
  background-image:
    linear-gradient(90deg, var(--film-hole) 3px, transparent 3px),
    linear-gradient(90deg, var(--film-hole) 3px, transparent 3px),
    linear-gradient(90deg, transparent 0 30%, var(--amber) 30% 55%, transparent 55%);
  background-size: 8px 3px, 8px 3px, 200% 6px;
  background-position: 2px 2px, 2px 13px, 0 6px;
  background-repeat: repeat-x, repeat-x, no-repeat;
  animation: reel 1.6s linear infinite;
}
progress.film:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes reel { from { background-position: 2px 2px, 2px 13px, 100% 6px; } to { background-position: 10px 2px, 10px 13px, -100% 6px; } }
@media (prefers-reduced-motion: reduce) { progress.film:indeterminate { animation: none; } progress.film::-webkit-progress-value { transition: none; } }

/* ── report rows ───────────────────────────────────────── */
.list { margin-top: 2.25rem; }
.reps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rep {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: .5rem 1.25rem; align-items: center;
  padding: .9rem .25rem; border-bottom: 1px solid var(--rule);
}
.rep-name { font-weight: 650; color: var(--ink); text-decoration: none; font-size: 1.02rem; overflow-wrap: anywhere; }
.rep-name:hover { color: var(--accent); text-decoration: underline; }
.rep-meta { display: flex; flex-wrap: wrap; gap: .2rem .9rem; color: var(--ink-2); font-size: .9rem; margin-top: .15rem; }
.rep-meta .handle { color: var(--ink); font-weight: 500; }
.rep-state { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.rep-state.big { margin: .5rem 0 1rem; }
.rep-state.big progress.film { max-width: 34rem; height: 22px; background-position: 2px 3px, 2px 16px; }
.state { font-weight: 600; font-size: .95rem; }
.st-queued, .st-fetching, .st-shooting, .st-writing { color: var(--amber); }
.st-done { color: var(--accent); }
.st-failed { color: var(--bad); }
.st-canceled, .st-expired { color: var(--muted); }
.rep-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.pages { display: flex; gap: .3rem; margin: 1rem 0; flex-wrap: wrap; }
.pages a, .pages span { min-width: 2.2rem; text-align: center; padding: .3rem .5rem; border-radius: var(--radius); }
.pages a { background: var(--surface); border: 1px solid var(--rule); text-decoration: none; }
.pages .cur { background: var(--ink); color: var(--paper); font-weight: 650; }
.pages .gap { color: var(--muted); }

/* ── a report: header and contact sheet ────────────────── */
.rep-head { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem 1.5rem; }
.rep-head h1 { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .5rem 1.5rem; margin: .25rem 0 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.sheet-intro { color: var(--ink-2); margin: 1.5rem 0 .75rem; }
.sheet {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 1rem;
}
.frame { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: .65rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.frame:target { box-shadow: 0 0 0 2px var(--accent); }
.frame-head { display: flex; align-items: baseline; gap: .6rem; font-size: .9rem; color: var(--ink-2); }
.frame-no { font-weight: 800; color: var(--ink); font-size: 1.05rem; letter-spacing: .02em; }
.frame-kind { font-weight: 600; }
.frame-head time { margin-left: auto; }
/* The card's full width, its top part: a tall card is cut at the bottom. */
.frame-img { display: block; background: var(--frame-bg); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; max-height: 24rem; }
.frame-img img { display: block; width: 100%; height: auto; }
.frame-none { display: grid; place-items: center; height: 8rem; background: var(--frame-bg); border: 1px dashed var(--rule-strong); border-radius: 4px; color: var(--muted); }
.frame-cap { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .9rem; }
.frame-note { margin: 0; font-size: .9rem; color: var(--ink-2); }
.versions summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.versions ul { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.versions li { display: flex; gap: .6rem; font-size: .9rem; padding: .4rem; border-radius: 4px; }
.versions li.current { background: var(--accent-soft); }
.versions img { width: 4.5rem; height: 5.5rem; object-fit: cover; object-position: top; border: 1px solid var(--rule); border-radius: 3px; }
.versions form { margin-top: .3rem; }

/* ── tables, the cost chart ────────────────────────────── */
.status-line { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; color: var(--ink-2); margin: 0 0 1.25rem; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; font-size: .95rem; }
.data th, .data td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data thead th { font-size: .85rem; color: var(--ink-2); font-weight: 600; background: var(--frame-bg); }
.data tbody th { font-weight: 600; }
.data .num { text-align: right; white-space: nowrap; }
.data .saved { color: var(--ink-2); }
.data tr:last-child th, .data tr:last-child td { border-bottom: 0; }
.table-view { margin: .75rem 0 0; }
.table-view summary { cursor: pointer; color: var(--accent); margin-bottom: .5rem; }

.chart { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1rem .75rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .seg.s1 { fill: var(--s1); }
.chart .seg.s2 { fill: var(--s2); }
.chart .seg.s3 { fill: var(--s3); }
.chart .seg.saved { fill: url(#hatch); stroke: var(--saved); stroke-width: 1; }
.chart .hatch-bg { fill: var(--surface); }
.chart .hatch-line { stroke: var(--saved); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .bar:hover .hit { fill: var(--grid); fill-opacity: .55; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; margin: 0 0 .75rem; padding: 0; font-size: .9rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key.s1 { background: var(--s1); }
.key.s2 { background: var(--s2); }
.key.s3 { background: var(--s3); }
.key.saved { border: 1px solid var(--saved); background: repeating-linear-gradient(45deg, var(--saved) 0 2px, transparent 2px 5px); }
.chart figcaption { margin-top: .5rem; }

/* ── narrow screens ────────────────────────────────────── */
@media (max-width: 760px) {
  h1 { font-size: 1.45rem; }
  .form-grid { grid-template-columns: 1fr; }
  .rep { grid-template-columns: 1fr; }
  .rep-actions { justify-content: flex-start; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .data { display: block; overflow-x: auto; }
  .inline input { width: 100%; }
  .frame-img { max-height: 20rem; }
  .new, .rep-head, .login { padding: 1rem; }
}
