/* The Benmore Brief: click-to-load YouTube player, chapter lists, episode cards, developer concepts.
   Used by the resource detail (episodes), resources index, homepage, book and developer concepts pages. */

.v2 :is(.brief-card, .dev-card, .home-brief) .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- click-to-load player (v2/partials/_youtube_player.html) ---------- */
.v2 .yt-player { position: relative; aspect-ratio: 16 / 9; background: #0b0b0b; border-radius: inherit; overflow: hidden; }
.v2 .yt-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.v2 .yt-facade { position: absolute; inset: 0; display: block; color: #fff; cursor: pointer; }
.v2 .yt-facade picture, .v2 .yt-facade img { display: block; width: 100%; height: 100%; }
.v2 .yt-facade img { object-fit: cover; transition: transform 700ms var(--v2-ease); }
.v2 .yt-facade::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.32)); pointer-events: none; }
.v2 .yt-facade:hover img { transform: scale(1.015); }
.v2 .yt-play { position: absolute; left: 50%; top: 50%; z-index: 1; display: grid; place-items: center; width: clamp(64px, 6.5vw, 88px); aspect-ratio: 1; border-radius: 50%; background: rgba(11,11,11,.8); color: #fff; transform: translate(-50%, -50%); transition: transform 280ms var(--v2-ease), background 280ms var(--v2-ease); }
.v2 .yt-play svg { width: 38%; height: 38%; margin-left: 6%; }
.v2 .yt-facade:hover .yt-play, .v2 .yt-facade:focus-visible .yt-play { background: var(--v2-accent); transform: translate(-50%, -50%) scale(1.06); }
.v2 .yt-facade:focus-visible { outline: 3px solid var(--v2-accent); outline-offset: -3px; }
.v2 .yt-length { position: absolute; left: 14px; bottom: 14px; z-index: 1; padding: 6px 9px; border-radius: 999px; background: rgba(11,11,11,.72); color: #fff; font: 500 .75rem/1 var(--v2-mono); letter-spacing: .02em; }

/* ---------- chapter list (v2/partials/_youtube_chapters.html) ---------- */
.v2 .yt-chapters { list-style: none; margin: 0; padding: 0; }
.v2 .yt-chapters li { border-top: 1px solid var(--v2-line); }
.v2 .yt-chapters li:last-child { border-bottom: 1px solid var(--v2-line); }
.v2 .yt-chapters a { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: 12px; padding: 11px 10px; color: inherit; text-decoration: none; font-size: .95rem; line-height: 1.4; transition: background 180ms var(--v2-ease), color 180ms var(--v2-ease); }
.v2 .yt-chapters time { font: .78rem/1.8 var(--v2-mono); color: var(--v2-muted); }
.v2 .yt-chapters a:hover { background: rgba(11,11,11,.04); }
.v2 .yt-chapters a:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: -2px; }
.v2 .yt-chapters a[aria-current], .v2 .yt-chapters a[aria-current] time { color: var(--v2-accent); }

/* ---------- episode cards (resources index, homepage, episode pages) ---------- */
.v2 .brief-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 16px; list-style: none; margin: 0; padding: 0; }
.v2 .brief-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; height: 100%; color: inherit; text-decoration: none; }
.v2 .brief-card-poster { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--v2-radius-sm); overflow: hidden; background: #dbe2e7; }
.v2 .brief-card-poster img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--v2-ease); }
.v2 .brief-card:hover .brief-card-poster img { transform: scale(1.035); }
.v2 .brief-card-poster .yt-length { left: 12px; bottom: 12px; }
.v2 .brief-card-label { display: block; font-size: .8125rem; color: #637077; }
.v2 .brief-card h3 { margin-top: 6px; font-size: clamp(1.15rem, 1.35vw, 1.4rem); font-weight: 400; line-height: 1.3; letter-spacing: -.02em; text-wrap: pretty; }
.v2 .brief-card:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 4px; border-radius: var(--v2-radius-sm); }

/* Resources index: The Benmore Brief shelf above the library */
.v2 .brief-shelf { margin-bottom: var(--ds-section-gap); scroll-margin-top: calc(var(--v2-nav-h) + 24px); }
.v2 .brief-shelf .library-section-heading { margin-bottom: 10px; }
.v2 .brief-shelf-links { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.v2 .brief-shelf-intro { max-width: 60ch; margin-bottom: 28px; color: var(--v2-muted); }
.v2 .brief-dev-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 36px; padding: 22px 28px; border-radius: var(--v2-radius-sm); background: #fff; color: inherit; text-decoration: none; transition: background 280ms var(--v2-ease); }
.v2 .brief-dev-strip strong { display: block; margin-top: 4px; font-size: var(--ds-card-heading, 1.4rem); font-weight: 400; letter-spacing: -.02em; line-height: 1.25; }
.v2 .brief-dev-strip > span { font-size: 1.3rem; transition: transform 280ms var(--v2-ease); }
.v2 .brief-dev-strip:hover > span { transform: translateX(4px); }
.v2 .brief-dev-strip:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 3px; }

/* Homepage: The Benmore Brief, before the closing CTA */
.v2 .home-brief { padding: clamp(24px, 3vw, 48px) 0 clamp(56px, 6vw, 96px); }
.v2 .home-brief-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: clamp(24px, 3vw, 40px); }
.v2 .home-brief-head h2 { font-size: var(--ds-heading); line-height: 1.1; letter-spacing: -.04em; }
.v2 .home-brief-head p { margin-top: 12px; max-width: 52ch; color: var(--v2-muted); }
.v2 .home-brief-head a { flex-shrink: 0; font-size: .88rem; text-decoration: underline; text-decoration-color: #b7bbb4; text-underline-offset: 5px; }

/* ---------- episode page (v2/resources/detail.html) ---------- */
/* The video leads; chapters sit beside it at its height, and the title, summary and one button sit under it. */
.pg-resd .ep-top { padding: clamp(24px, 3vw, 40px) 0 clamp(56px, 7vw, 104px); }
.pg-resd .ep-top .crumb { margin-bottom: 20px; }
.pg-resd .ep-stage { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "info"; gap: 36px clamp(24px, 3vw, 40px); }
.pg-resd .ep-stage.has-chapters { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); grid-template-areas: "player chapters" "info ."; }
.pg-resd .ep-player { grid-area: player; border-radius: var(--v2-radius); overflow: hidden; background: #0b0b0b; }
.pg-resd .ep-player figure { margin: 0; }
.pg-resd .ep-player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0b0b0b; }
/* Without chapters beside it, the player is capped so the whole video fits on screen. */
.pg-resd .ep-stage:not(.has-chapters) .ep-player { width: min(100%, calc((100svh - 260px) * 16 / 9)); }
.pg-resd .ep-chapters { grid-area: chapters; position: relative; min-height: 0; }
.pg-resd .ep-chapters-inner { position: absolute; inset: 0; display: flex; flex-direction: column; }
.pg-resd .ep-chapters h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 500; letter-spacing: -.01em; }
.pg-resd .ep-chapters .yt-chapters { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pg-resd .ep-chapters .yt-chapters a { padding-inline: 0 6px; }
.pg-resd .ep-info { grid-area: info; max-width: 760px; }
.pg-resd .ep-number { margin: 0; font-size: .95rem; color: var(--v2-muted); }
.pg-resd .ep-info h1 { margin-top: 8px; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.06; letter-spacing: -.035em; max-width: 22ch; text-wrap: balance; }
.pg-resd .ep-summary { margin-top: 18px; font-size: 1.125rem; line-height: 1.6; color: var(--v2-muted); max-width: 62ch; }
.pg-resd .ep-info .btn { margin-top: 28px; }
.pg-resd .ep-more { border-top: 1px solid var(--v2-line); }
.pg-resd .ep-more .related-head { flex-direction: row; align-items: center; }
.pg-resd .ep-more .related-head h2 { font-size: clamp(1.5rem, 2.2vw, 2.1rem); }
@media (max-width: 960px) {
  .pg-resd .ep-stage.has-chapters { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "info" "chapters"; }
  .pg-resd .ep-chapters-inner { position: static; }
  .pg-resd .ep-chapters .yt-chapters { overflow: visible; }
}

/* ---------- book page: the animated audiobook ---------- */
.v2 .book-facts > a { color: inherit; text-decoration: underline; text-decoration-color: #b7bbb4; text-underline-offset: 4px; }
.v2 .book-facts > a:hover { color: var(--v2-fg); }
.v2 .book-facts > span + a::before { content: "·"; display: inline-block; padding-inline: 12px; }
.v2 .book-listen { padding-block: 0 var(--ds-section-gap); scroll-margin-top: 90px; }
.v2 .listen-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr); gap: clamp(20px, 3vw, 40px); align-items: stretch; }
.v2 .listen-player { border-radius: var(--ds-radius); overflow: hidden; align-self: start; }
.v2 .listen-chapters { position: relative; min-height: 280px; }
.v2 .listen-chapters .yt-chapters { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 48px;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent); }

/* ---------- developer concepts page ---------- */
.v2 .dev-page { padding-bottom: var(--ds-section-gap); }
.v2 .dev-crumb { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; font-size: .9rem; color: var(--v2-muted); text-decoration: none; }
.v2 .dev-crumb:hover { color: var(--v2-fg); }
.v2 .dev-page .resources-heading a { color: var(--v2-fg); white-space: nowrap; text-decoration: underline; text-decoration-color: #b7bbb4; text-underline-offset: 4px; }
.v2 .dev-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 40px 16px; list-style: none; margin: 0; padding: 0; }
.v2 .dev-card { display: flex; flex-direction: column; min-width: 0; }
.v2 .dev-card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.v2 .dev-card-link + .dev-card-foot { margin-top: 6px; }
.v2 .dev-card-poster { display: block; aspect-ratio: 9 / 16; border-radius: var(--v2-radius-sm); overflow: hidden; background: #dfe3d6; }
.v2 .dev-card-poster img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--v2-ease); }
.v2 .dev-card-link:hover .dev-card-poster img { transform: scale(1.03); }
.v2 .dev-card h3 { margin-top: 14px; font-size: clamp(1.15rem, 1.4vw, 1.4rem); font-weight: 400; line-height: 1.2; letter-spacing: -.02em; }
.v2 .dev-card p { margin-top: 8px; color: var(--v2-muted); font-size: .9rem; line-height: 1.5; text-wrap: pretty; }
.v2 .dev-card-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: .8125rem; color: #637077; }
.v2 .dev-card-foot a { color: inherit; }
.v2 .dev-card-link:hover .dev-card-watch, .v2 .dev-card-foot a:hover { color: var(--v2-fg); }
.v2 .dev-card-link:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 4px; border-radius: var(--v2-radius-sm); }
.v2 .dev-shorts { margin-top: var(--ds-section-gap); padding-top: var(--ds-section-gap); border-top: 1px solid var(--v2-line); }
.v2 .dev-shorts .library-section-heading { margin-bottom: 10px; }
.v2 .dev-shorts > p { max-width: 60ch; margin-bottom: 28px; color: var(--v2-muted); }

@media (max-width: 1200px) {
  .v2 .dev-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .v2 .dev-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v2 .listen-grid { grid-template-columns: 1fr; }
  .v2 .listen-chapters { min-height: 0; }
  .v2 .listen-chapters .yt-chapters { position: static; max-height: 360px; }
}
@media (max-width: 760px) {
  /* Episode rows scroll sideways on phones instead of stacking six posters. */
  .v2 .brief-grid { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 80%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: none; }
  .v2 .brief-grid::-webkit-scrollbar { display: none; }
  .v2 .brief-grid > li { scroll-snap-align: start; }
  .v2 .home-brief-head { flex-direction: column; align-items: flex-start; }
  .v2 .dev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 12px; }
  .v2 .dev-card h3 { font-size: 1.2rem; margin-top: 12px; }
  .v2 .dev-card p { font-size: .875rem; }
  .v2 .brief-dev-strip { padding: 20px; }
  .v2 .brief-dev-strip strong { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .v2 :is(.yt-facade img, .brief-card-poster img, .dev-card-poster img, .brief-dev-strip > span) { transition: none; transform: none !important; }
  .v2 .yt-play { transition: none; }
  .v2 .yt-facade:hover .yt-play, .v2 .yt-facade:focus-visible .yt-play { transform: translate(-50%, -50%); }
}
