@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

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

:root {
    --bg-color: #f5f5f5;
    --text-color: #1a1a1a;
    --accent-color: #0052cc;
    --border-color: #e0e0e0;
    --hover-bg: #e8e8e8;
    --grid-line: rgba(0, 82, 204, 0.05);
    --grid-dot: rgba(0, 82, 204, 0.09);

    /* Updated to match main CSS */
    --nav-font-size: 1.7rem;
    --title-font-size: 1.8rem;
    --content-font-size: 1rem;
}

[data-theme="dark"] {
    --bg-color: #0f0f0f;
    --text-color: #e0e0e0;
    --accent-color: #ff9500;
    --border-color: #2a2a2a;
    --hover-bg: #1a1a1a;
    --grid-line: rgba(255, 149, 0, 0.05);
    --grid-dot: rgba(255, 149, 0, 0.09);
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        radial-gradient(var(--grid-dot) 1px, transparent 1px);
    background-size: 32px 32px, 32px 32px, 32px 32px;
    background-position: -1px -1px, -1px -1px, -1px -1px;
    background-attachment: fixed;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem 1.5rem;
    font-size: 17px;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Blog Page Container */
.blog-page-container {
    position: relative;
    min-height: 100vh;
}

/* Theme Toggle Container - Positioned at top right */
.blog-theme-toggle-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
}

/* Dark Mode Toggle - Engraved Colorless Button - Updated to match main CSS */
.theme-toggle {
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
    
    /* Engraved effect */
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.15),
        inset -2px -2px 4px rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .theme-toggle {
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover {
    transform: scale(0.95);
}

.theme-toggle:active {
    transform: scale(0.9);
}

.theme-icon {
    width: 24px;
    height: 24px;
    position: relative;
}

/* Sun icon - colorless */
.theme-icon.sun {
    background: var(--text-color);
    border-radius: 50%;
    opacity: 0.6;
}

.theme-icon.sun::before,
.theme-icon.sun::after {
    content: '';
    position: absolute;
    background: var(--text-color);
    opacity: 0.6;
}

.theme-icon.sun::before {
    width: 2px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.theme-icon.sun::after {
    width: 30px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Moon icon - colorless */
.theme-icon.moon {
    background: transparent;
    border-radius: 50%;
    position: relative;
    width: 22px;
    height: 22px;
    box-shadow: 
        inset -4px -2px 0 0 var(--text-color);
    opacity: 0.6;
}

/* Page transitions */
.page {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
section {
    margin: 4rem 0;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 900;
    line-height: 1.2;
}

h2 {
    font-size: var(--title-font-size);
    margin: 2rem 0 1.5rem;
    font-weight: 700;
}

h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem;
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
}

strong {
    font-weight: 700;
    display: inline;
    font-size: inherit;
}

em {
    font-style: italic;
    color: #666;
}

[data-theme="dark"] em {
    color: #999;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

/* Blog Post Styles */
.blog-post {
    margin-top: 3rem;
    margin-bottom: 4rem;
}

.back-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2rem;
    transition: opacity 0.2s ease, color 0.5s ease;
}

.back-link:hover {
    opacity: 0.7;
}

.blog-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    transition: border-color 0.5s ease;
}

.blog-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.2;
    transition: color 0.5s ease;
}

.blog-meta {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    transition: color 0.5s ease;
}

[data-theme="dark"] .blog-meta {
    color: #999;
}

.blog-content {
    line-height: 1.8;
}

.blog-content h2 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    transition: color 0.5s ease;
}

.blog-content h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    transition: color 0.5s ease;
}

.blog-content p {
    margin-bottom: 1.5rem;
    transition: color 0.5s ease;
}

.blog-content ul,
.blog-content ol {
    margin: 1.5rem 0;
    padding-left: 0;
    list-style: none;
}

.blog-content li {
    padding-left: 2rem;
    position: relative;
    line-height: 1.7;
    transition: color 0.5s ease;
}

.blog-content ul li::before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    font-weight: bold;
    color: var(--accent-color);
    transition: color 0.5s ease;
}

.blog-content ol {
    counter-reset: item;
}

.blog-content ol li {
    counter-increment: item;
}

.blog-content ol li::before {
    content: counter(item) ".";
    position: absolute;
    left: 0.5rem;
    font-weight: bold;
    color: var(--accent-color);
    transition: color 0.5s ease;
}

.blog-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--hover-bg);
    border-left: 4px solid var(--accent-color);
    border-radius: 4px;
    font-style: italic;
    color: #555;
    transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

[data-theme="dark"] .blog-content blockquote {
    color: #bbb;
}

.blog-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    transition: border-color 0.5s ease;
}

.blog-footer p {
    color: #666;
    font-size: 0.95rem;
    transition: color 0.5s ease;
}

[data-theme="dark"] .blog-footer p {
    color: #999;
}

.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    transition: border-color 0.5s ease;
}

.comments-section h3 {
    margin-top: 0;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* Highlighted sections */
.highlight-section {
    background: var(--hover-bg);
    padding: 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 2rem 0;
    transition: background 0.5s ease, border-color 0.5s ease;
}

.highlight-section h3 {
    margin-top: 0;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1px;
    transition: color 0.5s ease;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    transition: border-color 0.5s ease, color 0.5s ease;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.2s ease, color 0.5s ease;
}

footer a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

[data-theme="dark"] footer {
    color: #999;
}

/* Responsive Design - Updated to match main CSS */
@media (max-width: 768px) {
    :root {
        --nav-font-size: 1.4rem;
        --title-font-size: 1.5rem;
        --content-font-size: 1rem;
    }
    
    body {
        padding: 0 1rem 1.5rem 1rem;
        font-size: 16px;
    }
    
    .blog-theme-toggle-container {
        top: 1.5rem;
        right: 1.5rem;
    }
    
    .theme-toggle {
        width: 46px;
        height: 46px;
    }
    
    .theme-icon {
        width: 23px;
        height: 23px;
    }
    
    .theme-icon.sun::before {
        height: 28px;
    }
    
    .theme-icon.sun::after {
        width: 28px;
    }
    
    .theme-icon.moon {
        width: 21px;
        height: 21px;
    }
    
    .blog-title {
        font-size: 2rem;
    }
    
    .blog-content h2 {
        font-size: 1.4rem;
    }
    
    .blog-content blockquote {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 600px) {
    :root {
        --nav-font-size: 1.3rem;
        --title-font-size: 1.4rem;
        --content-font-size: 0.95rem;
    }
    
    .blog-theme-toggle-container {
        top: 1rem;
        right: 1rem;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
    }
    
    .theme-icon.sun::before {
        height: 27px;
    }
    
    .theme-icon.sun::after {
        width: 27px;
    }
    
    .theme-icon.moon {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    :root {
        --nav-font-size: 1.1rem;
        --title-font-size: 1.3rem;
        --content-font-size: 0.95rem;
    }
    
    body {
        padding: 0 0.75rem 1rem 0.75rem;
        font-size: 15px;
    }
    
    .blog-theme-toggle-container {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
    
    .theme-icon {
        width: 20px;
        height: 20px;
    }
    
    .theme-icon.sun::before {
        height: 25px;
    }
    
    .theme-icon.sun::after {
        width: 25px;
    }
    
    .theme-icon.moon {
        width: 18px;
        height: 18px;
    }
    
    .blog-title {
        font-size: 1.75rem;
    }
    
    .blog-content h2 {
        font-size: 1.3rem;
    }
    
    .blog-content blockquote {
        padding: 1rem;
        margin: 1.5rem 0;
    }
}

@media (max-width: 360px) {
    :root {
        --nav-font-size: 1.2rem;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
    }
    
    .theme-icon.sun::before {
        height: 27px;
    }
    
    .theme-icon.sun::after {
        width: 27px;
    }
    
    .theme-icon.moon {
        width: 20px;
        height: 20px;
    }
}

::selection {
    background: var(--hover-bg);
    color: var(--text-color);
}

.blog-image {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin: 1.5rem auto;
}

.blog-image-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.blog-image-row .blog-image {
    margin: 0;
    width: calc(33.333% - 0.667rem);
    height: 220px;
    padding: 0.5rem;
    background: var(--hover-bg);
    object-fit: contain;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .blog-image-row {
        flex-direction: column;
    }

    .blog-image-row .blog-image {
        width: 100%;
    }
}

/* ---- Hero image slot (placeholder until an image is added) ---- */
.blog-hero {
    margin: 0 0 2.5rem;
}

.blog-hero img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.blog-hero-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 260px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    color: #999;
    font-style: italic;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* ---- Epigraph under the title ---- */
.blog-epigraph {
    text-align: center;
    font-style: italic;
    font-size: 1.25rem;
    color: #666;
    letter-spacing: 0.3px;
    margin: 0 0 2.5rem;
    transition: color 0.5s ease;
}

[data-theme="dark"] .blog-epigraph {
    color: #999;
}

/* ---- Drop cap on the opening paragraph ---- */
.first-para::first-letter {
    -webkit-initial-letter: 2;
    initial-letter: 2;
    margin-right: 0.5rem;
    font-weight: 700;
    color: var(--accent-color);
    transition: color 0.5s ease;
}

/* ---- Section dividers (ornament above every heading but the first) ---- */
.blog-content h2:not(:first-of-type)::before {
    content: "* * *";
    display: block;
    text-align: center;
    color: var(--accent-color);
    letter-spacing: 0.5em;
    font-weight: 400;
    opacity: 0.5;
    margin-bottom: 2.5rem;
    transition: color 0.5s ease;
}

/* ---- Pull-quote (distinct from the bordered blockquote) ---- */
.blog-content blockquote.pull-quote {
    border-left: none;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    background: none;
    border-radius: 0;
    text-align: center;
    font-size: 1.5rem;
    line-height: 1.4;
    font-weight: 500;
    font-style: italic;
    color: var(--text-color);
    max-width: 90%;
    padding: 1.25rem 1.5rem;
    margin: 2.5rem auto;
    transition: color 0.5s ease, border-color 0.5s ease;
}

/* ---- Priority list as a numbered stack ---- */
.blog-content ol.priority-list {
    list-style: none;
    counter-reset: priority;
    padding-left: 0;
    margin: 1.5rem 0;
}

.blog-content ol.priority-list li {
    counter-increment: priority;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--hover-bg);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.5s ease, border-color 0.5s ease;
}

.blog-content ol.priority-list li::before {
    content: counter(priority);
    position: static;
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 1.5rem;
    text-align: center;
}