/* ==========================================================================
   TILES & GRIDS — the video library
   ========================================================================== */

/* Grid: 1 column → 2 at 640px → 3 at 1024px --------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  column-gap: var(--grid-col-gap);
  row-gap: var(--grid-row-gap);
}
@media (min-width: 640px)  { .grid { --cols: 2; } }
@media (min-width: 1024px) { .grid { --cols: 3; } }

/* Two columns + an odd number of videos would orphan the last tile, so on
   tablets the first (newest) tile spans both columns instead. */
@media (min-width: 640px) and (max-width: 1023px) {
  .grid:not(.grid--pair) > .tile:first-child:nth-last-child(2n + 3) { grid-column: 1 / -1; }
}

/* Homepage collections on phones show three, then "View all". */
@media (max-width: 639px) {
  .grid--home > :nth-child(n + 4) { display: none; }
}

/* Tile ------------------------------------------------------------------- */
.tile { position: relative; min-width: 0; }

.tile__link {
  display: block; color: inherit; text-decoration: none;
  border-radius: var(--radius);
}
.tile__link:focus-visible { outline-offset: 6px; }

.tile__media {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--soot);
  isolation: isolate;
}
.tile__media img,
.tile__media .art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  filter: brightness(0.9) saturate(0.95);
  transition: transform var(--dur-slow) var(--ease), filter var(--dur-slow) var(--ease);
}
/* hairline + warm light that fade in on hover / focus */
.tile__media::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(176 142 94 / 0);
  background: radial-gradient(120% 90% at 50% 110%, rgb(217 119 43 / 0.14), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}

.tile__play {
  position: absolute; right: 1rem; bottom: 1rem; z-index: 3;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgb(176 142 94 / 0.8);
  background: rgb(14 12 10 / 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--parchment);
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.tile__play svg { width: 13px; height: 13px; margin-left: 2px; }

.tile__body { padding-top: 1.1rem; transition: transform var(--dur-slow) var(--ease); }
.tile__title {
  font-size: var(--text-tile); font-weight: 300; line-height: 1.15;
  color: var(--parchment);
}
.tile__subtitle {
  margin-top: 0.35rem;
  font-family: var(--font-ui); font-size: var(--text-small); line-height: 1.45;
  color: var(--ash);
}
.tile__meta { margin-top: 0.6rem; }

.tile__link:hover .tile__media img,
.tile__link:hover .tile__media .art,
.tile__link:focus-visible .tile__media img,
.tile__link:focus-visible .tile__media .art { transform: scale(1.03); filter: brightness(1.02) saturate(1); }
.tile__link:hover .tile__media::after,
.tile__link:focus-visible .tile__media::after { opacity: 1; box-shadow: inset 0 0 0 1px rgb(176 142 94 / 0.45); }
.tile__link:hover .tile__play,
.tile__link:focus-visible .tile__play { opacity: 1; transform: none; }
.tile__link:hover .tile__body,
.tile__link:focus-visible .tile__body { transform: translateY(-3px); }

/* Touch screens have no hover: keep the play mark faintly visible. */
@media (hover: none) { .tile__play { opacity: 0.85; transform: none; } }

/* Tile in inline-playback mode (settings.playbackMode = "inline") */
.tile__media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 4; }
.tile--playing .tile__play { display: none; }

/* Artwork placeholder (used until a video has a real thumbnail) ------------ */
.art {
  --tone: var(--bronze);
  display: block;
  background:
    radial-gradient(70% 60% at 50% 108%, color-mix(in srgb, var(--tone) 75%, transparent) 0%, transparent 70%),
    radial-gradient(38% 36% at 50% 74%, color-mix(in srgb, var(--tone) 45%, transparent) 0%, transparent 100%),
    linear-gradient(180deg, #16120e 0%, #0d0b09 100%);
}
.art::before {  /* a quiet hearth arch */
  content: ""; position: absolute; left: 50%; bottom: 22%;
  width: 22%; aspect-ratio: 3 / 3.2; translate: -50% 0;
  border: 1px solid rgb(236 227 208 / 0.22); border-bottom: 0;
  border-radius: 999px 999px 0 0;
}
.art::after {   /* film grain */
  content: ""; position: absolute; inset: 0; opacity: 0.18; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.art__label {
  position: absolute; left: 1.1rem; top: 1rem; z-index: 1;
  font-family: var(--font-ui); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: rgb(236 227 208 / 0.55);
}

/* ==========================================================================
   COLLECTION LAYOUTS FOR 1 AND 2 VIDEOS (desktop only; stack below 1024px)
   ========================================================================== */

/* One video: the tile spans two columns, its details sit in the third. */
.feature { display: grid; gap: var(--space-5); }
.feature__text .label { display: block; margin-bottom: var(--space-4); }
.feature__title { font-size: var(--text-h2); font-weight: 300; line-height: 1.08; }
.feature__title a { text-decoration: none; }
.feature__title a:hover { text-decoration: underline; text-decoration-color: var(--bronze); }
.feature__subtitle { margin-top: var(--space-3); font-family: var(--font-ui); font-size: var(--text-small); color: var(--ash); }
.feature__desc { margin-top: var(--space-5); color: var(--ash); max-width: 34ch; }
.feature__cta { margin-top: var(--space-5); }

@media (min-width: 1024px) {
  .feature {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--grid-col-gap);
    align-items: end;
  }
  .feature > .tile { grid-column: span 2; }
  .feature > .tile .tile__body { display: none; }  /* details move to the side column */
  .feature__text { padding-bottom: var(--space-2); }
}
@media (max-width: 1023px) {
  .feature__text { display: none; }                 /* a plain tile below desktop */
}

/* Two videos: two tiles, the collection's short intro in the third column. */
.collection-note { color: var(--ash); font-style: italic; font-size: var(--text-lede); line-height: 1.4; }
.collection-note .text-link { margin-top: var(--space-4); font-style: normal; }

@media (min-width: 1024px) {
  .grid--pair .collection-note {
    align-self: center;
    padding-left: var(--space-6);
    border-left: 1px solid var(--line);
    max-width: 22rem;
  }
}
@media (max-width: 1023px) {
  .grid--pair .collection-note { display: none; }
}

/* ==========================================================================
   SEASON CARDS (Seasons page)
   ========================================================================== */
.season-grid {
  display: grid; gap: var(--grid-col-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.season-card { position: relative; display: block; text-decoration: none; color: inherit; border-radius: var(--radius); }
.season-card .tile__media { aspect-ratio: 4 / 5; }
.season-card .tile__media::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(0deg, rgb(14 12 10 / 0.85) 0%, rgb(14 12 10 / 0.1) 55%, transparent 100%);
}
.season-card__text { position: absolute; left: 1.5rem; right: 1.5rem; bottom: 1.4rem; z-index: 3; }
.season-card__name { font-size: 2.25rem; font-weight: 300; line-height: 1; }
.season-card__count { margin-top: var(--space-3); display: block; }
.season-card:hover img, .season-card:focus-visible img,
.season-card:hover .art, .season-card:focus-visible .art { transform: scale(1.03); filter: brightness(1.02); }
.season-card:hover .tile__media::after, .season-card:focus-visible .tile__media::after { opacity: 1; box-shadow: inset 0 0 0 1px rgb(176 142 94 / 0.45); }

.empty-note { color: var(--ash); font-style: italic; }
