/* ============================================
   GRIMSPEAKE — Gothic Paper Aesthetic
   ============================================ */

:root {
    /* Warm paper tones */
    --bg: #f5efe0;
    --bg-deep: #ede4d0;
    --text: #2a2520;
    --text-secondary: #5a504a;
    --accent: #8b4513;
    --accent-hover: #a0522d;
    --border: #c4b49a;
    --border-light: #d9cebc;
    --link: #6b3a1f;
    --link-hover: #8b4513;
    --selection-bg: rgba(139, 69, 19, 0.15);
    --divider-color: #b8a88a;
    --footer-color: #9a8a72;
    --shadow: rgba(42, 37, 32, 0.08);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: var(--selection-bg);
}

html {
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.85;
    letter-spacing: 0.008em;
    word-spacing: 0.04em;
    min-height: 100vh;
    position: relative;
    font-weight: 400;
}

/* Subtle paper grain texture */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ---- Layout ---- */
header, main, footer {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---- Header / Nav ---- */
header {
    padding-top: 3rem;
    padding-bottom: 1rem;
}

nav {
    display: flex;
    align-items: baseline;
}

.nav-home {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: color 0.2s ease;
}

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

.nav-socials {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.7rem;
    position: relative;
    top: 1px;
}

.nav-social {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    opacity: 0.55;
    transition: opacity 0.3s ease;
}

.nav-social:hover {
    opacity: 0.85;
}

.nav-social svg {
    fill: currentColor;
}

/* ---- Main Content ---- */
main {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

/* ---- Bio ---- */
.bio {
    margin-bottom: 0.5rem;
}

.bio p {
    margin-bottom: 1.1rem;
    font-size: 1.06rem;
    color: #342e28;
}

.bio p:first-child {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.bio strong {
    font-weight: 600;
    color: var(--accent);
}

.bio em {
    font-style: italic;
}

/* ---- Dividers ---- */
.divider {
    border: none;
    text-align: center;
    margin: 2.5rem 0;
    overflow: visible;
    height: auto;
    line-height: 1;
}

.divider::after {
    content: "❖";
    display: inline-block;
    font-size: 0.9rem;
    color: var(--divider-color);
    position: relative;
}

.divider::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--border-light) 20%,
        var(--border-light) 80%,
        transparent
    );
    position: relative;
    top: 0.55em;
}

/* ---- Content Sections ---- */
.content-section {
    margin-bottom: 0.5rem;
}

.content-section h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

/* ---- Link Lists ---- */
.link-list {
    list-style: none;
}

.link-list li {
    margin-bottom: 1.2rem;
}

.link-list a {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}

.link-list a:hover {
    background: var(--bg-deep);
    border-color: var(--border-light);
    box-shadow: 0 2px 8px var(--shadow);
}

.link-title {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--link);
    margin-bottom: 0.3rem;
    transition: color 0.2s ease;
}

.link-list a:hover .link-title {
    color: var(--link-hover);
}

.link-desc {
    display: block;
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ---- Footer (light) ---- */
footer {
    padding-bottom: 3rem;
    text-align: center;
}

.footer-mark {
    font-size: 1rem;
    color: var(--footer-color);
}

/* ============================================
   CHAPTER NAV & MANUSCRIPT ENTRIES
   ============================================ */

.chapter-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 2.5rem;
}

.chapter-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border);
    margin: 0 1rem;
    flex-shrink: 0;
}

.chapter-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    position: relative;
    transition: transform 0.3s ease;
    flex: 1;
    max-width: 140px;
}

.chapter-tab:hover {
    transform: translateY(-1px);
}

.chapter-numeral {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--border);
    line-height: 1;
    transition: color 0.4s ease, transform 0.4s ease;
}

.chapter-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
    transition: color 0.4s ease;
}

.chapter-tab:hover .chapter-numeral {
    color: var(--accent);
}

.chapter-tab:hover .chapter-label {
    color: var(--text);
}

.chapter-tab.active .chapter-numeral {
    color: var(--accent);
    transform: scale(1.1);
}

.chapter-tab.active .chapter-label {
    color: var(--accent);
}

.chapter-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                left 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.chapter-tab.active::after {
    width: 100%;
    left: 0;
}

/* ---- Chapter Panels ---- */
.chapter-panels {
    position: relative;
    min-height: 140px;
}

.chapter-panel {
    display: none;
    flex-direction: column;
    gap: 0;
}

.chapter-panel.active {
    display: flex;
    animation: panelReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ---- Manuscript Entries ---- */
.entry {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: var(--text);
    padding: 1.3rem 0;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    gap: 1rem;
    transition: background 0.3s ease;
}

.entry:first-child {
    border-top: 1px solid var(--border-light);
}

.entry:hover {
    background: linear-gradient(to right, var(--bg-deep), transparent 80%);
}

/* Ornamental left element */
.entry-ornament {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-top: 0.65rem;
    border: 1.5px solid var(--border);
    transform: rotate(45deg);
    transition: border-color 0.35s ease, background 0.35s ease, transform 0.5s ease;
}

.entry:hover .entry-ornament {
    border-color: var(--accent);
    background: var(--accent);
    transform: rotate(225deg);
}

.entry-body {
    flex: 1;
    min-width: 0;
}

.entry-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--link);
    margin-bottom: 0.3rem;
    letter-spacing: 0.01em;
    line-height: 1.35;
    transition: color 0.3s ease, letter-spacing 0.4s ease;
}

.entry:hover .entry-title {
    color: var(--accent);
    letter-spacing: 0.025em;
}

.entry-text {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: 0.93rem;
    color: var(--text-secondary);
    line-height: 1.6;
    letter-spacing: 0.01em;
    margin: 0;
    transition: color 0.3s ease;
}

.entry:hover .entry-text {
    color: var(--text);
}

.entry-arrow {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    font-size: 1rem;
    color: transparent;
    transition: color 0.3s ease, transform 0.3s ease;
}

.entry:hover .entry-arrow {
    color: var(--accent);
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 680px) {
    .chapter-nav {
        gap: 0;
    }

    .chapter-dot {
        margin: 0 0.5rem;
    }

    .chapter-tab {
        padding: 0.4rem 0.6rem;
    }

    .chapter-numeral {
        font-size: 1.1rem;
    }

    .entry {
        padding: 1rem 0;
    }

    .entry-arrow {
        display: none;
    }
}

/* ---- Article Pages ---- */
.article {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.article-header {
    margin-bottom: 2.5rem;
}

.article-header h1 {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
    text-wrap: balance;
}

.article-header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
}

.article-header .date {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--footer-color);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.8rem;
}

.article-body h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.article-body h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

.article-body p {
    margin-bottom: 1.25rem;
    font-size: 1.04rem;
    color: #342e28;
    hanging-punctuation: first;
}

.article-body strong {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.bio strong {
    font-weight: 600;
}

.article-body em {
    font-style: italic;
}

.article-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1.2rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-body ul, .article-body ol {
    margin-bottom: 1.15rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    font-size: 1.02rem;
    color: #342e28;
}

.article-body code {
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    background: var(--bg-deep);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    border: 1px solid var(--border-light);
}

.article-body pre {
    background: #2a2520;
    color: #e8dcc8;
    padding: 1.2rem 1.4rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid #3d352d;
}

.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.article-body .diagram {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--bg-deep);
    border: 1px solid var(--border-light);
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1.5rem 0;
    overflow-x: auto;
    white-space: pre;
    text-align: center;
    color: var(--text-secondary);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.92rem;
}

.article-body th,
.article-body td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.article-body th {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.back-link {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
    transition: color 0.2s ease;
}

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

.back-link::before {
    content: "← ";
}

/* ---- Footnotes ---- */
.footnote {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-deep);
    padding: 0.8rem 1rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    border-left: 3px solid var(--border);
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* ---- Page Enter ---- */
@keyframes pageReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

body {
    animation: pageReveal 0.8s ease-out;
}

/* ---- Page Transition Overlay ---- */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.page-transition.active {
    opacity: 1;
    pointer-events: all;
}

/* ---- Scroll Reveal System ---- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0s; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 0.40s; }

/* Reveal variants */
.reveal-fade {
    opacity: 0;
    transition: opacity 0.9s ease;
}

.reveal-fade.visible {
    opacity: 1;
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease,
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ---- Header Animations ---- */
@keyframes navSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header nav {
    animation: navSlideDown 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.nav-home {
    position: relative;
    transition: color 0.3s ease, letter-spacing 0.4s ease;
}

.nav-home:hover {
    letter-spacing: 0.12em;
}

.nav-home::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-home:hover::after {
    width: 100%;
}

.nav-links a {
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
    left: 0;
}

/* ---- Bio Entrance ---- */
@keyframes bioReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bio p:nth-child(1) { animation: bioReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both; }
.bio p:nth-child(2) { animation: bioReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both; }
.bio p:nth-child(3) { animation: bioReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both; }

/* ---- Link Card Hover ---- */
.link-list a {
    transition: background 0.35s ease,
                box-shadow 0.35s ease,
                border-color 0.35s ease,
                transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.link-list a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow), 0 1px 4px var(--shadow);
}

.link-list a:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

.link-title {
    transition: color 0.3s ease, letter-spacing 0.4s ease;
}

.link-list a:hover .link-title {
    letter-spacing: 0.02em;
}

.link-desc {
    transition: color 0.3s ease;
}

.link-list a:hover .link-desc {
    color: var(--text);
}

/* ---- Divider Animation ---- */
@keyframes dividerLineGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes dividerSymbolAppear {
    from { opacity: 0; transform: rotate(-90deg) scale(0.5); }
    to { opacity: 1; transform: rotate(0deg) scale(1); }
}

.divider.visible::before {
    animation: dividerLineGrow 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transform-origin: center;
}

.divider.visible::after {
    animation: dividerSymbolAppear 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

/* Pre-animation state for dividers */
.divider::before {
    transform: scaleX(0);
}

.divider::after {
    opacity: 0;
}

/* ---- Section Headers ---- */
.content-section h2 {
    position: relative;
    overflow: hidden;
}

.content-section h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 2rem;
    height: 1.5px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}

.content-section h2.visible::after {
    transform: scaleX(1);
}

/* ---- Article Page Animations ---- */
@keyframes articleTitleReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

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

.article-header h1 {
    animation: articleTitleReveal 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.article-header .subtitle {
    animation: articleSubReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.article-header .date {
    animation: articleSubReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

.back-link {
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    transform: translateX(-4px);
}

/* ---- Article Body Reveal ---- */
.article-body h2 {
    position: relative;
}

.article-body h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 2.5rem;
    height: 1.5px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.article-body h2.visible::after {
    transform: scaleX(1);
}

/* ---- Blockquote Entrance ---- */
.article-body blockquote {
    border-left-color: transparent;
    transition: border-left-color 0.6s ease 0.2s;
}

.article-body blockquote.visible {
    border-left-color: var(--border);
}

/* ---- Table Row Stagger ---- */
.article-body tbody tr {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.article-body table.visible tbody tr:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.05s; }
.article-body table.visible tbody tr:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.article-body table.visible tbody tr:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.15s; }
.article-body table.visible tbody tr:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.2s; }
.article-body table.visible tbody tr:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.25s; }
.article-body table.visible tbody tr:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }
.article-body table.visible tbody tr:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: 0.35s; }
.article-body table.visible tbody tr:nth-child(8) { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }
.article-body table.visible tbody tr:nth-child(9) { opacity: 1; transform: translateY(0); transition-delay: 0.45s; }
.article-body table.visible tbody tr:nth-child(10) { opacity: 1; transform: translateY(0); transition-delay: 0.5s; }

/* ---- Diagram Reveal ---- */
.article-body .diagram {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.article-body .diagram.visible {
    opacity: 1;
    transform: scale(1);
}

/* ---- Code Block Reveal ---- */
.article-body pre {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.article-body pre.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Footnote Slide In ---- */
.footnote {
    opacity: 0;
    transform: translateX(-16px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.footnote.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Footer ---- */
@keyframes footerPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.footer-mark {
    transition: opacity 0.6s ease;
}

footer:hover .footer-mark {
    animation: footerPulse 1.5s ease infinite;
}

/* ---- Strong/Accent Text Glow on Hover ---- */
.bio strong,
.article-body strong {
    transition: text-shadow 0.3s ease;
}

.bio strong:hover,
.article-body strong:hover {
    text-shadow: 0 0 12px rgba(139, 69, 19, 0.2);
}

/* ---- Scroll Progress Bar ---- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(to right, var(--accent), var(--link));
    z-index: 10001;
    width: 0%;
    transition: width 0.1s linear;
}

/* ---- Reduce Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal, .reveal-fade, .reveal-left, .reveal-scale {
        opacity: 1;
        transform: none;
    }
}

/* ---- Responsive ---- */
@media (max-width: 680px) {
    html {
        font-size: 16px;
    }

    header, main, footer {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
    }

    .article-header h1 {
        font-size: 1.6rem;
    }

    .link-list a {
        padding: 0.6rem 0.6rem;
    }
}

@media (max-width: 420px) {
    .nav-home {
        font-size: 1.2rem;
    }

    .article-header h1 {
        font-size: 1.4rem;
    }
}
