/* munju.wiki - Mid-century Knowledge Salon */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #F4EDE4;
    color: #3A2A1C;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    letter-spacing: 0.005em;
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== Perspective Container ===== */
#perspective-container {
    perspective: 1200px;
    position: relative;
    min-height: 200vh;
}

/* ===== Network Constellation ===== */
#network-constellation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#network-constellation.visible {
    opacity: 1;
}

#network-constellation circle {
    fill: #B8916A;
    opacity: 0.15;
}

#network-constellation path {
    stroke: #B8916A;
    stroke-width: 1;
    fill: none;
    opacity: 0.08;
}

@keyframes constellationRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Gate Layer ===== */
#gate-layer {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 12vh 2rem;
    transform-style: preserve-3d;
}

.gate-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 900px;
    position: relative;
}

.gate-pillar {
    width: 8px;
    height: 60vh;
    flex-shrink: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
    transform-origin: bottom center;
}

.gate-pillar.tilted-left {
    transform: rotateZ(-3deg);
    opacity: 0.2;
}

.gate-pillar.tilted-right {
    transform: rotateZ(3deg);
    opacity: 0.2;
}

.gate-text {
    text-align: center;
    padding: 0 clamp(2rem, 8vw, 6rem);
    flex: 1;
    max-width: 680px;
}

.site-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #3A2A1C;
    margin-bottom: 1.5rem;
}

.gate-question {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: #7A6B5D;
    line-height: 1.6;
}

/* ===== Scroll Chevron ===== */
.scroll-chevron {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
}

.chevron-icon {
    display: block;
    width: 24px;
    height: 24px;
    border-right: 2px solid #C47D3B;
    border-bottom: 2px solid #C47D3B;
    transform: rotate(45deg);
    animation: chevronPulse 2s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== Index Layer ===== */
#index-layer {
    position: relative;
    z-index: 1;
    padding: 8vh 2rem 12vh;
    transform-style: preserve-3d;
    transform: translateZ(-20px);
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    max-width: 780px;
    margin: 0 auto;
}

/* Stagger cards vertically */
.knowledge-card:nth-child(even) {
    margin-top: 40px;
}

/* ===== Knowledge Cards ===== */
.knowledge-card {
    position: relative;
    background: #EAE0D2;
    border: 2px solid #B8916A;
    border-radius: 12px;
    padding: 2rem 1.75rem;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease,
                opacity 0.4s ease,
                filter 0.4s ease;
    box-shadow: 0 8px 32px rgba(58, 42, 28, 0.12);
    opacity: 0;
    transform: translateY(40px);
}

.knowledge-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.knowledge-card.receded {
    transform: scale(0.92);
    filter: blur(4px);
    opacity: 0.5;
}

.knowledge-card:hover {
    box-shadow: 0 12px 40px rgba(58, 42, 28, 0.2);
    transform: translateY(-4px);
}

.knowledge-card.visible:hover {
    transform: translateY(-4px);
}

/* Card Fold (dog-ear) */
.card-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    overflow: hidden;
    transition: width 0.2s ease, height 0.2s ease;
}

.card-fold::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 16px 16px 0;
    border-color: transparent #F4EDE4 transparent transparent;
    border-top-right-radius: 12px;
}

.card-fold::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 16px 0 0 16px;
    border-color: transparent transparent transparent #C47D3B;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.knowledge-card:hover .card-fold {
    width: 24px;
    height: 24px;
}

.knowledge-card:hover .card-fold::before {
    border-width: 0 24px 24px 0;
}

.knowledge-card:hover .card-fold::after {
    border-width: 24px 0 0 24px;
    opacity: 0.6;
}

.card-category {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A6B5D;
    display: block;
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #3A2A1C;
    margin-bottom: 0.75rem;
}

.card-teaser {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #7A6B5D;
}

.card-expanded-content {
    display: none;
}

/* ===== Section Divider ===== */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 2rem 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 1px;
    background: #C47D3B;
    opacity: 0.3;
}

.section-divider span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #C47D3B;
    position: relative;
    z-index: 1;
}

/* ===== Focus Overlay ===== */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(58, 42, 28, 0);
    transition: background 0.5s ease;
    pointer-events: none;
}

.focus-overlay.active {
    background: rgba(58, 42, 28, 0.3);
    pointer-events: all;
}

.focus-overlay.hidden {
    display: none;
}

.focus-card {
    background: #EAE0D2;
    border: 2px solid #B8916A;
    border-radius: 12px;
    width: calc(100vw - 4vw);
    height: calc(100vh - 4vh);
    max-width: 900px;
    max-height: 90vh;
    padding: 48px;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.5s ease;
}

.focus-overlay.active .focus-card {
    transform: scale(1);
    opacity: 1;
}

.focus-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #B8916A;
    color: #F4EDE4;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.focus-close:hover {
    background: #C47D3B;
}

.focus-content .card-category {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A6B5D;
    margin-bottom: 1rem;
}

.focus-content .card-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #3A2A1C;
    margin-bottom: 1.5rem;
}

.focus-content .card-teaser {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #7A6B5D;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.focus-content p {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.72;
    color: #3A2A1C;
    margin-bottom: 1.25rem;
}

.focus-content .section-divider {
    margin: 2rem 0;
}

/* ===== Deep Map ===== */
.deep-map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 200;
    background: #F4EDE4;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.deep-map.active {
    opacity: 1;
    pointer-events: all;
}

.deep-map.hidden {
    display: none;
}

.deep-map-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #B8916A;
    color: #F4EDE4;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 201;
    transition: background 0.2s ease;
    line-height: 1;
}

.deep-map-close:hover {
    background: #C47D3B;
}

.deep-map-svg {
    width: 90vw;
    height: 90vh;
}

.deep-map-svg circle {
    fill: #B8916A;
    cursor: pointer;
    transition: opacity 0.3s ease, r 0.3s ease;
}

.deep-map-svg circle:hover {
    opacity: 1 !important;
}

.deep-map-svg path {
    stroke: #B8916A;
    stroke-width: 1;
    fill: none;
    opacity: 0.2;
}

.deep-map-svg text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    fill: #3A2A1C;
    text-anchor: middle;
    pointer-events: none;
}

/* ===== Radial Navigation ===== */
.radial-nav {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 300;
}

.radial-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #B8916A;
    border: none;
    color: #F4EDE4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(58, 42, 28, 0.2);
}

.radial-trigger:hover {
    background: #C47D3B;
    transform: scale(1.1);
}

.radial-icon {
    font-size: 1rem;
    line-height: 1;
}

.radial-menu {
    position: absolute;
    bottom: 52px;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.radial-item {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #3A2A1C;
    background: #EAE0D2;
    border: 1px solid #B8916A;
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
    display: inline-block;
    text-align: center;
}

.radial-item:hover {
    background: #C47D3B;
    color: #F4EDE4;
}


/* ===== Additional Accent Colors ===== */
a:visited, .visited-link {
    color: #6B2D2D;
}

.knowledge-card:active .card-title {
    color: #6B2D2D;
}

.card-category::before {
    color: #8B9E7A;
}

.knowledge-card:hover .card-category {
    color: #8B9E7A;
}

.radial-trigger:active {
    background: #6B2D2D;
}

.deep-map-svg circle:hover {
    fill: #8B9E7A;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .gate-content {
        max-width: 100%;
    }

    .gate-pillar {
        height: 40vh;
    }

    .gate-text {
        padding: 0 1.5rem;
    }

    .index-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .knowledge-card:nth-child(even) {
        margin-top: 0;
    }

    .focus-card {
        padding: 32px 24px;
        width: calc(100vw - 2vw);
        height: calc(100vh - 2vh);
    }

    .radial-nav {
        bottom: 16px;
        left: 16px;
    }
}

@media (max-width: 480px) {
    .gate-pillar {
        height: 30vh;
    }

    .gate-text {
        padding: 0 0.75rem;
    }

    .site-title {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
    }

    .focus-card {
        padding: 24px 16px;
    }
}
