@font-face {
    font-family: 'Denton Condensed Test';
    src: url('font/DentonCondensedTest-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}


@font-face {
    font-family: 'Denton Condensed Test';
    src: url('font/DentonCondensedTest-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Denton Condensed Test';
    src: url('font/DentonCondensedTest-BlackItalic.otf') format('opentype');
    font-weight: 900;
    font-style: italic;
}

:root {
    /* Color Palette - Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --text-primary: #111111;
    --text-secondary: #555555;
    --accent: #ca8a04;
    /* Deep Amber */
    --border: #eeeeee;
    --selection-bg: #fef9c3;
    --selection-text: #111111;

    /* Typography */
    --font-heading: 'Denton Condensed Test', serif;
    --font-body: 'Source Serif 4', serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Max Widths */
    --max-content-width: 680px;
    --max-site-width: 1100px;

    /* Transitions */
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --accent: #fbbf24;
    /* Muted Gold / Bright Amber */
    --border: #333333;
    --selection-bg: #3f3f3f;
    --selection-text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
}

.article-body,
.content-narrow,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
.post-content,
.featured-card p,
.article-card p,
.tagline,
.nav-brand,
.accent-tag,
footer p {
    -webkit-user-select: text;
    user-select: text;
}

/* Typography Scale */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.75rem;
}

p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-speed);
}

::selection {
    background-color: var(--accent);
    color: var(--bg-primary);
}

/* Layout Utilities */
.container {
    max-width: var(--max-site-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.content-narrow {
    max-width: var(--max-content-width);
    margin: 0 auto;
}

/* Decorative Accent Elements */
.accent-tag {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    display: block;
}

.accent-border {
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

blockquote {
    position: relative;
    padding: var(--spacing-md) var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    font-style: italic;
    font-size: 1.5rem;
    border-left: 4px solid var(--accent);
}

blockquote::before {
    content: '“';
    position: absolute;
    left: var(--spacing-sm);
    top: var(--spacing-xs);
    font-size: 4rem;
    color: var(--accent);
    font-family: var(--font-heading);
    opacity: 0.3;
}

/* Header & Navigation */
header {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--spacing-lg);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    white-space: nowrap;
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
    list-style: none;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

#search-input {
    padding: 0.5rem;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-body);
    width: 150px;
    transition: width 0.3s ease;
}

#search-input:focus {
    width: 200px;
    outline: none;
}

#menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
}

#theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#theme-toggle:hover {
    transform: scale(1.1) rotate(12deg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--accent);
    color: var(--accent);
}

#theme-toggle:active {
    transform: scale(0.95);
}

#theme-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    transition: transform 0.5s ease;
}

[data-theme="dark"] #theme-toggle {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    background: rgba(30, 30, 30, 0.8);
}

@media (max-width: 768px) {
    #theme-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 3rem;
        height: 3rem;
    }
}

/* Category Dropdown */
.nav-dropdown {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
}

.dropdown-trigger:hover {
    color: var(--accent);
}

.dropdown-trigger svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-trigger svg {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 1rem;
    min-width: 220px;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.6rem 0;
    font-size: 0.95rem;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.dropdown-content a:hover {
    color: var(--accent);
    padding-left: 0.5rem;
}

.view-all {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid transparent;
}

.view-all:hover {
    border-bottom: 1px solid var(--accent);
}

/* Responsive Navigation Redesign */
@media (max-width: 900px) {
    header {
        position: fixed;
        width: 100%;
        margin-bottom: 0;
        z-index: 9999;
    }

    body {
        padding-top: 70px;
        /* Offset for fixed header */
    }

    .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        right: -100%;
        /* Off-screen */
        width: 100%;
        max-width: none;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 6rem 1.5rem 2rem;
        gap: 0.5rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
        z-index: 10000;
        overflow-y: auto;
        box-shadow: none;
        visibility: hidden;
    }

    .nav-links.active {
        right: 0;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
        visibility: visible;
    }

    #menu-toggle {
        display: block;
        z-index: 10001;
        /* Above drawer */
        position: relative;
    }

    .nav-controls {
        border-left: none;
        padding-left: 0;
        gap: 0.5rem;
    }

    #search-input {
        display: none;
    }

    /* Categories in Mobile Menu */
    .nav-dropdown {
        width: 100%;
    }

    .dropdown-trigger {
        font-size: 1.25rem;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border);
        justify-content: space-between;
        width: 100%;
        font-family: var(--font-body);
    }

    .dropdown-content {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        padding: 0.5rem 0 0.5rem 1rem;
        margin-top: 0;
        background: transparent;
    }

    .nav-dropdown:hover .dropdown-content {
        display: none;
    }

    .nav-dropdown.mobile-open .dropdown-content {
        display: block;
    }

    .nav-dropdown.mobile-open .dropdown-trigger svg {
        transform: rotate(180deg);
    }

    .nav-links li a {
        font-size: 1.25rem;
        padding: 0.75rem 0;
        display: block;
        border-bottom: 1px solid var(--border);
        font-family: var(--font-body);
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        z-index: 9500;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .nav-overlay.active {
        display: block;
    }

    /* Mobile Search Bar inside Menu */
    .mobile-search {
        margin-bottom: 2rem;
        width: 100%;
    }

    .mobile-search input {
        width: 100%;
        padding: 0.75rem 1rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        color: var(--text-primary);
        font-family: var(--font-body);
        font-size: 1rem;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--text-primary);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg) var(--spacing-md);
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 0rem;
}

.tagline {
    text-align: center;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: clamp(1rem, 3vw, 1.25rem);
}

/* Featured Card */
.featured-card {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--spacing-lg);
    align-items: center;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.featured-card .cover-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    margin-bottom: 0;
}

.featured-card h2 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    margin-bottom: var(--spacing-sm);
}

.featured-author {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.featured-author a {
    display: flex;
    align-items: center;
}

.featured-author img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: opacity 0.2s ease;
}

.featured-author a:hover img {
    opacity: 0.8;
}

.author-link {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Article Cards */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.article-card {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--spacing-md);
}

.article-card .cover-image {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: var(--bg-secondary);
    margin-bottom: var(--spacing-sm);
    object-fit: cover;
}

.article-card h3:hover {
    color: var(--accent);
}

/* Responsive Layouts */
@media (max-width: 900px) {
    .featured-card {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 2rem;
        --spacing-xl: 3rem;
    }

    h1 {
        font-size: 2.25rem;
    }

    .hero {
        padding: var(--spacing-md) 0;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .related-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .content-narrow {
        padding: 0 var(--spacing-md);
    }

    blockquote {
        font-size: 1.25rem;
        padding: var(--spacing-md);
        margin: var(--spacing-md) 0;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2.25rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    h1 {
        font-size: 1.85rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .hero {
        padding: var(--spacing-md) 0;
        margin-bottom: var(--spacing-lg);
    }

    .hero h1 {
        font-size: 2.15rem;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .post-title {
        margin-bottom: 1.25rem !important;
    }

    .featured-card h2 {
        font-size: 1.5rem;
    }

    .article-body {
        font-size: 1.05rem;
        /* Slightly smaller to fit more words strictly for justification */
        line-height: 1.6;
        letter-spacing: -0.01em;
    }
}

/* Article Content Styling */
.article-body {
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: justify;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
    text-align-last: left;
}

.article-body p {
    margin-bottom: 2rem;
}

.article-body a {
    color: #3b82f6;
    /* Modern Blue */
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: all 0.2s ease;
    display: inline;
    /* Ensure it stays in flow for proper justification */
}

.article-body a:hover {
    color: var(--accent);
    text-decoration-thickness: 2px;
}

.post-hero-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 3rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.article-body img,
.article-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 3rem auto;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Captions if needed */
.article-body figure {
    margin: 3rem 0;
    text-align: center;
}

.article-body figcaption {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    font-style: italic;
}

/* Base styles for footnotes */
.footnotes {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.footnotes a {
    color: #3b82f6;
    /* Modern Blue */
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footnotes a:hover {
    color: var(--accent);
}


.footnotes-list {
    padding-left: 1.5rem;
}

.footnote-item {
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.footnote-item:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.footnotes-list li::marker {
    color: #3b82f6;
    font-weight: bold;
}


.footnote-backref {
    text-decoration: none;
    color: var(--accent);
    margin-left: 0.5rem;
    font-weight: bold;
}

.footnote-ref {
    color: #3b82f6;
    /* Modern Blue */
    text-decoration: none;
    font-weight: 600;
    padding: 0 2px;
    transition: background-color 0.2s;
}

.footnote-ref:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 2px;
}


[data-theme="dark"] .article-body img,
[data-theme="dark"] .article-image {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Footnote Highlights */
@keyframes gold-fade {
    0% {
        background-color: var(--accent);
        color: white;
    }

    100% {
        background-color: transparent;
    }
}

@keyframes blue-fade {
    0% {
        background-color: #3b82f6;
        color: white;
    }

    100% {
        background-color: transparent;
    }
}

/* When clicking [1] in text: highlight the item at the bottom */
.footnote-target-highlight {
    animation: gold-fade 2s ease-out;
    padding: 10px;
    border-radius: 4px;
}

/* When clicking arrow at bottom: highlight the [1] link in text */
.footnote-ref-highlight {
    animation: blue-fade 2s ease-out;
    border-radius: 2px;
}

:target {
    scroll-margin-top: 100px;
}

/* Footer Category List */
.footer-sidebar {
    text-align: left;
    max-width: var(--max-content-width);
    margin: 4rem auto 2rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
}

.footer-sidebar h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-family: var(--font-heading);
}

.footer-category-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem 2.5rem;
}

.footer-category-list li {
    padding: 0.25rem 0;
}

.footer-category-list a {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: color 0.2s;
    display: block;
}

.footer-category-list a:hover {
    color: var(--accent);
}

@media (max-width: 768px) {
    .footer-category-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Prevent unwanted focus outline on text elements tricked with tabindex="-1" */
[data-no-tap-search="true"]:focus {
    outline: none;
}