/* =============================================
   mujun.dev - Victorian Ornate + Zen Stillness
   Contradiction as Craft
   ============================================= */

:root {
    --parchment-cream: #FFF8F0;
    --linen-blush: #F5EDE4;
    --antiqued-brass: #B8956A;
    --burnished-gold: #D4A96A;
    --sumi-ink: #2C2420;
    --faded-umber: #6B5D52;
    --celadon-mist: #A8C5B8;
    --rose-dust: #C9A5A0;
    --indigo-night: #3A3555;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: var(--sumi-ink);
    background-color: var(--parchment-cream);
    overflow-x: hidden;
}

/* Aged paper grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--antiqued-brass) 0.5px, transparent 0.5px);
    background-size: 8px 8px;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

main {
    position: relative;
    z-index: 1;
}

/* =============================================
   Scroll Koi Fish
   ============================================= */
.scroll-koi {
    position: fixed;
    right: 16px;
    top: 0;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.1s linear;
    pointer-events: none;
}

.scroll-koi.visible {
    opacity: 0.6;
}

.scroll-koi svg {
    transition: transform 0.3s ease;
}

.scroll-koi.paused {
    animation: koi-pulse 2s ease-in-out infinite;
}

@keyframes koi-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* =============================================
   Acanthus Leaf Progress Indicator
   ============================================= */
.acanthus-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0.5;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.acanthus-indicator.paused {
    animation: acanthus-pulse 2s ease-in-out infinite;
}

@keyframes acanthus-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* =============================================
   Section 0: Hero
   ============================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    background: var(--parchment-cream);
}

.hero-oval-frame {
    position: relative;
    width: min(80vw, 600px);
    height: min(55vw, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: hero-appear 0.4s ease 0.4s forwards;
}

@keyframes hero-appear {
    to { opacity: 1; }
}

.oval-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.oval-path {
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
    animation: draw-oval 2.5s ease-in-out 0.8s forwards;
}

.oval-inner {
    stroke-dasharray: 1700;
    stroke-dashoffset: 1700;
    animation: draw-oval 2.5s ease-in-out 1.0s forwards;
}

@keyframes draw-oval {
    to { stroke-dashoffset: 0; }
}

.corner-ornament {
    opacity: 0;
    animation: ornament-appear 0.4s ease forwards;
    animation-delay: var(--delay, 2.5s);
}

@keyframes ornament-appear {
    to { opacity: 1; }
}

/* Betta Fish */
.betta-fish {
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    opacity: 0;
    animation: betta-fade 1s ease 3.8s forwards;
    pointer-events: none;
}

.betta-svg {
    width: 100%;
    height: 100%;
}

@keyframes betta-fade {
    to { opacity: 0.7; }
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    letter-spacing: 0.04em;
    color: var(--sumi-ink);
    margin-bottom: 16px;
    opacity: 0;
}

.hero-title.animated {
    opacity: 1;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-8px);
    animation: char-settle 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes char-settle {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--faded-umber);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    opacity: 0;
    animation: subtitle-fade 0.8s ease 4.4s forwards;
}

@keyframes subtitle-fade {
    to { opacity: 1; }
}

/* =============================================
   Kinetic Animated Typography
   ============================================= */
.kinetic-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.04em;
    color: var(--sumi-ink);
    text-align: center;
    margin-bottom: 60px;
}

.kinetic-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1), transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.kinetic-title.revealed .char {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================
   Section 1: Vitrine Grid
   ============================================= */
.vitrine-grid {
    padding: 100px 5vw 120px;
    min-height: 150vh;
    background: var(--parchment-cream);
}

.section-header {
    padding: 0 20px;
    margin-bottom: 20px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.vitrine-item {
    position: relative;
    background: var(--linen-blush);
    min-height: 280px;
    padding: 0;
    perspective: 800px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    /* 3D perspective tilt */
    transform-style: preserve-3d;
}

.vitrine-item.revealed {
    opacity: 1;
    transform: translateY(0) rotateX(2deg) rotateY(-2deg);
}

.vitrine-item.tall {
    grid-row: span 2;
    min-height: 500px;
}

.vitrine-item:hover {
    transform: translateY(0) rotateX(0deg) rotateY(0deg);
    box-shadow:
        inset 0 0 20px rgba(184, 149, 106, 0.1),
        0 4px 20px rgba(44, 36, 32, 0.08),
        0 8px 40px rgba(44, 36, 32, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.vitrine-item:hover .frame-path {
    stroke: var(--burnished-gold);
    transition: stroke 0.3s ease;
}

/* Frame SVG overlay */
.frame-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.frame-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.frame-path-inner {
    stroke-dasharray: 1900;
    stroke-dashoffset: 1900;
    transition: stroke-dashoffset 0.8s ease 0.2s;
}

.vitrine-item.revealed .frame-path {
    stroke-dashoffset: 0;
}

.vitrine-item.revealed .frame-path-inner {
    stroke-dashoffset: 0;
}

.frame-corner {
    opacity: 0;
    transition: opacity 0.3s ease 0.6s;
}

.vitrine-item.revealed .frame-corner {
    opacity: 1;
}

.frame-fleur {
    opacity: 0;
    transition: opacity 0.3s ease 0.7s;
}

.vitrine-item.revealed .frame-fleur {
    opacity: 1;
}

/* Vitrine Content */
.vitrine-content {
    position: relative;
    z-index: 1;
    padding: 40px 36px;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

.vitrine-item.revealed .vitrine-content {
    opacity: 1;
}

.specimen-label {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 0.75em;
    color: var(--antiqued-brass);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.vitrine-content h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    color: var(--sumi-ink);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.specimen-desc {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    color: var(--faded-umber);
    line-height: 1.75;
    margin-bottom: 16px;
}

.specimen-tech {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 0.8em;
    color: var(--celadon-mist);
    letter-spacing: 0.05em;
}

/* Lionfish Corner Ornaments */
.lionfish-ornament {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.5s ease 0.8s;
}

.vitrine-item.revealed .lionfish-ornament {
    opacity: 1;
}

.lionfish-ornament.top-right {
    top: 8px;
    right: 8px;
}

.lionfish-ornament.bottom-left {
    bottom: 8px;
    left: 8px;
}

/* =============================================
   Section 2: Zen Breathing Space
   ============================================= */
.breathing-space {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    position: relative;
    background: var(--parchment-cream);
    /* Damask-style background for alternating section */
    background-image:
        radial-gradient(ellipse at 50% 50%, var(--linen-blush) 0%, transparent 70%);
}

.filigree-line {
    width: 100%;
    max-width: 1000px;
    margin-bottom: 80px;
    overflow: hidden;
}

.filigree-line svg {
    width: 100%;
    height: 20px;
}

.filigree-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease;
}

.filigree-path-glow {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease 0.2s;
}

.filigree-line.revealed .filigree-path,
.filigree-line.revealed .filigree-path-glow {
    stroke-dashoffset: 0;
}

.zen-content {
    text-align: center;
    max-width: 600px;
    padding: 60px 40px;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.zen-content.revealed {
    opacity: 1;
}

.zen-quote {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zen-line {
    display: block;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 3vw, 2.2rem);
    color: var(--sumi-ink);
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.zen-content.revealed .zen-line:nth-child(1) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.zen-content.revealed .zen-line:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.8s;
}

.zen-content.revealed .zen-line:nth-child(3) {
    opacity: 0.7;
    transform: translateY(0);
    transition-delay: 1.3s;
    font-style: italic;
    color: var(--faded-umber);
}

/* =============================================
   Section 3: Featured Grid
   ============================================= */
.featured-grid {
    padding: 100px 5vw 120px;
    min-height: 70vh;
    background: var(--linen-blush);
    /* Damask pattern */
    background-image:
        radial-gradient(ellipse at 25% 25%, rgba(184, 149, 106, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 75%, rgba(184, 149, 106, 0.04) 0%, transparent 50%);
}

.featured-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.featured-item {
    position: relative;
    background: var(--parchment-cream);
    min-height: 320px;
    perspective: 800px;
    transform-style: preserve-3d;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.featured-item.revealed {
    opacity: 1;
    transform: translateY(0) rotateX(3deg) rotateY(-3deg);
}

.featured-item:hover {
    transform: translateY(-4px) rotateX(0) rotateY(0);
    box-shadow:
        inset 0 0 30px rgba(184, 149, 106, 0.12),
        0 6px 24px rgba(44, 36, 32, 0.1),
        0 12px 48px rgba(44, 36, 32, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-item .frame-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.featured-item .frame-path-inner {
    stroke-dasharray: 1900;
    stroke-dashoffset: 1900;
    transition: stroke-dashoffset 0.8s ease 0.2s;
}

.featured-item.revealed .frame-path {
    stroke-dashoffset: 0;
}

.featured-item.revealed .frame-path-inner {
    stroke-dashoffset: 0;
}

.featured-item:hover .frame-path {
    stroke: var(--burnished-gold);
}

.featured-content {
    position: relative;
    z-index: 1;
    padding: 44px 40px;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

.featured-item.revealed .featured-content {
    opacity: 1;
}

.specimen-number {
    display: block;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--antiqued-brass);
    margin-bottom: 12px;
    opacity: 0.6;
}

.featured-content h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
    color: var(--sumi-ink);
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

.featured-desc {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    color: var(--faded-umber);
    line-height: 1.75;
    margin-bottom: 18px;
}

.specimen-status {
    display: inline-block;
    font-family: 'Courier Prime', monospace;
    font-size: 0.75em;
    color: var(--celadon-mist);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 12px;
    border: 1px solid var(--celadon-mist);
    border-radius: 2px;
}

/* =============================================
   Section 4: Colophon
   ============================================= */
.colophon {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 40px;
    background: var(--parchment-cream);
}

.cartouche {
    position: relative;
    width: min(80vw, 500px);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--linen-blush);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.cartouche-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cartouche-path {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    transition: stroke-dashoffset 1.5s ease;
}

.cartouche.revealed .cartouche-path {
    stroke-dashoffset: 0;
}

.cartouche-inner {
    stroke-dasharray: 1550;
    stroke-dashoffset: 1550;
    transition: stroke-dashoffset 1.5s ease 0.3s;
}

.cartouche.revealed .cartouche-inner {
    stroke-dashoffset: 0;
}

.cartouche-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 50px 40px;
    opacity: 0;
    transition: opacity 0.8s ease 0.8s;
}

.cartouche.revealed .cartouche-content {
    opacity: 1;
}

.cartouche-content h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: 0.04em;
    color: var(--sumi-ink);
    margin-bottom: 28px;
}

.contact-info {
    margin-bottom: 28px;
}

.contact-line {
    margin-bottom: 8px;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
}

/* Animated Link Underline */
.animated-link {
    color: var(--celadon-mist);
    text-decoration: none;
    position: relative;
    background-image: linear-gradient(var(--celadon-mist), var(--celadon-mist));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    transition: background-size 0.3s ease, color 0.3s ease;
}

.animated-link:hover {
    background-size: 100% 1px;
    color: var(--sumi-ink);
}

.colophon-note {
    margin-top: 8px;
}

.code-note {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85em;
    color: var(--faded-umber);
    opacity: 0.6;
    margin-bottom: 4px;
}

.code-note code {
    font-family: inherit;
    background: rgba(58, 53, 85, 0.06);
    padding: 2px 8px;
    border-radius: 2px;
}

/* =============================================
   Responsive (Mobile < 768px)
   ============================================= */
@media (max-width: 768px) {
    .grid-container,
    .featured-container {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 0 8px;
    }

    .vitrine-grid,
    .featured-grid {
        padding: 60px 20px 80px;
        min-height: auto;
    }

    .vitrine-item,
    .featured-item {
        min-height: 220px;
    }

    .vitrine-item.tall {
        grid-row: span 1;
        min-height: 260px;
    }

    .vitrine-item.revealed,
    .featured-item.revealed {
        transform: translateY(0) rotateX(0deg) rotateY(0deg);
    }

    .hero-oval-frame {
        width: 90vw;
        height: 60vw;
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .breathing-space {
        padding: 60px 24px;
        min-height: 70vh;
    }

    .colophon {
        padding: 60px 24px;
        min-height: 60vh;
    }

    .cartouche {
        width: 92vw;
    }

    .cartouche-content {
        padding: 36px 24px;
    }

    .lionfish-ornament {
        display: none;
    }

    /* Simplify frames on mobile */
    .frame-border .frame-path {
        stroke-width: 1;
    }

    .frame-border .frame-path-inner,
    .frame-fleur,
    .frame-corner {
        display: none;
    }

    .scroll-koi {
        display: none;
    }

    .section-header {
        padding: 0 8px;
    }
}

/* =============================================
   Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .hero-oval-frame {
        opacity: 1;
    }

    .hero-title,
    .hero-title.animated,
    .hero-subtitle,
    .betta-fish {
        opacity: 1;
    }

    .hero-title .char {
        opacity: 1;
        transform: none;
    }

    .oval-path,
    .oval-inner {
        stroke-dashoffset: 0;
    }

    .vitrine-item,
    .featured-item,
    .cartouche {
        opacity: 1;
        transform: none;
    }

    .vitrine-content,
    .featured-content,
    .cartouche-content {
        opacity: 1;
    }

    .zen-content,
    .zen-line {
        opacity: 1;
        transform: none;
    }

    .frame-path,
    .frame-path-inner {
        stroke-dashoffset: 0;
    }

    .frame-corner,
    .frame-fleur,
    .lionfish-ornament {
        opacity: 1;
    }

    .filigree-path,
    .filigree-path-glow {
        stroke-dashoffset: 0;
    }

    .cartouche-path,
    .cartouche-inner {
        stroke-dashoffset: 0;
    }

    .kinetic-title .char {
        opacity: 1;
        transform: none;
    }

    .scroll-koi {
        opacity: 0.6;
    }
}
