/* Reset and Base Styles */
/* Base Styles */

/* Custom Fonts */
@font-face {
    font-family: 'Tiempos Text';
    src: url('assets/fonts/TiemposText-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

html {
    scroll-behavior: auto;
    overflow-x: hidden;
    height: 100%;
}

body {
    /* Monospace font for body text - PI style */
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    background: #eeece2;
    color: #3d3929;
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    font-size: 14px;
    letter-spacing: 0.02em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
}

/* Texture Overlay - Dot Grid Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, rgba(61,57,41,0.20) 1px, transparent 1px);
    background-size: 16px 16px;
    background-position: 0 0;
    pointer-events: none;
    z-index: 1;
    opacity: 1;
}

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

/* Page Sections */
.page-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.page-section.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.page-section.transitioning-out {
    opacity: 0;
    visibility: hidden;
    z-index: 1;
}

/* Progress Bar Container */
#progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 160px;
    background: rgba(238, 236, 226, 0.98);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(61, 57, 41, 0.1);
    display: flex;
    align-items: center;
    padding: 0 40px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
}

#progress-bar-container.hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

/* Progress Bar */
#progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(61, 57, 41, 0.15);
    border-radius: 2px;
    overflow: visible;
}

#progress-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #bd5d3a;
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 2px;
}

#progress-sections-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
}

.progress-section-marker {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.progress-section-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(232, 228, 220, 0.8);
    border: 2px solid rgba(189, 93, 58, 0.3);
    position: absolute;
    top: -4.5px;
    transition: all 0.3s;
    z-index: 2;
}

.progress-section-marker.active .progress-section-dot {
    background: #bd5d3a;
    border-color: #bd5d3a;
    transform: scale(1.2);
}

.progress-section-marker:hover .progress-section-dot {
    transform: scale(1.4);
    border-color: #bd5d3a;
}

.progress-section-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0.7;
    letter-spacing: 0.5px;
    pointer-events: none;
    background: rgba(238, 236, 226, 0.95);
    padding: 8px 20px;
    border-radius: 4px;
    transition: opacity 0.3s;
    min-width: max-content;
}

.progress-section-marker:hover .progress-section-label,
.progress-section-marker.active .progress-section-label {
    opacity: 1;
}

/* Navigation (removed - keeping for visual only) */
#main-nav {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 999;
    display: none;
}

/* Hero Section */
#hero,
#page-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

#page-hero .main-title,
#page-hero .subtitle,
#page-hero .nav-buttons {
    position: relative;
    z-index: 1;
}

.main-title {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 4rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    text-align: center;
    padding-left: 2rem;
    padding-right: 2rem;
    border-left: 4px solid #bd5d3a;
    border-right: 4px solid #bd5d3a;
    display: inline-block;
}

.subtitle {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 2rem;
    opacity: 0.7;
    text-align: center;
    letter-spacing: 0.03em;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #eeece2;
    border: 1px solid #3d3929;
    color: #3d3929;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow:
        3px 3px 0px rgba(61, 57, 41, 0.4);
    position: relative;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: #bd5d3a;
    color: #eeece2;
    border-color: #bd5d3a;
    box-shadow:
        6px 6px 0px rgba(189, 93, 58, 0.6);
    transform: translate(-2px, -2px);
}

.nav-btn:active {
    box-shadow:
        2px 2px 0px rgba(189, 93, 58, 0.4);
    transform: translate(1px, 1px);
}

.nav-btn.active {
    background: #bd5d3a;
    color: #eeece2;
    border-color: #bd5d3a;
}

#hero-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    opacity: 0.52;
    transform: scale(0.96);
}

#hero-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
}

.scroll-hint {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem;
    opacity: 0.85;
    animation: pulse 2s infinite;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    line-height: 1.35;
    z-index: 1;
}

.scroll-hint span {
    display: inline-block;
    margin-top: 4px;
    font-size: 1.1rem;
    line-height: 1;
    letter-spacing: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Main Content */
#content {
    padding-top: 180px;
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 0; /* Remove bottom padding - footer has its own padding */
    overflow-y: auto;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
    align-items: start;
}

/* Markdown Content */
#markdown-content {
    max-width: 700px;
}

.section {
    margin-bottom: 80px;
}

.section-title {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 3.5rem;
    font-weight: 400;
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
}

.section-number {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 1.1rem;
    color: #bd5d3a;
    opacity: 1;
    margin-right: 1rem;
    letter-spacing: 0.05em;
}

.section h2 {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 2.3rem;
    font-weight: 400;
    margin: 2.5rem 0 1.5rem;
    letter-spacing: -0.01em;
}

.section h2::before {
    content: attr(data-subsection-number);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 1rem;
    color: #3d3929;
    opacity: 0.8;
    margin-right: 1rem;
    letter-spacing: 0.05em;
}

.section h3 {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 1.8rem;
    font-weight: 400;
    margin: 2rem 0 1rem;
}

.section p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.section ul, .section ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.section li {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.section blockquote {
    border-left: 3px solid #bd5d3a;
    padding-left: 2rem;
    margin: 2rem 0;
    font-style: italic;
    opacity: 0.8;
}

.section img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
    display: block;
}

.section code {
    background: rgba(61, 57, 41, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.95em;
}

.section pre {
    background: rgba(61, 57, 41, 0.05);
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 2rem 0;
}

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

/* Canvas Container */
#canvas-container {
    position: sticky;
    top: 140px;
    width: 400px;
    height: 600px;
}

#main-canvas {
    width: 100%;
    height: 100%;
}

/* Footer */
#content-footer {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    min-height: auto; /* Auto height based on content */
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(189, 93, 58, 0.15);
    margin-top: 120px;
    background: #e0ddd3;
    padding: 20px 20px;
}

/* Remove dot pattern from footer */
#content-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e0ddd3;
    z-index: -1;
}

.footer-content {
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.footer-citation {
    margin-bottom: 1.5rem; /* Reduced from 3rem to 2rem */
}

.citation-title {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 2rem; /* Increased from 1.5rem */
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.citation-code {
    background: rgba(26, 26, 26, 0.05);
    border: 1px solid rgba(189, 93, 58, 0.12);
    border-radius: 6px;
    padding: 1.5rem; /* Reduced from 1.5rem to 1.25rem */
    text-align: left;
    overflow-x: auto;
    margin: 0;
}

.citation-code code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.85rem; /* Increased from 0.85rem for better readability */
    line-height: 1.6;
    color: #3d3929;
    display: block;
    white-space: pre;
}

.footer-social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 1.5rem; /* Reduced from 2rem to 1.5rem */
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: rgba(61, 57, 41, 0.6);
    transition: all 0.3s ease;
    text-decoration: none;
    border-radius: 50%;
    background: transparent;
}

.social-link:hover {
    color: #3d3929;
    transform: translateY(-4px);
    background: rgba(26, 26, 26, 0.05);
}

.social-link svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1);
}

.footer-text {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.footer-copyright {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    opacity: 0.85;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.footer-note {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    opacity: 0.5;
    letter-spacing: 0.03em;
}

/* Scroll Navigation (Notion-style) */
#scroll-nav {
    position: fixed;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 60vh;
    z-index: 100;
}

#scroll-nav.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Track with lines (always visible) */
.scroll-nav-track {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Right align the lines */
    gap: 12px;
    padding: 10px 0;
    transition: opacity 0.2s ease;
}

#scroll-nav:hover .scroll-nav-track {
    opacity: 0;
    pointer-events: none;
}

.scroll-nav-line {
    height: 2px; /* Even thinner */
    background: rgba(26, 26, 26, 0.2);
    border-radius: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scroll-nav-line:hover {
    background: rgba(26, 26, 26, 0.4);
}

.scroll-nav-line.active {
    background: #bd5d3a;
}

/* Long line for sections */
.scroll-nav-line.level-1 {
    width: 32px; /* Shorter */
}

/* Short line for subsections */
.scroll-nav-line.level-2 {
    width: 20px; /* Shorter */
}

/* Popup menu (shown on hover, overlays the lines) */
#scroll-nav-items {
    position: absolute;
    right: calc(100%); /* Position to the left of nav lines */
    top: 50%;
    transform: translateY(-50%); /* Vertical center only */
    background: #F0EDE8;
    border: 1px solid rgba(189, 93, 58, 0.12);
    border-radius: 10px;
    padding: 10px 0;
    width: 280px; /* Fixed width */
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow:
        0 2px 8px rgba(61, 57, 41, 0.06),
        0 8px 24px rgba(61, 57, 41, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#scroll-nav:hover #scroll-nav-items {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.scroll-nav-item {
    display: flex;
    align-items: center;
    padding: 7px 18px;
    cursor: pointer;
    transition: background 0.15s ease;
    min-width: 0; /* Allow text to shrink */
}

.scroll-nav-item:hover {
    background: rgba(26, 26, 26, 0.04);
}

.scroll-nav-item.active {
    background: rgba(26, 26, 26, 0.08);
}

.scroll-nav-item.active .scroll-nav-title {
    color: #3d3929;
    font-weight: 700;
}

.scroll-nav-item.level-1 {
    padding-left: 18px;
    padding-right: 18px;
}

.scroll-nav-item.level-2 {
    padding-left: 36px;
    padding-right: 18px;
}

.scroll-nav-title {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    color: rgba(26, 26, 26, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
    line-height: 1.5;
    min-width: 0; /* Important for ellipsis to work */
    flex: 1; /* Take available space */
    letter-spacing: 0.02em;
}

.scroll-nav-item.level-1 .scroll-nav-title {
    font-weight: 500;
    font-size: 0.75rem;
}

.scroll-nav-item.level-2 .scroll-nav-title {
    font-size: 0.7rem;
}

/* Scrollbar for popup menu */
#scroll-nav-items::-webkit-scrollbar {
    width: 6px;
}

#scroll-nav-items::-webkit-scrollbar-track {
    background: transparent;
}

#scroll-nav-items::-webkit-scrollbar-thumb {
    background: rgba(26, 26, 26, 0.15);
    border-radius: 3px;
}

#scroll-nav-items::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 26, 26, 0.25);
}

/* Table of Contents */
#table-of-contents {
    padding: 80px 40px 60px;
    overflow-y: auto;
}

.toc-container {
    max-width: 1400px;
    margin: 0 auto;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toc-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
}

.toc-title {
    font-family: 'Tiempos Text', 'Times New Roman', 'Georgia', 'Garamond', serif;
    font-size: 3.5rem;
    font-weight: 400;
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
}

.toc-grid {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px 30px;
}

.toc-section {
    margin-bottom: 1.5rem;
}

.toc-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
    position: relative;
}

.toc-section-title:hover {
    color: #bd5d3a;
}

.toc-section-title:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #bd5d3a;
}

.toc-section-number {
    color: #bd5d3a;
    opacity: 1;
    margin-right: 0.5rem;
}

.toc-subsections {
    list-style: none;
    padding-left: 1rem;
}

.toc-subsections li {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    padding-left: 1rem;
}

.toc-subsections li:before {
    content: '◇';
    position: absolute;
    left: 0;
    color: #3d3929;
    opacity: 0.5;
}

.toc-subsections li:hover {
    color: #bd5d3a;
    opacity: 1;
}

#toc-canvas-container {
    position: sticky;
    top: 80px;
    width: 400px;
    height: 600px;
    transition: opacity 0.3s ease;
}

#toc-canvas {
    width: 100%;
    height: 100%;
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 40px;
    right: 180px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #bd5d3a;
    color: #bd5d3a;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#back-to-top.hidden {
    opacity: 0;
    pointer-events: none;
}

#back-to-top:hover {
    background: #bd5d3a;
    color: #eeece2;
}

#back-to-top .btn-arrow {
    display: inline-block;
    font-size: 22px;
    line-height: 1;
    vertical-align: -3px;
    margin-right: 6px;
    letter-spacing: 0;
    font-weight: 600;
}

.back-to-top-link {
    background: transparent;
    border: 1px solid #bd5d3a;
    color: #bd5d3a;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.3s;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.back-to-top-link:hover {
    background: #bd5d3a;
    color: #eeece2;
}

/* Audio Controls */
#audio-controls {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 100;
    opacity: 0.85;
    transition: opacity 0.2s;
}

#audio-controls:hover {
    opacity: 1;
}

#audio-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #bd5d3a;
    color: #e8e4dc;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#audio-toggle:hover {
    transform: scale(1.1);
}

#audio-toggle.playing svg circle {
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    #canvas-container {
        position: relative;
        top: 0;
        width: 100%;
        max-width: 400px;
        height: min(55vh, 420px);
        margin: 0 auto 60px;
    }

    .toc-content {
        grid-template-columns: 1fr;
    }

    #toc-canvas-container {
        position: relative;
        top: 0;
        width: 100%;
        max-width: 400px;
        height: min(55vh, 420px);
        margin: 0 auto;
    }

    .toc-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #back-to-top {
        right: 40px;
        bottom: 100px;
    }

    .progress-section-label {
        font-size: 10px;
        padding: 6px 16px;
    }

    #progress-bar-container {
        height: 100px;
        padding: 0 40px;
    }

    #content-footer {
        height: 40vh;
        margin-top: 80px;
    }

    .footer-text {
        font-size: 1.3rem;
    }

    #scroll-nav {
        right: 20px;
    }

    #scroll-nav-items {
        width: calc(100vw - 60px);
        max-width: 250px;
    }

    .scroll-nav-line.level-1 {
        width: 36px;
    }

    .scroll-nav-line.level-2 {
        width: 22px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .nav-buttons {
        flex-direction: column;
        width: 100%;
    }

    .nav-btn {
        width: 100%;
    }

    #hero-canvas-container {
        width: 100%;
        max-width: 400px;
        height: min(50vh, 360px);
    }

    #hero-canvas {
        width: 100%;
        height: 100%;
        top: 0;
    }

    #canvas-container,
    #toc-canvas-container {
        height: min(50vh, 340px);
    }

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

    .section-title {
        font-size: 2.5rem;
    }

    .section h2 {
        font-size: 1.8rem;
    }

    #content {
        padding: 80px 20px 40px;
    }

    .content-wrapper {
        gap: 40px;
    }

    #back-to-top {
        right: 20px;
        bottom: 100px;
        padding: 10px 20px;
    }

    #audio-controls {
        right: 20px;
        bottom: 20px;
    }

    .progress-section-label {
        font-size: 9px;
        padding: 5px 14px;
        top: 15px;
    }

    .progress-section-dot {
        width: 10px;
        height: 10px;
    }

    #progress-bar-container {
        height: 90px;
        padding: 0 20px;
    }

    #content-footer {
        height: 35vh;
        margin-top: 60px;
    }

    .footer-text {
        font-size: 1.1rem;
    }

    .footer-copyright,
    .footer-note {
        font-size: 0.8rem;
    }

    #scroll-nav {
        display: none; /* Hide on mobile */
    }
}

/* Respect OS-level motion preference: kill decorative animation and fade transitions. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .scroll-hint,
    #audio-toggle.playing svg circle {
        animation: none !important;
    }
}

/* Keyboard focus ring — visible on all interactive targets. */
:focus-visible {
    outline: 2px solid #bd5d3a;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Page Dots Navigation ─────────────────────────────────────────────────── */
#page-dots {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 500;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(61, 57, 41, 0.25);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s, transform 0.3s;
}

.page-dot.active {
    background: #bd5d3a;
    transform: scale(1.4);
}

.page-dot:hover {
    background: rgba(189, 93, 58, 0.6);
    transform: scale(1.2);
}

/* ─── Full-page Layout ─────────────────────────────────────────────────────── */
.fullpage-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    padding: 60px 80px;
    gap: 60px;
    box-sizing: border-box;
    flex: 1;
}

.fullpage-layout--tight {
    display: grid;
    grid-template-columns: minmax(720px, 900px) minmax(520px, 640px);
    justify-content: center;
    align-items: center;
    gap: clamp(0px, 1.2vw, 18px);
    flex: 0 1 auto;
    width: min(calc(100vw - 80px), 1480px);
    max-width: 1480px;
    margin: 0 auto;
}

.fullpage-layout--tight .fullpage-text {
    max-width: 900px;
    flex: initial;
}

.fullpage-layout--tight .fullpage-visual {
    width: min(38vw, 640px);
    min-width: 520px;
    height: min(38vw, 640px);
    min-height: 520px;
    margin-left: -32px;
}

.fullpage-layout--center {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 80px;
}

.fullpage-layout--features {
    gap: 18px;
    justify-content: center;
}

.fullpage-text {
    flex: 1;
    max-width: 560px;
}

.fullpage-text--wide {
    max-width: 720px;
    text-align: left;
}

#page-quickstart .fullpage-layout--center {
    padding-left: 56px;
    padding-right: 56px;
}

.quickstart-content {
    width: min(calc(100vw - 112px), 1500px);
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: minmax(660px, 1fr) minmax(320px, 0.62fr);
    gap: clamp(24px, 3vw, 48px);
    align-items: center;
}

.quickstart-copy {
    width: 100%;
    min-width: 0;
}

.quickstart-content .page-body {
    max-width: 760px;
}

#page-quickstart .page-label,
#page-quickstart .page-title,
#page-quickstart .page-body {
    text-align: left;
}

#page-quickstart .code-block {
    width: 100%;
}

.quickstart-showcase-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 560px;
}

.quickstart-showcase {
    position: relative;
    width: 100%;
    aspect-ratio: 1024 / 650;
    border: 1px solid rgba(61, 57, 41, 0.2);
    background: rgba(61, 57, 41, 0.05);
    box-shadow: 12px 12px 0 rgba(61, 57, 41, 0.1);
    overflow: hidden;
}

.quickstart-showcase__caption {
    margin: 12px 0 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: rgba(61, 57, 41, 0.6);
    text-align: right;
}

.quickstart-showcase::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(238, 236, 226, 0.42);
    pointer-events: none;
    z-index: 1;
}

.quickstart-showcase__video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.fullpage-visual {
    flex-shrink: 0;
    width: 420px;
    height: 420px;
}

.fullpage-visual canvas {
    width: 100%;
    height: 100%;
}

/* ─── Page Typography ──────────────────────────────────────────────────────── */
.page-label {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #bd5d3a;
    margin-bottom: 1rem;
    font-weight: 400;
}

.page-title {
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

.page-body {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1.2rem;
    opacity: 0.85;
}

.interaction-hint {
    margin: -0.75rem 0 1.5rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: rgba(61, 57, 41, 0.55);
    text-align: center;
}

.interaction-hint:empty {
    display: none;
}

.page-body strong {
    color: #a84f32;
    font-weight: 700;
}

.page-body em {
    color: #5f6f3b;
    font-style: italic;
    font-weight: 700;
}

.motivation-forces {
    display: block;
    margin: 0.55rem 0 0.55rem 4ch;
}

.motivation-forces span {
    display: block;
}

.page-body--muted {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-top: 1rem;
}

.page-body code {
    background: rgba(61, 57, 41, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.page-quote {
    position: relative;
    display: block;
    border-left: 4px solid #bd5d3a;
    border-top: 1px solid rgba(189, 93, 58, 0.18);
    background:
        linear-gradient(90deg, rgba(189, 93, 58, 0.08), rgba(189, 93, 58, 0.02));
    padding: 1.1rem 1.35rem 1.1rem 3rem;
    margin: 0.65rem 0 1.9rem;
    font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    font-style: normal;
    font-weight: 400;
    opacity: 0.95;
    font-size: clamp(1.14rem, 1.45vw, 1.36rem);
    line-height: 1.45;
    letter-spacing: -0.012em;
    color: #5a4b34;
    box-shadow: 8px 8px 0 rgba(61, 57, 41, 0.04);
}

.page-quote::before {
    content: '“';
    position: absolute;
    left: 0.85rem;
    top: 0.2rem;
    font-family: Georgia, serif;
    font-size: 3.25rem;
    line-height: 1;
    color: rgba(189, 93, 58, 0.55);
}

.page-quote__text {
    display: block;
    font-style: italic;
}

.page-quote__author {
    display: block;
    margin-top: 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1;
    text-transform: uppercase;
    color: #a84f32;
    text-align: right;
}

.page-quote__author::before {
    content: '— ';
    letter-spacing: 0;
}

/* ─── Code Block ───────────────────────────────────────────────────────────── */
.code-block {
    background: rgba(61, 57, 41, 0.05);
    border: 1px solid rgba(61, 57, 41, 0.12);
    border-radius: 6px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.code-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(61, 57, 41, 0.06);
    border-bottom: 1px solid rgba(61, 57, 41, 0.08);
}

.code-block__lang {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.5;
}

.code-block__copy {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid rgba(61, 57, 41, 0.25);
    color: #3d3929;
    padding: 3px 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.code-block__copy:hover {
    background: #bd5d3a;
    color: #eeece2;
    border-color: #bd5d3a;
}

.code-block__pre {
    margin: 0;
    padding: 1.2rem 1.25rem;
    overflow-x: hidden;
}

.code-block__pre code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: clamp(0.68rem, 0.74vw, 0.82rem);
    line-height: 1.8;
    color: #3d3929;
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.code-token--command,
.code-token--key {
    color: #a84f32;
    font-weight: 700;
}

.code-token--path,
.code-token--value {
    color: #5f6f3b;
    font-weight: 700;
}

.code-token--slash {
    color: #bd5d3a;
    font-weight: 700;
}

.code-token--comment {
    color: rgba(61, 57, 41, 0.52);
    font-style: italic;
}

/* ─── Architecture Modules ─────────────────────────────────────────────────── */
#page-architecture .fullpage-layout {
    justify-content: center;
    gap: clamp(16px, 2vw, 28px);
    padding-left: 64px;
    padding-right: 64px;
    padding-top: 96px;
}

#page-architecture .fullpage-text {
    flex: 0 1 700px;
    max-width: 700px;
}

#page-architecture .fullpage-visual {
    width: clamp(460px, 38vw, 620px);
    height: clamp(460px, 38vw, 620px);
    margin-left: -6px;
    transform: translateY(38px);
}

.arch-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    gap: 12px;
    margin-top: 1.5rem;
    align-items: stretch;
}

.arch-tree {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 14px 16px 14px 14px;
    border: 1px solid rgba(61, 57, 41, 0.14);
    border-radius: 4px;
    background: rgba(61, 57, 41, 0.045);
    box-shadow: 8px 8px 0 rgba(61, 57, 41, 0.055);
    overflow: hidden;
}

.arch-tree__root,
.arch-tree__item {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    letter-spacing: 0.02em;
}

.arch-tree__root {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(61, 57, 41, 0.16);
    background: rgba(238, 236, 226, 0.82);
    color: #a84f32;
    font-size: 0.9rem;
    font-weight: 700;
}

.arch-tree__list {
    position: relative;
    display: grid;
    grid-template-rows: repeat(9, minmax(0, 1fr));
    gap: 0;
    flex: 1;
    margin: 10px 0 0 11px;
    padding: 0;
    list-style: none;
}

.arch-tree__list::before {
    content: '';
    position: absolute;
    left: 0;
    top: -10px;
    bottom: 13px;
    border-left: 1px solid rgba(61, 57, 41, 0.24);
}

.arch-tree__item {
    position: relative;
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 9px;
    row-gap: 1px;
    align-content: center;
    min-height: 0;
    font-size: clamp(0.82rem, 0.9vw, 1rem);
    color: rgba(61, 57, 41, 0.86);
}

.arch-tree__branch {
    grid-row: 1 / span 2;
    align-self: center;
    width: 15px;
    border-bottom: 1px solid rgba(61, 57, 41, 0.24);
}

.arch-tree__name {
    grid-column: 2;
    font-weight: 700;
    color: #3d3929;
    white-space: nowrap;
}

.arch-tree__desc {
    grid-column: 2;
    font-size: 0.78em;
    line-height: 1.15;
    color: rgba(61, 57, 41, 0.58);
    white-space: normal;
}

.arch-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.arch-module {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 52px;
    padding: 9px 12px;
    border: 1px solid rgba(61, 57, 41, 0.12);
    border-radius: 4px;
    background: rgba(61, 57, 41, 0.03);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.arch-module:hover {
    border-color: rgba(189, 93, 58, 0.3);
    background: rgba(189, 93, 58, 0.04);
    transform: translateX(2px);
}

.arch-module__num {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.7rem;
    color: #bd5d3a;
    letter-spacing: 0.08em;
    flex-shrink: 0;
    padding-top: 2px;
}

.arch-module__title {
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: 0.98rem;
    font-weight: 400;
    margin-bottom: 1px;
}

.arch-module__desc {
    font-size: 0.76rem;
    opacity: 0.7;
    line-height: 1.35;
    margin: 0;
}

/* ─── Features Cards ───────────────────────────────────────────────────────── */
.features-cards-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    width: min(calc(100vw - 176px), 1180px);
    margin-top: 6px;
}

.feature-card {
    appearance: none;
    min-height: 190px;
    padding: 24px 26px 26px;
    border: 1px solid rgba(61, 57, 41, 0.18);
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgba(238, 236, 226, 0.92), rgba(221, 216, 198, 0.64)),
        rgba(61, 57, 41, 0.035);
    text-align: left;
    box-sizing: border-box;
    box-shadow: 0 18px 50px rgba(61, 57, 41, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.feature-card:hover,
.feature-card:focus-visible {
    border-color: rgba(189, 93, 58, 0.38);
    box-shadow: 0 22px 58px rgba(61, 57, 41, 0.12);
    transform: translateY(-3px);
}

.feature-card:focus-visible {
    outline: 2px solid rgba(189, 93, 58, 0.7);
    outline-offset: 3px;
}

.feature-card:nth-child(-n + 2) {
    grid-column: span 3;
    min-height: 210px;
}

.feature-card:nth-child(n + 3) {
    grid-column: span 2;
}

.feature-card:nth-child(2) {
    background:
        linear-gradient(135deg, rgba(238, 236, 226, 0.9), rgba(207, 214, 184, 0.54)),
        rgba(61, 57, 41, 0.035);
}

.feature-card:nth-child(4) {
    background:
        linear-gradient(135deg, rgba(238, 236, 226, 0.92), rgba(221, 199, 181, 0.6)),
        rgba(61, 57, 41, 0.035);
}

.feature-card__num {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.7rem;
    color: #bd5d3a;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 14px;
}

.feature-card__title {
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: clamp(1.22rem, 1.45vw, 1.58rem);
    font-weight: 400;
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
    line-height: 1.12;
}

.feature-card__body {
    font-size: 0.86rem;
    line-height: 1.62;
    opacity: 0.8;
    margin: 0;
}

.feature-card__body code {
    background: rgba(61, 57, 41, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.feature-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 6vw, 80px);
    background:
        radial-gradient(circle at 50% 44%, rgba(238, 236, 226, 0.66), rgba(238, 236, 226, 0.88) 58%, rgba(238, 236, 226, 0.96)),
        rgba(238, 236, 226, 0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.feature-detail-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.feature-detail-card {
    position: relative;
    width: min(820px, 100%);
    max-height: min(680px, calc(100vh - 80px));
    overflow-y: auto;
    padding: clamp(32px, 5vw, 56px);
    border: 1px solid rgba(61, 57, 41, 0.22);
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgba(238, 236, 226, 0.98), rgba(222, 216, 196, 0.94)),
        #eeece2;
    box-shadow: 0 34px 90px rgba(61, 57, 41, 0.22);
    text-align: left;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.24s ease;
}

.feature-detail-card--with-image,
.feature-detail-card--with-video,
.feature-detail-card--with-table {
    width: min(1180px, 100%);
    max-height: min(760px, calc(100vh - 56px));
    padding: clamp(18px, 2vw, 28px);
    background: rgba(238, 236, 226, 0.98);
}

.feature-detail-overlay.active .feature-detail-card {
    transform: translateY(0) scale(1);
}

.feature-detail-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(61, 57, 41, 0.24);
    border-radius: 50%;
    background: rgba(238, 236, 226, 0.8);
    color: #3d3929;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.feature-detail-close:hover,
.feature-detail-close:focus-visible {
    border-color: #bd5d3a;
    color: #bd5d3a;
    outline: none;
}

.feature-detail-num {
    display: block;
    margin-bottom: 16px;
    color: #bd5d3a;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
}

.feature-detail-title {
    max-width: 14ch;
    margin: 0 56px 18px 0;
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: -0.02em;
}

.feature-detail-body {
    max-width: 68ch;
    margin: 0 0 28px;
    font-size: 0.98rem;
    line-height: 1.72;
    color: rgba(61, 57, 41, 0.82);
}

.feature-detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feature-detail-list:empty {
    display: none;
}

.feature-detail-list li {
    padding: 14px 16px;
    border: 1px solid rgba(61, 57, 41, 0.12);
    border-radius: 4px;
    background: rgba(61, 57, 41, 0.045);
    font-size: 0.9rem;
    line-height: 1.58;
    color: rgba(61, 57, 41, 0.82);
}

.feature-detail-body code,
.feature-detail-list code {
    background: rgba(61, 57, 41, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.92em;
}

.feature-card__body a,
.feature-detail-body a,
.app-card__body a {
    color: #bd5d3a;
    text-decoration: none;
    border-bottom: 1px solid rgba(189, 93, 58, 0.4);
    transition: border-color 0.18s ease;
}

.feature-card__body a:hover,
.feature-detail-body a:hover,
.app-card__body a:hover {
    border-bottom-color: #bd5d3a;
}

.feature-detail-image,
.feature-detail-video {
    display: none;
    width: 100%;
    height: auto;
    max-height: min(520px, calc(100vh - 320px));
    object-fit: contain;
    border-radius: 4px;
    background: rgba(61, 57, 41, 0.04);
}

.feature-detail-video[hidden] {
    display: none;
}

.feature-detail-caption[hidden] {
    display: none;
}

.feature-detail-caption {
    margin: 8px 0 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: rgba(61, 57, 41, 0.6);
    text-align: right;
}

.feature-detail-card--with-image .feature-detail-num {
    margin-bottom: 10px;
}

.feature-detail-card--with-image .feature-detail-title {
    max-width: none;
    margin-bottom: 10px;
    font-size: clamp(1.7rem, 3.2vw, 2.6rem);
    line-height: 1.04;
}

.feature-detail-card--with-image .feature-detail-body {
    max-width: 88ch;
    margin-bottom: 12px;
    font-size: 0.92rem;
    line-height: 1.55;
}

.feature-detail-card--with-image .feature-detail-image,
.feature-detail-card--with-video .feature-detail-video {
    display: block;
}

.feature-detail-card--with-video .feature-detail-num {
    margin-bottom: 10px;
}

.feature-detail-card--with-video .feature-detail-title {
    max-width: none;
    margin-bottom: 10px;
    font-size: clamp(1.7rem, 3.2vw, 2.6rem);
    line-height: 1.04;
}

.feature-detail-card--with-video .feature-detail-body {
    max-width: 88ch;
    margin-bottom: 12px;
    font-size: 0.92rem;
    line-height: 1.55;
}

.feature-detail-link[hidden] {
    display: none;
}

.feature-detail-link {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 12px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: #bd5d3a;
    text-decoration: none;
    border-bottom: 1px solid rgba(189, 93, 58, 0.4);
    padding-bottom: 1px;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.feature-detail-link:hover,
.feature-detail-link:focus-visible {
    color: #3d3929;
    border-bottom-color: #3d3929;
    outline: none;
}

.feature-detail-card--with-table .feature-detail-title {
    max-width: none;
    font-size: clamp(2rem, 4vw, 3.1rem);
}

.feature-detail-card--with-table .feature-detail-body {
    max-width: 88ch;
    margin-bottom: 18px;
}

.feature-detail-table-wrap[hidden] {
    display: none;
}

.feature-detail-table-wrap {
    margin-top: 8px;
    overflow-x: auto;
}

.feature-detail-table-caption {
    margin: 0 0 10px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(61, 57, 41, 0.62);
}

.feature-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    color: rgba(61, 57, 41, 0.88);
    background: rgba(61, 57, 41, 0.025);
    border: 1px solid rgba(61, 57, 41, 0.14);
    border-radius: 4px;
    overflow: hidden;
}

.feature-detail-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(61, 57, 41, 0.72);
    background: rgba(61, 57, 41, 0.06);
    border-bottom: 1px solid rgba(61, 57, 41, 0.18);
}

.feature-detail-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(61, 57, 41, 0.08);
    font-variant-numeric: tabular-nums;
}

.feature-detail-table tbody td:first-child {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.86rem;
    color: rgba(61, 57, 41, 0.92);
}

.feature-detail-table tbody tr:last-child td {
    border-bottom: none;
}

.feature-detail-table tbody tr.is-highlight {
    background: rgba(189, 93, 58, 0.09);
}

.feature-detail-table tbody tr.is-highlight td {
    color: #3d3929;
}

.feature-detail-table strong {
    font-weight: 600;
    color: #bd5d3a;
}

/* ─── Application Cards ────────────────────────────────────────────────────── */
.app-cards {
    display: flex;
    gap: 32px;
    margin-top: 2.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

#page-applications .fullpage-layout--center {
    justify-content: flex-start;
    padding-top: clamp(48px, 7vh, 88px);
}

.app-card {
    flex: 1;
    min-width: 280px;
    max-width: 360px;
    padding: 40px 32px;
    border: 1px solid rgba(61, 57, 41, 0.12);
    border-radius: 6px;
    background: rgba(61, 57, 41, 0.03);
    text-align: left;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition:
        transform 0.28s ease,
        border-color 0.28s ease,
        background 0.28s ease,
        box-shadow 0.28s ease;
}

.app-card:focus-visible {
    outline: 2px solid #bd5d3a;
    outline-offset: 4px;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #bd5d3a;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.32s ease;
}

.app-card:hover {
    border-color: rgba(189, 93, 58, 0.42);
    background: rgba(189, 93, 58, 0.05);
    box-shadow: 0 18px 36px rgba(61, 57, 41, 0.14);
    transform: translateY(-6px);
}

.app-card:hover::before {
    transform: scaleY(1);
}

.app-card:hover .app-card__title {
    color: #bd5d3a;
}

.app-card:hover .app-card__icon {
    transform: translateX(4px);
}

.app-card__icon {
    font-size: 1.8rem;
    color: #bd5d3a;
    display: block;
    margin-bottom: 16px;
    transition: transform 0.28s ease;
}

.app-card__title {
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 400;
    margin-bottom: 12px;
    transition: color 0.28s ease;
}

.app-card__body {
    font-size: 0.95rem;
    line-height: 1.65;
    opacity: 0.8;
    margin: 0;
}

/* ─── CTA Page ─────────────────────────────────────────────────────────────── */
.cta-content {
    width: min(100%, 1080px);
    max-width: 1080px;
    text-align: center;
}

#page-cta .page-title {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

#page-cta .page-body {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    text-align: justify;
    text-align-last: left;
}

.cta-buttons {
    justify-content: center;
    margin: 1.6rem 0 2rem;
}

.nav-btn--primary {
    background: #bd5d3a;
    color: #eeece2;
    border-color: #bd5d3a;
}

.nav-btn--primary:hover {
    background: #a04d30;
    border-color: #a04d30;
}

.cta-citation {
    width: min(100%, 680px);
    margin: 1.8rem auto 0;
    text-align: left;
}

.citation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 16px;
    background: rgba(61, 57, 41, 0.06);
    border: 1px solid rgba(61, 57, 41, 0.1);
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
}

.citation-title {
    font-family: 'Tiempos Text', 'Times New Roman', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0;
}

.citation-code {
    background: rgba(61, 57, 41, 0.05);
    border: 1px solid rgba(61, 57, 41, 0.1);
    border-radius: 0;
    padding: 1.1rem 1.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.citation-code::-webkit-scrollbar {
    display: none;
}

.citation-code code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #3d3929;
    display: block;
    min-width: 1120px;
    white-space: pre;
}

.citation-token--type,
.citation-token--key {
    color: #a84f32;
    font-weight: 700;
}

.citation-token--id,
.citation-token--command {
    color: #5f6f3b;
    font-weight: 700;
}

.citation-token--url {
    color: rgba(61, 57, 41, 0.72);
}

.citation-scroll {
    display: block;
    width: 100%;
    height: 18px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(61, 57, 41, 0.05);
    border: 1px solid rgba(61, 57, 41, 0.1);
    border-top: 0;
    border-radius: 0 0 4px 4px;
    cursor: ew-resize;
}

.citation-scroll::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(61, 57, 41, 0.16);
    border-radius: 999px;
}

.citation-scroll::-webkit-slider-thumb {
    width: 86px;
    height: 12px;
    margin-top: -3px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(61, 57, 41, 0.58);
    border: 1px solid rgba(61, 57, 41, 0.18);
    box-shadow: 0 1px 0 rgba(238, 236, 226, 0.7) inset;
    border-radius: 999px;
}

.citation-scroll::-moz-range-track {
    height: 6px;
    background: rgba(61, 57, 41, 0.16);
    border-radius: 999px;
}

.citation-scroll::-moz-range-thumb {
    width: 86px;
    height: 12px;
    background: rgba(61, 57, 41, 0.58);
    border: 1px solid rgba(61, 57, 41, 0.18);
    border-radius: 999px;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1160px) {
    .quickstart-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .quickstart-showcase {
        width: min(100%, 560px);
        justify-self: center;
    }
}

@media (max-width: 900px) {
    /* Mobile: stack all pages, use native scrolling, drop snap-nav layout */
    body.is-mobile {
        overflow-y: auto !important;
        overflow-x: hidden;
    }

    /* Mobile typography — serif for body copy (mono fallback hurts readability on phones) */
    body.is-mobile .page-body,
    body.is-mobile .feature-card__body,
    body.is-mobile .feature-detail-body,
    body.is-mobile .feature-detail-list li,
    body.is-mobile .app-card__body,
    body.is-mobile .arch-module__desc {
        font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Tiempos Text', serif;
        letter-spacing: 0;
        line-height: 1.65;
    }

    body.is-mobile .page-body {
        font-size: 0.98rem;
    }

    body.is-mobile .feature-card__body,
    body.is-mobile .app-card__body {
        font-size: 0.92rem;
    }

    /* Citation block — much smaller on mobile so it doesn't dominate the CTA page */
    body.is-mobile .citation-title {
        font-size: 0.78rem;
    }

    body.is-mobile .citation-code {
        padding: 0.55rem 0.7rem;
    }

    body.is-mobile .citation-code code {
        font-size: 0.5rem;
        line-height: 1.5;
        min-width: 600px;
    }

    body.is-mobile .citation-header {
        padding: 5px 10px;
    }

    body.is-mobile .citation-header .code-block__copy {
        font-size: 0.6rem;
        padding: 2px 7px;
    }

    body.is-mobile .page-section {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        min-height: auto;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: auto;
        overflow: visible;
        transition: none;
    }

    body.is-mobile .page-section.transitioning-out {
        opacity: 1 !important;
        visibility: visible !important;
    }

    body.is-mobile #page-hero {
        min-height: 100vh;
        min-height: 100dvh;
    }

    body.is-mobile #page-dots,
    body.is-mobile .scroll-hint,
    body.is-mobile #back-to-top {
        display: none !important;
    }

    /* Hide canvas containers on non-hero pages on mobile (perf) */
    body.is-mobile #motivation-canvas-container-1,
    body.is-mobile #motivation-canvas-container-2,
    body.is-mobile #motivation-canvas-container-3,
    body.is-mobile #architecture-canvas-container {
        display: none;
    }

    .fullpage-layout {
        flex-direction: column;
        padding: 80px 32px 40px;
        gap: 32px;
        overflow-y: auto;
    }

    .fullpage-layout--center {
        padding: 80px 32px 40px;
    }

    .fullpage-layout--tight {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        width: 100%;
        max-width: 100%;
        padding: 80px 32px 40px;
        gap: 24px;
    }

    .fullpage-layout--tight .fullpage-text {
        max-width: 100%;
    }

    .fullpage-layout--tight .fullpage-visual {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 0;
        margin-left: 0;
    }

    .fullpage-visual {
        width: 100%;
        max-width: 320px;
        height: 280px;
        margin: 0 auto;
    }

    .fullpage-text {
        max-width: 100%;
    }

    .quickstart-content {
        width: 100%;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    #page-quickstart .fullpage-layout--center {
        padding-left: 32px;
        padding-right: 32px;
    }

    .quickstart-showcase {
        width: min(100%, 420px);
        max-width: 420px;
    }

    #page-architecture .fullpage-layout {
        padding-left: 32px;
        padding-right: 32px;
        padding-top: 80px;
        gap: 18px;
    }

    #page-architecture .fullpage-text {
        flex: initial;
        max-width: 100%;
    }

    #page-architecture .fullpage-visual {
        width: min(100%, 420px);
        height: 360px;
        margin-left: 0;
        transform: none;
    }

    .arch-modules {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
        gap: 10px;
    }

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

    .features-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 12px;
    }

    .feature-card,
    .feature-card:nth-child(-n + 2),
    .feature-card:nth-child(n + 3) {
        grid-column: span 1;
        min-height: 178px;
        padding: 22px 22px 24px;
    }

    .app-cards {
        flex-direction: column;
        align-items: center;
    }

    .app-card {
        max-width: 100%;
        width: 100%;
    }

    #page-dots {
        right: 12px;
    }
}

@media (max-width: 600px) {
    .fullpage-layout,
    .fullpage-layout--center {
        padding: 70px 20px 32px;
    }

    .fullpage-layout--features {
        justify-content: flex-start;
        gap: 12px;
    }

    #page-quickstart .fullpage-layout--center {
        padding-left: 20px;
        padding-right: 20px;
    }

    #page-architecture .fullpage-layout {
        padding-left: 20px;
        padding-right: 20px;
        gap: 14px;
    }

    .arch-modules {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .arch-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .arch-module {
        min-height: 44px;
        padding: 7px 8px;
        gap: 7px;
    }

    .arch-module__num {
        font-size: 0.62rem;
    }

    .arch-module__title {
        font-size: 0.84rem;
    }

    .arch-module__desc {
        font-size: 0.66rem;
        line-height: 1.25;
    }

    .arch-tree {
        padding: 12px 14px;
    }

    .arch-tree__root {
        font-size: 0.8rem;
    }

    .arch-tree__item {
        grid-template-columns: 13px minmax(0, 1fr);
        column-gap: 6px;
        row-gap: 1px;
        min-height: 25px;
        font-size: 0.7rem;
    }

    .arch-tree__branch {
        width: 13px;
    }

    #page-architecture .fullpage-visual {
        width: min(100%, 340px);
        height: 260px;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .main-title {
        font-size: clamp(1.8rem, 8.5vw, 2.5rem);
        padding-left: 1.2rem;
        padding-right: 1.2rem;
        max-width: 100%;
    }

    .subtitle {
        font-size: 0.85rem;
        padding: 0 0.5rem;
    }

    .feature-card {
        padding: 24px 20px;
    }

    .features-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .feature-card,
    .feature-card:nth-child(-n + 2),
    .feature-card:nth-child(n + 3) {
        grid-column: span 1;
        min-height: auto;
        padding: 20px;
    }

    .feature-card__title {
        font-size: 1.3rem;
    }

    .feature-detail-overlay {
        align-items: flex-start;
        padding: 76px 16px 24px;
        overflow-y: auto;
    }

    .feature-detail-card {
        max-height: none;
        padding: 28px 22px 24px;
    }

    .feature-detail-card--with-image,
    .feature-detail-card--with-video,
    .feature-detail-card--with-table {
        padding: 12px;
    }

    .feature-detail-table {
        font-size: 0.82rem;
    }

    .feature-detail-table thead th,
    .feature-detail-table tbody td {
        padding: 10px 12px;
    }

    .feature-detail-title {
        max-width: 11ch;
        margin-right: 44px;
        font-size: 2.2rem;
    }

    .feature-detail-body {
        font-size: 0.9rem;
    }

    .feature-detail-list li {
        padding: 12px 13px;
        font-size: 0.84rem;
    }

    .feature-detail-image,
    .feature-detail-video {
        max-height: none;
    }

    #page-dots {
        display: none;
    }
}
