/* ========================================
   layer2.id — Wabi-Sabi Opulence
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --lacquer-black: #0E1210;
    --moss-midnight: #1A2A1E;
    --celadon-mist: #C8D8C0;
    --aged-jade: #7A9A78;
    --oxidized-gold: #8B7355;
    --temple-bronze: #A6926E;
    --patina-verdigris: #4A7A5A;
    --forest-canopy: #1E4628;
    --pale-lichen: #D4DED0;
    --deep-moss: #2A3A2A;
    --bg-dark: #162218;

    /* Typography */
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Source Serif 4', serif;

    /* Sizes */
    --hero-scale: clamp(2.8rem, 7vw, 6rem);
    --section-heading: clamp(1.6rem, 3.5vw, 2.8rem);
    --pull-quote: clamp(1.4rem, 3vw, 2.2rem);
    --body-size: clamp(1rem, 1.8vw, 1.15rem);
    --label-size: clamp(0.65rem, 1.1vw, 0.8rem);
    --subtitle-size: clamp(0.9rem, 1.5vw, 1.1rem);
    --transitional-scale: clamp(4rem, 12vw, 9rem);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--celadon-mist);
    background: var(--lacquer-black);
    background-image: linear-gradient(175deg, #0E1210 0%, #1A2A1E 40%, #162218 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    line-height: 1.75;
    font-size: var(--body-size);
    letter-spacing: 0.005em;
}

/* --- Paper Texture SVG Filter (hidden) --- */
.paper-texture-filter {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Particle Canvas --- */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* --- Folio Navigation --- */
#folioNav {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 16px 0;
}

.nav-line {
    position: absolute;
    top: 16px;
    bottom: 16px;
    width: 1px;
    background: rgba(139, 115, 85, 0.15);
    z-index: -1;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--aged-jade);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.nav-dot.active {
    background: var(--oxidized-gold);
    border-color: var(--oxidized-gold);
}

.nav-dot:hover {
    transform: scale(1.3);
    border-color: var(--temple-bronze);
}

.nav-tooltip {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--label-size);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--oxidized-gold);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

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

/* --- Folio (Section) Base --- */
.folio {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6vh 6vw;
    overflow: hidden;
}

/* --- Vignette Overlay --- */
.folio-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.folio-vignette::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(14, 18, 16, 0.25) 100%);
}

/* --- Folio Content Layer --- */
.folio-content {
    position: relative;
    z-index: 5;
    width: 100%;
}

/* --- Tilt 3D Target --- */
.tilt-target {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

/* --- Hero Folio --- */
.folio-hero {
    background: var(--lacquer-black);
    justify-content: flex-start;
    align-items: center;
}

.folio-hero .folio-content {
    padding-left: 15vw;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: var(--hero-scale);
    line-height: 1.15;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, #8B7355, #A6926E, #8B7355);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
    opacity: 0;
    transform: translateY(12px);
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: var(--subtitle-size);
    color: var(--aged-jade);
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(6px);
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Hanko Seal --- */
.hanko-seal {
    position: absolute;
    right: 8vw;
    bottom: 8vh;
    width: 64px;
    height: 64px;
    transform: rotate(-7deg);
    opacity: 0;
    z-index: 10;
}

.hanko-seal.visible {
    opacity: 0.4;
    transition: opacity 600ms ease;
}

/* --- Kintsugi Hero Lines --- */
.kintsugi-hero {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.6;
}

.kintsugi-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.kintsugi-line.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1500ms ease-in-out;
}

/* --- Folio Separator --- */
.folio-separator {
    position: relative;
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.separator-glow {
    position: absolute;
    width: 60%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(139, 115, 85, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 1.5s ease;
}

.separator-glow.pulse {
    animation: separatorPulse 1.5s ease forwards;
}

@keyframes separatorPulse {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.separator-line {
    width: 80%;
    height: auto;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.separator-line.visible {
    opacity: 0.5;
}

/* --- Type A: Text Dominant --- */
.folio-type-a {
    background: var(--moss-midnight);
}

.folio-type-a .folio-content {
    display: flex;
    gap: 4vw;
    align-items: center;
}

.text-block {
    width: 55%;
    padding-left: 15%;
    padding-top: 12vh;
    padding-bottom: 8vh;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.text-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.text-rule {
    position: absolute;
    left: calc(15% - 16px);
    top: -20px;
    bottom: -20px;
    width: 1px;
    background: rgba(139, 115, 85, 0.2);
}

.section-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--label-size);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--oxidized-gold);
    display: block;
    margin-bottom: 1.5rem;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: var(--section-heading);
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: var(--celadon-mist);
    font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
    margin-bottom: 2rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: var(--body-size);
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: var(--celadon-mist);
    max-width: 42ch;
    margin-bottom: 1.5em;
}

.body-text:last-child {
    margin-bottom: 0;
}

.illustration-block {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease 0.2s, transform 1s ease 0.2s;
}

.illustration-block.visible {
    opacity: 1;
    transform: translateY(0);
}

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

/* --- Kintsugi Decorative Lines (per folio) --- */
.kintsugi-decor {
    position: absolute;
    left: calc(15% - 20px);
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.kintsugi-decor.visible {
    opacity: 1;
}

/* --- Type B: Image Dominant --- */
.folio-type-b {
    background: var(--lacquer-black);
}

.folio-type-b .folio-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
}

.illustration-dominant {
    width: 70%;
    margin-left: auto;
    margin-right: -2vw;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.illustration-dominant.visible {
    opacity: 1;
    transform: translateY(0);
}

.illustration-large {
    width: 100%;
    height: auto;
}

.caption-block {
    position: absolute;
    left: 6vw;
    bottom: 6vh;
    max-width: 35ch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

.caption-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.caption-overline {
    width: 40px;
    height: 1px;
    background: var(--oxidized-gold);
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.caption-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    line-height: 1.65;
    color: var(--aged-jade);
}

/* --- Type C: Transitional --- */
.folio-type-c {
    background: var(--lacquer-black);
    justify-content: center;
}

.folio-type-c .folio-content {
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 10vw;
}

.watermark-text {
    position: absolute;
    left: 10vw;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--transitional-scale);
    color: rgba(30, 70, 40, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    z-index: 0;
}

.transitional-heading {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: var(--section-heading);
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: var(--oxidized-gold);
    font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.transitional-heading.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Closing Folio --- */
.folio-closing {
    background: var(--moss-midnight);
}

.folio-closing .folio-content {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.closing-content {
    padding-left: 5vw;
    max-width: 50ch;
    position: relative;
    z-index: 1;
}

.closing-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: var(--body-size);
    line-height: 1.75;
    color: var(--celadon-mist);
    margin-top: 2rem;
    margin-bottom: 3rem;
    max-width: 42ch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}

.closing-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-signature {
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.closing-signature.visible {
    opacity: 1;
}

.kintsugi-closing {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.kintsugi-closing.visible {
    opacity: 1;
}

/* --- Kintsugi Hover Micro-Cracks --- */
.kintsugi-crack-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.micro-crack {
    position: absolute;
    stroke: var(--oxidized-gold);
    stroke-width: 1;
    stroke-linecap: round;
    fill: none;
    opacity: 0;
}

/* --- Scroll Reveal Animations --- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .folio-type-a .folio-content {
        flex-direction: column;
    }

    .text-block {
        width: 100%;
        padding-left: 0;
    }

    .text-rule {
        display: none;
    }

    .illustration-block {
        width: 80%;
        margin: 2rem auto;
    }

    .illustration-dominant {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .folio {
        padding: 4vh 5vw;
    }

    .folio-hero .folio-content {
        padding-left: 5vw;
    }

    .folio-type-c .folio-content {
        padding-left: 5vw;
    }

    #folioNav {
        display: none;
    }

    .hanko-seal {
        right: 5vw;
        bottom: 5vh;
        width: 48px;
        height: 48px;
    }

    .watermark-text {
        left: 5vw;
        font-size: clamp(3rem, 10vw, 6rem);
    }

    .caption-block {
        position: relative;
        left: 0;
        bottom: 0;
        margin-top: 2rem;
    }
}

/* --- Prefers Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .hero-title,
    .hero-subtitle,
    .hanko-seal,
    .text-block,
    .illustration-block,
    .illustration-dominant,
    .caption-block,
    .transitional-heading,
    .closing-text,
    .closing-signature,
    .kintsugi-line,
    .separator-line,
    .kintsugi-decor,
    .kintsugi-closing {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .kintsugi-line {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }
}
