/* historic.quest - Maximalist Coastal Cartography */

/* ===== CSS Custom Properties ===== */
:root {
    --midnight-tidal: #0b3142;
    --teal-storm: #2a6f7d;
    --weathered-copper: #d4956a;
    --parchment-glow: #f5e6d0;
    --oxidized-green: #7ab8a8;
    --faded-timber: #8c7055;
    --bleached-coral: #faf3eb;
    --wrought-dark: #1e2a2d;
    --coastal-teal: #1a5c6b;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    line-height: 1.72;
    color: var(--wrought-dark);
    background: var(--parchment-glow);
    overflow-x: hidden;
}

/* ===== Coastline Scroll Indicator ===== */
.coastline-indicator {
    position: fixed;
    right: 12px;
    top: 0;
    height: 100vh;
    width: 40px;
    z-index: 100;
    pointer-events: none;
}

#coastlineSvg {
    width: 100%;
    height: 100%;
}

#coastlinePath {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 0.05s linear;
}

.waypoint circle {
    opacity: 0.8;
}

/* ===== Parchment Texture ===== */
.parchment-texture {
    position: absolute;
    inset: 0;
    background:
        repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 1px, rgba(140, 112, 85, 0.03) 1px, rgba(140, 112, 85, 0.03) 2px),
        repeating-radial-gradient(circle at 30% 70%, transparent 0, transparent 2px, rgba(212, 149, 106, 0.02) 2px, rgba(212, 149, 106, 0.02) 3px);
    filter: contrast(1.05) brightness(0.98);
    pointer-events: none;
    z-index: 0;
}

/* ===== Chamber Base Styles ===== */
.chamber {
    position: relative;
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8vh 5vw;
}

/* Chamber 1 - Warm Parchment */
.chamber-1 {
    background: linear-gradient(180deg, var(--parchment-glow) 0%, var(--bleached-coral) 100%);
    min-height: 130vh;
}

.chamber-1-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    max-width: 800px;
    width: 100%;
}

/* Chamber 2 - Warm Parchment */
.chamber-2 {
    background: linear-gradient(180deg, var(--bleached-coral) 0%, var(--parchment-glow) 100%);
    padding: 10vh 5vw;
    gap: 3rem;
}

/* Chamber 3 - Deep Ocean */
.chamber-3 {
    background: linear-gradient(180deg, var(--midnight-tidal) 0%, var(--coastal-teal) 60%, var(--teal-storm) 100%);
    overflow: hidden;
    gap: 3rem;
}

/* Chamber 4 - Warm Parchment */
.chamber-4 {
    background: linear-gradient(180deg, var(--parchment-glow) 0%, var(--bleached-coral) 100%);
    gap: 3rem;
}

/* Chamber 5 - Lighthouse */
.chamber-5 {
    background: radial-gradient(ellipse at 50% 40%, var(--parchment-glow) 0%, var(--weathered-copper) 35%, var(--teal-storm) 65%, var(--midnight-tidal) 100%);
    min-height: 100vh;
    gap: 3rem;
}

/* ===== Transition Zones ===== */
.transition-zone {
    height: 20vh;
    position: relative;
    z-index: 1;
}

.transition-1-2 {
    background: linear-gradient(180deg, var(--bleached-coral), var(--bleached-coral));
}

.transition-2-3 {
    background: linear-gradient(180deg, var(--parchment-glow), var(--midnight-tidal));
}

.transition-3-4 {
    background: linear-gradient(180deg, var(--teal-storm), var(--parchment-glow));
}

.transition-4-5 {
    background: linear-gradient(180deg, var(--bleached-coral), var(--teal-storm));
}

/* ===== Hero / Compass Rose ===== */
.hero-compass-wrapper {
    width: 200px;
    height: 200px;
}

.compass-rose-hero {
    width: 100%;
    height: 100%;
    animation: rotateCompass 60s linear infinite;
}

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

/* ===== Typography ===== */
.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--midnight-tidal);
    text-align: center;
}

.hero-title .title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-title.animated .title-char {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--faded-timber);
    text-align: center;
    transform: rotate(-2deg);
}

.chamber-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--midnight-tidal);
    text-align: center;
    position: relative;
    z-index: 2;
}

.chamber-title-light {
    color: var(--parchment-glow);
}

.chamber-title .title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.chamber-title.animated .title-char {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Geometric Frame ===== */
.geometric-frame {
    position: relative;
    width: 100%;
    max-width: 700px;
    z-index: 2;
}

.frame-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.draw-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.geometric-frame.visible .draw-path {
    stroke-dashoffset: 0;
}

.frame-content {
    position: relative;
    padding: 2.5rem 2rem;
    z-index: 1;
}

.intro-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: var(--wrought-dark);
    max-width: 38em;
    text-align: center;
}

/* ===== Log Entries (Chamber 2) ===== */
.log-entry {
    width: 100%;
    max-width: 700px;
}

.log-content {
    position: relative;
}

.date-stamp {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.85rem;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    color: var(--teal-storm);
    display: block;
    margin-bottom: 0.8rem;
}

.log-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: var(--wrought-dark);
    max-width: 38em;
    line-height: 1.72;
}

.margin-note {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: var(--weathered-copper);
    display: block;
    text-align: right;
    margin-top: 0.8rem;
    transform: rotate(-2deg);
}

/* ===== Wave Pattern (Chamber 3) ===== */
.wave-pattern {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    height: 300px;
    z-index: 0;
    pointer-events: none;
}

.wave-1 {
    animation: waveMove1 8s linear infinite;
}

.wave-2 {
    animation: waveMove2 12s linear infinite;
}

.wave-3 {
    animation: waveMove3 16s linear infinite;
}

@keyframes waveMove1 {
    from { transform: translateX(0); }
    to { transform: translateX(-300px); }
}

@keyframes waveMove2 {
    from { transform: translateX(0); }
    to { transform: translateX(-240px); }
}

@keyframes waveMove3 {
    from { transform: translateX(0); }
    to { transform: translateX(-400px); }
}

/* Tide content */
.tide-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    position: relative;
    z-index: 2;
    width: 100%;
}

.tide-text {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--bleached-coral);
    max-width: 38em;
}

/* ===== Archive Cards (Chamber 4) ===== */
.archive-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 700px;
}

.archive-card {
    background: var(--bleached-coral);
    border: 1.5px solid var(--weathered-copper);
    padding: 2rem 2.5rem;
    width: 100%;
    position: relative;
    box-shadow: 3px 4px 12px rgba(11, 49, 66, 0.12);
    transition: transform 0.3s ease-out, z-index 0s;
    cursor: default;
    margin-top: -1rem;
}

.archive-card:first-child {
    margin-top: 0;
}

.card-1 { transform: rotate(1.5deg); }
.card-2 { transform: rotate(-1.2deg); }
.card-3 { transform: rotate(1.5deg); }
.card-4 { transform: rotate(-1.2deg); }

.archive-card:hover {
    transform: rotate(0deg) translateY(-8px);
    z-index: 10;
}

.card-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--midnight-tidal);
    display: block;
    margin-bottom: 0.8rem;
    letter-spacing: 0.02em;
}

.card-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: var(--wrought-dark);
    line-height: 1.72;
    margin-bottom: 0.8rem;
}

.card-annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: var(--weathered-copper);
    display: block;
    text-align: right;
    transform: rotate(-2deg);
}

/* ===== Lighthouse (Chamber 5) ===== */
.lighthouse-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    position: relative;
    z-index: 2;
    max-width: 800px;
    text-align: center;
}

.lighthouse-statement {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2rem, 6vw, 4.5rem);
    color: var(--parchment-glow);
    line-height: 1.2;
    text-shadow: 0 2px 20px rgba(11, 49, 66, 0.4);
}

.compass-final {
    width: 120px;
    height: 120px;
}

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

.lighthouse-closing {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: var(--bleached-coral);
    max-width: 38em;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    opacity: 0.9;
}

/* ===== Geometric Shapes ===== */
.geo-shape {
    position: absolute;
    opacity: 0;
    transform: scale(0) rotate(180deg);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
    pointer-events: none;
}

.geo-shape.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.geo-shape svg {
    width: 100%;
    height: 100%;
}

/* Shape positions - Chamber 1 */
.shape-diamond {
    width: 24px; height: 24px;
    top: 15%; left: 8%;
}
.shape-triangle-1 {
    width: 20px; height: 20px;
    top: 70%; right: 10%;
}
.shape-circle-1 {
    width: 18px; height: 18px;
    bottom: 20%; left: 12%;
}

/* Shape positions - Chamber 2 */
.shape-hex-1 {
    width: 28px; height: 28px;
    top: 30%; right: 8%;
    position: relative;
    display: inline-block;
    margin: 1rem auto;
}
.shape-triangle-2 {
    width: 20px; height: 20px;
    bottom: 15%; left: 10%;
}
.shape-circle-2 {
    width: 22px; height: 22px;
    bottom: 10%; right: 12%;
}

/* Shape positions - Chamber 3 */
.shape-diamond-ocean {
    width: 28px; height: 28px;
    position: relative;
    display: inline-block;
}
.shape-circle-ocean {
    width: 24px; height: 24px;
    position: relative;
    display: inline-block;
}
.shape-tri-ocean {
    width: 22px; height: 22px;
    position: relative;
    display: inline-block;
}
.shape-compass-micro {
    width: 30px; height: 30px;
    bottom: 8%; right: 15%;
}

/* Shape positions - Chamber 4 */
.shape-diamond-archive {
    width: 22px; height: 22px;
    top: 12%; right: 10%;
}
.shape-hex-archive {
    width: 26px; height: 26px;
    bottom: 15%; left: 8%;
}

/* Shapes that are relatively positioned need different visibility */
.geo-shape[style*="relative"],
.tide-content .geo-shape,
.chamber-2 > .geo-shape.shape-hex-1 {
    position: relative;
    display: block;
    margin: 0 auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .chamber {
        padding: 6vh 4vw;
    }

    .frame-content {
        padding: 1.5rem 1.2rem;
    }

    .archive-card {
        padding: 1.5rem 1.2rem;
    }

    .coastline-indicator {
        right: 4px;
        width: 30px;
    }

    .hero-compass-wrapper {
        width: 140px;
        height: 140px;
    }

    .geo-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .lighthouse-statement {
        font-size: clamp(1.5rem, 7vw, 2.5rem);
    }
}
