/* ============================================================
   1. THEME VARIABLES & CINEMATIC PALETTE
   ============================================================ */
:root {
    /* Obsidian & Warm Tobacco Dark Palette (Default) */
    --bg-base: #0a0706;
    --bg-card: #130e0b;
    --bg-elevated: #1c1511;
    --bg-border: rgba(220, 180, 150, 0.1);
    --border-hover: rgba(217, 119, 87, 0.4);

    --text-primary: #f5ede6;
    --text-muted: #968378;
    --text-ghost: rgba(245, 237, 230, 0.2);

    --header-bg: rgba(10, 7, 6, 0.85);
    --mobile-bg: rgba(10, 7, 6, 0.98);

    /* Warm Ceramic & Ember Accent Tokens */
    --accent: #d97757;
    --accent-dim: rgba(217, 119, 87, 0.15);
    --accent-glow: rgba(217, 119, 87, 0.08);
    --accent-hover: #e28b6d;
    --accent-gradient: linear-gradient(135deg, #e28b6d 0%, #b85438 100%);

    --success: #10b981;
    --success-dim: rgba(16, 185, 129, 0.15);

    /* Shadows & Depths */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.8);

    /* Radii */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Motion Curves */
    --transition-fast: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 700ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Warm Paper Atelier Light Theme */
html.light {
    --bg-base: #f5f0ec;
    --bg-card: #ffffff;
    --bg-elevated: #eae2dc;
    --bg-border: rgba(120, 80, 60, 0.12);
    --border-hover: rgba(181, 96, 71, 0.5);

    --text-primary: #1e1613;
    --text-muted: #7a6b63;
    --text-ghost: rgba(30, 22, 19, 0.10);

    --header-bg: rgba(245, 240, 236, 0.92);
    --mobile-bg: rgba(245, 240, 236, 0.98);

    --accent: #b56047;
    --accent-dim: rgba(181, 96, 71, 0.12);
    --accent-glow: rgba(181, 96, 71, 0.06);
    --accent-hover: #c4725a;
    --accent-gradient: linear-gradient(135deg, #b56047 0%, #d4866a 100%);

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.08);
}

/* Also apply light theme when class is not dark (system preference fallback) */
html:not(.dark) {
    --bg-base: #f5f0ec;
    --bg-card: #ffffff;
    --bg-elevated: #eae2dc;
    --bg-border: rgba(120, 80, 60, 0.12);
    --border-hover: rgba(181, 96, 71, 0.5);

    --text-primary: #1e1613;
    --text-muted: #7a6b63;
    --text-ghost: rgba(30, 22, 19, 0.10);

    --header-bg: rgba(245, 240, 236, 0.92);
    --mobile-bg: rgba(245, 240, 236, 0.98);

    --accent: #b56047;
    --accent-dim: rgba(181, 96, 71, 0.12);
    --accent-glow: rgba(181, 96, 71, 0.06);
    --accent-hover: #c4725a;
    --accent-gradient: linear-gradient(135deg, #b56047 0%, #d4866a 100%);

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   2. GLOBAL RESET & BASE STYLES
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Subtle Architectural Grid Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(circle at 50% 30%, black 30%, transparent 85%);
    -webkit-mask-image: radial-gradient(circle at 50% 30%, black 30%, transparent 85%);
}

html:not(.dark) body::before,
html.light body::before {
    opacity: 0.10;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

/* Analog Film Grain Texture Overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

html:not(.dark) body::after,
html.light body::after {
    opacity: 0.025;
}

/* Atmospheric Vignette */
.cinematic-vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%, transparent 55%, rgba(5, 3, 2, 0.75) 100%);
}

html:not(.dark) .cinematic-vignette,
html.light .cinematic-vignette {
    background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(160, 130, 110, 0.12) 100%);
}

/* Selection */
::selection {
    background: var(--accent);
    color: #000;
}

/* Minimal Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: rgba(220, 180, 150, 0.15);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

html:not(.dark) ::-webkit-scrollbar-thumb,
html.light ::-webkit-scrollbar-thumb {
    background: rgba(120, 80, 60, 0.15);
}
html:not(.dark) ::-webkit-scrollbar-thumb:hover,
html.light ::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================================================
   3. EDITORIAL TYPOGRAPHY & WORD HIGHLIGHTING
   ============================================================ */
.font-editorial {
    font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
    letter-spacing: -0.015em;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.03em;
}

/* Apple/Editorial Word Scroll Illumination */
.text-scroll-highlight {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .text-scroll-highlight {
        font-size: 1.25rem;
        line-height: 1.9;
    }
}

.text-scroll-highlight .word {
    display: inline;
    opacity: 0.28;
    transition: opacity 0.25s ease, color 0.25s ease;
    will-change: opacity, color;
}

.text-scroll-highlight .word.active {
    opacity: 1;
    color: var(--text-primary);
}

.text-scroll-highlight .word.active.emphasis {
    color: var(--accent);
    font-weight: 500;
}

/* ============================================================
   4. HARDWARE-ACCELERATED PARALLAX & CURTAIN MASKS
   ============================================================ */
[data-parallax] {
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.curtain-reveal {
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

.curtain-reveal img,
.curtain-reveal > div {
    will-change: transform, filter;
    transform: scale(1.18);
    transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
}

.curtain-reveal.in-view img,
.curtain-reveal.in-view > div {
    transform: scale(1);
}

/* Burnished Editorial Frame with Internal Falloff */
.editorial-frame {
    position: relative;
    border: 1px solid var(--bg-border);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(217, 119, 87, 0.06);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.editorial-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.65);
    z-index: 2;
    transition: box-shadow var(--transition-base);
}

html:not(.dark) .editorial-frame::after,
html.light .editorial-frame::after {
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.04);
}

.editorial-frame:hover {
    border-color: var(--border-hover);
}

/* ============================================================
   5. HEADER, NAVIGATION & SCROLL CHROME
   ============================================================ */
.glass-header {
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.glass-header.is-scrolled {
    background: color-mix(in srgb, var(--bg-base) 88%, transparent);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.08);
}

html:not(.dark) .glass-header.is-scrolled,
html.light .glass-header.is-scrolled {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.06);
    border-color: rgba(120, 80, 60, 0.06);
}

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    z-index: 100000;
    background: var(--accent-gradient);
    box-shadow: 0 0 12px var(--accent);
    pointer-events: none;
}

/* Dropdown Menu */
.dropdown-container {
    position: relative;
}

.dropdown-trigger .arrow {
    transition: transform var(--transition-fast);
}

.dropdown-container.open .dropdown-trigger .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: rgba(19, 14, 11, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-md);
    padding: 0.35rem;
    min-width: 190px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

html:not(.dark) .dropdown-menu,
html.light .dropdown-menu {
    background: rgba(245, 240, 236, 0.97);
    border-color: rgba(120, 80, 60, 0.12);
}

.dropdown-container.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
}

html:not(.dark) .dropdown-menu a:hover,
html.light .dropdown-menu a:hover {
    background: rgba(0, 0, 0, 0.04);
}

.dropdown-menu .divider {
    height: 1px;
    background: var(--bg-border);
    margin: 0.35rem 0.5rem;
}

.glass-mobile-menu {
    background: var(--mobile-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* Mobile menu active state - body scroll lock */
body.menu-open {
    overflow: hidden;
}

/* ============================================================
   6. ATELIER CUSTOM CURSOR
   ============================================================ */
#cursor-dot,
#cursor-ring {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    z-index: 99999;
    opacity: 0;
    will-change: transform, width, height;
}

#cursor-dot {
    width: 5px;
    height: 5px;
    background-color: var(--accent);
    transition: transform 0.1s ease, opacity var(--transition-base);
}

#cursor-ring {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(217, 119, 87, 0.6);
    transition: transform var(--transition-fast), border-color var(--transition-base), width var(--transition-base), height var(--transition-base), background var(--transition-base), opacity var(--transition-base);
}

html:not(.dark) #cursor-ring,
html.light #cursor-ring {
    border-color: rgba(181, 96, 71, 0.5);
}

#cursor-ring.hover {
    width: 54px;
    height: 54px;
    border-color: var(--accent);
    background: rgba(217, 119, 87, 0.08);
}

#cursor-dot.hover {
    transform: scale(1.4);
}

@media (pointer: coarse) {
    #cursor-dot, #cursor-ring {
        display: none !important;
    }
}

/* ============================================================
   7. 3D SPECULAR TOOL CARDS
   ============================================================ */
.tool-card {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    --shine-x: 50%;
    --shine-y: 50%;
    min-height: 220px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform 0.18s ease-out;
    will-change: transform;
}

.tool-card::after {
    content: '';
    position: absolute;
    inset: -30%;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, 0.14) 0%, transparent 40%);
    transition: opacity 0.25s ease;
}

html:not(.dark) .tool-card::after,
html.light .tool-card::after {
    background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, 0.5) 0%, transparent 40%);
}

.tool-card[data-tool-card]::before {
    content: attr(data-tool-card);
    position: absolute;
    right: 1.25rem;
    bottom: 0.5rem;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 5.5rem;
    font-weight: 300;
    line-height: 1;
    color: var(--text-ghost);
    pointer-events: none;
    z-index: 0;
    user-select: none;
    transition: color var(--transition-base);
}

.tool-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(217, 119, 87, 0.15);
}

html:not(.dark) .tool-card:hover,
html.light .tool-card:hover {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(181, 96, 71, 0.12);
}

.tool-card:hover::after {
    opacity: 1;
}

.tool-card:hover[data-tool-card]::before {
    color: rgba(217, 119, 87, 0.18);
}

html:not(.dark) .tool-card:hover[data-tool-card]::before,
html.light .tool-card:hover[data-tool-card]::before {
    color: rgba(181, 96, 71, 0.12);
}

.tool-card > div {
    position: relative;
    z-index: 1;
}

/* Light theme card background override */
html:not(.dark) .tool-card,
html.light .tool-card {
    background: #ffffff !important;
    border-color: rgba(120, 80, 60, 0.08) !important;
}

/* ============================================================
   8. AMBIENT CANVAS & PRELOADER
   ============================================================ */
#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.65;
}

html:not(.dark) #bg-canvas,
html.light #bg-canvas {
    opacity: 0.20;
}

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

#loading-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
}

.loading-icon {
    width: 44px;
    height: 44px;
    opacity: 0.85;
    animation: gentlePulse 2s ease-in-out infinite;
}

.loading-bar {
    width: 110px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

html:not(.dark) .loading-bar,
html.light .loading-bar {
    background: rgba(0, 0, 0, 0.10);
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s linear;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); opacity: 0.75; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* Smooth Page Transitions */
#page-transition {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
    background: var(--bg-base);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.5s cubic-bezier(0.76, 0, 0.24, 1);
}

#page-transition.active {
    transform: scaleY(1);
    pointer-events: all;
}

/* ============================================================
   9. ACCESSIBILITY & MOTION PREFERENCES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    [data-parallax] {
        transform: none !important;
    }

    .curtain-reveal img,
    .curtain-reveal > div {
        transform: none !important;
    }

    .tool-card {
        transform: none !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   10. LIGHT THEME OVERRIDES FOR TAILWIND UTILITY CLASSES
   ============================================================ */
/* These override the hardcoded Tailwind classes in the HTML */

/* Background colors */
html:not(.dark) .bg-\[var\(--bg-base\)\],
html.light .bg-\[var\(--bg-base\)\] {
    background-color: #f5f0ec !important;
}

html:not(.dark) .bg-\[\#0a0706\],
html.light .bg-\[\#0a0706\] {
    background-color: #f5f0ec !important;
}

html:not(.dark) .bg-\[\#130e0b\],
html.light .bg-\[\#130e0b\] {
    background-color: #ffffff !important;
}

html:not(.dark) .bg-brand-950,
html.light .bg-brand-950 {
    background-color: #f0e8e0 !important;
}

html:not(.dark) .bg-black\/40,
html.light .bg-black\/40 {
    background-color: rgba(255, 255, 255, 0.60) !important;
}

html:not(.dark) .bg-black\/60,
html.light .bg-black\/60 {
    background-color: rgba(255, 255, 255, 0.80) !important;
}

html:not(.dark) .bg-black\/70,
html.light .bg-black\/70 {
    background-color: rgba(255, 255, 255, 0.90) !important;
}

html:not(.dark) .bg-white\/\[0\.02\],
html.light .bg-white\/\[0\.02\] {
    background-color: rgba(255, 255, 255, 0.80) !important;
}

html:not(.dark) .bg-white\/\[0\.03\],
html.light .bg-white\/\[0\.03\] {
    background-color: rgba(255, 255, 255, 0.85) !important;
}

html:not(.dark) .bg-white\/\[0\.04\],
html.light .bg-white\/\[0\.04\] {
    background-color: rgba(255, 255, 255, 0.90) !important;
}

html:not(.dark) .bg-gradient-to-b,
html.light .bg-gradient-to-b {
    --tw-gradient-from: #f8f2ec !important;
    --tw-gradient-to: #f0e8e0 !important;
}

html:not(.dark) .bg-gradient-to-br,
html.light .bg-gradient-to-br {
    --tw-gradient-from: #faf5f0 !important;
    --tw-gradient-to: #f0e8e2 !important;
}

/* Text colors */
html:not(.dark) .text-white,
html.light .text-white {
    color: #1e1613 !important;
}

html:not(.dark) .text-white\/90,
html.light .text-white\/90 {
    color: #1e1613 !important;
    opacity: 0.9;
}

html:not(.dark) .text-white\/50,
html.light .text-white\/50 {
    color: #7a6b63 !important;
    opacity: 0.7;
}

html:not(.dark) .text-white\/30,
html.light .text-white\/30 {
    color: #7a6b63 !important;
    opacity: 0.5;
}

html:not(.dark) .text-\[\#f5ede6\],
html.light .text-\[\#f5ede6\] {
    color: #1e1613 !important;
}

html:not(.dark) .text-brand-400,
html.light .text-brand-400 {
    color: #b56047 !important;
}

html:not(.dark) .text-\[var\(--text-primary\)\],
html.light .text-\[var\(--text-primary\)\] {
    color: #1e1613 !important;
}

html:not(.dark) .text-\[var\(--text-muted\)\],
html.light .text-\[var\(--text-muted\)\] {
    color: #7a6b63 !important;
}

/* Border colors */
html:not(.dark) .border-white\/10,
html.light .border-white\/10 {
    border-color: rgba(120, 80, 60, 0.08) !important;
}

html:not(.dark) .border-white\/5,
html.light .border-white\/5 {
    border-color: rgba(120, 80, 60, 0.04) !important;
}

html:not(.dark) .border-brand-400\/30,
html.light .border-brand-400\/30 {
    border-color: rgba(181, 96, 71, 0.20) !important;
}

/* Hover states */
html:not(.dark) .group:hover .text-brand-400,
html.light .group:hover .text-brand-400 {
    color: #b56047 !important;
}

html:not(.dark) .hover\:text-brand-400:hover,
html.light .hover\:text-brand-400:hover {
    color: #b56047 !important;
}

html:not(.dark) .hover\:bg-brand-600:hover,
html.light .hover\:bg-brand-600:hover {
    background-color: #9e4d36 !important;
}

/* Brand colors */
html:not(.dark) .bg-brand-500,
html.light .bg-brand-500 {
    background-color: #b56047 !important;
}

html:not(.dark) .bg-brand-500\/10,
html.light .bg-brand-500\/10 {
    background-color: rgba(181, 96, 71, 0.06) !important;
}

html:not(.dark) .text-emerald-400,
html.light .text-emerald-400 {
    color: #059669 !important;
}

/* Modal */
html:not(.dark) #modal-backdrop,
html.light #modal-backdrop {
    background-color: rgba(245, 240, 236, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html:not(.dark) #modal-backdrop .bg-\[\#140e0b\],
html.light #modal-backdrop .bg-\[\#140e0b\] {
    background-color: #ffffff !important;
    border-color: rgba(120, 80, 60, 0.08) !important;
}

html:not(.dark) #modal-backdrop .bg-black\/40,
html.light #modal-backdrop .bg-black\/40 {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

html:not(.dark) #modal-backdrop .border-white\/10,
html.light #modal-backdrop .border-white\/10 {
    border-color: rgba(120, 80, 60, 0.06) !important;
}

html:not(.dark) #modal-backdrop .border-white\/5,
html.light #modal-backdrop .border-white\/5 {
    border-color: rgba(120, 80, 60, 0.04) !important;
}

html:not(.dark) #modal-backdrop .text-\[var\(--text-muted\)\],
html.light #modal-backdrop .text-\[var\(--text-muted\)\] {
    color: #7a6b63 !important;
}

html:not(.dark) #modal-backdrop .hover\:text-white:hover,
html.light #modal-backdrop .hover\:text-white:hover {
    color: #1e1613 !important;
}

/* Dropdown trigger in light mode */
html:not(.dark) .dropdown-trigger,
html.light .dropdown-trigger {
    color: #1e1613 !important;
}

html:not(.dark) .dropdown-trigger:hover,
html.light .dropdown-trigger:hover {
    color: #b56047 !important;
}

/* Hero badge in light mode */
html:not(.dark) .bg-white\/\[0\.03\],
html.light .bg-white\/\[0\.03\] {
    background-color: rgba(255, 255, 255, 0.70) !important;
    border-color: rgba(120, 80, 60, 0.08) !important;
}

html:not(.dark) .border-white\/10,
html.light .border-white\/10 {
    border-color: rgba(120, 80, 60, 0.08) !important;
}

/* Mobile menu in light mode */
html:not(.dark) #mobile-menu a.text-white,
html.light #mobile-menu a.text-white {
    color: #1e1613 !important;
}

html:not(.dark) #mobile-menu a.text-brand-400,
html.light #mobile-menu a.text-brand-400 {
    color: #b56047 !important;
}

html:not(.dark) #mobile-menu .text-\[var\(--text-muted\)\],
html.light #mobile-menu .text-\[var\(--text-muted\)\] {
    color: #7a6b63 !important;
}

/* Footer in light mode */
html:not(.dark) footer .text-white,
html.light footer .text-white {
    color: #1e1613 !important;
}

html:not(.dark) footer .bg-black\/60,
html.light footer .bg-black\/60 {
    background-color: rgba(255, 255, 255, 0.80) !important;
}

html:not(.dark) footer .border-white\/5,
html.light footer .border-white\/5 {
    border-color: rgba(120, 80, 60, 0.04) !important;
}

html:not(.dark) footer .bg-brand-950,
html.light footer .bg-brand-950 {
    background-color: #f0e8e0 !important;
}

/* Tool card typography in light mode */
html:not(.dark) .tool-card h3,
html.light .tool-card h3 {
    color: #1e1613 !important;
}

html:not(.dark) .tool-card .text-\[var\(--text-muted\)\],
html.light .tool-card .text-\[var\(--text-muted\)\] {
    color: #7a6b63 !important;
}

html:not(.dark) .tool-card .font-mono,
html.light .tool-card .font-mono {
    color: #4a3a32 !important;
}

/* Contact section in light mode */
html:not(.dark) .bg-gradient-to-b.from-\[\#140e0b\],
html.light .bg-gradient-to-b.from-\[\#140e0b\] {
    --tw-gradient-from: #f8f2ec !important;
    --tw-gradient-to: #f0e8e0 !important;
}

html:not(.dark) .bg-black\/40,
html.light .bg-black\/40 {
    background-color: rgba(255, 255, 255, 0.70) !important;
}

html:not(.dark) .border-white\/10,
html.light .border-white\/10 {
    border-color: rgba(120, 80, 60, 0.08) !important;
}

html:not(.dark) .hover\:bg-black\/60:hover,
html.light .hover\:bg-black\/60:hover {
    background-color: rgba(255, 255, 255, 0.90) !important;
}

html:not(.dark) .text-white,
html.light .text-white {
    color: #1e1613 !important;
}

html:not(.dark) .bg-brand-500\/10,
html.light .bg-brand-500\/10 {
    background-color: rgba(181, 96, 71, 0.04) !important;
}

/* Fix for the gradient text in light mode */
html:not(.dark) .font-editorial.text-brand-400,
html.light .font-editorial.text-brand-400 {
    color: #b56047 !important;
}

/* Fix for the editorial frame inner divs in light mode */
html:not(.dark) .editorial-frame > div,
html.light .editorial-frame > div {
    background-color: #f8f2ec !important;
}

html:not(.dark) .editorial-frame .text-white\/90,
html.light .editorial-frame .text-white\/90 {
    color: #1e1613 !important;
}

html:not(.dark) .editorial-frame .text-\[var\(--text-muted\)\],
html.light .editorial-frame .text-\[var\(--text-muted\)\] {
    color: #7a6b63 !important;
}

html:not(.dark) .editorial-frame .text-white\/30,
html.light .editorial-frame .text-white\/30 {
    color: #7a6b63 !important;
    opacity: 0.5;
}


/* ============================================================
   8. PREMIUM CINEMATIC LOADING SCREEN
   ============================================================ */

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Animated gradient backdrop */
.loading-backdrop {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(217, 119, 87, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(217, 119, 87, 0.06) 0%, transparent 50%),
        var(--bg-base);
    animation: loadingBackdropPulse 4s ease-in-out infinite alternate;
}

@keyframes loadingBackdropPulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Floating gradient orb */
.loading-orb {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 119, 87, 0.20) 0%, transparent 70%);
    filter: blur(60px);
    animation: loadingOrbFloat 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes loadingOrbFloat {
    0% { transform: translate(-30%, -20%) scale(1); }
    50% { transform: translate(10%, -40%) scale(1.2); }
    100% { transform: translate(20%, -10%) scale(0.9); }
}

#loading-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    position: relative;
    z-index: 10;
}

/* Icon with rotating ring */
.loading-icon-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-icon-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(217, 119, 87, 0.15);
    border-top-color: var(--accent);
    animation: loadingRingSpin 1.2s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

.loading-icon-ring-spinner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid transparent;
    border-right-color: rgba(217, 119, 87, 0.25);
    animation: loadingRingSpin 1.8s cubic-bezier(0.6, 0, 0.4, 1) infinite reverse;
}

@keyframes loadingRingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-icon {
    width: 36px;
    height: 36px;
    opacity: 0.9;
    animation: loadingIconPulse 2s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.loading-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.9) saturate(1.2);
}

@keyframes loadingIconPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* Loading text with animated dots */
.loading-text {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.loading-label {
    transition: opacity 0.3s ease;
}

.loading-dots {
    display: inline-block;
    width: 1.5rem;
    text-align: left;
    animation: loadingDots 1.4s steps(4) infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Progress bar */
.loading-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 200px;
}

.loading-bar-track {
    flex: 1;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

html:not(.dark) .loading-bar-track,
html.light .loading-bar-track {
    background: rgba(0, 0, 0, 0.08);
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Glow on the progress bar fill */
.loading-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 20px;
    height: 5px;
    background: var(--accent);
    filter: blur(4px);
    opacity: 0.5;
    border-radius: 50%;
}

.loading-percent {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 2.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Light theme overrides for loading screen */
html:not(.dark) .loading-backdrop,
html.light .loading-backdrop {
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(181, 96, 71, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(181, 96, 71, 0.04) 0%, transparent 50%),
        var(--bg-base);
}

html:not(.dark) .loading-orb,
html.light .loading-orb {
    background: radial-gradient(circle, rgba(181, 96, 71, 0.12) 0%, transparent 70%);
}

html:not(.dark) .loading-icon-ring,
html.light .loading-icon-ring {
    border-color: rgba(181, 96, 71, 0.15);
    border-top-color: var(--accent);
}

html:not(.dark) .loading-icon-ring-spinner,
html.light .loading-icon-ring-spinner {
    border-right-color: rgba(181, 96, 71, 0.20);
}

html:not(.dark) .loading-icon img,
html.light .loading-icon img {
    filter: brightness(0.8) saturate(1.0);
}

/* ============================================================
   TUNNEL & ZOOM SCROLL EFFECTS
   ============================================================ */

/* Tunnel effect items — smooth transitions */
.tunnel-item,
.zoom-item {
    will-change: transform, opacity;
    transition: transform 0.15s ease-out, opacity 0.3s ease;
    backface-visibility: hidden;
}

/* Zoom items start slightly scaled down and fade in */
.zoom-item {
    opacity: 0.3;
    transform: scale(0.85);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

/* When zoom item is in view, it scales up */
.zoom-item.in-view {
    opacity: 1;
    transform: scale(1);
}

/* Tunnel items get perspective for depth */
.tunnel-item {
    perspective: 800px;
    transform-style: preserve-3d;
}

/* Tunnel item hover — enhanced depth */
.tunnel-item:hover {
    transform: translateZ(20px) !important;
    z-index: 10;
}

/* Prevent tunnel effect on mobile */
@media (max-width: 768px) {
    .tunnel-item,
    .zoom-item {
        transform: none !important;
        opacity: 1 !important;
    }
    
    [data-tunnel],
    [data-zoom] {
        transform: none !important;
        opacity: 1 !important;
    }
}



/* ============================================================
   INVERTED LIGHT SECTION — Philosophy override
   ============================================================ */
.section-light {
    background-color: #f5f0ec;
    /* Override theme variables locally for this section only */
    --bg-base: #f5f0ec;
    --bg-card: #ffffff;
    --bg-elevated: #eae2dc;
    --bg-border: rgba(120, 80, 60, 0.12);
    --text-primary: #1e1613;
    --text-muted: #5a4a40;
    --text-ghost: rgba(30, 22, 19, 0.10);
    --accent: #b56047;
    color: #1e1613;
}

.section-light h2,
.section-light h3 {
    color: #1e1613;
}

.section-light .font-editorial {
    color: #b56047;
}

.section-light p {
    color: #5a4a40;
}

/* Ensure text-scroll-highlight works correctly inside light section */
.section-light .text-scroll-highlight .word {
    color: #5a4a40;
}

.section-light .text-scroll-highlight .word.active {
    color: #1e1613;
}

.section-light .text-scroll-highlight .word.active.emphasis {
    color: #b56047;
    font-weight: 500;
}



/* ============================================================
   BRAND MONOGRAM — Minimal context-aware mark
   ============================================================ */
.brand-monogram {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(217, 119, 87, 0.25);
    background: rgba(217, 119, 87, 0.03);
    transition: 
        background-color 260ms cubic-bezier(0.4, 0, 0.2, 1),
        border-color 260ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 260ms ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.brand-monogram-letter {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1;
    color: #d97757;
    transform: translateY(-1px);
    transition: 
        color 260ms ease,
        transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

/* Hover — fills with brand, letter flips dark */
.brand-monogram:hover {
    background: #d97757;
    border-color: #d97757;
    box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.12),
                0 8px 20px -6px rgba(217, 119, 87, 0.5);
    transform: translateY(-1px);
}

.brand-monogram:hover .brand-monogram-letter {
    color: #0a0706;
    transform: translateY(-1px) scale(1.08);
}

/* Active / click feedback */
.brand-monogram:active {
    transform: scale(0.94);
    transition-duration: 80ms;
}

.brand-monogram:focus-visible {
    outline: 2px solid #d97757;
    outline-offset: 3px;
}

/* Light theme tweaks */
html:not(.dark) .brand-monogram,
html.light .brand-monogram {
    border-color: rgba(181, 96, 71, 0.28);
    background: rgba(181, 96, 71, 0.04);
}

html:not(.dark) .brand-monogram-letter,
html.light .brand-monogram-letter {
    color: #b56047;
}

html:not(.dark) .brand-monogram:hover,
html.light .brand-monogram:hover {
    background: #b56047;
    border-color: #b56047;
    box-shadow: 0 0 0 4px rgba(181, 96, 71, 0.12),
                0 8px 20px -6px rgba(181, 96, 71, 0.4);
}

html:not(.dark) .brand-monogram:hover .brand-monogram-letter,
html.light .brand-monogram:hover .brand-monogram-letter {
    color: #f5f0ec;
}

/* Subtle idle breathing pulse — draws the eye once, then calms */
@keyframes monogramIdleGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0); }
    50%      { box-shadow: 0 0 0 6px rgba(217, 119, 87, 0.06); }
}

.brand-monogram.is-idle {
    animation: monogramIdleGlow 3.6s ease-in-out 1;
}


/* ============================================================
   TOOLKIT — Clean capability cards (no numbering)
   ============================================================ */

.toolkit-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
        transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
        border-color 400ms ease,
        background-color 400ms ease;
}

.toolkit-card.in-view {
    opacity: 1;
    transform: translateY(0);
}

.toolkit-card:hover {
    border-color: rgba(217, 119, 87, 0.35);
    background: rgba(255, 255, 255, 0.03);
}

/* Icon */
.toolkit-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.625rem;
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.15);
    color: var(--accent);
    transition:
        background-color 400ms ease,
        border-color 400ms ease,
        transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toolkit-card:hover .toolkit-icon {
    background: rgba(217, 119, 87, 0.15);
    border-color: rgba(217, 119, 87, 0.3);
    transform: translateY(-2px);
}

/* Meta row (label · value) */
.toolkit-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.toolkit-label {
    color: var(--accent);
}

.toolkit-value {
    color: var(--text-muted);
}

/* Body */
.toolkit-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.toolkit-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.toolkit-desc {
    font-size: 0.8125rem;
    line-height: 1.65;
    font-weight: 300;
    color: var(--text-muted);
}

/* Foot — capability chips */
.toolkit-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.toolkit-foot span {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* Staggered reveal */
.toolkit-card:nth-child(1) { transition-delay: 0ms; }
.toolkit-card:nth-child(2) { transition-delay: 90ms; }
.toolkit-card:nth-child(3) { transition-delay: 180ms; }
.toolkit-card:nth-child(4) { transition-delay: 270ms; }

/* Light theme */
html:not(.dark) .toolkit-card,
html.light .toolkit-card {
    background: #ffffff;
    border-color: rgba(120, 80, 60, 0.08);
}

html:not(.dark) .toolkit-card:hover,
html.light .toolkit-card:hover {
    background: #ffffff;
    border-color: rgba(181, 96, 71, 0.35);
}

html:not(.dark) .toolkit-icon,
html.light .toolkit-icon {
    background: rgba(181, 96, 71, 0.08);
    border-color: rgba(181, 96, 71, 0.15);
    color: #b56047;
}

html:not(.dark) .toolkit-meta,
html.light .toolkit-meta,
html:not(.dark) .toolkit-foot,
html.light .toolkit-foot {
    border-color: rgba(120, 80, 60, 0.06);
}

html:not(.dark) .toolkit-foot span,
html.light .toolkit-foot span {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(120, 80, 60, 0.06);
    color: #5a4a40;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .toolkit-card {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}


/* ============================================================
   CONTACT CHANNELS — mobile list → desktop grid
   ============================================================ */

.contact-channels {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2.5rem;
    max-width: 32rem;
    margin-inline: auto;
}

/* Base item — mobile-first compact row */
.contact-item {
    display: grid;
    grid-template-columns: 40px 1fr 20px;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
    text-decoration: none;
    transition:
        border-color 240ms ease,
        background-color 240ms ease,
        transform 240ms ease;
}

.contact-item:hover {
    border-color: rgba(217, 119, 87, 0.5);
    background: rgba(0, 0, 0, 0.55);
    transform: translateY(-1px);
}

.contact-item:active {
    transform: scale(0.99);
    transition-duration: 80ms;
}

/* Icon tile */
.contact-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.625rem;
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.18);
    color: var(--accent);
    transition:
        background-color 240ms ease,
        border-color 240ms ease,
        color 240ms ease;
}

.contact-item:hover .contact-item-icon {
    background: rgba(217, 119, 87, 0.18);
    border-color: rgba(217, 119, 87, 0.35);
    color: var(--accent-hover);
}

/* Body (label + value) */
.contact-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    text-align: left;
}

.contact-item-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 240ms ease;
}

.contact-item:hover .contact-item-label {
    color: var(--accent);
}

.contact-item-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Arrow */
.contact-item-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition:
        color 240ms ease,
        transform 240ms ease;
}

.contact-item:hover .contact-item-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* Light theme */
html:not(.dark) .contact-item,
html.light .contact-item {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(120, 80, 60, 0.1);
}

html:not(.dark) .contact-item:hover,
html.light .contact-item:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(181, 96, 71, 0.45);
}

html:not(.dark) .contact-item-icon,
html.light .contact-item-icon {
    background: rgba(181, 96, 71, 0.08);
    border-color: rgba(181, 96, 71, 0.18);
    color: #b56047;
}

html:not(.dark) .contact-item-value,
html.light .contact-item-value {
    color: #1e1613;
}

/* ---------- Desktop: shift to 4-column card grid ---------- */
@media (min-width: 768px) {
    .contact-channels {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        max-width: 44rem;
    }
}

@media (min-width: 1024px) {
    .contact-channels {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        max-width: 56rem;
    }

    .contact-item {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 1rem;
        padding: 1.25rem;
        text-align: left;
    }

    .contact-item-icon {
        width: 44px;
        height: 44px;
    }

    .contact-item-body {
        gap: 0.25rem;
    }

    .contact-item-value {
        white-space: normal;
        overflow: visible;
        word-break: break-word;
    }

    .contact-item-arrow {
        justify-content: flex-end;
        width: 100%;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    html:not(.dark) .contact-item-arrow,
    html.light .contact-item-arrow {
        border-top-color: rgba(120, 80, 60, 0.08);
    }
}


/* ============================================================
   CONTACT TILES — 4-icon grid
   ============================================================ */

.contact-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 2rem;
    max-width: 26rem;
    margin-inline: auto;
}

@media (min-width: 640px) {
    .contact-tiles {
        gap: 0.75rem;
        margin-top: 2.5rem;
        max-width: 32rem;
    }
}

.contact-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.25rem;
    border-radius: 0.875rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    min-width: 0;
    transition:
        border-color 240ms ease,
        background-color 240ms ease,
        transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 640px) {
    .contact-tile {
        padding: 1rem 0.5rem;
        gap: 0.625rem;
        border-radius: 1rem;
    }
}

.contact-tile:hover {
    border-color: rgba(217, 119, 87, 0.5);
    background: rgba(0, 0, 0, 0.55);
    transform: translateY(-2px);
}

.contact-tile:active {
    transform: scale(0.96);
    transition-duration: 80ms;
}

.contact-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.625rem;
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.18);
    color: var(--accent);
    flex-shrink: 0;
    transition:
        background-color 240ms ease,
        border-color 240ms ease,
        color 240ms ease;
}

@media (min-width: 640px) {
    .contact-tile-icon {
        width: 44px;
        height: 44px;
        border-radius: 0.75rem;
    }
}

.contact-tile:hover .contact-tile-icon {
    background: rgba(217, 119, 87, 0.18);
    border-color: rgba(217, 119, 87, 0.4);
    color: var(--accent-hover);
}

.contact-tile-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 240ms ease;
}

@media (min-width: 640px) {
    .contact-tile-label {
        font-size: 0.5625rem;
        letter-spacing: 0.12em;
    }
}

.contact-tile:hover .contact-tile-label {
    color: var(--accent);
}

/* Light theme */
html:not(.dark) .contact-tile,
html.light .contact-tile {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(120, 80, 60, 0.1);
}

html:not(.dark) .contact-tile:hover,
html.light .contact-tile:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(181, 96, 71, 0.4);
}

html:not(.dark) .contact-tile-icon,
html.light .contact-tile-icon {
    background: rgba(181, 96, 71, 0.08);
    border-color: rgba(181, 96, 71, 0.18);
    color: #b56047;
}

/* Remove the old wrapper panel styles if they exist */
.contact-tiles-wrap {
    display: contents;
}

/* ============================================================
   FOOTER — Light section
   ============================================================ */

.site-footer {
    background: #f5f0ec;
    border-top: 1px solid rgba(120, 80, 60, 0.15);
    color: #1e1613;
    padding-block: 2.5rem 2rem;
    position: relative;
    z-index: 3;
}

.site-footer-inner {
    max-width: 80rem;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

@media (min-width: 768px) {
    .site-footer-inner { padding-inline: 2.5rem; }
}

@media (min-width: 1280px) {
    .site-footer-inner { padding-inline: 4rem; }
}

/* --- Top row: brand + nav --- */
.site-footer-top {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(120, 80, 60, 0.1);
}

@media (min-width: 768px) {
    .site-footer-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 3rem;
    }
}

/* Brand mark */
.site-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    align-self: flex-start;
}

.site-footer-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(181, 96, 71, 0.06);
    border: 1px solid rgba(181, 96, 71, 0.25);
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1;
    color: #b56047;
    transition:
        background-color 240ms ease,
        color 240ms ease,
        border-color 240ms ease;
    flex-shrink: 0;
}

.site-footer-brand:hover .site-footer-mark {
    background: #b56047;
    border-color: #b56047;
    color: #f5f0ec;
}

.site-footer-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
    line-height: 1;
}

.site-footer-wordmark {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #1e1613;
}

.site-footer-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8b7a70;
}

/* Nav */
.site-footer-nav {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 0.75rem 1.5rem;
    justify-content: start;
}

@media (min-width: 768px) {
    .site-footer-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem 1.75rem;
        justify-content: flex-end;
    }
}

.site-footer-nav a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5a4a40;
    text-decoration: none;
    transition: color 200ms ease;
    position: relative;
    padding: 0.125rem 0;
}

.site-footer-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: #b56047;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.site-footer-nav a:hover {
    color: #b56047;
}

.site-footer-nav a:hover::after {
    transform: scaleX(1);
}

/* --- Bottom row: copyright + meta --- */
.site-footer-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding-top: 1.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
}

@media (min-width: 640px) {
    .site-footer-bottom {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.site-footer-copy {
    color: #8b7a70;
}

.site-footer-meta {
    display: flex;
    gap: 1.5rem;
}

.site-footer-meta a {
    color: #8b7a70;
    text-decoration: none;
    transition: color 200ms ease;
}

.site-footer-meta a:hover {
    color: #b56047;
}


/* ============================================================
   MOBILE MENU — Overlay with blurred backdrop
   ============================================================ */

.mobile-menu-backdrop {
    position: fixed;
    top: 4rem;                      /* start below the header */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(10, 7, 6, 0.5);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu {
    position: fixed;
    top: 4rem;                     /* sits directly under the header */
    left: 0;
    right: 0;
    z-index: 45;
    max-height: calc(100dvh - 4rem);
    overflow-y: auto;
    padding: 1.5rem 1.5rem 2rem;
    background: var(--mobile-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);

    /* Reveal animation */
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 240ms ease;
}

.mobile-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Menu links */
.mobile-menu-link {
    display: block;
    padding: 0.75rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: color 200ms ease, padding-left 200ms ease;
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
    color: var(--text-primary);
    padding-left: 0.25rem;
}

.mobile-menu-link--primary {
    color: var(--accent);
    font-weight: 500;
}

.mobile-menu-link--accent {
    color: var(--accent);
    font-weight: 500;
    border-bottom: none;
    padding-top: 1rem;
}

/* Disciplines group */
.mobile-menu-group {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mobile-menu-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.mobile-menu-group .mobile-menu-link {
    padding: 0.5rem 0 0.5rem 0.75rem;
    border-bottom: none;
    border-left: 1px solid rgba(217, 119, 87, 0.25);
    color: var(--text-primary);
    font-size: 0.6875rem;
}

.mobile-menu-group .mobile-menu-link:hover {
    border-left-color: var(--accent);
    color: var(--accent);
    padding-left: 1rem;
}

/* Light theme */
html:not(.dark) .mobile-menu,
html.light .mobile-menu {
    background: rgba(245, 240, 236, 0.98);
    border-bottom-color: rgba(120, 80, 60, 0.08);
}

html:not(.dark) .mobile-menu-backdrop,
html.light .mobile-menu-backdrop {
    background: rgba(245, 240, 236, 0.4);
}

html:not(.dark) .mobile-menu-link,
html.light .mobile-menu-link {
    border-bottom-color: rgba(120, 80, 60, 0.06);
}


/* ============================================================
   METHODOLOGY CARDS — Discipline pages
   ============================================================ */

.methodology-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition:
        border-color 300ms ease,
        background-color 300ms ease,
        transform 300ms ease;
}

.methodology-card:hover {
    border-color: rgba(217, 119, 87, 0.35);
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-2px);
}

.methodology-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.625rem;
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.18);
    color: var(--accent);
    transition:
        background-color 300ms ease,
        border-color 300ms ease,
        transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.methodology-card:hover .methodology-icon {
    background: rgba(217, 119, 87, 0.16);
    border-color: rgba(217, 119, 87, 0.35);
    transform: translateY(-2px);
}

.methodology-head {
    padding-bottom: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.methodology-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
}

.methodology-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.methodology-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--text-primary);
}

.methodology-desc {
    font-size: 0.8125rem;
    line-height: 1.65;
    font-weight: 300;
    color: var(--text-muted);
}

.methodology-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding-top: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.methodology-foot span {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* Light theme */
html:not(.dark) .methodology-card,
html.light .methodology-card {
    background: #ffffff;
    border-color: rgba(120, 80, 60, 0.08);
}

html:not(.dark) .methodology-icon,
html.light .methodology-icon {
    background: rgba(181, 96, 71, 0.08);
    border-color: rgba(181, 96, 71, 0.15);
    color: #b56047;
}

html:not(.dark) .methodology-head,
html.light .methodology-head,
html:not(.dark) .methodology-foot,
html.light .methodology-foot {
    border-color: rgba(120, 80, 60, 0.06);
}

html:not(.dark) .methodology-foot span,
html.light .methodology-foot span {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(120, 80, 60, 0.06);
    color: #5a4a40;
}


/* ============================================================
   CASE CARDS — Static gallery grid
   ============================================================ */

.case-card {
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    overflow: hidden;
    transition:
        border-color 300ms ease,
        transform 300ms ease,
        box-shadow 300ms ease;
}

.case-card:hover {
    border-color: rgba(217, 119, 87, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.6);
}

/* Media placeholder */
.case-media {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    aspect-ratio: 4 / 3;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--bg-border);
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity 300ms ease;
}

.case-card:hover .case-media {
    opacity: 0.7;
}

.case-media-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Body */
.case-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.25rem 1rem;
    flex-grow: 1;
}

.case-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
}

.case-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--text-primary);
    transition: color 300ms ease;
}

.case-card:hover .case-title {
    color: var(--accent);
}

.case-desc {
    font-size: 0.75rem;
    line-height: 1.6;
    font-weight: 300;
    color: var(--text-muted);
}

/* Foot */
.case-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--bg-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: var(--text-muted);
}

.case-link {
    color: var(--accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: transform 200ms ease;
}

.case-card:hover .case-link {
    transform: translateX(3px);
}

/* Light theme */
html:not(.dark) .case-card,
html.light .case-card {
    background: #ffffff;
    border-color: rgba(120, 80, 60, 0.08);
}

html:not(.dark) .case-media,
html.light .case-media {
    background: #f0eae6;
    border-bottom-color: rgba(120, 80, 60, 0.08);
}

html:not(.dark) .case-foot,
html.light .case-foot {
    border-top-color: rgba(120, 80, 60, 0.06);
}

.site-footer-meta-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8b7a70;
}


/* ============================================================
   HEADING REVEAL — word-by-word fade-up
   ============================================================ */



/* Each word gets an overflow mask so the inner span can slide up */
.reveal-word {
    display: inline-block;
    overflow: hidden;
    line-height: inherit;
    /* Give descenders (g, y, p, j) a little room inside the mask */
    padding-bottom: 0.15em;
    margin-bottom: -0.15em;
    /* Prevent the browser from breaking inside a single word */
    white-space: nowrap;
}

/* The inner span starts pushed below the mask and fades in */
.reveal-word-inner {
    display: inline-block;
    transform: translateY(110%);
    opacity: 0;
    transition:
        transform 800ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 700ms ease;
    /* Stagger by word index — 60ms between words */
    transition-delay: calc(var(--word-index, 0) * 60ms);
    will-change: transform, opacity;
}

/* When the heading enters the viewport, all words slide up to place */
.reveal-heading.in-view .reveal-word-inner {
    transform: translateY(0);
    opacity: 1;
}

/* Reduced motion — show words immediately */
@media (prefers-reduced-motion: reduce) {
    .reveal-word-inner {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }
}