/* ============================================
   mujun.quest — Sci-Fi Hexagonal Expedition Map
   ============================================ */

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

:root {
    --deep-teal: #1A2A30;
    --medium-teal: #3A4A50;
    --sage: #5A8A70;
    --coastal-cream: #F4F6F2;
    --tide-pool-blue: #8AAAB0;
    --watercolor-wash: #B0C8C0;
    --mountain-grey: #5A7080;
    --sunset-peak: #D0A070;

    --font-display: 'Exo 2', sans-serif;
    --font-body: 'Nunito Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.8;
    color: var(--medium-teal);
    background-color: var(--coastal-cream);
    overflow-x: hidden;
    position: relative;
}

/* --- Watercolor Background Layer --- */
.watercolor-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(176, 200, 192, 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 80% 70%, rgba(138, 170, 176, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 90% 50% at 50% 90%, rgba(90, 138, 112, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 40% 40% at 70% 20%, rgba(208, 160, 112, 0.05) 0%, transparent 50%);
}

.watercolor-bg.active {
    opacity: 1;
}

/* --- Mountain Silhouettes --- */
.mountain-silhouette {
    display: block;
    width: 100%;
    position: relative;
    z-index: 1;
}

.mountain-silhouette--top {
    height: 120px;
    margin-bottom: -60px;
    opacity: 0;
    transition: opacity 1.2s ease 0.6s;
}

.mountain-silhouette--top.active {
    opacity: 1;
}

.mountain-silhouette--divider,
.mountain-silhouette--divider2 {
    height: 80px;
    margin: -20px 0;
}

.mountain-silhouette--bottom {
    height: 140px;
    margin-top: -40px;
}

/* --- Section Titles --- */
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    color: var(--deep-teal);
    text-align: center;
    margin-bottom: 3rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--tide-pool-blue);
    margin: 0.8rem auto 0;
}

/* --- Hex Cell Base --- */
.hex-cell {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--coastal-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    opacity: 0;
    transform: scale(0.7) translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Watercolor wash overlay inside hex cells */
.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, rgba(138, 170, 176, 0.15), rgba(176, 200, 192, 0.08));
    z-index: 0;
    transition: background 0.3s ease;
}

.hex-cell:hover::before {
    background: linear-gradient(135deg, rgba(138, 170, 176, 0.30), rgba(176, 200, 192, 0.18));
}

.hex-cell__content {
    position: relative;
    z-index: 1;
    padding: 2rem 1.5rem;
}

/* --- Hex Cell Border (tide pool blue, SVG-based) --- */
.hex-cell__border {
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease 0.3s;
}

/* Use box-shadow inset trick for visible border on hex */
.hex-cell__border::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: inset 0 0 0 2px var(--tide-pool-blue);
}

.hex-cell.visible .hex-cell__border {
    opacity: 1;
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    z-index: 2;
}

.hero__hex-container {
    margin-bottom: 3rem;
}

.hex-cell--hero {
    width: 340px;
    height: 370px;
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(176, 200, 192, 0.3) 100%);
}

.hex-cell--hero .hex-cell__content {
    padding: 3rem 2rem;
}

.hero__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    color: var(--deep-teal);
    letter-spacing: 0.12em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.hero__subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--mountain-grey);
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

/* --- Hero Stats --- */
.hero__stats {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.hex-cell--stat {
    width: 180px;
    height: 196px;
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(90, 138, 112, 0.1) 100%);
}

.hex-cell--stat .counter {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--sage);
    display: block;
    margin-bottom: 0.3rem;
}

.hex-cell--stat .counter-label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--mountain-grey);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: block;
}

/* --- Quest Grid Section --- */
.quest-grid-section {
    padding: 5rem 2rem;
    position: relative;
    z-index: 2;
}

/* --- Hex Grid --- */
.hex-grid {
    display: grid;
    grid-template-columns: repeat(4, 240px);
    gap: 4px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    justify-content: center;
}

/* Offset odd rows for honeycomb effect */
.hex-grid .hex-cell--biome:nth-child(n+5) {
    margin-top: -30px;
}

.hex-grid .hex-cell--biome:nth-child(5),
.hex-grid .hex-cell--biome:nth-child(6),
.hex-grid .hex-cell--biome:nth-child(7) {
    grid-column: span 1;
}

.hex-cell--biome {
    width: 240px;
    height: 262px;
    flex-shrink: 0;
}

.hex-cell--biome .hex-cell__content {
    padding: 2.5rem 1.5rem 2rem;
}

.hex-cell__icon {
    margin-bottom: 0.5rem;
}

.hex-cell__icon svg {
    display: block;
    margin: 0 auto;
}

.hex-cell__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--deep-teal);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.hex-cell__desc {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--medium-teal);
    margin-bottom: 0.5rem;
}

.counter--small {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--sage);
    display: block;
}

.counter-label {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.62rem;
    color: var(--mountain-grey);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: block;
}

/* --- Biome Accent Colors --- */
.hex-cell--tidepool {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(138, 170, 176, 0.15) 100%);
}

.hex-cell--sage {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(90, 138, 112, 0.15) 100%);
}

.hex-cell--deep {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(26, 42, 48, 0.08) 100%);
}

.hex-cell--sunset {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(208, 160, 112, 0.15) 100%);
}

.hex-cell--wash {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(176, 200, 192, 0.20) 100%);
}

.hex-cell--coastal {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(58, 74, 80, 0.08) 100%);
}

.hex-cell--mountain {
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(90, 112, 128, 0.12) 100%);
}

/* --- Expedition Log Section --- */
.expedition-section {
    padding: 5rem 2rem;
    position: relative;
    z-index: 2;
}

.hex-grid--log {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 1000px;
    margin: 0 auto;
}

.hex-cell--log {
    width: 300px;
    height: 328px;
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(176, 200, 192, 0.12) 100%);
}

.hex-cell--log .hex-cell__content {
    padding: 3rem 2rem 2rem;
}

.log-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--tide-pool-blue);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.5rem;
}

.hex-cell--log .hex-cell__title {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.hex-cell--log .hex-cell__desc {
    font-size: 0.7rem;
    margin-bottom: 0.8rem;
}

.log-stats {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
}

.log-stats .counter--small {
    font-size: 1.2rem;
}

.log-stats .counter-label {
    font-size: 0.6rem;
}

/* --- Dashboard Section --- */
.dashboard-section {
    padding: 5rem 2rem;
    position: relative;
    z-index: 2;
}

.hex-grid--dashboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 900px;
    margin: 0 auto;
}

.hex-cell--dashboard {
    width: 200px;
    height: 218px;
    background: linear-gradient(160deg, var(--coastal-cream) 0%, rgba(90, 138, 112, 0.12) 100%);
}

.counter--large {
    font-family: var(--font-mono);
    font-size: 2.4rem;
    font-weight: 400;
    color: var(--sage);
    display: block;
    margin-bottom: 0.3rem;
}

.hex-cell--dashboard .counter-label {
    font-size: 0.68rem;
}

/* --- Footer --- */
.footer {
    padding: 4rem 2rem 3rem;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
}

.footer__hex-container {
    display: flex;
    justify-content: center;
}

.hex-cell--footer {
    width: 300px;
    height: 328px;
    background: linear-gradient(160deg, rgba(26, 42, 48, 0.04) 0%, rgba(138, 170, 176, 0.10) 100%);
}

.footer__text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--deep-teal);
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.footer__coord {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--mountain-grey);
}

.footer__coord .counter {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--sage);
}

/* --- Hover Effects --- */
.hex-cell--biome:hover,
.hex-cell--log:hover,
.hex-cell--dashboard:hover {
    transform: scale(1.05) translateY(-4px);
    z-index: 10;
    transition: opacity 0.6s ease, transform 0.3s ease;
}

.hex-cell--biome:hover .hex-cell__title,
.hex-cell--log:hover .hex-cell__title {
    color: var(--sage);
    transition: color 0.3s ease;
}

/* --- Hero Pulse Glow --- */
@keyframes heroPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(138, 170, 176, 0.15)); }
    50% { filter: drop-shadow(0 0 14px rgba(138, 170, 176, 0.4)); }
}

.hex-cell--hero.visible {
    animation: heroPulse 3s ease-in-out infinite;
    animation-delay: 1s;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .hex-grid {
        grid-template-columns: repeat(3, 240px);
    }

    .hex-grid .hex-cell--biome:nth-child(n+4) {
        margin-top: -30px;
    }
}

@media (max-width: 900px) {
    .hex-grid {
        grid-template-columns: repeat(2, 200px);
    }

    .hero__stats {
        gap: 4px;
    }

    .hex-cell--hero {
        width: 280px;
        height: 306px;
    }

    .hex-cell--stat {
        width: 150px;
        height: 164px;
    }

    .hex-cell--stat .counter {
        font-size: 1.4rem;
    }

    .hex-cell--biome {
        width: 200px;
        height: 218px;
    }

    .hex-cell--biome .hex-cell__content {
        padding: 2rem 1.2rem 1.5rem;
    }

    .hex-cell--biome .hex-cell__desc {
        display: none;
    }

    .hex-cell--log {
        width: 260px;
        height: 284px;
    }

    .hex-cell--dashboard {
        width: 160px;
        height: 175px;
    }

    .counter--large {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .hex-grid {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .hex-grid .hex-cell--biome:nth-child(n+5),
    .hex-grid .hex-cell--biome:nth-child(even) {
        margin-top: 0;
    }

    .hex-cell--hero {
        width: 260px;
        height: 284px;
    }

    .hero__title {
        font-size: 1.8rem;
    }

    .hex-cell--stat {
        width: 140px;
        height: 153px;
    }

    .hex-cell--biome {
        width: 220px;
        height: 240px;
    }

    .hex-cell--biome .hex-cell__desc {
        display: block;
        font-size: 0.65rem;
    }

    .hex-cell--log {
        width: 260px;
        height: 284px;
    }

    .hex-cell--log .hex-cell__desc {
        font-size: 0.65rem;
    }

    .hex-cell--dashboard {
        width: 180px;
        height: 196px;
    }

    .hex-cell--footer {
        width: 260px;
        height: 284px;
    }

    .section-title {
        font-size: 1.3rem;
    }
}
