:root {
  color-scheme: dark;
  color: #f4ecdf;
  background: #14110f;
  --paper: #f4ecdf;
  --muted: #cbbeb0;
  --amber: #edc6a3;
  --rule: #65554a;
  --serif: Baskerville, 'Iowan Old Style', Georgia, serif;
  font: 16px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 15% 0%, #2b211c, transparent 60%); }
a { color: var(--amber); text-underline-offset: 4px; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 5px; }

.chalk-header, .chalk-layout { width: min(91%, 87rem); margin-inline: auto; }
.chalk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: clamp(15px, 2.1vw, 32px) 0;
  border-bottom: 1px solid var(--rule);
}
.chalk-header a { display: inline-flex; align-items: center; min-height: 44px; color: var(--paper); text-decoration: none; }
.chalk-header a:hover { text-decoration: underline; }
.wordmark { font: 400 clamp(.92rem, 1.45vw, 1.35rem)/1.15 var(--serif); letter-spacing: .23em; }
.chalk-return { font: italic 400 clamp(1rem, 1.45vw, 1.35rem)/1.15 var(--serif); }

.chalk-layout {
  display: grid;
  width: min(91%, 68rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  align-items: center;
  gap: clamp(22px, 5vw, 80px);
  padding-block: clamp(24px, 3.4vw, 48px) clamp(36px, 6vw, 92px);
}
.chalk-intro h1 { margin: 0; font: 400 clamp(3.8rem, 7.85vw, 8rem)/.83 var(--serif); letter-spacing: -.058em; }
.chalk-intro h1 em { display: block; color: var(--amber); font-weight: 400; }
.chalk-intro > p { max-width: 37ch; margin: clamp(16px, 3vw, 30px) 0 12px; color: var(--muted); }
.case-study { display: inline-flex; align-items: center; min-height: 44px; margin-top: 10px; }

.chalk-piece { width: min(100%, 38svh, 23rem); justify-self: center; }
.chalk-view { margin: 0; }
.chalk-screen {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #090909;
}
#chalk-drawing, #stage-film { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
#stage-film:focus-visible { outline-offset: -4px; }
.chalk-piece[data-view='film'] #stage-film { animation: stage-reveal .75s ease-in-out; }
@keyframes stage-reveal { from { opacity: 0; } to { opacity: 1; } }
.chalk-view figcaption { min-height: 2.25rem; padding-block: 9px 5px; color: var(--muted); font-size: .875rem; }

.chalk-controls { max-width: 27rem; padding-top: 8px; }
.chalk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chalk-actions button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #947a68;
  background: transparent;
  color: var(--paper);
  font-size: .9375rem;
}
.chalk-actions .chalk-play { border-color: var(--amber); background: var(--amber); color: #1f160f; font-weight: 650; }
.chalk-actions button:hover { border-color: var(--paper); }
.chalk-actions .chalk-play:hover { background: var(--paper); }
.chalk-controls label { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; color: var(--muted); font-size: .875rem; }
.chalk-controls input[type='range'] { display: block; width: 100%; min-height: 36px; margin: 0; accent-color: var(--amber); cursor: ew-resize; }
.chalk-controls output { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#chalk-status[data-playback-error] {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  color: var(--amber);
}

@media (min-width: 761px) and (max-height: 820px) {
  .chalk-header { padding-block: clamp(14px, 2.4vh, 22px); }
}

@media (max-width: 760px) {
  .chalk-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-block-start: 20px; }
  .chalk-intro h1 { font-size: clamp(3.2rem, 9.9vw, 5rem); }
  .chalk-intro h1 em { display: inline; }
  .chalk-intro > p { max-width: 39ch; margin: 12px 0; }
  .chalk-piece { width: min(100%, 27svh, 23rem); }
}

@media (prefers-reduced-motion: reduce) {
  .chalk-piece[data-view='film'] #stage-film { animation: none; }
}
