/* ============================================
   miris.quest - Dark Quest Log Styles
   Navy Metallic | Organic Flow | Handwritten
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-navy: #0A1020;
    --metallic-blue: #2A3858;
    --brushed-steel: #8090B0;
    --silver-bright: #C0D0E8;
    --warm-amber: #D8A848;
    --navy-mid: #182840;
    --metallic-glow: rgba(128,144,176,0.2);
    --shimmer-a: rgba(42,56,88,0.8);
    --shimmer-b: rgba(24,40,64,0.9);

    --font-handwritten: 'Caveat', cursive;
    --font-body: 'Nunito', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --flow-offset: 5%;
}

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

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

body {
    background: var(--deep-navy);
    color: var(--silver-bright);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- Generative Background Canvas --- */
#generative-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Metallic Shimmer Overlay --- */
#shimmer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(42,56,88,0.03) 0%,
        rgba(128,144,176,0.05) 50%,
        rgba(42,56,88,0.03) 100%
    );
    background-size: 200% 200%;
    animation: shimmerShift 12s ease-in-out infinite;
}

@keyframes shimmerShift {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
}

/* --- Sections Common --- */
.viewport-section,
.quest-section {
    position: relative;
    z-index: 2;
}

.quest-section {
    padding: 8vh 5vw;
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
}

.quest-section[data-flow-offset="5"] {
    --flow-offset: 5%;
}
.quest-section[data-flow-offset="15"] {
    --flow-offset: 15%;
}
.quest-section[data-flow-offset="20"] {
    --flow-offset: 20%;
}
.quest-section[data-flow-offset="10"] {
    --flow-offset: 10%;
}

/* --- Section Canvases --- */
.section-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.section-canvas.active {
    opacity: 1;
}

/* ========== HERO SECTION ========== */
#hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 8vw;
    position: relative;
    overflow: hidden;
}

/* Hero Blobs */
.hero-blob {
    position: absolute;
    z-index: 0;
    opacity: 0.25;
}

.hero-blob-1 {
    width: 500px;
    height: 500px;
    top: -10%;
    right: -5%;
    background: radial-gradient(ellipse, var(--metallic-blue) 0%, transparent 70%);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blobMorph1 20s ease-in-out infinite;
}

.hero-blob-2 {
    width: 350px;
    height: 350px;
    bottom: 5%;
    left: 10%;
    background: radial-gradient(ellipse, var(--navy-mid) 0%, transparent 70%);
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
    animation: blobMorph2 25s ease-in-out infinite;
}

.hero-blob-3 {
    width: 250px;
    height: 250px;
    top: 30%;
    right: 25%;
    background: radial-gradient(ellipse, rgba(216,168,72,0.1) 0%, transparent 70%);
    border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%;
    animation: blobMorph3 18s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25% { border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%; }
    50% { border-radius: 70% 30% 50% 50% / 40% 60% 30% 70%; }
    75% { border-radius: 40% 60% 60% 40% / 50% 50% 60% 40%; }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
    33% { border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%; }
    66% { border-radius: 60% 40% 40% 60% / 30% 70% 50% 50%; }
}

@keyframes blobMorph3 {
    0%, 100% { border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%; }
    50% { border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%; }
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 3;
    transform: rotate(-2deg);
}

/* Logotype SVG Handwriting Animation */
.logotype-svg {
    width: clamp(300px, 50vw, 600px);
    height: auto;
    overflow: visible;
}

.logotype-text {
    font-family: var(--font-handwritten);
    font-size: 64px;
    font-weight: 700;
    fill: none;
    stroke: var(--silver-bright);
    stroke-width: 1.5;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: writeIn 2s ease forwards 0.5s;
}

@keyframes writeIn {
    to {
        stroke-dashoffset: 0;
        fill: var(--silver-bright);
    }
}

.hero-subtitle {
    margin-top: 1rem;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--brushed-steel);
    opacity: 0;
    animation: fadeUp 1s ease forwards 2s;
}

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

/* Quest Marker / Compass */
.quest-marker {
    position: absolute;
    top: 50%;
    right: 15%;
    transform: translateY(-50%);
    z-index: 3;
    opacity: 0;
    animation: fadeUp 1.2s ease forwards 1.5s;
}

.compass-svg {
    width: 160px;
    height: 160px;
    animation: compassSpin 30s linear infinite;
}

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

.compass-ring {
    fill: none;
    stroke: var(--brushed-steel);
    stroke-width: 1.5;
    opacity: 0.5;
}

.compass-ring-inner {
    fill: none;
    stroke: var(--metallic-blue);
    stroke-width: 1;
    opacity: 0.3;
}

.compass-needle-n,
.compass-needle-s,
.compass-needle-w,
.compass-needle-e {
    stroke: var(--brushed-steel);
    stroke-width: 2;
    opacity: 0.6;
}

.compass-arrow-n {
    fill: var(--warm-amber);
    opacity: 0.9;
}

.compass-arrow-s {
    fill: var(--brushed-steel);
    opacity: 0.4;
}

.compass-center {
    fill: var(--warm-amber);
}

.compass-tick {
    stroke: var(--brushed-steel);
    stroke-width: 1;
    opacity: 0.4;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    opacity: 0;
    animation: fadeUp 1s ease forwards 2.5s;
}

.scroll-indicator .quest-data {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    border-right: 2px solid var(--warm-amber);
    border-bottom: 2px solid var(--warm-amber);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); opacity: 1; }
    50% { transform: rotate(45deg) translateY(8px); opacity: 0.5; }
}

/* ========== HANDWRITTEN ANNOTATIONS ========== */
.annotation {
    position: absolute;
    z-index: 4;
    pointer-events: none;
}

.annotation-text {
    font-family: var(--font-handwritten);
    font-size: clamp(18px, 2.5vw, 28px);
    font-weight: 700;
    color: var(--warm-amber);
    white-space: nowrap;
    display: block;
}

.annotation-hero {
    top: 20%;
    right: 38%;
    transform: rotate(-8deg);
}

.annotation-arrow {
    width: 40px;
    height: 60px;
    display: block;
    margin-top: -5px;
}

.annotation-quests {
    bottom: 12%;
    right: 8%;
    transform: rotate(5deg);
}

.annotation-tech {
    top: 8%;
    left: var(--flow-offset);
    transform: rotate(-3deg);
}

.annotation-contact {
    top: 50%;
    right: 5%;
    transform: rotate(4deg);
}

/* ========== BLOB CONTAINERS ========== */
.blob-container {
    background: linear-gradient(135deg, var(--shimmer-a), var(--shimmer-b));
    border: 1px solid var(--metallic-glow);
    padding: clamp(2rem, 4vw, 4rem);
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin-left: var(--flow-offset);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease, border-radius 1.5s ease;
}

.blob-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.blob-shape-1 {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}

.blob-shape-2 {
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
}

.blob-shape-3 {
    border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%;
}

.blob-shape-4 {
    border-radius: 30% 70% 50% 50% / 50% 30% 70% 50%;
}

.blob-shape-5 {
    border-radius: 60% 40% 40% 60% / 40% 60% 60% 40%;
}

.blob-container:hover {
    border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
    border-color: rgba(216,168,72,0.3);
}

/* ========== SECTION HEADERS ========== */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.section-title {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 52px);
    color: var(--silver-bright);
    line-height: 1.2;
}

.section-meta {
    flex-basis: 100%;
    font-size: 11px;
    color: var(--brushed-steel);
    letter-spacing: 1px;
}

/* Quest Data (monospace spans) */
.quest-data {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 12px;
    color: var(--brushed-steel);
}

/* ========== QUEST ICONS ========== */
.quest-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.quest-icon svg {
    width: 100%;
    height: 100%;
}

/* Flame animation */
.flame-outer,
.flame-inner {
    animation: flameFlicker 2s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

.flame-inner {
    animation-delay: 0.3s;
}

@keyframes flameFlicker {
    0% { transform: scaleX(1) scaleY(1); }
    25% { transform: scaleX(0.95) scaleY(1.03); }
    50% { transform: scaleX(1.02) scaleY(0.97); }
    75% { transform: scaleX(0.98) scaleY(1.02); }
    100% { transform: scaleX(1.01) scaleY(0.99); }
}

/* Scroll unfurl animation */
.scroll-body,
.scroll-line {
    opacity: 0.8;
}

.scroll-top,
.scroll-bottom {
    animation: scrollUnfurl 3s ease-in-out infinite alternate;
}

@keyframes scrollUnfurl {
    0% { transform: scaleX(0.98); }
    100% { transform: scaleX(1.02); }
}

/* Beacon pulse */
.beacon-ring-1 {
    animation: beaconPulse 2s ease-out infinite;
}

.beacon-ring-2 {
    animation: beaconPulse 2s ease-out infinite 0.5s;
}

@keyframes beaconPulse {
    0% { r: 12; opacity: 0.4; }
    100% { r: 22; opacity: 0; }
}

/* ========== QUEST LIST ========== */
.quest-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quest-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: rgba(10,16,32,0.4);
    border-radius: 20% 80% 70% 30% / 60% 40% 60% 40%;
    border: 1px solid rgba(128,144,176,0.1);
    transition: border-color 0.4s ease, transform 0.3s ease;
}

.quest-item:hover {
    border-color: var(--warm-amber);
    transform: translateX(5px);
}

.quest-item-marker {
    width: 12px;
    height: 12px;
    min-width: 12px;
    margin-top: 6px;
    background: var(--warm-amber);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(216,168,72,0.5);
    animation: markerGlow 2s ease-in-out infinite alternate;
}

@keyframes markerGlow {
    0% { box-shadow: 0 0 6px rgba(216,168,72,0.3); }
    100% { box-shadow: 0 0 14px rgba(216,168,72,0.7); }
}

.quest-item-title {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 28px);
    color: var(--silver-bright);
    margin-bottom: 0.3rem;
}

.quest-item-desc {
    color: var(--brushed-steel);
    margin-bottom: 0.5rem;
}

.quest-item-meta {
    font-size: 11px;
    color: rgba(128,144,176,0.6);
}

/* ========== LORE SECTION ========== */
.lore-content p {
    margin-bottom: 1.25rem;
    max-width: 60ch;
}

.lore-quote {
    margin-top: 2rem;
    padding: 1.5rem 2rem;
    border-left: 3px solid var(--warm-amber);
    background: rgba(10,16,32,0.3);
    border-radius: 0 30% 30% 0 / 0 50% 50% 0;
}

.lore-quote .annotation-text {
    font-size: clamp(20px, 3vw, 32px);
    line-height: 1.4;
    color: var(--warm-amber);
}

/* ========== TECH GRID ========== */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.tech-item {
    padding: 1.2rem;
    background: rgba(10,16,32,0.5);
    border: 1px solid rgba(128,144,176,0.1);
    border-radius: 40% 60% 50% 50% / 50% 50% 40% 60%;
    transition: border-color 0.4s ease, border-radius 0.8s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tech-item:hover {
    border-color: var(--warm-amber);
    border-radius: 50%;
}

.tech-label {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 10px;
    color: var(--warm-amber);
}

.tech-value {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(14px, 1.2vw, 18px);
    color: var(--silver-bright);
}

/* ========== JOURNAL ENTRIES ========== */
.journal-entries {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.journal-entry {
    padding: 1.5rem;
    background: rgba(10,16,32,0.4);
    border-left: 2px solid var(--metallic-blue);
    border-radius: 0 30% 20% 0 / 0 50% 40% 0;
    transition: border-color 0.4s ease, transform 0.3s ease;
}

.journal-entry:hover {
    border-color: var(--warm-amber);
    transform: translateX(8px);
}

.journal-date {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 11px;
    color: var(--warm-amber);
    letter-spacing: 1px;
}

.journal-title {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(22px, 2.5vw, 32px);
    color: var(--silver-bright);
    margin-bottom: 0.5rem;
}

.journal-text {
    color: var(--brushed-steel);
    max-width: 55ch;
}

/* ========== CONTACT SECTION ========== */
.contact-content p {
    margin-bottom: 2rem;
    max-width: 55ch;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(10,16,32,0.5);
    border: 1px solid rgba(128,144,176,0.15);
    border-radius: 60% 40% 40% 60% / 50% 50% 50% 50%;
    text-decoration: none;
    color: var(--silver-bright);
    transition: border-color 0.4s ease, transform 0.3s ease, border-radius 0.8s ease;
}

.contact-link:hover {
    border-color: var(--warm-amber);
    transform: translateX(8px);
    border-radius: 50%;
}

.contact-link-icon {
    font-size: 1.5rem;
    color: var(--warm-amber);
    flex-shrink: 0;
}

.contact-link-label {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(18px, 2vw, 24px);
    margin-right: 0.5rem;
}

.contact-link .quest-data {
    font-size: 11px;
    color: var(--brushed-steel);
}

/* ========== FOOTER ========== */
#footer {
    position: relative;
    z-index: 2;
    padding: 4rem 8vw 3rem;
    border-top: 1px solid rgba(128,144,176,0.1);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.footer-logo {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--silver-bright);
}

.footer-meta {
    font-size: 11px;
    color: var(--brushed-steel);
}

.footer-copy {
    font-size: 11px;
    color: rgba(128,144,176,0.4);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    #hero {
        padding: 0 5vw;
    }

    .quest-marker {
        display: none;
    }

    .annotation-hero {
        display: none;
    }

    .blob-container {
        max-width: 100%;
        margin-left: 2%;
        padding: clamp(1.5rem, 3vw, 2.5rem);
        border-radius: 20px !important;
    }

    .blob-container:hover {
        border-radius: 20px !important;
    }

    .quest-section {
        padding: 6vh 3vw;
    }

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

    .contact-link {
        border-radius: 20px;
        flex-wrap: wrap;
    }

    .quest-item {
        border-radius: 16px;
    }

    .annotation {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-content {
        transform: rotate(0deg);
    }

    .logotype-svg {
        width: 80vw;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
