/**
 * Portfolio CSS - Custom styles for Frank Lisk portfolio
 *
 * Uses 6-layer hero structure (back to front):
 * - Layer 0 (z-0): CSS gradient background (green → orange)
 * - Layer 1 (z-1): sun.png - orange sun circle
 * - Layer 2 (z-2): mountain_clouds.svg - cream clouds and mountain outline
 * - Layer 3 (z-3): hills.svg - green rolling hills
 * - Layer 4 (z-4): frank-portrait-transparent.svg - illustrated portrait
 * - Layer 5 (z-5): Text content overlay
 */

/* ========================================
   Hero Section - 6-Layer Structure
   ======================================== */

/* Hero scaling - single variable controls sun/portrait proportionally */
:root {
    --hero-base: clamp(800px, calc(400px + 50vw), 950px);
}

#hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* Layer 1: CSS Gradient Background - colors from mockup */
.hero-gradient {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(to bottom,
        #1B5E3B 0%,      /* green at top */
        #A5542E 40%      /* orange starts at 40% */
    );
}

/* Layer 2: Sun - bottom-aligned behind head */
.hero-sun {
    position: absolute;
    z-index: 1;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    width: var(--hero-base);
    pointer-events: none;
}

.hero-sun img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
}

/* Layer 3: Clouds/Mountains */
.hero-clouds {
    position: absolute;
    z-index: 2;
    bottom: 15%;
    left: 0;
    right: 0;
    width: 100%;
    pointer-events: none;
}

.hero-clouds img {
    width: 100%;
    height: auto;
    display: block;
}

/* Layer 4: Hills */
.hero-hills {
    position: absolute;
    z-index: 3;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    pointer-events: none;
}

.hero-hills img {
    width: 100%;
    height: auto;
    display: block;
}

/* Layer 5: Portrait - THE CENTRAL FOCUS, bottom-aligned */
.hero-portrait {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: calc(var(--hero-base) * 1.15);  /* 15% larger than sun */
    pointer-events: none;
}

.hero-portrait img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: bottom;
    display: block;
    filter: drop-shadow(0 20px 40px rgba(15, 41, 24, 0.4));
}

/* Layer 5.5: Orange gradient overlay at bottom (inside hero-portrait, but full viewport width) */
.hero-overlay {
    position: absolute;
    z-index: 1;  /* Above img, below content */
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;  /* Full viewport width */
    height: 30%;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(165, 84, 46, 0.98) 100%
    );
    pointer-events: none;
}

/* Layer 6: Content - positioned relative to portrait (inside .hero-portrait) */
.hero-content {
    position: absolute;
    bottom: 3%;
    left: 0;
    right: 0;
    z-index: 2;  /* Above overlay (z-index: 1) */
    pointer-events: auto;  /* Re-enable clicks (portrait has pointer-events: none) */
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.65),
        0 4px 12px rgba(0, 0, 0, 0.45),
        0 8px 24px rgba(0, 0, 0, 0.3);
}

.hero-content * {
    position: relative;
    z-index: 5;
}

/* Hero title - fluid scaling with clamp */
.hero-title {
    font-size: clamp(2.25rem, calc(1rem + 4vw), 3.375rem);
    /* min: 36px, fluid scaling, max: 54px */
}

@media (min-width: 768px) {
    .hero-title {
        font-size: clamp(3.375rem, calc(2rem + 3vw), 4.0625rem);
        /* md+: min 54px, fluid, max 65px */
    }
}

/* Responsive - Mobile (< 640px) */
@media (max-width: 639px) {
    .hero-content {
        bottom: 4%;
    }
}

/* ========================================
   Menu Drawer Animation
   ======================================== */

#menu-drawer {
    will-change: transform;
}

#menu-drawer.open {
    transform: translateX(0);
}

#menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Menu toggle button (FL tag logo) */
.menu-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.menu-toggle-btn:hover {
    transform: scale(1.1);
}

.menu-toggle-logo {
    height: clamp(60px, calc(40px + 4vw), 80px);
    width: auto;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25))
            drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease;
}

/* Rotate logo 90° when menu is open */
#menu-toggle.active .menu-toggle-logo {
    transform: rotate(90deg);
}

/* Sidebar nav links */
.nav-link {
    display: block;
}

.nav-link:hover {
    text-decoration: underline;
}

.nav-link.main-link {
    padding: 1rem 0;
    font-size: 1.875rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 1);
}

@media (min-width: 640px) {
    .nav-link.main-link {
        font-size: 2.25rem;
    }
}

.nav-link.private-link {
    padding: 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 300;
    color: rgba(193, 156, 65, 0.9);
}

/* ========================================
   Custom List Styling
   ======================================== */

.styled-list {
    list-style: none;
    padding-left: 0;
}

.styled-list li {
    position: relative;
    padding-left: 1.5rem;
}

.styled-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    background: #D5C994;
    transform: rotate(45deg);
}

.styled-list.subtle li::before {
    background: rgba(255, 255, 255, 0.6);
    width: 5px;
    height: 5px;
}

/* ========================================
   CTA Button Enhancement
   ======================================== */

.cta-btn {
    position: relative;
    overflow: hidden;
}

.cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.cta-btn:hover::before {
    transform: translateX(100%);
}

/* ========================================
   Section Transitions
   ======================================== */

section {
    scroll-margin-top: 2rem;
}

/* Subtle section divider */
section:not(#hero)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

/* ========================================
   Scroll Indicator Animation
   ======================================== */

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) translateX(-50%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-25%) translateX(-50%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* ========================================
   Responsive Adjustments
   ======================================== */

/* Mobile adjustments - TODO after desktop is finalized */
/* @media (max-width: 639px) { } */

/* Ensure no horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ========================================
   Loading State
   ======================================== */

.hero-portrait img {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    animation-delay: 0.3s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .hero-layer,
    .hero-portrait,
    #menu-toggle,
    #menu-drawer,
    #menu-overlay {
        display: none;
    }

    #hero {
        min-height: auto;
        padding: 2rem;
        background: #fff;
        color: #000;
    }

    .hero-content {
        text-shadow: none;
    }
}
