/* ============================================
   namu.quest — Art-Deco Treasure Map
   Colors: #3A2810, #5A4830, #6A5838, #8A6830,
           #B08840, #C8A860, #F4EDE0, #FBF6EE
   Fonts: Playfair Display, Lora, Josefin Sans
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.85;
    color: #5A4830;
    background-color: #F4EDE0;
    overflow-x: hidden;
}

/* Subtle parchment texture via noise gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(58,40,16,0.03) 2px,
            rgba(58,40,16,0.03) 4px
        );
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #3A2810;
    font-weight: 700;
}

h2 {
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    color: #3A2810;
    margin-bottom: 0.5rem;
}

.quest-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #B08840;
    display: block;
    margin-bottom: 1rem;
}

.quest-label--small {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
}

/* --- Lens Flare --- */
.lens-flare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
    z-index: 0;
}

#lens-flare-hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, rgba(200,170,100,0.15), transparent 60%);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease;
}

.lens-flare--section {
    background: radial-gradient(circle at 25% 25%, rgba(200,170,100,0.12), transparent 55%);
}

.lens-flare--right {
    background: radial-gradient(circle at 75% 30%, rgba(200,170,100,0.12), transparent 55%);
}

.lens-flare--visible {
    opacity: 1;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8vw;
}

.hero-ornament {
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: heroOrnamentIn 0.8s ease forwards 0.2s;
}

@keyframes heroOrnamentIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 0.7;
        transform: scale(1);
    }
}

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.15em;
    color: #3A2810;
    text-align: center;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    animation: heroTitleIn 1.2s ease forwards 0.3s;
}

@keyframes heroTitleIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-underline {
    width: 0;
    height: 3px;
    background-color: #B08840;
    margin: 1.5rem auto;
    animation: heroUnderlineDraw 0.8s ease forwards 1s;
}

@keyframes heroUnderlineDraw {
    to {
        width: min(400px, 60vw);
    }
}

.hero-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #8A6830;
    text-align: center;
    opacity: 0;
    animation: heroSubIn 1s ease forwards 1.6s;
    position: relative;
    z-index: 2;
}

@keyframes heroSubIn {
    to {
        opacity: 1;
    }
}

.hero-bottom-ornament {
    text-align: center;
    margin-top: 2rem;
    opacity: 0;
    animation: heroSubIn 1s ease forwards 2s;
}

/* --- Deco Frame (corner ornaments) --- */
.deco-frame {
    position: relative;
    padding: clamp(2rem, 5vw, 4rem);
    display: inline-block;
}

.deco-corner {
    position: absolute;
    width: 40px;
    height: 40px;
}

.deco-corner::before,
.deco-corner::after {
    content: '';
    position: absolute;
    background-color: #6A5838;
}

.deco-corner::before {
    width: 100%;
    height: 2px;
}

.deco-corner::after {
    width: 2px;
    height: 100%;
}

/* Position each corner */
.deco-corner--tl { top: 0; left: 0; }
.deco-corner--tl::before { top: 0; left: 0; width: 40px; }
.deco-corner--tl::after { top: 0; left: 0; height: 40px; }

.deco-corner--tr { top: 0; right: 0; }
.deco-corner--tr::before { top: 0; right: 0; width: 40px; left: auto; }
.deco-corner--tr::after { top: 0; right: 0; height: 40px; left: auto; }

.deco-corner--bl { bottom: 0; left: 0; }
.deco-corner--bl::before { bottom: 0; left: 0; width: 40px; top: auto; }
.deco-corner--bl::after { bottom: 0; left: 0; height: 40px; top: auto; }

.deco-corner--br { bottom: 0; right: 0; }
.deco-corner--br::before { bottom: 0; right: 0; width: 40px; top: auto; left: auto; }
.deco-corner--br::after { bottom: 0; right: 0; height: 40px; top: auto; left: auto; }

/* Hero deco frame corners animate in */
#hero .deco-corner {
    opacity: 0;
    animation: cornerFadeIn 0.6s ease forwards 0.6s;
}

@keyframes cornerFadeIn {
    to { opacity: 1; }
}

/* --- Chevron Dividers --- */
.chevron-divider {
    width: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
    text-align: center;
    padding: 1rem 0;
}

.chevron-divider svg {
    width: 100%;
    max-width: 800px;
    height: 40px;
}

.chevron-divider--visible {
    opacity: 1;
}

#hero .chevron-divider {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0;
}

/* --- Quest Islands --- */
.quest-island {
    position: relative;
    margin: 8vw auto;
    max-width: 900px;
    padding: 0 8vw;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.quest-island--visible {
    opacity: 1;
    transform: translateY(0);
}

.island-frame {
    position: relative;
    background-color: #FBF6EE;
    border: 2px solid #6A5838;
    padding: clamp(2.5rem, 5vw, 4rem);
}

.island-heading {
    margin-bottom: 1.5rem;
}

.island-text {
    margin-bottom: 1rem;
    color: #5A4830;
}

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

/* Section bottom ornament */
.island-ornament {
    text-align: center;
    margin-top: 2rem;
    opacity: 0.6;
}

/* --- Underline Draw Inline --- */
.underline-draw-inline {
    background-image: linear-gradient(#B08840, #B08840);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s ease;
    padding-bottom: 2px;
}

.underline-draw-inline:hover,
.island-frame:hover .underline-draw-inline {
    background-size: 100% 2px;
}

/* --- Route Grid --- */
.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.route-card {
    position: relative;
    background-color: #F4EDE0;
    border: 1px solid #C8A860;
    padding: 1.8rem;
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.route-card:hover {
    border-color: #B08840;
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(58,40,16,0.08);
}

.route-card-ornament {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 12px;
    overflow: hidden;
}

.route-card-ornament::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #C8A860;
}

.route-title {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
}

/* --- Codex Entries --- */
.codex-entries {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.codex-entry {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.codex-number {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #B08840;
    border: 2px solid #C8A860;
    position: relative;
}

/* Deco diamond at corner of codex number */
.codex-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 8px;
    height: 8px;
    background-color: #C8A860;
    transform: rotate(45deg);
}

.codex-body {
    flex: 1;
}

.codex-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    color: #3A2810;
    margin-bottom: 0.5rem;
}

/* --- Instrument Display --- */
.instrument-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2.5rem;
    margin-top: 2.5rem;
    text-align: center;
}

.instrument {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instrument-icon {
    margin-bottom: 1rem;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.instrument:hover .instrument-icon {
    opacity: 1;
    transform: scale(1.08);
}

.instrument-desc {
    font-size: 0.9rem;
    color: #5A4830;
    line-height: 1.7;
}

/* --- Waypoint List --- */
.waypoint-list {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.waypoint {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.waypoint-marker {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.35rem;
    border: 2px solid #B08840;
    transform: rotate(45deg);
    position: relative;
    transition: background-color 0.3s ease;
}

.waypoint-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background-color: #C8A860;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.waypoint:hover .waypoint-marker {
    background-color: rgba(200,170,100,0.2);
}

.waypoint:hover .waypoint-marker::after {
    background-color: #B08840;
}

.waypoint-content {
    flex: 1;
}

.waypoint-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: #3A2810;
    margin-bottom: 0.35rem;
}

/* --- Footer --- */
#footer {
    padding: 4rem 8vw 3rem;
    text-align: center;
}

.footer-content {
    padding-top: 2rem;
}

.footer-ornament {
    margin-bottom: 1.5rem;
}

.footer-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    font-size: 1.3rem;
    color: #3A2810;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.footer-tagline {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #8A6830;
}

/* --- Selection Color --- */
::selection {
    background-color: rgba(176,136,64,0.2);
    color: #3A2810;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .quest-island {
        padding: 0 5vw;
        margin: 12vw auto;
    }

    .island-frame {
        padding: 2rem 1.5rem;
    }

    .deco-corner {
        width: 24px;
        height: 24px;
    }

    .deco-corner--tl::before,
    .deco-corner--tr::before,
    .deco-corner--bl::before,
    .deco-corner--br::before {
        width: 24px;
    }

    .deco-corner--tl::after,
    .deco-corner--tr::after,
    .deco-corner--bl::after,
    .deco-corner--br::after {
        height: 24px;
    }

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

    .instrument-display {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .waypoint {
        gap: 1rem;
    }

    .codex-entry {
        gap: 1rem;
    }

    .codex-number {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    #hero {
        padding: 5vw;
    }

    .hero-title {
        letter-spacing: 0.08em;
    }
}
