/* Article pages only (see the extraHead in scripts/build-article-pages.js):
   the narration strip, the videos and the photos inside the text. Its own
   file, with its own ?v= (ARTICLE_MEDIA_VERSION), so changing it doesn't
   mean re-versioning styles.css across every hand-authored page too. */

/* ---- Narration strip - the app's audio strip (narration_strip.dart):
   play, a waveform that is the seek bar, the times, the speed turtle.
   Overrides the plain .audio-card in styles.css, which stays as it was
   for the native player readers without JS get (css/noscript-audio.css). */
.audio-card.audio-strip {
  display: block;
  padding: 10px 8px 10px 10px;
  border: 1px solid #ECE7E0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(27, 58, 92, 0.10);
}
/* The label is for screen readers (and js/word-follow.js's floating
   button, which borrows it); the strip itself says it visually. */
.audio-strip-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.audio-strip audio { display: none; }
.as-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.as-play {
  flex: none;
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: #1B3A5C;
  color: #fff;
  box-shadow: 0 3px 10px rgba(27, 58, 92, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
}
.as-play:active { transform: scale(0.94); }
.as-play svg { width: 28px; height: 28px; fill: currentColor; }
.as-play .as-icon-play { margin-left: 2px; }
.as-play .as-icon-pause,
.as-play .as-icon-replay { display: none; }
.audio-strip.is-playing .as-icon-play,
.audio-strip.is-ended .as-icon-play { display: none; }
.audio-strip.is-playing .as-icon-pause { display: block; }
.audio-strip.is-ended:not(.is-playing) .as-icon-replay { display: block; }
/* Waiting for the recording: a thin ring turns round the button. */
.audio-strip.is-loading .as-play::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #C8703C;
  animation: as-spin 0.9s linear infinite;
}
@keyframes as-spin { to { transform: rotate(360deg); } }

.as-track { flex: 1; min-width: 0; }
.as-wave {
  position: relative;
  height: 30px;
  cursor: pointer;
  /* A sideways drag seeks; up and down still scrolls the page. */
  touch-action: pan-y;
  border-radius: 6px;
}
.as-bars {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.as-bars i {
  flex: none;
  width: 3px;
  min-height: 3px;
  border-radius: 1.5px;
  background: #C9CED6;
}
.as-bars i.on { background: #1B3A5C; }
/* The playhead: a slim ochre line, wider while dragging. */
.as-head {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: #C8703C;
  opacity: 0;
  pointer-events: none;
}
.audio-strip.is-started .as-head { opacity: 1; }
.audio-strip.is-scrubbing .as-head { width: 3px; margin-left: -1.5px; }
.as-wave:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
.as-times {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #6B7280;
  font-variant-numeric: tabular-nums;
}

/* The speed turtle: 1x -> 0.85x -> 0.7x -> 1x, like the app's SpeedTurtle.
   When slowed, a navy ring and a small ochre tag with the speed. */
.as-speed {
  flex: none;
  position: relative;
  width: 42px;
  height: 42px;
  margin: 3px;
  padding: 0;
  border: 1.6px solid #F3ECE3;
  border-radius: 50%;
  background: #F3ECE3;
  color: #1B3A5C;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}
.as-speed svg { width: 28px; height: 28px; }
.as-speed.is-slow { border-color: #1B3A5C; }
.as-speed-tag {
  position: absolute;
  top: -6px;
  right: -9px;
  padding: 1.5px 5px;
  border: 1.5px solid #fff;
  border-radius: 8px;
  background: #C8703C;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  transform: scale(0);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.as-speed.is-slow .as-speed-tag { transform: scale(1); }
.as-play:focus-visible,
.as-speed:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
[dir="rtl"] .as-speed-tag { right: auto; left: -9px; }
@media (prefers-reduced-motion: reduce) {
  .as-speed-tag, .as-play { transition: none; }
  .audio-strip.is-loading .as-play::after { animation-duration: 2.5s; }
}

/* ---- Videos (renderVideo): a still with a play button until the reader
   asks for the video (js/article-media.js), then the YouTube player in the
   same box, so nothing moves. Rounded like the site's cards. ---- */
.article-video {
  margin: 1.4em 0 1.8em;
}
.article-video-hero { margin: 0 0 28px; }
.article-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--navy-deep);
  box-shadow: var(--shadow-sm);
}
/* An upright video (YouTube Shorts): 9:16, kept to a phone's width. */
.article-video.is-vertical .article-video-frame {
  aspect-ratio: 9 / 16;
  max-width: min(100%, 340px);
  margin: 0 auto;
}
.article-video-facade,
.article-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.article-video-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* A soft shade so the button reads on a bright still. */
.article-video-facade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(10, 18, 28, 0.32) 0%, rgba(10, 18, 28, 0.08) 45%, rgba(10, 18, 28, 0) 70%);
  pointer-events: none;
}
.article-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid var(--ochre);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(10, 18, 28, 0.35);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.article-video-play svg { width: 34px; height: 34px; fill: currentColor; margin-left: 4px; }
.article-video-facade:hover .article-video-play,
.article-video-facade:focus-visible .article-video-play { transform: scale(1.06); background: var(--navy-soft); }
.article-video-facade:focus-visible { outline: 3px solid var(--ochre); outline-offset: -3px; }
@media (max-width: 480px) {
  .article-video-play { width: 62px; height: 62px; margin: -31px 0 0 -31px; }
  .article-video-play svg { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .article-video-play { transition: none; }
}

/* The X post: X's own script draws it. Until then (or without JS) the
   blockquote is a plain card with the link to the post. */
.article-video-x .twitter-tweet:not(.twitter-tweet-rendered) {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}
.article-video-x .twitter-tweet-rendered { margin-left: auto !important; margin-right: auto !important; }

/* The line under every video: who posted it, and a link to the original. */
.article-video-caption {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--faint);
}
.article-video-caption a { color: var(--muted); text-decoration: none; }
.article-video-caption a:hover { text-decoration: underline; }
.article-video-provider {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--terra);
  margin-inline-end: 4px;
}

/* ---- Photos inside the text (renderInlinePhoto): 16:9, rounded, the
   credit line under it set like the top photo's (.article-hero-credit and
   .article-hero-caption in styles.css). ---- */
.article-inline-photo {
  margin: 1.4em 0 1.8em;
}
.article-inline-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: var(--cream);
}
.article-inline-photo figcaption {
  font-family: var(--font-sans);
  line-height: 1.45;
  padding-top: 8px;
}
/* On its own line here, a touch larger than the credit after it. */
.article-inline-photo .article-hero-caption {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
