/* =========================================================
   addrenvoy.com - Wabi-Sabi Post-Digital Patina
   ========================================================= */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --kiln-charcoal: #2B1D14;
    --fired-terracotta: #C4623A;
    --sunset-persimmon: #E8873C;
    --golden-hour: #F2B05E;
    --aged-linen: #FFF5E6;
    --patina-bronze: #8B7355;
    --oxidized-copper: #4A7C6B;
    --evening-indigo: #2E3854;
    --dark-text: #3B2820;
    --body-text-color: #4A3828;
    --light-body: #E8DDD0;

    /* Typography */
    --font-heading: 'EB Garamond', Georgia, serif;
    --font-subheading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-accent: 'IBM Plex Mono', 'Courier New', monospace;

    /* Layout */
    --diagonal-angle: 7deg;
    --section-overlap: 80px;

    /* Bubble variations */
    --bubble-1: 47% 53% 42% 58% / 55% 45% 52% 48%;
    --bubble-2: 52% 48% 55% 45% / 43% 57% 48% 52%;
    --bubble-3: 45% 55% 50% 50% / 58% 42% 46% 54%;
    --bubble-4: 50% 50% 44% 56% / 52% 48% 55% 45%;
    --bubble-5: 48% 52% 56% 44% / 45% 55% 50% 50%;
    --bubble-6: 53% 47% 48% 52% / 50% 50% 43% 57%;
    --bubble-7: 46% 54% 51% 49% / 56% 44% 49% 51%;
    --bubble-8: 51% 49% 45% 55% / 47% 53% 54% 46%;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: var(--body-text-color);
    background-color: var(--aged-linen);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Vertical Navigation --- */
#vertical-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.nav-line {
    position: absolute;
    top: -10px;
    bottom: -10px;
    width: 2px;
    background: var(--patina-bronze);
    opacity: 0.3;
    border-radius: 1px;
}

.nav-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--patina-bronze);
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0;
}

.nav-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--golden-hour);
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.6s ease;
    pointer-events: none;
    filter: blur(4px);
}

.nav-dot.active {
    background: var(--golden-hour);
    border-color: var(--golden-hour);
    transform: scale(1.3);
}

.nav-dot.active::after {
    opacity: 0.5;
    animation: navPulse 3s ease-in-out infinite;
}

.nav-label {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: var(--font-accent);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--patina-bronze);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
}

@keyframes navPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* --- Floating Background Bubbles --- */
#floating-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
    animation: floatBubble var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes floatBubble {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: var(--base-opacity);
    }
    25% {
        transform: translate(calc(var(--drift-x) * 0.6), calc(var(--drift-y) * -0.3)) scale(1.05);
        opacity: calc(var(--base-opacity) * 1.2);
    }
    50% {
        transform: translate(var(--drift-x), calc(var(--drift-y) * -0.7)) scale(0.95);
        opacity: var(--base-opacity);
    }
    75% {
        transform: translate(calc(var(--drift-x) * 0.4), calc(var(--drift-y) * -1)) scale(1.02);
        opacity: calc(var(--base-opacity) * 0.8);
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: var(--base-opacity);
    }
}

/* --- Scenes (Sections) --- */
.scene {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Diagonal clip-paths */
.scene-opening {
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 60px), 0 100%);
    padding-bottom: 60px;
}

.scene-concept {
    clip-path: polygon(0 60px, 100% 0, 100% calc(100% - 60px), 0 100%);
    margin-top: -60px;
    padding: 100px 0 100px;
}

.scene-growth {
    clip-path: polygon(0 60px, 100% 0, 100% calc(100% - 60px), 0 100%);
    margin-top: -60px;
    padding: 100px 0 100px;
}

.scene-bloom {
    clip-path: polygon(0 60px, 100% 0, 100% calc(100% - 60px), 0 100%);
    margin-top: -60px;
    padding: 100px 0 100px;
}

.scene-closing {
    clip-path: polygon(0 60px, 100% 0, 100% 100%, 0 100%);
    margin-top: -60px;
    padding: 120px 0 80px;
}

/* Background layers */
.scene-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Paper texture overlay */
.scene-bg-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
}

/* Light scene backgrounds */
.scene[data-bg="light"] .scene-bg-layer {
    background: var(--aged-linen);
}

.scene[data-bg="light"] .scene-bg-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(43, 29, 20, 0.06) 100%);
    pointer-events: none;
}

/* Dark scene backgrounds */
.scene[data-bg="dark"] .scene-bg-layer {
    background: var(--kiln-charcoal);
}

.scene[data-bg="dark"] .scene-bg-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(43, 29, 20, 0.15) 100%);
    pointer-events: none;
}

/* Mid-layer (botanical illustrations) */
.scene-mid-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* Scene content */
.scene-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    width: 90%;
    margin: 0 auto;
    padding: 40px 0;
}

/* --- Kintsugi Dividers --- */
.kintsugi-divider {
    position: relative;
    z-index: 10;
    height: 60px;
    margin-top: -80px;
    margin-bottom: -20px;
    pointer-events: none;
}

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

.divider-crack {
    animation: crackPulse 4s ease-in-out infinite;
}

@keyframes crackPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Opening Scene --- */
.kintsugi-main-crack {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.crack-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawCrack 3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.5s forwards;
}

.crack-branch-1, .crack-branch-2, .crack-branch-3, .crack-branch-4 {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.crack-branch-1 {
    animation: drawBranch 1s ease 3s forwards;
}
.crack-branch-2 {
    animation: drawBranch 1s ease 3.3s forwards;
}
.crack-branch-3 {
    animation: drawBranch 1s ease 3.5s forwards;
}
.crack-branch-4 {
    animation: drawBranch 1s ease 3.7s forwards;
}

@keyframes drawCrack {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes drawBranch {
    0% {
        stroke-dashoffset: 200;
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.8;
    }
}

/* Title */
.opening-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.site-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(52px, 10vw, 80px);
    letter-spacing: -0.01em;
    line-height: 1.08;
    color: var(--dark-text);
    position: relative;
    display: inline-block;
}

.title-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: letterReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(3s + (var(--delay) * 0.12s));
}

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

.opening-tagline {
    font-family: var(--font-subheading);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(18px, 3vw, 28px);
    color: var(--fired-terracotta);
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 1.2s ease 4.5s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* --- Botanical SVGs --- */
.botanical-wisteria {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 350px;
    height: 450px;
    opacity: 0;
    animation: fadeIn 2s ease 2s forwards;
}

.wisteria-branch,
.wisteria-branch-b {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawStem 2.5s cubic-bezier(0.25, 0.1, 0.25, 1.4) 2s forwards;
}

.wisteria-leaf {
    opacity: 0;
    transform-origin: center;
    animation: leafUnfurl 1s ease forwards;
}
.leaf-1 { animation-delay: 3.5s; }
.leaf-2 { animation-delay: 3.8s; }
.leaf-3 { animation-delay: 4.1s; }

.wisteria-flowers path {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}
.flower-cluster-1 { animation-delay: 4.3s; }
.flower-cluster-2 { animation-delay: 4.5s; }
.flower-cluster-3 { animation-delay: 4.7s; }
.flower-cluster-4 { animation-delay: 4.9s; }
.flower-cluster-5 { animation-delay: 5.1s; }

@keyframes drawStem {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes leafUnfurl {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-30deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Root illustrations */
.botanical-roots {
    position: absolute;
    left: 0;
    top: 0;
    width: 280px;
    height: 100%;
}

.root-main,
.root-branch-1,
.root-branch-2,
.root-branch-3,
.root-branch-4,
.root-branch-5 {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

/* Stem illustrations */
.botanical-stems {
    position: absolute;
    right: 0;
    top: 0;
    width: 400px;
    height: 100%;
}

/* Flower illustrations */
.botanical-flowers {
    position: absolute;
    right: 40px;
    top: 0;
    width: 350px;
    height: 100%;
}

/* Decay illustrations */
.botanical-decay {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 350px;
    height: 450px;
    opacity: 0.8;
}

/* --- Bubble Containers --- */
.bubble-container {
    background: rgba(255, 245, 230, 0.06);
    backdrop-filter: blur(2px);
    padding: 36px 40px;
    margin-bottom: 28px;
    position: relative;
    transition: border-radius 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s ease,
                box-shadow 0.6s ease;
    transform: translateY(30px);
    opacity: 0;
}

.bubble-container.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Light section bubbles */
.scene[data-bg="light"] .bubble-container {
    background: rgba(43, 29, 20, 0.04);
    box-shadow: 4px 6px 20px rgba(43, 29, 20, 0.08);
}

/* Dark section bubbles */
.scene[data-bg="dark"] .bubble-container {
    background: rgba(255, 245, 230, 0.06);
    box-shadow: 4px 6px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.15);
}

/* Bubble radius variations */
.bubble-var-1 { border-radius: var(--bubble-1); }
.bubble-var-2 { border-radius: var(--bubble-2); }
.bubble-var-3 { border-radius: var(--bubble-3); }
.bubble-var-4 { border-radius: var(--bubble-4); }
.bubble-var-5 { border-radius: var(--bubble-5); }
.bubble-var-6 { border-radius: var(--bubble-6); }
.bubble-var-7 { border-radius: var(--bubble-7); }
.bubble-var-8 { border-radius: var(--bubble-8); }

/* Hover - morph border radius */
.bubble-container:hover {
    transform: translateY(-2px);
    box-shadow: 6px 8px 28px rgba(43, 29, 20, 0.12);
}

.scene[data-bg="dark"] .bubble-container:hover {
    box-shadow: 6px 8px 28px rgba(0, 0, 0, 0.4);
    border-color: rgba(242, 176, 94, 0.2);
}

/* Satellite bubbles on hover */
.bubble-container::before,
.bubble-container::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bubble-container::before {
    background: var(--golden-hour);
    top: -4px;
    right: 20%;
}

.bubble-container::after {
    background: var(--sunset-persimmon);
    bottom: -4px;
    left: 15%;
}

.bubble-container:hover::before {
    opacity: 0.6;
    transform: translate(10px, -12px) scale(1.2);
}

.bubble-container:hover::after {
    opacity: 0.5;
    transform: translate(-8px, 10px) scale(1);
}

/* --- Typography --- */
.section-heading {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(32px, 5vw, 52px);
    letter-spacing: -0.01em;
    line-height: 1.08;
    color: var(--dark-text);
    margin-bottom: 20px;
}

.light-heading {
    color: var(--aged-linen);
}

.sub-heading {
    font-family: var(--font-subheading);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(18px, 2.5vw, 26px);
    color: var(--fired-terracotta);
    margin-bottom: 14px;
    line-height: 1.3;
}

.scene[data-bg="dark"] .sub-heading {
    color: var(--sunset-persimmon);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: var(--body-text-color);
    max-width: 680px;
}

.light-text {
    color: var(--light-body);
}

.accent-label {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--patina-bronze);
    display: inline-block;
    margin-bottom: 12px;
}

.scene[data-bg="dark"] .accent-label {
    color: var(--golden-hour);
    opacity: 0.7;
}

/* --- Closing Scene --- */
.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 70vh;
}

.closing-message {
    margin-bottom: 60px;
}

.closing-quote {
    font-family: var(--font-subheading);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(24px, 4vw, 40px);
    color: var(--fired-terracotta);
    line-height: 1.3;
    max-width: 700px;
    margin: 0 auto 16px;
}

.closing-attribution {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--patina-bronze);
}

.closing-coda {
    max-width: 600px;
}

.closing-body {
    color: var(--dark-text);
    text-align: center;
    max-width: 100%;
}

/* --- Concept Scene Layout --- */
.concept-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 800px;
}

.concept-content .bubble-var-1 {
    justify-self: start;
    max-width: 620px;
    margin-left: 40px;
}

.concept-content .bubble-var-2 {
    justify-self: end;
    max-width: 580px;
    margin-right: 20px;
}

.concept-content .bubble-var-3 {
    justify-self: start;
    max-width: 500px;
    margin-left: 80px;
}

/* --- Growth Scene Layout --- */
.growth-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.growth-content .bubble-var-4 {
    grid-column: 1 / -1;
    max-width: 700px;
}

.growth-content .bubble-var-5 {
    max-width: 480px;
}

.growth-content .bubble-var-6 {
    max-width: 480px;
    justify-self: end;
}

/* --- Bloom Scene Layout --- */
.bloom-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 850px;
}

.bloom-content .bubble-var-7 {
    max-width: 680px;
    margin-left: 20px;
}

.bloom-content .bubble-var-8 {
    max-width: 620px;
    margin-left: 100px;
}

.bloom-content .bubble-var-2 {
    max-width: 560px;
    margin-left: 60px;
}

/* --- Scroll-linked animations for botanicals --- */
.scene[data-bg="dark"] .botanical-roots g {
    transition: opacity 1.5s ease;
}

.scene.in-view .root-main,
.scene.in-view .root-branch-1,
.scene.in-view .root-branch-2,
.scene.in-view .root-branch-3,
.scene.in-view .root-branch-4,
.scene.in-view .root-branch-5 {
    animation: drawStem 2.5s cubic-bezier(0.25, 0.1, 0.25, 1.4) forwards;
}

.scene.in-view .root-branch-1 { animation-delay: 0.3s; }
.scene.in-view .root-branch-2 { animation-delay: 0.6s; }
.scene.in-view .root-branch-3 { animation-delay: 0.9s; }
.scene.in-view .root-branch-4 { animation-delay: 1.2s; }
.scene.in-view .root-branch-5 { animation-delay: 1.5s; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .scene-opening {
        clip-path: polygon(0 0, 100% 0, 100% calc(100% - 35px), 0 100%);
    }

    .scene-concept,
    .scene-growth,
    .scene-bloom {
        clip-path: polygon(0 35px, 100% 0, 100% calc(100% - 35px), 0 100%);
        margin-top: -35px;
    }

    .scene-closing {
        clip-path: polygon(0 35px, 100% 0, 100% 100%, 0 100%);
        margin-top: -35px;
    }

    #vertical-nav {
        right: 12px;
        gap: 18px;
    }

    .nav-label {
        display: none;
    }

    .scene-content {
        width: 92%;
        padding: 30px 0;
    }

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

    .growth-content .bubble-var-5,
    .growth-content .bubble-var-6 {
        max-width: 100%;
        justify-self: start;
    }

    .concept-content .bubble-var-1,
    .concept-content .bubble-var-2,
    .concept-content .bubble-var-3 {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .bloom-content .bubble-var-7,
    .bloom-content .bubble-var-8,
    .bloom-content .bubble-var-2 {
        margin-left: 0;
        max-width: 100%;
    }

    .bubble-container {
        padding: 24px 20px;
    }

    .botanical-wisteria,
    .botanical-decay {
        width: 200px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 42px;
    }

    .section-heading {
        font-size: 28px;
    }

    .closing-quote {
        font-size: 22px;
    }

    .body-text {
        font-size: 15px;
    }
}
