:root {
    --primary-dark: #1a1a1a;
    --primary-light: #f4f1ea;
    --accent-gold: #d4af37;
    --accent-earth: #8b5a2b;
    --text-main: #333333;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: #1a1a1a;
    background-image: url('assets/images/body_bg.png');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 5rem;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 8, 3, 0.78);
    z-index: 0;
    pointer-events: none;
}

/* Sticky Top Ticker */
.agri-ticker {
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--accent-gold);
    color: var(--primary-dark);
    z-index: 1000;
    overflow: hidden;
    padding: 0.6rem 0;
    display: flex;
    align-items: center;
}

.agri-ticker .ticker-label {
    background: var(--primary-dark);
    color: var(--accent-gold);
    font-weight: 700;
    padding: 0.3rem 1.5rem;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticker-track {
    display: flex;
    animation: ticker 35s linear infinite;
    white-space: nowrap;
}

.ticker-track span {
    padding: 0 3rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.ticker-track span::before {
    content: '🌾 ';
}

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

/* Page top banner */
.page-banner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1f1a0e 100%);
    border: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    margin-top: 2rem;
    margin-bottom: 0;
}

.page-banner .banner-left {
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--accent-gold);
    font-size: 1rem;
}

.page-banner .banner-center {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: white;
    letter-spacing: 1px;
}

.page-banner .banner-right {
    font-size: 0.8rem;
    color: #aaa;
    text-align: right;
}

/* Section label above each magazine */
.mag-label {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
    margin-top: 2.5rem;
    padding: 0 0.5rem;
}

.mag-label span.lang-badge {
    background: var(--accent-gold);
    color: var(--primary-dark);
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 2px;
}

.mag-label span.lang-title {
    color: white;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-style: italic;
}

.mag-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(212,175,55,0.4), transparent);
}

/* Divider between two magazines */
.mag-divider {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 4rem 0;
}

.mag-divider::before, .mag-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(212,175,55,0.35);
}

.mag-divider .divider-text {
    color: var(--accent-gold);
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
    white-space: nowrap;
}

/* Bottom agriculture footer */
.agri-footer {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    margin-top: 4rem;
    border-top: 1px solid rgba(212,175,55,0.3);
    padding-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.agri-footer .foot-col {
    color: #bbb;
}

.agri-footer .foot-col h4 {
    color: var(--accent-gold);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(212,175,55,0.2);
}

.agri-footer .foot-col p {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.agri-footer-bottom {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    text-align: center;
    color: #555;
    font-size: 0.8rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 2rem;
}

.demo-header {
    text-align: center;
    color: white;
    margin-bottom: 0;
    margin-top: 0;
    display: none;
}

.magazine-viewport {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 3D Flipbook Core */
.magazine {
    position: relative;
    width: 900px;
    height: 600px;
    perspective: 2500px;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    background: var(--primary-dark);
}

/* The static left page / Farmers Reference */
.static-left-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background-color: var(--primary-dark);
    color: var(--primary-light);
    z-index: 0;
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.static-left-page h3 {
    color: var(--accent-gold);
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 0.5rem;
}

.static-left-page ul {
    list-style: none;
}

.static-left-page ul li {
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 0.95rem;
    line-height: 1.4;
}

.static-left-page ul li strong {
    color: var(--accent-gold);
    display: block;
    margin-bottom: 0.2rem;
}

.sheet {
    position: absolute;
    width: 50%;
    height: 100%;
    right: 0;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-origin: left center;
}

.sheet.flipped {
    transform: rotateY(-180deg);
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background-color: var(--primary-light);
    overflow: hidden;
}

.page.front {
    transform: rotateY(0deg);
    border-right: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.05);
}

.page.back {
    transform: rotateY(180deg);
    border-left: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 5px 0 15px rgba(0,0,0,0.05);
}

/* Page Content Styling */
.content-wrapper {
    padding: 3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Simulate the inner spine (gutter) of the book */
.page.front .content-wrapper {
    padding: 3rem 3rem 3rem 4.5rem;
}

.page.back .content-wrapper {
    padding: 3rem 4.5rem 3rem 3rem;
}

.centered {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.page-number {
    position: absolute;
    bottom: 2rem;
    font-size: 0.8rem;
    color: #888;
}

.page.front .page-number { right: 3rem; }
.page.back .page-number { left: 3rem; }

.section-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    line-height: 1.2;
}

.text-gold { color: var(--accent-gold); }
.text-earth { color: var(--accent-earth); }
.text-center { text-align: center; }

/* Typographic Elements */
.verse {
    font-size: 1.1rem;
    line-height: 2;
    text-align: justify;
    margin-bottom: 1.5rem;
}

.util {
    font-size: 1rem;
    line-height: 1.6;
    text-align: justify;
    margin-bottom: 1.2rem;
}

.telugu-text {
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: justify;
}

/* Special Pages */
.cover-page {
    position: relative;
    color: white;
}

.cover-bg {
    position: absolute;
    top:0; left:0; width:100%; height:100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.cover-bg::after {
    content: '';
    position: absolute;
    top:0; left:0; width:100%; height:100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.8));
}

.cover-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 3rem;
}

.cover-content .title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.cover-content .subtitle {
    color: var(--accent-gold);
    font-size: 1.2rem;
    font-style: italic;
    margin-bottom: 1rem;
}

.issue-number {
    font-size: 0.8rem;
    letter-spacing: 2px;
    border-top: 1px solid rgba(255,255,255,0.3);
    padding-top: 1rem;
}

.dark-bg {
    background-color: var(--primary-dark);
    color: var(--primary-light);
}

.highlight-bg {
    background-color: var(--accent-earth);
    color: white;
}

/* Imagery */
.image-bleed { padding: 0; }
.bg-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

/* Utilities inside pages */
.infographic {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.infographic .box {
    background: white;
    padding: 2rem 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    flex: 1;
}

.infographic .box.highlight {
    background: var(--accent-gold);
    color: white;
}

.infographic h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.spec-list {
    list-style: none;
    margin-top: 1rem;
}

.spec-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.steps h4 {
    color: var(--accent-earth);
    margin: 1.2rem 0 0.5rem 0;
}

.event-card {
    background: rgba(255,255,255,0.1);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
}

.event-card h2 {
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

/* Controls */
.magazine-controls {
    margin-top: 3rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    background: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.magazine-controls button {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    transition: all 0.3s;
}

.magazine-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.magazine-controls button:not(:disabled):hover {
    background: var(--accent-gold);
}

.pageCounter {
    font-weight: 600;
    color: var(--primary-dark);
    min-width: 150px;
    text-align: center;
}

/* =============================================
   RESPONSIVE / MOBILE STYLES
   ============================================= */

/* --- Tablet (900px and below) --- */
@media (max-width: 960px) {
    .page-banner {
        max-width: 96vw;
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .page-banner .banner-center { font-size: 1.2rem; }

    .mag-label, .mag-divider, .agri-footer, .agri-footer-bottom {
        max-width: 96vw;
    }

    /* Scale down the full flipbook to fit screen */
    .magazine {
        width: 96vw;
        height: calc(96vw * 0.667); /* keep 3:2 ratio */
        transform-origin: top center;
    }

    .magazine-controls {
        gap: 1rem;
        padding: 0.8rem 1.2rem;
    }
}

/* --- Mobile (below 640px): Switch to single-page card mode --- */
@media (max-width: 640px) {

    /* Ticker: smaller text */
    .agri-ticker { padding: 0.4rem 0; }
    .agri-ticker .ticker-label { padding: 0.3rem 0.8rem; font-size: 0.75rem; }
    .ticker-track span { font-size: 0.78rem; padding: 0 1.5rem; }

    /* Banner: stack vertically */
    .page-banner {
        flex-direction: column;
        text-align: center;
        gap: 0.2rem;
        padding: 1rem;
    }
    .page-banner .banner-right { text-align: center; }

    /* Mag label: smaller */
    .mag-label { margin-top: 1.5rem; }
    .mag-label span.lang-title { font-size: 1rem; }

    /* Divider: smaller text */
    .mag-divider .divider-text { font-size: 0.9rem; }

    /* ---- FLIPBOOK → SINGLE-PAGE CARD MODE ---- */
    .magazine {
        /* Remove fixed 3D perspective size — each page becomes a card */
        width: 96vw;
        height: 72vw;        /* 4:3 card ratio on mobile */
        perspective: none;
        background: transparent;
        box-shadow: none;
    }

    /* In mobile mode each sheet occupies the whole box */
    .magazine.mobile-mode .sheet {
        width: 100%;
        right: 0;
        transition: none;
        transform: none !important;
    }

    /* Mobile: only show the active page's FRONT, hide all others */
    .magazine.mobile-mode .sheet {
        display: none;
    }
    .magazine.mobile-mode .sheet.mobile-active {
        display: block;
    }

    /* In mobile mode the visible page fills the whole card */
    .magazine.mobile-mode .page.front {
        width: 100%;
        height: 100%;
        transform: none;
        border: none;
        box-shadow: 0 8px 30px rgba(0,0,0,0.4);
        border-radius: 4px;
    }

    /* Hide back pages and static panel in mobile mode */
    .magazine.mobile-mode .page.back,
    .magazine.mobile-mode .static-left-page {
        display: none;
    }

    /* Mobile: remove gutter, use uniform padding */
    .magazine.mobile-mode .page.front .content-wrapper,
    .magazine.mobile-mode .page.back .content-wrapper {
        padding: 1.4rem 1.4rem 2.5rem 1.4rem;
    }

    /* Scale fonts down slightly inside mobile pages */
    .magazine.mobile-mode .section-title { font-size: 1.3rem; margin-bottom: 1rem; }
    .magazine.mobile-mode .util { font-size: 0.88rem; line-height: 1.6; margin-bottom: 0.8rem; }
    .magazine.mobile-mode .telugu-text { font-size: 0.85rem; }
    .magazine.mobile-mode .spec-list li { padding: 0.5rem 0; font-size: 0.88rem; }
    .magazine.mobile-mode .steps h4 { margin: 0.8rem 0 0.3rem 0; }
    .magazine.mobile-mode .page-number { bottom: 0.6rem; font-size: 0.7rem; }
    .magazine.mobile-mode .infographic { gap: 0.5rem; margin: 1rem 0; }
    .magazine.mobile-mode .infographic h1 { font-size: 1.8rem; }

    /* Farmer reference: now a visible strip above the magazine */
    .mobile-ref-strip {
        display: block !important;
        width: 96vw;
        background: var(--primary-dark);
        border: 1px solid rgba(212,175,55,0.2);
        padding: 1rem 1.2rem;
        margin-bottom: 0;
        color: var(--primary-light);
    }

    .mobile-ref-strip h3 {
        color: var(--accent-gold);
        font-family: var(--font-heading);
        font-size: 1rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid rgba(212,175,55,0.3);
        padding-bottom: 0.3rem;
    }

    .mobile-ref-strip .ref-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 1rem;
    }

    .mobile-ref-strip .ref-grid span {
        font-size: 0.78rem;
        color: #bbb;
    }

    .mobile-ref-strip .ref-grid span strong {
        color: var(--accent-gold);
        display: block;
    }

    /* Controls: smaller, full width */
    .magazine-controls {
        width: 96vw;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.7rem 1rem;
        margin-top: 1.2rem;
    }

    .magazine-controls button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .pageCounter {
        min-width: unset;
        font-size: 0.85rem;
    }

    /* Footer: stack to single column */
    .agri-footer {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .agri-footer .foot-col h4 { font-size: 1rem; }
    .agri-footer .foot-col p { font-size: 0.85rem; }
    .agri-footer-bottom { font-size: 0.75rem; padding: 1rem 0; }

    /* Cover title in mobile */
    .cover-content .title { font-size: 2rem; }
    .cover-content .subtitle { font-size: 0.95rem; }

    /* Dark/highlight page text colors */
    .dark-bg .section-title { color: var(--accent-gold); }

    /* Event card */
    .event-card { padding: 1rem; }
    .event-card h2 { font-size: 1.2rem; }
}

/* Hide mobile ref strip on desktop */
.mobile-ref-strip { display: none; }
