/* ==========================================
   monopole.quest - Steampunk Expedition Journal
   ========================================== */

/* --- 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(14px, 1vw, 17px);
    line-height: 1.75;
    color: #5A4830;
    background-color: #E8D8C0;
    overflow-x: hidden;
}

/* --- Aged Paper Texture --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* --- Animations --- */
@keyframes gearSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes stampIn {
    0% {
        opacity: 0;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1.0);
    }
}

@keyframes drawLineDown {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #E8D8C0;
    overflow: hidden;
}

/* Corner Gears */
.corner-gear {
    position: absolute;
    width: 120px;
    height: 120px;
    z-index: 2;
}

.corner-gear-tl {
    top: 30px;
    left: 30px;
}

.corner-gear-tr {
    top: 30px;
    right: 30px;
}

.gear-cw {
    animation: gearSpin 20s linear infinite;
}

.gear-ccw {
    animation: gearSpin 20s linear infinite reverse;
}

.corner-gear svg {
    width: 100%;
    height: 100%;
}

/* Compass Rose Background */
.compass-rose-bg {
    position: absolute;
    width: 70vmin;
    height: 70vmin;
    max-width: 600px;
    max-height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

/* Logotype */
#logotype {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: stampIn 600ms ease-out forwards;
    opacity: 0;
    animation-delay: 300ms;
    animation-fill-mode: forwards;
}

.logotype-text {
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(28px, 4vw, 56px);
    color: #3A2818;
    letter-spacing: 0.02em;
    text-shadow: 1px 1px 0 rgba(176, 136, 48, 0.3);
}

.logotype-dot {
    color: #B08830;
}

.logotype-subtitle {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    color: #A06030;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 12px;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1;
    animation: fadeInUp 800ms ease-out 1.5s both;
}

.scroll-text {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 12px;
    color: #A06030;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.scroll-arrow {
    animation: bobDown 2s ease-in-out infinite;
}

/* --- Timeline Section --- */
#timeline {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 40px 120px;
}

/* Central Timeline Line */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 3px;
    height: 100%;
    background: #B08830;
    transform: translateX(-50%);
    transform-origin: top center;
}

/* Draw animation container for timeline line */
.timeline-line-animated {
    position: absolute;
    left: 50%;
    top: 0;
    width: 3px;
    background: #B08830;
    transform: translateX(-50%);
    transform-origin: top center;
    height: 0;
    transition: height 2s ease-out;
}

/* --- Chapter Headers --- */
.chapter-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 0 40px;
    z-index: 2;
}

.chapter-gears {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
}

.chapter-gear {
    width: 70px;
    height: 70px;
}

.chapter-gear-small {
    width: 50px;
    height: 50px;
    margin-left: -8px;
}

.chapter-compass {
    margin-bottom: 12px;
}

.mini-compass {
    width: 40px;
    height: 40px;
}

.chapter-title {
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(22px, 3vw, 36px);
    color: #3A2818;
    text-align: center;
    letter-spacing: 0.02em;
    background-color: #E8D8C0;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* --- Timeline Entries --- */
.timeline-entry {
    position: relative;
    width: 50%;
    padding: 20px 0;
    opacity: 0;
}

.timeline-entry.revealed {
    opacity: 1;
}

/* Left entries */
.entry-left {
    margin-right: 50%;
    padding-right: 40px;
    text-align: right;
    --entry-dir: -40px;
}

.entry-left .connector {
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 3px;
    background: #B08830;
    transition: width 300ms ease-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.entry-left.revealed .connector {
    width: 40px;
}

.entry-left .entry-panel {
    transform: translateX(-40px);
    opacity: 0;
    transition: transform 500ms ease-out 250ms, opacity 500ms ease-out 250ms;
}

.entry-left.revealed .entry-panel {
    transform: translateX(0);
    opacity: 1;
}

/* Right entries */
.entry-right {
    margin-left: 50%;
    padding-left: 40px;
    text-align: left;
    --entry-dir: 40px;
}

.entry-right .connector {
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 3px;
    background: #B08830;
    transition: width 300ms ease-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.entry-right.revealed .connector {
    width: 40px;
}

.entry-right .entry-panel {
    transform: translateX(40px);
    opacity: 0;
    transition: transform 500ms ease-out 250ms, opacity 500ms ease-out 250ms;
}

.entry-right.revealed .entry-panel {
    transform: translateX(0);
    opacity: 1;
}

/* Rivets */
.rivet {
    display: block;
    width: 6px;
    height: 6px;
    background: #B08830;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(58, 40, 24, 0.3);
}

/* Entry Panel */
.entry-panel {
    background: #D8C8A8;
    border: 1px solid #C8B890;
    padding: 28px 24px;
    border-radius: 3px;
    box-shadow:
        0 2px 8px rgba(58, 40, 24, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.entry-panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(176, 136, 48, 0.15);
    border-radius: 2px;
    pointer-events: none;
}

.entry-date {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 13px;
    color: #A06030;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.entry-title {
    font-family: 'Abril Fatface', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(18px, 2.2vw, 24px);
    color: #3A2818;
    margin-bottom: 12px;
    line-height: 1.3;
}

.entry-body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    color: #5A4830;
    line-height: 1.75;
    margin-bottom: 16px;
}

.entry-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(176, 136, 48, 0.2);
    gap: 12px;
}

.entry-left .entry-footer {
    flex-direction: row-reverse;
}

.entry-status {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    color: #B08830;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.entry-coord {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 11px;
    color: #C8B890;
    letter-spacing: 0.05em;
}

/* --- Footer --- */
#expedition-footer {
    position: relative;
    text-align: center;
    padding: 60px 20px 80px;
    background: linear-gradient(to bottom, #E8D8C0, #D8C8A8);
    border-top: 3px solid #B08830;
}

.footer-gears {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.footer-gear {
    width: 50px;
    height: 50px;
}

.footer-text {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(14px, 1.2vw, 18px);
    color: #3A2818;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.footer-date {
    font-family: 'Special Elite', 'Courier New', monospace;
    font-size: 12px;
    color: #A06030;
    letter-spacing: 0.2em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #timeline {
        padding: 60px 20px 80px;
    }

    .timeline-line {
        left: 20px;
    }

    .timeline-entry {
        width: 100%;
        padding-left: 50px;
        padding-right: 0;
        text-align: left;
    }

    .entry-left {
        margin-right: 0;
        padding-right: 0;
        text-align: left;
        --entry-dir: -40px;
    }

    .entry-left .connector {
        left: -1px;
        right: auto;
    }

    .entry-left .entry-footer {
        flex-direction: row;
    }

    .entry-right {
        margin-left: 0;
        padding-left: 50px;
    }

    .entry-right .connector {
        left: -1px;
    }

    .corner-gear {
        width: 70px;
        height: 70px;
    }

    .chapter-gear {
        width: 50px;
        height: 50px;
    }

    .chapter-gear-small {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .corner-gear {
        width: 50px;
        height: 50px;
    }

    .corner-gear-tl {
        top: 15px;
        left: 15px;
    }

    .corner-gear-tr {
        top: 15px;
        right: 15px;
    }

    .timeline-entry {
        padding-left: 40px;
    }

    .entry-panel {
        padding: 20px 16px;
    }
}
