/* ============================================================
   RADventures — Flashlight Cave Landing
   Palette: KVR tunnel — rock charcoal, forest green, trail tan,
            sky grey-blue, muted rose-pink highlights
   ============================================================ */

/* === Design Tokens === */
:root {
    /* Palette pulled from the tunnel photo — NATURAL CONTRAST */
    --color-primary: #8ebe72;          /* Forest pine green */
    --color-primary-glow: rgba(142, 190, 114, 0.3);
    --color-accent: #e8a08f;           /* Rose-pink mountain, brighter */
    --color-accent-glow: rgba(232, 160, 143, 0.3);
    --color-trail: #d4bc9a;            /* Dusty gravel trail, lifted */
    --color-sky: #a0c0d4;              /* Hazy BC sky, brighter */
    --color-bg: #080a06;              /* Deep tunnel rock */
    --color-surface: rgba(18, 20, 16, 0.75);
    --color-text: #f4f1eb;            /* Bright daylight spill */
    --color-text-muted: rgba(244, 241, 235, 0.55);
    /* Fonts */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    /* Flashlight */
    --flashlight-radius: 180px;
    --flashlight-feather: 100px;
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;
    --radius: 0.5rem;
}

/* === Utilities === */
.mobile-only { display: none; }

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* === Cave Layers === */
.cave-layer {
    position: fixed;
    /* Oversize slightly so parallax shift never shows edges */
    inset: -20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

#cave-dark {
    background-image: url('assets/images/cave-dark.webp');
    background-image: image-set(
        url('assets/images/cave-dark.webp') type('image/webp'),
        url('assets/images/Gemini_Generated_Image_gnpeqwgnpeqwgnpe.jpeg') type('image/jpeg')
    );
    z-index: 1;
}

#cave-light {
    background-image: url('assets/images/cave-lit.webp');
    background-image: image-set(
        url('assets/images/cave-lit.webp') type('image/webp'),
        url('assets/images/Gemini_Generated_Image_z2xj1sz2xj1sz2xj.jpeg') type('image/jpeg')
    );
    z-index: 2;
    /* Start with mask hidden — JS will update the position */
    -webkit-mask-image: radial-gradient(
        circle var(--flashlight-radius) at -200px -200px,
        rgba(0,0,0,1) 0%,
        rgba(0,0,0,0.85) 40%,
        rgba(0,0,0,0.4) 70%,
        rgba(0,0,0,0) 100%
    );
    mask-image: radial-gradient(
        circle var(--flashlight-radius) at -200px -200px,
        rgba(0,0,0,1) 0%,
        rgba(0,0,0,0.85) 40%,
        rgba(0,0,0,0.4) 70%,
        rgba(0,0,0,0) 100%
    );
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    will-change: mask-image, -webkit-mask-image;
}

/* === Flashlight Glow === */
#flashlight-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(
        circle at center,
        rgba(164, 200, 142, 0.07) 0%,
        rgba(143, 168, 184, 0.03) 40%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    will-change: left, top;
    mix-blend-mode: screen;
}

/* === Custom Cursor Dot === */
#cursor-dot {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow:
        0 0 12px 4px var(--color-primary-glow),
        0 0 40px 10px rgba(164, 200, 142, 0.12);
    pointer-events: none;
    z-index: 1000;
    transform: translate(-50%, -50%);
    transition: width 0.15s, height 0.15s, box-shadow 0.15s;
    will-change: left, top;
}

#cursor-dot.hovering {
    width: 20px;
    height: 20px;
    box-shadow:
        0 0 20px 6px var(--color-primary-glow),
        0 0 60px 16px rgba(164, 200, 142, 0.18);
}

/* === Content Layer === */
#content-layer {
    position: relative;
    z-index: 10;
    min-height: 100vh;
}

/* === Navigation === */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(180deg, rgba(5,5,5,0.7) 0%, transparent 100%);
}

#main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
    transition: text-shadow 0.3s;
}

.logo:hover {
    text-shadow: 0 0 20px var(--color-primary-glow);
}

.logo span {
    font-weight: 300;
    color: var(--color-trail);
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    transition: color 0.3s, text-shadow 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-primary);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--color-text);
    text-shadow: 0 0 12px var(--color-primary-glow);
}

.nav-links a:hover::after {
    width: 100%;
}

/* "About" nav link gets a special accent treatment */
.nav-links a[data-modal] {
    color: var(--color-trail);
    transition: color 0.3s, text-shadow 0.3s, transform 0.2s;
}
.nav-links a[data-modal]:hover {
    color: var(--color-text);
    text-shadow: 0 0 14px rgba(212, 188, 154, 0.4); /* Glow matching trail color */
    transform: translateY(-1px);
}
.nav-links a[data-modal]::after {
    background: var(--color-trail);
}

/* === Hero Section === */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 var(--spacing-xl) var(--spacing-xl);
    padding-bottom: calc(var(--spacing-xl) + 25vh); /* Leave room for carousel */
    position: relative;
}

.hero-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    align-items: end;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.hero-body {
    padding-left: 6rem;
    padding-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease 0.5s forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6.5vw, 5.4rem);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--color-text);
    font-style: italic;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease 0.2s forwards;
}

.hero-accent {
    color: var(--color-primary);
    text-shadow: 0 0 40px rgba(142, 190, 114, 0.15);
}



.hero-description {
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.75;
    color: rgba(241, 236, 228, 0.85);
    max-width: 420px;
    margin-bottom: var(--spacing-lg);
    text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

/* === Buttons === */
.hero-actions {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.btn {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
    cursor: none;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.6rem;
    border: 1px solid var(--color-primary);
    color: var(--color-bg);
    background: var(--color-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: transparent;
    color: var(--color-primary);
    box-shadow: 0 0 20px rgba(142, 190, 114, 0.18);
}

.btn-secondary {
    color: var(--color-text-muted);
    border-bottom: 1px solid rgba(232, 228, 220, 0.3);
    padding-bottom: 2px;
}

.btn-secondary:hover {
    color: var(--color-text);
    border-bottom-color: var(--color-trail);
}

/* === Hero Footer === */
.hero-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: var(--spacing-xl) auto 0;
    width: 100%;
    opacity: 0;
    animation: fadeUp 0.6s ease 0.8s forwards;
}

.hero-location {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-trail);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
    opacity: 0.85;
}

.hero-scroll {
    font-size: 1.4rem;
    color: var(--color-text-muted);
    animation: bob 2s ease-in-out infinite;
}

/* === Animations === */
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* === About Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 6, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    cursor: none;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    position: relative;
    max-width: 600px;
    width: 90%;
    background: rgba(18, 22, 16, 0.92);
    border: 1px solid rgba(164, 200, 142, 0.15);
    border-radius: 12px;
    padding: 3rem;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s ease;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(164, 200, 142, 0.08);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    cursor: none;
    transition: color 0.2s;
    line-height: 1;
    padding: 0.25rem;
}
.modal-close:hover {
    color: var(--color-accent);
}

.modal-card h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.modal-card p {
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(232, 228, 220, 0.8);
    margin-bottom: 1rem;
}

.modal-card p:last-of-type {
    margin-bottom: 0;
}

.modal-accent {
    color: var(--color-primary);
}

/* === Logo Showcase Carousel === */
.showcase {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    min-height: 25vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
    background: linear-gradient(0deg, rgba(8, 10, 6, 0.97) 0%, rgba(8, 10, 6, 0.8) 60%, rgba(8, 10, 6, 0.3) 85%, transparent 100%);
    pointer-events: none;
}

.showcase-label {
    display: block;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 1.2rem;
    opacity: 0.5;
}

.showcase-track-wrapper {
    overflow: hidden;
    width: 100%;
}

.showcase-track {
    display: flex;
    width: max-content;
    animation: scrollLogos 18s linear infinite;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 8rem;
    padding-right: 8rem; /* Trailing gap makes the math perfectly even for seamless loop */
}

.showcase-logo {
    flex-shrink: 0;
    font-family: var(--font-body);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.55;
    white-space: nowrap;
    user-select: none;
    transition: opacity 0.3s;
    line-height: 3;
}

@keyframes scrollLogos {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-100% / 3)); }
}

/* === Responsive — Tablet (768px) === */
@media (max-width: 768px) {
    :root {
        --flashlight-radius: 120px;
    }

    header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .nav-links {
        gap: var(--spacing-md);
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    .hero {
        padding: 0 var(--spacing-md) var(--spacing-md);
        padding-bottom: calc(var(--spacing-lg) + 20vh);
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .hero-body {
        padding-left: 0;
    }

    .hero-title {
        font-size: clamp(2.2rem, 8vw, 3.6rem);
    }

    .hero-footer {
        margin-top: var(--spacing-md);
    }

    .modal-card {
        padding: 2rem 1.5rem;
        max-width: 90%;
    }

    .modal-card h2 {
        font-size: 1.5rem;
    }

    /* Carousel: still 20vh on tablet */
    .showcase {
        min-height: 20vh;
        padding: 1.5rem 0;
    }

    .showcase-logo {
        font-size: 1.2rem;
    }

    .logo-group {
        gap: 5rem;
        padding-right: 5rem;
    }

    /* Use mobile images on tablet */
    #cave-dark {
        background-image: url('assets/images/cave-dark-mobile.webp');
        background-image: image-set(
            url('assets/images/cave-dark-mobile.webp') type('image/webp'),
            url('assets/images/Gemini_Generated_Image_gnpeqwgnpeqwgnpe.jpeg') type('image/jpeg')
        );
    }

    #cave-light {
        background-image: url('assets/images/cave-lit-mobile.webp');
        background-image: image-set(
            url('assets/images/cave-lit-mobile.webp') type('image/webp'),
            url('assets/images/Gemini_Generated_Image_z2xj1sz2xj1sz2xj.jpeg') type('image/jpeg')
        );
    }
}

/* === Responsive — Phone (480px) === */
@media (max-width: 480px) {
    .mobile-only { display: block; }
    .desktop-only { display: none; }

    :root {
        --flashlight-radius: 90px;
    }

    body {
        cursor: auto;
    }

    #cursor-dot, #flashlight-glow {
        display: none;
    }

    header {
        padding: var(--spacing-sm);
    }

    .logo {
        font-size: 1rem;
    }

    .nav-links {
        gap: var(--spacing-sm);
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    .hero {
        padding: 12vh var(--spacing-md) var(--spacing-sm);
        padding-bottom: calc(var(--spacing-md) + 16vh); /* Exactly clear the showcase */
        align-items: flex-start;
        justify-content: flex-start; /* Removed space-between so flex-grow works properly */
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        flex-grow: 1; /* Stretch to fill height */
        width: 100%;
    }

    .hero-body {
        margin-top: auto; 
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0; 
        padding-left: 0;
        width: 90%; /* Creates a centered block */
        display: flex;
        flex-direction: column;
        align-items: flex-start; /* Left align the contents inside the centered block */
    }

    .hero-title {
        font-size: clamp(2.4rem, 11vw, 3rem);
        line-height: 1.05;
        text-shadow: 0 4px 20px rgba(0,0,0,0.8);
    }

    .hero-description {
        font-size: 0.95rem;
        line-height: 1.6;
        text-shadow: 0 2px 10px rgba(0,0,0,0.8);
        max-width: 100%;
        margin-bottom: var(--spacing-md); 
        text-align: left; /* Explicitly keep left aligned */
    }

    .hero-actions {
        display: flex;
        align-items: center; 
        gap: var(--spacing-lg); 
        width: 100%;
        justify-content: flex-start; /* Keep button and text left aligned within the block */
    }

    .btn-primary {
        padding: 0.8rem 1.6rem;
        font-size: 0.9rem;
        width: auto;
        justify-content: center;
        letter-spacing: 0.05em;
    }

    .hero-footer {
        display: none; /* Hidden on mobile */
    }

    .hero-location {
        font-size: 0.75rem;
        letter-spacing: 0.15em;
    }

    .modal-card {
        padding: 1.5rem 1.2rem;
        border-radius: 8px;
    }

    .modal-card h2 {
        font-size: 1.3rem;
    }

    .modal-card p {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    /* Carousel: smaller on phone */
    .showcase {
        min-height: 16vh;
        padding: 1rem 0;
    }

    .showcase-label {
        font-size: 0.5rem;
        margin-bottom: 0.8rem;
    }

    .showcase-logo {
        font-size: 1rem;
        line-height: 2;
    }

    .logo-group {
        gap: 3rem;
        padding-right: 3rem;
    }

    .showcase-track {
        animation-duration: 12s;
    }
}

/* === Responsive — Small Phone (360px) === */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.6rem;
    }

    .hero-description {
        font-size: 0.82rem;
    }

    .showcase-logo {
        font-size: 0.85rem;
    }
}
