/* ============================================
   lordly.dev - Botanical Monastery
   A contemplative digital garden
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #F5ECD7;
    --bg-alt: #EDE0C8;
    --bg-warm: #E8D5B0;
    --text-primary: #2D1810;
    --text-secondary: #3D2B1F;
    --accent-primary: #C4632A;
    --accent-secondary: #5E8C61;
    --accent-tertiary: #9A7B4F;
    --highlight: #8B4513;
    --decorative: #6B8E7B;
    --deep-bg: #4A3728;
    --copper-rust: #6B3A2A;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Lora', 'Georgia', serif;
    --font-caption: 'Alegreya Sans', 'Helvetica Neue', sans-serif;
    --font-accent: 'IM Fell English', 'Georgia', serif;

    --ease-organic: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --ease-grow: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- 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-secondary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.8s var(--ease-organic);
}

/* --- Paper Grain Texture Overlay --- */
#paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* --- Vine Navigation --- */
#vine-nav {
    position: fixed;
    left: 12px;
    top: 0;
    width: 40px;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
}

#vine-svg {
    width: 40px;
    height: 100%;
    overflow: visible;
}

#vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.3s var(--ease-organic);
}

#vine-leaves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.vine-leaf {
    position: absolute;
    left: 8px;
    width: 24px;
    height: 18px;
    cursor: pointer;
    transform: scale(0);
    transition: transform 0.5s var(--ease-grow);
    pointer-events: auto;
}

.vine-leaf.visible {
    transform: scale(1);
}

.vine-leaf svg {
    width: 100%;
    height: 100%;
}

.vine-leaf:hover svg path {
    stroke: var(--accent-primary);
}

/* --- Background Watermark Layer --- */
#watermark-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.watermark-spiral {
    position: absolute;
    top: 10%;
    right: -5%;
    opacity: 1;
}

.watermark-spiral-2 {
    top: auto;
    right: auto;
    bottom: 15%;
    left: -5%;
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    z-index: 1;
}

/* --- Hero Section --- */
#hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

#root-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#roots-svg {
    width: 100%;
    height: 100%;
}

/* Root drawing animation */
.root-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0;
}

.root-stipple .root-path {
    stroke-dasharray: 0;
    stroke-dashoffset: 0;
}

.root-crosshatch .root-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.root-label {
    cursor: pointer;
    opacity: 0;
    transition: fill 0.3s var(--ease-organic), opacity 0.8s var(--ease-organic);
    letter-spacing: 0.02em;
}

.root-label:hover {
    fill: var(--accent-primary);
}

/* Hero title */
#hero-title {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s var(--ease-organic), transform 1.5s var(--ease-organic);
}

#hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

#cartouche {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90vw;
    height: auto;
    z-index: -1;
}

.cartouche-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

#site-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(48px, 8vw, 96px);
    color: var(--text-primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 0.15em;
    position: relative;
}

#site-subtitle {
    font-family: var(--font-caption);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(14px, 2vw, 18px);
    color: var(--accent-tertiary);
    letter-spacing: 0.04em;
    opacity: 0;
    transition: opacity 1.5s var(--ease-organic) 0.5s;
}

#hero-title.visible #site-subtitle {
    opacity: 1;
}

/* --- Branch Dividers --- */
.branch-divider {
    position: relative;
    width: 100%;
    height: 120px;
    z-index: 10;
    overflow: visible;
    margin: -20px 0;
}

.branch-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.branch-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 2s var(--ease-organic);
}

.branch-path.drawn {
    stroke-dashoffset: 0;
}

.branch-detail {
    transition-delay: 0.3s;
}

.branch-leaf {
    transition-delay: 0.6s;
}

/* --- Content Sections --- */
.content-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 40px;
    position: relative;
}

/* S-curve column alignment */
.zone-left .content-column {
    margin-left: 8%;
    margin-right: auto;
}

.zone-center .content-column {
    margin-left: auto;
    margin-right: auto;
}

.zone-right .content-column {
    margin-left: auto;
    margin-right: 8%;
}

.content-column {
    width: clamp(320px, 65vw, 900px);
    max-width: 90%;
    position: relative;
    z-index: 2;
}

/* Section headings */
.section-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(32px, 5vw, 48px);
    color: var(--highlight);
    letter-spacing: 0.04em;
    margin-bottom: 1.5em;
    position: relative;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.section-heading.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Decorative wavy line under heading */
.section-heading::after {
    content: '';
    display: block;
    width: 120px;
    height: 8px;
    margin-top: 0.6em;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,4 C10,1 20,7 30,4 C40,1 50,7 60,4 C70,1 80,7 90,4 C100,1 110,7 120,4' fill='none' stroke='%23C4632A' stroke-width='1'/%3E%3C/svg%3E") no-repeat;
    background-size: contain;
}

/* Body text */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 38em;
    margin-bottom: 1.5em;
}

/* Reveal animation for text */
.reveal-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--ease-organic), transform 0.7s var(--ease-organic);
}

.reveal-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Caption text */
.caption-text {
    font-family: var(--font-caption);
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
    color: var(--accent-tertiary);
    letter-spacing: 0.02em;
}

/* Epigraph / pull quotes */
.epigraph {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: 16px;
    color: var(--copper-rust);
    margin-top: 2em;
    padding-left: 1.5em;
    border-left: 2px solid var(--accent-tertiary);
    max-width: 32em;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.epigraph.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Work entries */
.work-entry {
    margin-bottom: 2em;
    padding-left: 1em;
    border-left: 3px solid var(--decorative);
}

.work-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    color: var(--highlight);
    display: block;
    margin-bottom: 0.3em;
    letter-spacing: 0.02em;
}

.work-desc {
    display: block;
    font-size: 16px;
}

/* Contact address */
.contact-address {
    margin-top: 2em;
    text-align: center;
}

.contact-address .caption-text {
    font-size: 18px;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--accent-primary);
    padding-bottom: 2px;
    cursor: default;
}

/* --- Margin Flora --- */
.margin-flora {
    position: absolute;
    z-index: 15;
    pointer-events: none;
}

/* Default: left side */
.margin-flora {
    left: 3%;
    top: 30%;
}

.margin-flora-right {
    left: auto;
    right: 3%;
    top: 25%;
}

.flora-svg {
    opacity: 0.6;
}

/* --- Foreground Parallax Layer --- */
.foreground-layer {
    will-change: transform;
}

/* --- Footer --- */
#footer {
    background-color: var(--deep-bg);
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
}

.footer-content {
    position: relative;
}

.footer-roots {
    width: 300px;
    height: auto;
    margin-bottom: 2em;
    opacity: 0.4;
}

.footer-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    color: var(--bg-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.5em;
}

.footer-caption {
    font-family: var(--font-caption);
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
    color: var(--accent-tertiary);
    letter-spacing: 0.02em;
}

/* --- Cursor on illustrated elements --- */
.root-label,
.branch-svg,
.flora-svg,
.vine-leaf {
    cursor: crosshair;
}

/* --- Alternating section background warmth --- */
.section.bg-warm-1 {
    background-color: var(--bg-primary);
}

.section.bg-warm-2 {
    background-color: var(--bg-alt);
}

.section.bg-warm-3 {
    background-color: var(--bg-warm);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-section {
        padding: 80px 24px;
    }

    .zone-left .content-column,
    .zone-center .content-column,
    .zone-right .content-column {
        margin-left: auto;
        margin-right: auto;
    }

    .content-column {
        width: 95%;
    }

    #vine-nav {
        display: none;
    }

    .margin-flora {
        display: none;
    }

    #site-title {
        font-size: clamp(36px, 10vw, 64px);
    }

    .section-heading {
        font-size: clamp(28px, 6vw, 40px);
    }

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

    .branch-divider {
        height: 80px;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 60px 16px;
    }

    #cartouche {
        width: 320px;
    }

    .work-title {
        font-size: 18px;
    }

    .work-desc {
        font-size: 15px;
    }
}
