/* ============================================================
   STREAM
   ------------------------------------------------------------
   The hero and the player in it are unchanged -- same layout,
   same blurred background, same loader and error overlay.

   Everything below the player is rebuilt: the intro, the
   search and filter bar, the library grid and the pagination,
   on the same grid, gutter and type scale as the rest of the
   site.
   ============================================================ */

.video-stream {
  z-index: 0;
  /* Center the primary player in the hero, clear of the fixed header. */
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 15vh;
  box-sizing: border-box;
}

/* 1. Full-Viewport Background “Atmosphere” */
.video-section {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

/* Top-anchored, like every other page's hero. Scoped to `.video-stream`
   because global.css's `center` is shared with the homepage. */
.video-stream .video-background-container {
  background-position: center top;
}

/* 1. Make sure the bg-player container spans the full viewport */
.video-background-container,
.video-overlay.bg-player {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  width: 150%;
  height: 150%;
  transform: translate(-15%, -15%);
}

/* 2. Apply the blur + darken filter to the container */
.video-overlay.bg-player {
  filter: blur(50px) brightness(0.5);
  pointer-events: none;
}

/* 2. Primary “Control” Player */
.main-player-container {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  width: 100%;
  max-width: 60vw;
  /* Never taller than the hero area left under the header, so it can't be clipped. */
  max-height: calc(100dvh - 22vh);
  aspect-ratio: 16/9;
  flex: 0 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 1rem;
  overflow: hidden;
  background: #000;
}

.main-player {
  width: 100%;
  height: 100%;
}

/* Video Loader Overlay */
.video-loader-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-loader-overlay.active {
  opacity: 1;
}

.video-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ff820d;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#error-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: 'Sofia Pro', sans-serif;
  font-size: 1rem;
}

#error-overlay button {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  background: #444;
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
}

/* ============================================================
   Below the player
   ============================================================ */
.stream-about,
.lib {
  --st-ink: #fff;
  --st-paper: #121212;
  --st-accent: #ff820d;
  --st-muted: rgba(255, 255, 255, 0.62);
  --st-rule: rgba(255, 255, 255, 0.22);
  --st-rule-strong: #fff;

  --st-gutter: clamp(1.25rem, 5vw, 6rem);
  --st-max: 1440px;

  font-family: 'Sofia Pro', sans-serif;
}

.stream-about *,
.lib *,
.lib *::before,
.lib *::after {
  box-sizing: border-box;       /* preflight is off in this project */
}

/* ------------------------------------------------------------
   Intro

   The old rule was `font-size: 3vh` with `text-align: justify`,
   and its media queries set it to 4px under 1200 and 0px under
   768 -- so the paragraph explaining the ministry was unreadable
   on a tablet and literally invisible on a phone.
   ------------------------------------------------------------ */
.stream-about {
  width: 100%;
  background-color: var(--st-paper);
  color: var(--st-ink);
  padding: clamp(3rem, 6vw, 5rem) 0 0;
}

.stream-about__inner {
  max-width: var(--st-max);
  margin: 0 auto;
  padding-inline: var(--st-gutter);
  border-top: 2px solid var(--st-rule-strong);
  padding-top: clamp(0.9rem, 1.6vw, 1.25rem);
}

.stream-about__label {
  margin: 0 0 clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--st-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.stream-about__text {
  margin: 0;
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  font-weight: 300;
  line-height: 1.6;
  text-align: left;             /* was justified, which rivers at this measure */
  max-width: 72ch;
}

/* ------------------------------------------------------------
   Library
   ------------------------------------------------------------ */
.lib {
  width: 100%;
  background-color: var(--st-paper);
  color: var(--st-ink);
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(3.5rem, 7vw, 6rem);
}

.lib__inner {
  max-width: var(--st-max);
  margin: 0 auto;
  padding-inline: var(--st-gutter);
}

.lib__head {
  border-top: 2px solid var(--st-rule-strong);
  padding-top: clamp(0.9rem, 1.6vw, 1.25rem);
  margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
}

.lib__label {
  margin: 0 0 clamp(0.75rem, 1.5vw, 1rem);
  color: var(--st-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lib__title {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

/* ------------------------------------------------------------
   Search and filters

   One ruled row instead of a rounded, shadowed panel: the fields
   are underlines on the page's own ground, the way the contact
   form's are, and the actions finish the same line.
   ------------------------------------------------------------ */
.lib-filters {
  margin-bottom: clamp(2rem, 4vw, 3rem);
  padding-bottom: clamp(1rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--st-rule);
}

.lib-filters__label {
  margin: 0 0 clamp(1rem, 2vw, 1.5rem);
  color: var(--st-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lib-filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: clamp(1rem, 2.5vw, 2rem);
}

.lib-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 0 1 auto;
  min-width: 0;
}

/* Search earns the room; the dates and the page size only need their own. */
.lib-field--search {
  flex: 1 1 18rem;
}

.lib-field--limit {
  flex: 0 0 auto;
}

.lib-field label {
  color: var(--st-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lib-field input,
.lib-field select {
  width: 100%;
  margin: 0;
  padding: 0.6rem 0;

  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--st-rule);
  border-radius: 0;

  color: var(--st-ink);
  font-family: 'Sofia Pro', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  transition: border-color .15s ease;
}

.lib-field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 1.5rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff820d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
}

.lib-field select option {
  color: #1b1b1b;
}

.lib-field input::placeholder {
  color: var(--st-muted);
}

/* The rule thickens on focus and the padding gives back the pixel, so the
   row does not shift under the pointer. */
.lib-field input:focus,
.lib-field select:focus {
  outline: none;
  border-bottom-color: var(--st-accent);
  border-bottom-width: 2px;
  padding-bottom: calc(0.6rem - 1px);
}

/* The native date picker's icon is near-invisible on a dark ground. */
.lib-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.55;
  cursor: pointer;
}

.lib-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.lib-field input[type="search"]::-webkit-search-cancel-button {
  filter: invert(1);
  opacity: 0.55;
  cursor: pointer;
}

.lib-filters__actions {
  display: flex;
  gap: 0;
  flex: 0 0 auto;
}

.lib-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;

  background: transparent;
  border: 1px solid var(--st-rule-strong);
  border-radius: 0;
  color: var(--st-ink);

  font-family: 'Sofia Pro', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.lib-btn + .lib-btn {
  border-left: 0;
}

.lib-btn:hover {
  background: var(--st-ink);
  color: #000;
}

.lib-btn--primary {
  background: var(--st-accent);
  border-color: var(--st-accent);
  color: #000;
}

.lib-btn--primary:hover {
  filter: brightness(1.06);
  background: var(--st-accent);
  color: #000;
}

.lib-btn:focus-visible {
  outline: 2px solid var(--st-accent);
  outline-offset: 3px;
}

.lib-filters__count {
  margin: clamp(1rem, 2vw, 1.5rem) 0 0;
  color: var(--st-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   The grid

   Cards were rounded boxes with a drop shadow that scaled up 5%
   on hover -- which blurs the thumbnail and shoves its
   neighbours' hit areas around. The title sat on top of the
   image under a gradient, so a long one covered the picture it
   was describing. Title and date are under the image now, and
   the hover is colour and a rule.
   ------------------------------------------------------------ */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  column-gap: clamp(1rem, 2vw, 2rem);
  row-gap: clamp(2rem, 3.5vw, 3rem);
}

.lib-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 0;

  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.lib-card__frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1b1b1b;
  border-bottom: 2px solid transparent;
  transition: border-color .15s ease;
}

.lib-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.35);
  transition: filter .2s ease;
}

.lib-card__meta {
  display: block;
  margin-top: 0.85rem;
  color: var(--st-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.lib-card__title {
  display: block;
  margin-top: 0.5rem;
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--st-ink);
  transition: color .15s ease;

  /* Titles run long. Three lines, then an ellipsis, so one verbose title
     cannot make its row twice the height of the others. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-card:hover .lib-card__frame,
.lib-card:focus-visible .lib-card__frame {
  border-bottom-color: var(--st-accent);
}

.lib-card:hover .lib-card__frame img,
.lib-card:focus-visible .lib-card__frame img {
  filter: grayscale(0);
}

.lib-card:hover .lib-card__title,
.lib-card:focus-visible .lib-card__title {
  color: var(--st-accent);
}

.lib-card:focus-visible {
  outline: 2px solid var(--st-accent);
  outline-offset: 4px;
}

.lib-empty {
  grid-column: 1 / -1;
  padding: clamp(3rem, 6vw, 5rem) 0;
  color: var(--st-muted);
}

.lib-empty h3 {
  margin: 0 0 0.5rem;
  color: var(--st-ink);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lib-empty p {
  margin: 0;
  font-size: 1rem;
  font-weight: 300;
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */
.lib-pagination {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(1.25rem, 2.5vw, 1.75rem);
  border-top: 1px solid var(--st-rule);
}

.lib-page-btn {
  padding: 0.8rem 1.5rem;
  background: transparent;
  border: 1px solid var(--st-rule-strong);
  border-radius: 0;
  color: var(--st-ink);
  font-family: 'Sofia Pro', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.lib-page-btn:hover:not(:disabled) {
  background: var(--st-ink);
  color: #000;
}

.lib-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.lib-page-btn:focus-visible {
  outline: 2px solid var(--st-accent);
  outline-offset: 3px;
}

.lib-page-info {
  color: var(--st-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Archive notice
   ------------------------------------------------------------ */
#archive-notice {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border: 1px solid var(--st-rule);
  border-left: 2px solid var(--st-accent);
  background: rgba(255, 255, 255, 0.03);
}

#archive-notice h4 {
  margin: 0 0 0.5rem;
  color: var(--st-ink);
  font-family: 'Sofia Pro', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#archive-notice p {
  margin: 0;
  color: var(--st-muted);
  font-family: 'Sofia Pro', sans-serif;
  font-size: 0.9375rem;
  font-weight: 300;
  line-height: 1.55;
}

#archive-notice a {
  color: var(--st-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease;
}

#archive-notice a:hover {
  border-bottom-color: var(--st-accent);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .main-player-container {
    max-width: 80vw;
  }
}

@media (max-width: 768px) {
  .video-stream {
    padding-top: 12vh;
  }

  .main-player-container {
    max-width: 92vw;
  }

  .lib-grid {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}

@media (max-width: 620px) {

  .lib-filters__row {
    flex-direction: column;
    align-items: stretch;
  }

  /* `flex: 1 1 18rem` on the search field is a basis along the main axis --
     which is the HEIGHT once the row turns into a column. The field was
     rendering 288px tall, which is the "gap" between the search box and the
     dates. Stacked, every field sizes to its own content. */
  .lib-field,
  .lib-field--search,
  .lib-field--limit {
    flex: 0 0 auto;
  }

  .lib-filters__actions {
    margin-top: 0.5rem;
  }

  .lib-btn {
    flex: 1 1 0;
  }

  .lib-grid {
    grid-template-columns: 1fr;
  }

  .lib-pagination {
    flex-wrap: wrap;
  }

  .lib-page-btn {
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  .lib-card__frame,
  .lib-card__frame img,
  .lib-card__title,
  .lib-btn,
  .lib-page-btn,
  .lib-field input,
  .lib-field select,
  #archive-notice a {
    transition: none;
  }
}

/* ============================================================
   Library notice — shown once a visit

   The acknowledge button is the only way out, as specified: no
   close cross, no Escape, no dismiss on the backdrop.
   ============================================================ */
.stream-notice {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(0, 0, 0, 0.82);
  font-family: 'Sofia Pro', sans-serif;
}

.stream-notice__panel {
  box-sizing: border-box;
  width: 100%;
  max-width: 30rem;
  padding: clamp(1.75rem, 4vw, 2.5rem);

  background: #1b1b1b;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-top: 2px solid #ff820d;
  border-radius: 0;
  color: #fff;
}

.stream-notice__label {
  margin: 0 0 clamp(0.9rem, 2vw, 1.25rem);
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.stream-notice__title {
  margin: 0 0 clamp(0.75rem, 1.5vw, 1rem);
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stream-notice__text {
  margin: 0 0 clamp(1.5rem, 3vw, 2rem);
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}

.stream-notice__ack {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.95rem 2rem;

  background: #ff820d;
  border: 0;
  border-radius: 0;
  color: #000;

  font-family: 'Sofia Pro', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter .15s ease;
}

.stream-notice__ack:hover {
  filter: brightness(1.06);
}

.stream-notice__ack:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .stream-notice__ack {
    transition: none;
  }
}
