/* ============================================
   RUE - STYLES
   Building our roads.
   Optimized for Web Vitals (LCP, CLS, INP, FCP)
   ============================================ */

/* ----------------------------------------
   Font Face Declarations
   Only load fonts that are actually used
   Using font-display: swap for FOUT optimization
   ---------------------------------------- */

/* Hellix - Used for logo (preloaded, critical) */
@font-face {
    font-family: 'Hellix';
    src: url('assets/fonts/Hellix-SemiBold.woff2') format('woff2'),
         url('assets/fonts/Hellix-SemiBold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Maisonneue Book - Primary body text (preloaded) */
@font-face {
    font-family: 'Maisonneue';
    src: url('assets/fonts/MaisonNeue-Book.woff2') format('woff2'),
         url('assets/fonts/MaisonNeue-Book.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Maisonneue Book Italic - Used for slogan italic text */
@font-face {
    font-family: 'Maisonneue';
    src: url('assets/fonts/MaisonNeue-BookItalic.woff2') format('woff2'),
         url('assets/fonts/MaisonNeue-BookItalic.woff') format('woff');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* Maisonneue Demi - Used for footer company name (preloaded) */
@font-face {
    font-family: 'Maisonneue';
    src: url('assets/fonts/MaisonNeue-Demi.woff2') format('woff2'),
         url('assets/fonts/MaisonNeue-Demi.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Maisonneue Bold - Used for footer links */
@font-face {
    font-family: 'Maisonneue';
    src: url('assets/fonts/MaisonNeue-Bold.woff2') format('woff2'),
         url('assets/fonts/MaisonNeue-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ----------------------------------------
   CSS Custom Properties (Variables)
   ---------------------------------------- */
:root {
    /* Colors - Dark Theme matching rue.xyz */
    --color-bg: #141414;
    --color-bg-footer: #141414;
    --color-text: #ffffff;
    --color-text-muted: #a3a3a3;
    --color-text-dark: #474747;
    --color-border: #2f333d;
    
    /* Typography */
    --font-primary: 'Maisonneue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Hellix', 'Maisonneue', sans-serif;
    --font-mono: 'Maisonneue Mono', 'SF Mono', Consolas, monospace;
    
    /* Layout */
    --container-max: 1140px;
    --container-padding: 20px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Smooth scroll only when not using reduced motion */
    scroll-behavior: smooth;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Optimize text rendering */
    text-rendering: optimizeSpeed;
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* ----------------------------------------
   Container
   ---------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

/* ----------------------------------------
   Typography
   ---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 500;
    line-height: 1.2;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.7;
}

/* ----------------------------------------
   Header
   ---------------------------------------- */
.header {
    padding-top: 40px;
    padding-bottom: 40px;
    /* Contain layout for performance (CLS optimization) */
    contain: layout style;
}

.header-content {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo {
    font-family: var(--font-display);
    font-size: 55px;
    font-weight: 600;
    line-height: 55px;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.02em;
    margin-left: -2px;
    transition: opacity var(--transition-base);
    /* Prevent CLS with explicit dimensions */
    min-height: 55px;
    display: inline-block;
}

.logo:hover {
    opacity: 0.7;
}

/* Optimize hover transitions - only add will-change on interaction */
@media (hover: hover) {
    .logo:hover,
    .footer-link:hover,
    .contact-link:hover {
        will-change: opacity;
    }
}

.slogan {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.slogan-line {
    font-family: 'Maisonneue', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.slogan-building {
    font-style: italic;
}

.slogan-roads {
    font-style: normal;
}

/* ----------------------------------------
   Main Content
   ---------------------------------------- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ----------------------------------------
   Hero Section
   ---------------------------------------- */
.hero {
    min-height: 55vh;
    display: flex;
    align-items: flex-start;
    margin-bottom: 40px;
}

.hero-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Main Hero Description */
.hero-main {
    max-width: 700px;
    padding-top: 0;
}

.hero-description {
    font-size: 14px;
    font-weight: 300;
    line-height: 21px;
    color: var(--color-text-dark);
}

/* Approach & Contact Sections */
.hero-approach,
.hero-contact {
    margin-top: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.section-description {
    font-size: 14px;
    font-weight: 300;
    line-height: 21px;
    color: var(--color-text-dark);
}

/* Hero Divider */
.hero-divider {
    display: none;
}

/* Contact Link */
.contact-link {
    color: var(--color-text-dark);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.contact-link:hover {
    color: var(--color-text);
    opacity: 1;
}

/* ----------------------------------------
   Footer
   ---------------------------------------- */
.footer {
    background-color: var(--color-bg-footer);
    padding-top: 40px;
    padding-bottom: 40px;
    margin-top: auto;
    /* Contain layout for performance */
    contain: layout style;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-info {
    flex: 1;
}

.footer-company {
    font-family: 'Maisonneue', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    color: var(--color-text);
    margin-bottom: 10px;
}

.footer-legal {
    font-family: 'Maisonneue', sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    color: #838383;
    max-width: 800px;
}

.footer-links {
    display: flex;
    gap: 24px;
    padding-bottom: 20px;
}

.footer-link {
    font-family: 'Maisonneue', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.footer-link:hover {
    opacity: 0.7;
}

/* ----------------------------------------
   Responsive Design
   ---------------------------------------- */

/* Tablet and up */
@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .footer-links {
        flex-shrink: 0;
        padding-bottom: 0;
    }
}

/* Mobile */
@media (max-width: 479px) {
    .logo {
        font-size: 30px;
        line-height: 40px;
    }
    
    .hero {
        min-height: 44vh;
    }
    
    .hero-description {
        font-size: 17px;
        line-height: 24px;
    }
}

/* ----------------------------------------
   Animations (GPU-accelerated with transform3d)
   ---------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .header,
    .hero-main,
    .hero-approach,
    .hero-contact,
    .footer {
        animation: fadeInUp 0.6s ease-out both;
        /* Use composite layer for smooth animation */
        will-change: transform, opacity;
    }
    
    .header {
        animation-delay: 0s;
    }
    
    .hero-main {
        animation-delay: 0.1s;
    }
    
    .hero-approach {
        animation-delay: 0.2s;
    }
    
    .hero-contact {
        animation-delay: 0.3s;
    }
    
    .footer {
        animation-delay: 0.4s;
    }
    
    /* Remove will-change after animation completes (performance) */
    .header,
    .hero-main,
    .hero-approach,
    .hero-contact,
    .footer {
        animation-fill-mode: forwards;
    }
}

/* GPU-accelerated keyframes using translate3d */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* ----------------------------------------
   Selection & Print
   ---------------------------------------- */
::selection {
    background-color: var(--color-text);
    color: var(--color-bg);
}

::-moz-selection {
    background-color: var(--color-text);
    color: var(--color-bg);
}

@media print {
    body {
        background: white;
        color: black;
    }
    
    .footer {
        background: none;
    }
    
    a {
        text-decoration: underline;
    }
}
