/* ============================================================
   Tidal Church — Live data UI (live banner + latest messages)
   Brand-consistent, self-scoped. Works in light & OS dark mode.
   ============================================================ */

/* ---- Live / Next-service banner ---- */
.live-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 20px; border-radius: 14px; text-decoration: none;
  background: #eef6f8; border: 1px solid #d7e6ec; color: #0a2540;
  margin-bottom: 40px; transition: box-shadow .2s ease, transform .15s ease;
}
.live-strip:hover { text-decoration: none; box-shadow: 0 10px 30px rgba(10,37,64,.12); transform: translateY(-1px); }
.live-strip .live-label { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: #0fa3a3; }
.live-strip .live-title { font-weight: 600; }
.live-strip .live-when { color: #5a6b78; font-size: .92rem; }
.live-strip .live-cta { margin-left: auto; font-weight: 700; color: #0fa3a3; white-space: nowrap; }
.live-strip--on { background: #fdecec; border-color: #f6c9c9; }
.live-strip--on strong { color: #d33; text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; }
.live-strip--on .live-cta { color: #d33; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #e11; box-shadow: 0 0 0 0 rgba(238,17,17,.5); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(238,17,17,.5); } 70% { box-shadow: 0 0 0 10px rgba(238,17,17,0); } 100% { box-shadow: 0 0 0 0 rgba(238,17,17,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---- Latest messages grid ---- */
.msg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 900px) { .msg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .msg-grid { grid-template-columns: 1fr; } }

.msg-card {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: #fff; border: 1px solid #e3e8ec; text-decoration: none; color: inherit;
  transition: box-shadow .2s ease, transform .15s ease, border-color .2s ease;
}
.msg-card:hover { text-decoration: none; box-shadow: 0 16px 40px rgba(10,37,64,.16); transform: translateY(-3px); border-color: #cfe0e6; }
.msg-card__thumb {
  position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, #0a4b74, #0fa3a3);
  display: grid; place-items: center; overflow: hidden;
}
.msg-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-card__type {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 4px 9px; border-radius: 999px;
}
.msg-card__play {
  position: absolute; z-index: 2; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.92); box-shadow: 0 6px 18px rgba(0,0,0,.28);
  opacity: 0; transform: scale(.8); transition: opacity .2s ease, transform .2s ease;
}
.msg-card__play::after { content: ""; position: absolute; top: 50%; left: 54%; transform: translate(-50%,-50%);
  border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #0a2540; }
.msg-card:hover .msg-card__play { opacity: 1; transform: scale(1); }
.msg-card__body { padding: 16px 18px 20px; }
.msg-card__series { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #0fa3a3; }
.msg-card__title { font-size: 1.02rem; line-height: 1.3; margin: 6px 0 0; color: #0a2540;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-card__meta { font-size: .88rem; color: #5a6b78; margin: 8px 0 0; }

@media (prefers-color-scheme: dark) {
  .live-strip { background: #12283a; border-color: #203645; color: #eaf3f9; }
  .live-strip .live-when { color: #9fb2c0; }
  .live-strip--on { background: #35191b; border-color: #5b2a2a; }
  .msg-card { background: #12283a; border-color: #203645; }
  .msg-card__title { color: #eaf3f9; }
  .msg-card__meta { color: #9fb2c0; }
  .msg-card__play { background: rgba(255,255,255,.92); }
}

/* ---- Featured-series "See more" link ---- */
.video-rail__more {
  display: inline-block; margin-top: 14px; font-weight: 700; font-size: .9rem;
  color: #fff; text-decoration: none; opacity: .9; transition: opacity .15s ease, transform .15s ease;
}
.video-rail__more:hover { text-decoration: none; opacity: 1; transform: translateX(3px); }

/* ---- Drive video lightbox ---- */
.dv-lightbox {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(2,12,20,.86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 24px; animation: dvFade .18s ease;
}
.dv-lightbox[hidden] { display: none; }
@keyframes dvFade { from { opacity: 0; } to { opacity: 1; } }
.dv-lightbox__frame { position: relative; width: min(1000px, 94vw); aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); background: #000; }
.dv-lightbox__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.dv-lightbox__close {
  position: absolute; top: 18px; right: 22px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; font-size: 26px; line-height: 1;
  transition: background .15s ease;
}
.dv-lightbox__close:hover { background: rgba(255,255,255,.26); }

/* ============================================================
   Homepage tiles grid (4×2) — managed from the dashboard
   ============================================================ */
.tiles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; width: 100%; }
@media (max-width: 900px) { .tiles-grid { grid-template-columns: repeat(2, 1fr); } }

.tile {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  display: block; text-decoration: none; isolation: isolate;
  background: linear-gradient(150deg, #0a2540, #0fa3a3);
  /* scroll-reveal resting state (JS toggles .is-in) */
  opacity: 0; transform: translateY(32px) scale(.98);
  transition: opacity .65s cubic-bezier(.2,.7,.2,1), transform .65s cubic-bezier(.2,.7,.2,1);
}
.tile.is-in { opacity: 1; transform: none; }
.tile:hover { z-index: 3; text-decoration: none; }
.tile__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  filter: grayscale(.55) brightness(.78);
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .4s ease;
}
.tile:hover .tile__img { transform: scale(1.09); filter: grayscale(0) brightness(1); }
.tile__scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(2,12,20,.4) 0%, rgba(2,12,20,.08) 60%, rgba(2,12,20,.12) 100%);
  transition: background .4s ease;
}
/* On hover: darken a touch so the revealed text stays readable */
.tile:hover .tile__scrim { background: linear-gradient(to top, rgba(2,12,20,.72) 0%, rgba(2,12,20,.5) 55%, rgba(2,12,20,.55) 100%); }
.tile__body {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center; padding: 20px; gap: 6px;
  /* hidden until hover */
  opacity: 0; transform: translateY(14px);
  transition: opacity .35s ease, transform .4s cubic-bezier(.2,.7,.2,1);
}
.tile:hover .tile__body { opacity: 1; transform: none; }
.tile__tag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.85); }
.tile__title {
  font-family: var(--font-head, "Montserrat", sans-serif); color: #fff; font-weight: 700;
  font-size: clamp(1.3rem, 2vw, 1.9rem); line-height: 1.08; letter-spacing: -.01em;
  text-shadow: 0 2px 18px rgba(0,0,0,.6);
}
/* Cross marker: the resting indicator; fades out as the text appears */
.tile__cross {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 16px; height: 16px; color: rgba(255,255,255,.7); transition: opacity .3s ease;
}
.tile:hover .tile__cross { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .tile { opacity: 1; transform: none; transition: none; }
  .tile__img, .tile__body { transition: none; }
}
/* Touch / mobile: there is no hover, so show text + full-colour image by default */
@media (hover: none), (max-width: 900px) {
  .tile { opacity: 1; transform: none; }         /* always visible (no scroll-reveal reliance) */
  .tile__body { opacity: 1; transform: none; }   /* title/tag always shown */
  .tile__img { filter: none; }                    /* full colour */
  .tile__scrim { background: linear-gradient(to top, rgba(2,12,20,.72) 0%, rgba(2,12,20,.32) 55%, rgba(2,12,20,.4) 100%); }
  .tile__cross { opacity: 0; }                     /* text shows, so hide the resting marker */
}

/* ---- Campus messages (Shediac / Miramichi campus pages) --------- */
.cmsg { display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px; align-items: start; }

.cmsg__feature {
  display: block; width: 100%; text-align: left; padding: 0;
  background: #fff; border: 1px solid #e4edf1; border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(10,37,64,.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
button.cmsg__feature { cursor: pointer; }
button.cmsg__feature:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(10,37,64,.16); border-color: #cfe0e6; }
.cmsg__feature:focus-visible { outline: 3px solid var(--accent, #12b5c7); outline-offset: 3px; }

/* ---- audio variant: banner + native player, no video-shaped frame ---- */
.cmsg__banner {
  position: relative; height: 132px; overflow: hidden; cursor: pointer;
  touch-action: none;                       /* drag to scrub, don't scroll the page */
  background: linear-gradient(135deg, var(--accent, #12b5c7) 0%, #0a2540 88%);
}
.cmsg__banner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 24% 22%, rgba(255,255,255,.24) 0%, transparent 58%);
}
.cmsg__banner:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

/* Two identical wave layers: the dim one is the track, the white one is the
   progress, revealed left-to-right by clipping. */
.cmsg__wavebase, .cmsg__waveon {
  position: absolute; left: 0; right: 0; bottom: 0; height: 72%;
  display: block; pointer-events: none;
}
.cmsg__wavebase .cmsg__wave, .cmsg__waveon .cmsg__wave { width: 100%; height: 100%; display: block; }
.cmsg__wavebase .cmsg__wave { fill: rgba(255,255,255,.26); }
.cmsg__waveon { clip-path: inset(0 100% 0 0); -webkit-clip-path: inset(0 100% 0 0); }
.cmsg__waveon .cmsg__wave { fill: #fff; }

.cmsg__head {
  position: absolute; top: 12%; bottom: 12%; left: 0; width: 2px; margin-left: -1px;
  background: #fff; border-radius: 2px; opacity: 0; pointer-events: none;
  box-shadow: 0 0 10px rgba(255,255,255,.75);
}
/* Player: dark pill, white controls, identical in light and dark mode. */
.cmsg__player {
  display: inline-flex; align-items: center; gap: 13px; margin-top: 18px;
  padding: 8px 20px 8px 8px; border-radius: 999px; background: #0f2a3d;
}
.cmsg__pp {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0;
  cursor: pointer; display: grid; place-items: center;
  background: rgba(255,255,255,.16); color: #fff;
  transition: background .15s ease, transform .12s ease;
}
.cmsg__pp:hover { background: rgba(255,255,255,.3); }
.cmsg__pp:active { transform: scale(.93); }
.cmsg__pp:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cmsg__pp svg { width: 17px; height: 17px; fill: #fff; display: block; }
.cmsg__player.is-playing .cmsg__pp { background: rgba(255,255,255,.28); }

.cmsg__time {
  flex: none; font-size: .84rem; font-weight: 600; color: #fff;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
@media (prefers-reduced-motion: reduce) {
  .cmsg__pp { transition: none; }
}

/* Audio messages have no Drive thumbnail (the <img> removes itself on error),
   so the campus-accent gradient below is what most cards actually show. */
.cmsg__thumb {
  position: relative; display: block; aspect-ratio: 2/1; overflow: hidden;
  background: linear-gradient(135deg, var(--accent, #12b5c7) 0%, #0a2540 78%);
}
.cmsg__thumb::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.22) 0%, transparent 55%);
}
.cmsg__thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.cmsg__type {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 4px 9px; border-radius: 5px; background: rgba(4,16,26,.72); color: #fff;
}
.cmsg__play {
  position: absolute; inset: 0; margin: auto; width: 62px; height: 62px; border-radius: 50%;
  background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(0,0,0,.3);
  transform: scale(.9); transition: transform .2s ease;
}
.cmsg__play::after {
  content: ""; position: absolute; top: 50%; left: 54%; transform: translate(-50%,-50%);
  border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #0a2540;
}
.cmsg__feature:hover .cmsg__play { transform: scale(1.06); }

.cmsg__body { display: block; padding: 20px 22px 24px; }
.cmsg__eyebrow {
  display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent, #0fa3a3);
}
.cmsg__title { display: block; font-size: 1.35rem; line-height: 1.25; margin: 8px 0 0; color: #0a2540; }
.cmsg__meta { display: block; font-size: .92rem; color: #5a6b78; margin-top: 8px; }
.cmsg__series {
  display: inline-block; margin-top: 12px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: #5a6b78;
  padding: 4px 9px; border: 1px solid #dbe6ec; border-radius: 5px;
}

.cmsg__panel { display: flex; flex-direction: column; gap: 14px; }
.cmsg__label {
  margin: 0; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: #5a6b78;
}
/* A fixed-column grid instead of flex-wrap: names are different lengths, so
   wrapping by cumulative item width left ragged rows (a name a bit longer
   pushes the next one to a new line early, even with room to spare) instead
   of the clean columns a name list should read as. */
.cmsg__speakers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
.cmsg__spk { display: flex; align-items: center; gap: 9px; min-width: 0; color: #0a2540; font-size: .92rem; font-weight: 600; }
.cmsg__spk:hover { text-decoration: none; color: var(--accent, #0fa3a3); }
.cmsg__spk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmsg__avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden;
  background: #dce8ee; display: grid; place-items: center; border: 1px solid #cfe0e6;
}
.cmsg__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmsg__initials { font-size: .78rem; font-weight: 700; color: #5a6b78; letter-spacing: .02em; }
.cmsg__more { align-self: start; margin-top: 6px; }

@media (max-width: 860px) {
  .cmsg { grid-template-columns: 1fr; gap: 22px; }
  .cmsg__title { font-size: 1.18rem; }
  .cmsg__more { align-self: stretch; text-align: center; }
}
@media (max-width: 420px) {
  /* Three columns leaves too little room for the name next to a 40px
     avatar once the panel is down to full phone width. */
  .cmsg__speakers { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-color-scheme: dark) {
  .cmsg__feature { background: #12283a; border-color: #203645; }
  .cmsg__feature:hover { border-color: #2c4a5e; }
  .cmsg__title { color: #eaf3f9; }
  .cmsg__meta { color: #9fb2c0; }
  .cmsg__series { color: #9fb2c0; border-color: #203645; }
  .cmsg__label { color: #9fb2c0; }
  .cmsg__spk { color: #eaf3f9; }
  .cmsg__avatar { background: #1b3547; border-color: #203645; }
  .cmsg__initials { color: #9fb2c0; }
}
