/* munju.wiki — Candlelit Wiki Styles */
/* Y2K-futurism rendered through artisanal craft */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.75;
    color: #4a3f35;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200,170,120,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(180,150,100,0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(210,180,130,0.03) 0%, transparent 60%),
        #f5ead6;
    overflow-x: hidden;
}

body * {
    text-shadow: 0 0 1px rgba(74, 63, 53, 0.1);
}

a {
    color: #c9a04e;
    text-decoration: none;
}

/* ========== SECTION BASE ========== */
.section {
    min-height: 100vh;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* ========== SECTION 1: COVER ========== */
.section-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(232,200,116,0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 50%, rgba(200,170,120,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(180,150,100,0.04) 0%, transparent 40%),
        #f5ead6;
}

.cover-content {
    text-align: center;
    position: relative;
    padding: 2rem;
}

.cover-flames {
    display: flex;
    justify-content: center;
    gap: 120px;
    margin-bottom: 1rem;
}

.cover-flame {
    filter: drop-shadow(0 0 12px rgba(232, 200, 116, 0.6));
}

.cover-flame .flame-outer {
    animation: flamePath 4s ease-in-out infinite;
}

.cover-flame .flame-mid {
    animation: flamePath 3s ease-in-out infinite 0.3s;
}

.cover-flame .flame-inner {
    animation: flamePath 2s ease-in-out infinite 0.5s;
}

.flame-left {
    animation: flameSwayLeft 4s ease-in-out infinite;
}

.flame-right {
    animation: flameSwayRight 4s ease-in-out infinite;
}

@keyframes flameSwayLeft {
    0%, 100% { transform: rotate(-1deg) scaleY(1); }
    25% { transform: rotate(1deg) scaleY(1.04); }
    50% { transform: rotate(-0.5deg) scaleY(0.96); }
    75% { transform: rotate(0.5deg) scaleY(1.02); }
}

@keyframes flameSwayRight {
    0%, 100% { transform: rotate(1deg) scaleY(1); }
    25% { transform: rotate(-1deg) scaleY(1.03); }
    50% { transform: rotate(0.5deg) scaleY(0.97); }
    75% { transform: rotate(-0.5deg) scaleY(1.01); }
}

@keyframes flamePath {
    0%, 100% { opacity: 0.9; }
    25% { opacity: 1; }
    50% { opacity: 0.85; }
    75% { opacity: 0.95; }
}

.cover-title {
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(3rem, 8vw, 6rem);
    color: #5c4632;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(201, 160, 78, 0.3);
}

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

.doodle-star.star-1 {
    position: absolute;
    top: 10%;
    left: 15%;
    transform: rotate(12deg);
    animation: twinkle 3s ease-in-out infinite;
}

.doodle-star.star-2 {
    position: absolute;
    top: 20%;
    right: 12%;
    transform: rotate(-8deg);
    animation: twinkle 3.5s ease-in-out infinite 0.5s;
}

.doodle-moon {
    position: absolute;
    bottom: 25%;
    right: 8%;
    transform: rotate(5deg);
    animation: twinkle 4s ease-in-out infinite 1s;
}

.doodle-spiral {
    position: absolute;
    bottom: 20%;
    left: 10%;
    transform: rotate(-3deg);
    animation: twinkle 3.8s ease-in-out infinite 0.3s;
}

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

.cover-invitation {
    font-family: 'Indie Flower', cursive;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: #8b7355;
    max-width: 500px;
    margin: 1.5rem auto 2rem;
    line-height: 1.8;
}

.cover-scroll-hint {
    animation: bobDown 2s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ========== SECTION DIVIDERS ========== */
.section-divider {
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.section-divider svg {
    width: 100%;
    max-width: 600px;
    height: 20px;
}

.divider-flames, .divider-stars {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
}

.tiny-flame {
    animation: flicker 3s ease-in-out infinite;
}

.tiny-flame:nth-child(2) {
    animation-delay: 0.5s;
}

.tiny-flame:nth-child(3) {
    animation-delay: 1s;
}

@keyframes flicker {
    0%, 100% { transform: scaleY(1) rotate(-1deg); opacity: 0.9; }
    25% { transform: scaleY(1.04) rotate(1deg); opacity: 1; }
    50% { transform: scaleY(0.96) rotate(-0.5deg); opacity: 0.85; }
    75% { transform: scaleY(1.02) rotate(0.5deg); opacity: 0.95; }
}

.tiny-star {
    animation: twinkle 2.5s ease-in-out infinite;
}

.tiny-star:nth-child(2) { animation-delay: 0.3s; }
.tiny-star:nth-child(3) { animation-delay: 0.6s; }
.tiny-star:nth-child(4) { animation-delay: 0.9s; }
.tiny-star:nth-child(5) { animation-delay: 1.2s; }

/* ========== SECTION 2: INDEX ========== */
.section-index {
    padding: 4rem 2rem;
    min-height: auto;
}

.section-heading {
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(2rem, 5.5vw, 4.2rem);
    color: #5c4632;
    letter-spacing: 0.02em;
    text-align: center;
    margin-bottom: 3rem;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    min-height: 600px;
}

/* Wobbly border SVG backgrounds */
.topic-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    box-shadow: 2px 3px 12px rgba(46, 36, 24, 0.15);
    background: #f5ead6;
    border-image-source: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect x='2' y='2' width='96' height='96' fill='none' stroke='%23b8976a' stroke-width='2' rx='2' style='stroke-dasharray:none' /%3E%3C/svg%3E");
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='4'%3E%3Cpath d='M0,2 C50,0 100,4 150,2 C200,0 250,3 300,1' fill='none' stroke='%23b8976a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='4'%3E%3Cpath d='M0,2 C50,4 100,0 150,2 C200,4 250,1 300,3' fill='none' stroke='%23b8976a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='200'%3E%3Cpath d='M2,0 C0,40 4,80 2,120 C0,160 3,200 2,200' fill='none' stroke='%23b8976a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='200'%3E%3Cpath d='M2,0 C4,40 0,80 2,120 C4,160 1,200 2,200' fill='none' stroke='%23b8976a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-position: top left, bottom left, left top, right top;
    background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
    background-size: 300px 4px, 300px 4px, 4px 200px, 4px 200px;
    border: none;
    padding: 1.5rem;
}

.topic-card:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 24px rgba(201, 160, 78, 0.4);
    z-index: 10;
}

.card-1 {
    grid-column: 1 / 6;
    grid-row: 1;
    transform: rotate(-2deg);
    z-index: 3;
}

.card-2 {
    grid-column: 5 / 10;
    grid-row: 1;
    transform: rotate(1.5deg);
    z-index: 4;
    margin-top: 30px;
}

.card-3 {
    grid-column: 8 / 13;
    grid-row: 1 / 3;
    transform: rotate(-1deg);
    z-index: 2;
    margin-top: 60px;
}

.card-4 {
    grid-column: 2 / 7;
    grid-row: 2;
    transform: rotate(2.5deg);
    z-index: 5;
    margin-top: -20px;
}

.card-5 {
    grid-column: 6 / 11;
    grid-row: 2 / 3;
    transform: rotate(-2.5deg);
    z-index: 1;
    margin-top: 20px;
}

.card-1:hover { transform: rotate(-2deg) scale(1.06); }
.card-2:hover { transform: rotate(1.5deg) scale(1.06); }
.card-3:hover { transform: rotate(-1deg) scale(1.06); }
.card-4:hover { transform: rotate(2.5deg) scale(1.06); }
.card-5:hover { transform: rotate(-2.5deg) scale(1.06); }

.card-inner {
    position: relative;
}

.card-icon {
    margin-bottom: 0.5rem;
}

.topic-card h3 {
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: #5c4632;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.topic-card p {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    color: #4a3f35;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.card-label {
    font-family: 'Satisfy', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    color: #a0845c;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card-label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 12px;
    background: #c9a04e;
    clip-path: polygon(50% 0%, 20% 40%, 30% 100%, 70% 100%, 80% 40%);
}

/* ========== SECTION 3: FEATURED ========== */
.section-featured {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.featured-content {
    max-width: 1100px;
    position: relative;
    width: 100%;
}

.featured-article {
    max-width: 580px;
    margin: 0 auto;
}

.featured-title {
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    color: #5c4632;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    text-align: center;
}

.featured-meta {
    font-family: 'Satisfy', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    color: #a0845c;
    text-align: center;
    margin-bottom: 2rem;
}

.featured-body p {
    margin-bottom: 1.5rem;
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.75;
    color: #4a3f35;
}

.featured-body p:first-child::first-letter {
    font-family: 'Caveat Brush', cursive;
    font-size: 3em;
    float: left;
    line-height: 0.8;
    margin-right: 0.1em;
    color: #c9a04e;
}

/* Margin notes */
.featured-margin-note {
    position: absolute;
    width: 180px;
    font-family: 'Indie Flower', cursive;
    font-size: clamp(0.8rem, 1.6vw, 0.95rem);
    color: #8b7355;
    line-height: 1.5;
    padding: 0.75rem;
    background: rgba(245, 234, 214, 0.7);
    border-left: 2px solid #b8976a;
}

.note-icon {
    display: block;
    margin-bottom: 0.3rem;
}

.note-left {
    left: 0;
}

.note-right {
    right: 0;
}

.note-1 {
    top: 5%;
    transform: rotate(-1.5deg);
}

.note-2 {
    top: 35%;
    transform: rotate(1deg);
}

.note-3 {
    top: 65%;
    transform: rotate(-0.5deg);
}

/* ========== SECTION 4: CONTRIBUTORS ========== */
.section-contributors {
    padding: 4rem 2rem;
    min-height: auto;
}

.contributors-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.contributor-stamp {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.contributor-stamp:hover {
    transform: scale(1.06);
}

.stamp-avatar {
    width: 80px;
    height: 80px;
    border-radius: 47% 53% 46% 54% / 50% 48% 52% 50%;
    background: #a0845c;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    transition: background 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 2px 8px rgba(46, 36, 24, 0.2);
}

.contributor-stamp:hover .stamp-avatar {
    background: #c9a04e;
    box-shadow: 0 4px 24px rgba(201, 160, 78, 0.4);
}

.stamp-avatar svg {
    width: 50px;
    height: 50px;
}

.stamp-avatar svg circle,
.stamp-avatar svg path {
    stroke: #f5ead6;
}

.stamp-name {
    font-family: 'Patrick Hand', cursive;
    font-size: 1rem;
    color: #5c4632;
    text-align: center;
}

.stamp-role {
    font-family: 'Indie Flower', cursive;
    font-size: 0.85rem;
    color: #8b7355;
    text-align: center;
}

/* Stamp offsets for broken-grid feel */
.stamp-1 { transform: translateY(0) rotate(-1deg); }
.stamp-2 { transform: translateY(12px) rotate(1.5deg); }
.stamp-3 { transform: translateY(-8px) rotate(-0.5deg); }
.stamp-4 { transform: translateY(16px) rotate(2deg); }
.stamp-5 { transform: translateY(-4px) rotate(-1.5deg); }
.stamp-6 { transform: translateY(10px) rotate(0.5deg); }
.stamp-7 { transform: translateY(-12px) rotate(-2deg); }
.stamp-8 { transform: translateY(6px) rotate(1deg); }

.stamp-1:hover { transform: translateY(0) rotate(-1deg) scale(1.06); }
.stamp-2:hover { transform: translateY(12px) rotate(1.5deg) scale(1.06); }
.stamp-3:hover { transform: translateY(-8px) rotate(-0.5deg) scale(1.06); }
.stamp-4:hover { transform: translateY(16px) rotate(2deg) scale(1.06); }
.stamp-5:hover { transform: translateY(-4px) rotate(-1.5deg) scale(1.06); }
.stamp-6:hover { transform: translateY(10px) rotate(0.5deg) scale(1.06); }
.stamp-7:hover { transform: translateY(-12px) rotate(-2deg) scale(1.06); }
.stamp-8:hover { transform: translateY(6px) rotate(1deg) scale(1.06); }

/* ========== SECTION 5: CLOSING ========== */
.section-closing {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(232,200,116,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(46, 36, 24, 0.3) 60%, rgba(46, 36, 24, 0.8) 100%),
        #2e2418;
    min-height: 100vh;
}

.closing-content {
    text-align: center;
    position: relative;
}

/* Candle Assembly */
.candle-assembly {
    position: relative;
    width: 60px;
    height: 220px;
    margin: 0 auto 2rem;
}

.candle-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,200,116,0.25) 0%, rgba(212,162,106,0.1) 40%, transparent 70%);
    animation: glowPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.candle-flame-wrapper {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
}

.flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform-origin: bottom center;
}

.flame-layer-outer {
    width: 28px;
    height: 44px;
    background: radial-gradient(ellipse at 50% 90%, #e8c874 0%, rgba(232,200,116,0.3) 60%, transparent 100%);
    transform: translateX(-50%);
    filter: blur(3px);
    animation: flicker 4s ease-in-out infinite;
}

.flame-layer-mid {
    width: 20px;
    height: 36px;
    background: radial-gradient(ellipse at 50% 85%, #d4a26a 0%, rgba(212,162,106,0.5) 70%, transparent 100%);
    transform: translateX(-50%);
    animation: flicker 3s ease-in-out infinite 0.3s;
}

.flame-layer-inner {
    width: 10px;
    height: 24px;
    background: radial-gradient(ellipse at 50% 80%, #f5ead6 0%, rgba(245,234,214,0.4) 70%, transparent 100%);
    transform: translateX(-50%);
    animation: flicker 2s ease-in-out infinite 0.5s;
}

.candle-wick {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: #4a3f35;
    border-radius: 1px;
}

.candle-body {
    position: absolute;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 120px;
    background: linear-gradient(180deg, #f5ead6 0%, #e8c874 30%, #d4a26a 100%);
    border-radius: 4px 4px 2px 2px;
    box-shadow: inset 0 0 8px rgba(46, 36, 24, 0.15);
    position: relative;
    top: 65px;
}

.candle-drip {
    position: absolute;
    background: #f5ead6;
    border-radius: 0 0 50% 50%;
}

.drip-1 {
    top: -2px;
    left: 5px;
    width: 8px;
    height: 16px;
}

.drip-2 {
    top: -1px;
    right: 6px;
    width: 6px;
    height: 12px;
}

.candle-holder {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 16px;
    background: #b8976a;
    border-radius: 4px 4px 8px 8px;
    box-shadow: 0 4px 12px rgba(46, 36, 24, 0.4);
}

.closing-text {
    font-family: 'Indie Flower', cursive;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: #d4a26a;
    max-width: 440px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

.closing-seal {
    width: 60px;
    height: 60px;
    border-radius: 47% 53% 46% 54% / 50% 48% 52% 50%;
    background: #a0845c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 2px 12px rgba(46, 36, 24, 0.4);
}

.closing-seal:hover {
    transform: scale(1.06);
    background: #c9a04e;
    box-shadow: 0 4px 24px rgba(201, 160, 78, 0.5);
}

.closing-seal span {
    font-family: 'Satisfy', cursive;
    font-size: 1.2rem;
    color: #f5ead6;
    text-shadow: 0 1px 2px rgba(46, 36, 24, 0.4);
}

/* ========== NAV CLUSTER ========== */
.nav-cluster {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.nav-icon {
    width: 44px;
    height: 44px;
    border-radius: 47% 53% 46% 54% / 50% 48% 52% 50%;
    background: rgba(245, 234, 214, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(46, 36, 24, 0.2);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, background 0.4s ease;
    position: relative;
}

.nav-icon:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 24px rgba(201, 160, 78, 0.4);
    background: rgba(245, 234, 214, 1);
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

/* Tooltip */
.nav-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Satisfy', cursive;
    font-size: 0.9rem;
    color: #a0845c;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    background: rgba(245, 234, 214, 0.95);
    padding: 4px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(46, 36, 24, 0.15);
}

.nav-icon:hover::before {
    opacity: 1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .index-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        min-height: auto;
    }

    .topic-card {
        transform: none !important;
        margin-top: 0 !important;
    }

    .topic-card:hover {
        transform: scale(1.03) !important;
    }

    .featured-margin-note {
        position: relative;
        width: 100%;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        margin: 1rem 0;
    }

    .cover-flames {
        gap: 60px;
    }

    .contributors-grid {
        gap: 1.5rem;
    }

    .contributor-stamp {
        transform: none !important;
    }

    .contributor-stamp:hover {
        transform: scale(1.06) !important;
    }

    .nav-cluster {
        bottom: 16px;
        right: 16px;
        gap: 8px;
    }

    .nav-icon {
        width: 38px;
        height: 38px;
    }
}
