/* The how-to videos' public pages, /watch and /watch/<name> (train 109:
   "a YouTube kind of style"). Refined Heritage on its own: burgundy, gold,
   cream, serif headings; light and dark by the phone's setting. Phone first:
   most who watch are on an iPhone. Text colours clear 4.5:1 on their
   surfaces in both themes. */

:root {
  --bg: #F4EEE8; --paper: #FDFBF8; --ink: #1F1A17; --ink-2: #5E544C; --line: #E6DCD1;
  --burgundy: #722F37; --burgundy-text: #722F37; --gold-text: #6C5332; --tile: #EDE3D8;
  --focus: #722F37; --serif: 'Newsreader', Georgia, serif; --sans: 'Hanken Grotesk', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1614; --paper: #262019; --ink: #F3ECE5; --ink-2: #BDB0A4; --line: #3A312B;
    --burgundy-text: #E3B3B9; --gold-text: #D9B98A; --tile: #31281F; --focus: #E3B3B9;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--burgundy-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top, .wrap, .foot { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand i { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: var(--burgundy); color: #fff; display: grid; place-items: center; font: 600 19px/1 var(--serif); font-style: normal; }
.brand span { font: 500 18px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-back { flex: 0 0 auto; display: flex; }
.back { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-weight: 600; font-size: 15px; }
.back::before { content: '\2039'; margin-right: 6px; font-size: 22px; line-height: 1; }
.wrap { padding-bottom: 40px; }
.foot { padding-top: 24px; padding-bottom: max(32px, env(safe-area-inset-bottom)); color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--line); }

h1 { font: 500 clamp(28px, 7vw, 42px)/1.12 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 500 22px/1.2 var(--serif); margin: 0; }
.lede { color: var(--ink-2); margin: 0 0 18px; max-width: 62ch; }
.eyebrow { font: 700 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 10px; }

/* Search: a GET form, filtered as you type by watch.js. */
.search { display: flex; gap: 8px; max-width: 560px; margin: 0 0 8px; }
.search input { flex: 1 1 auto; min-width: 0; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.search input::placeholder { color: var(--ink-2); opacity: 1; }
.search button, .ui-btn, .share { min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--burgundy); color: #fff; font: 600 15px/1 var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.search button:hover, .ui-btn:hover, .share:hover { background: #5A2329; }

/* The top video. */
.hero { display: grid; gap: 14px; margin: 22px 0 8px; }
.hero-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--tile); box-shadow: 0 24px 60px -32px rgba(0, 0, 0, .55); }
.hero-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-words h2 { font-size: clamp(24px, 5.5vw, 34px); line-height: 1.15; margin-bottom: 6px; text-wrap: balance; }
.hero-words h2 a { color: var(--ink); text-decoration: none; }
.hero-words h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.hero-words p { color: var(--ink-2); margin: 0 0 14px; }
.hero-words .eyebrow { margin-bottom: 8px; }
/* Lower left, clear of the poster's own title (mid-frame) and of the length (lower right). */
.play { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px 7px 11px; border-radius: 999px; background: rgba(114, 47, 55, .95); color: #fff; font: 600 13.5px/1 var(--sans); font-style: normal; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6); }
.play::before { content: ''; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent #fff; }

/* A shelf: a row that scrolls sideways, snapping card by card. */
.shelf { margin-top: 30px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.arrows { display: flex; gap: 8px; flex: 0 0 auto; }
.arrows button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 400 24px/1 var(--sans); cursor: pointer; display: grid; place-items: center; padding: 0 0 3px; }
.arrows button:hover { border-color: var(--burgundy-text); color: var(--burgundy-text); }
.arrows button:disabled { opacity: .4; cursor: default; }
.row { list-style: none; margin: 0 -16px; padding: 6px 16px 14px; display: grid; grid-auto-flow: column; grid-auto-columns: 76%; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: thin; }
.row > .card { scroll-snap-align: start; }

/* A card. Title and line come first in the page; the picture is drawn above them. */
.card { min-width: 0; }
.card a { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; border-radius: 14px; }
.card .thumb { order: -1; position: relative; display: block; aspect-ratio: 16 / 9; margin-bottom: 6px; border-radius: 12px; overflow: hidden; background: var(--tile); border: 1px solid var(--line); }
.card .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.card a:hover .thumb img, .card a:focus-visible .thumb img { transform: scale(1.03); }
.card-title { font: 500 18px/1.25 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-line { color: var(--ink-2); font-size: 14.5px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blank { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, #722F37, #4A1E24); color: rgba(255, 255, 255, .9); font: 500 44px/1 var(--serif); }
.time { position: absolute; right: 8px; bottom: 8px; padding: 3px 7px; border-radius: 6px; background: rgba(20, 16, 14, .86); color: #fff; font: 600 12.5px/1.2 var(--sans); font-variant-numeric: tabular-nums; }
.new { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--burgundy); color: #fff; font: 700 11.5px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.thumb .new { position: absolute; left: 8px; top: 8px; }
.none { color: var(--ink-2); margin: 28px 0; }

/* One video's page. */
.watch { display: grid; gap: 26px; }
.player { margin: 0 -16px; }
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.info { margin-top: 14px; }
.info h1 { font-size: clamp(24px, 6vw, 34px); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 12px; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.chip:hover { border-color: var(--burgundy-text); }
.share { min-height: 44px; padding: 0 18px; margin-left: auto; }
.status { font-size: 14px; color: var(--ink-2); }
.status:empty { display: none; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.box h2 { font-size: 20px; margin-bottom: 10px; }
.chapters { list-style: none; margin: 0; padding: 0; }
.chapters a { display: flex; gap: 14px; align-items: baseline; min-height: 44px; padding: 10px 8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.chapters a:hover, .chapters a[aria-current] { background: var(--bg); }
.chapters time { flex: 0 0 auto; min-width: 3.4em; color: var(--burgundy-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.next { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.next .card a { display: grid; grid-template-columns: 42% minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 12px; row-gap: 4px; }
.next .card .thumb { grid-row: 1 / span 2; grid-column: 1; margin: 0; }
.next .card-title { font-size: 16px; }
.next .card-line { font-size: 13.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

@media (min-width: 600px) {
  .row { grid-auto-columns: calc((100% - 16px - 14px) / 2.3); }
  .player { margin: 0; }
  .player video { border-radius: 16px; box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .6); }
}
@media (min-width: 860px) {
  .top, .wrap, .foot { padding-left: 28px; padding-right: 28px; }
  .row { margin: 0; padding: 6px 2px 14px; scroll-padding: 0; grid-auto-columns: calc((100% - 3 * 16px) / 4); gap: 16px; }
  .hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 32px; margin-top: 28px; }
}
@media (min-width: 1080px) {
  .watch { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 28px; }
  .watch-next { position: sticky; top: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .card .thumb img { transition: none; }
  .card a:hover .thumb img, .card a:focus-visible .thumb img { transform: none; }
}
.toplink { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-weight: 600; font-size: 15px; }
