/* Base Variables and Scale */
:root {
    /* Color Strategy: Restrained Dark / Midnight Hedge Fund */
    --bg-color: #0b0c0f;
    --surface-color: #121318;
    --surface-elevated: #1a1b22;
    --text-primary: #e8e9ec;
    --text-secondary: #8b8d96;
    --text-muted: #51545e;
    --accent-color: #ed1c24; /* Red Boulder Red */
    --accent-hover: #c9151c;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --focus-ring: rgba(237, 28, 36, 0.4);

    /* Typography: 16px base, modular scale 1.25 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Instrument Serif', 'Playfair Display', Georgia, serif;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.563rem;
    --text-2xl: 1.953rem;
    --text-3xl: 2.441rem;
    
    /* Fluid display size for the massive hero text */
    --text-display: clamp(3rem, 6vw + 1rem, 6rem);

    /* 4pt Spacing Scale */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
    --space-24: 6rem;    /* 96px */
    --space-32: 8rem;    /* 128px */

    /* Easing Curves */
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Hide scrollbar cross-browser */
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow: hidden;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-sans);
    line-height: 1.5;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Subtle radial gradient to give depth to the dark background */
    background: radial-gradient(circle at 50% 0%, #15161d 0%, var(--bg-color) 60%);
}

/* Texture Overlay */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Typography Enhancements */
h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    line-height: 1.1;
    text-wrap: balance;
}

/* Header & Logo */
.site-header {
    padding: var(--space-8) var(--space-12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    mix-blend-mode: exclusion; /* Cool effect for scrolling over content */
}

.logo-container {
    width: 240px;
    transition: transform 0.8s var(--ease-out-expo);
    transform-origin: left center;
}

.brand-logo {
    width: 100%;
    height: auto;
    display: block;
}

/* When scrolled, we can shrink the logo slightly */
.is-scrolled .logo-container {
    transform: scale(0.8);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

.ghost-btn {
    font-size: var(--text-sm);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: var(--space-3) var(--space-6);
    position: relative;
    color: var(--text-secondary);
    transition: color 300ms var(--ease-out-quart);
}

.ghost-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-6);
    right: var(--space-6);
    height: 1px;
    background-color: var(--text-secondary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 300ms var(--ease-out-quart), background-color 300ms var(--ease-out-quart);
}

.ghost-btn:hover {
    color: var(--text-primary);
}

.ghost-btn:hover::after {
    transform: scaleX(1);
    transform-origin: left;
    background-color: var(--text-primary);
}

.primary-btn {
    background-color: var(--text-primary);
    color: var(--bg-color);
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: 100%;
    transition: transform 300ms var(--ease-out-quart), background-color 300ms var(--ease-out-quart);
}

.primary-btn:hover {
    background-color: #ffffff;
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Hero Section */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 var(--space-12);
    margin-top: var(--space-32);
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.display-title {
    font-size: var(--text-display);
    letter-spacing: -0.02em;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.display-title .line {
    display: block;
}

/* To give it an editorial feel, we indent the second line slightly */
.display-title .line:last-child {
    padding-left: 10%;
    color: var(--text-secondary);
    font-style: italic;
}

.subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    max-width: 65ch;
    font-weight: 300;
    line-height: 1.6;
    padding-left: 2px; /* Optical alignment */
}

/* Footer */
.site-footer {
    padding: var(--space-8) var(--space-12);
    text-align: right;
    font-size: var(--text-xs);
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Cinematic Modal / Takeover */
.takeover-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    visibility: hidden;
    pointer-events: none;
}

.takeover-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

.takeover-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(11, 12, 15, 0.4);
    backdrop-filter: blur(0px);
    opacity: 0;
    transition: opacity 500ms var(--ease-out-quart), backdrop-filter 500ms var(--ease-out-quart);
}

.takeover-modal.is-open .takeover-backdrop {
    opacity: 1;
    backdrop-filter: blur(12px);
}

.takeover-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    background-color: var(--surface-color);
    border-left: 1px solid var(--border-color);
    height: 100%;
    padding: var(--space-12) var(--space-8);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 500ms var(--ease-out-expo);
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.takeover-modal.is-open .takeover-panel {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-12);
}

.panel-header h2 {
    font-size: var(--text-2xl);
    color: #ffffff;
}

.close-btn {
    color: var(--text-secondary);
    padding: var(--space-2);
    margin: calc(var(--space-2) * -1); /* Increase touch target */
    transition: color 200ms ease;
}

.close-btn:hover {
    color: #ffffff;
}

/* Form Styles */
.consultation-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
}

label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: inherit;
    padding: var(--space-3) 0;
    transition: border-color 300ms var(--ease-out-quart);
    border-radius: 0;
}

input::placeholder {
    color: var(--text-muted);
}

input:focus {
    outline: none;
    border-bottom-color: var(--text-primary);
}

/* Invalid state handling for company email */
input:not(:placeholder-shown):invalid {
    border-bottom-color: var(--accent-color);
}

.error-msg {
    display: none;
    color: var(--accent-color);
    font-size: var(--text-sm);
    position: absolute;
    bottom: calc(var(--space-6) * -1);
}

input:not(:placeholder-shown):invalid ~ .error-msg {
    display: block;
    animation: fadeIn 300ms var(--ease-out-quart);
}

.form-actions {
    margin-top: var(--space-4);
}

.success-message {
    display: none;
    color: #ffffff;
    font-size: var(--text-base);
    line-height: 1.6;
    padding: var(--space-6);
    background-color: var(--surface-elevated);
    border: 1px solid var(--border-color);
}

.success-message.is-visible {
    display: block;
    animation: fadeUpIn 500ms var(--ease-out-quart) forwards;
}

/* Entrance Animations */
.reveal-on-load {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUpIn 800ms var(--ease-out-expo) forwards;
    animation-delay: calc(var(--delay) * 150ms);
}

@keyframes fadeUpIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .site-header {
        padding: var(--space-6);
    }
    
    .logo-container {
        width: 180px;
    }
    
    .hero {
        padding: 0 var(--space-6);
    }
    
    .site-footer {
        padding: var(--space-6);
        text-align: center;
    }
    
    .takeover-panel {
        max-width: 100%;
        padding: var(--space-8) var(--space-6);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
