/* =========================================
   CognioNews Homepage V2 — News-Standard Layout
   Sidebar, banner ads, proper spacing, editorial rhythm
   ========================================= */

/* === TICKER (slow, readable) === */
.ticker-wrap {
    display: flex !important;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--gold-border);
    height: 36px;
    overflow: hidden;
    position: relative;
}

.ticker-label {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--gold);
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    z-index: 2;
}

.ticker {
    padding-left: 90px;
    white-space: nowrap;
    animation: ticker-scroll 240s linear infinite;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* === NAV SUBSCRIBE CTA === */
.nav-cta {
    margin-left: auto;
}

.nav-subscribe-btn {
    background: var(--gold) !important;
    color: var(--bg-primary) !important;
    padding: 0.45rem 1.2rem !important;
    border-radius: 4px;
    font-weight: 700 !important;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    transition: background var(--transition), transform var(--transition);
}

.nav-subscribe-btn:hover {
    background: var(--gold-hover) !important;
    transform: translateY(-1px);
}

/* === THE CORRECTION HERO (full width banner) === */
.correction-hero {
    background: linear-gradient(135deg, #0f1219 0%, #0a0c14 50%, #111827 100%);
    border-bottom: 2px solid var(--gold-border);
    padding: 0;
    overflow: hidden;
}

.correction-hero-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 420px;
    min-height: 220px;
    gap: 0;
}

.correction-hero-content {
    padding: 1.75rem 2.5rem 1.75rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.correction-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.correction-badge {
    background: var(--gold);
    color: var(--bg-primary);
    padding: 0.2rem 0.7rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.correction-date {
    color: var(--fg-muted);
    font-size: 0.8rem;
}

.correction-headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 0.6rem;
}

.correction-summary {
    color: var(--fg-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    max-width: 520px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.correction-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: gap var(--transition), color var(--transition);
}

.correction-cta:hover {
    gap: 0.85rem;
    color: var(--gold-hover);
}

.correction-hero-image {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(201,162,39,0.06), transparent);
}

.correction-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.correction-hero-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(201,162,39,0.04), rgba(201,162,39,0.01));
    min-height: 200px;
}

@media (max-width: 900px) {
    .correction-hero-inner {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .correction-hero-content {
        padding: 1.25rem 1.5rem;
    }
    .correction-hero-image {
        height: 160px;
        order: -1;
    }
}

/* === BANNER AD (full-width leaderboard) === */
.banner-ad {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
}

.banner-ad-inner {
    width: 100%;
    max-width: 728px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.1rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), transform var(--transition);
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
}

.banner-ad-inner:hover {
    transform: translateY(-1px);
}

.banner-ad-inner .ba-sponsored {
    position: absolute;
    top: -8px;
    right: 12px;
    font-size: 0.55rem;
    color: var(--fg-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: var(--bg-primary);
    padding: 0 6px;
}

.banner-ad-inner .ba-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.banner-ad-inner .ba-body {
    flex: 1;
}

.banner-ad-inner .ba-body strong {
    display: block;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.banner-ad-inner .ba-body span {
    color: var(--fg-muted);
    font-size: 0.85rem;
}

.banner-ad-inner .ba-cta {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.ba-engine { background: linear-gradient(135deg, rgba(201,162,39,0.1), var(--bg-card)); border-color: rgba(201,162,39,0.25); }
.ba-engine:hover { border-color: var(--gold); }
.ba-engine .ba-icon { color: var(--gold); }
.ba-engine .ba-cta { background: var(--gold); color: var(--bg-primary); }

.ba-deepdives { background: linear-gradient(135deg, rgba(34,197,94,0.08), var(--bg-card)); border-color: rgba(34,197,94,0.2); }
.ba-deepdives:hover { border-color: #22c55e; }
.ba-deepdives .ba-icon { color: #22c55e; }
.ba-deepdives .ba-cta { background: #22c55e; color: #000; }

.ba-certified { background: linear-gradient(135deg, rgba(201,162,39,0.08), var(--bg-card)); border-color: rgba(201,162,39,0.2); }
.ba-certified:hover { border-color: var(--gold); }
.ba-certified .ba-icon { color: var(--gold); }
.ba-certified .ba-cta { background: var(--gold); color: var(--bg-primary); }

.ba-public { background: linear-gradient(135deg, rgba(59,130,246,0.08), var(--bg-card)); border-color: rgba(59,130,246,0.2); }
.ba-public:hover { border-color: #3b82f6; }
.ba-public .ba-icon { color: #3b82f6; }
.ba-public .ba-cta { background: #3b82f6; color: #fff; }

/* === MAIN CONTENT + DUAL SIDEBAR LAYOUT === */
.content-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 1rem;
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .content-layout {
        grid-template-columns: 1fr 280px;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    .sidebar-left {
        display: none;
    }
    .sidebar {
        position: sticky;
        top: 60px;
    }
}

@media (max-width: 900px) {
    .content-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1.5rem;
    }
    .sidebar-left {
        display: none;
    }
    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .columns-ribbon-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .columns-ribbon-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .banner-ad-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 1rem;
    }
    .banner-ad-inner .ba-icon { display: none; }

    /* Hero compact on mobile */
    .hero {
        padding: 20px 16px 16px !important;
    }
    .hero h1 {
        font-size: 1.3rem !important;
    }
    .hero .tagline {
        font-size: 0.8rem !important;
        margin-bottom: 10px !important;
    }
    .hero .description {
        font-size: 0.8rem !important;
        margin-bottom: 12px !important;
    }
    .hero-tiers {
        gap: 0.5rem !important;
        margin-top: 0.75rem !important;
    }
    .tier-badge {
        padding: 4px 10px !important;
    }
    .tier-label {
        font-size: 0.65rem !important;
    }
    .tier-desc {
        font-size: 0.55rem !important;
    }
    .hero-stats {
        gap: 1rem !important;
        margin-top: 0.75rem !important;
    }
    .hero-stats > div > div:first-child {
        font-size: 1.1rem !important;
    }
    .hero-stats > div > div:last-child {
        font-size: 0.55rem !important;
    }
    .hero-bg {
        opacity: 0.25 !important;
    }
}

@media (max-width: 600px) {
    body {
        overflow-x: hidden;
    }
    .content-layout {
        padding: 0.75rem;
        gap: 1rem;
    }
    .sidebar {
        grid-template-columns: 1fr;
    }
    .content-layout .stories-grid {
        grid-template-columns: 1fr;
    }
    .topic-filters {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
    }
    .topic-btn {
        flex-shrink: 0;
        font-size: 0.85rem;
        padding: 10px 16px;
        min-height: 44px;
    }
    .columns-ribbon-grid {
        grid-template-columns: 1fr;
    }
    .banner-ad {
        padding: 0.5rem;
    }
    .hero {
        padding: 16px 12px 12px !important;
    }
    .hero .description {
        display: none;
    }
    .hero-tiers {
        display: none !important;
    }
}

/* === LEFT SIDEBAR === */
.sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 70px;
}

@media (max-width: 1200px) {
    .sidebar-left {
        display: none !important;
    }
}

/* Prevent horizontal overflow on all screens */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

.main-content {
    min-width: 0;
}

/* === COLUMNS RIBBON (in main) === */
.columns-ribbon {
    margin-bottom: 2rem;
    padding: 0;
}

.columns-ribbon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.columns-ribbon-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}

.columns-ribbon-header a {
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.columns-ribbon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.col-ribbon-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: border-color var(--transition), transform var(--transition);
    border-top: 3px solid var(--card-accent, var(--gold));
}

.col-ribbon-card:hover {
    border-color: var(--card-accent, var(--gold));
    transform: translateY(-2px);
}

.col-ribbon-card .col-r-type {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--card-accent, var(--gold));
}

.col-ribbon-card .col-r-title {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.4rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.col-ribbon-card .col-r-date {
    color: var(--fg-muted);
    font-size: 0.7rem;
    margin-top: 0.5rem;
}

/* === SECTION STATS (used in columns header) === */
.section-stats {
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.section-stats span {
    color: var(--gold);
    font-weight: 700;
}

/* === SIDEBAR === */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: sticky;
    top: 70px;
}

@media (max-width: 900px) {
    .sidebar {
        position: static !important;
        display: flex !important;
        flex-direction: column;
    }
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-section-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gold);
}

.sidebar-section-body {
    padding: 0;
}

/* Sidebar story list */
.sb-story {
    display: block;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition);
}

.sb-story:last-child { border-bottom: none; }

.sb-story:hover {
    background: rgba(255,255,255,0.02);
}

.sb-story .sb-topic {
    font-size: 0.55rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gold);
}

.sb-story h4 {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    color: #e5e7eb;
    margin-top: 0.2rem;
}

.sb-story .sb-meta {
    font-size: 0.7rem;
    color: var(--fg-dim);
    margin-top: 0.3rem;
}

/* Sidebar product ad (rectangle) */
.sidebar-ad {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255,255,255,0.08);
    transition: border-color var(--transition), transform var(--transition);
}

.sidebar-ad:hover {
    transform: translateY(-2px);
}

.sidebar-ad-inner {
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.sidebar-ad .sa-label {
    font-size: 0.5rem;
    color: var(--fg-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.sidebar-ad .sa-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.sidebar-ad .sa-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.35rem;
}

.sidebar-ad .sa-tagline {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.sidebar-ad .sa-desc {
    font-size: 0.8rem;
    color: var(--fg-muted);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.sidebar-ad .sa-btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* === CARD IMAGES === */
.sa-card-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
    display: block;
}

.sa-engine { background: linear-gradient(180deg, rgba(201,162,39,0.12), var(--bg-card)); }
.sa-engine .sa-icon, .sa-engine .sa-tagline { color: var(--gold); }
.sa-engine .sa-btn { background: var(--gold); color: var(--bg-primary); }

.sa-deepdives { background: linear-gradient(180deg, rgba(34,197,94,0.1), var(--bg-card)); }
.sa-deepdives .sa-icon, .sa-deepdives .sa-tagline { color: #22c55e; }
.sa-deepdives .sa-btn { background: #22c55e; color: #000; }

.sa-certified { background: linear-gradient(180deg, rgba(201,162,39,0.1), var(--bg-card)); }
.sa-certified .sa-icon, .sa-certified .sa-tagline { color: var(--gold); }
.sa-certified .sa-btn { background: var(--gold); color: var(--bg-primary); }

.sa-public { background: linear-gradient(180deg, rgba(59,130,246,0.1), var(--bg-card)); }
.sa-public .sa-icon, .sa-public .sa-tagline { color: #3b82f6; }
.sa-public .sa-btn { background: #3b82f6; color: #fff; }

/* === OVERRIDE BASE STYLES inside content-layout === */
.content-layout .controls {
    max-width: none;
    margin: 0;
    padding: 0 0 1.5rem;
}

.content-layout .stories-section {
    max-width: none;
    margin: 0;
    padding: 0 0 2rem;
}

.content-layout .stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.content-layout .view-toggle {
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.content-layout .hero {
    display: none;
}

/* === VIEW TOGGLE === */
.view-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.view-toggle button {
    background: #1a1a2e;
    color: #ccc;
    border: 1px solid #333;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}
.view-toggle button.active {
    background: var(--gold);
    color: var(--bg-primary);
    border-color: var(--gold);
}

/* List view overrides */
.stories-grid.list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.stories-grid.list .story-card {
    display: flex;
    flex-direction: row;
    align-items: center;
}
.stories-grid.list .story-card .story-image {
    width: 120px;
    height: 80px;
    margin-right: 1rem;
}
.stories-grid.list .story-content {
    flex: 1;
}

/* === DIVIDER === */
.section-divider {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-divider hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* === MOBILE ENHANCEMENTS (homepage-v2) === */

/* View toggle touch targets */
@media (pointer: coarse) {
    .view-toggle button {
        padding: 10px 16px;
        min-height: 44px;
    }

    .sidebar-ad .sa-btn {
        padding: 12px 24px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .sb-story {
        padding: 14px 16px;
        min-height: 44px;
    }
}

/* List view on small screens — stack instead of row */
@media (max-width: 600px) {
    .stories-grid.list .story-card {
        flex-direction: column;
        align-items: stretch;
    }

    .stories-grid.list .story-card .story-image {
        width: 100%;
        height: 160px;
        margin-right: 0;
        margin-bottom: 0.75rem;
    }

    .sidebar-ad-inner {
        padding: 1.25rem 1rem;
    }

    .section-divider {
        padding: 0 0.75rem;
    }
}

/* Columns ribbon responsive at 900px */
@media (max-width: 900px) {
    .columns-ribbon-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* =========================================
   MOBILE STACK STRIP
   Horizontal scrollable product cards
   Hidden on desktop (sidebar-left visible)
   ========================================= */

.stack-strip {
    display: none;
}

@media (max-width: 1200px) {
    .stack-strip {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding: 0 0 12px;
        margin-bottom: 1rem;
        scrollbar-width: none;
    }

    .stack-strip::-webkit-scrollbar {
        display: none;
    }

    .stack-card {
        flex: 0 0 200px;
        scroll-snap-align: start;
        background: var(--bg-card);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 10px;
        overflow: hidden;
        text-decoration: none;
        color: inherit;
        transition: border-color 0.2s, transform 0.2s;
    }

    .stack-card:hover,
    .stack-card:active {
        border-color: rgba(255,255,255,0.2);
        transform: translateY(-2px);
    }

    .stack-card img {
        width: 100%;
        height: 80px;
        object-fit: cover;
        display: block;
    }

    .sc-info {
        padding: 10px 12px;
    }

    .sc-info strong {
        display: block;
        font-size: 0.85rem;
        font-weight: 700;
        color: var(--fg);
        margin-bottom: 2px;
    }

    .sc-info span {
        font-size: 0.7rem;
        color: var(--fg-muted);
    }

    /* Colour accents per product */
    .sc-engine { border-bottom: 2px solid var(--gold); }
    .sc-engine .sc-info strong { color: var(--gold); }

    .sc-deepdives { border-bottom: 2px solid #22c55e; }
    .sc-deepdives .sc-info strong { color: #22c55e; }

    .sc-certified { border-bottom: 2px solid var(--gold); }
    .sc-certified .sc-info strong { color: var(--gold); }

    .sc-public { border-bottom: 2px solid #3b82f6; }
    .sc-public .sc-info strong { color: #3b82f6; }
}

/* Smaller cards on phones */
@media (max-width: 480px) {
    .stack-card {
        flex: 0 0 160px;
    }

    .stack-card img {
        height: 64px;
    }

    .sc-info {
        padding: 8px 10px;
    }

    .sc-info strong {
        font-size: 0.8rem;
    }

    .sc-info span {
        font-size: 0.65rem;
    }
}
