/* ═══════════════════════════════════════════════════════════════════════════
   CODIFICANDO · Acabado premium compartido (tema, Centro de Ayuda y Blog)
   - Revelado suave al hacer scroll (clase .cod-rv la agrega cod_premium.js)
   - Entrada de los héroes (solo CSS)
   - Encabezado: sombra al desplazarse, enlace activo, menú compacto en
     pantallas medianas para que quepa "Centro de Ayuda"
   - Respeta prefers-reduced-motion
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --cod-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Encabezado ---------- */
header .cod-nav {
    transition: padding 0.25s var(--cod-ease) !important;
}
header.cod-header-scrolled {
    box-shadow: 0 6px 30px rgba(26, 26, 46, 0.12) !important;
}
header.cod-header-scrolled .cod-nav {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}
.cod-menu-desktop > li > a {
    position: relative !important;
}
.cod-menu-desktop > li > a::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 6px;
    height: 2px;
    border-radius: 2px;
    background: #F28C28;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s var(--cod-ease);
}
.cod-menu-desktop > li > a:hover::after,
.cod-menu-desktop > li > a.is-active::after {
    transform: scaleX(1);
}
.cod-menu-desktop > li > a.is-active {
    color: #1a1a2e !important;
    font-weight: 600 !important;
}
.cod-mobile-nav a.is-active {
    background: rgba(242, 140, 40, 0.12) !important;
    color: #F28C28 !important;
    font-weight: 600 !important;
}
/* Encabezado: nunca desbordar. Ancho máximo real y reducción progresiva */
header .cod-nav {
    max-width: 1440px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    flex-wrap: nowrap !important;
}
.cod-menu-desktop {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}
@media (min-width: 992px) and (max-width: 1600px) {
    .cod-menu-desktop { gap: 0 !important; }
    .cod-menu-desktop > li > a { font-size: 14px !important; padding: 9px 11px !important; }
    .cod-menu-desktop > li > a::after { left: 11px; right: 11px; }
    .cod-btn-dir { padding: 9px 13px !important; font-size: 13px !important; }
    .cod-btn-cta { padding: 9px 14px !important; font-size: 13px !important; }
    .cod-logo-text { font-size: 18px !important; }
}
@media (min-width: 992px) and (max-width: 1320px) {
    .cod-menu-desktop > li > a { font-size: 13.5px !important; padding: 8px 9px !important; }
    .cod-btn-dir { display: none !important; }
    .cod-logo-text { font-size: 17px !important; }
}
@media (min-width: 992px) and (max-width: 1140px) {
    .cod-menu-desktop > li > a { font-size: 13px !important; padding: 8px 7px !important; }
    .cod-logo-text { display: none !important; }
}

/* ---------- Iconos SVG monocromos (sustituyen emojis) ---------- */
.cod-ic {
    display: inline-block;
    vertical-align: -0.18em;
    flex-shrink: 0;
}
.cod-category-pill .cod-ic,
.cod-widget-title .cod-ic,
.cod-post-category .cod-ic,
.cod-card-badge .cod-ic,
.cod-featured-badge .cod-ic { margin-right: 5px; }
.docs-module-icon .cod-ic { color: #F28C28; }
.sidebar-emoji .cod-ic { color: #F28C28; }
.result-icon .cod-ic { color: #F28C28; }
.cod-active-filter-icon .cod-ic { color: #F28C28; }
.cod-card-placeholder .cod-ic,
.cod-related-no-image .cod-ic,
.card-img-placeholder .cod-ic { color: rgba(255,255,255,0.45); }

/* ---------- Revelado al hacer scroll ---------- */
.cod-rv {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s var(--cod-ease), transform 0.7s var(--cod-ease);
    transition-delay: var(--cod-rv-delay, 0ms);
    will-change: opacity, transform;
}
.cod-rv.is-in {
    opacity: 1;
    transform: none;
}
/* Los elementos con transform propio en hover conservan su efecto */
.cod-rv.is-in:hover {
    will-change: auto;
}

/* ---------- Entrada de héroes ---------- */
@keyframes codRise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
@keyframes codFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: no-preference) {
    .docs-hero .container > *,
    .manual-hero .container > *,
    .module-hero .container > *,
    .cat-hero .container > *,
    .cod-blog-hero .container > *,
    .cod-post-hero .container > * {
        animation: codRise 0.8s var(--cod-ease) both;
    }
    .docs-hero .container > :nth-child(2),
    .manual-hero .container > :nth-child(2),
    .module-hero .container > :nth-child(2),
    .cat-hero .container > :nth-child(2),
    .cod-blog-hero .container > :nth-child(2),
    .cod-post-hero .container > :nth-child(2) { animation-delay: 0.1s; }
    .docs-hero .container > :nth-child(3),
    .manual-hero .container > :nth-child(3),
    .module-hero .container > :nth-child(3),
    .cod-blog-hero .container > :nth-child(3),
    .cod-post-hero .container > :nth-child(3) { animation-delay: 0.2s; }
    .docs-hero .container > :nth-child(4),
    .manual-hero .container > :nth-child(4),
    .cod-blog-hero .container > :nth-child(4),
    .cod-post-hero .container > :nth-child(4) { animation-delay: 0.3s; }
    .docs-hero .container > :nth-child(5),
    .manual-hero .container > :nth-child(5),
    .cod-post-hero .container > :nth-child(5) { animation-delay: 0.4s; }
    .cod-post-cover img { animation: codRise 0.9s 0.25s var(--cod-ease) both; }
}

/* ---------- Micro-interacciones (Centro de Ayuda y Blog) ---------- */
.docs-module-card,
.docs-manual-card,
.cat-manual-item,
.cat-subcat,
.manual-item,
.related-card,
.result-card,
.cod-blog-card,
.cod-related-card,
.cod-featured-card,
.cod-wa-card,
.cod-sidebar-widget,
.cod-author-card {
    transition: transform 0.35s var(--cod-ease), box-shadow 0.35s var(--cod-ease), border-color 0.25s ease !important;
}
.cod-blog-card .cod-card-image,
.cod-related-image-wrapper,
.cod-featured-image {
    overflow: hidden;
}
.cod-blog-card .cod-card-image img,
.cod-featured-image img {
    transition: transform 0.6s var(--cod-ease);
}
.cod-blog-card:hover .cod-card-image img,
.cod-featured-card:hover .cod-featured-image img {
    transform: scale(1.05);
}
.step-card {
    transition: transform 0.35s var(--cod-ease), box-shadow 0.35s var(--cod-ease), border-color 0.25s ease;
}
.step-card:hover {
    transform: translateY(-2px);
}
.step-card .step-number {
    transition: transform 0.35s var(--cod-ease), box-shadow 0.35s var(--cod-ease);
}
.step-card:hover .step-number {
    transform: scale(1.08);
    box-shadow: 0 8px 22px rgba(242, 140, 40, 0.45);
}
.step-image img,
.step-gif img {
    transition: transform 0.6s var(--cod-ease), box-shadow 0.4s ease;
}
.step-image:hover img {
    transform: scale(1.012);
}
.cod-wa-btn,
.cod-wa-banner-btn,
.step-cta-btn,
.docs-cta-btn,
.cod-cta-btn,
.cod-read-btn {
    position: relative;
    overflow: hidden;
}
.cod-wa-btn::after,
.cod-wa-banner-btn.wa::after,
.docs-cta-btn::after,
.cod-cta-btn.primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s var(--cod-ease);
    pointer-events: none;
}
.cod-wa-btn:hover::after,
.cod-wa-banner-btn.wa:hover::after,
.docs-cta-btn:hover::after,
.cod-cta-btn.primary:hover::after {
    left: 120%;
}
.docs-search-inner {
    transition: box-shadow 0.3s ease, transform 0.3s var(--cod-ease);
}
.docs-search-inner:focus-within {
    box-shadow: 0 20px 60px rgba(242, 140, 40, 0.25);
    transform: translateY(-2px);
}
.toc-link {
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.25s var(--cod-ease);
}
.toc-link.active {
    padding-left: 14px;
}

/* Barra de progreso de lectura (manuales y artículos) */
.cod-read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #F28C28, #FFB366);
    z-index: 10002;
    transition: width 0.15s linear;
    pointer-events: none;
}

/* ---------- Accesibilidad ---------- */
@media (prefers-reduced-motion: reduce) {
    .cod-rv { opacity: 1; transform: none; transition: none; }
    .docs-hero .container > *, .manual-hero .container > *, .module-hero .container > *,
    .cat-hero .container > *, .cod-blog-hero .container > *, .cod-post-hero .container > *,
    .cod-post-cover img { animation: none !important; }
    .cod-read-progress { transition: none; }
}
