/* 
 * Responsive CSS - The Diplomatic Corps of Our Design
 * Where different screen sizes are treated with equal dignity
 * Like the UN, but actually functional and with fewer interpreters
 */

/* Calculator Interface - The professional transformation chamber */
.calculator-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(2vw + 20px);
}

.calc-header {
    text-align: center;
    margin-bottom: calc(2vw + 30px);
}

.calc-form {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns by default */
    gap: calc(1.5vw + 20px);
    margin-bottom: calc(2vw + 30px);
}

.calc-group {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border-radius: 4px;
    padding: calc(1.5vw + 20px);
    border: 1px solid rgba(45, 25, 65, 0.8);
}

.calc-group h3 {
    margin-bottom: calc(1vw + 15px);
    color: #ffffff;
    font-family: 'Fredericka the Great', serif;
}

.input-group {
    margin-bottom: calc(0.8vw + 12px);
}

.input-group label {
    display: block;
    margin-bottom: calc(0.3vw + 5px);
    color: #ffffff;
    font-size: calc(0.65rem + 0.2vw);
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3); /* Dark input background */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(45, 25, 65, 0.6);
    border-radius: 4px;
    padding: calc(0.5vw + 8px);
    color: #ffffff;
    font-family: 'Consolas', monospace; /* Monospace for precision */
    font-size: calc(0.6rem + 0.2vw);
    transition: all 0.3s ease; /* Smooth focus transitions */
}

.input-group input:focus {
    outline: none; /* Remove default browser outline */
    border-color: rgba(255, 0, 98, 0.6); /* Hot pink focus border */
    box-shadow: 0 0 0 2px rgba(255, 0, 98, 0.2); /* Subtle glow */
}

/* Result display styling */
.result-item {
    margin-bottom: calc(0.5vw + 8px);
    font-family: 'Consolas', monospace;
    font-size: calc(0.65rem + 0.2vw);
}

.result-label {
    color: rgba(255, 255, 255, 0.8); /* Slightly dimmed labels */
}

.result-value {
    color: #ffffff;
    font-weight: bold; /* Emphasis on values */
}

/* Tablet Landscape and Large Screens - Where everything looks spacious */
@media (min-width: 1200px) {
    .tile {
        max-width: 1400px; /* Prevent excessive width on very large screens */
    }
    
    .calc-form {
        gap: calc(2vw + 30px); /* More generous spacing */
    }
    
    .floating-particles {
        opacity: calc(var(--global-transition-progress, 0) * 0.6); /* More visible particles */
    }
}

/* Tablet Portrait and Medium Screens - The middle ground */
@media (max-width: 1024px) {
    body {
        font-size: calc(0.9rem + 0.3vw); /* Slightly larger base font */
    }
    
    .tile {
        padding: calc(3vw + 20px); /* Adjust padding */
        margin: calc(2vw + 10px) 0;
    }
    
    h1 {
        font-size: clamp(1.6rem, 5vw, 3rem); /* Responsive scaling */
    }
    
    h2 {
        font-size: clamp(1.1rem, 4vw, 2rem);
    }
    
    .code-container {
        padding: calc(2vw + 8px); /* Adjust code container padding */
        overflow-x: auto; /* Ensure horizontal scrolling for code */
    }
}

/* Standard Tablet and Small Laptop - The workhorse breakpoint */
@media (max-width: 768px) {
    .calc-form {
        grid-template-columns: 1fr; /* Single column layout */
        gap: calc(2vw + 15px);
    }
    
    .tile {
        width: calc(100vw - 20px); /* Account for body margins */
        padding: calc(4vw + 15px);
    }
    
    h1 {
        font-size: clamp(1.4rem, 6vw, 2.5rem);
    }
    
    .parallax-overlay {
        /* Use absolute positioning on mobile to avoid fixed position issues */
        position: absolute;
        /* Ensure it covers the full document height, not just viewport */
        height: 100%;
        min-height: 100vh;
        /* Disable will-change on mobile for better performance */
        will-change: auto;
    }
    
    .parallax-image {
        /* Mobile parallax - now with proper dimensions instead of wishful thinking */
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 120vh; /* Consistent with desktop - revolutionary idea */
        object-fit: cover;
        object-position: center top;
        /* Removed conflicting transform override - JavaScript can do its job now */
        /* Simplified filters for mobile because their processors are delicate flowers */
        filter: blur(0.5px) brightness(1.2) saturate(0.9) contrast(1.3) opacity(0.8);
        display: block;
        /* Re-enable GPU acceleration for mobile parallax */
        will-change: transform;
    }
    
    /* Adjust viewport height for mobile browsers */
    body {
        /* Use a more stable height calculation */
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height when supported */
    }
    
    /* Reduce particle complexity on mobile */
    .floating-particles {
        opacity: calc(var(--global-transition-progress, 0) * 0.2);
    }
    
    .particle {
        width: 1px;
        height: 1px;
        animation-duration: 30s; /* Slower animation for performance */
    }
    
    /* Simplify vignette on mobile */
    body::after {
        background: radial-gradient(circle at center, 
            transparent 0%, 
            transparent 70%, 
            rgba(0, 0, 0, calc(0.2 + var(--global-transition-progress, 0) * 0.2)) 100%);
    }
    
    /* Adjust button positioning for mobile */
    .back-button {
        top: 15px;
        left: 15px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .demo-button, .calc-button {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Large Phones and Small Tablets - The challenging middle ground */
@media (max-width: 600px) {
    .tile {
        margin: calc(3vw + 8px) 0;
        padding: calc(5vw + 12px);
    }
    
    .code-container {
        font-size: 0.75rem; /* Smaller code text for mobile */
        padding: 12px;
    }
    
    h1 {
        font-size: clamp(1.2rem, 7vw, 2rem);
        line-height: 1.1;
    }
    
    h2 {
        font-size: clamp(1rem, 5vw, 1.6rem);
    }
    
    p, li {
        font-size: calc(0.8rem + 0.2vw);
        line-height: 1.6;
    }
    
    .calc-group {
        padding: calc(3vw + 12px);
    }
    
    .input-group input {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Standard Phones - The final frontier */
@media (max-width: 480px) {
    .parallax-overlay {
        position: fixed;
        /* Static background fallback for very small screens */
        background: linear-gradient(45deg, 
            rgba(30, 15, 45, 0.9) 0%, 
            rgba(0, 0, 0, 0.8) 100%);
    }
    
    .parallax-image {
        display: none; /* Hide complex image on very small screens */
    }
    
    body {
        font-size: 1rem; /* Fixed size for very small screens */
    }
    
    .tile {
        width: calc(100vw - 10px); /* Minimal margins */
        padding: 15px;
        margin: 8px 0;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    h3 {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }
    
    .code-container {
        padding: 8px;
        font-size: 0.7rem;
        overflow-x: auto; /* Ensure code scrolling */
    }
    
    .calc-form {
        gap: 15px;
    }
    
    .calc-group {
        padding: 15px;
    }
    
    /* Simplify buttons for tiny screens */
    .demo-button, .calc-button {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 25px;
    }
    
    .back-button {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    /* Reduce visual complexity */
    .floating-particles {
        display: none; /* Hide particles on very small screens */
    }
    
    body::after {
        display: none; /* Remove vignette for performance */
    }
}

/* Ultra-wide screens - For the fortunate few */
@media (min-width: 1920px) {
    .container {
        max-width: 1800px;
        margin: 0 auto;
    }
    
    .tile {
        max-width: 1600px;
    }
    
    .floating-particles {
        opacity: calc(var(--global-transition-progress, 0) * 0.8); /* More dramatic effect */
    }
}

/* Print styles - Because someone always wants to print presentations */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .parallax-overlay,
    .floating-particles,
    .demo-button,
    .calc-button,
    .back-button {
        display: none !important; /* Hide interactive elements */
    }
    
    .tile {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        page-break-inside: avoid; /* Avoid breaking tiles across pages */
    }
    
    .code-container {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
    }
    
    h1, h2, h3, h4, p, li {
        color: black !important;
        text-shadow: none !important;
    }
}
