/* ==== BLOCK: poem-overlay (Figma: PBH - Poem overlay / Desktop, Tablet, Mobile) ====
   The poem page opened over a timeline. The panel slides up and fades in (1s ease, as the live site); the timeline behind
   fades to 40%. Desktop and tablet: poem on the left, "For teachers" and the notes on the right.
   Phones (to 699px): one column; the right-hand notes and "Explore other poems" fold into accordions. */
.pm-overlay { --pm-speed: 1s; position: fixed; inset: 0; z-index: 2000; overflow-y: auto; overscroll-behavior: contain; padding: 30px 5px; cursor: pointer; }
.pm-panel { position: relative; max-width: 1200px; margin: 0 auto; background: #fff; border-radius: 16px; box-shadow: 0 0 40px rgba(0,0,0,.18); overflow: hidden; cursor: auto; color: #000; }
.pm-panel:focus, .pm-panel:focus-visible,
:root:not([data-input="pointer"]) .pm-panel:focus-visible { outline: none; }
.pm-overlay svg { fill: currentColor; }
.pm-overlay.is-entering .pm-panel { animation: pm-in var(--pm-speed) ease both; }
.pm-overlay.is-leaving .pm-panel { transition: opacity .25s ease-out, transform .25s ease-out; opacity: 0; transform: translateY(24px); }
.pm-content.is-swapping { animation: pm-swap .3s ease-out both; }
@keyframes pm-in { from { opacity: 0; transform: translateY(50vh); } to { opacity: 1; transform: none; } }
@keyframes pm-swap { from { opacity: 0; } to { opacity: 1; } }
html.pm-lock { overflow: hidden; }
/* the timeline behind fades back (the header, breadcrumb and footer stay as they are) */
.tl > :not(.pm-overlay), [data-pm-host] > :not(.pm-overlay) { transition: opacity .4s ease-out; }
.tl.is-poem-open > :not(.pm-overlay):not(template), [data-pm-host].is-poem-open > :not(.pm-overlay):not(template) { opacity: .4; }

/* header: previous poem, poet, next poem; close at the top right */
.pm-head { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 30px 24px; border-bottom: 1px solid var(--neutral-200); }
.pm-nav { display: flex; align-items: center; gap: 10px; max-width: 240px; color: #000; font-size: 14px; line-height: 21px; text-decoration: none; }
.pm-nav--next { justify-self: end; text-align: right; }
.pm-nav[hidden] { display: none !important; }
.pm-nav svg { flex: none; width: 24px; height: 24px; color: var(--orange-500); transition: transform .2s ease-out; }
.pm-nav-text { display: flex; flex-direction: column; min-width: 0; }
.pm-nav:hover .pm-nav-title { text-decoration: underline; text-underline-offset: 2px; }
.pm-nav--prev:hover svg { transform: translateX(-3px); }
.pm-nav--next:hover svg { transform: translateX(3px); }
.pm-nav--next[data-lucky-again] { max-width: none; gap: 0; }
.pm-nav--next[data-lucky-again] .pm-nav-text,
.pm-nav--next[data-lucky-again] > svg { display: none !important; }
.pm-nav-lucky { flex: none; width: 72px; height: 72px; object-fit: contain; display: block; transition: transform .2s ease-out; }
.pm-nav--next[data-lucky-again]:hover .pm-nav-lucky { transform: scale(1.06); }
.pm-nav:focus-visible, .pm-close:focus-visible, .pm-print:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.pm-poet { grid-column: 2; display: flex; flex-direction: column; align-items: center; min-width: 236px; text-align: center; }
.pm-poet [data-part] { display: contents; }
.pm-pic { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin-bottom: 3px; }
.pm-pic--none { display: grid; place-items: center; background: var(--tl-mid, #92d1e4); color: var(--tl-ink, var(--ink)); font-weight: 800; font-size: 30px; letter-spacing: -0.02em; }
.pm-poet-name { margin: 0; font-weight: 700; font-size: 16px; line-height: 24px; }
.pm-poet-dates { margin: 3px 0 0; font-size: 14px; line-height: 21px; }
.pm-close { position: absolute; top: 14px; right: 12px; display: grid; place-items: center; width: 32px; height: 32px; padding: 4px; border: 0; background: none; color: var(--orange-500); cursor: pointer; text-decoration: none; }
.pm-close svg { width: 18px; height: 18px; }
.pm-close:hover { color: var(--orange-700); }
/* Standalone /poems/<slug>: open overlay over a blank host */
html[data-poem-standalone] .poem-loading[hidden],
html[data-poem-standalone] .poem-error[hidden] { display: none !important; }
html[data-poem-standalone] body.page-poem [data-pm-host].is-poem-open > :not(.pm-overlay):not(template) { opacity: 0; pointer-events: none; }

/* body: poem column + notes column */
.pm-body { display: flex; align-items: stretch; gap: 8px; padding: 8px; }
.pm-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pm-side { flex: 0 0 max(258px, 31%); display: flex; flex-direction: column; gap: 8px; }

.pm-poem { position: relative; display: flex; flex-direction: column; gap: 48px; padding: 48px; }
.pm-title { margin: 0; padding-right: 32px; font-weight: 400; font-size: 28px; line-height: 35px; letter-spacing: -0.02em; color: #000; }
.pm-title span { font-weight: 800; }
.pm-title:focus, .pm-title:focus-visible,
:root:not([data-input="pointer"]) .pm-title:focus-visible { outline: none; }
.pm-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: -24px 0 0; }
.pm-tools-sw { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 32px; }
.pm-switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; line-height: 21px; color: #000; cursor: pointer; user-select: none; }
.pm-switch[hidden] { display: none !important; }
.pm-switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange-500, #df5200); cursor: pointer; }
.pm-switch img { display: block; height: 18px; width: auto; }
.pm-print { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin-left: auto; padding: 0; border: 0; background: none; color: #000; cursor: pointer; text-decoration: none; }
.pm-print svg { width: 32px; height: 32px; }
.pm-print:hover { color: var(--neutral-600); }
.pm-text { font-size: 16px; line-height: 24px; }
.pm-text p { margin: 0 0 24px; }
.pm-text > :last-child { margin-bottom: 0; }
.pm-text hr { margin: 24px 0; border: 0; border-top: 1px solid var(--neutral-200); }
.pm-text a { color: inherit; text-decoration: none; pointer-events: none; } /* OED links are off until toggled */
.pm-text.is-oed-on a[href*="oed.com"] { pointer-events: auto; text-decoration: underline; text-underline-offset: 2px; color: var(--orange-500, #df5200); }
.pm-todo { color: var(--neutral-500); font-style: italic; }
.pm-credits { font-size: 12px; line-height: 24px; letter-spacing: -0.02em; }
.pm-credits p { margin: 0; }

.pm-h { margin: 0; font-weight: 700; font-size: 16px; line-height: 24px; color: var(--ink); }

/* performances: a carousel of videos (the middle one centred, its neighbours peeking in) */
.pm-perf { display: flex; flex-direction: column; gap: 24px; padding: 24px 0; background: var(--yellow-50); }
.pm-perf .pm-h { padding: 0 32px; }
.pm-carousel { container-type: inline-size; --tile: min(480px, calc(100cqw - 64px)); position: relative; }
.pm-videos { display: flex; gap: 32px; margin: 0; padding: 0 calc(50% - var(--tile) / 2); list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pm-videos::-webkit-scrollbar { display: none; }
.pm-video { flex: 0 0 var(--tile); scroll-snap-align: center; }
.pm-video-play, .pm-video-frame { position: relative; display: block; width: 100%; aspect-ratio: 381 / 214; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--ink); cursor: pointer; }
.pm-video-play img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.pm-video-play:hover img { transform: scale(1.03); }
.pm-play { position: absolute; left: 50%; top: 50%; width: 45px; height: 45px; margin: -22.5px 0 0 -22.5px; border-radius: 50%; background: #00b5ed; }
.pm-play::after { content: ""; position: absolute; left: 16px; top: 10px; border-style: solid; border-width: 12.5px 0 12.5px 17px; border-color: transparent transparent transparent #fff; }
.pm-video-play:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pm-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pm-video-title { display: flex; gap: 8px; margin: 8px 0 0; font-weight: 400; font-size: 14px; line-height: 21px; color: #000; }
.pm-video-title svg { flex: none; width: 21px; height: 21px; }
.pm-car-nav { position: absolute; left: 50%; top: 0; width: var(--tile); aspect-ratio: 381 / 214; transform: translateX(-50%); pointer-events: none; }
.pm-car-btn { position: absolute; top: 50%; display: grid; place-items: center; width: 36px; height: 36px; margin-top: -18px; padding: 0; border: 1.5px solid #fff; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; pointer-events: auto; transition: opacity .2s; }
.pm-car-btn svg { width: 24px; height: 24px; }
.pm-car-btn--prev { left: -54px; }
.pm-car-btn--next { right: -54px; }
.pm-car-btn:disabled { opacity: .35; cursor: default; }
.pm-car-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* resources: Listen / Watch */
.pm-res { display: flex; flex-direction: column; gap: 24px; padding: 24px 16px 40px; background: var(--yellow-100); }
.pm-res .pm-h { padding: 0 16px; }
.pm-res-row { display: flex; align-items: center; gap: 30px; width: 100%; max-width: 540px; margin: 0 auto; }
.pm-res-img { flex: none; width: 124px; height: 124px; border-radius: 50%; object-fit: cover; }
.pm-res-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; font-size: 14px; line-height: 21px; color: var(--ink); }
.pm-res-copy p { margin: 0; }
.pm-res-copy .btn { white-space: normal; text-align: left; }

/* notes column: on desktop and tablet each <details> is always open and its summary is a plain heading */
.pm-acc > summary { list-style: none; }
.pm-acc > summary::-webkit-details-marker { display: none; }
.pm-acc--teachers { padding: 30px 32px; border: 1px solid #9195ae; border-radius: 16px; background: #e7e8ec; }
.pm-info { flex: 1; display: flex; flex-direction: column; gap: 24px; padding: 30px 32px; background: var(--neutral-50); }
.pm-side summary { font-weight: 700; font-size: 14px; line-height: 24px; letter-spacing: -0.02em; color: var(--orange-500); }
.pm-acc--teachers summary { color: var(--ink); }
.pm-acc-body { margin-top: 8px; font-size: 14px; line-height: 24px; letter-spacing: -0.02em; }
.pm-acc-body p { margin: 0 0 24px; }
.pm-acc-body > :last-child { margin-bottom: 0; }
.pm-acc-body a:not(.tl-link):not(.as-link) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pm-acc-body a:not(.tl-link):not(.as-link):hover { color: var(--neutral-600); }
.pm-acc--teachers p { margin: 0; }
.pm-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pm-tags li { padding: 3px 8px; border: 1px solid var(--neutral-500); border-radius: 30px; font-size: 12px; line-height: 18px; letter-spacing: 0; color: var(--ink); }

/* explore other poems: four timeline cards */
.pm-more { padding: 32px 0 56px; border-top: 1px solid var(--neutral-200); }
.pm-more summary { padding: 0 40px; font-weight: 700; font-size: 16px; line-height: 24px; color: var(--ink); }
.pm-more .pm-acc-body { margin-top: 24px; }
.pm-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 15px 8px 0; list-style: none; }

@media (min-width: 700px) {
  .pm-acc > summary { pointer-events: none; }
}
@media (max-width: 1099px) {
  .pm-poem { padding: 48px 32px; }
  .pm-car-btn--prev { left: 8px; }
  .pm-car-btn--next { right: 8px; }
}
/* phones: one column; notes and "Explore other poems" become accordions (Figma: FAQ / Closed, Opened) */
@media (max-width: 699px) {
  .pm-head { grid-template-columns: minmax(0, 1fr) minmax(0, 120px) minmax(0, 1fr); gap: 8px; padding: 30px 8px; }
  .pm-poet { min-width: 0; }
  .pm-nav { gap: 6px; }
  .pm-nav-text { overflow-wrap: anywhere; }
  .pm-body { flex-direction: column; gap: 8px; padding: 8px 8px 0; }
  .pm-poem { padding: 48px 24px; }
  .pm-res-row { gap: 24px; }
  .pm-res-img { width: 96px; height: 96px; }
  .pm-side { flex: none; gap: 0; margin: 0 -8px; }
  .pm-acc--teachers, .pm-info { padding: 0; border: 0; border-radius: 0; background: none; gap: 0; }
  .pm-more { padding: 0 0 24px; border-top: 0; }
  .pm-acc { border-bottom: 1px solid var(--orange-500); }
  .pm-acc > summary, .pm-side summary, .pm-more summary { position: relative; padding: 24px 56px 24px 24px; font-weight: 700; font-size: 16px; line-height: 24px; letter-spacing: 0; color: var(--ink); cursor: pointer; }
  .pm-acc > summary::after { content: ""; position: absolute; right: 24px; top: 28px; width: 16px; height: 16px; background: var(--orange-500); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 2h2v5h5v2H9v5H7V9H2V7h5z'/%3E%3C/svg%3E") center / 16px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 2h2v5h5v2H9v5H7V9H2V7h5z'/%3E%3C/svg%3E") center / 16px no-repeat; }
  .pm-acc[open] > summary { color: var(--orange-600); font-weight: 800; }
  .pm-acc[open] > summary::after { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 7h12v2H2z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 7h12v2H2z'/%3E%3C/svg%3E"); }
  .pm-acc > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  .pm-acc-body { margin: 0; padding: 0 24px 24px; font-size: 16px; line-height: 24px; letter-spacing: 0; color: var(--ink); }
  .pm-more .pm-acc-body { margin: 0; }
  .pm-cards { flex-direction: column; align-items: center; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-overlay.is-entering .pm-panel, .pm-content.is-swapping { animation: none; }
  .pm-overlay.is-leaving .pm-panel, .tl > :not(.pm-overlay), .pm-nav svg, .pm-video-play img { transition: none; }
}
/* printing an open poem prints just the poem */
@media print {
  html.pm-lock body * { visibility: hidden; }
  html.pm-lock .pm-panel, html.pm-lock .pm-panel * { visibility: visible; }
  html.pm-lock .pm-overlay { position: absolute; inset: 0; overflow: visible; padding: 0; }
  html.pm-lock .pm-panel { box-shadow: none; border-radius: 0; animation: none; }
  .pm-nav, .pm-close, .pm-print, .pm-tools, .pm-perf, .pm-res, .pm-side, .pm-more { display: none !important; }
}
