/* Hallmark · checked: 2026-11-27 · genre: atmospheric · scope: app
 * floor: 0 FAIL · fixed: 5 (26a the Desmos graph took focus with no ring, made inert; 33 roles on the labelled stage canvas and graph; F4 one filled action once traced; F14 setting notes hold their height; F15 figures in the body face) · structural: 0 printed
 * also: hover styles only where hover exists; the pane hugs the picture; error beside its action; steps capped by column
 * finish-review: subagent · 5 findings · 5 resolved · gap: none
 * built: Hallmark · shape: app screen · theme: sarthak's site (by request: ../site/static/index.css, its palette, faces, heads and rails) · nav: a top bar, the name and the open file · signature: the live Desmos stage in a framed pane, held against the source frame · states: empty, reading, tracing, ready, exporting, error · axes: dark/high-contrast-serif/cool · posture: restrained · contrast: pass · redesign: polish · v2.0.0 */
/* Hallmark · answered F21 · the working screen opens at its h2 heads because the page's h1 lives on the empty screen it replaces */
@import url("./tokens.css");
@import url("./base.css");

:root {
  --bar-h: 64px;
  --sheet-w: 380px;
  --control-h: 40px;
  --label: 12.5px;
}

/* ---------- shell ---------- */

body { min-height: 100dvh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.7; color: var(--color-ink-2); }
/* desktop: the tool is exactly one window tall; only the settings sheet scrolls */
@media (min-width: 60.01rem) { body { height: 100dvh; } }

.bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-lg);
  padding: var(--space-lg) var(--gutter) var(--space-md);
}
.wordmark {
  font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1;
  color: var(--color-ink); text-decoration: none; white-space: nowrap;
}
@media (hover: hover) { .wordmark:hover { color: var(--color-ink); } }
.bar-file { display: flex; align-items: baseline; gap: var(--space-md); min-width: 0; }
.file-name { color: var(--color-muted); font-size: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.work { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
body:not([data-state="empty"]) .work { grid-template-columns: minmax(0, 1fr) var(--sheet-w); }

a { color: var(--color-ink-2); text-decoration-color: var(--color-faint); transition: color var(--dur-micro) var(--ease-out), text-decoration-color var(--dur-micro) var(--ease-out); }
@media (hover: hover) { a:hover { color: var(--color-ink); text-decoration-color: var(--color-ink-2); } }
a:active { color: var(--color-accent-2); }
::selection { background: var(--color-accent-soft); color: var(--color-paper); }

/* ---------- empty state ---------- */

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.drop {
  flex: 1; position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--space-lg);
  margin: var(--space-xs) var(--gutter) var(--gutter); padding: var(--space-2xl) var(--space-3xl);
  border: var(--rule-hair) dashed var(--color-rule); cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { body[data-state="empty"] .drop:hover { border-color: var(--color-accent-2); } }
body.dragging .drop { border-color: var(--color-accent-2); background: var(--color-hover); }
body:not([data-state="empty"]) .drop { display: none; }
.drop:focus-within { outline: 2px solid var(--color-focus); outline-offset: 3px; }

.drop h1 { max-width: 16ch; font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1.08; color: var(--color-ink); }
.drop .lead { color: var(--color-ink); max-width: 46ch; font-size: var(--text-md); line-height: 1.7; }
.drop-note { color: var(--color-muted); font-size: var(--label); }

.steps {
  list-style: none; counter-reset: step; margin: var(--space-xl) 0 0; padding: var(--space-lg) 0 0;
  border-top: var(--rule-hair) solid var(--color-rule-soft); align-self: stretch;
  /* the columns keep their width on a wide screen; the rule above them runs the full box */
  display: grid; grid-template-columns: repeat(3, minmax(0, 21rem)); gap: var(--space-lg);
  color: var(--color-muted); font-size: var(--label); line-height: 1.6;
}
.steps li { counter-increment: step; display: grid; grid-template-columns: 3ch minmax(0, 1fr); max-width: 36ch; }
.steps li::before { content: counter(step) "."; }

/* ---------- stage: a framed pane, labels cut into its top edge ---------- */

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-md); padding: var(--space-md) var(--space-lg) var(--space-lg) var(--gutter); }

.frame {
  position: relative; flex: none;
  /* one column the width of the frame, whatever is in it (the picture must not size it, or the
     column grows round a picture wider than the frame), and one row the picture's height: the
     pane hugs the picture, and the height it has spare falls below the transport */
  display: grid; grid-template: auto / minmax(0, 1fr); place-items: center; padding: var(--space-md);
  border: var(--rule-hair) solid var(--color-rule);
}
.frame-label {
  position: absolute; top: 0; z-index: var(--z-raised); transform: translateY(-50%);
  margin: 0; padding: 0 1ch; background: var(--color-paper);
  font-size: var(--label); line-height: 1.5; white-space: nowrap;
}
.frame-label--left { left: 1.5ch; color: var(--color-ink-2); }
.frame-label--right { right: 1.5ch; color: var(--color-muted); }
body.comparing .frame-label--left { color: var(--color-warm); }

.calc, .source, .reel {
  grid-area: 1 / 1;
  /* --frame-h: the tallest the picture can be (app.js) */
  width: min(100%, calc(var(--frame-h, 100%) * var(--aspect, 1.7778)));
  aspect-ratio: var(--aspect, 1.7778);
}
/* Layers, bottom to top: the graph, the reel, the source (held to compare), the credit. The
   graph is isolated so Desmos's own positioned layers stay under the reel. */
.calc { isolation: isolate; }
.source { opacity: 0; z-index: var(--z-base); pointer-events: none; }
/* playback frames, drawn ahead by workers (reel.js), over the graph while things move */
.reel { z-index: var(--z-base); visibility: hidden; pointer-events: none; }
body.reeling .reel { visibility: visible; }

/* where the export's credit will sit, at the same size relative to the picture */
.credit-box {
  position: relative; grid-area: 1 / 1; z-index: var(--z-base); pointer-events: none;
  width: min(100%, calc(var(--frame-h, 100%) * var(--aspect, 1.7778)));
  aspect-ratio: var(--aspect, 1.7778);
  container-type: size; display: none;
}
body:is([data-state="ready"], [data-state="exporting"]):not(.comparing) .credit-box { display: block; }
.credit-mark {
  position: absolute; right: 3cqh; bottom: 3cqh;
  font: 400 3.4cqh/1 var(--font-display); color: var(--color-ink); opacity: 0.8;
  text-shadow: 0 0 0.25em var(--color-shade); white-space: nowrap;
}
body.comparing .source { opacity: 1; }

.transport { display: flex; align-items: center; gap: var(--space-md); min-height: var(--control-h); }
.scrub { flex: 1; min-width: 0; height: var(--control-h); accent-color: var(--color-accent-2); background: transparent; cursor: pointer; }
.scrub:disabled { cursor: not-allowed; opacity: 0.4; }
.time { color: var(--color-muted); font-size: var(--label); white-space: nowrap; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: var(--control-h); height: var(--control-h); padding: 0;
  border: var(--rule-hair) solid var(--color-rule); border-radius: 0;
  background: transparent; color: var(--color-ink); cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.icon-btn svg { width: 14px; height: 14px; fill: currentColor; }
.icon-btn .i-pause { display: none; }
body.playing .icon-btn .i-pause { display: block; }
body.playing .icon-btn .i-play { display: none; }
body.playing .icon-btn { color: var(--color-accent); border-color: var(--color-accent-2); }
@media (hover: hover) { .icon-btn:hover:not(:disabled) { border-color: var(--color-ink-2); background: var(--color-hover); } }
.icon-btn:active:not(:disabled) { color: var(--color-accent-2); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- controls ---------- */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-h); padding: 0 var(--space-md);
  border: var(--rule-hair) solid var(--color-rule); border-radius: 0;
  background: transparent; color: var(--color-ink);
  font: 400 var(--label)/1 var(--font-body); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.btn::after { content: ""; position: absolute; inset: -2px; } /* 44px hit target */
@media (hover: hover) { .btn:hover:not(:disabled) { border-color: var(--color-ink-2); background: var(--color-hover); } }
.btn:active:not(:disabled) { color: var(--color-accent-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); font-weight: 600; }
@media (hover: hover) { .btn--primary:hover:not(:disabled) { background: var(--color-accent-soft); border-color: var(--color-accent-soft); color: var(--color-accent-ink); } }
.btn--primary:active:not(:disabled) { background: var(--color-accent-2); border-color: var(--color-accent-2); color: var(--color-accent-ink); }
.btn--quiet { border-color: transparent; color: var(--color-muted); padding: 0 var(--space-xs); }
@media (hover: hover) { .btn--quiet:hover:not(:disabled) { border-color: transparent; background: transparent; color: var(--color-ink); } }
.compare[aria-pressed="true"] { color: var(--color-warm); }

.btn:focus-visible, .icon-btn:focus-visible, .scrub:focus-visible, a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }

/* ---------- the sheet ---------- */

.sheet { overflow-y: auto; min-height: 0; padding: var(--space-md) var(--gutter) var(--space-xl) var(--space-md); }
.block { display: flex; flex-direction: column; gap: var(--space-md); }
.block + .block { margin-top: var(--space-xl); }

/* heads read like markdown, as on the site: "## name -------" */
.head {
  display: flex; align-items: baseline; gap: 1ch; max-width: none;
  font: 400 var(--text-section)/1.5 var(--font-body); color: var(--color-ink); white-space: nowrap;
}
.head::before { content: "##" / ""; color: var(--color-accent-2); }
.head::after { content: "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" / ""; flex: 1; min-width: 0; overflow: hidden; color: var(--color-faint); }

.row { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.row legend { padding: 0; margin-bottom: var(--space-xs); color: var(--color-muted); font-size: var(--label); }
.row-note { color: var(--color-muted); font-size: var(--label); line-height: 1.6; min-height: 1.6em; }

.seg { display: flex; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--control-h); padding: 0 var(--space-xs); margin-left: calc(-1 * var(--rule-hair));
  border: var(--rule-hair) solid var(--color-rule);
  color: var(--color-muted); font-size: var(--label); white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.seg label:first-child span { margin-left: 0; }
@media (hover: hover) { .seg span:hover { color: var(--color-ink); background: var(--color-hover); } }
.seg input:checked + span { position: relative; z-index: var(--z-base); border-color: var(--color-accent-2); color: var(--color-ink); background: var(--color-hover); }
.seg input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; z-index: var(--z-raised); }
.seg input:active + span { color: var(--color-accent-2); }
.seg input:disabled + span { opacity: 0.4; cursor: not-allowed; }

.switch { display: flex; align-items: center; gap: var(--space-sm); min-height: var(--control-h); cursor: pointer; color: var(--color-ink-2); font-size: var(--label); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; flex: none; width: 34px; height: 18px;
  border: var(--rule-hair) solid var(--color-rule);
  transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px;
  background: var(--color-muted);
  transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .switch:hover .switch-track { border-color: var(--color-ink-2); } }
.switch input:checked + .switch-track { border-color: var(--color-accent-2); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--color-accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.switch input:active + .switch-track { background: var(--color-hover); }
.switch input:disabled + .switch-track { opacity: 0.4; cursor: not-allowed; }
body[data-style="lines"] #ink-row { display: none; }

.actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.actions .btn--primary { flex: 1; }

/* progress: a light rule, overdrawn in heavy rule up to now, like the site's player */
.progress { display: flex; flex-direction: column; gap: var(--space-2xs); }
.progress-line { display: flex; justify-content: space-between; gap: var(--space-md); color: var(--color-ink-2); font-size: var(--label); }
.progress-line .num { color: var(--color-muted); }
.rail { position: relative; overflow: hidden; white-space: nowrap; font-family: var(--font-art); font-size: var(--label); line-height: 1.2; color: var(--color-faint); }
.rail::before { content: "\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500\2500"; }
.rail-done { position: absolute; inset: 0 auto 0 0; width: calc(var(--progress, 0) * 100%); overflow: hidden; color: var(--color-accent-2); }
.rail-done::before { content: "\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501\2501"; }
.progress .btn { align-self: flex-start; margin-top: var(--space-xs); }

.error { color: var(--color-error); font-size: var(--label); }

.figures { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: var(--space-md); column-gap: var(--space-lg); }
.figures div { min-width: 0; }
.figures dt { color: var(--color-muted); font-size: var(--label); }
.figures dd { margin: 0; color: var(--color-ink); font-size: var(--text-lg); line-height: 1.3; font-variant-numeric: tabular-nums; }

.download { font-size: var(--label); color: var(--color-muted); }

.offscreen { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; overflow: hidden; }
.noscript { padding: var(--space-lg); }

/* ---------- touch and notches ---------- */

.compare { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#live-note:empty { display: none; }
/* notes that change with a setting keep their height, so the controls under them stay put */
#fidelity-note, #renderer-note { min-height: 2lh; }
@media (hover: none) { .drop-pointer { display: none; } }
.bar { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }

/* ---------- smaller screens ---------- */

@media (max-width: 60rem) {
  body:not([data-state="empty"]) .work { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .frame { flex: none; padding: var(--space-sm) var(--space-xs) var(--space-xs); }
  /* the picture takes the full width, but a tall (portrait) video stops at about a third of
     the screen's height, so the pinned stage leaves room for the settings */
  .calc, .source, .reel, .credit-box { width: min(100%, calc(34svh * var(--aspect, 1.7778))); }
  .screen {
    padding: var(--space-md) max(var(--gutter), env(safe-area-inset-right)) var(--space-sm) max(var(--gutter), env(safe-area-inset-left));
  }
  .sheet {
    overflow: visible;
    padding: var(--space-lg) max(var(--gutter), env(safe-area-inset-right)) calc(var(--space-2xl) + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  }
  .drop { padding: var(--space-xl) var(--space-lg); }
}
/* on a phone held upright the graph stays pinned while the settings scroll under it */
@media (max-width: 60rem) and (min-height: 600px) {
  body:not([data-state="empty"]) .stage {
    position: sticky; top: 0; z-index: var(--z-sticky);
    background: var(--color-paper); border-bottom: var(--rule-hair) solid var(--color-rule-soft);
  }
}
@media (max-width: 40rem) {
  .steps { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); margin-top: var(--space-lg); }
  .drop { flex: none; justify-content: flex-start; margin-bottom: var(--space-lg); }
  .bar { padding-top: var(--space-md); }
  .transport { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--space-sm); row-gap: 0; }
  .time { grid-column: 2; grid-row: 2; line-height: 1.2; }
}
