/* ============================================
   daitoua.quest — Vintage Cartography Styles
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    --parchment: #e8dcc8;
    --ocean: #c8d8e0;
    --coast: #6b5a40;
    --route: #8b2c2c;
    --gold: #b8963a;
    --ink: #2c2418;
    --forest: #4a6040;
    --compass: #555040;
    --forest-fill: rgba(74, 96, 64, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Gentium Book Plus', Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.75;
    font-weight: 400;
    color: var(--ink);
    background-color: var(--parchment);
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, .cartouche-title {
    font-family: 'Pirata One', cursive;
    font-weight: 400;
}

.map-coord,
.compass-label,
.compass-label-sm,
.location-label,
.route-label {
    font-family: 'IM Fell English', serif;
    font-weight: 400;
}

/* --- Hero Map Section --- */
#map-hero {
    position: relative;
    min-height: 80vh;
    background-color: var(--ocean);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#main-map {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Land Regions --- */
.land-region {
    fill: var(--forest-fill);
    stroke: var(--coast);
    stroke-width: 1;
    cursor: pointer;
    transition: stroke-width 0.2s ease, fill 0.2s ease;
}

.land-region:hover {
    stroke-width: 2;
    fill: rgba(74, 96, 64, 0.3);
}

.land-region.active {
    stroke-width: 2.5;
    fill: rgba(74, 96, 64, 0.35);
    stroke: var(--gold);
}

/* --- Location Stars --- */
.location-star {
    fill: var(--gold);
    stroke: var(--coast);
    stroke-width: 0.5;
    cursor: pointer;
    transition: transform 0.3s ease;
    transform-origin: center;
}

.location-star:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 3px rgba(184, 150, 58, 0.6));
}

.location-star.pulse {
    animation: star-pulse 1.5s ease-in-out infinite;
}

@keyframes star-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* --- Location Labels --- */
.location-label {
    font-family: 'IM Fell English', serif;
    font-size: 11px;
    fill: var(--ink);
    text-anchor: middle;
    pointer-events: none;
}

/* --- Map Coordinate Labels --- */
.map-coord {
    font-family: 'IM Fell English', serif;
    font-size: 10px;
    fill: var(--coast);
    opacity: 0.6;
}

/* --- Route Lines --- */
.route-line {
    fill: none;
    stroke: var(--route);
    stroke-width: 1.5;
    stroke-dasharray: 4 6;
    stroke-dashoffset: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.route-line.animate {
    opacity: 1;
    animation: draw-route 3s ease forwards;
}

@keyframes draw-route {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}

.route-label {
    font-family: 'IM Fell English', serif;
    font-size: 10px;
    fill: var(--route);
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.route-label.visible {
    opacity: 0.8;
}

/* --- Compass Rose --- */
.compass-label {
    font-family: 'IM Fell English', serif;
    font-size: 10px;
    fill: var(--compass);
}

.compass-label-sm {
    font-family: 'IM Fell English', serif;
    font-size: 7px;
    fill: var(--compass);
    opacity: 0.7;
}

/* --- Cartouche --- */
#cartouche {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    width: 320px;
}

.cartouche-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
}

.cartouche-content {
    position: relative;
    z-index: 2;
    padding: 28px 35px;
    text-align: center;
}

.cartouche-title {
    font-family: 'Pirata One', cursive;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--ink);
    letter-spacing: 0.05em;
    line-height: 1.2;
    margin-bottom: 2px;
}

.cartouche-subtitle {
    font-family: 'IM Fell English', serif;
    font-size: 0.95rem;
    color: var(--coast);
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.cartouche-desc {
    font-family: 'IM Fell English', serif;
    font-size: 0.75rem;
    color: var(--compass);
    font-style: italic;
}

/* --- Map Legend --- */
#map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(232, 220, 200, 0.9);
    border: 1px solid var(--coast);
    padding: 12px 16px;
    z-index: 10;
}

.legend-title {
    font-family: 'Pirata One', cursive;
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--coast);
    padding-bottom: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-family: 'IM Fell English', serif;
    font-size: 0.8rem;
    color: var(--ink);
}

.legend-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.legend-star {
    background: var(--gold);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.legend-route {
    height: 2px;
    margin-top: 7px;
    background: repeating-linear-gradient(90deg, var(--route) 0px, var(--route) 4px, transparent 4px, transparent 10px);
}

.legend-land {
    background: var(--forest-fill);
    border: 1px solid var(--coast);
}

/* --- Location Info Panel --- */
#location-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 400px;
    max-width: 90vw;
    background: var(--parchment);
    border-left: 3px solid var(--coast);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(44, 36, 24, 0.15);
}

#location-panel.open {
    transform: translateX(0);
}

#panel-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: 1px solid var(--coast);
    color: var(--ink);
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: 'Gentium Book Plus', serif;
}

#panel-close:hover {
    background: var(--coast);
    color: var(--parchment);
}

#panel-header {
    padding: 30px 30px 15px;
    border-bottom: 1px solid rgba(107, 90, 64, 0.3);
}

#panel-title {
    font-family: 'Pirata One', cursive;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--ink);
    margin-bottom: 4px;
}

#panel-coords {
    font-family: 'IM Fell English', serif;
    font-size: 0.85rem;
    color: var(--coast);
    font-style: italic;
}

#panel-divider {
    height: 1px;
    margin: 0 30px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

#panel-body {
    padding: 20px 30px 40px;
    font-family: 'Gentium Book Plus', serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--ink);
}

#panel-body h3 {
    font-family: 'Pirata One', cursive;
    font-size: 1.15rem;
    color: var(--coast);
    margin: 20px 0 8px;
}

#panel-body h3:first-child {
    margin-top: 0;
}

#panel-body p {
    margin-bottom: 12px;
}

#panel-body .panel-fact {
    background: rgba(107, 90, 64, 0.08);
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 0.9rem;
}

/* --- Panel Overlay --- */
#panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 36, 24, 0.3);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- Footer --- */
#site-footer {
    background: var(--ink);
    padding: 40px 20px;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-compass {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.footer-compass circle,
.footer-compass polygon {
    stroke: var(--parchment);
}

.footer-compass polygon {
    fill: var(--parchment);
}

.footer-compass text {
    fill: var(--parchment);
}

.footer-text {
    font-family: 'Pirata One', cursive;
    font-size: 1.1rem;
    color: var(--parchment);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}

.footer-note {
    font-family: 'IM Fell English', serif;
    font-size: 0.8rem;
    color: var(--coast);
    font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #cartouche {
        width: 220px;
        top: 10px;
        left: 10px;
    }

    .cartouche-content {
        padding: 18px 22px;
    }

    .cartouche-subtitle {
        font-size: 0.75rem;
    }

    .cartouche-desc {
        font-size: 0.65rem;
    }

    #location-panel {
        width: 100%;
        max-width: 100%;
    }

    #map-legend {
        bottom: 10px;
        left: 10px;
        padding: 8px 12px;
    }

    .legend-title {
        font-size: 0.85rem;
    }

    .legend-item {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    #cartouche {
        width: 180px;
    }

    .cartouche-content {
        padding: 14px 18px;
    }

    .cartouche-title {
        font-size: 1.2rem;
    }
}
