@font-face {
    font-family: 'Harmond Display';
    src: url('fonts/Harmond-SemiBoldCondensed.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Harmond Display';
    src: url('fonts/Harmond-SemBdItaCond.otf') format('opentype');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Harmond Display';
    src: url('fonts/Harmond-ExtraBoldExpanded.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

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

:root {
    /* Dark mode (default) */
    --bg-primary: #0a0e14;
    --bg-secondary: #11151d;
    --text-primary: #d4d9e0;
    --text-secondary: #8b95a6;
    --accent-teal: #4a9b8e;
    --accent-purple: #7a6b9a;
    --accent-green: #5a8a6f;
    --accent-muted: #6b7a8a;
    --line-color: #2a3441;
    --glow-color: rgba(74, 155, 142, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f8f7f4;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent-teal: #4a9b8e;
    --accent-purple: #7a6b9a;
    --accent-green: #5a8a6f;
    --accent-muted: #999999;
    --line-color: #e0e0e0;
    --glow-color: rgba(74, 155, 142, 0.2);
}

body {
    font-family: 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.8;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    background: rgba(17, 21, 29, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
}

[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.8);
}

.theme-toggle:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: var(--accent-teal);
}

.theme-icon {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-light {
    display: none;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}

[data-theme="light"] .theme-icon-light {
    display: block;
}

.blog-nav {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1000;
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    font-weight: 400;
}

.nav-link:hover {
    color: var(--accent-teal);
}

/* Hamburger menu button (mobile only) */
.nav-toggle {
    display: none;
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1001;
    background: rgba(17, 21, 29, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
}

[data-theme="light"] .nav-toggle {
    background: rgba(255, 255, 255, 0.8);
}

.nav-toggle:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: var(--accent-teal);
}

.hamburger {
    width: 20px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.active .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav menu */
.nav-menu {
    display: none;
    position: fixed;
    top: 5rem;
    left: 2rem;
    z-index: 1000;
    background: rgba(17, 21, 29, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line-color);
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 120px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .nav-menu {
    background: rgba(255, 255, 255, 0.95);
}

.nav-menu.active {
    opacity: 1;
    transform: translateY(0);
}

.nav-menu .nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.nav-menu .nav-link:hover {
    background: var(--bg-secondary);
}

.nav-menu .nav-link + .nav-link {
    margin-top: 0.25rem;
}

/* Mobile nav styling */
@media (max-width: 768px) {
    .blog-nav {
        display: none;
    }

    .nav-toggle {
        display: flex;
        top: 1.5rem;
        left: 1.5rem;
    }

    .nav-menu {
        display: block;
        top: 4.5rem;
        left: 1.5rem;
    }
}

.blog-post {
    max-width: 700px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
    position: relative;
}

.post-header {
    margin-bottom: 4rem;
    position: relative;
}

.post-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: lowercase;
    margin-bottom: 2rem;
    font-style: italic;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.post-meta.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-title {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.post-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-part {
    display: inline-block;
}

.title-image-wrapper {
    position: relative;
    display: inline-block;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border: 1px solid var(--line-color);
    margin: 0 0.5rem;
    overflow: hidden;
}

.title-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-purple));
    opacity: 0.1;
    transition: opacity 0.3s ease;
}

.title-word {
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    font-weight: 800;
}

.post-attribution {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

.post-attribution.visible {
    opacity: 0.6;
    transform: translateY(0);
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.9;
}

.post-content p {
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content p.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-content h2 {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    font-style: normal;
    margin: 3rem 0 1.5rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content h2.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-content em {
    font-style: italic;
    color: var(--accent-teal);
}

/* Images with captions */
.post-figure {
    margin: 3rem 0;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-figure.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-figure img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--line-color);
    background: var(--bg-secondary);
}

.post-figure-caption {
    font-family: 'Red Hat Display', sans-serif;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    text-align: center;
    line-height: 1.6;
}

.post-figure-caption strong {
    font-weight: 600;
    color: var(--text-primary);
    font-style: normal;
}

/* Footnotes and References */
.post-footnotes {
    margin-top: 6rem;
    padding-top: 3rem;
    border-top: 1px solid var(--line-color);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-footnotes.visible {
    opacity: 1;
    transform: translateY(0);
}

.footnotes-title {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    font-weight: 600;
    font-style: italic;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.footnotes-list {
    list-style: none;
    counter-reset: footnote-counter 0;
}

.footnote-item {
    counter-increment: footnote-counter;
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.footnote-item::before {
    content: counter(footnote-counter);
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--accent-teal);
    font-size: 0.875rem;
}

.footnote-item a {
    color: var(--accent-teal);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.footnote-item a:hover {
    border-bottom-color: var(--accent-teal);
}

/* Inline footnote references */
.post-content a[href^="#footnote"] {
    color: var(--accent-teal);
    text-decoration: none;
    font-size: 0.85em;
    vertical-align: super;
    line-height: 0;
    margin-left: 0.2em;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-content a[href^="#footnote"]:hover {
    border-bottom-color: var(--accent-teal);
}

/* Scroll-linked animations */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax effect for title image */
.title-image-wrapper {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* Blog Listing Page */
.blog-listing {
    max-width: 800px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
}

.listing-header {
    margin-bottom: 4rem;
    text-align: center;
}

.listing-title {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.listing-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-style: italic;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-preview {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-preview.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-link {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 2rem;
    border: 1px solid var(--line-color);
    background: var(--bg-secondary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 155, 142, 0.1), transparent);
    transition: left 0.5s ease;
}

.post-link:hover {
    border-color: var(--accent-teal);
    transform: translateY(-2px);
}

.post-link:hover::before {
    left: 100%;
}

.post-preview-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: lowercase;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.post-preview-title {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.post-link:hover .post-preview-title {
    color: var(--accent-teal);
}

.post-preview-excerpt {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.post-preview-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Coming soon post cards */
.post-coming-soon {
    display: block;
    padding: 2rem;
    border: 1px solid var(--line-color);
    background: var(--bg-secondary);
    opacity: 0.5;
    cursor: default;
}

.post-coming-soon .post-preview-title {
    color: var(--text-secondary);
}

.post-coming-soon-badge {
    font-size: 0.75rem;
    color: var(--accent-muted);
    font-style: italic;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

/* Responsive */
@media (max-width: 768px) {
    .blog-post {
        padding: 6rem 1.5rem 3rem;
    }

    .blog-listing {
        padding: 6rem 1.5rem 3rem;
    }

    .theme-toggle {
        top: 1.5rem;
        right: 1.5rem;
    }

    .post-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .post-content {
        font-size: 1rem;
    }

    .post-link {
        padding: 1.5rem;
    }

    .post-figure {
        margin: 2rem 0;
    }

    .post-figure-caption {
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }

    .post-footnotes {
        margin-top: 4rem;
        padding-top: 2rem;
    }

    .footnote-item {
        font-size: 0.9rem;
        padding-left: 1.5rem;
    }
}

/* Code blocks */
.post-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--line-color);
    border-radius: 4px;
    padding: 2rem 4rem;
    margin: 3rem -6rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content pre.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.post-content p code,
.post-content li code,
.post-content h2 code,
.post-content h3 code {
    background: var(--bg-secondary);
    border: 1px solid var(--line-color);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Syntax highlighting */
.post-content pre code {
    color: var(--text-primary);
}

.code-comment {
    color: var(--text-secondary);
    font-style: italic;
}

.code-keyword {
    color: var(--accent-purple);
    font-weight: 600;
}

.code-string {
    color: var(--accent-green);
}

.code-function {
    color: var(--accent-teal);
}

.code-number {
    color: #d4a574;
}

.code-operator {
    color: var(--accent-muted);
}

/* Lists */
.post-content ol,
.post-content ul {
    margin: 1.5rem 0 2rem 0;
    padding-left: 2rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content ol.visible,
.post-content ul.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-content li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    line-height: 1.8;
}

.post-content ol li {
    list-style-type: decimal;
}

.post-content ul li {
    list-style-type: disc;
}

.post-content li strong {
    color: var(--accent-teal);
}

/* H3 headings */
.post-content h3 {
    font-family: 'Harmond Display', 'Red Hat Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    font-style: italic;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content h3.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Links */
.post-content a {
    color: var(--accent-teal);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-content a:hover {
    border-bottom-color: var(--accent-teal);
}

/* Better spacing after lists */
.post-content ol + p,
.post-content ul + p,
.post-content ol + h2,
.post-content ul + h2,
.post-content ol + h3,
.post-content ul + h3 {
    margin-top: 2rem;
}

/* Blockquotes */
.post-content blockquote {
    margin: 3rem -3rem;
    padding: 2rem 3rem;
    border: 1px solid var(--line-color);
    background: var(--bg-secondary);
    font-style: italic;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.post-content blockquote.visible {
    opacity: 1;
    transform: translateY(0);
}

.post-content blockquote p {
    margin-bottom: 0;
    opacity: 1;
    transform: none;
}

/* Responsive blockquotes and code blocks */
@media (max-width: 768px) {
    .post-content blockquote {
        margin: 2rem -1rem;
        padding: 1.5rem 1rem;
        font-size: 1rem;
    }

    .post-content pre {
        margin: 2rem -1rem;
        padding: 1.5rem 1rem;
    }
}
