/* ==========================================================================
   mujun.cafe — Neubrutalist Golden Teahouse
   Design Language: Z-pattern layout, blur-focus transitions, 3D CSS accents
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Color Palette */
    --color-gold: #D4A840;
    --color-parchment: #C0B8A0;
    --color-warm-muted: #8A8070;
    --color-espresso-black: #0C0A06;
    --color-panel-dark: #1A1810;
    --color-scholar-cream: #2A2818;

    /* Typography */
    --font-display: 'Nunito', sans-serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-annotation: 'Caveat', cursive;

    /* Border */
    --border-width: 3px;
    --border-style: solid;
    --border-color: var(--color-gold);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 12px;
    --spacing-md: 24px;
    --spacing-lg: 36px;
    --spacing-xl: 60px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--color-espresso-black);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    color: var(--color-parchment);
    background: var(--color-espresso-black);
    overflow-x: hidden;
    position: relative;
}

/* --- Opening Overlay --- */
#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-espresso-black);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#opening-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.opening-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 8vw, 6rem);
    color: var(--color-gold);
    letter-spacing: 0.15em;
    text-shadow: 0 0 40px rgba(212, 168, 64, 0.4), 0 0 80px rgba(212, 168, 64, 0.15);
    opacity: 0;
    transform: scale(0.9);
    animation: overlayReveal 1.5s ease 0.3s forwards;
}

.title-dot {
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(212, 168, 64, 0.6);
}

@keyframes overlayReveal {
    0% { opacity: 0; transform: scale(0.9); }
    60% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- Scholarly Annotations --- */
.annotation {
    position: fixed;
    z-index: 100;
    max-width: 160px;
    font-family: var(--font-annotation);
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--color-warm-muted);
    background: var(--color-scholar-cream);
    border: 1px solid rgba(212, 168, 64, 0.2);
    padding: 10px 12px;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.6s ease;
    pointer-events: none;
}

.annotation.visible {
    opacity: 1;
    transform: translateY(0);
}

.annotation-left {
    left: 12px;
    transform: translateY(10px);
}

.annotation-right {
    right: 12px;
    transform: translateY(10px);
}

.annotation-1 { top: 15%; }
.annotation-2 { top: 35%; }
.annotation-3 { top: 22%; }
.annotation-4 { top: 50%; }
.annotation-5 { top: 65%; }
.annotation-6 { top: 78%; }

.annotation-marker {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--color-gold);
    margin-bottom: 4px;
    letter-spacing: 0.1em;
}

.annotation p {
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

.annotation em {
    color: var(--color-gold);
    font-style: italic;
}

/* --- Z-Pattern Layout --- */
.z-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 200px 40px;
    min-height: 100vh;
}

/* --- Z-Panel Base --- */
.z-panel {
    position: relative;
    background: var(--color-panel-dark);
    border: var(--border-width) var(--border-style) var(--border-color);
    padding: 0;
    overflow: hidden;
    filter: blur(3px);
    opacity: 0.6;
    transition: filter 1s ease, opacity 1s ease, transform 0.6s ease;
}

.z-panel.in-focus {
    filter: blur(0);
    opacity: 1;
}

.z-panel:hover {
    transform: translateY(-2px);
}

.panel-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: var(--border-width) var(--border-style) var(--border-color);
    pointer-events: none;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.z-panel.in-focus .panel-border {
    opacity: 1;
    transform: scale(1);
}

.panel-content {
    padding: 40px 36px;
    position: relative;
    z-index: 2;
}

/* --- Z-Panel Specific --- */

/* Panel 1 — Hero (top-left) */
.z-panel-1 {
    grid-column: 1;
    grid-row: 1;
    min-height: 50vh;
    display: flex;
    align-items: center;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.2rem, 5vw, 4rem);
    color: var(--color-gold);
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(212, 168, 64, 0.3);
}

.gold-dot {
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(212, 168, 64, 0.6);
}

.hero-subtitle {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: var(--color-warm-muted);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin-top: 12px;
}

.hero-line {
    width: 80px;
    height: 3px;
    background: var(--color-gold);
    margin: 24px 0;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 1.2s ease;
}

.z-panel-1.in-focus .hero-line {
    transform: scaleX(1);
}

.hero-description {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-parchment);
    max-width: 420px;
}

/* Panel 2 — 3D Accent (top-right) */
.z-panel-2 {
    grid-column: 2;
    grid-row: 1;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.z-panel-2 .panel-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* 3D CSS Cup */
.css-3d-cup {
    perspective: 600px;
    width: 200px;
    height: 200px;
    position: relative;
    margin: 0 auto;
}

.cup-body {
    width: 120px;
    height: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) perspective(600px) rotateX(15deg) rotateY(20deg);
    animation: cupRotate 12s ease-in-out infinite;
}

@keyframes cupRotate {
    0% { transform: translate(-50%, -50%) perspective(600px) rotateX(15deg) rotateY(20deg); }
    25% { transform: translate(-50%, -50%) perspective(600px) rotateX(10deg) rotateY(40deg); }
    50% { transform: translate(-50%, -50%) perspective(600px) rotateX(18deg) rotateY(20deg); }
    75% { transform: translate(-50%, -50%) perspective(600px) rotateX(12deg) rotateY(0deg); }
    100% { transform: translate(-50%, -50%) perspective(600px) rotateX(15deg) rotateY(20deg); }
}

.cup-face {
    position: absolute;
    border: 2px solid var(--color-gold);
}

.cup-front {
    width: 120px;
    height: 100px;
    background: rgba(212, 168, 64, 0.08);
    border-color: var(--color-gold);
    transform: translateZ(40px);
}

.cup-back {
    width: 120px;
    height: 100px;
    background: rgba(212, 168, 64, 0.04);
    border-color: rgba(212, 168, 64, 0.5);
    transform: translateZ(-40px);
}

.cup-left {
    width: 80px;
    height: 100px;
    background: rgba(212, 168, 64, 0.06);
    border-color: rgba(212, 168, 64, 0.7);
    transform: rotateY(-90deg) translateZ(0px);
    left: -20px;
}

.cup-right {
    width: 80px;
    height: 100px;
    background: rgba(212, 168, 64, 0.1);
    border-color: var(--color-gold);
    transform: rotateY(90deg) translateZ(120px);
    left: -20px;
}

.cup-top {
    width: 120px;
    height: 80px;
    background: rgba(212, 168, 64, 0.12);
    border-color: var(--color-gold);
    transform: rotateX(90deg) translateZ(0px);
    top: -40px;
}

.cup-bottom {
    width: 120px;
    height: 80px;
    background: rgba(26, 24, 16, 0.9);
    border-color: rgba(212, 168, 64, 0.4);
    transform: rotateX(-90deg) translateZ(100px);
    top: -40px;
}

.cup-handle {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 30px;
    height: 40px;
    border: 3px solid var(--color-gold);
    border-left: none;
    border-radius: 0 50% 50% 0;
    transform: translateY(-50%);
    opacity: 0.7;
}

.cup-steam {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.cup-steam span {
    display: block;
    width: 2px;
    height: 30px;
    background: linear-gradient(to top, rgba(212, 168, 64, 0.3), transparent);
    border-radius: 2px;
    animation: steam 2.5s ease-in-out infinite;
}

.cup-steam span:nth-child(2) {
    animation-delay: 0.4s;
    height: 24px;
}

.cup-steam span:nth-child(3) {
    animation-delay: 0.8s;
    height: 20px;
}

@keyframes steam {
    0% { opacity: 0; transform: translateY(0) scaleY(0.5); }
    30% { opacity: 0.6; }
    60% { opacity: 0.3; transform: translateY(-15px) scaleY(1); }
    100% { opacity: 0; transform: translateY(-30px) scaleY(0.8); }
}

.accent-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--color-warm-muted);
    text-align: center;
    margin-top: 30px;
    text-transform: uppercase;
}

/* Panel 3 — Philosophy (spans full width, diagonal) */
.z-panel-3 {
    grid-column: 1 / -1;
    grid-row: 2;
    background: var(--color-espresso-black);
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--color-gold);
    margin-bottom: 36px;
    letter-spacing: 0.05em;
}

.philosophy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.philosophy-item {
    background: var(--color-panel-dark);
    border: 3px solid var(--color-gold);
    padding: 32px 28px;
    position: relative;
}

.philosophy-item::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    height: 4px;
    background: var(--color-gold);
}

.phi-number {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.5rem;
    color: rgba(212, 168, 64, 0.15);
    line-height: 1;
    margin-bottom: 12px;
}

.philosophy-item h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-gold);
    margin-bottom: 12px;
    letter-spacing: 0.03em;
}

.philosophy-item p {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-parchment);
    line-height: 1.8;
}

/* Panel 4 — Offerings (bottom-left) */
.z-panel-4 {
    grid-column: 1;
    grid-row: 3;
    min-height: 45vh;
}

.offerings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.offering-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(212, 168, 64, 0.15);
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.z-panel-4.in-focus .offering-item {
    opacity: 1;
    transform: translateX(0);
}

.z-panel-4.in-focus .offering-item:nth-child(1) { transition-delay: 0.1s; }
.z-panel-4.in-focus .offering-item:nth-child(2) { transition-delay: 0.2s; }
.z-panel-4.in-focus .offering-item:nth-child(3) { transition-delay: 0.3s; }
.z-panel-4.in-focus .offering-item:nth-child(4) { transition-delay: 0.4s; }
.z-panel-4.in-focus .offering-item:nth-child(5) { transition-delay: 0.5s; }

.offering-item:last-child {
    border-bottom: none;
}

.offering-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-gold);
    white-space: nowrap;
    display: flex;
    gap: 8px;
}

.offering-index {
    font-weight: 800;
    color: rgba(212, 168, 64, 0.4);
}

.offering-line {
    flex: 1;
    border-bottom: 1px dotted rgba(212, 168, 64, 0.3);
    min-width: 30px;
    margin-bottom: 4px;
}

.offering-note {
    font-family: var(--font-annotation);
    font-size: 0.85rem;
    color: var(--color-warm-muted);
    white-space: nowrap;
}

/* Panel 5 — Atmosphere (bottom-right) */
.z-panel-5 {
    grid-column: 2;
    grid-row: 3;
    min-height: 45vh;
}

.atmosphere-text {
    margin-bottom: 40px;
}

.atmosphere-text p {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--color-parchment);
    margin-bottom: 16px;
}

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

/* 3D Geometric Cube */
.atmosphere-3d {
    perspective: 600px;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.geo-cube {
    width: 60px;
    height: 60px;
    position: relative;
    transform-style: preserve-3d;
    transform: perspective(600px) rotateX(15deg) rotateY(20deg);
    animation: geoSpin 20s linear infinite;
    margin: 20px auto;
}

@keyframes geoSpin {
    from { transform: perspective(600px) rotateX(15deg) rotateY(0deg); }
    to { transform: perspective(600px) rotateX(15deg) rotateY(360deg); }
}

.geo-face {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--color-gold);
}

.geo-front { transform: translateZ(30px); background: rgba(212, 168, 64, 0.06); }
.geo-back { transform: translateZ(-30px); background: rgba(212, 168, 64, 0.03); }
.geo-left { transform: rotateY(-90deg) translateZ(30px); background: rgba(212, 168, 64, 0.05); }
.geo-right { transform: rotateY(90deg) translateZ(30px); background: rgba(212, 168, 64, 0.08); }
.geo-top { transform: rotateX(90deg) translateZ(30px); background: rgba(212, 168, 64, 0.1); }
.geo-bottom { transform: rotateX(-90deg) translateZ(30px); background: rgba(26, 24, 16, 0.8); }

/* Footer */
.z-panel-footer {
    grid-column: 1 / -1;
    grid-row: 4;
    min-height: auto;
    background: var(--color-espresso-black);
    border-top: 3px solid var(--color-gold);
    border-left: 3px solid var(--color-gold);
    border-right: 3px solid var(--color-gold);
    border-bottom: 3px solid var(--color-gold);
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 36px;
}

.footer-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-gold);
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.footer-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--color-gold), transparent);
}

.footer-tagline {
    font-family: var(--font-annotation);
    font-size: 1rem;
    color: var(--color-warm-muted);
    white-space: nowrap;
}

/* --- Gold Border Drawing Animation --- */
@keyframes borderDraw {
    0% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
    25% { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); }
    50% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0); }
    75% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}

.z-panel.border-animate {
    animation: borderDraw 1s ease forwards;
}

/* --- Gold Glow Accents --- */
.z-panel::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 1px solid rgba(212, 168, 64, 0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.z-panel.in-focus::after {
    opacity: 1;
    box-shadow: inset 0 0 30px rgba(212, 168, 64, 0.03), 0 0 20px rgba(212, 168, 64, 0.05);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .z-layout {
        padding: 40px 120px 40px;
    }

    .annotation {
        display: none;
    }
}

@media (max-width: 900px) {
    .z-layout {
        grid-template-columns: 1fr;
        padding: 20px 20px 20px;
    }

    .z-panel-1 { grid-column: 1; grid-row: 1; }
    .z-panel-2 { grid-column: 1; grid-row: 2; }
    .z-panel-3 { grid-column: 1; grid-row: 3; }
    .z-panel-4 { grid-column: 1; grid-row: 4; }
    .z-panel-5 { grid-column: 1; grid-row: 5; }
    .z-panel-footer { grid-column: 1; grid-row: 6; }

    .philosophy-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .footer-line {
        width: 100%;
        background: linear-gradient(to right, transparent, var(--color-gold), transparent);
    }

    .offering-item {
        flex-wrap: wrap;
    }

    .offering-line {
        display: none;
    }
}

@media (max-width: 600px) {
    .z-panel-1 { min-height: 40vh; }
    .z-panel-2 { min-height: 35vh; }

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

    .section-heading {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }

    .panel-content {
        padding: 28px 20px;
    }

    .css-3d-cup {
        width: 150px;
        height: 150px;
    }
}
