:root {
    /* Botanical Slate Light Theme (Default) */
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-heading: #0f172a;
    --color-text: #334155;
    --color-primary: #166534;
    --color-accent: #ca8a04;
    --color-border: #e2e8f0;

    /* Theme Overrides via inline styles from Theme Builder */
    
    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --text-base: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem); /* 18px to 20px */
    --text-lg: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
    --text-xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);
    --text-2xl: clamp(1.875rem, 1.6rem + 1.375vw, 2.5rem);
    --text-3xl: clamp(2.25rem, 1.8rem + 2.25vw, 3.25rem);
    --text-4xl: clamp(2.75rem, 2rem + 3.75vw, 4.5rem);

    --measure-max: 70ch;
    --sidebar-width: 340px;
    --container-width: 1200px;
    --radius: 8px;
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.1);
    
    --header-height: 80px;
}

/* Dark Mode Support via class or OS pref */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #020617;
        --color-surface: #0f172a;
        --color-heading: #f8fafc;
        --color-text: #cbd5e1;
        --color-border: #1e293b;
        --color-primary: #4ade80;
        --color-accent: #facc15;
    }
}
:root[data-theme="dark"] {
    --color-bg: #020617;
    --color-surface: #0f172a;
    --color-heading: #f8fafc;
    --color-text: #cbd5e1;
    --color-border: #1e293b;
    --color-primary: #4ade80;
    --color-accent: #facc15;
}

/* Hindi Typography Overrides */
:root:lang(hi) {
    --font-heading: 'Noto Serif Devanagari', serif;
    --font-body: 'Hind', sans-serif;
    --text-base: clamp(1.15rem, 1.05rem + 0.4vw, 1.3rem); /* Slightly larger for Devanagari */
}

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

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.75;
    color: var(--text-color);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:lang(hi) body {
    line-height: 1.95;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    color: var(--color-heading);
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    background: var(--color-surface);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    transition: height 0.3s ease, box-shadow 0.3s ease;
}

header.scrolled {
    height: 60px;
    box-shadow: var(--shadow-subtle);
    border-bottom-color: transparent;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo a {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 900;
    color: var(--color-heading);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
}
.logo img {
    max-height: 40px;
    transition: max-height 0.3s ease;
}
header.scrolled .logo img { max-height: 32px; }

/* Desktop Nav */
.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-menu a {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    position: relative;
}

.nav-menu a:hover, .nav-menu a.active {
    color: var(--color-primary);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    margin-left: 1rem;
}
.theme-toggle:hover { color: var(--color-primary); }

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-heading);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: var(--color-surface);
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.mobile-panel.open { right: 0; }
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-overlay.open { opacity: 1; pointer-events: all; }
.close-menu {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-heading);
    cursor: pointer;
    margin-bottom: 2rem;
}
.mobile-nav-list { list-style: none; display: flex; flex-direction: column; gap: 1.5rem; }
.mobile-nav-list a { font-family: var(--font-heading); font-size: var(--text-xl); font-weight: 700; color: var(--color-heading); }

/* Homepage Layout */
.hero-post {
    margin-top: 3rem;
    margin-bottom: 4rem;
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 3rem;
    align-items: center;
}

.hero-image-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3;
}
.hero-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-post:hover .hero-image-wrap img {
    transform: scale(1.05);
}

.hero-content .category-label {
    color: var(--color-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: inline-block;
}

.hero-content h2 {
    font-size: var(--text-4xl);
    margin-bottom: 1.5rem;
}
.hero-content h2 a:hover { color: var(--color-primary); }

.hero-excerpt {
    font-size: var(--text-lg);
    color: var(--color-text);
    margin-bottom: 2rem;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: var(--text-sm);
}

/* Post Grid */
.section-title {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.post-card {
    background: transparent;
    transition: transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}
.post-card.reveal {
    opacity: 1;
    transform: translateY(0);
}
.post-card:hover {
    transform: translateY(-4px);
}

.post-card .img-wrap {
    aspect-ratio: 16/10;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-subtle);
}

.post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.post-card:hover img { transform: scale(1.03); }

.post-card h3 {
    font-size: var(--text-xl);
    margin: 0.5rem 0 1rem;
}

.post-card p {
    font-size: var(--text-sm);
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.byline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
}
.byline img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Main Layout Wrapper */
.main-layout {
    display: flex;
    gap: 4rem;
    margin-top: 3rem;
}
.content-area { flex: 1; min-width: 0; }
.sidebar { width: var(--sidebar-width); flex-shrink: 0; }

/* Single Post */
.post-header-wrap {
    max-width: var(--measure-max);
    margin: 0 auto 3rem;
    text-align: center;
}

.post-title {
    font-size: var(--text-4xl);
    line-height: 1.1;
    margin: 1.5rem 0;
}

.post-meta-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.post-featured-img {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 3rem;
}

/* Post Content Setup */
.post-layout {
    display: flex;
    gap: 4rem;
    position: relative;
}

.post-toc {
    width: 250px;
    flex-shrink: 0;
}
.post-toc-inner {
    position: sticky;
    top: 100px;
    padding-right: 1rem;
    border-right: 1px solid var(--color-border);
}
.post-toc h4 {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    margin-bottom: 1rem;
}
.post-toc ul {
    list-style: none;
    font-size: var(--text-sm);
}
.post-toc li { margin-bottom: 0.75rem; }
.post-toc a { color: var(--color-text); opacity: 0.8; }
.post-toc a:hover { color: var(--color-primary); opacity: 1; }

.entry-content {
    max-width: var(--measure-max);
    margin: 0 auto;
    font-size: var(--text-base);
}

.entry-content p { margin-bottom: 1.5em; }

.entry-content h2 { font-size: var(--text-3xl); margin: 2em 0 1em; }
.entry-content h3 { font-size: var(--text-2xl); margin: 1.5em 0 0.75em; }

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 2em 0;
}

/* The Editorial Dropcap */
.entry-content > p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-heading);
    font-size: 5.5em;
    line-height: 0.8;
    padding: 0.1em 0.1em 0 0;
    color: var(--color-primary);
    font-weight: 900;
}

/* Reading Progress */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1001;
}
.reading-progress-bar {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
}

/* Footer */
footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 5rem 0 2rem;
    margin-top: 6rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-widget h3 {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.footer-widget p { font-size: var(--text-sm); }
.footer-widget ul { list-style: none; font-size: var(--text-sm); }
.footer-widget li { margin-bottom: 0.75rem; }
.footer-widget a:hover { color: var(--color-primary); }

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text);
    opacity: 0.7;
}

/* Sidebar Widgets */
.widget {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-subtle);
}
.widget-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.75rem;
}
.widget ul { list-style: none; }
.widget li { margin-bottom: 1rem; border-bottom: 1px dashed var(--color-border); padding-bottom: 1rem; }
.widget li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.widget a:hover { color: var(--color-primary); }

/* Buttons & Elements */
.btn {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--color-accent); transform: translateY(-2px); }

/* Form Elements */
input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    .main-layout, .post-layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .post-toc { display: none; }
    .hero-post { grid-template-columns: 1fr; gap: 2rem; }
    .hero-image-wrap { aspect-ratio: 16/9; }
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .mobile-menu-btn { display: block; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
    .posts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .post-meta-bar { flex-direction: column; gap: 1rem; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; transform: none !important; animation: none !important; }
}

/* =====================================================
   PHASE 2: Category Profile Design Tokens
   ===================================================== */

/* Dropcap — activated by .dropcap on .entry-content */
.entry-content.dropcap > p:first-of-type::first-letter {
    font-family: var(--font-heading);
    font-size: 4.5em;
    font-weight: 900;
    color: var(--color-primary);
    float: left;
    line-height: 0.8;
    margin: 0.05em 0.12em 0 0;
    padding: 0.05em 0;
}

/* Anti-CLS Ad Slot: contain prevents layout recalculation on load */
.ad-slot {
    width: 100%;
    overflow: hidden;
    contain: layout size;
    box-sizing: border-box;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0;
    margin: 2.5rem 0;
    text-align: center;
}
.ad-label {
    display: block;
    font-size: 10px;
    color: var(--color-text);
    opacity: 0.5;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

/* Quick Read AEO Box */
.quick-read-box { contain: content; }

/* High Density — News profile */
.layout-density-high .posts-grid { gap: 1rem; }
.layout-density-high .post-card .post-details { padding: 0.75rem; }
.layout-density-high h2, .layout-density-high h3 { line-height: 1.2; }

/* Relaxed Density — Finance/Legal profile */
.layout-density-relaxed .entry-content {
    font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
    line-height: 1.9;
    max-width: 65ch;
}
.layout-density-relaxed .post-layout { gap: 5rem; }

/* E-E-A-T and share mobile */
@media (max-width: 640px) {
    .eeat-anchor-top { flex-direction: column; align-items: flex-start; }
    .share-under-headline { flex-wrap: wrap; }
    .post-share-end { flex-direction: column; align-items: flex-start; }
}

/* =====================================================
   PHASE 3: Breaking News Ticker
   ===================================================== */
.breaking-ticker {
    display: flex;
    align-items: center;
    background: var(--color-primary);
    color: #fff;
    height: 38px;
    overflow: hidden;
    position: relative;
    contain: layout;
    font-size: var(--text-sm);
    font-weight: 600;
    z-index: 90;
}
.ticker-label {
    flex-shrink: 0;
    background: #dc2626;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    gap: 6px;
}
.ticker-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: ticker-pulse 1.2s ease-in-out infinite;
}
@keyframes ticker-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.3; transform: scale(0.7); }
}
.ticker-track { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; }
.ticker-items {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 40s linear infinite;
    will-change: transform;
}
.breaking-ticker:hover .ticker-items { animation-play-state: paused; }
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.ticker-item {
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 0 24px;
    transition: opacity 0.2s;
    font-weight: 500;
}
.ticker-item:hover { opacity: 0.8; text-decoration: underline; }
.ticker-sep { margin-left: 24px; opacity: 0.5; }

@media (prefers-reduced-motion: reduce) {
    .ticker-items { animation: none; }
    .ticker-label::before { animation: none; }
}