/* Sideways rows (20 Nov 2026): one look for every horizontal row of cards or tabs on the public site (Watch rows,
   homepage shelves, related videos, the timeline, the tales tabs on phones). The scrolling element carries
   data-hscroll; hscroll.js wraps it in .hs and adds the round buttons, the edge fade and the progress line.
   Without the script the row still swipes and scrolls, only the browser's grey bar is gone. */
@property --hs-l { syntax: "<length-percentage>"; inherits: false; initial-value: 0px; }
@property --hs-r { syntax: "<length-percentage>"; inherits: false; initial-value: 0px; }

/* The row itself: no browser scrollbar, native swipe/trackpad, snapping (rows that set their own snap keep it). */
html [data-hscroll] { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior-x: contain; }
html [data-hscroll]::-webkit-scrollbar { display: none; width: 0; height: 0; }
:where([data-hscroll]) { scroll-snap-type: x proximity; }
:where([data-hscroll]) > * { scroll-snap-align: start; }
:where([data-hscroll~="free"]) { scroll-snap-type: none; }
@media (prefers-reduced-motion: no-preference) { :where([data-hscroll]) { scroll-behavior: smooth; } }

/* The frame added by the script. Colours follow the page: the site's light and night themes swap these tokens. */
.hs {
  position: relative; min-inline-size: 0;
  --hs-bg: var(--sheet, #fbfaf5); --hs-fg: var(--ink, #192d34); --hs-line: var(--line-strong, #bdbdae);
  --hs-accent: var(--clay, #35655f); --hs-on: var(--ivory, #fbfaf5); --hs-track: var(--line, #d6d4c9);
  --hs-top: 50%; --hs-size-btn: 2.75rem; --hs-fade: min(4.5rem, 14%);
}
.hs.is-scrollable > [data-hscroll] {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--hs-l), #000 calc(100% - var(--hs-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--hs-l), #000 calc(100% - var(--hs-r)), transparent);
  transition: --hs-l .25s ease, --hs-r .25s ease;
}
.hs.hs-more-l > [data-hscroll] { --hs-l: var(--hs-fade); }
.hs.hs-more-r > [data-hscroll] { --hs-r: var(--hs-fade); }

/* Round previous/next buttons over the row's edges: only for a mouse or trackpad (touch screens swipe). */
.hs > .hs-btn {
  position: absolute; z-index: 4; inset-block-start: var(--hs-top); margin: calc(var(--hs-size-btn) / -2) 0 0;
  display: none; place-items: center; inline-size: var(--hs-size-btn); block-size: var(--hs-size-btn); padding: 0;
  border: 1px solid var(--hs-line); border-radius: 50%; background: var(--hs-bg); color: var(--hs-fg);
  box-shadow: 0 6px 18px rgba(12, 30, 34, .16), 0 1px 3px rgba(12, 30, 34, .14); cursor: pointer;
  font: inherit; line-height: 0; -webkit-tap-highlight-color: transparent;
  transition: opacity .2s ease, visibility .2s, background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.hs > .hs-prev { inset-inline-start: .55rem; }
.hs > .hs-next { inset-inline-end: .55rem; }
.hs > .hs-btn svg { display: block; inline-size: 1.25rem; block-size: 1.25rem; }
.hs[dir="ltr"] > .hs-prev svg, .hs[dir="rtl"] > .hs-next svg { transform: scaleX(-1); }
.hs > .hs-btn:hover { background: var(--hs-accent); border-color: var(--hs-accent); color: var(--hs-on); }
.hs > .hs-btn:active { transform: scale(.93); }
.hs > .hs-btn:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 2px; }
.hs > .hs-btn:disabled { opacity: 0; visibility: hidden; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .hs.is-scrollable > .hs-btn { display: grid; } }

/* Slim progress line, centred in the row's bottom padding (where the grey bar used to be). */
.hs > .hs-bar {
  position: absolute; inset-block-end: 0; inset-inline: 0; margin-inline: auto; inline-size: min(9rem, 40%); block-size: 3px;
  border-radius: 3px; background: var(--hs-track); overflow: hidden; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.hs.is-scrollable > .hs-bar { opacity: 1; }
.hs > .hs-bar > span {
  position: absolute; inset-block: 0; inline-size: calc(var(--hs-size, 1) * 100%);
  inset-inline-start: calc(var(--hs-pos, 0) * (100% - var(--hs-size, 1) * 100%)); border-radius: inherit; background: var(--hs-accent);
}

/* Per place. */
.watch .hs { --hs-top: 40%; }
.hs.hs-tabs { --hs-size-btn: 2.2rem; --hs-fade: min(2.75rem, 18%); }
.hs.hs-tabs > .hs-prev { inset-inline-start: 0; }
.hs.hs-tabs > .hs-next { inset-inline-end: 0; }
.tales .hs { --hs-bg: rgba(12, 29, 34, .92); --hs-fg: var(--tb-cream, #fbf4e6); --hs-line: var(--tb-line, rgba(222, 186, 118, .3));
  --hs-accent: var(--tb-gold, #deba76); --hs-on: var(--tb-night, #0c1d22); --hs-track: rgba(222, 186, 118, .22); }

@media (prefers-reduced-motion: reduce) {
  .hs.is-scrollable > [data-hscroll], .hs > .hs-btn, .hs > .hs-bar { transition: none; }
}
@media (forced-colors: active) { .hs > .hs-btn { border-color: ButtonText; } }
@media print { .hs > .hs-btn, .hs > .hs-bar { display: none; } }
