/* =================================================================
   YouTube channel (youtube-channel.php)
   Load AFTER css/index.css (tokens, fonts, header, footer).
   ================================================================= */

/* -----------------------------------------------------------------
   HERO — the homepage hero with YouTube red as a second accent
   ----------------------------------------------------------------- */
.yt-hero {
  --orb-w: 360px;
  --orb-h: 270px;
  --orb-side: 8%;
  --orb-top: 50%;
  --orb-cx: calc(var(--orb-side) + var(--orb-w) / 2);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(3rem, 2rem + 5vw, 5.5rem) var(--gutter) !important;
  color: var(--night-soft);
  background:
    radial-gradient(60% 80% at var(--orb-cx) var(--orb-top), rgba(14, 78, 134, 0.3), transparent 70%),
    linear-gradient(160deg, var(--night-surface) 0%, var(--night-panel) 50%, var(--night-page) 100%);
}

.yt-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: repeating-radial-gradient(
    ellipse var(--orb-w) var(--orb-h) at var(--orb-cx) var(--orb-top),
    rgba(255, 255, 255, 0.07) 0 1px,
    transparent 1px 7%
  );
  -webkit-mask-image: radial-gradient(ellipse 60% 100% at var(--orb-cx) var(--orb-top), #000 10%, rgba(0, 0, 0, 0.35) 55%, transparent 85%);
  mask-image: radial-gradient(ellipse 60% 100% at var(--orb-cx) var(--orb-top), #000 10%, rgba(0, 0, 0, 0.35) 55%, transparent 85%);
}

.yt-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: var(--orb-top);
  left: var(--orb-side);
  width: var(--orb-w);
  height: var(--orb-h);
  margin-top: calc(var(--orb-h) / -2);
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(246, 178, 60, 0.7) 0%,
    rgba(224, 154, 30, 0.3) 22%,
    rgba(34, 184, 216, 0.22) 48%,
    transparent 70%
  );
  filter: blur(2px);
}

.yt-hero-inner {
  max-width: var(--container);
  margin: 0 auto;
}

.yt-hero-inner > * {
  max-width: 660px;
}

.yt-crumbs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: var(--fs-sm);
  color: var(--night-soft);
}

.yt-crumbs a:hover { color: var(--night-ink); }
.yt-crumbs i { font-size: 0.65em; opacity: 0.7; }
.yt-crumbs [aria-current] { color: var(--night-ink); }

.yt-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 2.8vw, 3.3rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--white);
  margin-bottom: 0.9rem;
  text-wrap: balance;
}

.yt-hero p {
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.15rem);
  line-height: 1.9;
  color: var(--night-soft);
  margin-bottom: 1.75rem;
}

.yt-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.yt-subscribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0 1.6rem;
  border-radius: var(--radius-md);
  background: #E62117;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  box-shadow: 0 10px 26px rgba(230, 33, 23, 0.3);
  transition: background var(--transition), transform var(--transition);
}

.yt-subscribe i {
  font-size: 1.2em;
}

.yt-subscribe:hover {
  background: #C9180F;
  transform: translateY(-2px);
}

.yt-channel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--night-line);
  background: rgba(17, 45, 71, 0.6);
  color: var(--night-ink);
  font-weight: 700;
  transition: border-color var(--transition), background var(--transition);
}

.yt-channel-link i {
  font-size: 0.8em;
}

.yt-channel-link:hover {
  border-color: var(--lagoon);
  background: rgba(34, 184, 216, 0.14);
}

@media (max-width: 760px) {
  .yt-hero {
    --orb-w: 240px;
    --orb-h: 180px;
    --orb-side: -80px;
    --orb-top: 25%;
  }
}

@media (max-width: 420px) {
  .yt-hero-actions > a {
    width: 100%;
  }
}

/* -----------------------------------------------------------------
   VIDEOS
   ----------------------------------------------------------------- */
.yt-body {
  background: var(--foam);
}

.yt-head {
  max-width: var(--container);
  margin: 0 auto 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.yt-head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--ocean);
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  direction: ltr;
  text-align: right;
}

.yt-head h2 span {
  direction: rtl;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-soft);
}

.yt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.yt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--mist);
  background: var(--white);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.yt-chip i { font-size: 0.85em; color: var(--ink-soft); }

.yt-chip span {
  min-width: 24px;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--foam);
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  text-align: center;
}

.yt-chip:hover { border-color: var(--ocean); }

.yt-chip[aria-pressed="true"] {
  background: var(--ocean);
  border-color: var(--ocean);
  color: var(--white);
}

.yt-chip[aria-pressed="true"] i { color: inherit; }

.yt-chip[aria-pressed="true"] span {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

@media (max-width: 760px) {
  .yt-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
  }
  .yt-chips::-webkit-scrollbar { display: none; }
  .yt-chip { flex-shrink: 0; white-space: nowrap; }
}

.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(1.1rem, 0.8rem + 1vw, 1.75rem);
  max-width: var(--container);
  margin: 0 auto;
}

.video-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
  transition: transform var(--transition), box-shadow var(--transition);
}

.video-card[hidden] {
  display: none;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}

/* Thumbnail with play button (YouTube loads only on click) */
.yt-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--abyss);
}

.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.yt-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6, 37, 63, 0.55), transparent 55%);
}

.video-card:hover .yt-thumb img {
  transform: scale(1.04);
}

.yt-play {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sand);
  color: var(--abyss);
  font-size: 1.2rem;
  box-shadow: 0 0 0 8px rgba(246, 178, 60, 0.28);
  transition: transform var(--transition), box-shadow var(--transition);
}

.yt-play i {
  transform: translateX(2px);
}

.yt-thumb:hover .yt-play,
.yt-thumb:focus-visible .yt-play {
  transform: scale(1.08);
  box-shadow: 0 0 0 12px rgba(246, 178, 60, 0.32);
}

.yt-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.25rem 1.3rem;
}

.yt-tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
  background: #E3F5FA;
  color: var(--lagoon-ink);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.video-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}

.video-card p {
  font-size: var(--fs-sm);
  line-height: 1.8;
  color: var(--ink-soft);
}

/* Closing call to action */
.yt-cta {
  max-width: var(--container);
  margin: 2.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  border-radius: var(--radius-lg);
  color: var(--night-soft);
  background:
    radial-gradient(50% 120% at 8% 50%, rgba(230, 33, 23, 0.16), transparent 70%),
    linear-gradient(160deg, var(--night-surface), var(--night-page));
  border: 1px solid var(--night-line);
}

.yt-cta h3 {
  font-size: var(--fs-lg);
  color: var(--night-ink);
  margin-bottom: 0.25rem;
}

@media (max-width: 560px) {
  .yt-cta .yt-subscribe {
    width: 100%;
  }
}

/* -----------------------------------------------------------------
   PLAYER MODAL
   ----------------------------------------------------------------- */
.yt-modal {
  width: min(1000px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--night-page, #071A2B);
  color: var(--night-ink, #E4EFF7);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.yt-modal::backdrop {
  background: rgba(6, 37, 63, 0.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.yt-modal[open] {
  animation: yt-pop 0.2s ease both;
}

@keyframes yt-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.yt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem 0.8rem 0.6rem;
  padding-inline-start: 1.25rem;
}

.yt-modal-head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.5;
  color: var(--night-ink, #E4EFF7);
  min-width: 0;
}

.yt-modal-close {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--night-line);
  background: transparent;
  color: var(--night-ink, #E4EFF7);
  font-size: 1.1rem;
}

.yt-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.yt-modal-frame {
  aspect-ratio: 16 / 9;
  background: #000;
}

.yt-modal-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.yt-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.yt-nav,
.yt-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--night-line);
  background: transparent;
  color: var(--night-ink, #E4EFF7);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.yt-nav:hover:not(:disabled),
.yt-open:hover {
  border-color: var(--lagoon);
  background: rgba(34, 184, 216, 0.12);
}

.yt-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.yt-open i {
  color: #FF3B30;
}

@media (max-width: 560px) {
  .yt-open span,
  .yt-modal-foot .yt-open {
    font-size: var(--fs-xs);
  }
  .yt-nav {
    padding: 0 0.7rem;
  }
}
