/* Magazine Publications Frontend Styles - Editorial Layout */
.magazine-publications-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px 40px 20px;
}

/* Remove outline on targeted sections */
.mag-section:target {
    outline: none;
}

/* Remove focus outline on sections */
.mag-section:focus {
    outline: none;
}

/* Full width sections that break out of container */
.full-width-section {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Story link wrapper - makes entire story clickable */
.story-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.story-link:hover {
    opacity: 0.9;
}

.story-link:visited {
    color: inherit;
}

/* Smooth scrolling for the page */
html {
    scroll-behavior: smooth;
}

/* Section spacing */
.mag-section {
    margin-bottom: 60px;
}

/* Section 2 specific spacing - reduce bottom margin */
.mag-section.section-2 {
    margin-bottom: -20px;
}

/* Section titles */
.section-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: #000;
    text-align: left;
}

.carousel-section-title {
    padding: 20px 20px 0 20px;
}

.grid-section-title {
    padding: 20px 0 0 0;
    text-align: left;
}

/* ===== SECTION 1: Hero Layout ===== */
.section-1-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
}

/* Vertical separator between hero and sidebar */
.section-1-grid::before {
    content: '';
    position: absolute;
    left: calc(50% - 0.5px);
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e8e8e8;
    z-index: 1;
}

.hero-main {
    width: 100%;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.hero-story {
    position: relative;
    height: fit-content;
}

.hero-story .story-keyword {
    display: block;
    color: #666;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.hero-story .story-image {
    width: 100%;
    margin-bottom: 20px;
}

.hero-story .story-image img {
    width: 100%;
    height: auto;
    display: block;
}

.hero-story .story-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 15px 0;
    color: #000;
}

.hero-story .story-title a {
    text-decoration: none;
    color: inherit;
}

.hero-story .story-title a:hover {
    color: #333;
}

.hero-story .story-description {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin: 0 0 15px 0;
}

.hero-story .reading-time {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Hero Sidebar */
.hero-sidebar {
    width: 100%;
    min-height: 120vh;
}

.sidebar-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding-bottom: 60px;
    position: relative;
}

/* Vertical separator between sidebar columns */
.sidebar-columns::before {
    content: '';
    position: absolute;
    left: calc(50% - 0.5px);
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e8e8e8;
    z-index: 1;
}

.sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.sidebar-story {
    position: relative;
    padding-bottom: 20px;
}

.sidebar-story:not(:last-child) {
    border-bottom: 1px solid #000000;
    margin-bottom: 40px;
}

.sidebar-story .story-keyword {
    display: block;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.sidebar-story .story-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px 0;
    color: #000;
}

.sidebar-story .story-title a {
    text-decoration: none;
    color: inherit;
}

.sidebar-story .story-title a:hover {
    color: #333;
}

.sidebar-story .story-image {
    width: 100%;
    margin-bottom: 12px;
}

.sidebar-story .story-image img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-story .reading-time {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar story separators */
.sidebar-separator {
    width: 100%;
    height: 1px;
    margin: -45px 0 -35px 0;
    background-color: #cccccc;
}

/* ===== SECTION 2: Carousel ===== */
.section-2 {
    padding: 30px 0 0 0;
    margin-top: 50px;
    border-top: 3px solid #000000;
}

.carousel-container {
    position: relative;
    padding: 20px 0;
}

.carousel-wrapper {
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: grid;
    grid-template-columns: repeat(8, 25%); /* 8 stories total, 4 visible at once */
    transition: transform 0.3s ease;
    width: 100%;
}

.carousel-story {
    position: relative;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Vertical separators between carousel stories - only visible ones */
.carousel-story::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: var(--carousel-separator-height, calc(100% - 15px));
    width: 1px;
    background-color: black;
}

/* Remove separator from every 4th story (last in view) */
.carousel-track > a:nth-child(4n) .carousel-story::after {
    display: none !important;
}

.carousel-story .story-keyword {
    display: block;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.carousel-story .story-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    color: #000;
}

.carousel-story .story-title a {
    text-decoration: none;
    color: inherit;
}

.carousel-story .story-title a:hover {
    color: #333;
}

.carousel-story .story-image {
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
    overflow: hidden;
    background-color: #e9e9e9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-story .story-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.carousel-story .reading-time {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.carousel-nav:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.9);
}

.carousel-nav:disabled {
    background: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

/* ===== SECTION 3: Featured Story ===== */
.section-3 {
    padding: 30px 0 0 0;
    margin-top: 50px;
    margin-bottom: 0;
    border-top: 3px solid #000000;
}

.featured-story {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.featured-story .story-keyword {
    display: block;
    color: #666;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.featured-story .story-title {
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #000;
    line-height: 1.2;
}

.featured-story .story-title a {
    text-decoration: none;
    color: inherit;
}

.featured-story .story-title a:hover {
    color: #333;
}

.featured-story .story-description {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
    margin: 0 0 20px 0;
}

.featured-story .reading-time {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 25px;
}

.featured-story .story-image {
    width: 100%;
    margin-bottom: 30px;
}

.featured-story .story-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== SECTION 4: Grid Layout ===== */
.section-4 {
    padding: 30px 0 0 0;
    margin-top: 50px;
    border-top: 3px solid #000000;
}

.grid-4x2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid #000000;
    background-image:
        linear-gradient(90deg, transparent 25%, #000000 25%, #000000 calc(25% + 1px), transparent calc(25% + 1px)),
        linear-gradient(90deg, transparent 50%, #000000 50%, #000000 calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(90deg, transparent 75%, #000000 75%, #000000 calc(75% + 1px), transparent calc(75% + 1px));
}

.grid-story {
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.grid-story .story-keyword {
    display: block;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    height: 20px;
    margin-top: 5px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.grid-story .story-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
    color: #000;
    flex-shrink: 0;
}

.grid-story .story-title a {
    text-decoration: none;
    color: inherit;
}

.grid-story .story-title a:hover {
    color: #333;
}

.grid-story .story-description {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0 0 10px 0;
    flex: 1;
}

.grid-story .reading-time {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 20px;
    margin-top: auto;
    flex-shrink: 0;
}

.grid-story .story-image {
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
    flex-shrink: 0;
    overflow: hidden;
    background-color: #e9e9e9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-story .story-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ===== SECTION 5: Newsletter CTA ===== */
.section-5 {
    padding: 60px 40px;
    margin-top: 60px;
    border-top: 3px solid #000000;
}

.newsletter-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 60px;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.newsletter-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.newsletter-image img {
    width: 100%;
    height: auto;
    max-width: 400px;
}

.newsletter-content {
    color: #000;
}

.newsletter-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #000;
    line-height: 1.3;
}

.newsletter-subtitle {
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 30px 0;
    color: #333;
}

.newsletter-form {
    max-width: 500px;
}

.newsletter-form iframe {
    width: 100%;
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .section-1-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .section-1-grid::before {
        display: none;
    }

    .hero-main {
        position: static;
        max-height: none;
    }

    .hero-sidebar {
        min-height: auto;
    }

    .sidebar-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding-bottom: 0;
    }

    .sidebar-col {
        gap: 40px;
    }

    .sidebar-story:not(:last-child) {
        margin-bottom: 20px;
    }

    /* Carousel stays at 4 columns until 768px */

    .grid-4x2 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .magazine-publications-container {
        padding: 20px 10px;
    }

    .magazine-publications-container .publications-title {
        font-size: clamp(24px, 8vw, 40px) !important;
        letter-spacing: 1px !important;
    }

    .hero-story .story-title {
        font-size: 28px;
    }

    /* Add separator line under hero story on mobile only */
    .hero-story {
        border-bottom: 1px solid #000000;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }

    .sidebar-columns {
        grid-template-columns: 1fr;
    }

    .sidebar-columns::before {
        display: none;
    }

    /* Add horizontal separator between sidebar column groups on mobile */
    .sidebar-col:first-child {
        border-bottom: 1px solid #000000;
        margin-bottom: -10px;
    }

    .sidebar-col:last-child {
        margin-top: -10px;
    }

    /* Carousel mobile: 1 story visible at a time */
    .carousel-track {
        grid-template-columns: repeat(8, 100%); /* 8 stories total, 1 visible */
    }

    .carousel-story::after {
        display: none; /* Remove all separators on mobile */
    }

    .grid-4x2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        border: none;
        background-image: none;
    }

    .grid-story {
        border: 2px solid #000000; /* Default color, will be overridden by dynamic styles */
    }

    .newsletter-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .featured-story .story-title {
        font-size: 32px;
    }

    .newsletter-title {
        font-size: clamp(20px, 6vw, 26px);
    }
}

@media (max-width: 480px) {
    .magazine-publications-container .publications-title {
        font-size: clamp(20px, 7vw, 32px) !important;
        letter-spacing: 0.5px !important;
    }

    /* Carousel already handled by 768px breakpoint */

    .grid-4x2 {
        grid-template-columns: 1fr;
    }

    .hero-story .story-title {
        font-size: 24px;
    }

    .featured-story .story-title {
        font-size: 28px;
    }

    .section-5 {
        padding: 40px 20px;
    }
}