/* Pencil Box media players, for the Department site: the provenance label, audio and video players and the product gallery.
   Copied from the Pencil Box guide (hiaaronadams/doibrand, assets/pencil-box.css: "Provenance label", "Media players" and
   "Product gallery") so the older pinned pencil-box.css next to it does not have to change. Loaded only on pages that
   have a player (see inc/pencil-box-media.php). To update, copy those sections again. */
:root { --radius-sm: 5px; --radius-md: 12px; --radius-lg: 16px; }

/* ---------- Provenance label ----------
   Says a photo, video or recording was made by people and not generated by AI.
   Sits beside a caption or source line, or over the media itself (--media).
   --mark is the mark alone, for tight spaces: give it role="img" and an aria-label. */
.doi-provenance {
  --doi-provenance-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.75' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3Cpath d='M5 8.3l2.2 2.2L11 5.8' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='square'/%3E%3C/svg%3E");
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 var(--border-width-1) var(--color-border-default);
  font: var(--text-label-s);
  white-space: nowrap;
}
.doi-provenance::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--doi-provenance-mark) center / contain no-repeat;
  mask: var(--doi-provenance-mark) center / contain no-repeat;
}
.doi-provenance--media { background: var(--color-bg-inverse); color: var(--color-text-inverse); box-shadow: none; }
.doi-provenance--mark { gap: 0; padding: var(--space-4); }

/* Provenance label, animated in (for video and for the first time it appears).
   The mark scales up from nothing with an elastic overshoot; then the rest of the
   chip and its text open out from behind it, a mask wiping left to right.
   Add --animate; remove and add it again to replay. Off under prefers-reduced-motion.
   For footage, the same animation is rendered with a transparent background in assets/provenance/. */
@keyframes doi-provenance-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes doi-provenance-mark {
  0%   { transform: scale(0); }
  34%  { transform: scale(1.28); }
  54%  { transform: scale(0.88); }
  72%  { transform: scale(1.07); }
  88%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}
@keyframes doi-provenance-open {
  from { clip-path: inset(0 calc(100% - 30px) 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
.doi-provenance--animate {
  animation: doi-provenance-in 120ms linear both, doi-provenance-open 560ms var(--ease-out) 640ms both;
}
.doi-provenance--animate::before {
  transform-origin: center;
  animation: doi-provenance-mark 720ms cubic-bezier(0.25, 0.6, 0.35, 1) both;
}
.doi-provenance--mark.doi-provenance--animate { animation: doi-provenance-in 120ms linear both; }
@media (prefers-reduced-motion: reduce) {
  .doi-provenance--animate, .doi-provenance--animate::before { animation: none; }
}

/* Visually hidden text for screen readers */
.doi-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }


/* Visually hidden text for screen readers */
.doi-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Media players ----------
   Audio and video, wired up by assets/pencil-box.js. The one soft corner of Pencil Box: players are
   handled for minutes at a time, so they sit in a rounded, slightly lifted panel with quiet translucent
   controls, light type and tabular times. The audio waveform shows the whole track dim; what has played
   turns Beaurocracy Blue (Safety Yellow on the Blue theme), led by a vertical line with a soft glow.
   Video uses the same panel, with the picture at the top and the controls on their own rows below it. */
.doi-audio, .doi-video {
  --doi-media-played: var(--color-blue-100);
  --doi-media-rest: var(--color-text-primary);
  --doi-media-soft: color-mix(in srgb, var(--color-text-primary) 7%, transparent);
  --doi-media-softer: color-mix(in srgb, var(--color-text-primary) 12%, transparent);
  display: grid;
  gap: var(--space-16);
  box-sizing: border-box;
  width: 100%;
  max-width: 720px;
  padding: var(--space-24) 28px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-text-primary) 4%, var(--color-bg-page));
  box-shadow: inset 0 0 0 var(--border-width-1) color-mix(in srgb, var(--color-text-primary) 10%, transparent);
  color: var(--color-text-primary);
  container-type: inline-size;
}
.doi-audio audio { display: none; }
/* the video's panel is the audio player's; only the picture and the scrubber differ (below) */
.doi-audio-row { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
/* In a narrow player the title takes its own line above the buttons */
@container (max-width: 400px) {
  .doi-audio-row { flex-wrap: wrap; }
  .doi-audio .doi-audio-meta { order: -2; flex: 1 0 calc(100% - 56px); margin: 0 0 var(--space-12); }
  .doi-audio-row .doi-media-cc { order: -1; align-self: flex-start; }
}
.doi-media-btn, .doi-media-play {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; margin: 0;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-secondary);
  font-family: var(--font-text); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
.doi-media-btn:hover { background: var(--doi-media-soft); color: var(--color-text-primary); }
.doi-media-play { width: 52px; height: 52px; border-radius: var(--radius-md); background: var(--doi-media-soft); color: var(--color-text-primary); }
.doi-media-play:hover { background: var(--doi-media-softer); }
.doi-media-play:active { background: var(--doi-media-softer); transform: scale(0.97); }
.doi-media-btn svg { width: 22px; height: 22px; fill: currentColor; }
.doi-media-play svg { width: 20px; height: 20px; fill: currentColor; }
.doi-media-btn:focus-visible, .doi-media-play:focus-visible, .doi-audio-wave:focus-visible, .doi-video-track:focus-visible {
  outline: var(--border-width-2) solid var(--color-border-focus); outline-offset: 2px;
}
.doi-audio-meta { display: grid; gap: 2px; min-width: 0; margin-left: var(--space-16); }
.doi-audio-kicker { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-text); font-size: 13px; letter-spacing: 0.01em; color: var(--color-text-muted); }
.doi-audio-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-text); font-size: 21px; font-weight: 400; line-height: 1.25; letter-spacing: -0.005em; }

/* The waveform is the scrubber: the whole track dim, the part heard in the link color, a slider for the keyboard */
.doi-audio-wave {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  cursor: pointer; touch-action: none;
}
.doi-audio-wave i {
  flex: none; width: 2px; height: max(3px, var(--h, 50%)); border-radius: 2px;
  background: var(--doi-media-rest);
  opacity: 0.22;
  transition: opacity var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.doi-audio-wave:hover i:not(.is-played) { opacity: 0.32; }
.doi-audio-wave i.is-played { background: var(--doi-media-played); opacity: 1; }
/* now: a vertical line in Beaurocracy Blue with a soft glow */
.doi-audio-head {
  position: absolute; top: -6px; bottom: -6px; left: var(--at, 0%);
  width: 2px; margin-left: -1px; border-radius: 2px;
  background: var(--doi-media-played);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--doi-media-played) 70%, transparent), 0 0 26px 6px color-mix(in srgb, var(--doi-media-played) 35%, transparent);
  pointer-events: none;
}
/* Blue would vanish on the Blue theme: there the played part is Safety Yellow */
[data-theme="blue"] :is(.doi-audio, .doi-video) { --doi-media-played: var(--color-yellow-100); }
.doi-media-time { display: flex; justify-content: space-between; font-family: var(--font-text); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
/* Captions: a CC toggle at the end of the row, and the current line under the times */
.doi-media-cc { width: auto; height: 28px; padding: 0 var(--space-8); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 var(--border-width-1) var(--doi-media-softer); }
.doi-audio-row .doi-media-cc { margin-left: auto; }
.doi-media-cc[aria-pressed="true"] { background: var(--doi-media-softer); color: var(--color-text-primary); box-shadow: none; }
.doi-audio-caption {
  --cap-h: 4.2em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  margin: calc(-1 * var(--space-16)) 0 0; max-width: none;
  /* closed until the first line arrives, then it slides open to a fixed height and stays there,
     so a wrapping cue never changes the player's size or moves anything around it */
  height: 0; overflow: hidden; opacity: 0;
  font-family: var(--font-text); font-size: 17px; line-height: 1.4; color: var(--color-text-secondary);
  transition: height var(--dur-base) var(--ease-out), margin-top var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
@container (min-width: 400px) { .doi-audio-caption { --cap-h: 2.8em; -webkit-line-clamp: 2; } }
.doi-audio.has-captions.is-captioning .doi-audio-caption { height: var(--cap-h); margin-top: 0; opacity: 1; }

/* Video: the same panel as the audio player, the picture at the top and the controls on their own rows below */
.doi-video { max-width: 960px; }
.doi-video-frame { position: relative; display: block; overflow: hidden; border-radius: var(--radius-md); background: var(--color-black-100); }
.doi-video video { display: block; width: 100%; height: auto; background: var(--color-black-100); cursor: pointer; }
.doi-video video::cue { font-family: var(--font-text); background: rgb(0 0 0 / 0.6); color: var(--color-manila-100); }
/* Human made label, over the picture. Hidden until the first play when it animates in. */
.doi-video-frame > .doi-provenance { position: absolute; right: var(--space-12); bottom: var(--space-12); z-index: 1; pointer-events: none;
  transform: scale(0.75); transform-origin: right bottom; --doi-provenance-opacity: 0.55; opacity: var(--doi-provenance-opacity); }
.doi-video-frame > .doi-provenance[hidden] { display: none; }
.doi-video-frame:fullscreen { display: grid; place-items: center; border-radius: 0; background: #000; }
.doi-video-frame:fullscreen video { max-height: 100vh; }
.doi-video .doi-audio-row { margin-top: var(--space-4); }
.doi-media-tools { display: flex; align-items: center; gap: var(--space-4); margin-left: auto; padding-left: var(--space-8); }
.doi-video .doi-media-cc { margin-left: 0; }
/* the scrubber: a slim rounded line, the played part Beaurocracy Blue, now a glowing line */
.doi-video-track { position: relative; height: 24px; cursor: pointer; touch-action: none; }
.doi-video-track::before, .doi-video-fill { content: ""; position: absolute; left: 0; top: 10px; height: 4px; border-radius: 4px; }
.doi-video-track::before { right: 0; background: var(--doi-media-rest); opacity: 0.18; }
.doi-video-fill { width: var(--at, 0%); background: var(--doi-media-played); }
.doi-video-track .doi-audio-head { top: 2px; bottom: 2px; }
.doi-video-track:hover::before { opacity: 0.28; }
@container (max-width: 400px) {
  .doi-video .doi-audio-row { flex-wrap: wrap; }
  .doi-video .doi-audio-meta { order: -2; flex: 1 0 100%; margin: 0 0 var(--space-8); }
}

/* A video inside a gallery is a perfect square like the pictures: the picture fills it and a slim control strip
   (play, title, CC, sound, full screen, scrubber, times) sits over the bottom on a soft shade. */
.doi-gallery-track { overflow-y: hidden; }
.doi-gallery-slide > .doi-video {
  display: grid; grid-template-rows: 1fr auto auto auto; gap: 0; align-self: stretch;
  position: relative; max-width: none; aspect-ratio: 1; padding: 0; overflow: hidden;
  border-radius: 0; background: var(--color-black-100); box-shadow: none; color: var(--color-manila-100);
  --doi-media-rest: var(--color-manila-100); --doi-media-softer: rgb(255 255 255 / 0.22); --doi-media-soft: rgb(255 255 255 / 0.14);
}
.doi-gallery-slide > .doi-video .doi-video-frame { grid-area: 1 / 1 / -1 / 2; position: absolute; inset: 0; border-radius: 0; }
.doi-gallery-slide > .doi-video video { width: 100%; height: 100%; object-fit: contain; }
.doi-gallery-slide > .doi-video .doi-video-frame::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; pointer-events: none;
  background: linear-gradient(to top, rgb(0 0 0 / 0.72), transparent); }
.doi-gallery-slide > .doi-video .doi-audio-row, .doi-gallery-slide > .doi-video .doi-video-track, .doi-gallery-slide > .doi-video .doi-media-time { position: relative; z-index: 2; margin-left: var(--space-16); margin-right: var(--space-16); }
.doi-gallery-slide > .doi-video .doi-audio-row { grid-row: 2; flex-wrap: nowrap; margin-top: 0; gap: var(--space-8); }
.doi-gallery-slide > .doi-video .doi-video-track { grid-row: 3; }
.doi-gallery-slide > .doi-video .doi-media-time { grid-row: 4; margin-bottom: var(--space-12); color: rgb(255 255 255 / 0.75); }
.doi-gallery-slide > .doi-video .doi-audio-row > .doi-media-btn { display: none; }
.doi-gallery-slide > .doi-video .doi-media-btn { color: rgb(255 255 255 / 0.85); }
.doi-gallery-slide > .doi-video .doi-media-btn:hover { color: #fff; }
.doi-gallery-slide > .doi-video .doi-media-play { width: 44px; height: 44px; }
.doi-gallery-slide > .doi-video .doi-audio-meta { order: 0; flex: 1 1 auto; margin: 0 0 0 var(--space-8); }
.doi-gallery-slide > .doi-video .doi-audio-kicker { display: none; }
.doi-gallery-slide > .doi-video .doi-audio-title { color: #fff; font-size: 15px; text-shadow: 0 1px 6px rgb(0 0 0 / 0.5); }
.doi-gallery-slide > .doi-video .doi-media-tools { padding-left: 0; }
.doi-gallery-slide > .doi-video .doi-video-frame > .doi-provenance { top: var(--space-12); bottom: auto; transform-origin: right top; }
.doi-gallery-slide > .doi-video .doi-audio-wave:focus-visible, .doi-gallery-slide > .doi-video .doi-video-track:focus-visible { outline-color: #fff; }

.doi-gallery-slide > .doi-video .doi-audio-row, .doi-gallery-slide > .doi-video .doi-video-track, .doi-gallery-slide > .doi-video .doi-media-time, .doi-gallery-slide > .doi-video .doi-video-frame::after {
  transition: opacity var(--dur-base) var(--ease-out); }
.doi-gallery-slide > .doi-video.is-idle .doi-audio-row, .doi-gallery-slide > .doi-video.is-idle .doi-video-track, .doi-gallery-slide > .doi-video.is-idle .doi-media-time { opacity: 0; pointer-events: none; }
.doi-gallery-slide > .doi-video.is-idle .doi-video-frame::after { opacity: 0; }
.doi-gallery-slide > .doi-video.is-idle video { cursor: none; }

/* ---------- Product gallery: big picture with arrows and swipe, thumbnails below with their own arrows ---------- */
.doi-gallery { --doi-gal-gap: var(--space-8); display: grid; gap: var(--doi-gal-gap); min-width: 0; }
.doi-gallery-stage { position: relative; }
.doi-gallery-track { display: flex; align-items: flex-start; transition: height var(--dur-base) var(--ease-out); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: var(--radius-md); }
.doi-gallery-track::-webkit-scrollbar, .doi-gallery-thumbs::-webkit-scrollbar { display: none; }
.doi-gallery-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: center; margin: 0; display: grid; align-items: start; align-self: flex-start; }
.doi-gallery-slide > img { display: block; width: 100%; height: auto; }
.doi-gallery-arrow { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--radius-sm); background: var(--color-bg-inverse); color: var(--color-text-inverse); opacity: 0.92;
  transition: background var(--dur-quick) var(--ease-out), opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out); }
.doi-gallery-arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.doi-gallery-arrow:hover { opacity: 1; }
.doi-gallery-arrow:active { transform: translateY(1px); }
.doi-gallery-arrow:focus-visible, .doi-gallery-thumb:focus-visible { outline: 2px solid var(--color-border-focus, currentColor); outline-offset: 2px; }
.doi-gallery-arrow[disabled] { opacity: 0; pointer-events: none; }
.doi-gallery-prev { left: var(--space-12); } .doi-gallery-next { right: var(--space-12); }
.doi-gallery-count { position: absolute; left: var(--space-12); top: var(--space-12); z-index: 2; font: var(--text-label-s); font-variant-numeric: tabular-nums;
  padding: 2px var(--space-8); border-radius: var(--radius-sm); background: var(--color-bg-inverse); color: var(--color-text-inverse); pointer-events: none; }
.doi-gallery-strip { position: relative; }
.doi-gallery-thumbs { display: flex; gap: var(--doi-gal-gap); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.doi-gallery-thumb { flex: 0 0 calc((100% - 3 * var(--doi-gal-gap)) / 4); aspect-ratio: 1; padding: 0; border: 0; cursor: pointer; overflow: hidden; scroll-snap-align: start;
  border-radius: var(--radius-sm); background: var(--color-black-100); opacity: 0.6; transition: opacity var(--dur-quick) var(--ease-out); }
.doi-gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.doi-gallery-thumb:hover { opacity: 0.85; }
.doi-gallery-thumb[aria-current="true"] { opacity: 1; box-shadow: inset 0 0 0 2px var(--color-text-primary); }
.doi-gallery-strip .doi-gallery-arrow { width: 32px; height: 32px; margin-top: -16px; }
.doi-gallery-strip .doi-gallery-arrow svg { width: 16px; height: 16px; }
.doi-gallery-strip .doi-gallery-prev { left: var(--space-4); } .doi-gallery-strip .doi-gallery-next { right: var(--space-4); }
@media (prefers-reduced-motion: reduce) { .doi-gallery-arrow, .doi-gallery-thumb { transition: none; } .doi-gallery-track, .doi-gallery-thumbs { scroll-behavior: auto; } .doi-gallery-track { transition: none; } }


@media (prefers-reduced-motion: reduce) {
  .doi-media-btn, .doi-media-play, .doi-audio-wave i, .doi-audio-caption, .doi-gallery-slide > .doi-video .doi-audio-row, .doi-gallery-slide > .doi-video .doi-video-track, .doi-gallery-slide > .doi-video .doi-media-time, .doi-gallery-slide > .doi-video .doi-video-frame::after { transition: none; }
  .doi-media-play:active { transform: none; }
}

/* Inputs and selection controls ease between states */
.doi-input, .doi-checkbox, .doi-radio, .doi-toggle { transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .doi-button, .doi-input, .doi-checkbox, .doi-radio, .doi-toggle, .doi-toggle::before { transition: none; }
  .doi-button:active:not(:disabled) { transform: none; }
}

/* room around a player inside post and page content */
.entry-content .doi-video, .entry-content .doi-audio, .entry-content .doi-gallery, .wp-block-post-content .doi-video, .wp-block-post-content .doi-audio { margin: 2em 0; }

/* A live stream (data-live): the waveform is a level meter, not a scrubber */
.doi-audio-wave--live { cursor: default; touch-action: auto; }
.doi-audio-wave--live i { transition: height 0.12s linear, opacity var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out); }
.doi-audio-wave--live:hover i:not(.is-played) { opacity: 0.22; }
.doi-media-live { display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; font-weight: 700; }
.doi-media-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.doi-audio--live.is-playing .doi-media-live { color: var(--color-red-100, #FF2576); }
.doi-audio--live.is-playing .doi-media-live::before { opacity: 1; animation: doi-live 1.6s ease-in-out infinite; }
.doi-audio--live.is-buffering .doi-media-live::after { content: '· tuning in'; text-transform: none; letter-spacing: 0; font-weight: 400; }
.doi-audio--live.is-error .doi-media-live::after { content: '· off the air'; text-transform: none; letter-spacing: 0; font-weight: 400; }
@keyframes doi-live { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .doi-audio--live.is-playing .doi-media-live::before { animation: none; } .doi-audio-wave--live i { transition: none; } }
