/* ═══════════════════════════════════════════════════════════════════
   CANALESTUDIOS-MOBILE.CSS — Drawer móvil + fixes scroll/safe-area
   Aplicado a TODAS las páginas de Canal Estudios excepto la app
   alumno (index.html). Incluye:
     · Botón hamburguesa + drawer slide-from-right (Grupo A)
     · Fixes universales: dvh, safe-area, overscroll, touch
     · Compatibilidad con CSS variables existentes (capi/skill/muted/ink)
       con fallbacks por si una página no las define.
   Carga: <link rel="stylesheet" href="/css/canalestudios-mobile.css?v=20260501">
   ═══════════════════════════════════════════════════════════════════ */

/* ── VARIABLES CON FALLBACKS ────────────────────────────────────── */
:root {
  --ces-capi:   var(--capi, #6d28d9);
  --ces-skill:  var(--skill, #059669);
  --ces-ink:    var(--ink, #0a0814);
  --ces-muted:  var(--muted, #6b7280);
  --ces-border: var(--border, #e5e7eb);
  --ces-display: var(--display, 'Inter', -apple-system, sans-serif);
}

/* ── FIX 1: NAV con safe-area-inset-top (notch iPhone) ──────────── */
nav {
  padding-top: max(.9rem, env(safe-area-inset-top)) !important;
}

/* ── FIX 2: Hamburger 44x44 (Apple HIG / Material touch target) ── */
.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ces-ink);
  padding: 0;
  font-family: inherit;
  border-radius: 8px;
  transition: background .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: rgba(15, 23, 42, .06);
  outline: none;
}
.menu-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ── FIX 3: DRAWER MÓVIL — slide desde la derecha ───────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 360px);
  background: #fff;
  z-index: 201;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(15, 23, 42, .18);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  /* Dynamic viewport height: se ajusta con la barra de URL iOS */
  height: 100vh;
  height: 100dvh;
}
.nav-drawer.open {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--ces-border);
  flex-shrink: 0;
}
.drawer-head-title {
  font-family: var(--ces-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.drawer-head-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--ces-capi), var(--ces-skill));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.drawer-close {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--ces-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.drawer-close:hover,
.drawer-close:focus-visible {
  background: rgba(15, 23, 42, .06);
  color: var(--ces-ink);
  outline: none;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .95rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ces-ink);
  min-height: 48px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.drawer-link:hover,
.drawer-link:focus-visible {
  background: rgba(109, 40, 217, .06);
  color: var(--ces-capi);
  border-left-color: var(--ces-capi);
  outline: none;
  text-decoration: none;
}
.drawer-link.is-cta {
  color: #fff;
  background: var(--ces-capi);
  margin: .5rem 1rem;
  border-radius: 10px;
  justify-content: center;
  border-left: 0;
  box-shadow: 0 4px 14px rgba(109, 40, 217, .25);
}
.drawer-link.is-cta:hover {
  background: #5b21b6;
  color: #fff;
  border-left: 0;
}
.drawer-link-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}
.drawer-divider {
  height: 1px;
  background: var(--ces-border);
  margin: .6rem 1.4rem;
  border: 0;
}
.drawer-foot {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--ces-border);
  font-size: .78rem;
  color: var(--ces-muted);
  flex-shrink: 0;
  text-align: center;
}

/* ── FIX 4: Body scroll lock cuando drawer abierto ──────────────── */
body.no-scroll {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

/* ── FIX 5: MEDIA QUERIES — mostrar hamburger / ocultar nav-links ─ */
@media (max-width: 900px) {
  .nav-links { display: none !important; }
  .menu-toggle { display: inline-flex !important; }
  nav .nb { padding: .5rem 1rem; font-size: .8rem; }
}
@media (max-width: 600px) {
  nav { padding: .7rem 1rem; padding-top: max(.7rem, env(safe-area-inset-top)) !important; }
  .nb { padding: .45rem .9rem; font-size: .78rem; }
}

/* ── FIX 6: Inputs sin zoom iOS al focus (font-size mínimo 16px) ── */
@media (hover: none) and (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  input:not([type]),
  select,
  textarea {
    font-size: 16px !important;
  }
  /* Touch optimization global */
  button, a, [role="button"], [onclick] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ── FIX 7: Body min-height usa dvh donde haya 100vh ────────────── */
@supports (height: 100dvh) {
  @media (max-width: 900px) {
    body {
      min-height: 100dvh;
    }
  }
}

/* ── FIX 8: overscroll-behavior global en body — no pull-to-refresh ─ */
@media (max-width: 900px) {
  body {
    overscroll-behavior-y: none;
  }
}

/* ── FIX 9: Imágenes responsive en mobile (no overflow horizontal) ─ */
@media (max-width: 600px) {
  img, video, iframe {
    max-width: 100%;
    height: auto;
  }
}

/* ── FIX 10: Footer/header con safe-area inferior (home gesture) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: max(2rem, calc(2rem + env(safe-area-inset-bottom)));
  }
}
