/* Hallmark · shape: app screen · genre: atmospheric · theme: custom light table (shared with the site, site/tokens.css) · job: try · redesign: restyle
 * screen: the sheet of kept slides with a fewer, normal or more choice · states: pick (empty), finding (loading), error, slides (full) · signature: the slide sheet · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: E, the pick screen is one control, so the drop area carries the mark and the space */

:root {
  --app-width: 1080px; --control: 40px; --display-weight: 800; --display-stretch: 70%;
  --color-sheet: oklch(99.4% 0.004 250); --color-shadow: oklch(20% 0.01 260 / 0.18);
  --font-pdf: Helvetica, Arial, sans-serif; /* the PDF is set in Helvetica, so the pages on screen are too */
  /* Text colours for notes. app.js NOTE_COLORS holds the same values for the PDF. */
  --color-handle: oklch(52% 0.12 255); /* the selection colour for boxes, like Word's */
  --note-ink: #17181c; --note-red: #c42b23; --note-blue: #1f5fd1; --note-green: #1b7f4a; --note-grey: #5d6475;
}

.hidden { display: none !important; }
h1 { font-size: var(--text-display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); line-height: 0.95; max-width: 14ch; }
h2 { font-size: var(--text-xl); font-weight: 500; font-stretch: 100%; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--color-muted); }
.hint { font-size: var(--text-sm); color: var(--color-muted); }

/* Top bar */
.bar-top { max-width: var(--app-width); margin: 0 auto; padding: var(--space-lg) var(--space-md) var(--space-md); }
.brand { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xl); font-weight: 800; font-stretch: 75%; text-decoration: none; color: var(--color-ink); }
.mark { width: 28px; height: 28px; flex: none; }
.mark-back { fill: none; stroke: var(--color-ink); stroke-width: 2.5; }
.mark-front { fill: var(--color-accent); }

.shell { max-width: var(--app-width); margin: 0 auto; padding: 0 var(--space-md) var(--space-3xl); }

/* Screens settle in: a short fade each time one appears */
.pick, .panel, .error, #slides { animation: settle var(--dur-long) var(--ease-out) both; }
@keyframes settle { from { opacity: 0; transform: translateY(6px); } }

/* Pick a video (empty state) */
.pick { display: grid; gap: var(--space-xl); padding-top: var(--space-2xl); }
.drop {
  position: relative; display: grid; place-items: center; gap: var(--space-xs); text-align: center; cursor: pointer;
  min-height: 320px; padding: var(--space-2xl) var(--space-md);
  background: var(--color-paper-2); border: 2px dashed var(--color-ink);
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.drop:hover { background: var(--color-paper-3); }
.drop.over { background: var(--color-paper-3); border-color: var(--color-accent); border-style: solid; }
.drop:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-mark { width: 64px; height: 64px; margin-bottom: var(--space-sm); transition: transform var(--dur-short) var(--ease-out); }
.drop:hover .drop-mark, .drop.over .drop-mark { transform: translateY(-3px); }
.drop-big { font-size: var(--text-2xl); font-weight: 800; font-stretch: 75%; color: var(--color-ink); }
.drop-small { font-size: var(--text-sm); color: var(--color-muted); }

/* Panels */
.panel { background: var(--color-paper-2); color: var(--color-ink); padding: var(--space-lg); margin-top: var(--space-lg); }

/* Finding slides (loading state) */
#working { max-width: 640px; margin: 18vh auto 0; }
#working h2 { margin-bottom: var(--space-2xs); font-size: var(--text-2xl); font-weight: 800; font-stretch: 75%; }
.meter { height: 2px; background: var(--color-rule-2); margin: var(--space-lg) 0 var(--space-sm); overflow: hidden; }
.meter-fill { height: 100%; background: var(--color-accent); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-short) linear; }
.work-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); }
.so-far { list-style: none; margin: var(--space-md) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-xs); }
.so-far:empty { display: none; }
.so-far li { animation: settle var(--dur-long) var(--ease-out) both; }
.so-far img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--color-rule); background: var(--color-paper); }

/* Error */
.error { margin-top: var(--space-lg); padding: var(--space-md) var(--space-lg); background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-error); color: var(--color-ink); font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--space-lg);
  border: var(--rule-hair) solid transparent; border-radius: var(--radius-pill); background: none;
  font-weight: 700; font-stretch: 90%; color: var(--color-ink); cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out);
}
.btn--ink { background: var(--color-ink); color: var(--color-paper); }
.btn--ink:hover { background: var(--color-accent); color: var(--color-accent-ink); }
.btn--secondary { border: 2px solid var(--color-ink); }
.btn--secondary:hover { background: var(--color-paper-3); }
.btn--small { min-height: 36px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.btn:disabled, .btn--ink:disabled { background: var(--color-paper-3); color: var(--color-muted); border-color: var(--color-rule); cursor: default; transform: none; }

/* Toolbar over the slides: one slim row that stays at the top while you scroll */
.tools {
  position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
  margin-top: var(--space-md); padding: var(--space-xs) var(--space-md); background: var(--color-paper); border-bottom: 2px solid var(--color-ink);
}
.tools h2 { font-size: var(--text-xl); font-weight: var(--display-weight); font-stretch: var(--display-stretch); }
.tools-count { display: flex; align-items: baseline; gap: var(--space-md); }
.page-at { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); }

/* Format bar, shown while editing */
.tools { flex-wrap: wrap; }
.format { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs); padding-top: var(--space-xs); border-top: 1px solid var(--color-rule); }
.fbtn {
  min-width: 36px; height: 36px; padding: 0 var(--space-sm); border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill);
  background: var(--color-paper); color: var(--color-ink); font: inherit; font-family: var(--font-pdf); font-size: var(--text-md); cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.fbtn--add { font-family: inherit; font-weight: 700; font-size: var(--text-sm); }
.fbtn:hover:not(:disabled) { background: var(--color-paper-2); }
.fbtn[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
.fbtn:active:not(:disabled) { transform: translateY(1px); }
.fbtn:focus-visible, .swatch:focus-visible, .fsize select:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.fbtn:disabled, .swatch:disabled, .fsize select:disabled { color: var(--color-muted); background: var(--color-paper-2); border-color: var(--color-rule); cursor: default; }
.fsep { width: 1px; height: 24px; background: var(--color-rule); margin: 0 var(--space-2xs); }
.swatch { width: 28px; height: 28px; border-radius: var(--radius-pill); border: 2px solid var(--color-paper); box-shadow: 0 0 0 1px var(--color-rule-2); cursor: pointer; transition: transform var(--dur-micro) var(--ease-out); }
.swatch[data-color="ink"] { background: var(--note-ink); }
.swatch[data-color="red"] { background: var(--note-red); }
.swatch[data-color="blue"] { background: var(--note-blue); }
.swatch[data-color="green"] { background: var(--note-green); }
.swatch[data-color="grey"] { background: var(--note-grey); }

.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-ink); }
.swatch:hover:not(:disabled) { transform: scale(1.1); }
.swatch:active:not(:disabled) { transform: scale(0.95); }
.fsize { display: inline-flex; align-items: center; gap: var(--space-2xs); font-size: var(--text-sm); color: var(--color-ink-2); }
.fsize select { height: 36px; border: 1px solid var(--color-rule-2); border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-ink); font: inherit; padding: 0 var(--space-xs); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.actions .btn { min-height: 40px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.btn--quiet { color: var(--color-ink-2); text-decoration: underline; text-decoration-color: var(--color-rule-2); text-underline-offset: 0.2em; }
.btn--quiet:hover { color: var(--color-ink); text-decoration-color: var(--color-accent); }
.tools-hint { margin: var(--space-xs) 0 0; padding: 0 var(--space-md); }
@media (max-width: 40rem) {
  .tools { position: static; flex-direction: column; align-items: stretch; }
  .actions .btn { flex: 1; }
}

/* The slide sheet */
.grid { list-style: none; padding: 0; margin: var(--space-lg) 0 0; display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.slide { position: relative; background: var(--color-film); color: var(--color-film-ink); transition: background-color var(--dur-short) var(--ease-out); }
.slide:hover { background: var(--color-film-2); }
.slide--new { animation: arrive var(--dur-long) var(--ease-out) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }
.slide img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: var(--color-paper); }
.slide-meta { display: flex; justify-content: space-between; align-items: center; padding: var(--space-sm) var(--space-md); font-size: var(--text-sm); color: var(--color-film-muted); font-variant-numeric: tabular-nums; }
.slide-x {
  position: absolute; top: var(--space-xs); right: var(--space-xs); width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-ink); font-size: var(--text-lg); line-height: 1; cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.slide-x:hover { background: var(--color-accent); color: var(--color-accent-ink); }
.slide-x:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.slide-x:active { transform: scale(0.95); }
.slide-notes { padding: 0 var(--space-md) var(--space-md); }
.slide-notes h3 { font-size: var(--text-md); font-weight: 500; margin-bottom: var(--space-2xs); }
.slide-notes ul { margin: 0; padding-left: var(--space-md); color: var(--color-film-ink); font-size: var(--text-sm); display: grid; gap: var(--space-2xs); }

/* Progress while AI writes notes */
.busy { margin-top: var(--space-sm); padding: 0 var(--space-md); max-width: 640px; }
.busy-bar { height: 3px; background: var(--color-paper-3); overflow: hidden; }
.busy-bar span { display: block; width: 35%; height: 100%; background: var(--color-accent); animation: sweep 1.4s var(--ease-in-out) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.busy-row { display: flex; justify-content: space-between; gap: var(--space-md); margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); }
.slide.noting { outline: 3px solid var(--color-accent); outline-offset: 2px; animation: breathe 1.6s var(--ease-in-out) infinite; }
@keyframes breathe { 50% { opacity: 0.6; } }

/* Transcript: a clean, text-only view. Pictures, the editor and the notes lines step aside. */
#slides.tx-mode #grid, #slides.tx-mode #format, #slides.tx-mode #notes-text, #slides.tx-mode #busy,
#slides.tx-mode #download, #slides.tx-mode #notes, #slides.tx-mode #edit, #slides.tx-mode .page-at { display: none !important; }
.tx-view { max-width: 760px; margin: var(--space-xl) auto 0; padding: 0 var(--space-md); }
.tx-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--space-md); padding-bottom: var(--space-md); border-bottom: 2px solid var(--color-ink); }
.tx-head h2 { font-size: var(--text-3xl); font-weight: var(--display-weight); font-stretch: var(--display-stretch); }
.tx-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.tx-actions .btn { min-height: 40px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.tx-progress { margin-top: var(--space-md); }
.busy-bar--fill span { width: 100%; transform-origin: left; animation: none; transition: transform var(--dur-short) linear; }
.busy-bar--fill.busy-bar--sweep span { width: 35%; animation: sweep 1.4s var(--ease-in-out) infinite; }
.tx-lines { list-style: none; margin: var(--space-lg) 0 var(--space-3xl); padding: 0; }
.tx-line { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: var(--space-md); padding: var(--space-xs) 0; animation: settle var(--dur-short) var(--ease-out) both; }
.tx-line p { max-width: 62ch; line-height: 1.6; }
.tx-stamp { padding-top: 0.15em; font-size: var(--text-sm); font-weight: 600; color: var(--color-muted); }
.tx-slide { margin: var(--space-lg) 0 var(--space-2xs); padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); font-size: var(--text-sm); font-weight: 700; color: var(--color-accent); }
.tx-slide:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
@media (max-width: 40rem) { .tx-line { grid-template-columns: 3.5rem minmax(0, 1fr); gap: var(--space-sm); } }

/* After notes: the PDF itself, page after page, typed on directly.
   Every size is in PDF points times --u, so the sheet on screen matches the file. */
.grid.doc { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--space-xl); padding: var(--space-xl) var(--space-md); background: var(--color-paper-3); }
/* Fit a whole page on screen: never taller than the window below the top bar. */
.sheet { width: min(100%, 1040px, calc((100svh - 150px) * 841.89 / 473.56)); display: grid; gap: var(--space-xs); scroll-margin-top: 80px; }
.paper {
  position: relative; aspect-ratio: 841.89 / 473.56; container-type: inline-size; --u: calc(100cqw / 841.89);
  background: var(--color-sheet); color: var(--color-ink); font-family: var(--font-pdf); box-shadow: 0 2px 10px var(--color-shadow);
}
.paper > * { position: absolute; margin: 0; }
.paper img { object-fit: contain; background: var(--color-paper); }
.s-label { color: var(--color-muted); line-height: 1.3; }
.s-foot { color: var(--color-muted); }
.s-fit { overflow: hidden; }
.s-cover { display: grid; align-items: start; }
.s-title { font-size: calc(28 * var(--u)); font-weight: 700; line-height: 1.15; margin-bottom: calc(12 * var(--u)); }
.s-summary { font-size: calc(13 * var(--u)); line-height: 1.45; margin-bottom: calc(24 * var(--u)); }
.s-terms-head { font-size: calc(15 * var(--u)); font-weight: 700; line-height: 1.3; margin-bottom: calc(6 * var(--u)); }
.s-terms { margin: 0; }
.s-terms dt { font-size: calc(12 * var(--u)); font-weight: 700; line-height: 1.35; }
.s-terms dd { font-size: calc(12 * var(--u)); line-height: 1.35; color: var(--color-muted); margin: 0 0 calc(6 * var(--u)); }
.s-heading { font-size: calc(16 * var(--u)); font-weight: 700; line-height: 1.25; margin-bottom: calc(8 * var(--u)); }
.s-points { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(6 * var(--u)); }
.s-points li { position: relative; padding-left: calc(16 * var(--u)); font-size: calc(13 * var(--u)); line-height: 1.35; }
.s-points li::before { content: "\2022"; position: absolute; left: calc(2 * var(--u)); top: 0; }
.s-del {
  position: absolute; left: calc(-4 * var(--u)); top: 0; width: calc(16 * var(--u)); height: calc(16 * var(--u)); padding: 0;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-pill); background: var(--color-ink); color: var(--color-sheet);
  font-size: calc(11 * var(--u)); line-height: 1; cursor: pointer; opacity: 0.15; transition: opacity var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
.s-points li:hover .s-del, .s-del:focus-visible { opacity: 1; }
.s-del:hover { background: var(--color-accent); }
.s-del:active { transform: scale(0.92); }
.s-del:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.s-empty { font-size: calc(13 * var(--u)); color: var(--color-muted); }

.ed { outline: none; border-radius: 2px; cursor: text; transition: background-color var(--dur-micro) var(--ease-out); }
.ed:hover { background: var(--color-paper-2); }
.ed:focus { background: var(--color-paper-2); box-shadow: 0 0 0 2px var(--color-focus); }
.ed:empty::before { content: attr(aria-label); color: var(--color-muted); }

.s-warn { display: none; left: calc(32 * var(--u)); bottom: calc(12 * var(--u)); font-size: calc(10 * var(--u)); font-weight: 700; color: var(--color-accent); }
.too-full .s-warn { display: block; }
.too-full .s-fit { box-shadow: inset 0 -3px 0 var(--color-accent); }
.sheet-tools { display: flex; justify-content: flex-end; gap: var(--space-lg); }

/* Boxes on a page: AI notes, the cover blocks and your own text boxes. In Edit each one can
   be moved by its Move tab and resized by its corner. */
.blk { position: absolute; }
.blk > .s-fit { width: 100%; height: 100%; }
.tb { font-family: var(--font-pdf); color: var(--note-ink); white-space: pre-wrap; overflow-wrap: break-word; }
.tb-text { min-height: 1.3em; }
/* Inside a box the border is the only frame, as in Word: no extra ring or underline on the text. */
.grid.doc.editing .tb .ed, .grid.doc.editing .tb .ed:hover, .grid.doc.editing .tb .ed:focus { background: none; box-shadow: none; }
.tb[style*="height"] .tb-text { height: 100%; overflow: hidden; }
/* Word-style selection: nothing at rest, a faint border on hover, and once selected a thin
   border with eight square handles. The border itself is the move grip. */
.editing .blk { outline: 1px solid transparent; outline-offset: 2px; }
.editing .blk:hover { outline-color: var(--color-rule-2); }
.editing .blk:focus-within, .editing .blk:focus { outline: 1px solid var(--color-handle); }
.editing .blk:focus-visible { outline: 2px solid var(--color-focus); }
.fr-edge { position: absolute; z-index: 2; cursor: move; touch-action: none; }
.fr-edge--top { left: -4px; right: -4px; top: -7px; height: 8px; }
.fr-edge--bottom { left: -4px; right: -4px; bottom: -7px; height: 8px; }
.fr-edge--left { top: -4px; bottom: -4px; left: -7px; width: 8px; }
.fr-edge--right { top: -4px; bottom: -4px; right: -7px; width: 8px; }
.fr-h {
  position: absolute; z-index: 3; width: 9px; height: 9px; background: var(--color-sheet); border: 1px solid var(--color-handle);
  touch-action: none; opacity: 0; pointer-events: none; transition: opacity var(--dur-micro) var(--ease-out);
}
.blk:focus-within > .fr-h, .blk:focus > .fr-h { opacity: 1; pointer-events: auto; }
.fr-h--nw { left: -7px; top: -7px; cursor: nwse-resize; }
.fr-h--n { left: calc(50% - 5px); top: -7px; cursor: ns-resize; }
.fr-h--ne { right: -7px; top: -7px; cursor: nesw-resize; }
.fr-h--e { right: -7px; top: calc(50% - 5px); cursor: ew-resize; }
.fr-h--se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.fr-h--s { left: calc(50% - 5px); bottom: -7px; cursor: ns-resize; }
.fr-h--sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.fr-h--w { left: -7px; top: calc(50% - 5px); cursor: ew-resize; }
.fr-h:hover { background: var(--color-handle); }
body.placing .grid.doc .paper { cursor: crosshair; box-shadow: 0 0 0 3px var(--color-accent); }
.grid.doc.editing { background: var(--color-paper-2); }
.grid.doc.editing .paper { box-shadow: 0 0 0 2px var(--color-ink), 0 2px 10px var(--color-shadow); }
.grid.doc.editing .ed { box-shadow: inset 0 -1px 0 var(--color-rule-2); }
.grid.doc.editing .ed:focus { box-shadow: 0 0 0 2px var(--color-focus); }

.link-btn { width: auto; }


.link-btn {
  min-height: 36px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--color-ink);
  text-decoration: underline; text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; text-underline-offset: 0.2em; cursor: pointer;
}
.link-btn:hover { color: var(--color-accent); }
.link-btn:active { transform: translateY(1px); }
.link-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.link-btn--quiet { color: var(--color-muted); text-decoration-color: var(--color-rule-2); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .pick, .panel, .error, #slides, .slide--new, .so-far li { animation: none; }
  .busy-bar span { animation: none; width: 100%; opacity: 0.5; }
  .busy-bar--fill.busy-bar--sweep span { animation: none; }
  .tx-line { animation: none; }
  .slide.noting { animation: none; }
  .meter-fill { transition: none; }
}
