:root {
  --indigo: #2b1378;
  --indigo-deep: #1a0a4a;
  --violet: #4c1d95;
  --magenta: #c026d3;
  --magenta-hot: #e040fb;
  --lilac: #f4ecff;
  --lilac-strong: #e9d5ff;
  --cream: #faf7ff;
  --ink: #1c1230;
  --muted: #675a7a;
  --line: rgba(43, 19, 120, 0.12);
  --white: #ffffff;
  --shadow: 0 1px 2px rgba(43, 19, 120, 0.05), 0 16px 40px rgba(43, 19, 120, 0.08);
  --radius: 18px;
  --font: "Outfit", system-ui, sans-serif;
  --space: 1.25rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 50% -80px, rgba(192, 38, 211, 0.16), transparent 60%),
    radial-gradient(900px 380px at 100% 20%, rgba(43, 19, 120, 0.08), transparent 55%),
    var(--cream);
  line-height: 1.5;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
}

button,
input {
  font: inherit;
}

a {
  color: var(--violet);
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--indigo);
  color: var(--white);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  z-index: 10;
}

.skip-link:focus {
  top: 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.hero {
  width: 100%;
  max-width: min(980px, 100%);
  margin: 0 auto;
  padding: 0.85rem var(--space) 0.35rem;
}

.hero-frame {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 603 / 161;
  background: url("../images/homily_online_banner.jpg") center / contain no-repeat;
}

.site-main {
  width: min(1080px, 100%);
  max-width: 100vw;
  margin: 0 auto;
  padding: 2rem var(--space) 4rem;
  display: grid;
  gap: 2.5rem;
}

section {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.section-head h2 {
  min-width: 0;
}

#refresh-videos {
  flex-shrink: 0;
}

h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--indigo);
}

h2::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--magenta), var(--indigo));
}

.section-lede {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.suggest {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1.35rem;
  max-width: 100%;
}

.suggest label {
  display: block;
  font-weight: 600;
  color: var(--indigo);
  margin-bottom: 0.45rem;
}

.search-row {
  display: flex;
  gap: 0.6rem;
}

.search-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-row input:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(192, 38, 211, 0.18);
  background: var(--white);
}

.search-row button,
#refresh-videos {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--magenta) 0%, var(--indigo) 100%);
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.search-row button:hover,
#refresh-videos:hover {
  filter: brightness(1.06);
}

.search-row button:active,
#refresh-videos:active {
  transform: translateY(1px);
}

.search-row button:focus-visible,
#refresh-videos:focus-visible,
.search-row input:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

#refresh-videos {
  padding: 0.5rem 0.95rem;
  font-size: 0.92rem;
}

#refresh-videos[aria-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  max-width: 100%;
}

.video-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.video-thumb,
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--indigo-deep);
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.video-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.play-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--magenta-hot), var(--indigo));
  box-shadow: 0 10px 24px rgba(43, 19, 120, 0.35);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.play-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
}

.video-thumb:hover .play-btn,
.video-thumb:focus-visible .play-btn {
  transform: scale(1.06);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-meta {
  padding: 0.9rem 1rem 1.05rem;
}

.video-meta h3 {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.video-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.video-meta a {
  color: inherit;
  text-decoration: none;
}

.video-meta a:hover {
  color: var(--magenta);
}

.channel-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 0;
  padding: 0;
}

.channel-list li {
  background: var(--lilac);
  color: var(--indigo);
  border: 1px solid var(--lilac-strong);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.suggest p:first-of-type {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
}

.status {
  min-height: 1.25rem;
  margin: 0.7rem 0 0;
  font-size: 0.92rem;
}

.status.ok {
  color: #157a3a;
}

.status.err {
  color: #b42318;
}

.panel-status {
  grid-column: 1 / -1;
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--muted);
  text-align: center;
}

.video-card.skeleton {
  pointer-events: none;
}

.thumb-skel {
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, #efe7fb 25%, #f7f2ff 37%, #efe7fb 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.line {
  height: 0.85rem;
  margin: 0.85rem 1rem 0;
  border-radius: 999px;
  background: #efe7fb;
}

.line.short {
  width: 42%;
  margin-bottom: 1.1rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem var(--space) calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0.15rem 0;
}

.site-footer strong {
  color: var(--indigo);
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (min-width: 720px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h2 {
    font-size: 1.65rem;
  }

  .suggest {
    padding: 1.4rem 1.5rem 1.55rem;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  :root {
    --space: 1rem;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row button {
    width: 100%;
  }

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

  .hero-frame {
    background-size: 94% auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .thumb-skel,
  .search-row button,
  #refresh-videos,
  .play-btn {
    animation: none;
    transition: none;
  }
}

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