:root {
  --sv-bg: #ffffff;
  --sv-card: #fff;
  --sv-text: #151515;
  --sv-muted: #686861;
  --sv-line: rgba(20, 20, 20, 0.1);
  --sv-accent: #ff8800;
  --sv-ink: #10110d;
  --sv-soft: #f1f1f1;
  --sv-shadow: 0 24px 70px rgba(0, 0, 0, 0.09);
}

html[data-color-mode='dark'] {
  --sv-bg: #0d0e0c;
  --sv-card: #171816;
  --sv-text: #f5f4ef;
  --sv-muted: #d8d8d8;
  --sv-line: rgba(255, 255, 255, 0.1);
  --sv-soft: #20221e;
  --sv-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

.video-page {
  background: var(--sv-bg);
  color: var(--sv-text);
  min-height: 100vh;
  overflow: hidden;
}

.video-shell {
  width: min(1380px, calc(100% - 40px));
  margin: auto;
}

.video-hero {
  min-height: 580px;
  display: flex;
  align-items: center;
  position: relative;
  background: var(--sv-ink);
  color: #f7f7f2;
  overflow: hidden;
}

.hero-inner {
  position: relative;
  z-index: 2;
  padding: 100px 0 78px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  margin: 0 0 16px;
  text-transform: uppercase;
}

.video-hero h1 {
  font-size: clamp(3.4rem, 8vw, 7.8rem);
  line-height: 0.83;
  letter-spacing: -0.07em;
  margin: 0;
  max-width: 980px;
  font-weight: 700;
}

.video-hero h1 span {
  color: var(--sv-accent);
}

.hero-copy {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.6;
  max-width: 620px;
  color: #bdbeb6;
  margin: 30px 0;
}

.hero-search {
  height: 64px;
  max-width: 720px;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 20px;
  border-radius: 10px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
  transition:
    transform 0.25s,
    box-shadow 0.25s;
}

.hero-search:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.32);
}

.hero-search input {
  border: 0;
  outline: 0;
  flex: 1;
  font-size: 1rem;
  background-color: transparent;
}

.hero-search kbd {
  font: inherit;
  font-size: 0.72rem;
  background: #eee;
  padding: 5px 8px;
  border-radius: 7px;
  color: #666;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.7;
}

.orb-a {
  width: 420px;
  height: 420px;
  background: #16292c;
  right: -100px;
  top: -100px;
}

.orb-b {
  width: 280px;
  height: 280px;
  border: 1px solid #16292c;
  right: 17%;
  bottom: -150px;
}

.library-section {
  padding: 72px 0 110px;
}

.featured {
  margin-bottom: 80px;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  background: var(--sv-card);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: var(--sv-shadow);
  animation: rise 0.65s both;
}

.featured-media {
  position: relative;
  aspect-ratio: 16/9;
  min-height: 360px;
  background: #222;
  cursor: pointer;
}

.featured-media img,
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.featured-body {
  padding: clamp(28px, 4vw, 58px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-body h2 {
  font-size: clamp(2rem, 3.3vw, 4rem);
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 8px 0 18px;
}

.featured-body p {
  color: var(--sv-muted);
  line-height: 1.6;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-head h2 {
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  letter-spacing: -0.055em;
  margin: 0;
}

.result-count {
  color: var(--sv-muted);
}

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: auto;
  padding: 2px 0 18px;
  scrollbar-width: none;
}

.playlist-chips {
  display: contents;
}

.chip {
  border: 1px solid var(--sv-line);
  background: var(--sv-card);
  color: var(--sv-text);
  padding: 10px 16px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 650;
  transition: 0.2s ease;
}

.chip.active {
  background: var(--sv-text);
  color: var(--sv-bg);
  border-color: var(--sv-text);
}

.filter-trigger {
  margin-left: auto;
}

.filter-panel {
  background: var(--sv-card);
  border: 1px solid var(--sv-line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 28px;
  animation: panel 0.25s both;
}

.filter-panel[hidden] {
  display: none;
}

.filter-panel label {
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sv-muted);
  display: grid;
  gap: 7px;
  min-width: 160px;
}

.filter-panel select {
  background: var(--sv-soft);
  color: var(--sv-text);
  border: 0;
  border-radius: 11px;
  padding: 11px;
}

.text-btn {
  border: 0;
  background: none;
  color: var(--sv-text);
  text-decoration: underline;
  padding: 12px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px 20px;
}

.video-card {
  min-width: 0;
  animation: rise 0.5s both;
}

.video-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 5px;
  background: var(--sv-soft);
  position: relative;
  cursor: pointer;
}

.duration {
  position: absolute;
  right: 9px;
  bottom: 9px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
}

.video-meta {
  padding: 15px 3px 0;
}

.video-meta h3 {
  font-size: 1.08rem;
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.video-sub {
  font-size: 0.82rem;
  color: var(--sv-muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.card-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.icon-btn {
  color: var(--sv-text);
  transition: 0.2s;
  cursor: pointer;
}

.icon-btn i {
  font-size: 1.25rem;
}

.icon-btn.saved {
  background: var(--sv-text);
  color: var(--sv-bg);
}

.notes-toggle {
  border: 0;
  background: none;
  color: var(--sv-text);
  font-weight: 700;
  padding: 8px 0;
}

.loading-card {
  aspect-ratio: 1.35;
  background: linear-gradient(100deg, var(--sv-soft) 20%, var(--sv-card) 45%, var(--sv-soft) 70%);
  background-size: 300% 100%;
  border-radius: 18px;
  animation: shimmer 1.3s infinite;
}

.empty-state {
  text-align: center;
  padding: 90px 20px;
  color: var(--sv-muted);
}

.empty-state i {
  font-size: 2rem;
}

.watch-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.watch-modal.open {
  display: block;
}

.watch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  animation: fade 0.18s ease both;
}

.watch-sheet {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(960px, 100%);
  background: var(--sv-bg);
  color: var(--sv-text);
  overflow: auto;
  padding: 64px clamp(18px, 4vw, 52px);
  animation: sheet 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.watch-close {
  position: absolute;
  right: 22px;
  top: 20px;
  border: 0;
  background: var(--sv-soft);
  color: var(--sv-text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  z-index: 2;
}

.player {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
}

.player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.watch-title {
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.05em;
  line-height: 1;
  margin: 28px 0 10px;
}

.watch-actions {
  display: flex;
  gap: 9px;
  margin: 20px 0 36px;
}

.action-pill {
  border: 1px solid var(--sv-line);
  background: var(--sv-card);
  color: var(--sv-text);
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 700;
}

.notes-panel {
  border-top: 1px solid var(--sv-line);
  padding-top: 30px;
}

.notes-panel h3 {
  font-size: 1.7rem;
}

.note-main {
  font-size: 1.15rem;
  line-height: 1.7;
}

.note-section {
  margin: 30px 0;
}

.note-section h4 {
  font-size: 1.15rem;
}

.note-section p,
.note-section li {
  line-height: 1.75;
  color: var(--sv-muted);
}

.tag {
  display: inline-block;
  background: var(--sv-soft);
  padding: 7px 10px;
  border-radius: 999px;
  margin: 3px;
  font-size: 0.8rem;
}

.toast-msg {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: var(--sv-text);
  color: var(--sv-bg);
  padding: 11px 16px;
  border-radius: 999px;
  z-index: 10001;
  transition: 0.25s;
}

.toast-msg.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 22px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes panel {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shimmer {
  to {
    background-position: -150% 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes sheet {
  from {
    transform: translateX(100%);
  }

  to {
    transform: none;
  }
}

@media (max-width: 900px) {
  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-media {
    min-height: 0;
  }

  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-panel {
    flex-wrap: wrap;
  }

  .filter-trigger {
    margin-left: 0;
  }
  .icon-btn i {
  font-size: 1.50rem;
}
}

@media (max-width: 600px) {
  .video-shell {
    width: min(100% - 28px, 1380px);
  }

  .video-hero {
    min-height: 520px;
  }

  .hero-inner {
    padding: 80px 0 60px;
  }

  .library-section {
    padding-top: 42px;
  }

  .featured {
    margin-bottom: 56px;
  }

  .featured-card {
    border-radius: 20px;
  }

  .featured-body {
    padding: 25px;
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .video-thumb {
    border-radius: 15px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .filter-panel {
    display: grid;
  }

  .filter-panel label {
    min-width: 0;
  }

  .watch-sheet {
    padding-top: 72px;
  }

  .player {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 2026-09 UI refinements */
.featured {
  margin-top: 0;
}

.video-card {
  position: relative;
  z-index: 0;
}

.featured-media img,
.video-thumb img {
  transition: none;
}

.video-meta,
.video-meta *,
.card-actions,
.card-actions * {
  transform: none !important;
}

.filters {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x;
  padding-bottom: 18px;
}

.filters.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.filters.is-dragging * {
  pointer-events: none;
}

.playlist-chips {
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}

.filter-trigger {
  flex: 0 0 auto;
}

/* Large screens: centered lightbox instead of a side drawer. */
@media (min-width: 701px) {
  .watch-modal.open {
    display: grid;
    place-items: center;
    padding: 34px;
  }

  .watch-sheet {
    position: relative;
    right: auto;
    top: auto;
    height: min(90vh, 980px);
    width: min(980px, calc(100vw - 68px));
    border-radius: 26px;
    padding: 58px clamp(24px, 4vw, 48px) 44px;
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.48);
    animation: lightboxIn 0.4s ease both;
  }

  .watch-close {
    right: 18px;
    top: 16px;
  }
}

/* Small screens: bottom sheet that rises from the bottom. */
@media (max-width: 700px) {
  .watch-modal.open {
    display: block;
  }

  .watch-sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(98dvh, 920px);
    border-radius: 24px 24px 0 0;
    padding: 58px 16px 34px;
    animation: bottomSheetIn 0.4s ease both;
    overscroll-behavior: contain;
  }

  .watch-close {
    top: 10px;
    right: 12px;
  }

  .player {
    border-radius: 14px;
  }

  .watch-title {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .watch-actions {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .watch-actions::-webkit-scrollbar {
    display: none;
  }

  .action-pill {
    flex: 0 0 auto;
  }

  .library-section {
    padding-top: 24px;
  }

  .featured {
    margin-bottom: 48px;
  }

  .library-search {
    margin-bottom: 22px;
  }
}

@keyframes lightboxIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.975);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes bottomSheetIn {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

/* Intentional hover zones only */
.video-thumb {
  transform-origin: center;
  transition:
    transform 1s cubic-bezier(0.2, 0.75, 0.25, 1),
    box-shadow 0.26s ease;
  z-index: 1;
}

.video-thumb:hover {
  transform: scale(1.015);
  z-index: 3;
}

.featured-card {
  transform-origin: center;
  transition:
    transform 1s cubic-bezier(0.2, 0.75, 0.25, 1),
    box-shadow 0.28s ease;
}

.featured-card.featured-hover {
  transform: scale(1.015);
  box-shadow: 0 30px 86px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 3;
}

/* With the description removed, keep the featured copy compact and centered. */
.featured-body {
  min-width: 0;
}

.featured-body h2 {
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* Ahava-style watch modal structure --------------------------------------- */
.watch-sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.watch-header {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--sv-line);
  /* Deliberately distinct from the modal body, like the Ahava header. */
  background: var(--sv-soft);
}

.watch-header-title {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 700;
  line-height: 1.2;
}

.watch-header .watch-close {
  position: static;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sv-text);
  display: grid;
  place-items: center;
}

.watch-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 30px clamp(18px, 4vw, 52px) 44px;
}

@media (min-width: 701px) {
  .watch-sheet {
    padding: 0;
  }

  .watch-header {
    padding: 14px 16px 14px 24px;
  }

  .watch-body {
    padding: 34px clamp(24px, 4vw, 48px) 44px;
  }
}

@media (max-width: 700px) {
  .watch-sheet {
    padding: 0;
  }

  .watch-header {
    min-height: 58px;
    padding: 9px 10px 9px 18px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 24px 24px 0 0;
  }

  .watch-header:active {
    cursor: grabbing;
  }

  .watch-body {
    padding: 18px 16px 34px;
  }
}

/* Full-bleed modal video: player touches the header and both modal edges. */
.watch-body {
  --watch-content-gutter: clamp(24px, 4vw, 48px);
  padding: 0 0 44px;
}

#watchContent > .player {
  width: 100%;
  margin: 0;
  border-radius: 0;
}

#watchContent > .player iframe,
#watchContent > .player img {
  border-radius: 0;
}

#watchContent > :not(.player) {
  margin-left: var(--watch-content-gutter);
  margin-right: var(--watch-content-gutter);
}

@media (max-width: 700px) {
  .watch-body {
    --watch-content-gutter: 16px;
    padding: 0 0 34px;
  }
}

/* Modal scrolling: vertical only, with the scrollbar visually hidden. */
.watch-sheet,
.watch-body,
#watchContent {
  max-width: 100%;
  overflow-x: hidden;
}

.watch-body {
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.watch-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#watchContent {
  width: 100%;
}

/* Mobile sermon cards: full-bleed thumbnails, padded metadata */
@media (max-width: 600px) {
  .video-thumb {
    width: calc(100% + 28px);
    margin-left: -14px;
    margin-right: -14px;
    border-radius: 0;
  }

  .video-thumb img {
    border-radius: 0;
  }
}

/* Mobile loading thumbnails: match full-bleed sermon thumbnails */
@media (max-width: 600px) {
  .loading-card {
    width: calc(100% + 28px);
    margin-left: -14px;
    margin-right: -14px;
    border-radius: 0;
  }
}

/* Notes-only modal ------------------------------------------------------- */
.notes-only .watch-body {
  padding-top: 0;
}

.notes-only-panel {
  border-top: 0;
  padding: clamp(28px, 4vw, 46px) var(--watch-content-gutter) 8px;
  margin: 0 !important;
}

.notes-only-title {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
  margin: 0 0 18px;
}

.notes-tags {
  margin: 22px 0 6px;
}

.notes-only-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 14px;
  margin: 0 0 18px;
  background: var(--sv-bg);
}

.notes-only-actions .action-pill {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notes-only-actions .action-pill i {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 700px) {
  .notes-only-panel {
    padding: 24px 16px 8px;
  }

  .notes-only-actions {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Bookmark feedback must be immediate. Do not animate the saved-state change. */
.icon-btn.bookmark,
.icon-btn.bookmark i,
.bookmark.saved,
.bookmark.saved i {
  transition: none !important;
  animation: none !important;
}
