/* Home Dedicated Styles - Phase 5 Migration */

/* Opinion Columnistas Section */
.opinion-columnistas-container {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.opinion-columnistas-container a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color 0.3s ease;
}

.opinion-columnistas-container a:hover {
    color: #ff5100 !important;
}

.highlighted-post {
    flex: 2;
}

.highlighted-post img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Utility Classes for Border Radius */
.h-br-8 { border-radius: 8px !important; }
.h-br-6 { border-radius: 6px !important; }
.h-br-4 { border-radius: 4px !important; }

.h-aspect-16-9 {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    display: block;
    margin-bottom: 12px;
    border-radius: 6px !important; /* Force it here */
    -webkit-mask-image: -webkit-radial-gradient(white, black); /* Safari fix for overflow + border-radius */
    mask-image: radial-gradient(white, black);
}

.h-aspect-16-9 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 6px !important;
}

.small-posts-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding-right: 5px; /* Safety padding */
}

.small-post-item img {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 6px;
    margin-bottom: 10px;
    display: block;
}

.post-meta {
    font-size: 13px;
    color: #555555;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.post-meta a:hover {
    color: #ff5100;
}

.post-meta img {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.post-meta .sep {
    color: #ccc;
    margin: 0 4px;
}

.post-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 12px;
}

.post-img-link {
    display: block;
    overflow: hidden;
}

.post-title a {
    color: #333;
    text-decoration: none;
    display: inline-block;
}

.post-title a:hover {
    color: #ff5100;
}

.post-title-small {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 5px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em; /* Force alignment */
}

.post-title-small a {
    color: #333;
    text-decoration: none;
    display: inline-block;
}

.post-title-small a:hover {
    color: #ff5100;
}

.post-excerpt {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile Opinion */
.opinion-columnistas-mobile-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 0 15px;
}

.mobile-post-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
}

/* Ultimas Columnistas List (Sidebar/Bottom) */
.ultimas-columnistas-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: transparent;
    padding: 0;
}

.columnista-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.columnista-item.last {
    border-bottom: none;
}

.columnista-details {
    flex: 1;
}

.columnista-details .author-name {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
    color: #B33300 !important; /* Deeper orange for guaranteed WCAG AA contrast (5.5:1) against #FAFAFA */
    line-height: 1.2;
    text-transform: uppercase;
}

.columnista-details .post-link-title {
    font-size: 14px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    display: block;
    margin: 5px 0;
    transition: color 0.3s ease;
}

.columnista-details .post-link-title:hover {
    color: #FF5100 !important;
}

.columnista-image {
    flex-shrink: 0;
}

.columnista-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Columna Universitaria */
.columna-universitaria-container {
    display: flex;
    gap: 30px;
}

/* 3-Column Layout: HERO | 300px MIDDLE | SIDEBAR */
.h-opinion-full-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 40px;
}

.h-opinion-main-block {
    flex: 1; /* This is the container for [opinion_columnistas] (Hero + Middle) */
    display: flex;
    gap: 30px;
}

.opinion-columnistas-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    gap: 30px;
    box-sizing: border-box;
}

.highlighted-post {
    flex: 1.5;
    min-width: 0;
}

.small-posts-stack {
    width: 300px !important; /* Middle column fixed 300px */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.h-opinion-sidebar {
    width: 350px !important; /* Right column (Sidebar list) */
    flex-shrink: 0;
}

.ultimas-columnistas-container {
    width: 100% !important;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Home Section Styles */
.h-home-section {
    margin-bottom: 70px; /* Standardized spacing */
}

/* Advertising Banners Row */
.h-ad-banners-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.h-ad-banner-col {
    flex: 1;
    text-align: center;
}

@media (max-width: 640px) {
    .h-ad-banners-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .h-ad-banner-col {
        width: 100%;
    }
}
.h-section-opinion {
    background-color: #FAFAFA;
    padding: 30px 0 0;
    /* margin-bottom already handled by .h-home-section (70px) */
}

/* Banners publicitarios – 2 columnas */
.h-section-ad-banners {
    margin-bottom: 70px;
}

.h-ad-banners-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
}

.h-ad-banner-col {
    min-width: 0;
    overflow: hidden;
}

/* Los banners del plugin llenan su columna */
.h-ad-banner-col img,
.h-ad-banner-col a,
.h-ad-banner-col > * {
    width: 100%;
    display: block;
}

/* Mobile: 1 columna */
@media (max-width: 640px) {
    .h-ad-banners-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.h-section-title {
    font-size: 24px;
    font-weight: 800;
    color: #ff5100;
    margin: 0;
    text-transform: uppercase;
}

/* Category Grid Row (3 Columns) */
.h-category-flex-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.h-cat-col {
    min-width: 0; /* prevent overflow */
}

/* Multimedia Block */
.h-multimedia-row {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.h-multimedia-yt {
    flex: 0 0 320px;
}

.h-multimedia-spotify {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1024px) {
    .h-multimedia-row {
        flex-direction: column;
        gap: 30px;
    }
    .h-multimedia-yt {
        width: 100%;
        flex: none;
        max-width: 400px;
        margin: 0 auto;
    }
    .h-multimedia-spotify {
        width: 100%;
        text-align: left;
    }
    .last-episode-mobile {
        display: block;
        margin-bottom: 30px;
        text-align: left;
    }
    .last-episode-mobile div[style*="position: relative"] {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 20px !important;
    }
    .last-episode-mobile img {
        border-radius: 12px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    }
    .last-episode-mobile h3 {
        font-size: 18px;
        margin: 10px 0;
        line-height: 1.3;
        text-align: left;
    }
}

/* Newsletter Section - Premium Dark Style */
.h-section-newsletter {
    background-color: #383838;
    padding: 70px 0;
    margin-bottom: 70px;
}

.h-newsletter-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: row; /* Back to columns */
    justify-content: center; /* Center them as a block */
    align-items: center;
    gap: 100px; /* Space between them */
}

.h-newsletter-left {
    flex: 0 1 auto;
    text-align: left; /* Left aligned content in left column */
}

.h-newsletter-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 25px;
}

.h-newsletter-title {
    font-size: 28px;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.2;
}

.h-newsletter-sub {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.5;
}

.h-newsletter-right {
    flex: 1;
    max-width: 550px;
}

/* Form Styling */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.newsletter-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.newsletter-form input[type="text"],
.newsletter-form input[type="email"] {
    width: 320px; /* Fixed width for better control in centered layout */
    max-width: 100%;
    padding: 10px 15px;
    background: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    box-sizing: border-box; /* Fix for mobile overflow */
}

.newsletter-checkbox {
    color: #fff;
    font-size: 13px;
}

.newsletter-checkbox label {
    display: flex;
    justify-content: flex-start; /* Left aligned checkbox */
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.newsletter-checkbox a {
    color: #fff;
    text-decoration: underline;
}

.btn-nl-submit {
    background-color: #fff;
    color: #383838;
    border: none;
    padding: 10px 40px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start; /* Left aligned button */
    text-transform: none;
}

.btn-nl-submit:hover {
    background-color: #f2f2f2;
    transform: translateY(-2px);
}

.nl-success { color: #4CAF50; font-size: 14px; margin-top: 10px; }
.nl-error { color: #FF5252; font-size: 14px; margin-top: 10px; }

/* Responsive Newsletter */
@media (max-width: 900px) {
    .h-newsletter-inner {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }
    .h-newsletter-logo {
        margin: 0 auto 20px;
    }
    .btn-nl-submit {
        align-self: center;
    }
    .h-newsletter-right {
        width: 100%;
    }
    .newsletter-form input[type="text"],
    .newsletter-form input[type="email"] {
        width: 100%; /* Full width on mobile */
    }
}


/* Metadata Global Standardization (11px icons) */
.h-post-meta img,
.entry-meta img,
.sidebar-post-meta img,
.h-home-featured-meta img {
    width: 11px !important;
    height: 11px !important;
}

/* Responsive Gaps – Tablet */
@media (max-width: 1024px) {
    .h-opinion-full-row {
        flex-direction: column;
        gap: 30px;
    }

    .h-opinion-sidebar,
    .small-posts-stack {
        width: 100% !important;
    }

    .h-opinion-main-block {
        flex-direction: column;
    }

    .h-category-flex-row {
        grid-template-columns: 1fr;
        gap: 50px;
    }
}

/* Responsive Gaps – Mobile (375px) */
@media (max-width: 640px) {
    /* Section Gaps */
    .h-home-section {
        margin-bottom: 60px !important; /* Increased separation between major blocks */
    }

    .h-section-videocolumnas {
        margin-bottom: 10px !important; /* Reduce espacio antes de banners */
    }

    .revista-ad {
        margin: 10px 0;
    }

    .h-section-title {
        font-size: 20px;
        text-transform: uppercase;
        font-weight: 800; /* Ensure category titles are strong */
    }

    /* Hierarchy fix: Featured title should be slightly less loud than category title */
    .main-title {
        font-size: 20px !important;
        margin-top: 15px !important;
    }

    /* Columnas a 1 sola */
    .h-category-flex-row,
    .opinion-columnistas-container,
    .columna-universitaria-container {
        grid-template-columns: 1fr !important;
        display: flex;
        flex-direction: column;
        gap: 60px; /* Separación clara entre bloques principales */
    }

    /* Hierarchy fix: Featured title should be slightly less loud than category title */
    .main-title, .post-title, .highlighted-post .post-title-small {
        font-size: 20px !important;
        margin-top: 15px !important;
    }

    /* Small posts in university block - match category style strictly on mobile */
    .small-post-item {
        display: grid !important;
        grid-template-columns: 110px 1fr !important;
        gap: 15px !important;
        align-items: start !important;
        padding: 15px 0 !important;
        border-bottom: 1px solid #eee;
    }

    .small-post-item:last-child { border-bottom: none; }

    .small-post-item .h-aspect-16-9 {
        width: 110px !important;
        margin: 0 !important;
    }

    .small-post-item .item-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        min-width: 0;
        justify-content: flex-start !important;
    }

    .small-post-item .post-title-small {
        font-size: 16px !important;
        font-weight: 700 !important;
        margin: 0 0 8px 0 !important;
        line-height: 1.4 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .small-post-item .post-meta {
        font-size: 11px !important;
        margin: 0 !important;
        display: flex !important;
        gap: 8px;
        order: 2; /* Ensure meta stays below title if flex order is used */
    }

    /* Opinion and University Section Mobile Overrides */
    .opinion-columnistas-container,
    .columna-universitaria-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important; /* Spacing between featured and first small post */
    }

    .h-opinion-full-row {
        display: block !important;
        width: 100% !important;
    }

    .h-opinion-main-block {
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    .h-opinion-sidebar {
        display: block !important;
        width: 100% !important;
        margin-top: 40px !important;
        padding-top: 30px;
        border-top: 1px solid #eee;
    }

    @media (min-width: 1024px) {
        /* Legacy rule if needed, keeping empty for now to match deletion */
    }

    /* Category post item – stacked on mobile */
    .category-post-item {
        padding: 12px 0;
        display: flex;
        flex-direction: row;
        gap: 12px;
        align-items: center;
    }

    .category-post-item .item-img-link img {
        width: 110px !important;
        height: 62px !important;
        border-radius: 4px !important;
    }

    .category-post-item .item-title {
        font-size: 13px !important;
        height: auto;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .ultimas-columnistas-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }

    .highlighted-post img {
        height: auto !important;
        aspect-ratio: 16/9 !important;
    }

    .post-title {
        font-size: 18px;
    }

    .post-excerpt {
        font-size: 14px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .small-posts-stack {
        width: 100% !important;
        gap: 15px;
    }


    /* Reducir listado de categorías de 4 a 2 items secundarios */
    .category-post-item:nth-child(n+3) {
        display: none;
    }
}

/* University Block Desktop Grid (when using small-posts-stack structure) */
@media (min-width: 768px) {
    .h-section-col-univer .small-posts-stack {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
}

.small-posts-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mobile-grid-item .post-title-small {
    font-size: 14px;
    font-weight: 700;
    margin: 8px 0;
}

/* Category Posts (Home Ranking) */
.category-posts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-post-main .main-img-link img {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    border-radius: 6px !important; /* Grid standardization: 6px */
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: block;
}

.category-post-main .main-title {
    font-size: 22px;
    font-weight: 800;
    margin: 12px 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    height: 2.6em; /* Forces 2 lines height for alignment */
}

.category-post-main .main-title a {
    color: #333;
    text-decoration: none;
}

.category-post-main .main-title a:hover {
    color: #FF5100;
}

.category-post-main .main-excerpt {
    font-size: 15px;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 4.5em; /* Forces 3 lines height for alignment */
}


.category-post-list {
    display: flex;
    flex-direction: column;
}

.category-post-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.category-post-item:last-child {
    border-bottom: none;
}

.category-post-item .item-img-link img {
    width: 130px !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    border-radius: 4px !important; /* Mini standardization: 4px */
    display: block;
}

.category-post-item .item-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
}

.category-post-item .item-title a {
    color: #333;
    text-decoration: none;
}

.category-post-item .item-title a:hover {
    color: #FF5100;
}


/* Latest Posts Block */
.desktop-latest-posts-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 0; /* Handled by section margin */
}

.desktop-latest-post-item img {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    margin-bottom: 15px;
    display: block;
}

.noticia-title, 
.desktop-latest-post-item h3 {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    margin: 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em; /* Ensure consistent alignment */
}

.desktop-latest-post-item .excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Section: Podcast Random MKT */
.h-section-podcast-yt {
    background-color: #383838;
    padding: 80px 0;
    width: 100%;
}

.h-section-podcast-yt .h-section-title {
    color: #ffffff !important;
}

.h-section-podcast-yt .h-section-header::after {
    background-color: #ff5100;
}

.h-podcast-platforms {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.h-podcast-platforms span {
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}
