/* MasqproT — Masquerade Protocol
   Muji minimalism × translucent frost × leaf-organic motifs */

:root {
    --c-deep: #2c3330;
    --c-parchment: #f8f6f3;
    --c-frost: rgba(248, 246, 243, 0.72);
    --c-sage: #8fa89b;
    --c-terracotta: #c9917a;
    --c-frost-blue: #d4e4ed;
    --c-moss: #3d5a4c;
    --c-copper: #b87a5e;
    --c-line: #c8d6d0;
    --c-body: #4a5550;

    --font-display: "DM Serif Display", "Inter", serif;
    --font-body: "Karla", "Inter", system-ui, sans-serif;
    --font-ui: "Space Grotesk", "Space", "Inter", monospace;

    --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
    --ease-quiet: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.75;
    color: var(--c-body);
    background: var(--c-parchment);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

/* ===== Typography ===== */
.display-h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(40px, 6.5vw, 88px);
    line-height: 1.05;
    color: var(--c-deep);
    -webkit-text-stroke: 0.4px rgba(44, 51, 48, 0.3);
    letter-spacing: -0.01em;
}
.display-h2 em {
    font-style: italic;
    color: var(--c-moss);
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-copper);
    margin-bottom: 24px;
}

.hl { color: var(--c-terracotta); font-weight: 500; }

/* ===== Cursor leaf trail ===== */
.cursor-leaf {
    position: fixed;
    width: 60px;
    height: 80px;
    top: 0; left: 0;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-15deg);
    transition: opacity 0.8s var(--ease-quiet);
    z-index: 9999;
    mix-blend-mode: multiply;
}
.cursor-leaf svg { width: 100%; height: 100%; opacity: 0.18; }
@media (hover: none) { .cursor-leaf { display: none; } }

/* ===== Top nav ===== */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px clamp(24px, 5vw, 64px);
    background: rgba(248, 246, 243, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(143, 168, 155, 0.15);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.6s var(--ease-quiet), transform 0.6s var(--ease-quiet);
}
.top-nav.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.nav-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-ui);
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-deep);
}
.nav-links {
    list-style: none;
    display: flex;
    gap: clamp(18px, 3vw, 40px);
}
.nav-links a {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-body);
    position: relative;
    padding-bottom: 2px;
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 50%; bottom: 0;
    width: 0; height: 1px;
    background: var(--c-copper);
    transition: width 0.25s ease-out, left 0.25s ease-out;
}
.nav-links a:hover::after { width: 100%; left: 0; }
@media (max-width: 640px) {
    .nav-links { display: none; }
}

/* ===== Scene base ===== */
.scene {
    position: relative;
    min-height: 100vh;
    padding: clamp(80px, 12vh, 160px) clamp(24px, 6vw, 96px);
    isolation: isolate;
}

/* ===== Duotone backgrounds (procedural) ===== */
.duotone-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
}
.duotone-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-deep) 0%, var(--c-moss) 35%, var(--c-frost-blue) 100%);
}
.duotone-mask::before {
    background:
        radial-gradient(ellipse 60% 45% at 50% 38%, rgba(212, 228, 237, 0.85) 0%, rgba(143, 168, 155, 0.5) 30%, transparent 60%),
        radial-gradient(ellipse 14% 12% at 38% 36%, var(--c-deep) 0%, transparent 70%),
        radial-gradient(ellipse 14% 12% at 62% 36%, var(--c-deep) 0%, transparent 70%),
        radial-gradient(ellipse 40% 8% at 50% 52%, var(--c-moss) 0%, transparent 70%),
        linear-gradient(160deg, var(--c-deep) 0%, var(--c-moss) 50%, #6b8378 100%);
}
.duotone-botanical::before {
    background:
        radial-gradient(ellipse 80% 60% at 30% 50%, rgba(212, 228, 237, 0.7), transparent 60%),
        repeating-linear-gradient(72deg, transparent 0 18px, rgba(44, 51, 48, 0.18) 18px 19px),
        repeating-linear-gradient(108deg, transparent 0 22px, rgba(44, 51, 48, 0.12) 22px 23px),
        linear-gradient(160deg, var(--c-moss) 0%, var(--c-deep) 100%);
}
.duotone-veil::before {
    background:
        radial-gradient(ellipse 70% 50% at 50% 50%, rgba(212, 228, 237, 0.6), transparent 70%),
        repeating-linear-gradient(45deg, rgba(44, 51, 48, 0.08) 0 4px, transparent 4px 9px),
        repeating-linear-gradient(-45deg, rgba(212, 228, 237, 0.08) 0 4px, transparent 4px 9px),
        linear-gradient(180deg, var(--c-deep) 0%, var(--c-moss) 100%);
}

/* ===== Frost layers ===== */
.frost-layer {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(248, 246, 243, 0.55);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}
@supports not (backdrop-filter: blur(1px)) {
    .frost-layer { background: rgba(248, 246, 243, 0.95); }
}
.frost-hero {
    backdrop-filter: blur(60px) saturate(1.05);
    -webkit-backdrop-filter: blur(60px) saturate(1.05);
    background: rgba(248, 246, 243, 0.35);
    transition: backdrop-filter 4s var(--ease-quiet), background 4s var(--ease-quiet), -webkit-backdrop-filter 4s var(--ease-quiet);
}
.frost-hero.is-thinning {
    backdrop-filter: blur(24px) saturate(1.05);
    -webkit-backdrop-filter: blur(24px) saturate(1.05);
    background: rgba(248, 246, 243, 0.45);
}

.frost-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(248, 246, 243, 0.4);
}

.frost-unmask {
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    background: rgba(248, 246, 243, 0.55);
}

/* ===== Scene 1 — Invitation ===== */
.scene-invitation {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}
.invitation-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
}
.logotype {
    font-family: var(--font-display);
    font-size: clamp(56px, 10vw, 128px);
    color: var(--c-deep);
    letter-spacing: -0.02em;
    line-height: 1;
    -webkit-text-stroke: 0.5px rgba(44, 51, 48, 0.3);
    opacity: 0;
    transform: translateY(8px);
    animation: fadeUp 2s var(--ease-quiet) 0.4s forwards;
}
.tagline {
    margin-top: 28px;
    font-family: var(--font-body);
    font-size: clamp(15px, 1.4vw, 19px);
    color: var(--c-body);
    letter-spacing: 0.04em;
    opacity: 0;
    animation: fadeUp 2s var(--ease-quiet) 1.4s forwards;
}
@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}
.scroll-indicator {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: pulseLeaf 3s var(--ease-quiet) infinite;
    opacity: 0.55;
}
@keyframes pulseLeaf {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Leaf watermarks */
.leaf-watermark {
    position: absolute;
    pointer-events: none;
    opacity: 0.04;
    z-index: 0;
    animation: drift 40s linear infinite;
}
.leaf-wm-1 {
    top: 8%;
    right: -120px;
    width: 520px;
    transform: rotate(18deg);
}
@keyframes drift {
    0% { transform: rotate(18deg) translateY(0); }
    50% { transform: rotate(22deg) translateY(-30px); }
    100% { transform: rotate(18deg) translateY(0); }
}

/* ===== Scene 2 — Threshold ===== */
.scene-threshold {
    background: var(--c-parchment);
    overflow: hidden;
}
.threshold-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
}
.threshold-text {
    padding-right: 16px;
}
.threshold-text h2 { margin-bottom: 32px; }
.threshold-text p {
    margin-bottom: 20px;
    max-width: 56ch;
    color: var(--c-body);
}
.threshold-meta {
    margin-top: 48px;
    display: flex;
    gap: 32px;
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-moss);
    border-top: 1px solid rgba(143, 168, 155, 0.3);
    padding-top: 24px;
}
.threshold-image {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 2px;
}
.threshold-image .frost-card {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.55;
}
.leaf-draw {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    z-index: 2;
}
.leaf-draw path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.5s ease-out;
}
.leaf-draw.is-drawn path { stroke-dashoffset: 0; }

@media (max-width: 820px) {
    .threshold-grid { grid-template-columns: 1fr; }
    .threshold-image { aspect-ratio: 4/3; }
}

/* Z lines */
.z-line {
    position: absolute;
    height: 1px;
    background: var(--c-line);
    opacity: 0.6;
    pointer-events: none;
}
.z-line-1 {
    bottom: 8%;
    left: 8%;
    right: 18%;
    transform: rotate(-1.5deg);
    transform-origin: left center;
}
.z-line-2 {
    top: 22%;
    left: 18%;
    right: 8%;
    transform: rotate(1.2deg);
    transform-origin: right center;
}

/* ===== Scene 3 — Ballroom ===== */
.scene-ballroom {
    background:
        radial-gradient(ellipse 70% 50% at 80% 20%, rgba(212, 228, 237, 0.35), transparent 60%),
        radial-gradient(ellipse 60% 40% at 10% 80%, rgba(201, 145, 122, 0.12), transparent 60%),
        var(--c-parchment);
    overflow: hidden;
}
.ballroom-header {
    max-width: 1280px;
    margin: 0 auto clamp(60px, 8vh, 100px);
    text-align: right;
}
.ballroom-header h2 {
    margin-top: 16px;
}
.reveal-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.8fr;
    gap: clamp(20px, 3vw, 40px);
    align-items: start;
}
.reveal-card {
    position: relative;
    padding: 40px 32px 36px;
    background: var(--c-frost);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(143, 168, 155, 0.3);
    border-radius: 2px;
    overflow: hidden;
    transition: transform 0.45s var(--ease-spring), border-color 0.3s ease, box-shadow 0.45s var(--ease-spring);
}
.reveal-card.pos-a { transform: translateY(0); }
.reveal-card.pos-b { transform: translateY(60px); }
.reveal-card.pos-c { transform: translateY(20px); }
.reveal-card:hover {
    transform: translateY(-4px) !important;
    border-color: rgba(143, 168, 155, 1);
    box-shadow: 0 20px 60px -30px rgba(44, 51, 48, 0.25);
}
.reveal-card:hover .card-leaf-bg { transform: rotate(3deg) scale(1.04); }

.card-frost {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(248, 246, 243, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    opacity: 1;
    transition: opacity 0.9s var(--ease-quiet);
    pointer-events: none;
}
.reveal-card.is-revealed .card-frost { opacity: 0; }

.card-leaf-bg {
    position: absolute;
    bottom: -40px;
    right: -30px;
    width: 220px;
    opacity: 0.08;
    z-index: 0;
    transition: transform 0.6s var(--ease-spring);
}
.card-content {
    position: relative;
    z-index: 1;
}
.card-num {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.25em;
    color: var(--c-copper);
    display: block;
    margin-bottom: 18px;
}
.reveal-card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 32px;
    color: var(--c-deep);
    line-height: 1.15;
    margin-bottom: 18px;
}
.reveal-card p {
    color: var(--c-body);
    font-size: 16px;
    margin-bottom: 28px;
}
.link-draw {
    position: relative;
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-copper);
    padding-bottom: 4px;
    display: inline-block;
}
.link-draw::after {
    content: "";
    position: absolute;
    left: 50%; bottom: 0;
    width: 0; height: 1px;
    background: var(--c-copper);
    transition: width 0.25s ease-out, left 0.25s ease-out;
}
.link-draw:hover::after { width: 100%; left: 0; }

@media (max-width: 920px) {
    .reveal-grid { grid-template-columns: 1fr; }
    .reveal-card { transform: none !important; }
}

/* ===== Scene 4 — Unmasking ===== */
.scene-unmasking {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.unmasking-stage {
    position: relative;
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16/9;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 2px;
}
.mask-outline {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    z-index: 2;
}
.mask-outline path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 3s ease-out;
}
.mask-outline.is-drawn path { stroke-dashoffset: 0; }
.full-color-reveal {
    opacity: 0;
    transition: opacity 1.6s var(--ease-quiet) 1.4s;
}
.mask-outline.is-drawn .full-color-reveal { opacity: 1; }

.unmasking-text {
    position: absolute;
    bottom: 8%;
    left: 6%;
    right: 6%;
    z-index: 5;
    max-width: 560px;
    background: rgba(248, 246, 243, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 28px 32px;
    border-left: 1px solid var(--c-sage);
}
.unmasking-text h2 { font-size: clamp(28px, 3.6vw, 44px); margin: 16px 0 14px; }
.unmasking-text p { font-size: 15px; }

/* ===== Scene 5 — Departure ===== */
.scene-departure {
    background: var(--c-parchment);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: clamp(120px, 18vh, 200px);
    padding-bottom: clamp(80px, 12vh, 140px);
    position: relative;
    overflow: hidden;
}
.leaf-drift {
    position: absolute;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    opacity: 0;
    animation: driftUp 12s linear infinite;
}
@keyframes driftUp {
    0% { transform: translate(-50%, 0); opacity: 0; }
    20% { opacity: 0.18; }
    80% { opacity: 0.18; }
    100% { transform: translate(-50%, -60vh); opacity: 0; }
}
.departure-mark {
    margin-bottom: 40px;
    opacity: 0.85;
}
.departure-line {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(22px, 2.6vw, 32px);
    color: var(--c-deep);
    max-width: 720px;
    line-height: 1.4;
    margin: 0 auto 80px;
}
.departure-meta {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: clamp(28px, 5vw, 80px);
    margin-bottom: 64px;
    border-top: 1px solid rgba(143, 168, 155, 0.3);
    border-bottom: 1px solid rgba(143, 168, 155, 0.3);
    padding: 32px 0;
}
.meta-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.meta-label {
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--c-copper);
}
.meta-val {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--c-deep);
}
.departure-foot {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    justify-content: center;
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-body);
    opacity: 0.7;
}
@media (max-width: 720px) {
    .departure-meta { grid-template-columns: repeat(2, auto); }
}

/* ===== Reveal helpers ===== */
.reveal-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s var(--ease-quiet), transform 0.9s var(--ease-quiet);
}
.reveal-block.is-visible {
    opacity: 1;
    transform: translateY(0);
}
