/**
 * ALEXANDER BURTON'S PORTFOLIO STYLESHEET
 * 
 * THEME: Matrix/Terminal Cyberpunk Aesthetic
 *   - Dark backgrounds (black, dark greys)
 *   - Neon green accent (#00ff41) - mimics vintage terminal
 *   - Glowing effects & monospace font
 *   - Performance optimized for mobile
 * 
 * STRUCTURE:
 *   1. CSS Custom Properties (color palette, spacing, shadows)
 *   2. Base elements (body, header, main, footer)
 *   3. Navigation menu (bubble button, dropdown, items)
 *   4. Volume control slider
 *   5. Responsive design (mobile, tablet, desktop)
 * 
 * DESIGN SYSTEM:
 *   Colors use CSS variables (:root) for easy theme switching
 *   All transitions use 0.3-0.4s ease for smooth animations
 *   z-index: 1000 reserved for menu (stays above all content)
 */

/* ═══════════════════════════════════════════════════════════════════════════
   DESIGN SYSTEM: Color Palette & Custom Properties
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    /* PRIMARY COLORS */
    --primary-green: #00ff41;           /* Neon green accent (matrix theme) */
    
    /* BACKGROUND COLORS (darkest to lightest) */
    --black: #000000;                   /* Pure black - body background */
    --dark-grey-dark: #1a1a1a;          /* Almost black - deep backgrounds */
    --dark-grey: #2a2a2a;               /* Dark grey - primary backgrounds */
    --dark-grey-light: #3a3a3a;         /* Lighter grey - secondary backgrounds */
    
    /* TYPOGRAPHY */
    --font-mono: 'Courier New', monospace;  /* Monospace for matrix aesthetic */
    
    /* SHADOWS / GLOW EFFECTS (box-shadow values) */
    /* Format: "blur-radius X Y offset" for colored shadows */
    --glow-sm: 0 0 10px;                /* Subtle glow */
    --glow-md: 0 0 15px;                /* Medium glow */
    --glow-lg: 0 0 20px;                /* Large glow */
    --glow-xl: 0 0 30px;                /* Extra large glow (hover effects) */
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE ELEMENTS: Page layout & typography
   ═══════════════════════════════════════════════════════════════════════════ */

body {
    background-color: var(--black);     /* Pure black background */
    color: var(--primary-green);        /* Green text (optional) */
    margin: 0;
    padding: 0;
    font-family: var(--font-mono);
    
    /* Mobile optimizations */
    overflow-x: hidden;                 /* Prevent horizontal scroll on mobile */
    -webkit-text-size-adjust: 100%;     /* Prevent text zoom on device rotate */
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION: Menu bubble & dropdown
   ═══════════════════════════════════════════════════════════════════════════ */

/**
 * .navbar
 *   Container for menu button and dropdown
 *   Fixed position (top-left corner)
 *   z-index: 1000 ensures menu stays above all page content
 */
.navbar {
    position: fixed;
    top: 20px;                          /* 20px from top */
    left: 20px;                         /* 20px from left */
    z-index: 1000;                      /* Above all content */
    touch-action: manipulation;         /* Mobile: disable double-tap zoom */
    transform: none !important;         /* Override any inherited transforms */
}

/**
 * .menu-bubble
 *   The circular "Nav" button in top-left
 *   Shows/hides menu dropdown on click
 * 
 * STATES:
 *   Default: visible, shows "Nav" text
 *   :hover: glows brighter, scales up 1.1x
 *   .active: becomes invisible (menu open, button hides)
 */
.menu-bubble {
    width: 125px;
    height: 50px;
    border-radius: 12px;
    
    /* Gradient background: lighter top to darker bottom */
    background: linear-gradient(135deg, var(--dark-grey) 0%, var(--dark-grey-dark) 100%);
    
    color: var(--primary-green);        /* Green text */
    border: 1px solid rgba(0, 255, 65, 0.3);  /* Semi-transparent green border */
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-mono);
    
    /* Flexbox: center the "Nav" text */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    
    /* Animations */
    transition: all 0.3s ease;
    box-shadow: var(--glow-lg) rgba(0, 255, 65, 0.3);  /* Subtle green glow */
    
    /* Box model */
    box-sizing: border-box;
    
    /* Mobile optimizations */
    -webkit-tap-highlight-color: transparent;  /* Hide tap highlight on iOS */
    touch-action: manipulation;                 /* Faster tap response */
    user-select: none;
    -webkit-user-select: none;
    
    /* Force consistent sizing across all browsers/pages */
    width: 125px !important;
    height: 50px !important;
    font-size: 20px !important;
}

/* Hover effect: brighter glow and scale */
.menu-bubble:hover {
    box-shadow: var(--glow-xl) rgba(0, 255, 65, 0.5);  /* Brighter glow */
    transform: scale(1.1);                              /* Slightly larger */
}

/* Active state: button hides when menu is open */
.menu-bubble.active {
    opacity: 0;                         /* Make invisible */
    pointer-events: none;               /* Don't capture clicks */
}

/**
 * .menu-dropdown
 *   Container for menu items (Home, About, etc.)
 *   Appears below/right of menu button
 *   Hidden by default, scales in when .active
 * 
 * STATES:
 *   Default: display: none, opacity: 0, scale: 0 (invisible)
 *   .active: display: flex, opacity: 1, scale: 1 (visible, animated)
 */
.menu-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    
    /* Vertical list layout */
    display: none;                      /* Hidden by default */
    flex-direction: column;
    gap: 10px;                          /* Space between menu items */
    
    /* Animation setup */
    opacity: 0;                         /* Invisible */
    transform: scale(0);                /* Shrunk to nothing */
    transform-origin: top left;         /* Scale from top-left corner */
    transition: all 0.4s ease;          /* Smooth 0.4s animation */
}

/* When menu button clicked, apply .active class */
.menu-dropdown.active {
    display: flex;                      /* Show menu items */
    opacity: 1;                         /* Fade in */
    transform: scale(1);                /* Grow to full size */
}

/**
 * .menu-item
 *   Individual menu item (Home, About me, Software, etc.)
 *   Can be <a> (link) or <button> (action)
 * 
 * BEHAVIOR:
 *   Clicking link closes menu and navigates
 *   Clicking button (mute, writer mode) keeps menu open
 */
.menu-item {
    display: block !important;
    width: 360px !important;
    padding: 12px;
    white-space: normal;
    word-wrap: break-word;
    
    /* Gradient background matching menu-bubble */
    background: linear-gradient(135deg, var(--dark-grey) 0%, var(--dark-grey-dark) 100%);
    
    color: var(--primary-green);        /* Green text */
    border: 1px solid rgba(0, 255, 65, 0.2);  /* Subtle green border */
    border-radius: 8px;
    
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    
    /* Remove default button styling */
    text-decoration: none;
    text-align: center;
    
    /* Animations */
    transition: all 0.3s ease;
    
    /* Box model */
    box-sizing: border-box;
}

.menu-item:hover {
    background: linear-gradient(135deg, var(--dark-grey-light) 0%, var(--dark-grey) 100%);
    box-shadow: var(--glow-md) rgba(0, 255, 65, 0.8);
    transform: scale(1.05);
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.9);
}

.menu-title {
    order: -1;
}

#writerModeToggle {
    position: absolute;
    left: 156px;
    top: 0;
    width: 160px !important;
}

.volume-control {
    position: absolute;
    left: 156px;
    top: 301px;
    height: 48px;
    width: 120px;
    background: linear-gradient(135deg, var(--dark-grey) 0%, var(--dark-grey-dark) 100%);
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    box-shadow: var(--shadow-sm) rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 65, 0.3);
    z-index: 1001;
}

.volume-control.visible {
    display: flex;
}

.volume-slider {
    width: 100%;
    height: 4px;
    background: rgba(0, 255, 65, 0.3);
    outline: none;
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-green);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 255, 65, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-green);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0 6px rgba(0, 255, 65, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-title {
    color: var(--primary-green);
    font-size: 50px;
    font-family: var(--font-mono);
    margin-top: 20px;
    margin-bottom: 18px;
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.8), var(--glow-md) rgba(0, 255, 65, 0.6);
    font-weight: bold;
    text-align: center;
    /* Responsive padding for mobile */
    padding: 0 20px;
}

main {
    color: var(--primary-green);
    text-shadow: var(--glow-sm) var(--primary-green), var(--glow-md) var(--primary-green);
    font-family: var(--font-mono);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* Mobile padding to prevent content from touching edges */
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

/* Homepage image styling removed */

/* About page gallery */
.about-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px 0 60px;
}

.about-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

/* Social icon links with hover glow */
.about-gallery a {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.about-gallery a:hover .about-img {
    box-shadow: var(--glow-lg) rgba(0, 255, 65, 0.8);
    transform: scale(1.1);
}

/* Copy tooltip (hidden by default, shown via JS .visible class on desktop only) */
.copy-tooltip {
    display: none;
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-grey);
    color: var(--primary-green);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--primary-green);
    font-weight: bold;
    box-shadow: var(--glow-sm) rgba(0, 255, 65, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.copy-tooltip:hover {
    background: var(--dark-grey-light);
    box-shadow: var(--glow-sm) rgba(0, 255, 65, 0.6);
}

/* Show tooltip when JS adds .visible class (desktop only via @media hover) */
@media (hover: hover) {
    .copy-tooltip.visible {
        display: block;
    }
}

.about-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--primary-green);
    box-shadow: var(--glow-sm) rgba(0,255,65,0.2);
    transition: all 0.3s ease;
}

.about-portrait {
    display: block;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 3px solid var(--primary-green);
    box-shadow: var(--glow-md) rgba(0,255,65,0.2);
}

.portrait-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 0;
}

.about-intro {
    max-width: 800px;
    color: var(--primary-green);
    text-align: center;
    font-size: 18px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 38px;
    }
    
    main {
        padding: 15px;
    }
    
    .navbar {
        top: 15px;
        left: 15px;
    }
    
    /* Slightly larger touch targets on tablets */
    .menu-item {
        padding: 14px !important;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 30px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    main {
        padding: 10px;
        font-size: 16px;
        line-height: 1.5;
    }
    
    .navbar {
        top: 10px;
        left: 10px;
    }
    
    /* Ensure touch targets meet accessibility standards (44x44px minimum) */
    .menu-bubble {
        width: 70px !important;
        height: 44px !important;
        font-size: 18px !important;
    }
    
    .menu-item {
        width: 110px !important;
        padding: 14px 10px !important;
        font-size: 16px !important;
        min-height: 44px;
    }
    
    .about-img {
        width: 72px;
        height: 72px;
    }
    
    .about-intro {
        padding: 0 12px;
        font-size: 16px;
    }
    
    .about-gallery {
        gap: 12px;
    }
    
    /* Make duck more visible and easier to tap on mobile */
    #draggableDuck {
        width: 60px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
}

/* Force consistent menu item sizing */
.menu-item {
    width: 150px !important;
    padding: 12px !important;
    font-size: 18px !important;
}

/* Ensure images are responsive */
main img {
    max-width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

/* Improve link tap targets on mobile */
a {
    -webkit-tap-highlight-color: rgba(0, 255, 65, 0.2);
    touch-action: manipulation;
}

/* Prevent zoom on input focus (if you add forms later) */
input, textarea, select {
    font-size: 18px;
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Portfolio Tile Styles */
.portfolio-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.portfolio-tile {
    width: 100%;
    max-width: 500px;
    background: var(--dark-grey-dark);
    border: 2px solid var(--primary-green);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--glow-sm) rgba(0, 255, 65, 0.3);
    transition: all 0.3s ease;
}

.portfolio-tile:hover {
    box-shadow: var(--glow-xl) rgba(0, 255, 65, 0.8);
    transform: translateY(-5px) scale(1.02);
}

.tile-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--black);
}

.tile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.4s ease;
}

.tile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.tile-image-container:hover .tile-image {
    opacity: 0;
}

.tile-image-container:hover .tile-overlay {
    opacity: 1;
    pointer-events: auto;
}

.tile-description {
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    margin: 0;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.6);
    max-width: 90%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tile-footer {
    padding: 15px 20px;
    background: var(--dark-grey);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.tile-link {
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: bold;
    text-decoration: underline;
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.6);
    transition: all 0.2s ease;
    cursor: pointer;
}

.tile-link:hover {
    color: var(--primary-green);
    text-shadow: var(--glow-md) rgba(0, 255, 65, 0.9);
    text-decoration: underline;
}

.tile-tech {
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: 18px;
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.6);
}

/* Responsive adjustments for portfolio tiles */
@media (max-width: 768px) {
    .portfolio-grid {
        gap: 20px;
        padding: 15px;
    }
    
    .tile-description {
        font-size: 15px;
        padding: 15px;
    }
    
    .tile-link {
        font-size: 18px;
    }
    
    .tile-tech {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .portfolio-grid {
        gap: 15px;
        padding: 10px;
    }
    
    .tile-description {
        font-size: 14px;
        padding: 10px;
    }
    
    .tile-footer {
        padding: 12px 15px;
    }
    
    .tile-link {
        font-size: 17px;
    }
    
    .tile-tech {
        font-size: 15px;
    }
}

/* Journey/Blog Post Styles */
.journey-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.journey-post {
    margin-bottom: 40px;
    border: 2px solid #7722dd;
    border-radius: 8px;
    background: rgba(119, 34, 221, 0.1);
    overflow: hidden;
}

.post-header {
    background: linear-gradient(135deg, #7722dd 0%, #6600cc 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.3s ease;
}

.post-header:hover {
    background: linear-gradient(135deg, #8833ee 0%, #7711dd 100%);
    box-shadow: var(--glow-sm) rgba(119, 34, 221, 0.6);
}

.post-title {
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: bold;
    margin: 0;
    text-shadow: var(--glow-sm) rgba(0, 255, 65, 0.6);
}

.post-date {
    color: rgba(0, 255, 65, 0.95);
    font-family: var(--font-mono);
    font-size: 16px;
    font-style: italic;
}

.post-body {
    padding: 25px 30px;
    color: var(--primary-green);
    font-family: var(--font-mono);
    line-height: 1.8;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.journey-post.collapsed .post-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.post-body p {
    margin: 0 0 15px 0;
    text-align: left;
}

.post-body p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .journey-container {
        padding: 15px;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post-title {
        font-size: 22px;
    }
    
    .post-body {
        padding: 20px 15px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .post-title {
        font-size: 20px;
    }
    
    .post-date {
        font-size: 14px;
    }
    
    .post-body {
        padding: 15px 12px;
        font-size: 13px;
        line-height: 1.6;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIDEO MODAL: Popup player with fullscreen support
   ═══════════════════════════════════════════════════════════════════════════ */

.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    background-color: var(--dark-grey);
    border: 2px solid var(--primary-green);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--glow-xl) rgba(0, 255, 65, 0.4);
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--black);
}

.video-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    font-size: 32px;
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 2001;
    transition: all 0.3s ease;
}

.video-close-btn:hover {
    background-color: var(--primary-green);
    color: var(--black);
    box-shadow: var(--glow-md) rgba(0, 255, 65, 0.6);
}

.video-fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 70px;
    background-color: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 2001;
    transition: all 0.3s ease;
    font-weight: bold;
}

.video-fullscreen-btn:hover {
    background-color: var(--primary-green);
    color: var(--black);
    box-shadow: var(--glow-md) rgba(0, 255, 65, 0.6);
}

.video-info {
    padding: 20px;
    background-color: var(--dark-grey-dark);
    border-top: 1px solid rgba(0, 255, 65, 0.2);
    color: var(--primary-green);
}

.video-info h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--primary-green);
    font-family: var(--font-mono);
}

.video-info p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(0, 255, 65, 0.8);
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIDEO PROJECT TILE: Enhanced hover for expandable descriptions
   ═══════════════════════════════════════════════════════════════════════════ */

.portfolio-tile.video-project {
    cursor: pointer;
}

.portfolio-tile.video-project:hover {
    transform: scale(1.02);
}

.video-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 300px;
}

.video-overlay .tile-description {
    max-height: 100%;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
}

.video-overlay a {
    color: var(--primary-green);
    text-decoration: underline;
    transition: all 0.3s ease;
}

.video-overlay a:hover {
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}

@media (max-width: 768px) {
    .video-modal {
        padding: 10px;
    }

    .video-modal-content {
        max-width: 100%;
    }

    .video-close-btn,
    .video-fullscreen-btn {
        font-size: 20px;
        width: 40px;
        height: 40px;
        top: 10px;
    }

    .video-close-btn {
        right: 10px;
    }

    .video-fullscreen-btn {
        right: 55px;
    }

    .video-info {
        padding: 15px;
    }

    .video-info h3 {
        font-size: 15px;
    }

    .video-info p {
        font-size: 12px;
    }
}