/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: var(--space-md);
    antialiased: true;
    min-height: 100vh;
}

/* Global Link Styles */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Parallax Background */
#parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 120vh;
    /* Taller than viewport for scrolling room */
    z-index: -1;

    background-image: url('../assets/jerryf.JPG');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;

    will-change: transform;
    /* Initial state handled by CSS, JS adds movement */
}

/* Loading Screen - Jellyfish & Ocean Theme */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #020024 0%, #090979 35%, #00d4ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    overflow: hidden;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.ocean {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Clione (Sea Angel) */
.clione-container {
    position: relative;
    animation: float 4s ease-in-out infinite;
}

.clione {
    position: relative;
    width: 60px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clione-head {
    width: 40px;
    height: 35px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50% 50% 40% 40%;
    position: relative;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.clione-antennae {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
}

.clione-antennae.left {
    left: 4px;
    transform: rotate(-20deg);
}

.clione-antennae.right {
    right: 4px;
    transform: rotate(20deg);
}

.clione-body {
    width: 30px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px 10px 15px 15px;
    position: relative;
    top: -5px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.clione-organs {
    width: 14px;
    height: 20px;
    background: radial-gradient(circle, #e74c3c, #c0392b);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
    opacity: 0.9;
}

.clione-wing {
    position: absolute;
    top: 30px;
    width: 35px;
    height: 18px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
    /* General shape, specific sides overridden below */
    border-radius: 75%;
    z-index: 3;
}

.clione-wing.left {
    left: -25px;
    transform-origin: right center;
    /* Root (Right) = Round. Tip (Left) = Pointed but soft. */
    /* top-left | top-right | bottom-right | bottom-left / ... */
    /* Right side (root) -> 50% (round) */
    /* Left side (tip) -> small radius (pointed) */
    border-radius: 20% 50% 50% 20% / 40% 50% 50% 40%;

    animation: flap-left 1s ease-in-out infinite alternate;
}

.clione-wing.right {
    right: -25px;
    background: linear-gradient(to left, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
    transform: none;
    transform-origin: left center;
    /* Mirror */
    /* Root is Left (TL, BL) -> 50% */
    /* Tip is Right (TR, BR) -> Tapered */
    border-radius: 50% 20% 20% 50% / 50% 40% 40% 50%;

    animation: flap-right 1s ease-in-out infinite alternate;
}

.clione-tail {
    width: 20px;
    height: 40px;
    background: rgba(255, 255, 255, 0.4);
    /* Root (Top) should be WIDE and ROUNDED (connection to body). */
    /* Tip (Bottom) should be tapered/pointed. */
    /* Top Left/Right: 50% (Round connection) */
    /* Bottom Left/Right: Tapered */
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;

    position: relative;
    top: -8px;
}

@keyframes flap-left {
    0% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(-40deg);
    }
}

@keyframes flap-right {
    0% {
        transform: rotate(-10deg);
    }

    100% {
        transform: rotate(40deg);
    }
}

/* White Dolphin */
.dolphin-orbit {
    position: absolute;
    width: 300px;
    height: 300px;
    animation: orbit 10s linear infinite;
    z-index: 10;
}

.dolphin {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(-1);
    width: 60px;
    height: 30px;
}

.dolphin-body {
    width: 60px;
    height: 25px;
    background: #ecf0f1;
    border-radius: 40% 60% 60% 40% / 50% 50% 50% 50%;
    position: relative;
    box-shadow: inset -2px -2px 5px rgba(0, 0, 0, 0.1);
}

.dolphin-tail {
    position: absolute;
    right: -10px;
    top: 8px;
    width: 15px;
    height: 10px;
    background: #ecf0f1;
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    transform: rotate(-10deg);
    animation: tail-wag 0.5s ease-in-out infinite alternate;
}

.dolphin-fin {
    position: absolute;
    top: -8px;
    left: 25px;
    width: 12px;
    height: 10px;
    background: #ecf0f1;
    border-radius: 50% 50% 0 0;
    transform: skewX(-20deg);
}

.dolphin-flipper {
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 12px;
    height: 8px;
    background: #bdc3c7;
    border-radius: 0 0 50% 50%;
    transform: skewX(20deg);
}

.dolphin-eye {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 3px;
    height: 3px;
    background: #2c3e50;
    border-radius: 50%;
}

/* Secondary Dolphin (Smaller, Inner Orbit) */
.dolphin-orbit.secondary {
    width: 200px;
    height: 200px;
    animation-duration: 7s;
    animation-direction: reverse;
    /* Swim counter-clockwise? No, keep flow */
    animation-direction: normal;
    animation-delay: -2s;
    /* Offset */
}

/* If orbit is smaller, dolphin should also be smaller */
.dolphin-orbit.secondary .dolphin {
    transform: translateX(-50%) scaleX(-1) scale(0.7);
    /* Note: transform order matters. 
       original: translateX(-50%) scaleX(-1) 
       new: translateX(-50%) scaleX(-1) scale(0.7) 
       This scales it down while keeping flip */
}

@keyframes orbit {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes tail-wag {
    from {
        transform: rotate(-10deg) translateY(0);
    }

    to {
        transform: rotate(10deg) translateY(2px);
    }
}

/* Bubbles */
.bubbles span {
    position: absolute;
    bottom: -50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100%;
    animation: rise 10s infinite ease-in;
}

.bubbles span:nth-child(1) {
    width: 20px;
    height: 20px;
    left: 10%;
    animation-duration: 8s;
}

.bubbles span:nth-child(2) {
    width: 30px;
    height: 30px;
    left: 25%;
    animation-duration: 12s;
    animation-delay: 2s;
}

.bubbles span:nth-child(3) {
    width: 15px;
    height: 15px;
    left: 40%;
    animation-duration: 6s;
    animation-delay: 4s;
}

.bubbles span:nth-child(4) {
    width: 25px;
    height: 25px;
    left: 60%;
    animation-duration: 9s;
    animation-delay: 1s;
}

.bubbles span:nth-child(5) {
    width: 10px;
    height: 10px;
    left: 80%;
    animation-duration: 7s;
    animation-delay: 3s;
}

/* --- Interactive Effects --- */

/* 1. Water Ripple */
.ripple {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%) scale(1);
    animation: ripple-anim 1s ease-out forwards;
    pointer-events: none;
    /* Pass clicks through */
    z-index: 19999;
}

@keyframes ripple-anim {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(5);
        /* Expand nicely */
        opacity: 0;
    }
}

/* 2. Cursor Bubble Trail */
.cursor-bubble {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4));
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    /* Above background (-1), but below content (which needs to be > 1) */
    transform: translate(-50%, -50%);
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
    animation: bubble-float 2s ease-in forwards;
}

@keyframes bubble-float {
    0% {
        transform: translate(-50%, -50%) translateY(0) translateX(0);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) translateY(-50px) translateX(var(--drift));
        opacity: 0;
    }
}

.bubbles span:nth-child(6) {
    width: 40px;
    height: 40px;
    left: 90%;
    animation-duration: 15s;
    animation-delay: 5s;
}

.loading-text {
    position: absolute;
    bottom: 20%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    33% {
        transform: rotate(10deg);
    }

    66% {
        transform: rotate(-10deg);
    }
}

@keyframes blink {

    0%,
    96%,
    100% {
        transform: scaleY(1);
    }

    98% {
        transform: scaleY(0.1);
    }
}

@keyframes rise {
    0% {
        bottom: -50px;
        transform: translateX(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        bottom: 100%;
        transform: translateX(-20px);
        opacity: 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Layout Container */
.container {
    max-width: 100%;
    margin: 0;
    padding: var(--space-sm);
}

/* Section Divider Styles */
.section-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 2px;
    width: 100%;
}

.section-divider span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.section-divider .divider-line {
    flex: 1;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
}

/* Split Grid for Main Content (Profile vs Projects) */
.split-grid {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.grid-col-left {
    flex: 1;
    min-width: 400px;
}

.grid-col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Breakpoints */
@media (max-width: 900px) {
    .split-grid {
        flex-direction: column;
    }

    .grid-col-left,
    .grid-col-right {
        width: 100%;
        min-width: 0;
        flex: none;
    }

    .profile-card {
        height: auto !important;
        min-height: 500px;
    }
}

/* Secondary "Admin" Section outside of main grid */
.secondary-section {
    margin-top: 2px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
}

/* Helper for JS-sized cards */
.project-card,
.contact-card {
    width: 100%;
}