/* =========================================
   HOUSE FRIEDMAN - ENGINEERING AT ANY SCALE
   Global Design Variables & Tokens
========================================= */
:root {
    --bg-dark: #0a0a0c;
    --surface-dark: rgba(20, 20, 25, 0.7);
    --surface-light: rgba(255, 255, 255, 0.03);
    --surface-glass: rgba(20, 20, 25, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    --text-main: #ffffff;
    --text-muted: #8892b0;
    
    --accent-cyan: #00f0ff;
    --accent-pink: #ff007f;
    --accent-glow: rgba(0, 240, 255, 0.3);
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono: 'Space Mono', monospace;
    
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================
   Reset & Base Elements
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Standalone IFrame Application Containers */
body.iframe-app {
    background-color: transparent;
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Immersive Background */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    opacity: 0.5;
    pointer-events: none;
}

.ambient-glow {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
    filter: blur(80px);
}

/* =========================================
   Typography & Emphasis
========================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.highlight-cyan {
    color: var(--accent-cyan);
    text-shadow: 0 0 15px var(--accent-glow);
}

/* =========================================
   Universal Scrollbar Styling
========================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* =========================================
   Glassmorphic Navigation
========================================= */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
    transition: var(--transition-smooth);
}

.nav-container {
    max-width: 95%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

.brand-logo {
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 2px;
}

.brand-logo .house { color: var(--text-main); }
.brand-logo .friedman { color: var(--accent-cyan); }

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    position: relative;
}

.nav-links a:hover {
    color: var(--accent-cyan);
}

.nav-links a:not(.btn-cyan)::after {
    content: '';
    position: absolute;
    width: 0%;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-cyan);
    transition: var(--transition-smooth);
}

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

.btn-cyan {
    border: 1px solid var(--accent-cyan);
    padding: 8px 20px;
    border-radius: 4px;
    background: rgba(0, 240, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.btn-cyan:hover {
    background: var(--accent-cyan);
    color: var(--bg-dark) !important;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

/* =========================================
   Dropdown Navigation
========================================= */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    width: 250px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    z-index: 1000;
    top: 100%;
    left: 0;
    padding: 10px 0;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s ease;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: rgba(0, 240, 255, 0.05);
    color: var(--accent-cyan);
    padding-left: 25px; /* Subtle indent animation */
}

/* Override global nav underline for dropdown links */
.dropdown-content a::after {
    display: none !important;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease forwards;
}

/* =========================================
   Layout & Content Wrappers
========================================= */
.content-wrapper {
    flex: 1;
    margin-top: 100px; /* offset for nav */
    max-width: 95%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0 30px 60px 30px;
}

/* =========================================
   Hero Section
========================================= */
.hero-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    align-items: center;
}

.sub-heading {
    font-family: var(--font-sans);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 4px;
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.main-heading {
    font-size: 4.5rem;
    margin-bottom: 30px;
}

.hero-description {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 40px;
}

.hero-actions {
    display: flex;
    gap: 20px;
}

.btn-primary {
    display: inline-block;
    padding: 14px 30px;
    background: var(--accent-cyan);
    color: var(--bg-dark);
    text-decoration: none;
    font-weight: 700;
    font-family: var(--font-heading);
    border-radius: 4px;
    transition: var(--transition-smooth);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    display: inline-block;
    padding: 14px 30px;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
}

/* =========================================
   Tesseract Omni-Swarm
========================================= */
.swarm-container { position: relative; width: 100%; height: 100%; min-height: 400px; display: flex; justify-content: center; align-items: center; perspective: 1200px; transform-style: preserve-3d; }
.cube-drifter { position: absolute; width: 60px; height: 60px; top: calc(50% - 30px); left: calc(50% - 30px); transform-style: preserve-3d; }

.cube { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; }
.cube-face { position: absolute; width: 100%; height: 100%; border: 1px solid currentColor; background: rgba(255, 255, 255, 0.02); box-shadow: inset 0 0 15px currentColor; }

.face-front  { transform: translateZ(30px); }
.face-back   { transform: rotateY(180deg) translateZ(30px); }
.face-right  { transform: rotateY(90deg) translateZ(30px); }
.face-left   { transform: rotateY(-90deg) translateZ(30px); }
.face-top    { transform: rotateX(90deg) translateZ(30px); }
.face-bottom { transform: rotateX(-90deg) translateZ(30px); }

@keyframes cube-spin { from { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); } to { transform: rotateX(360deg) rotateY(720deg) rotateZ(180deg); } }

/* Vector Field Mappings */
.c1 .cube { animation: cube-spin 15s infinite linear; }
.c1 .cube-face { color: var(--accent-cyan); }
.cube-drifter.c1 { animation: drift-1 14s infinite ease-in-out alternate; z-index: 5; }
@keyframes drift-1 { 0% { transform: translate3d(-200px, -150px, -50px) scale(0.8); } 100% { transform: translate3d(200px, 150px, 100px) scale(1.3); } }

.c2 .cube { animation: cube-spin 12s infinite linear reverse; }
.c2 .cube-face { color: var(--accent-pink); }
.cube-drifter.c2 { animation: drift-2 18s infinite ease-in-out alternate; z-index: 2; }
@keyframes drift-2 { 0% { transform: translate3d(150px, -200px, -150px) scale(0.5); } 100% { transform: translate3d(-150px, 200px, 50px) scale(1.1); } }

.c3 .cube { animation: cube-spin 20s infinite linear; }
.c3 .cube-face { color: var(--accent-blue); }
.cube-drifter.c3 { animation: drift-3 22s infinite ease-in-out alternate; z-index: 6; }
@keyframes drift-3 { 0% { transform: translate3d(-150px, 150px, -100px) scale(1.5); } 100% { transform: translate3d(180px, -100px, -200px) scale(0.6); } }

.c4 .cube { animation: cube-spin 18s infinite linear reverse; }
.c4 .cube-face { color: #00ffaa; }
.cube-drifter.c4 { animation: drift-4 16s infinite ease-in-out alternate; z-index: 4; }
@keyframes drift-4 { 0% { transform: translate3d(200px, 50px, 150px) scale(0.7); } 100% { transform: translate3d(-200px, -50px, -100px) scale(1.2); } }

.c5 .cube { animation: cube-spin 25s infinite linear; }
.c5 .cube-face { color: #ffaa00; }
.cube-drifter.c5 { animation: drift-5 25s infinite ease-in-out alternate; z-index: 1; }
@keyframes drift-5 { 0% { transform: translate3d(0, 200px, -200px) scale(0.4); } 100% { transform: translate3d(0, -200px, 100px) scale(1.6); } }

.c6 .cube { animation: cube-spin 10s infinite linear reverse; }
.c6 .cube-face { color: #aa00ff; }
.cube-drifter.c6 { animation: drift-6 12s infinite ease-in-out alternate; z-index: 3; }
@keyframes drift-6 { 0% { transform: translate3d(-250px, 0, 50px) scale(1.1); } 100% { transform: translate3d(250px, 0, -250px) scale(0.5); } }

/* =========================================
   Featured Projects Grid
========================================= */
.featured-overview {
    padding-top: 60px;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 10px;
}

.section-header .divider {
    width: 50px;
    height: 3px;
    background: var(--accent-cyan);
    margin-bottom: 40px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.project-card {
    background: var(--surface-dark);
    border: 1px solid var(--border-glass);
    padding: 40px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.project-card h4 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.project-card p {
    color: var(--text-muted);
    font-size: 1rem;
    position: relative;
    z-index: 2;
}

.card-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: var(--accent-cyan);
    filter: blur(80px);
    opacity: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: var(--transition-smooth);
    z-index: 1;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
}

.project-card:hover .card-glow {
    opacity: 0.15;
}

/* =========================================
   Footer
========================================= */
footer {
    border-top: 1px solid var(--border-glass);
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

/* =========================================
   Utility Animations
========================================= */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-links a.active { color: var(--accent-cyan); border-bottom: 2px solid var(--accent-cyan); }


/* Select Inputs Fix */
select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}
