/* ==========================================================================
   stopmotion.makermanuals.com — the recorder and the film pages.
   Same look as makermanuals (Workshop): light grey, white cards, safety orange.
   Recorder: laptop screen, big buttons with an icon and a word.
   ========================================================================== */

@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-regular-latin.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/atkinson-bold-latin.woff2") format("woff2"); }

:root {
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #1d1f21;
  --muted: #5f6368;
  --line: #e3e3df;
  --line-strong: #d0d0ca;
  --accent: #f26b1d;
  --accent-dark: #c9520f;
  --accent-ink: #ffffff;
  --warn-bg: #fff5d6; --warn-ink: #5c4100;
  --danger: #d42b2b; --danger-bg: #fdeceb; --danger-ink: #7a1414;
  --ok-ink: #1d6b35;
  --radius: 10px;
  --radius-sm: 6px;
  --container: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--ink); background: var(--bg); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wordmark { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--accent); }

/* ---------- pages (start, playlists, films) ---------- */

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.site-header .brand { font-size: 1.25rem; text-decoration: none; color: var(--ink); font-weight: 700; }
.site-header .brand .sub { color: var(--muted); font-weight: 400; }
.site-header nav { margin-left: auto; display: flex; gap: 12px; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a[aria-current] { color: var(--ink); font-weight: 700; }

main.page { padding: 32px 0 64px; }
.page h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 8px; }
.page .lead { color: var(--muted); margin: 0 0 32px; font-size: 1.1rem; }


.start-head { display: flex; margin-bottom: 40px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.make-btn { display: flex; align-items: center; gap: 16px; padding: 20px 28px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.make-btn:hover { background: var(--accent-dark); }
.make-btn .big { font-size: 2.5rem; line-height: 1; }
.make-btn strong { display: block; font-size: 1.35rem; }
.make-btn .hint { display: block; color: rgba(255, 255, 255, 0.9); }
.playlist-section { margin-bottom: 56px; }
.playlist-section h2 { margin: 0 0 4px; }
.playlist-section { scroll-margin-top: 24px; }
.playlist-section .lead { margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); display: block; }
.card:hover { border-color: var(--accent); }
.card .cover { aspect-ratio: 16 / 9; background: #ddd; object-fit: cover; width: 100%; }
.card .body { display: block; padding: 12px 14px 14px; }
.card .title { font-weight: 700; display: block; }
.card .meta { display: block; color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }

.crumbs { margin: 0 0 12px; font-size: 0.95rem; }
.film-navs { display: flex; justify-content: space-between; gap: 12px; margin: -16px 0 32px; }
.film-nav { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong); color: inherit; text-decoration: none; font-weight: 600; }
a.film-nav:hover, a.film-nav:focus-visible { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
span.film-nav { visibility: hidden; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; }
.film-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 24px; margin: 16px 0 32px; }
.film-info h1 { margin: 0; }
.film-info .by { color: var(--muted); font-size: 1.1rem; }
.film-info label { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.description { max-width: 60ch; color: var(--muted); margin: 0 0 24px; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- the recorder ---------- */

body.recorder { height: 100vh; height: 100dvh; overflow: hidden; }
#app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
/* fixed rows: the banner is often hidden, and the others must not move up into its row */
.sm-bar { grid-row: 1; }
.sm-banner { grid-row: 2; }
.sm-main { grid-row: 3; }
.sm-strip { grid-row: 4; }
.sm-actions { grid-row: 5; }
.sm-bar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sm-home { text-decoration: none; color: var(--ink); font-weight: 700; white-space: nowrap; }
a.sm-btn { text-decoration: none; }
.sm-btn.sm-back { min-height: 0; padding: 6px 14px; text-decoration: none; white-space: nowrap; }
.sm-info { color: var(--muted); font-variant-numeric: tabular-nums; }
.sm-title-btn { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.sm-title-btn:hover { border-color: var(--accent); }
.sm-title-lines { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sm-title-text { font-weight: 700; overflow-wrap: anywhere; }
.sm-credit-text { font-size: .9em; color: var(--muted); overflow-wrap: anywhere; }
.sm-title-empty { border-style: dashed; }
.sm-title-empty .sm-title-text { font-weight: 400; color: var(--muted); }
.sm-title-btn .sm-svg { flex: none; width: 1rem; height: 1rem; margin-top: 3px; color: var(--muted); }
.sm-save-status { color: var(--muted); font-size: 0.9rem; }
.sm-save-status[data-state="error"] { color: var(--danger); font-weight: 700; }
.sm-info[data-state="near"] { color: var(--warn-ink); font-weight: 700; }
.sm-info[data-state="over"] { color: var(--danger); font-weight: 700; }
.sm-spacer { flex: 1; }
.sm-langs { display: flex; gap: 10px; }
.sm-langs a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.sm-langs a[aria-current] { color: var(--ink); font-weight: 700; }

.sm-banner { padding: 10px 16px; background: var(--warn-bg); color: var(--warn-ink); font-weight: 700; }
.sm-banner[data-kind="error"] { background: var(--danger-bg); color: var(--danger-ink); }

.sm-main { display: grid; grid-template-columns: 1fr 260px; gap: 16px; padding: 16px; min-height: 0; }
.sm-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; background: #111; border-radius: var(--radius); overflow: hidden; }
.sm-canvas { display: block; max-width: 100%; max-height: 100%; aspect-ratio: 16 / 9; }
.sm-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.sm-flash.on { animation: sm-flash 0.25s ease-out; }
@keyframes sm-flash { from { opacity: 0.85; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sm-flash.on { animation-duration: 0.1s; } }
.sm-stage-label { position: absolute; left: 12px; top: 12px; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 2px 10px; border-radius: 999px; font-size: 0.9rem; }
.sm-stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; text-align: center; padding: 24px; font-size: 1.15rem; }
.sm-stage-msg p { max-width: 36ch; margin: 0; }

.sm-side { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.sm-btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; min-height: 48px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 700; position: relative; }
.sm-btn:hover:not(:disabled) { border-color: var(--accent); }
.sm-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sm-btn[aria-pressed="true"] { background: #fff0e6; border-color: var(--accent); }
.sm-btn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -8px; right: -6px; background: var(--accent); color: #fff; font-size: 0.75rem; padding: 0 6px; border-radius: 999px; }
.sm-icon { font-size: 1.3em; line-height: 1; }
.sm-svg { display: inline-flex; width: 1.25em; height: 1.25em; font-size: 1rem; }
.sm-svg svg { width: 100%; height: 100%; }
.sm-row .sm-svg { width: 1.5rem; height: 1.5rem; }
.sm-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sm-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.sm-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.sm-photo { min-height: 96px; font-size: 1.35rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); flex-direction: column; gap: 4px; }
.sm-photo .sm-icon { font-size: 2rem; }
.sm-photo:hover:not(:disabled) { background: var(--accent-dark); }
.sm-play { min-height: 56px; }
.sm-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sm-cam { justify-content: flex-start; text-align: left; }
.sm-row .sm-btn { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 0.85rem; }
.sm-field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.sm-range { width: 100%; accent-color: var(--accent); }
.sm-range-label { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.sm-check { display: flex; gap: 8px; align-items: center; }
.sm-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sm-hint { color: var(--muted); font-size: 0.85rem; margin: auto 0 0; }
.sm-keys { list-style: none; padding: 0; }
.sm-keys li { margin: 0; }
.sm-dialog .sm-hint { margin: 12px 0 16px; font-size: 0.95rem; }

.sm-strip { display: flex; align-items: flex-start; min-height: max-content; gap: 8px; padding: 10px 16px; overflow-x: auto; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scroll-padding: 16px; }
.sm-thumb { flex: none; position: relative; width: 128px; height: auto; aspect-ratio: 16 / 9; padding: 0; border: 3px solid transparent; border-radius: var(--radius-sm); background: #ddd; cursor: pointer; overflow: hidden; }
.sm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sm-thumb[aria-selected="true"] { border-color: var(--accent); }
.sm-thumb:not(.sm-live) { touch-action: pan-x; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sm-thumb img { pointer-events: none; -webkit-user-drag: none; }
.sm-drag-on, .sm-drag-on .sm-thumb { cursor: grabbing; }
.sm-thumb.sm-dragging { opacity: 0.85; border-color: var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); transform: translateY(-4px) scale(1.04); z-index: 1; }
.sm-num { position: absolute; left: 4px; bottom: 2px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.75rem; padding: 0 5px; border-radius: 4px; }
.sm-live { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-weight: 700; font-size: 0.85rem; background: var(--bg); border: 3px dashed var(--line-strong); }
.sm-live[aria-selected="true"] { border-style: solid; border-color: var(--accent); }

.sm-actions { display: flex; gap: 8px; padding: 10px 16px; background: var(--surface); }

.sm-dialog { border: none; border-radius: var(--radius); padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); }
.sm-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.sm-dialog h2 { margin: 0 0 16px; }
.sm-dialog-text { font-size: 1.1rem; margin: 0 0 16px; }
.sm-dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sm-dialog-buttons.sm-stack { flex-direction: column; align-items: stretch; }
.sm-form label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-weight: 700; }
.sm-form input { font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.sm-form small { font-weight: 400; color: var(--muted); }
.sm-field-note { margin: -8px 0 14px; font-size: 0.95rem; }
.sm-field-note[data-kind="error"] { color: var(--danger); font-weight: 700; }
.sm-field-note[data-kind="ok"] { color: var(--ok-ink); }
.sm-error { background: var(--danger-bg); color: var(--danger-ink); padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 700; }
.sm-progress progress { width: 100%; height: 16px; accent-color: var(--accent); margin-bottom: 8px; }

@media (max-width: 900px) {
  body.recorder { height: auto; overflow: auto; }
  #app { height: auto; }
  .sm-main { grid-template-columns: 1fr; }
  .sm-actions { flex-wrap: wrap; }
}
