/* =============================================
   graphers.net — Victorian Cartographer's Club
   Color Palette: Gold-Black-Luxury
   ============================================= */

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

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

body {
    font-family: 'Nunito', sans-serif;
    background: #0a0a0a;
    color: #e8e0d0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================
   Typography
   ============================================= */

.compass-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
}

.graph-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
}

/* =============================================
   Marble Surface (CSS-only texture)
   ============================================= */

.marble-surface {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(201,162,62,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139,58,58,0.04) 0%, transparent 40%),
        linear-gradient(135deg, transparent 40%, rgba(201,162,62,0.03) 42%, transparent 44%),
        linear-gradient(225deg, transparent 35%, rgba(232,224,208,0.04) 37%, transparent 39%),
        linear-gradient(170deg, #0d0b08 0%, #1a1510 100%);
    will-change: background-position;
}

.marble-surface-dark {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(201,162,62,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(139,58,58,0.03) 0%, transparent 40%),
        linear-gradient(135deg, transparent 40%, rgba(201,162,62,0.02) 42%, transparent 44%),
        linear-gradient(170deg, #0a0a0a 0%, #0d0b08 100%);
}

.marble-surface-warm {
    background:
        radial-gradient(ellipse at 25% 50%, rgba(201,162,62,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 30%, rgba(139,58,58,0.05) 0%, transparent 40%),
        linear-gradient(135deg, transparent 38%, rgba(201,162,62,0.04) 40%, transparent 42%),
        linear-gradient(225deg, transparent 33%, rgba(232,224,208,0.05) 35%, transparent 37%),
        linear-gradient(170deg, #1a1510 0%, #2a2520 100%);
}

/* =============================================
   Compass Navigation (Fixed)
   ============================================= */

.compass-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    cursor: pointer;
}

.compass-rose-nav {
    width: 56px;
    height: 56px;
    animation: compassRotateSlow 120s linear infinite;
    transition: transform 0.3s ease;
}

.compass-nav:hover .compass-rose-nav {
    animation-play-state: paused;
    transform: scale(1.1);
}

.compass-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.compass-nav.open .compass-menu {
    pointer-events: auto;
    opacity: 1;
}

.compass-link {
    position: absolute;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: #c9a23e;
    white-space: nowrap;
    transition: color 0.3s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.compass-link:hover {
    color: #f5f0e3;
}

.compass-n { top: -30px; left: 50%; transform: translateX(-50%); }
.compass-e { top: 50%; right: -70px; transform: translateY(-50%); }
.compass-s { bottom: -30px; left: 50%; transform: translateX(-50%); }
.compass-w { top: 50%; left: -60px; transform: translateY(-50%); }

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

/* =============================================
   Act I: The Vestibule
   ============================================= */

.vestibule {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vestibule-content {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.vestibule-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c9a23e;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeRevealUp 0.8s ease-out 0.5s forwards;
}

.vestibule-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    letter-spacing: 0.08em;
    color: #e8e0d0;
    opacity: 0;
    transform: translateY(15px);
    animation: fadeRevealUp 0.8s ease-out 0.9s forwards;
}

.vestibule-compass {
    width: clamp(120px, 20vw, 200px);
    height: clamp(120px, 20vw, 200px);
    opacity: 0;
    animation: fadeIn 1s ease-out 1.3s forwards;
}

.compass-rose-hero {
    width: 100%;
    height: 100%;
}

.compass-circle-outer {
    stroke-dasharray: 566;
    stroke-dashoffset: 566;
    animation: drawCircle 2s ease-out 1.5s forwards;
}

.compass-needle {
    opacity: 0;
    animation: fadeIn 0.6s ease-out 2.5s forwards;
}

.scroll-chevron {
    opacity: 0;
    animation: fadeIn 0.5s ease-out 3s forwards, pulseChevron 2s ease-in-out 3.5s infinite;
}

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

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

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes pulseChevron {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}


/* =============================================
   Gallery & Archive Grid Sections
   ============================================= */

.gallery,
.archive {
    position: relative;
    padding: clamp(60px, 8vw, 120px) 0;
}

.gallery-content,
.archive-content {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 48px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: clamp(24px, 3vw, 48px);
}

/* Archive uses smaller gap for tighter layout */
.archive-content {
    gap: clamp(16px, 2vw, 32px);
}

/* =============================================
   Module Base Styles
   ============================================= */

.module {
    position: relative;
    border-radius: 4px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease;
}

.module:hover {
    transform: translateY(-4px);
}

.module-inner {
    position: relative;
    padding: clamp(28px, 3vw, 48px);
    height: 100%;
}

/* Module reveal (hidden by default, shown by JS) */
.module-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.module-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================
   Module Type 1: Cartouche (section header)
   ============================================= */

.cartouche {
    grid-column: 1 / -1;
    background: #0a0a0a;
    border: 1px solid rgba(201,162,62,0.2);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.3),
        0 8px 16px rgba(0,0,0,0.2),
        0 16px 32px rgba(0,0,0,0.15);
}

.cartouche:hover {
    box-shadow:
        0 4px 8px rgba(0,0,0,0.4),
        0 12px 24px rgba(0,0,0,0.3),
        0 24px 48px rgba(0,0,0,0.2);
}

.cartouche .module-inner {
    text-align: center;
    padding: clamp(36px, 4vw, 64px) clamp(28px, 3vw, 48px);
    background:
        radial-gradient(ellipse at 50% 50%, rgba(201,162,62,0.04) 0%, transparent 70%),
        linear-gradient(135deg, transparent 40%, rgba(201,162,62,0.02) 42%, transparent 44%);
}

.cartouche-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c9a23e;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 12px;
}

.cartouche-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(0.9rem, 1.2vw, 1.15rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8e0d0;
    opacity: 0.7;
}

/* =============================================
   Module Type 2: Atlas Page
   ============================================= */

.atlas-page {
    background: #f5f0e3;
    border: 1px solid #c9a23e;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.2),
        0 8px 16px rgba(0,0,0,0.15),
        0 16px 32px rgba(0,0,0,0.1);
}

.atlas-page:hover {
    box-shadow:
        0 4px 8px rgba(0,0,0,0.3),
        0 12px 24px rgba(0,0,0,0.2),
        0 24px 48px rgba(0,0,0,0.15);
}

.atlas-page .module-inner {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(201,162,62,0.03) 0%, transparent 60%);
}

.module-label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a6832a;
    margin-bottom: 12px;
}

.atlas-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0a0a0a;
    margin-bottom: 16px;
}

.atlas-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #3d3529;
    margin-bottom: 16px;
}

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

/* =============================================
   Module Type 3: Instrument Panel
   ============================================= */

.instrument-panel {
    background: #1a1510;
    border: 1px solid rgba(201,162,62,0.15);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.3),
        0 8px 16px rgba(0,0,0,0.2),
        0 16px 32px rgba(0,0,0,0.15);
    aspect-ratio: 1;
}

.instrument-panel:hover {
    box-shadow:
        0 4px 8px rgba(201,162,62,0.1),
        0 12px 24px rgba(0,0,0,0.3),
        0 24px 48px rgba(0,0,0,0.2);
}

.instrument-panel-sm {
    aspect-ratio: auto;
}

.instrument-circle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instrument-panel:not(.instrument-panel-sm) .instrument-circle {
    border: 1px solid rgba(201,162,62,0.2);
    border-radius: 50%;
    overflow: hidden;
}

.instrument-content {
    text-align: center;
    padding: 16px;
}

.instrument-label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a6832a;
    margin-bottom: 8px;
}

.instrument-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c9a23e;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.instrument-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1rem);
    line-height: 1.6;
    color: #e8e0d0;
    margin-bottom: 12px;
}

.instrument-graph {
    display: flex;
    justify-content: center;
}

.mini-graph {
    width: 100px;
    height: 100px;
}


/* =============================================
   Module Type 5: Drawer Pull
   ============================================= */

.drawer-pull {
    background: #c9a23e;
    border: none;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.2),
        0 4px 8px rgba(0,0,0,0.15);
}

.drawer-pull:hover {
    background: #a6832a;
    box-shadow:
        0 4px 8px rgba(0,0,0,0.3),
        0 8px 16px rgba(0,0,0,0.2);
}

.drawer-pull .module-inner {
    padding: clamp(16px, 2vw, 24px) clamp(20px, 3vw, 32px);
    display: flex;
    align-items: center;
}

.drawer-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: clamp(0.9rem, 1vw, 1.05rem);
    line-height: 1.5;
    color: #0a0a0a;
}

/* =============================================
   Corner Flourishes
   ============================================= */

.corner-flourish {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 2;
    pointer-events: none;
}

.cartouche .corner-flourish {
    width: 50px;
    height: 50px;
}

.corner-tl { top: 4px; left: 4px; }
.corner-tr { top: 4px; right: 4px; }
.corner-bl { bottom: 4px; left: 4px; }
.corner-br { bottom: 4px; right: 4px; }

.flourish-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease-out;
}

.module-reveal.revealed .flourish-path {
    stroke-dashoffset: 0;
}

/* =============================================
   Section Divider
   ============================================= */

.section-divider {
    position: relative;
    z-index: 1;
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

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

.divider-compass {
    transition: transform 0.3s ease;
}

/* =============================================
   Act III: The Map Room (Panorama)
   ============================================= */

.map-room {
    position: relative;
    min-height: 100vh;
    padding: clamp(80px, 10vw, 160px) 0;
    overflow: hidden;
}

.compass-rose-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    max-width: 600px;
    height: auto;
    z-index: 0;
    pointer-events: none;
}

.map-room-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
}

.panorama-text-block {
    text-align: center;
    margin-bottom: clamp(32px, 5vw, 64px);
}

.panorama-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c9a23e;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 12px;
}

.panorama-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    letter-spacing: 0.1em;
    color: #e8e0d0;
    opacity: 0.7;
}

.panorama-body {
    /* Panorama reveal */
}

.panorama-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #e8e0d0;
    margin-bottom: 24px;
}

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

.highlight-term {
    color: #8b3a3a;
    background-image: linear-gradient(#8b3a3a, #8b3a3a);
    background-size: 100% 1px;
    background-position: bottom;
    background-repeat: no-repeat;
    padding-bottom: 1px;
}

/* =============================================
   Coda: The Guest Book
   ============================================= */

.coda {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coda-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 640px;
    padding: 0 clamp(24px, 4vw, 48px);
}

.coda-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.coda-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: #f5f0e3;
}

.coda-rule {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a23e, transparent);
}

.compass-rose-coda {
    width: 60px;
    height: 60px;
    opacity: 0.6;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 768px) {
    .gallery-content,
    .archive-content {
        grid-template-columns: 1fr;
    }

    .instrument-panel {
        aspect-ratio: auto;
    }

    .compass-nav {
        top: 16px;
        right: 16px;
    }

    .compass-rose-nav {
        width: 44px;
        height: 44px;
    }

    .compass-n { top: -24px; }
    .compass-s { bottom: -24px; }
    .compass-e { right: -55px; }
    .compass-w { left: -50px; }

    .compass-link {
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    .gallery-content,
    .archive-content {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }
}
