/* ============================================================================
   WEB PUBLICA - css/youtube-base.css
   YOUTUBE (1 de 3) — estructura general de la sección: variables, escenario,
   encabezado, botón "Ir al canal" y reducción de movimiento.

   La sección YouTube se reparte en 3 archivos CSS (todos acotados a #youtube
   para no pisar al resto del sitio):
     1) css/youtube-base.css   -> este archivo: base, stage, head, archivo-link, reduced-motion
     2) css/youtube-torre.css  -> columna izquierda: suscripción + torre de lomos de cassette
     3) css/youtube-card.css   -> grilla de 4 slots (2x2) + cards, calendario y play

   Los tres se cargan desde index.html con un <link> cada uno. Este archivo va PRIMERO
   porque define las variables (--accent, --yt-escala, --yt-head-mb, etc.) que usan los otros dos.

   IDs: un comentario YOUTUBE/categoría/número arriba de cada bloque. Nunca se reciclan
   (los números de bloques eliminados quedan sin usar).
      Categorías de este archivo: base, stage, head, archivo-link
   + sufijos: -pc (≥721px), -mobile (≤720px), -reduced-motion

   Estructura de index.html que estos estilos esperan:
     <section id="youtube" class="section youtube-section">
       <div class="yt-stage">
         <div class="yt-archive">
           <div class="yt-head">
             <p class="yt-head-titulo" id="youtubeTitulo"></p>
             <p class="yt-head-sub" id="youtubeSub"></p>
             <a class="yt-head-link" id="youtubeLink"></a>
           </div>
           <div class="yt-grid" id="youtubeGrid"></div>   <- el panel y los slots los arma js/youtube.js
         </div>
       </div>
     </section>

   Disposición de la grilla en PC (3 columnas iguales; se define en youtube-card.css):
        [ panel  ] [ slot 1 ] [ slot 2 ]
        [ (torre)] [ slot 3 ] [ slot 4 ]
   ============================================================================ */

/* ===== BASE ===== */

/* YOUTUBE/base/01
   Variables propias (copia de las de #noticias: esta sección no las hereda) y tipografía base.
   Si cambiás --nt-escala en noticias.css, cambiá --yt-escala acá al mismo valor. */
#youtube {
  --accent: #ff4d00;
  --accent-ink: #ffffff;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --yt-width: 120rem;
  --yt-gutter: clamp(1rem, 4.2vw, 4rem);
  --yt-escala: .85;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* YOUTUBE/base/02
   js/youtube.js oculta la sección con el atributo hidden si no hay videos;
   esta regla evita que un display de .section lo pise. */
#youtube[hidden] {
  display: none;
}

/* YOUTUBE/base/03
   Color de selección de texto: naranja de la marca. */
#youtube ::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* YOUTUBE/base/04
   Los botones heredan fuente y color del sitio (el navegador les pone los suyos). */
#youtube button {
  font: inherit;
  color: inherit;
}

/* YOUTUBE/base/05
   Las imágenes se comportan como bloque (sin hueco de línea debajo). */
#youtube img {
  display: block;
}

/* YOUTUBE/base/06
   Sin padding lateral, igual que #noticias (el ancho lo da .yt-archive). */
#youtube {
  padding: 0;
}

/* ===== STAGE ===== */

/* YOUTUBE/stage/01
   Escenario: ocupa todo el ancho y recorta lo que se salga. */
#youtube .yt-stage {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: clamp(12px, 1.5vw, 22px) 0 clamp(14px, 1.8vw, 24px);
  overflow: hidden;
}

/* YOUTUBE/stage/02
   Contenedor central: mismo ancho que .archive de Noticias. */
#youtube .yt-archive {
  position: relative;
  width: calc(var(--yt-escala) * (min(100%, var(--yt-width)) - 2 * var(--yt-gutter)));
  margin: 0 auto;
  isolation: isolate;
}

/* ===== HEAD (encabezado) ===== */

/* YOUTUBE/head/01
   Base del encabezado (se completa en PC y mobile más abajo). */
#youtube .yt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: .8125rem;
  color: var(--text-secondary);
}

/* YOUTUBE/head/02
   Título. */
#youtube .yt-head-titulo {
  margin: 0;
  color: var(--text-primary);
  font-weight: 500;
}

/* YOUTUBE/head/03
   Subtítulo. */
#youtube .yt-head-sub {
  margin: 0;
  color: var(--text-secondary);
}

/* ===== ACCESO AL CANAL (botón naranja del encabezado) ===== */

/* YOUTUBE/archivo-link/01
   Botón "Ir al canal": siempre naranja, sin borde, esquinas apenas redondeadas (copia de Noticias). */
#youtube .yt-head-link {
  align-self: flex-end;
  margin-bottom: calc(var(--yt-escala) * .15rem);
  padding: .55em 1em;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: Arial, 'Helvetica Neue', sans-serif;
  font-size: calc(var(--yt-escala) * .67rem);
  font-weight: 700;
  letter-spacing: .13em;
  line-height: 1.3;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .25s var(--ease-out-expo), background-color .25s;
}

/* YOUTUBE/archivo-link/02
   Al pasar el mouse o enfocar con teclado: se levanta un poco y el naranja se oscurece. */
#youtube .yt-head-link:hover,
#youtube .yt-head-link:focus-visible {
  background: #e04300;
  transform: translateY(-3px);
  outline: none;
}


/* ===== PC (≥721px): mismo aire y encabezado que Noticias ===== */
@media (min-width: 721px) {

  /* YOUTUBE/stage-pc/01
     Medidas del encabezado, calculadas igual que en Noticias.
     --yt-head-mb también lo usa youtube-card.css para separar la grilla del encabezado. */
  #youtube {
    --yt-cq: calc((min(100vw, var(--yt-width)) - 2 * var(--yt-gutter)) / 100);
    --yt-title: calc(var(--yt-escala) * clamp(3rem, 6.1 * var(--yt-cq), 5rem));
    --yt-head-pt: calc(var(--yt-escala) * (.67rem * 1.3 + clamp(.65rem, 1.15 * var(--yt-cq), .9rem)));
    --yt-head-pb: calc(var(--yt-escala) * clamp(.85rem, 1.5 * var(--yt-cq), 1.2rem));
    --yt-head-mb: calc(var(--yt-escala) * clamp(.8rem, 1.2 * var(--yt-cq), 1rem));
    --yt-head: calc(var(--yt-title) * .9 + var(--yt-head-pt) + var(--yt-head-pb) + 1px + var(--yt-head-mb));
  }

  /* YOUTUBE/stage-pc/02
     Mismo margen vertical que Noticias y contenido centrado. */
  #youtube .yt-stage {
    display: flex;
    align-items: center;
    padding: clamp(1.2rem, 2vw, 1.6rem) 0;
  }

  /* YOUTUBE/head-pc/01
     Contenedor del encabezado: hueco de la líneita + título + línea fina. */
  #youtube .yt-head {
    box-sizing: border-box;
    height: calc(var(--yt-head) - var(--yt-head-mb));
    align-items: flex-end;
    gap: 2rem;
    padding: var(--yt-head-pt) 0 var(--yt-head-pb);
    border-bottom: 1px solid var(--border-strong);
  }

  /* YOUTUBE/head-pc/02
     Título grande en Georgia (idéntico al de Noticias). */
  #youtube .yt-head-titulo {
    margin: 0;
    color: var(--text-primary);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: var(--yt-title);
    font-weight: 400;
    line-height: .9;
    letter-spacing: -.07em;
    text-transform: none;
  }

  /* YOUTUBE/head-pc/03
     Subtítulo en mayúsculas chicas, pegado al título (el botón queda solo a la derecha).
     El gap es 2rem: con -1rem de margen quedan 1rem entre el título y el subtítulo. */
  #youtube .yt-head-sub {
    margin: 0 auto 0 -1rem;
    padding-bottom: calc(var(--yt-escala) * .15rem);
    color: var(--text-secondary);
    font-family: Arial, 'Helvetica Neue', sans-serif;
    font-size: calc(var(--yt-escala) * .67rem);
    line-height: 1.3;
    letter-spacing: .13em;
    text-transform: uppercase;
  }
}


/* ===== MOBILE (≤720px) ===== */
@media (max-width: 720px) {

  /* YOUTUBE/stage-mobile/01
     60px arriba: deja libre el botón hamburguesa (fijo, arriba a la derecha). */
  #youtube .yt-stage {
    padding: 60px 12px 12px;
  }

  /* YOUTUBE/stage-mobile/02
     En celular el contenedor ocupa todo el ancho. */
  #youtube .yt-archive {
    width: 100%;
  }

  /* YOUTUBE/head-mobile/01
     Encabezado más bajo y con letra más chica. */
  #youtube .yt-head {
    height: 28px;
    font-size: .75rem;
  }

  /* YOUTUBE/head-mobile/02
     En celular el acceso al canal no va en la cabecera. */
  #youtube .yt-head-link {
    display: none;
  }
}


/* ===== REDUCIR MOVIMIENTO ===== */
@media (prefers-reduced-motion: reduce) {

  /* YOUTUBE/base-reduced-motion/01
     Si el sistema pide menos movimiento, se anulan transiciones y animaciones
     de toda la sección (incluye torre y cards de los otros dos archivos). */
  #youtube *,
  #youtube ::after,
  #youtube ::before {
    scroll-behavior: auto !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }
}
