/* ===================================================
   LAYOUT.CSS — Container, Sections, Header, Footer, Grid, Responsive
   =================================================== */

/* ---- Container ---- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* ---- Sections ---- */
.section {
    padding: var(--spacing-lg) 0;
    scroll-margin-top: var(--header-height);
}

.alt-bg {
    background-color: var(--bg-secondary);
}

.section-title {
    margin-bottom: var(--spacing-md);
    position: relative;
    display: block;
    text-align: center;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -5px;
    width: 40px;
    height: 3px;
    background-color: var(--accent-primary);
}

/* ---- Header / Navbar ---- */
header {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

header.scrolled {
    background: rgba(11, 11, 13, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    padding: 0 1rem;
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.45rem;
    letter-spacing: -0.04em;
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

/* ---- Hamburger ---- */
.hamburger {
    display: none;
    cursor: pointer;
    z-index: 1001;
    background: transparent;
    border: 0;
    padding: 0;
}

.hamburger div {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 5px;
    transition: all 0.3s ease;
}

/* ---- Hero ---- */
.hero-fullscreen {
    position: relative;
    min-height: 145vh;
    background-color: #000;
}

.hero-bg-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    z-index: 10;
}

.hero-frame-stage {
    position: absolute;
    right: clamp(20px, 5vw, 72px);
    top: 50%;
    transform: translateY(-48%);
    width: min(40vw, 560px);
    aspect-ratio: 464 / 688;
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 60px rgba(139, 30, 45, 0.18);
    z-index: 1;
}

.hero-frame-stage::before {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    z-index: 3;
    pointer-events: none;
}

.hero-frame-stage::after {
    content: 'LIVE QA VIEW';
    position: absolute;
    left: 18px;
    bottom: 18px;
    z-index: 3;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    background: rgba(11, 11, 13, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(242, 242, 242, 0.82);
    font-family: 'Fira Code', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.hero-bg-canvas,
.hero-bg-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 1;
}

.hero-bg-poster {
    transition: opacity 0.35s ease;
}

.hero-bg-poster.is-hidden,
.hero-bg-canvas.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.hero-technical-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.corner-border {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--accent-primary);
    opacity: 0.5;
}

.top-left { top: 40px; left: 40px; border-right: 0; border-bottom: 0; }
.top-right { top: 40px; right: 40px; border-left: 0; border-bottom: 0; }
.bottom-left { bottom: 40px; left: 40px; border-right: 0; border-top: 0; }
.bottom-right { bottom: 40px; right: 40px; border-left: 0; border-top: 0; }

.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.1;
    z-index: 5;
    animation: scanline 8s linear infinite;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 48%, rgba(139, 30, 45, 0.18) 0%, rgba(139, 30, 45, 0) 34%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0%, rgba(0, 0, 0, 0.52) 100%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.96) 0%, rgba(0, 0, 0, 0.88) 34%, rgba(0, 0, 0, 0.6) 58%, rgba(0, 0, 0, 0.2) 100%);
    z-index: 2;
}

.hero-content-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: flex;
    align-items: center;
    z-index: 20;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    margin-top: -100vh;
    margin-top: -100svh;
    padding: calc(var(--header-height) + 52px) 0 48px;
}

.hero-content-shell {
    display: grid;
    grid-template-columns: minmax(0, 560px) minmax(320px, 1fr);
    gap: clamp(32px, 7vw, 120px);
    align-items: center;
    width: 100%;
}

.hero-content {
    max-width: 560px;
    padding-left: 0;
    position: relative;
    z-index: 10;
}

.hero-content::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 0.35rem;
    width: 2px;
    height: 120px;
    background: linear-gradient(180deg, rgba(139, 30, 45, 0.9) 0%, rgba(139, 30, 45, 0) 100%);
    box-shadow: 0 0 24px rgba(139, 30, 45, 0.35);
}

.hero-visual-spacer {
    min-height: 1px;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.15rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(242, 242, 242, 0.78);
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--font-display);
    font-size: var(--h1-size);
    font-weight: 700;
    line-height: 0.98;
    margin-bottom: 0.9rem;
    color: var(--text-primary);
    text-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    letter-spacing: -0.055em;
}

.hero-subtitle {
    font-size: clamp(1rem, 0.75vw + 0.98rem, 1.18rem);
    color: var(--text-secondary);
    margin-bottom: 2.2rem;
    max-width: 34ch;
    line-height: 1.7;
    text-wrap: pretty;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-role {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 0.8vw + 1rem, 1.55rem);
    color: var(--accent-primary);
    font-weight: 500;
    margin-bottom: 0.95rem;
    letter-spacing: -0.02em;
}

/* ---- Grid Layouts ---- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.methodology-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.methodology-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
}

.qualities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 700px;
    margin: 0 auto;
}

/* Prevent overflow hidden on animated grids */
.qualities-grid,
.skills-grid,
.projects-grid,
.video-grid,
.methodology-grid {
    overflow: visible;
}

/* ---- Footer / CTA ---- */
.cta-section {
    background: var(--accent-primary);
    text-align: center;
    padding: var(--spacing-lg) 0;
}

/* ---- Social Links (Footer Upgrade) ---- */
.social-links {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--spacing-md);
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    transition: all 0.3s ease;
}

.social-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
}

.social-link:focus-visible {
    outline-color: rgba(255, 255, 255, 0.95);
}

.social-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ---- Hero Stats ---- */
.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
    letter-spacing: -0.05em;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* ---- Footer Highlight ---- */
.footer-highlight {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

/* ---- Responsive ---- */
@media screen and (max-width: 768px) {
    .nav-links {
        position: fixed;
        right: 0;
        height: 100vh;
        top: 0;
        background-color: rgba(11, 11, 13, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        transform: translateX(100%);
        transition: transform 0.5s ease-in;
        z-index: 1000;
        gap: 2rem;
    }

    .nav-links li { opacity: 0; }

    .hamburger { display: block; }

    .hero-actions { justify-content: center; }

    .hero-content-shell {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .hero-visual-spacer {
        display: none;
    }

    .hero-content {
        max-width: 100%;
        padding-left: 0;
        text-align: center;
    }

    .hero-content::before {
        display: none;
    }

    .hero-fullscreen {
        min-height: 100vh;
        min-height: 100svh;
    }

    .hero-content-wrapper {
        position: relative;
        top: auto;
        height: 100vh;
        height: 100svh;
        align-items: flex-end;
        padding: calc(var(--header-height) + 16px) 0 32px;
        z-index: 20;
        margin-top: 0;
    }

    .hero-bg-wrapper {
        position: absolute;
        top: 0;
        width: 100%;
        height: 100vh;
        height: 100svh;
        z-index: 10;
        overflow: hidden;
    }

    .hero-frame-stage {
        left: 50%;
        right: auto;
        top: 12vh;
        transform: translateX(-50%);
        width: min(66vw, 360px);
        border-radius: 24px;
    }

    .hero-overlay {
        background:
            linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.34) 28%, rgba(0, 0, 0, 0.84) 66%, rgba(0, 0, 0, 0.96) 100%),
            linear-gradient(90deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.3) 100%);
    }
    
    .hero-content {
        padding-top: 31vh;
    }

    .hero-stats {
        justify-content: center;
        gap: 1.25rem;
    }

    .stat-item {
        align-items: center;
    }

    .hero-subtitle {
        max-width: 32ch;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-eyebrow {
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-role {
        margin-bottom: 0.5rem;
    }

    .navbar {
        flex-direction: row;
        height: var(--header-height);
        padding: 0 1rem;
    }

}

.nav-active { transform: translateX(0%) !important; }

@media (max-width: 600px) {
    .qualities-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-fullscreen {
        min-height: 100vh;
        min-height: 100svh;
    }

    .hero-bg-wrapper {
        position: absolute;
    }

    .hero-content-wrapper {
        position: relative;
        top: auto;
        margin-top: 0;
    }

    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
