/* Ripple Theme - Main Stylesheet
   NUC Ghost Theme v4.0.0
   ================================ */

/* ========================================
   SELF-HOSTED FONTS
   ======================================== */

/* Cormorant Garamond */
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-700-normal.woff2') format('woff2');
}

/* Source Serif 4 */
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: italic;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-500-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/source-serif-4-latin-700-normal.woff2') format('woff2');
}

/* DM Sans */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-700-normal.woff2') format('woff2');
}

/* JetBrains Mono */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

/* ========================================
   DESIGN SYSTEM TOKENS
   ======================================== */

:root {
    /* Primary - deep, serious, warm */
    --color-bg:           #0F0E0C;
    --color-surface:      #1A1816;
    --color-surface-alt:  #242220;

    /* Text hierarchy */
    --color-text:         #E8E4DF;
    --color-text-muted:   #9B958D;
    --color-text-faint:   #5C574F;

    /* Accent - the River */
    --color-love:         #4A9EAF;
    --color-power:        #C4713B;
    --color-mixture:      #8B7D6B;

    /* Ring indicators */
    --color-ring-1:       #4A9EAF;
    --color-ring-2:       #8B7D6B;
    --color-ring-3:       #C4713B;

    /* Functional */
    --color-link:         #4A9EAF;
    --color-link-hover:   #6BB8C7;
    --color-border:       #2A2724;
    --color-highlight:    rgba(74, 158, 175, 0.15);

    /* Typography */
    --font-display:   'Cormorant Garamond', Georgia, serif;
    --font-body:      'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-ui:        'DM Sans', -apple-system, sans-serif;
    --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

    /* Type scale - major third (1.25) */
    --text-xs:    0.64rem;
    --text-sm:    0.8rem;
    --text-base:  1rem;
    --text-md:    1.125rem;
    --text-lg:    1.25rem;
    --text-xl:    1.563rem;
    --text-2xl:   1.953rem;
    --text-3xl:   2.441rem;
    --text-4xl:   3.052rem;
    --text-5xl:   3.815rem;

    /* Line heights */
    --leading-tight:   1.2;
    --leading-body:    1.7;
    --leading-relaxed: 1.85;

    /* Measure */
    --measure:      68ch;
    --measure-wide: 85ch;

    /* Spacing */
    --space-xs:   0.25rem;
    --space-sm:   0.5rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2rem;
    --space-2xl:  3rem;
    --space-3xl:  4rem;
    --space-4xl:  6rem;
    --space-5xl:  8rem;

    /* Content widths */
    --width-content:  42rem;
    --width-wide:     64rem;
    --width-full:     80rem;
}

/* Light mode overrides */
[data-theme="light"] {
    --color-bg:           #F5F2EE;
    --color-surface:      #EDE9E3;
    --color-surface-alt:  #E3DED7;
    --color-text:         #1A1714;
    --color-text-muted:   #4A4540;
    --color-text-faint:   #8B8580;
    --color-border:       #D5CFC7;
    --color-link:         #3A8E9F;
    --color-link-hover:   #2A7E8F;
    --color-highlight:    rgba(74, 158, 175, 0.12);
}


/* ========================================
   TYPOGRAPHY
   ======================================== */

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    --gh-font-heading: var(--font-display);
    --gh-font-body: var(--font-body);
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

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

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-text);
}

h1 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-lg);
}

h2 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-md);
}

h3 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-md);
}

h4 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
}

h5 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
}

h6 {
    font-size: var(--text-base);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

/* Body text */
p {
    margin-bottom: var(--space-lg);
}

/* Links */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Lists */
ul, ol {
    margin-bottom: var(--space-lg);
    padding-left: var(--space-xl);
}

li {
    margin-bottom: var(--space-sm);
}

/* Blockquotes */
blockquote {
    border-left: 3px solid var(--color-love);
    padding-left: var(--space-xl);
    margin: var(--space-2xl) 0;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-style: italic;
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--color-surface);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

pre {
    background-color: var(--color-surface);
    padding: var(--space-lg);
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: var(--space-lg);
}

pre code {
    background: none;
    padding: 0;
}

/* Horizontal rule -- water ripple divider */
hr {
    border: none;
    height: 40px;
    background: url('../images/devider.png') center center / cover no-repeat;
    margin: var(--space-3xl) 0;
    opacity: 0.6;
}

/* Fallback for pages without the divider image */
hr.plain {
    height: auto;
    background: none;
    border-top: 1px solid var(--color-border);
    opacity: 1;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: var(--space-2xl) 0;
}

figcaption {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
    text-align: center;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-lg);
}

th, td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

th {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Selection */
::selection {
    background-color: var(--color-highlight);
    color: var(--color-text);
}

/* UI text utility */
.text-ui {
    font-family: var(--font-ui);
}

.text-mono {
    font-family: var(--font-mono);
}

/* Content body - for Ghost editor content */
.content-body {
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
    font-size: var(--text-md);
    line-height: var(--leading-body);
}

.content-body h2 {
    margin-top: var(--space-3xl);
}

.content-body h3 {
    margin-top: var(--space-2xl);
}

.content-body > *:first-child {
    margin-top: 0;
}

/* Ghost-specific content classes */
.content-body .kg-image-card,
.content-body .kg-gallery-card {
    margin: var(--space-2xl) 0;
}

.content-body .kg-width-wide {
    max-width: var(--measure-wide);
    margin-left: auto;
    margin-right: auto;
}

.content-body .kg-width-full {
    max-width: 100%;
}

.content-body .kg-image {
    width: 100%;
    border-radius: 4px;
}

.content-body .kg-bookmark-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    margin: var(--space-2xl) 0;
}

.content-body .kg-bookmark-content {
    padding: var(--space-lg);
}

.content-body .kg-bookmark-title {
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--color-text);
}

.content-body .kg-bookmark-description {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
}

.content-body .kg-bookmark-metadata {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    margin-top: var(--space-sm);
}


/* ========================================
   LAYOUT
   ======================================== */

/* Site structure */
.site-main {
    min-height: calc(100vh - 200px);
}

/* Neutralize fixed-position elements while they live inside <main>.
   sidebar-nav.js moves breadcrumb, overlay, toggle, toast, and sidebar
   (on mobile) to <body>, but before that runs the browser sees them as
   fixed children of <main>, which triggers a Chrome compositor bug that
   breaks position:sticky on the site header. Blog posts work because
   they have none of these. Once JS moves them to <body>, .site-main is
   no longer an ancestor and these overrides stop matching. */
.site-main .breadcrumb-bar,
.site-main .toc-toggle,
.site-main .sidebar-overlay,
.site-main .resume-toast {
    position: static !important;
    display: none !important;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    max-width: var(--width-full);
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Footer layout */
.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-5xl);
}

.site-footer-inner {
    max-width: var(--width-full);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.site-footer-top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3xl);
    margin-bottom: var(--space-3xl);
}

.site-footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Content containers */
.page-content,
.post-content {
    max-width: var(--width-wide);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.page-header,
.post-header {
    max-width: var(--measure);
    margin: 0 auto var(--space-3xl);
    text-align: center;
}

.page-feature-image,
.post-feature-image {
    max-width: var(--measure-wide);
    margin: 0 auto var(--space-3xl);
    border-radius: 6px;
    overflow: hidden;
}

.page-feature-image img,
.post-feature-image img {
    width: 100%;
}

/* Post grid - used on index, tag, author pages */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
    max-width: var(--width-full);
    margin: 0 auto;
}

/* Section containers */
.tag-archive,
.author-archive {
    max-width: var(--width-full);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.tag-header,
.author-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-3xl);
    padding-top: var(--space-2xl);
    border-top: 1px solid var(--color-border);
}

/* Error page */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}


/* ========================================
   COMPONENTS
   ======================================== */

/* ----------------------------------------
   Navigation
   ---------------------------------------- */

.site-logo-link {
    display: flex;
    align-items: center;
}

.site-logo {
    max-height: 40px;
    width: auto;
}

.site-title-text {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text);
}

.site-nav {
    display: flex;
    align-items: center;
}

.site-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-lg);
}

.site-nav li {
    margin: 0;
}

.site-nav a {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-sm) 0;
    transition: color 0.2s ease;
}

.site-nav a:hover {
    color: var(--color-text);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    z-index: 110;
}

.nav-toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .site-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        background-color: var(--color-surface);
        padding: var(--space-5xl) var(--space-xl) var(--space-2xl);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 105;
        overflow-y: auto;
    }

    .site-nav.is-open {
        transform: translateX(0);
    }

    .site-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .site-nav a {
        display: block;
        padding: var(--space-md) 0;
        font-size: var(--text-base);
        border-bottom: 1px solid var(--color-border);
        color: var(--color-text);
    }
}

/* Nav overlay for mobile */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 14, 12, 0.8);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--color-text);
    background-color: var(--color-surface);
}

.theme-toggle-sun {
    display: block;
}

.theme-toggle-moon {
    display: none;
}

[data-theme="light"] .theme-toggle-sun {
    display: none;
}

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

/* ----------------------------------------
   Buttons
   ---------------------------------------- */

.btn {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-md) var(--space-xl);
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    text-align: center;
}

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

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

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

/* ----------------------------------------
   Post Cards
   ---------------------------------------- */

.post-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.post-card:hover {
    border-color: var(--color-text-faint);
}

.post-card-image-link {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .post-card-image {
    transform: scale(1.02);
}

.post-card-content {
    padding: var(--space-lg);
}

.post-card-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    line-height: var(--leading-tight);
}

.post-card-title a {
    color: var(--color-text);
}

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

.post-card-excerpt {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    line-height: var(--leading-body);
    margin-bottom: var(--space-md);
}

.post-card-meta {
    display: flex;
    gap: var(--space-md);
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ----------------------------------------
   Ring Indicators
   ---------------------------------------- */

.ring-indicator {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 3px;
    margin-bottom: var(--space-sm);
}

.ring-indicator--1 {
    color: var(--color-ring-1);
    background-color: rgba(74, 158, 175, 0.12);
}

.ring-indicator--2 {
    color: var(--color-ring-2);
    background-color: rgba(139, 125, 107, 0.12);
}

.ring-indicator--3 {
    color: var(--color-ring-3);
    background-color: rgba(196, 113, 59, 0.12);
}

/* ----------------------------------------
   Post Meta
   ---------------------------------------- */

.post-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-lg);
}

.post-meta-tag {
    color: var(--color-love);
}

/* ----------------------------------------
   Post Tags (footer)
   ---------------------------------------- */

.post-footer {
    max-width: var(--measure);
    margin: var(--space-3xl) auto 0;
    padding-top: var(--space-2xl);
    border-top: 1px solid var(--color-border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.post-tag {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.post-tag:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

/* ----------------------------------------
   Footer Components
   ---------------------------------------- */

.site-footer-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
}

.site-footer-description {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    max-width: 40ch;
}

.site-footer-nav-title {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.site-footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer-nav li {
    margin-bottom: var(--space-sm);
}

.site-footer-nav a {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.site-footer-nav a:hover {
    color: var(--color-text);
}

.site-footer-tagline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: var(--text-base);
    color: var(--color-text-muted);
}

.site-footer-copyright {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
}

.site-footer-copyright a {
    color: var(--color-text-faint);
}

.site-footer-copyright a:hover {
    color: var(--color-text-muted);
}

/* ----------------------------------------
   Author Components
   ---------------------------------------- */

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto var(--space-lg);
}

.author-name {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
}

.author-bio {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    max-width: var(--measure);
    margin: var(--space-md) auto 0;
}

.author-location {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-faint);
    margin-top: var(--space-sm);
}

/* ----------------------------------------
   Section Titles
   ---------------------------------------- */

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    text-align: center;
    margin-bottom: var(--space-2xl);
    color: var(--color-text);
}

/* ----------------------------------------
   Error Page
   ---------------------------------------- */

.error-code {
    font-family: var(--font-display);
    font-size: var(--text-5xl);
    color: var(--color-text-faint);
    margin-bottom: var(--space-md);
}

.error-message {
    font-size: var(--text-xl);
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.error-description {
    font-size: var(--text-base);
    color: var(--color-text-faint);
    margin-bottom: var(--space-2xl);
}


/* ========================================
   PAGE-SPECIFIC STYLES
   ======================================== */

/* ----------------------------------------
   Homepage Hero
   ---------------------------------------- */

.hero {
    padding: var(--space-5xl) var(--space-xl);
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/background.png') center center / cover no-repeat;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}

.hero-inner {
    max-width: var(--width-content);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-quote {
    border: none;
    padding: 0;
    margin: 0 auto var(--space-2xl);
    max-width: 36ch;
}

.hero-quote p {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 400;
    font-style: italic;
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    margin-bottom: 0;
}

.hero-description {
    font-size: var(--text-md);
    color: var(--color-text-muted);
    line-height: var(--leading-body);
    max-width: 50ch;
    margin: 0 auto var(--space-2xl);
}

/* ----------------------------------------
   Three-Path Cards
   ---------------------------------------- */

.paths {
    padding: var(--space-4xl) var(--space-xl);
    background-color: var(--color-surface);
}

.paths-inner {
    max-width: var(--width-full);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
}

.path-card {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-2xl);
    text-align: center;
    transition: border-color 0.2s ease;
}

.path-card:hover {
    border-color: var(--color-text-faint);
}

.path-card-image {
    height: 150px;
    margin: calc(-1 * var(--space-2xl));
    margin-bottom: var(--space-lg);
    overflow: hidden;
    border-radius: 5px 5px 0 0;
}

.path-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.path-card--ring-1 .path-card-image img {
    /* Sphere is centered but small -- zoom in a bit */
    object-fit: cover;
    transform: scale(1.3);
}

.path-card-ring {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 3px;
    margin-bottom: var(--space-lg);
}

.path-card--ring-1 .path-card-ring {
    color: var(--color-ring-1);
    background-color: rgba(74, 158, 175, 0.12);
}

.path-card--ring-2 .path-card-ring {
    color: var(--color-ring-2);
    background-color: rgba(139, 125, 107, 0.12);
}

.path-card--ring-3 .path-card-ring {
    color: var(--color-ring-3);
    background-color: rgba(196, 113, 59, 0.12);
}

.path-card-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-md);
}

.path-card-description {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    line-height: var(--leading-body);
    margin-bottom: var(--space-lg);
}

.path-card-link {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.path-card--ring-1 .path-card-link { color: var(--color-ring-1); }
.path-card--ring-2 .path-card-link { color: var(--color-ring-2); }
.path-card--ring-3 .path-card-link { color: var(--color-ring-3); }

/* ----------------------------------------
   Latest Posts Section (Homepage)
   ---------------------------------------- */

.latest-posts {
    padding: var(--space-4xl) var(--space-xl);
}

.latest-posts-inner {
    max-width: var(--width-full);
    margin: 0 auto;
    text-align: center;
}

.latest-posts .post-grid {
    margin-bottom: var(--space-2xl);
    text-align: left;
}

/* ----------------------------------------
   Tag / Author Archives
   ---------------------------------------- */

.tag-description {
    font-size: var(--text-md);
    color: var(--color-text-muted);
    max-width: var(--measure);
    margin: var(--space-md) auto 0;
}

/* ----------------------------------------
   Page tag
   ---------------------------------------- */

.page-tag {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
}


/* ----------------------------------------
   Blog Archive
   ---------------------------------------- */

.blog-archive {
    max-width: var(--width-full);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.blog-archive-inner {
    max-width: var(--width-full);
    margin: 0 auto;
}

.blog-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.blog-title {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
}

.blog-description {
    font-size: var(--text-md);
    color: var(--color-text-muted);
    max-width: var(--measure);
    margin: var(--space-md) auto 0;
}


/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-footer-top {
        flex-direction: column;
        gap: var(--space-2xl);
    }
}

@media (max-width: 768px) {
    .site-header-inner {
        padding: var(--space-md) var(--space-md);
    }

    .page-content,
    .post-content,
    .tag-archive,
    .author-archive {
        padding: var(--space-2xl) var(--space-md);
    }

    .site-footer-inner {
        padding: var(--space-2xl) var(--space-md);
    }

    .post-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: var(--text-3xl);
    }

    h2 {
        font-size: var(--text-2xl);
    }

    .site-footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .hero {
        padding: var(--space-3xl) var(--space-md);
    }

    .hero-quote p {
        font-size: var(--text-2xl);
    }

    .paths {
        padding: var(--space-2xl) var(--space-md);
    }

    .paths-inner {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .path-card {
        padding: var(--space-lg);
    }

    .path-card-image {
        height: 120px;
        margin: calc(-1 * var(--space-lg));
        margin-bottom: var(--space-md);
    }

    .latest-posts {
        padding: var(--space-2xl) var(--space-md);
    }
}


/* ========================================
   PHASE 2 & 3 COMPONENTS
   ======================================== */

/* ----------------------------------------
   Reading Progress Bar
   ---------------------------------------- */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    z-index: 1000;
    background-color: transparent;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-love), var(--color-mixture));
    transition: width 0.08s linear;
}

/* ----------------------------------------
   Philosophy Layout (with sidebar)
   ---------------------------------------- */

.philosophy-layout {
    position: relative;
}

.philosophy-container {
    display: flex;
    gap: var(--space-3xl);
    max-width: var(--width-full);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.philosophy-content {
    flex: 1;
    min-width: 0;
}

.philosophy-header {
    max-width: var(--measure);
    margin: 0 auto var(--space-3xl);
    text-align: center;
    position: relative;
    padding: var(--space-3xl) var(--space-xl);
}

.philosophy-header::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: -4rem;
    right: -4rem;
    bottom: -2rem;
    background: url('../images/background.png') center center / cover no-repeat;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
    border-radius: 8px;
}

.philosophy-header > * {
    position: relative;
    z-index: 1;
}

.philosophy-title {
    margin-bottom: var(--space-md);
}

.philosophy-meta {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.philosophy-feature-image {
    max-width: var(--measure-wide);
    margin: 0 auto var(--space-3xl);
    border-radius: 6px;
    overflow: hidden;
}

.philosophy-feature-image img {
    width: 100%;
}

/* ----------------------------------------
   Sidebar Section Nav
   ---------------------------------------- */

.sidebar-nav {
    position: sticky;
    top: calc(60px + var(--space-2xl));
    width: 200px;
    flex-shrink: 0;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: var(--space-md);
}

.sidebar-nav-inner {
    padding-top: var(--space-sm);
}

.sidebar-nav-list {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-link {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    line-height: 1.4;
    color: var(--color-text-faint);
    padding: var(--space-xs) var(--space-sm);
    border-left: 2px solid var(--color-border);
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav-link:hover {
    color: var(--color-text-muted);
    border-left-color: var(--color-text-faint);
}

.sidebar-nav-link.is-active {
    color: var(--color-love);
    border-left-color: var(--color-love);
}

/* ----------------------------------------
   Go Deeper CTAs
   ---------------------------------------- */

.cta-deeper {
    margin-top: var(--space-4xl);
    padding-top: var(--space-3xl);
    border-top: 1px solid var(--color-border);
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
}

.cta-deeper-title {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

.cta-deeper-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.cta-deeper-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.cta-deeper-link:hover {
    border-color: var(--color-text-faint);
    background-color: var(--color-surface-alt);
    color: var(--color-text);
}

.cta-deeper-link-ring {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 3px;
    flex-shrink: 0;
}

.cta-deeper-link-ring--1 {
    color: var(--color-ring-1);
    background-color: rgba(74, 158, 175, 0.12);
}

.cta-deeper-link-ring--2 {
    color: var(--color-ring-2);
    background-color: rgba(139, 125, 107, 0.12);
}

.cta-deeper-link-ring--3 {
    color: var(--color-ring-3);
    background-color: rgba(196, 113, 59, 0.12);
}

.cta-deeper-link-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
}

/* ----------------------------------------
   Start Here Page
   ---------------------------------------- */

.start-here-page {
    max-width: var(--width-content);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-xl);
}

.start-here-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.start-here-title {
    margin-bottom: var(--space-md);
}

.start-here-subtitle {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-style: italic;
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
}

.start-here-footer {
    margin-top: var(--space-4xl);
    padding-top: var(--space-3xl);
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.start-here-next-label {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-style: italic;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2xl);
}

.start-here-next-paths {
    display: flex;
    gap: var(--space-lg);
    justify-content: center;
}

.start-here-next-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: border-color 0.2s ease;
    min-width: 160px;
}

.start-here-next-link:hover {
    border-color: var(--color-text-faint);
    color: var(--color-text);
}

.start-here-next-ring {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.start-here-next-link--philosophy .start-here-next-ring { color: var(--color-ring-2); }
.start-here-next-link--society .start-here-next-ring { color: var(--color-ring-1); }
.start-here-next-link--blog .start-here-next-ring { color: var(--color-love); }

/* ----------------------------------------
   FAQ Page + Accordion
   ---------------------------------------- */

.faq-page {
    max-width: var(--width-content);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.faq-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.faq-title {
    margin-bottom: var(--space-md);
}

.faq-description {
    font-size: var(--text-md);
    color: var(--color-text-muted);
    line-height: var(--leading-body);
}

.faq-accordion-item {
    border-bottom: 1px solid var(--color-border);
}

.faq-accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--space-lg) 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    gap: var(--space-md);
}

.faq-accordion-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text);
    line-height: var(--leading-tight);
}

.faq-accordion-icon {
    flex-shrink: 0;
    font-family: var(--font-ui);
    font-size: var(--text-xl);
    font-weight: 300;
    color: var(--color-text-muted);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.faq-accordion-item.is-open .faq-accordion-icon {
    transform: rotate(45deg);
}

.faq-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-accordion-content-inner {
    padding-bottom: var(--space-xl);
    color: var(--color-text-muted);
    font-size: var(--text-md);
    line-height: var(--leading-body);
}

.faq-accordion-content-inner p:last-child {
    margin-bottom: 0;
}

.faq-accordion-content-inner a {
    color: var(--color-love);
}

/* ----------------------------------------
   Glossary Page
   ---------------------------------------- */

.glossary-page {
    max-width: var(--width-wide);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.glossary-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.glossary-title {
    margin-bottom: var(--space-md);
}

.glossary-description {
    font-size: var(--text-md);
    color: var(--color-text-muted);
    line-height: var(--leading-body);
}

.glossary-alphabet {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-3xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.glossary-alphabet:empty {
    display: none;
}

.glossary-alphabet a {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 700;
    padding: var(--space-xs) var(--space-sm);
    color: var(--color-text-muted);
    border-radius: 3px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.glossary-alphabet a:hover {
    color: var(--color-love);
    background-color: var(--color-highlight);
}

.glossary-term-heading {
    padding-top: var(--space-lg);
}

.glossary-body h2,
.glossary-body h3 {
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-sm);
}

/* ----------------------------------------
   Glossary Tooltips (inline)
   ---------------------------------------- */

.glossary-term {
    border-bottom: 1px dotted var(--color-love);
    cursor: help;
    position: relative;
    display: inline;
}

.glossary-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-style: normal;
    color: var(--color-text-muted);
    line-height: 1.5;
    white-space: normal;
    width: max-content;
    max-width: 300px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.glossary-term:hover .glossary-tooltip,
.glossary-term:focus .glossary-tooltip {
    opacity: 1;
    visibility: visible;
}


/* ========================================
   PHASE 2+3 RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .sidebar-nav {
        display: none;
    }

    /* Longform TOC: hidden when closed (no position:fixed in <main>).
       A fixed element inside <main> triggers a Chrome mobile compositor bug
       that breaks position:sticky on the site header. Blog posts work because
       they have zero fixed elements in <main>. Keeping the sidebar display:none
       when closed matches that pattern. Only .open adds position:fixed. */
    /* Mobile: sidebar is moved to <body> by JS so it cannot poison
       the sticky header. Selectors use .sidebar-nav without a layout
       parent so they match regardless of DOM position. */
    .sidebar-nav {
        display: none;
    }

    .sidebar-nav.open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        min-width: 0;
        background: var(--color-bg);
        border-right: 1px solid var(--color-border);
        z-index: 950;
        padding: 80px 0.5rem var(--space-xl);
        max-height: 100vh;
        overflow-y: auto;
        animation: tocSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .sidebar-overlay {
        display: block;
    }

    .toc-toggle {
        display: flex;
    }

    .philosophy-container {
        padding: var(--space-2xl) var(--space-xl);
    }

    .start-here-next-paths {
        flex-direction: column;
        align-items: center;
    }

    .start-here-next-link {
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 768px) {
    .philosophy-container {
        padding: var(--space-2xl) var(--space-md);
    }

    .start-here-page {
        padding: var(--space-2xl) var(--space-md);
    }

    .faq-page {
        padding: var(--space-2xl) var(--space-md);
    }

    .glossary-page {
        padding: var(--space-2xl) var(--space-md);
    }

    .cta-deeper-link {
        flex-direction: column;
        text-align: center;
    }

    .glossary-tooltip {
        max-width: 240px;
    }
}


/* ========================================
   PHASE 4: POLISH
   ======================================== */

/* ----------------------------------------
   Skip to Content (Accessibility)
   ---------------------------------------- */

.skip-to-content {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-love);
    color: var(--color-bg);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-sm) var(--space-lg);
    border-radius: 0 0 4px 4px;
    z-index: 300;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
    color: var(--color-bg);
}

/* ----------------------------------------
   Focus States (Accessibility)
   ---------------------------------------- */

*:focus-visible {
    outline: 2px solid var(--color-love);
    outline-offset: 2px;
}

/* Remove outline for mouse clicks, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ----------------------------------------
   Social Links (Footer)
   ---------------------------------------- */

.site-footer-social {
    flex-shrink: 0;
}

.social-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.social-links li {
    margin: 0;
}

.social-links a {
    color: var(--color-text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
    color: var(--color-love);
    transform: translateY(-2px);
}

.social-links svg {
    display: block;
}

/* ----------------------------------------
   TOC Drawer Slide-In (mobile)
   ---------------------------------------- */

@keyframes tocSlideIn {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

/* ----------------------------------------
   Scroll Reveal Animations
   ---------------------------------------- */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Stagger children in grids */
.reveal-stagger .reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger .reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal-stagger .reveal:nth-child(4) { transition-delay: 0.3s; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ----------------------------------------
   Phase 4 Responsive
   ---------------------------------------- */

@media (max-width: 768px) {
    .social-links {
        gap: var(--space-sm);
    }
}


/* ========================================
   LONGFORM READING TEMPLATE
   ======================================== */

/* ----------------------------------------
   Breadcrumb Bar
   ---------------------------------------- */

.breadcrumb-bar {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    height: 36px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-xl);
    z-index: 800;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-faint);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.breadcrumb-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.breadcrumb-link {
    color: var(--color-text-faint);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--color-love);
}

.breadcrumb-sep {
    margin: 0 0.5rem;
    color: var(--color-text-faint);
    flex-shrink: 0;
}

.breadcrumb-current {
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40ch;
}

/* ----------------------------------------
   Longform Layout
   ---------------------------------------- */

.longform-layout {
    display: flex;
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px var(--space-xl) 0;
    gap: var(--space-3xl);
}

/* ----------------------------------------
   TOC Sidebar (desktop only - mobile gets the drawer via @media max-width 1024px)
   ---------------------------------------- */

@media (min-width: 1025px) {
    .longform-layout .sidebar-nav {
        position: sticky;
        top: 100px;
        width: 260px;
        min-width: 260px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding: var(--space-md) 0;
        align-self: flex-start;
        scrollbar-width: thin;
        scrollbar-color: var(--color-border) transparent;
    }

    .longform-layout .sidebar-nav::-webkit-scrollbar { width: 4px; }
    .longform-layout .sidebar-nav::-webkit-scrollbar-track { background: transparent; }
    .longform-layout .sidebar-nav::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
}

.toc-label {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-faint);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    position: relative;
}

.toc-link {
    display: block;
    padding: 0.3rem 0.75rem;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--color-text-faint);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.25s, border-color 0.25s, background 0.25s;
    line-height: 1.35;
}

.toc-link:hover {
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.02);
}

.toc-link.active {
    color: var(--color-text);
    border-left-color: var(--color-love);
    background: rgba(74, 158, 175, 0.1);
}

.toc-sub {
    padding-left: 0.75rem;
}

.toc-sub .toc-link {
    font-size: 0.72rem;
    padding: 0.2rem 0.75rem;
    opacity: 0.8;
}

.toc-sub .toc-link.active {
    opacity: 1;
    color: var(--color-text-muted);
    border-left-color: var(--color-mixture);
}

/* ----------------------------------------
   Longform Content
   ---------------------------------------- */

.longform-content {
    flex: 1;
    min-width: 0;
    padding-bottom: var(--space-4xl);
}

.doc-header {
    padding: 3rem 0 2.5rem;
    max-width: 720px;
}

.doc-title {
    font-size: 3rem;
    line-height: 1.15;
    margin-bottom: var(--space-sm);
}

.doc-subtitle {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.doc-meta {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-text-faint);
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.doc-feature-image {
    max-width: var(--measure-wide);
    margin: 0 0 var(--space-3xl);
    border-radius: 6px;
    overflow: hidden;
}

.doc-feature-image img {
    width: 100%;
    display: block;
}

/* Headings need top offset to clear fixed header + breadcrumb */
.longform-body h2,
.longform-body h3,
.longform-body h4 {
    scroll-margin-top: 110px;
}

/* ----------------------------------------
   Section Meta (reading times)
   ---------------------------------------- */

.section-meta {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-faint);
    margin: 0.5rem 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    max-width: var(--measure);
}

/* ----------------------------------------
   TOC Toggle Button (mobile)
   ---------------------------------------- */

.toc-toggle {
    display: flex;
    position: fixed;
    bottom: var(--space-xl);
    left: var(--space-xl);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    z-index: 850;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.toc-toggle:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

@media (min-width: 1025px) {
    .toc-toggle {
        display: none;
    }
}

/* ----------------------------------------
   Sidebar Overlay (mobile)
   ---------------------------------------- */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 940;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ----------------------------------------
   Resume Reading Toast
   ---------------------------------------- */

.resume-toast {
    position: fixed;
    bottom: -200px;
    right: var(--space-xl);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    max-width: 340px;
}

.resume-toast.visible {
    bottom: var(--space-xl);
    opacity: 1;
    pointer-events: auto;
}

.resume-toast-text {
    flex: 1;
    line-height: 1.4;
}

.resume-toast-text small {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-faint);
    margin-top: 0.15rem;
}

.resume-btn {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    border: none;
    background: var(--color-love);
    color: var(--color-bg);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.resume-btn:hover {
    background: #6BB8C7;
}

.resume-dismiss {
    background: none;
    border: none;
    color: var(--color-text-faint);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.resume-dismiss:hover {
    color: var(--color-text-muted);
}

/* ----------------------------------------
   Glossary Tooltip (mobile touch)
   ---------------------------------------- */

.glossary-term.touch-active .glossary-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ----------------------------------------
   Longform Responsive
   ---------------------------------------- */

@media (max-width: 900px) {
    .longform-layout {
        gap: 0;
        padding: 36px var(--space-md) 0;
    }

    .doc-title {
        font-size: 2.2rem;
    }

    .resume-toast {
        right: var(--space-md);
        left: auto;
        max-width: min(320px, calc(100vw - 2 * var(--space-md)));
    }

    .resume-toast.visible {
        bottom: 5rem;
    }
}

@media (max-width: 600px) {
    .doc-title {
        font-size: 1.8rem;
    }

    .breadcrumb-bar {
        font-size: 0.7rem;
        padding: 0 var(--space-md);
    }

    .doc-header {
        padding: 2rem 0 1.5rem;
    }
}


/* ========================================
   GHOST PORTAL / MEMBERS BUTTON
   ======================================== */

/* Show the subscribe portal button only on the home page.
   Ghost adds .home-template to <body> on the index/homepage.
   The portal is rendered inside a Shadow DOM so internal classes
   cannot be targeted from an external stylesheet. Instead we hide
   the host element (#ghost-portal-root) which collapses everything
   inside it including the trigger button. */
body:not(.home-template) #ghost-portal-root {
    display: none !important;
}
