/*
 * The new room's reading (`?room=2`; js/room2-reading.js): ONE panel on every device (round two, 14). A
 * period, an open story and "N more stories" share its head row, its type and its sections. Wide, it is
 * the card beside the picture (where it sits: css/room2.css). Narrow, it is the same card under the
 * picture, and it rises over the picture when a story or the more list opens (.r2-risen, --r2-lift set
 * by the script), easing back on close. Colours are the site's tokens (css/site.css), day and night.
 */
.r2-reading {
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}
.r2-read { padding: 0 20px 28px; max-width: 640px; }
.r2-reading button { font: inherit; color: inherit; }

/* the head row: the kicker or the open story's pill; play's place and the close at the right. It stays in
   view while the reading scrolls (the card's own scroll when wide, the page's on a phone). */
.r2-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 10px 0 8px; margin: 0;
  background: var(--surface);
}
.r2-titles { flex: 1 1 auto; min-width: 0; }
.r2-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.r2-play-slot:empty { display: none; }
.r2-kicker { margin: 0; color: var(--muted); font-size: 15px; font-weight: 600; }
.r2-kick { white-space: nowrap; }   /* a date never breaks inside; the head wraps between the topic and the span */
.r2-title { margin: 4px 0 0; font-size: 23px; line-height: 1.22; font-weight: 700; letter-spacing: -0.01em; }
.r2-head .r2-title { margin: 0; font-size: inherit; line-height: 1; letter-spacing: 0; }
.r2-title:focus, .r2-title:focus-visible { outline: none; }   /* focus lands on the title so a screen reader starts there */
.r2-count { margin: 6px 0 0; }
.r2-text { margin: 12px 0 0; color: var(--soft); }
.r2-lead { margin: 10px 0 0; color: var(--text); font-weight: 600; }
.r2-quiet { margin: 14px 0 0; color: var(--muted); }
.r2-nothing { color: var(--text); }

.r2-close {
  flex: 0 0 auto; width: 44px; height: 44px; margin: 0 -6px 0 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  font-size: 26px !important; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.r2-close:hover { background: var(--surface-2); }

/* a story's name: the picture's pill (css/room2.css .r2-pill), in the story's colour (--c) */
.r2-spill {
  display: inline-flex; align-items: center; max-width: 100%;
  min-height: 32px; padding: 5px 13px; box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 16px;
  background: var(--bg);
  color: var(--c); font-weight: 650; font-size: 15px; line-height: 1.3;
}
.r2-spill.is-open { background: var(--c); color: var(--bg); border-color: var(--c); font-size: 16px; }
.r2-spill-label { min-width: 0; }
.r2-row:hover .r2-spill { border-color: var(--c); }

/* where it stands */
.r2-standing { margin: 14px 0 0; }
.r2-standing-when { margin: 0 0 2px; color: var(--muted); font-size: 15px; font-weight: 600; }
.r2-standing-text { margin: 0; }
/* a past frame's card: where it stands now, under the "As of" one, quieter (follow-up 2) */
.r2-standing-now { margin-top: 10px; padding-left: 10px; border-left: 2px solid var(--border); }
.r2-standing-now .r2-standing-when { font-size: 13.5px; }
.r2-standing-now .r2-standing-text { color: var(--muted); font-size: 15px; }
.r2-nothing-new { color: var(--muted); font-weight: 500; }

/* whole story, back to November (and the card's play where the room has no single play button) */
.r2-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.r2-act {
  min-height: 44px; padding: 0 18px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600 !important;
}
.r2-act:hover { background: var(--surface-2); }
.r2-act-main { background: var(--accent); border-color: var(--accent); color: var(--on-accent) !important; }
.r2-act-main:hover { background: var(--accent); filter: brightness(1.06); }
/* an open story's play sits first in this row (rule 20, Dec 3): the phone's one button, or the header's twin */
.r2-actions .r2-play.r2-off { display: none; }
/* one row of two at 390 px and in the wide panel: both at the play button's size, a little less padding */
.r2-actions:has(.r2-play) { gap: 8px; }
.r2-actions:has(.r2-play) .r2-act { padding: 0 14px; font-size: 14.5px; }
.r2-actions .r2-play { padding: 0 13px 0 11px; gap: 6px; font-size: 14.5px; font-weight: 600 !important; }

/* sections: a real heading and a clear break */
.r2-section { margin: 26px 0 0; padding: 16px 0 0; border-top: 6px solid var(--surface-2); }
.r2-section-title { margin: 0 0 4px; color: var(--text); font-size: 18px; font-weight: 700; letter-spacing: -0.005em; }
.r2-parts, .r2-stories, .r2-updates { list-style: none; margin: 0; padding: 0; }
.r2-parts > li, .r2-stories > li, .r2-updates > li { border-bottom: 1px solid var(--border); }
.r2-parts > li:last-child, .r2-stories > li:last-child, .r2-updates > li:last-child { border-bottom: 0; }

.r2-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; min-height: 44px;
  padding: 10px 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.r2-row:hover .r2-row-head, .r2-row:hover .r2-update-head { color: var(--accent); }
.r2-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.r2-row-date { color: var(--muted); font-size: 15px; font-weight: 600; }
.r2-row-head { font-weight: 600; line-height: 1.35; }
.r2-part .r2-row-head::after, .r2-update-go .r2-update-head::after { content: "\00a0›"; color: var(--faint); }

/* a story in a list: its pill, its standing line, its count in the period */
.r2-story { gap: 5px; padding: 12px 0; }
.r2-row-top { display: flex; align-items: center; min-width: 0; }
.r2-row-standing {
  color: var(--soft); font-size: 15px; line-height: 1.4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.r2-story .r2-row-count { color: var(--muted); font-size: 14px; }

/* a story's updates; the line between the unseen and the seen */
.r2-update { padding: 2px 0 12px; }
.r2-update-top { padding: 10px 0 0; }
.r2-update-head { margin: 0; font-weight: 700; line-height: 1.35; }
.r2-update-text { margin: 4px 0 0; color: var(--soft); }
.r2-updates > li.r2-divider {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0;
  color: var(--accent); font-size: 14px; font-weight: 700;
}
.r2-updates > li.r2-divider::before, .r2-updates > li.r2-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--accent); opacity: .5; }
.r2-updates > li.r2-divider::before { flex: 0 0 12px; }
.r2-updates > li:has(+ .r2-divider) { border-bottom: 0; }

/* articles one tap down */
.r2-articles { margin: 6px 0 0; }
.r2-articles-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 2px;
  border: 0; background: none; color: var(--accent) !important; font-weight: 600 !important; cursor: pointer;
}
.r2-chev { display: inline-block; transition: transform 0.15s ease; }
.r2-articles-toggle[aria-expanded="true"] .r2-chev { transform: rotate(90deg); }

/* a published year or month page (room2-reading.js pageLink, lookingBack): quiet links in the articles' look */
.r2-pagelinks { display: flex; flex-direction: column; align-items: flex-start; margin: 0; }
.r2-pagelink {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none;
  color: var(--accent) !important; font: inherit; font-weight: 600 !important; text-decoration: none; cursor: pointer; text-align: left;
}
.r2-pagelink:hover { text-decoration: underline; }
.r2-article-list { list-style: none; margin: 0 0 6px; padding: 0; border-top: 1px solid var(--border); }
.r2-article-list > li { border-bottom: 1px solid var(--border); }
.r2-article-list a {
  display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: 10px 0;
  color: var(--text); text-decoration: none;
}
.r2-article-list a:hover .r2-a-title { text-decoration: underline; }
.r2-a-title { line-height: 1.35; }
.r2-a-meta { color: var(--muted); font-size: 14.5px; }
.r2-article-list.loading .r2-blank { height: 64px; background: linear-gradient(var(--surface-2), var(--surface-2)) 0 12px / 70% 14px no-repeat; }

/* narrow: one card under the picture, always the same; it rises over the picture for a story or the more
   list and eases back. This replaces room2.css's `html.r2-open .r2-reading` sheet (the integrator removes
   that rule; until then these win by weight). */
@media (max-width: 699.98px) {
  html.room2 .r2-reading, html.room2.r2-open .r2-reading {
    position: relative; z-index: 3;
    margin-top: 0; border-top: 0;
    border-radius: 18px 18px 0 0;
    background: var(--surface);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
    min-height: 40vh;
    overflow: clip;            /* the rounded top clips the sticky head's corners; clip keeps sticky working */
    animation: none;
    transform: none;
    transition: margin-top .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s;
  }
  html.room2 .r2-reading.r2-risen, html.room2.r2-open .r2-reading.r2-risen {
    margin-top: calc(-1 * var(--r2-lift, 0px));
    min-height: 66vh;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, .14);
  }
  .r2-read { padding: 0 16px 28px; }
  /* a story or the more list: its pill and the close on the first line, play's one button under them, so
     the name is never squeezed into a column beside the button */
  .r2-read-story > .r2-head, .r2-read-more > .r2-head { flex-wrap: wrap; row-gap: 4px; }
  .r2-read-story > .r2-head > .r2-tools, .r2-read-more > .r2-head > .r2-tools { display: contents; }
  .r2-read-story > .r2-head .r2-close, .r2-read-more > .r2-head .r2-close { order: 2; }
  .r2-read-story > .r2-head .r2-play-slot, .r2-read-more > .r2-head .r2-play-slot { order: 3; flex: 1 0 100%; }
  html.room2[data-theme="dark"] .r2-reading { box-shadow: 0 -6px 20px rgba(0, 0, 0, .35); }
}

@media (min-width: 700px) {
  /* under the topic's name in weight (Dec 3, Mony: the eye goes the topic's name, the picture's biggest
     story, then the panel's headline): a step under the 23 px name */
  .r2-title { font-size: 20px; line-height: 1.25; font-weight: 650; }
  .r2-head .r2-title { font-size: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  .r2-chev { transition: none; }
  html.room2 .r2-reading, html.room2.r2-open .r2-reading { transition: none; }
}
.r2-more-list { margin-top: 10px; }

/* words for a screen reader only (a heading the header already shows) */
.r2-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.r2-title.r2-sr + .r2-section, .r2-title.r2-sr + .r2-lead { margin-top: 2px; }   /* no blank where the repeated title was */
