/* ============================================
   archetype.boo — styles.css
   Fairycore meets circuit board grimoire
   ============================================ */

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

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

body {
    background: #0d0221;
    color: #c9b8e8;
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* --- Background Radial Gradient (via pseudo-element, fixed) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 50%, #1a0a3e 0%, #0d0221 70%);
    z-index: -2;
    pointer-events: none;
}

/* --- Background Texture Layer --- */
#bg-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.03;
    background-image:
        radial-gradient(circle at 20% 30%, #150535 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, #150535 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, #150535 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, #150535 1px, transparent 1px);
    background-size: 60px 60px, 80px 80px, 50px 50px, 70px 70px;
}

/* Alchemical symbols texture via repeating SVG data URI */
#bg-texture::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 10 L65 20 L55 20 Z' fill='none' stroke='%23150535' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='60' r='8' fill='none' stroke='%23150535' stroke-width='0.5'/%3E%3Cpath d='M85 55 A10 10 0 1 1 85 75 A10 10 0 0 0 85 55' fill='none' stroke='%23150535' stroke-width='0.5'/%3E%3Cpath d='M55 90 L65 90 L60 80 Z' fill='none' stroke='%23150535' stroke-width='0.5'/%3E%3Ccircle cx='95' cy='25' r='3' fill='none' stroke='%23150535' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 120px 120px;
}

/* --- Particle Canvas Overlay --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

/* --- SVG Connector Vines --- */
.connector-vines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: visible;
}

/* --- Navigation Strip (Desktop) --- */
.nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 200;
    background: linear-gradient(to right, rgba(13, 2, 33, 0.95), rgba(13, 2, 33, 0));
    padding: 16px 0;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e637bf;
    background: rgba(13, 2, 33, 0.8);
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
}

.nav-icon:hover {
    border-color: #00f0ff;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    transform: scale(1.15);
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

/* --- Mobile Navigation --- */
.nav-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background: rgba(13, 2, 33, 0.97);
    border-top: 1px solid #e637bf;
    z-index: 200;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-icon-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: 1px solid #e637bf;
    background: rgba(13, 2, 33, 0.8);
    text-decoration: none;
    transition: border-color 0.3s ease;
}

.nav-icon-mobile:hover {
    border-color: #00f0ff;
}

.nav-icon-mobile svg {
    width: 20px;
    height: 20px;
}

/* --- Title Sequence --- */
.title-sequence {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 40px 20px;
}

.site-title {
    font-family: 'Cinzel Decorative', 'Cormorant Garamond', serif;
    font-size: 48px;
    font-weight: 400;
    color: #00f0ff;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
    min-height: 1.3em;
    text-shadow:
        0 0 20px rgba(0, 240, 255, 0.5),
        0 0 40px rgba(0, 240, 255, 0.2);
}

.site-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.site-title .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 20px;
    font-weight: 400;
    color: #c9b8e8;
    text-align: center;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.site-subtitle.visible {
    opacity: 1;
}

/* --- Module Grid --- */
.module-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    padding: 60px 80px 120px 80px;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 10;
}

/* --- Module Base --- */
.module {
    position: relative;
    border: 1px solid #e637bf;
    background: rgba(13, 2, 33, 0.92);
    border-radius: 2px;
    padding: 0;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, border-width 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

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

.module:hover {
    border-width: 2px;
    box-shadow: 0 0 16px rgba(230, 55, 191, 0.25);
    transform: translateY(-4px);
}

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

.module__inner {
    padding: 32px;
}

/* --- Module Column Spans (irregular, collage-like) --- */
/* Hero module: span 7 */
.module--hero {
    grid-column: span 7;
}

/* Shadow module: span 5 */
.module--shadow {
    grid-column: span 5;
}

/* Sage module: span 5, offset */
.module--sage {
    grid-column: 2 / span 5;
}

/* Trickster module: span 7 */
.module--trickster {
    grid-column: span 7;
}

/* Anima module: span 5 */
.module--anima {
    grid-column: span 5;
}

/* Text modules */
.module--text {
    grid-column: span 5;
}

.module--text-small {
    grid-column: span 3;
}

/* Quote modules */
.module--quote {
    grid-column: span 3;
}

.module--quote-wide {
    grid-column: span 7;
}

/* Accent modules (small decorative) */
.module--accent {
    grid-column: span 3;
}

.module--accent-wide {
    grid-column: span 4;
}

/* Closing module */
.module--closing {
    grid-column: span 7;
}

/* Slight overlap effect via negative margins on alternating modules */
.module:nth-child(even) {
    margin-top: -8px;
}

.module:nth-child(3n) {
    margin-left: -4px;
}

/* --- Module: Illustration --- */
.module--illustration .module__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.archetype-illustration {
    margin-bottom: 24px;
    max-width: 100%;
    height: auto;
}

/* --- Module: Text --- */
.module__heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: #f8f0ff;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(230, 55, 191, 0.25);
}

.module__body {
    font-family: 'Lora', Georgia, serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.75;
    color: #c9b8e8;
}

.module__body:hover {
    color: #f8f0ff;
    transition: color 0.3s ease;
}

/* --- Module: Archetype Titles --- */
.module__title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.2;
    color: #f8f0ff;
    margin-bottom: 12px;
    text-shadow: 0 0 8px rgba(230, 55, 191, 0.25);
}

.module__caption {
    font-family: 'Lora', Georgia, serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: #c9b8e8;
    font-style: italic;
}

/* --- Module: Quote --- */
.module__blockquote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    font-style: italic;
    line-height: 1.4;
    color: #f8f0ff;
    text-shadow: 0 0 8px rgba(230, 55, 191, 0.25);
    margin-bottom: 12px;
}

.module__cite {
    font-family: 'Lora', Georgia, serif;
    font-size: 13px;
    font-weight: 400;
    color: #c9b8e8;
    opacity: 0.7;
    display: block;
}

/* --- Module: Accent --- */
.module--accent .module__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.module__glyph {
    margin-bottom: 12px;
}

.module__whisper {
    font-family: 'Lora', Georgia, serif;
    font-size: 12px;
    font-weight: 400;
    color: #c9b8e8;
    opacity: 0.5;
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

/* --- SVG Illustration Animations --- */

/* Moth wing pulse */
@keyframes wingPulse {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(0.95); }
}

.moth-wing-left,
.moth-wing-right {
    animation: wingPulse 4s ease-in-out infinite;
    transform-origin: center;
}

/* Signal ring pulse */
@keyframes signalPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.signal-ring {
    animation: signalPulse 3s ease-in-out infinite;
    transform-origin: center;
}

/* Fox eye glow */
@keyframes eyeGlow {
    0%, 100% { filter: drop-shadow(0 0 2px #fff44f); }
    50% { filter: drop-shadow(0 0 6px #fff44f); }
}

.fox-eye {
    animation: eyeGlow 3s ease-in-out infinite;
}

/* Fox tail sway */
@keyframes tailSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.fox-tail {
    animation: tailSway 5s ease-in-out infinite;
    transform-origin: 80px 155px;
}

/* Owl pupil blink */
@keyframes owlBlink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.owl-pupil {
    animation: owlBlink 6s ease-in-out infinite;
    transform-origin: center;
}

/* Fern spiral unfurl */
@keyframes spiralPulse {
    0%, 100% { stroke-dashoffset: 0; }
    50% { stroke-dashoffset: 5; }
}

.fern-spiral {
    stroke-dasharray: 40;
    animation: spiralPulse 4s ease-in-out infinite;
}

/* Fern dissolution particles float */
@keyframes particleFloat {
    0% { transform: translate(0, 0); opacity: 0.5; }
    50% { transform: translate(3px, -5px); opacity: 0.8; }
    100% { transform: translate(6px, -10px); opacity: 0; }
}

.fern-particle {
    animation: particleFloat 3s ease-in-out infinite;
}

.fern-particle:nth-child(2) { animation-delay: 0.5s; }
.fern-particle:nth-child(3) { animation-delay: 1s; }
.fern-particle:nth-child(4) { animation-delay: 1.5s; }
.fern-particle:nth-child(5) { animation-delay: 2s; }
.fern-particle:nth-child(6) { animation-delay: 2.5s; }

/* Serpent path shimmer */
@keyframes serpentShimmer {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 20; }
}

.serpent-path {
    stroke-dasharray: 10 5;
    animation: serpentShimmer 4s linear infinite;
}

/* --- Nav glow effect on target modules --- */
/* --- Deep Fuchsia gradient shadow on illustration modules --- */
.module--illustration::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, #8b1a7a10, transparent);
    pointer-events: none;
    z-index: 0;
}

/* --- Neon Lime highlight marker for accent modules --- */
.module--accent .module__whisper::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a8ff04;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px #a8ff04;
}

.module.nav-glow {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5) !important;
    border-color: #00f0ff !important;
}

/* --- Connector vine paths --- */
.vine-path {
    fill: none;
    stroke: #e637bf;
    stroke-width: 1;
    opacity: 0.3;
    stroke-linecap: round;
}

/* --- Gradient intensify on load --- */
@keyframes gradientIntensify {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

body::before {
    animation: gradientIntensify 1.5s ease-out forwards;
}

/* ============================================
   Mobile Styles (below 768px)
   ============================================ */
@media (max-width: 768px) {
    .nav-strip {
        display: none;
    }

    .nav-mobile {
        display: flex;
    }

    .module-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 40px 16px 80px 16px;
    }

    .module {
        width: 100%;
        margin-top: 0 !important;
        margin-left: 0 !important;
    }

    .site-title {
        font-size: 32px;
        letter-spacing: 0.1em;
    }

    .site-subtitle {
        font-size: 16px;
    }

    .archetype-illustration {
        max-width: 60vw;
    }

    .module__title {
        font-size: 28px;
    }

    .module__heading {
        font-size: 20px;
    }

    .module__body {
        font-size: 15px;
    }

    .module__blockquote {
        font-size: 16px;
    }

    /* Hide connector vines on mobile */
    .connector-vines {
        display: none;
    }

    /* Bottom padding for mobile nav */
    body {
        padding-bottom: 56px;
    }
}

/* ============================================
   Tablet adjustments
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .module-grid {
        padding: 60px 40px 120px 60px;
    }

    .site-title {
        font-size: 40px;
    }
}

/* ============================================
   Large screen adjustments
   ============================================ */
@media (min-width: 1600px) {
    .module-grid {
        max-width: 1600px;
    }

    .site-title {
        font-size: 56px;
    }
}
