@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=DM+Mono:wght@300;400&display=swap');

:root {
    --bg: #080808;
    --bg-2: #0f0f0f;
    --bg-3: #161616;
    --surface: #1a1a1a;
    --white: #f5f5f0;
    --white-dim: rgba(245,245,240,0.6);
    --white-faint: rgba(245,245,240,0.10);
    --white-ghost: rgba(245,245,240,0.04);
    --gray-a: #888880;
    --gray-b: #555550;
    --gray-c: #2e2e2a;
    --accent: #c8b89a;
    --accent-dim: rgba(200,184,154,0.28);
    --accent-faint: rgba(200,184,154,0.07);
    --accent-warm: #d4c5a9;

    --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    --t-fast: 0.2s var(--ease-smooth);
    --t-mid:  0.5s var(--ease-expo);
    --t-slow: 0.9s var(--ease-expo);

    --radius-sm: 2px;
    --radius: 4px;
    --vh: 1vh;
}

body.light-mode {
    --bg: #f5f5f0;
    --bg-2: #eeede8;
    --bg-3: #e5e4de;
    --surface: #dddcd6;
    --white: #0a0a08;
    --white-dim: rgba(10,10,8,0.6);
    --white-faint: rgba(10,10,8,0.1);
    --white-ghost: rgba(10,10,8,0.04);
    --gray-a: #666660;
    --gray-b: #999990;
    --gray-c: #d0cfca;
    --accent: #8a6a40;
    --accent-dim: rgba(138,106,64,0.25);
    --accent-faint: rgba(138,106,64,0.06);
    --accent-warm: #7a5a32;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: none;
    transition: background 0.6s var(--ease-smooth), color 0.6s var(--ease-smooth);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.modal-open { overflow: hidden; }

@media (hover: none) {
    body { cursor: auto; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-b); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    will-change: auto;
}

.ambient-orbs {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0; overflow: hidden;
}

.orb {
    position: absolute; border-radius: 50%;
    filter: blur(140px); opacity: 0.04;
    animation: orbFloat 22s ease-in-out infinite;
    will-change: transform;
}
.orb-1 { width: 700px; height: 700px; background: radial-gradient(circle, var(--accent), transparent); top: -250px; left: -150px; }
.orb-2 { width: 450px; height: 450px; background: radial-gradient(circle, var(--white), transparent); top: 40%; right: -120px; animation-delay: -8s; animation-duration: 28s; }
.orb-3 { width: 550px; height: 550px; background: radial-gradient(circle, var(--accent), transparent); bottom: -200px; left: 30%; animation-delay: -16s; animation-duration: 19s; }

@media (max-width: 768px) {
    .orb-1 { width: 350px; height: 350px; }
    .orb-2 { width: 250px; height: 250px; }
    .orb-3 { width: 300px; height: 300px; }
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -50px) scale(1.06); }
    66% { transform: translate(-25px, 25px) scale(0.94); }
}

.cursor {
    position: fixed; top: 0; left: 0;
    pointer-events: none; z-index: 99999;
    transform: translate(-50%, -50%);
}

@media (hover: none), (max-width: 768px) {
    .cursor { display: none; }
}

.cursor-dot {
    width: 4px; height: 4px;
    background: var(--white);
    border-radius: 50%;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background 0.2s;
}

.cursor-ring {
    width: 32px; height: 32px;
    border: 1px solid rgba(245,245,240,0.4);
    border-radius: 50%;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.45s var(--ease-expo), height 0.45s var(--ease-expo), border-color 0.3s, opacity 0.3s;
}

.cursor-label {
    position: absolute; top: 50%; left: 50%;
    transform: translate(22px, -50%);
    font-family: var(--font-mono); font-size: 8px; letter-spacing: 3px;
    color: var(--white); white-space: nowrap; opacity: 0; transition: opacity 0.3s;
    text-transform: uppercase;
}

.cursor.hovering .cursor-ring { width: 56px; height: 56px; border-color: var(--accent); opacity: 0.9; }
.cursor.hovering .cursor-dot { background: var(--accent); width: 6px; height: 6px; }
.cursor.clicking .cursor-ring { width: 20px; height: 20px; }
.cursor.gallery-hover .cursor-label { opacity: 1; }

.loader {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 100000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.9s var(--ease-smooth), visibility 0.9s var(--ease-smooth);
}

.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-inner { text-align: center; position: relative; padding: 0 20px; }

.loader-logo {
    font-family: var(--font-display);
    font-size: clamp(42px, 8vw, 88px);
    font-weight: 300; letter-spacing: clamp(8px, 2vw, 20px);
    color: var(--white); margin-bottom: 60px; opacity: 0;
    animation: loaderLogoIn 0.9s var(--ease-expo) 0.2s forwards;
}

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

.loader-line {
    width: min(300px, 80vw); height: 1px;
    background: var(--gray-c); margin: 0 auto 28px; position: relative; overflow: hidden;
}
.loader-line-inner {
    position: absolute; top: 0; left: 0; height: 100%; width: 0%;
    background: linear-gradient(90deg, transparent, var(--accent), var(--white));
    transition: width 0.12s;
}
.loader-text {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 7px;
    color: var(--gray-a); text-transform: uppercase; margin-bottom: 20px;
    animation: loaderLogoIn 0.7s var(--ease-expo) 0.5s both;
}
.loader-count {
    font-family: var(--font-mono); font-size: clamp(24px, 5vw, 36px);
    font-weight: 300; color: var(--white-dim); letter-spacing: 6px;
    animation: loaderLogoIn 0.7s var(--ease-expo) 0.6s both;
}

.loader-corners { position: absolute; inset: 40px; pointer-events: none; }
.loader-corners span { position: absolute; width: 20px; height: 20px; border-color: var(--white-faint); border-style: solid; border-width: 0; }
.loader-corners span:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.loader-corners span:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.loader-corners span:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.loader-corners span:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

.container { max-width: 1600px; margin: 0 auto; padding: 0 80px; }

.header {
    position: fixed; top: 0; left: 0; right: 0;
    padding: 28px 80px;
    display: flex; align-items: center; justify-content: space-between;
    z-index: 1000;
    transition: padding 0.4s var(--ease-smooth), background 0.4s, transform 0.5s var(--ease-expo);
}

.header.nav-hidden {
    transform: translateY(-100%);
}

.header::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
    opacity: 0; transition: opacity 0.4s; pointer-events: none; z-index: -1;
}

.header.scrolled {
    padding: 20px 80px;
    background: rgba(8,8,8,0.88);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border-bottom: 1px solid var(--white-faint);
}

.header.scrolled::after { opacity: 1; }
body.light-mode .header.scrolled { background: rgba(245,245,240,0.88); }

.header-progress {
    position: absolute; bottom: 0; left: 0;
    height: 1px; width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--white));
    transition: width 0.08s;
}

.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--white); flex-shrink: 0; }
.logo-km { font-family: var(--font-display); font-size: 22px; font-weight: 400; letter-spacing: 4px; transition: color var(--t-fast); }
.logo-sep { font-family: var(--font-mono); font-size: 12px; color: var(--gray-b); margin: 0 2px; }
.logo-archive { font-family: var(--font-mono); font-size: 10px; letter-spacing: 5px; color: var(--gray-a); transition: color var(--t-fast); }
.logo:hover .logo-km { color: var(--accent); }
.logo:hover .logo-archive { color: var(--white); }

.nav-links { display: flex; gap: 48px; align-items: center; }

.nav-link {
    font-family: var(--font-body); font-size: 11px; font-weight: 400;
    letter-spacing: 4px; text-transform: uppercase; color: var(--gray-a);
    text-decoration: none; position: relative; padding: 4px 0; transition: color var(--t-fast);
    min-height: 44px; display: flex; align-items: center;
}

.nav-link::before {
    content: attr(data-index);
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    font-family: var(--font-mono); font-size: 8px; color: var(--accent);
    opacity: 0; transition: opacity 0.3s;
}

.nav-link::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0%; height: 1px; background: var(--accent);
    transition: width 0.4s var(--ease-expo);
}

.nav-link:hover, .nav-link.active { color: var(--white); }
.nav-link:hover::before, .nav-link.active::before { opacity: 1; }
.nav-link.active::after, .nav-link:hover::after { width: 100%; }

.header-time { font-family: var(--font-mono); font-size: 10px; letter-spacing: 3px; color: var(--gray-b); }

.nav-toggle {
    display: none;
    flex-direction: column; gap: 5px; width: 36px;
    background: none; border: none; padding: 8px;
    cursor: pointer; z-index: 1001;
}
.nav-toggle span {
    display: block; width: 24px; height: 1px;
    background: var(--white); transition: transform 0.4s var(--ease-expo), opacity 0.3s, width 0.3s;
    transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.audio-player {
    position: fixed; bottom: 32px; right: 32px; z-index: 500;
    display: flex; align-items: center; gap: 12px;
    background: rgba(8,8,8,0.82);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--white-faint); padding: 10px 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

body.light-mode .audio-player { background: rgba(245,245,240,0.88); }
.audio-player.audio-playing { border-color: var(--accent-dim); box-shadow: 0 0 28px var(--accent-faint); }

.audio-visualizer { display: flex; align-items: flex-end; gap: 2px; height: 14px; opacity: 0; transition: opacity 0.3s; }
.audio-player.audio-playing .audio-visualizer { opacity: 1; }
.audio-visualizer span { display: block; width: 2px; background: var(--accent); border-radius: 1px; animation: vizBar 0.8s ease-in-out infinite alternate; height: 4px; }
.audio-visualizer span:nth-child(1) { animation-delay: 0s; }
.audio-visualizer span:nth-child(2) { animation-delay: 0.15s; }
.audio-visualizer span:nth-child(3) { animation-delay: 0.3s; }
.audio-visualizer span:nth-child(4) { animation-delay: 0.45s; }
.audio-visualizer span:nth-child(5) { animation-delay: 0.6s; }

@keyframes vizBar { from { height: 2px; } to { height: 14px; } }

.audio-btn {
    background: transparent; border: none; color: var(--gray-a);
    cursor: pointer; padding: 4px; transition: color var(--t-fast);
    font-size: 11px; min-width: 28px; min-height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.audio-btn:hover { color: var(--accent); }
.audio-track { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--gray-b); white-space: nowrap; }

.theme-toggle {
    position: fixed; bottom: 32px; left: 32px; z-index: 500;
    width: 42px; height: 42px;
    border: 1px solid var(--white-faint);
    background: rgba(8,8,8,0.72);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: border-color var(--t-fast), transform 0.35s var(--ease-back);
}

body.light-mode .theme-toggle { background: rgba(245,245,240,0.82); }
.theme-toggle:hover { border-color: var(--accent); transform: rotate(20deg); }
.theme-icon { font-size: 12px; color: var(--gray-a); transition: color 0.3s; }
.theme-toggle:hover .theme-icon { color: var(--accent); }

.back-to-top {
    position: fixed; bottom: 84px; right: 32px; z-index: 500;
    width: 42px; height: 42px;
    border: 1px solid var(--white-faint);
    background: rgba(8,8,8,0.72);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--gray-a); font-size: 11px;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity 0.4s, visibility 0.4s, transform 0.4s var(--ease-expo), border-color var(--t-fast), color var(--t-fast);
}

.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }

.hero {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    position: relative; display: flex; align-items: center;
    padding: 120px 80px 80px;
    overflow: hidden;
}

.hero-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.12;
}

.hero-content { position: relative; z-index: 2; max-width: 1000px; }

.hero-eyebrow {
    display: flex; align-items: center; gap: 20px; margin-bottom: 40px;
    opacity: 0; transform: translateY(20px);
}
.eyebrow-line { display: block; width: 60px; height: 1px; background: var(--accent); flex-shrink: 0; }
.eyebrow-text { font-family: var(--font-mono); font-size: 10px; letter-spacing: 5px; color: var(--accent); text-transform: uppercase; }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(52px, 9vw, 140px);
    font-weight: 300; line-height: 0.92; margin-bottom: 40px;
    letter-spacing: -1px; overflow: hidden;
}
.hero-word { display: block; transform: translateY(110%); opacity: 0; will-change: transform, opacity; }
.hero-word-italic { font-style: italic; color: var(--accent); font-weight: 300; letter-spacing: 2px; }

.hero-subtitle {
    font-size: clamp(15px, 2vw, 18px); font-weight: 300;
    color: var(--white-dim); max-width: 580px; line-height: 1.8;
    margin-bottom: 60px; opacity: 0; transform: translateY(20px);
}

.hero-cta { display: flex; align-items: center; gap: 40px; opacity: 0; transform: translateY(20px); flex-wrap: wrap; }

.cta-btn {
    font-family: var(--font-body); font-size: 11px; letter-spacing: 5px; text-transform: uppercase;
    color: var(--bg); background: var(--white); border: none; padding: 16px 36px;
    text-decoration: none; display: inline-block; position: relative; overflow: hidden;
    transition: color 0.4s var(--ease-expo);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cta-btn::before {
    content: ''; position: absolute; inset: 0; background: var(--accent);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.4s var(--ease-expo); z-index: 0;
}

.cta-btn span { position: relative; z-index: 1; }
.cta-btn:hover { color: var(--bg); }
.cta-btn:hover::before { transform: scaleX(1); }

.hero-count { font-family: var(--font-mono); font-size: 12px; letter-spacing: 3px; color: var(--gray-a); }
.hero-count em { font-family: var(--font-display); font-size: 28px; font-style: italic; color: var(--accent); margin-right: 8px; vertical-align: middle; }

.hero-scroll-indicator {
    position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: 0;
}
.scroll-track { width: 1px; height: 80px; background: var(--gray-c); position: relative; overflow: hidden; }
.scroll-thumb { position: absolute; top: 0; left: 0; width: 100%; background: var(--accent); animation: scrollThumb 2s ease-in-out infinite; }

@keyframes scrollThumb {
    0% { height: 0; top: 0; }
    50% { height: 40px; top: 20px; }
    100% { height: 0; top: 80px; }
}

.hero-scroll-indicator span { font-family: var(--font-mono); font-size: 8px; letter-spacing: 5px; color: var(--gray-b); text-transform: uppercase; writing-mode: vertical-rl; }

.hero-index {
    position: absolute; right: 80px; bottom: 80px;
    display: flex; flex-direction: column; gap: 16px;
    opacity: 0; transform: translateX(20px); z-index: 2;
}
.hero-index-item { font-family: var(--font-mono); font-size: 10px; letter-spacing: 3px; color: var(--gray-b); display: flex; justify-content: space-between; gap: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-c); min-width: 180px; }
.hero-index-item span { font-family: var(--font-display); font-size: 14px; font-style: italic; color: var(--accent); }

.category-nav {
    position: sticky; top: 73px; z-index: 900;
    background: rgba(8,8,8,0.92);
    backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
    border-bottom: 1px solid var(--white-faint); padding: 20px 0;
    transition: transform 0.4s var(--ease-expo), opacity 0.4s;
}

body.light-mode .category-nav { background: rgba(245,245,240,0.92); }
.category-nav.hidden { transform: translateY(-100%); opacity: 0; pointer-events: none; }

.category-row { display: flex; align-items: center; gap: 40px; flex-wrap: wrap; }
.category-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 5px; color: var(--gray-b); white-space: nowrap; }
.category-buttons { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.category-btn {
    background: transparent; border: 1px solid transparent; color: var(--gray-a);
    padding: 9px 22px; font-family: var(--font-body); font-size: 10px; letter-spacing: 4px;
    text-transform: uppercase; cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
    display: flex; align-items: center; gap: 10px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.btn-count { font-family: var(--font-mono); font-size: 9px; color: var(--gray-b); transition: color var(--t-fast); }
.category-btn:hover { color: var(--white); border-color: var(--white-faint); }
.category-btn.active { color: var(--bg); background: var(--white); border-color: var(--white); }
.category-btn.active .btn-count { color: var(--gray-b); }
body.light-mode .category-btn.active { color: var(--white); background: var(--bg); border-color: var(--bg); }

.category-sort { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.sort-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 4px; color: var(--gray-b); }

.filter-select {
    background: var(--bg); border: 1px solid var(--white-faint); color: var(--white);
    padding: 8px 32px 8px 12px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px;
    text-transform: uppercase; cursor: pointer;
    transition: border-color var(--t-fast); appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888880'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    min-height: 44px;
}

body.light-mode .filter-select { background-color: var(--bg); }
.filter-select:hover { border-color: var(--accent); }
.filter-select:focus { outline: none; border-color: var(--accent); }

.gallery-section {
    padding: 180px 0; border-bottom: 1px solid var(--white-faint); position: relative;
    opacity: 0; transform: translateY(60px);
    transition: opacity 1.2s var(--ease-expo), transform 1.2s var(--ease-expo);
}

.gallery-section.active { opacity: 1; transform: translateY(0); }

.section-number {
    position: absolute; top: 80px; left: 80px;
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 4px; color: var(--gray-c);
    writing-mode: vertical-rl; transform: rotate(180deg);
}

.section-header { margin-bottom: 100px; padding-left: 140px; position: relative; }

.section-kicker {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 6px; color: var(--accent);
    text-transform: uppercase; margin-bottom: 24px; display: flex; align-items: center; gap: 16px;
}
.section-kicker::before { content: ''; width: 32px; height: 1px; background: var(--accent); flex-shrink: 0; }

.section-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 7vw, 100px);
    font-weight: 300; line-height: 0.95; margin-bottom: 40px; overflow: hidden;
}
.section-title-line { display: block; transform: translateY(110%); opacity: 0; transition: transform 1s var(--ease-expo), opacity 0.8s; }
.section-title-outline { -webkit-text-stroke: 1px var(--white-dim); color: transparent; font-style: italic; }

.gallery-section.active .section-title-line:nth-child(1) { transform: translateY(0); opacity: 1; transition-delay: 0.1s; }
.gallery-section.active .section-title-line:nth-child(2) { transform: translateY(0); opacity: 1; transition-delay: 0.25s; }

.section-subtitle {
    font-size: 16px; font-weight: 300; color: var(--white-dim);
    max-width: 640px; line-height: 1.8;
    padding-left: 28px; border-left: 1px solid var(--gray-c);
}

.gallery-grid { columns: 3; column-gap: 28px; }

.gallery-item {
    break-inside: avoid; margin-bottom: 28px; position: relative; overflow: hidden;
    cursor: pointer; opacity: 0; transform: translateY(40px);
    transition: opacity 0.8s var(--ease-expo), transform 0.8s var(--ease-expo);
}

.gallery-item.visible { opacity: 1; transform: translateY(0); }

.item-image-container { position: relative; overflow: hidden; }
.item-image {
    width: 100%; height: auto; display: block;
    transition: transform 0.9s var(--ease-expo), filter 0.6s;
    filter: grayscale(100%) brightness(0.82) contrast(1.1);
    transform: scale(1.02); will-change: transform;
}
.gallery-item:hover .item-image { transform: scale(1.08); filter: grayscale(0%) brightness(1) contrast(1); }

.item-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(8,8,8,0) 30%, rgba(8,8,8,0.96) 100%);
    opacity: 0; transition: opacity 0.5s; z-index: 2;
}
.gallery-item:hover .item-overlay { opacity: 1; }

.item-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 32px; z-index: 3;
    transform: translateY(16px); opacity: 0;
    transition: transform 0.5s var(--ease-expo), opacity 0.4s;
}
.gallery-item:hover .item-info { transform: translateY(0); opacity: 1; }

.item-category {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 4px; color: var(--accent);
    text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
}
.item-category::after { content: ''; flex: 1; height: 1px; background: var(--accent); opacity: 0.4; max-width: 40px; }

.item-title { font-family: var(--font-display); font-size: 26px; font-weight: 300; line-height: 1.2; margin-bottom: 8px; color: var(--white); }
.item-date { font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px; color: var(--gray-a); }

.item-view {
    position: absolute; top: 20px; right: 20px; z-index: 3;
    width: 40px; height: 40px; border: 1px solid rgba(245,245,240,0.25); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0.7) rotate(-45deg);
    transition: opacity 0.4s, transform 0.5s var(--ease-back);
}
.item-view i { font-size: 11px; color: var(--white); transform: rotate(45deg); }
.gallery-item:hover .item-view { opacity: 1; transform: scale(1) rotate(0deg); }

@media (hover: none) {
    .item-image { filter: grayscale(20%) brightness(0.88) contrast(1.05); transform: scale(1); }
    .item-overlay { opacity: 1; background: linear-gradient(to bottom, rgba(8,8,8,0) 40%, rgba(8,8,8,0.88) 100%); }
    .item-info { transform: translateY(0); opacity: 1; }
    .item-view { opacity: 1; transform: scale(1) rotate(0deg); }
}

#writing .gallery-grid {
    columns: unset; column-gap: unset;
    display: block;
    border-top: 1px solid var(--white-faint);
}

.writing-entry {
    break-inside: unset; margin-bottom: 0;
    position: relative; overflow: hidden;
    cursor: pointer;
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.7s var(--ease-expo), transform 0.7s var(--ease-expo);
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: start; gap: 0 48px;
    padding: 44px 0;
    border-bottom: 1px solid var(--white-faint);
    -webkit-tap-highlight-color: transparent;
}

.writing-entry.visible { opacity: 1; transform: translateY(0); }

.writing-entry::before {
    content: '';
    position: absolute; left: -80px; top: 0; bottom: 0;
    width: 3px; background: var(--accent);
    transform: scaleY(0); transform-origin: bottom;
    transition: transform 0.55s var(--ease-expo);
}

.writing-entry:hover::before { transform: scaleY(1); }

.writing-entry::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--accent-faint) 0%, transparent 65%);
    opacity: 0; transition: opacity 0.5s ease; pointer-events: none;
}

.writing-entry:hover::after { opacity: 1; }

.wr-col-index { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.wr-num { font-family: var(--font-mono); font-size: 10px; color: var(--gray-b); letter-spacing: 2px; transition: color 0.3s; }
.writing-entry:hover .wr-num { color: var(--accent); }

.wr-badge {
    font-family: var(--font-mono); font-size: 7px; letter-spacing: 3px; text-transform: uppercase;
    border: 1px solid var(--gray-b); color: var(--gray-a); padding: 3px 7px; white-space: nowrap;
    transition: border-color 0.3s, color 0.3s;
}

.writing-entry:hover .wr-badge { border-color: var(--accent); color: var(--accent); }

.wr-col-main { min-width: 0; }

.wr-entry-title {
    font-family: var(--font-display);
    font-size: clamp(22px, 3.2vw, 44px);
    font-weight: 300; font-style: italic;
    color: var(--white); line-height: 1.1;
    margin-bottom: 18px; letter-spacing: -0.01em;
    transition: color 0.35s;
}

.writing-entry:hover .wr-entry-title { color: var(--accent-warm); }

.wr-entry-excerpt {
    font-family: var(--font-mono); font-size: 11px; font-weight: 300;
    color: var(--white-dim); line-height: 1.9; max-width: 620px;
    letter-spacing: 0.015em; margin-bottom: 22px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    line-clamp: 2; transition: color 0.3s;
}

body.light-mode .wr-entry-excerpt {
    color: rgba(10, 10, 8, 0.75);
}

.writing-entry:hover .wr-entry-excerpt { color: rgba(245,245,240,0.74); }

.wr-entry-meta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.wr-meta-date { font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px; color: var(--gray-a); text-transform: uppercase; }
.wr-meta-sep { width: 16px; height: 1px; background: var(--gray-b); flex-shrink: 0; }
.wr-meta-type { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--gray-b); }

.wr-col-action { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; padding-top: 4px; flex-shrink: 0; }

.wr-arrow {
    width: 44px; height: 44px; border: 1px solid var(--gray-b);
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.35s, transform 0.5s var(--ease-back), background 0.35s;
}

body.light-mode .writing-entry:hover .wr-entry-excerpt {
    color: rgba(10, 10, 8, 0.95);
}

.writing-entry:hover .wr-arrow { border-color: var(--accent); background: var(--accent-faint); transform: rotate(-45deg) scale(1.1); }
.wr-arrow svg { width: 14px; height: 14px; stroke: var(--gray-a); fill: none; stroke-width: 1.5; transition: stroke 0.3s; }
.writing-entry:hover .wr-arrow svg { stroke: var(--accent); }

.wr-featured-tag {
    font-family: var(--font-mono); font-size: 7px; letter-spacing: 3px; color: var(--accent);
    text-transform: uppercase; display: flex; align-items: center; gap: 5px;
    opacity: 0; transition: opacity 0.35s;
}

.wr-featured-tag::before {
    content: ''; display: block; width: 4px; height: 4px; background: var(--accent);
    border-radius: 50%; animation: featPulse 2s ease-in-out infinite;
}

@keyframes featPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.65); }
}

.wr-featured-tag.always-show { opacity: 0.55; }
.writing-entry:hover .wr-featured-tag { opacity: 1; }
.writing-entry:hover .wr-featured-tag.always-show { opacity: 1; }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; margin-bottom: 120px; padding-left: 140px; }

.about-heading { font-family: var(--font-mono); font-size: 9px; letter-spacing: 5px; color: var(--accent); text-transform: uppercase; margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--white-faint); }
.about-text { font-size: 17px; font-weight: 300; color: var(--white-dim); line-height: 1.85; margin-bottom: 24px; }

.about-quote { border-top: 1px solid var(--white-faint); border-bottom: 1px solid var(--white-faint); padding: 80px 140px; position: relative; margin-bottom: 80px; }
.quote-mark { font-family: var(--font-display); font-size: 180px; line-height: 0.5; color: var(--accent); opacity: 0.08; position: absolute; top: 40px; left: 100px; pointer-events: none; }

.about-quote blockquote { font-family: var(--font-display); font-size: clamp(20px, 3vw, 38px); font-weight: 300; font-style: italic; color: var(--white-dim); line-height: 1.6; max-width: 900px; margin: 0 auto 32px; text-align: center; position: relative; z-index: 1; }
.about-quote cite { display: block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 5px; color: var(--accent); text-align: center; text-transform: uppercase; font-style: normal; }

.about-stats { display: flex; gap: 0; padding-left: 140px; }
.stat-item { flex: 1; padding: 40px; border-left: 1px solid var(--white-faint); }
.stat-item:first-child { border-left: none; }
.stat-num { display: block; font-family: var(--font-display); font-size: clamp(48px, 5vw, 72px); font-weight: 300; font-style: italic; color: var(--accent); line-height: 1; margin-bottom: 12px; }
.stat-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 4px; color: var(--gray-a); text-transform: uppercase; }

.modal {
    position: fixed; inset: 0; z-index: 10000;
    opacity: 0; visibility: hidden;
    transition: opacity 0.5s var(--ease-smooth), visibility 0.5s;
    display: flex; align-items: flex-start; justify-content: center;
    overflow-y: auto; overflow-x: hidden; padding: 40px 20px;
    -webkit-overflow-scrolling: touch;
}

.modal.active { opacity: 1; visibility: visible; }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(8,8,8,0.97);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    z-index: -1;
}
body.light-mode .modal-backdrop { background: rgba(245,245,240,0.97); }

.modal-content {
    width: 95%; max-width: 1400px; position: relative;
    transform: translateY(40px) scale(0.98); opacity: 0;
    transition: transform 0.7s var(--ease-expo), opacity 0.6s;
}
.modal.active .modal-content { transform: translateY(0) scale(1); opacity: 1; transition-delay: 0.1s; }

.modal-close {
    position: fixed; top: 32px; right: 40px;
    width: 44px; height: 44px;
    background: transparent; border: 1px solid var(--white-faint);
    cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    z-index: 2; transition: border-color var(--t-fast), transform 0.4s var(--ease-back);
    -webkit-tap-highlight-color: transparent;
}
.modal-close span { display: block; width: 18px; height: 1px; background: var(--white); transition: transform 0.3s var(--ease-expo); }
.modal-close span:first-child { transform: translateY(3.5px) rotate(45deg); }
.modal-close span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.modal-close:hover { border-color: var(--accent); transform: rotate(90deg); }

.modal-body { display: grid; grid-template-columns: 1fr 380px; gap: 0; border: 1px solid var(--white-faint); }

.modal-body.writing-modal { grid-template-columns: 1fr; }
.modal-body.writing-modal .modal-media { display: none; }
.modal-body.writing-modal .modal-info-panel { padding: 64px 80px; }
.modal-body.writing-modal .modal-title { font-size: clamp(32px, 5vw, 68px); font-style: italic; line-height: 1.05; margin-bottom: 36px; }
.modal-body.writing-modal .modal-description {
    font-family: var(--font-display);
    font-size: clamp(17px, 1.5vw, 20px);
    font-weight: 300;
    line-height: 2;
    color: var(--white-dim);
    column-count: 2;
    column-gap: 64px;
    column-rule: 1px solid var(--white-ghost);
}
.modal-body.writing-modal .modal-description p {
    margin-bottom: 1.4em;
    break-inside: avoid;
}
.modal-body.writing-modal .modal-description p:first-child::first-letter {
    font-family: var(--font-display);
    font-size: 4em;
    font-weight: 400;
    font-style: italic;
    color: var(--accent);
    float: left;
    line-height: 0.72;
    margin-right: 0.08em;
    margin-top: 0.1em;
}
@media (max-width: 900px) {
    .modal-body.writing-modal .modal-description {
        column-count: 1;
    }
}

.modal-media { padding: 40px; border-right: 1px solid var(--white-faint); }
.modal-image-wrap { position: relative; overflow: hidden; margin-bottom: 24px; }
.modal-image { width: 100%; height: auto; max-height: 65vh; object-fit: contain; display: block; transition: transform 1.2s var(--ease-expo); }
.modal-image-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, transparent 60%, rgba(8,8,8,0.3)); pointer-events: none; }
.modal-image-wrap:hover .modal-image { transform: scale(1.03); }

.modal-gallery { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--gray-b) transparent; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.modal-gallery-item { flex: 0 0 96px; height: 64px; overflow: hidden; cursor: pointer; opacity: 0.4; transition: opacity var(--t-fast); border: 1px solid transparent; }
.modal-gallery-item.active, .modal-gallery-item:hover { opacity: 1; border-color: var(--accent); }
.modal-gallery-item img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(100%); transition: filter 0.4s; }
.modal-gallery-item.active img, .modal-gallery-item:hover img { filter: grayscale(0%); }

.modal-info-panel { padding: 40px; display: flex; flex-direction: column; }

.modal-category-badge { font-family: var(--font-mono); font-size: 9px; letter-spacing: 5px; color: var(--accent); text-transform: uppercase; margin-bottom: 20px; display: inline-flex; align-items: center; gap: 10px; }
.modal-category-badge::before { content: ''; width: 24px; height: 1px; background: var(--accent); }

.modal-title { font-family: var(--font-display); font-size: clamp(28px, 3vw, 52px); font-weight: 300; line-height: 1.1; margin-bottom: 24px; }
.modal-description { font-size: 15px; font-weight: 300; color: var(--white-dim); line-height: 1.85; flex: 1; }

.modal-divider { width: 40px; height: 1px; background: var(--accent); margin: 32px 0; }

.modal-meta-grid { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.meta-item { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--white-ghost); }
.meta-full { flex-direction: column; gap: 6px; }

.meta-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px; color: var(--gray-b); text-transform: uppercase; }
.meta-value { font-size: 13px; font-weight: 300; color: var(--white-dim); }
.meta-preserved { color: var(--accent); font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; }
.meta-mono { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; color: var(--gray-a); }

.modal-nav-row { display: flex; gap: 12px; margin-top: auto; padding-top: 24px; border-top: 1px solid var(--white-faint); }
.modal-nav-btn {
    background: transparent; border: 1px solid var(--white-faint); color: var(--gray-a);
    padding: 10px 20px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 3px;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    text-transform: uppercase; min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.modal-nav-btn:hover { color: var(--bg); background: var(--white); border-color: var(--white); }
body.light-mode .modal-nav-btn:hover { color: var(--white); background: var(--bg); border-color: var(--bg); }

.modal-swipe-hint {
    display: none;
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px;
    color: var(--gray-b); text-align: center; margin-top: 16px; text-transform: uppercase;
}

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

@media (max-width: 1400px) {
    .container { padding: 0 60px; }
    .header { padding: 24px 60px; }
    .header.scrolled { padding: 18px 60px; }
    .hero { padding: 120px 60px 80px; }
    .gallery-grid { columns: 2; }
    .section-header { padding-left: 100px; }
    .about-grid { padding-left: 100px; }
    .about-quote { padding: 60px 100px; }
    .about-stats { padding-left: 100px; }
    .writing-entry { grid-template-columns: 64px 1fr auto; gap: 0 32px; }
    .modal-body.writing-modal .modal-info-panel { padding: 48px 60px; }
}

@media (max-width: 1100px) {
    .modal-body { grid-template-columns: 1fr; }
    .modal-media { border-right: none; border-bottom: 1px solid var(--white-faint); }
    .gallery-grid { columns: 2; }
    .about-grid { grid-template-columns: 1fr; gap: 48px; }
    .hero-index { display: none; }
    .writing-entry { gap: 0 24px; padding: 36px 0; }
}

@media (max-width: 900px) {
    .container { padding: 0 40px; }
    .header { padding: 20px 40px; }
    .header.scrolled { padding: 16px 40px; }
    .hero { padding: 100px 40px 80px; }
    .header-time { display: none; }
    .nav-links { gap: 28px; }
    .gallery-grid { columns: 1; }
    .section-header { padding-left: 60px; }
    .about-grid { padding-left: 60px; }
    .about-quote { padding: 48px 60px; }
    .about-stats { padding-left: 60px; flex-direction: column; }
    .stat-item { border-left: none; border-top: 1px solid var(--white-faint); padding: 24px 0; }
    .stat-item:first-child { border-top: none; }
    .writing-entry { grid-template-columns: 52px 1fr; gap: 0 20px; }
    .wr-col-action { display: none; }
    .modal-body.writing-modal .modal-info-panel { padding: 40px; }
    .section-number { left: 16px; }
    .gallery-section { padding: 120px 0; }
}

@media (max-width: 640px) {
    body { cursor: auto; }
    .cursor { display: none; }

    .container { padding: 0 20px; }

    .header { padding: 16px 20px; flex-wrap: nowrap; gap: 0; justify-content: space-between; align-items: center; }
    .header.scrolled { padding: 14px 20px; }
    .nav { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg); z-index: 999; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.4s var(--ease-smooth), visibility 0.4s; }
    .nav.open { opacity: 1; visibility: visible; }
    .nav-links { flex-direction: column; gap: 40px; text-align: center; }
    .nav-link { font-size: 13px; letter-spacing: 5px; }
    .nav-link::before { display: none; }
    .nav-toggle { display: flex; }

    .hero { padding: 100px 20px 80px; min-height: 100svh; }
    .hero-title { font-size: clamp(44px, 12vw, 72px); line-height: 0.95; }
    .hero-subtitle { font-size: 15px; max-width: 100%; margin-bottom: 40px; }
    .hero-cta { gap: 24px; }
    .hero-scroll-indicator { display: none; }
    .hero-eyebrow { margin-bottom: 28px; }
    .eyebrow-text { font-size: 8px; letter-spacing: 4px; }

    .gallery-section { padding: 80px 0; }
    .section-number { left: 10px; top: 40px; }
    .section-header { padding-left: 0; margin-bottom: 60px; }
    .section-kicker { font-size: 8px; letter-spacing: 4px; }
    .section-subtitle { padding-left: 16px; font-size: 14px; }
    .section-title { font-size: clamp(40px, 11vw, 68px); }

    .about-grid { padding-left: 0; gap: 40px; margin-bottom: 60px; }
    .about-quote { padding: 40px 20px; }
    .quote-mark { display: none; }
    .about-stats { padding-left: 0; }
    .about-text { font-size: 15px; }

    .writing-entry { grid-template-columns: 1fr; gap: 12px; padding: 28px 0; }
    .wr-col-index { flex-direction: row; align-items: center; gap: 12px; }
    .wr-col-action { display: none; }
    .wr-entry-title { font-size: clamp(22px, 7vw, 32px); margin-bottom: 12px; }
    .wr-entry-excerpt { font-size: 10px; }

    .category-row { gap: 12px; }
    .category-label { display: none; }
    .category-buttons { gap: 6px; }
    .category-btn { padding: 8px 14px; font-size: 9px; letter-spacing: 3px; }
    .category-sort { margin-left: 0; width: 100%; justify-content: flex-end; }

    .audio-player { right: 16px; bottom: 16px; padding: 8px 12px; gap: 8px; }
    .audio-track { display: none; }
    .theme-toggle { left: 16px; bottom: 16px; width: 38px; height: 38px; }
    .back-to-top { right: 16px; bottom: 72px; width: 38px; height: 38px; }

    .modal { padding: 0; align-items: flex-end; }
    .modal-content { width: 100%; max-width: 100%; border-radius: 0; max-height: 96vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .modal-body { border: none; border-top: 1px solid var(--white-faint); }
    .modal-media, .modal-info-panel { padding: 20px; }
    .modal-body.writing-modal .modal-info-panel { padding: 80px 20px 32px; }
    .modal-body.writing-modal .modal-description { font-size: 16px; line-height: 1.95; column-count: 1; }
    .modal-close { top: 16px; right: 16px; width: 40px; height: 40px; }
    .modal-swipe-hint { display: block; }
    .modal-nav-row { padding-top: 16px; }
}

@media (max-width: 400px) {
    .hero-title { font-size: 40px; }
    .cta-btn { padding: 14px 24px; font-size: 10px; }
    .category-btn { padding: 8px 10px; letter-spacing: 2px; }
}
