/* ============================================================
   DDAZZL.com - Dark Academia / Asymmetric / Wave-Form Design
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #1A1612;
    --bg-secondary: #2A2118;
    --accent-primary: #C46D2A;
    --accent-secondary: #A8893A;
    --text-primary: #E8DCC8;
    --text-secondary: #9A8B76;
    --divider: #3D2B1F;
    --highlight: #D4763B;
    --pure-black: #000000;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- Paper Grain Texture Overlay (CSS-generated noise) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.02;
    background-image:
        repeating-radial-gradient(circle at 17% 32%, var(--text-secondary) 0px, transparent 1px),
        repeating-radial-gradient(circle at 53% 68%, var(--divider) 0px, transparent 1px),
        repeating-radial-gradient(circle at 81% 14%, var(--text-secondary) 0px, transparent 1px),
        repeating-radial-gradient(circle at 29% 87%, var(--divider) 0px, transparent 1px);
    background-size: 3px 3px, 5px 5px, 4px 4px, 6px 6px;
}

/* --- Vertical Spine (persistent book-binding rule) --- */
#vertical-spine {
    position: fixed;
    top: 0;
    left: 33.333%;
    width: 1px;
    height: 100vh;
    background-color: var(--divider);
    opacity: 0.2;
    z-index: 100;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

/* --- Rotated Vertical Navigation --- */
#sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    z-index: 200;
    padding: 20px 0;
}

.nav-label {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    width: 48px;
    height: 80px;
    overflow: visible;
}

.nav-text {
    font-family: 'Jost', 'Futura', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    transform: rotate(-90deg);
    white-space: nowrap;
    transition: color 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.4;
}

.nav-label:hover .nav-text {
    color: var(--highlight);
    opacity: 1;
    transform: rotate(0deg);
}

/* Nav hover pulse effect (wave on still water) */
.nav-label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--highlight);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: none;
}

.nav-label:hover::after {
    animation: nav-pulse 0.6s ease-out forwards;
}

@keyframes nav-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(6);
        opacity: 0;
    }
}

/* --- Chapters (full-screen sections) --- */
.chapter {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chapter-content {
    width: 100%;
    max-width: 1200px;
    padding: 60px 80px 60px 80px;
    position: relative;
}

/* --- Chapter 1: Hero --- */
#chapter-hero {
    background: radial-gradient(ellipse at 30% 50%, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.hero-content {
    display: flex;
    align-items: flex-start;
    padding-left: 12%;
}

.hero-left {
    max-width: 600px;
}

.hero-title {
    font-family: 'Jost', 'Futura', sans-serif;
    font-weight: 500;
    font-size: clamp(56px, 8vw, 120px);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateX(-40px);
    animation: heroTitleIn 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
}

.hero-tagline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(18px, 2.2vw, 26px);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 480px;
    opacity: 0;
    transform: translateY(20px);
    animation: heroTaglineIn 0.8s ease 1.5s forwards;
}

@keyframes heroTitleIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroTaglineIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Wave */
.hero-wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.hero-wave {
    width: 200%;
    height: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
}

.wave-path.wave-1 {
    animation: waveShift1 12s linear infinite;
}

.wave-path.wave-2 {
    animation: waveShift2 16s linear infinite;
}

@keyframes waveShift1 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes waveShift2 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-40%); }
}

/* --- Chapter 2: Concept --- */
#chapter-concept {
    background-color: var(--bg-primary);
}

.concept-content {
    display: flex;
    align-items: center;
    gap: 60px;
}

.concept-illustration {
    flex: 0 0 55%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.concept-illustration.revealed {
    opacity: 1;
    transform: translateX(0);
}

.illustration-svg {
    width: 100%;
    max-width: 420px;
    height: auto;
}

/* SVG path drawing animation */
.draw-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s ease;
}

.concept-illustration.revealed .draw-path {
    stroke-dashoffset: 0;
}

.concept-text {
    flex: 1;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s,
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
}

.concept-text.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Bracket frame (manuscript notation) */
.bracket-frame {
    position: relative;
    padding: 40px 30px;
}

.bracket {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    color: var(--accent-secondary);
    opacity: 0.5;
    line-height: 1;
}

.bracket-top-left {
    top: 0;
    left: 0;
}

.bracket-top-right {
    top: 0;
    right: 0;
}

.bracket-bottom-left {
    bottom: 0;
    left: 0;
}

.bracket-bottom-right {
    bottom: 0;
    right: 0;
}

.concept-paragraph {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-primary);
}

/* --- Chapter 3: Details --- */
#chapter-details {
    background-color: var(--bg-secondary);
}

.details-content {
    display: flex;
    flex-direction: column;
    gap: 80px;
    padding-top: 80px;
    padding-bottom: 80px;
}

.detail-block {
    max-width: 520px;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.detail-block-left {
    align-self: flex-start;
    margin-left: 8%;
    transform: translateX(-60px);
}

.detail-block-right {
    align-self: flex-end;
    margin-right: 8%;
    transform: translateX(60px);
}

.detail-block.revealed {
    opacity: 1;
    transform: translateX(0);
}

.detail-label {
    font-family: 'Jost', 'Futura', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-secondary);
    display: block;
    margin-bottom: 12px;
}

.wave-divider {
    width: 120px;
    height: 20px;
    margin-bottom: 20px;
}

.wave-divider svg {
    width: 100%;
    height: 100%;
}

.detail-body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-primary);
}

/* --- Chapter 4: Colophon/Footer --- */
.chapter-colophon {
    background-color: #E8DCC8;
    color: var(--bg-primary);
    min-height: 60vh;
}

.colophon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;
}

.colophon-wave {
    width: 200px;
    height: 30px;
}

.colophon-wave svg {
    width: 100%;
    height: 100%;
}

.colophon-attribution {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 20px;
    color: var(--bg-primary);
    line-height: 1.6;
    max-width: 480px;
}

.colophon-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.meta-item {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--bg-secondary);
    text-transform: uppercase;
}

.meta-separator {
    color: var(--accent-primary);
    font-size: 14px;
}

/* --- Grid Dots (decorative) --- */
.grid-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.grid-dot.visible {
    opacity: 0.6;
}

.dot-1 {
    top: 20%;
    left: 33.333%;
}

.dot-2 {
    bottom: 30%;
    left: 66.666%;
}

.dot-3 {
    top: 50%;
    left: 50%;
}

/* --- Link Hover (draw underline from left to right) --- */
a {
    color: var(--accent-primary);
    text-decoration: none;
    position: relative;
}

a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--highlight);
    transition: width 0.3s ease;
}

a:hover::before {
    width: 100%;
}

/* --- Section Transition Bands --- */
.chapter + .chapter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 10%, var(--divider) 30%, var(--divider) 70%, transparent 90%);
}

/* --- Standing Wave Background Texture --- */
#chapter-hero::after,
#chapter-concept::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            rgba(61, 43, 31, 0.05) 40px,
            rgba(61, 43, 31, 0.05) 41px
        );
    z-index: 0;
}

#chapter-hero .chapter-content,
#chapter-hero .hero-wave-container,
#chapter-concept .chapter-content {
    position: relative;
    z-index: 1;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    #sidebar-nav {
        display: none;
    }

    .chapter-content {
        padding: 40px 24px;
    }

    .hero-content {
        padding-left: 5%;
    }

    .concept-content {
        flex-direction: column;
        gap: 40px;
    }

    .concept-illustration {
        flex: none;
        width: 100%;
    }

    .detail-block-left,
    .detail-block-right {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .detail-block-right {
        align-self: flex-start;
    }

    #vertical-spine {
        display: none;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 40px;
        letter-spacing: 0.15em;
    }

    .hero-tagline {
        font-size: 16px;
    }

    .bracket-frame {
        padding: 20px 16px;
    }

    .details-content {
        gap: 50px;
    }
}
