/* ==========================================================
   a6c.boo - Modular Mosaic Design System
   Flat Design | Zero-Gap | Variable Typography
   ========================================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --deep-blue: #1B3A5C;
    --coral: #E8634A;
    --gold: #D4A843;
    --white: #F5F5F2;
    --slate: #1E2328;
    --teal: #2A9D8F;
    --gray: #C8CCD0;
    --violet: #4A2D6B;
    --slate-blue: #6B7A8D;

    /* Typography */
    --font-headline: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Elastic easing */
    --elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Module border */
    --border: 1px solid #C8CCD0;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: var(--slate);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Keyframe Animations --- */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes blink-bit {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.65; }
}

@keyframes node-breathe {
    0%, 100% { r: 3; }
    50% { r: 4.5; }
}

@keyframes radar-sweep {
    0% { transform-origin: 300px 300px; transform: rotate(0deg); }
    100% { transform-origin: 300px 300px; transform: rotate(360deg); }
}

@keyframes radar-blip-pulse {
    0%, 100% { opacity: 0.1; }
    15% { opacity: 0.8; }
    40% { opacity: 0.3; }
}

@keyframes crosshair-fade {
    0% { opacity: 0; }
    100% { opacity: 0.15; }
}

/* --- Mosaic Row --- */
.mosaic-row {
    display: flex;
    flex-wrap: nowrap;
    width: 100vw;
    scroll-snap-align: start;
    position: relative;
}

/* --- Module Base --- */
.module {
    position: relative;
    overflow: hidden;
    border: var(--border);
    margin: -0.5px;
    opacity: 0;
    transform: translateY(8px);
    transition: background-color 250ms var(--elastic), border-color 200ms ease;
}

.module.in-view {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease, transform 400ms var(--elastic), background-color 250ms var(--elastic), border-color 200ms ease;
}

/* Stagger children in each row */
.mosaic-row .module:nth-child(1).in-view { transition-delay: 0ms; }
.mosaic-row .module:nth-child(2).in-view { transition-delay: 80ms; }
.mosaic-row .module:nth-child(3).in-view { transition-delay: 160ms; }
.mosaic-row .module:nth-child(4).in-view { transition-delay: 240ms; }

/* --- Module Sizes --- */
.module-4x1 {
    width: 100vw;
    height: 80px;
}

.module-hero {
    width: 100vw;
    height: 75vh;
}

.module-2x2 {
    width: 50vw;
    height: 50vw;
    max-height: 80vh;
}

.module-2x3 {
    width: 50vw;
    height: 75vw;
    max-height: 90vh;
}

.module-2x1 {
    width: 50vw;
    height: 25vw;
    max-height: 40vh;
}

.module-1x1 {
    width: 25vw;
    height: 25vw;
    max-height: 40vh;
}

/* --- Module Backgrounds --- */
[data-bg="deep-blue"] { background-color: var(--deep-blue); }
[data-bg="coral"] { background-color: var(--coral); }
[data-bg="gold"] { background-color: var(--gold); }
[data-bg="white"] { background-color: var(--white); }
[data-bg="slate"] { background-color: var(--slate); }
[data-bg="teal"] { background-color: var(--teal); }
[data-bg="violet"] { background-color: var(--violet); }
[data-bg="briefing-slate"] { background-color: var(--slate); }
[data-bg="dark-coral"] { background-color: var(--slate); }
[data-bg="violet-gold"] { background-color: var(--violet); }
[data-bg="blue-teal"] { background-color: var(--deep-blue); }

/* --- Navigation --- */
.nav-module {
    display: flex;
    align-items: center;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 3vw;
}

.nav-logo {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--white);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2.5vw;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray);
    text-decoration: none;
    transition: color 250ms var(--elastic);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--teal);
    transition: width 300ms var(--elastic);
}

.nav-link:hover {
    color: var(--teal);
}

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

.nav-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Status Dots --- */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-active { background-color: var(--teal); }
.status-pending { background-color: var(--gold); }
.status-highlight { background-color: var(--coral); }

/* --- Label Mono --- */
.label-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--slate-blue);
}

/* --- Typography --- */
.hero-headline {
    font-family: var(--font-headline);
    font-size: clamp(2.8rem, 7vw, 6rem);
    line-height: 1.05;
    color: var(--white);
    font-variation-settings: 'wght' 200;
    letter-spacing: -0.02em;
}

.hero-headline .word {
    display: inline-block;
    font-variation-settings: 'wght' 200;
    transition: font-variation-settings 600ms var(--elastic);
    margin-right: 0.25em;
}

.hero-headline .word.animated {
    font-variation-settings: 'wght' 700;
}

.section-title {
    font-family: var(--font-headline);
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    line-height: 1.15;
    color: var(--slate);
    font-variation-settings: 'wght' 200;
    letter-spacing: -0.01em;
    margin-bottom: 1.2rem;
}

.section-title.light-text {
    color: var(--white);
}

.section-title .word {
    display: inline-block;
    font-variation-settings: 'wght' 200;
    transition: font-variation-settings 600ms var(--elastic);
    margin-right: 0.15em;
}

.section-title .word.animated {
    font-variation-settings: 'wght' var(--target-weight, 600);
}

/* Hover weight shift on text modules */
.text-module:hover .section-title .word.animated {
    font-variation-settings: 'wght' 800;
    transition-duration: 300ms;
}

.body-text {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--slate);
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
    max-width: 540px;
}

.body-text.light-text {
    color: rgba(245, 245, 242, 0.85);
}

.light-text {
    color: var(--white);
}

.light-muted {
    color: rgba(200, 204, 208, 0.7);
}

.light-text-muted {
    color: rgba(245, 245, 242, 0.65);
}

/* --- Hero Module --- */
.hero-module {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 5vw;
}

.hero-label {
    margin-top: 1.5rem;
    color: var(--gray);
}

.hero-duotone-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(27, 58, 92, 0.92) 0%, rgba(27, 58, 92, 0.6) 100%);
    z-index: 1;
}

.hero-node-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* --- Text Module --- */
.text-module {
    display: flex;
    align-items: center;
}

.module-content {
    padding: clamp(2rem, 4vw, 4rem);
}

.tag-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* --- Inline Diagram --- */
.inline-diagram {
    margin-top: 1.5rem;
    opacity: 0.6;
}

.inline-node-diagram {
    width: 100%;
    max-width: 300px;
    height: auto;
}

/* --- Research Tags --- */
.research-tags {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.3rem;
}

/* --- Capability List --- */
.capability-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.3rem;
}

.capability-item {
    display: flex;
    align-items: center;
    gap: 0;
}

.capability-item .status-dot {
    flex-shrink: 0;
}

.capability-item .label-mono {
    font-size: 11px;
}

/* --- Contact --- */
.contact-link {
    display: inline-block;
    font-family: var(--font-headline);
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 600;
    color: var(--teal);
    text-decoration: none;
    border-bottom: 2px solid var(--teal);
    padding-bottom: 2px;
    transition: color 250ms var(--elastic), border-color 250ms var(--elastic);
    margin-top: 0.5rem;
}

.contact-link:hover {
    color: var(--gold);
    border-color: var(--gold);
}

.contact-status {
    margin-top: 1rem;
    display: block;
}

/* --- Duotone Module --- */
.duotone-module {
    display: flex;
    align-items: center;
    justify-content: center;
}

.duotone-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 400ms ease, transform 400ms var(--elastic), filter 250ms var(--elastic);
}

.duotone-module.in-view .duotone-art {
    opacity: 1;
    transform: scale(1);
}

/* Duotone image hover brightness */
.duotone-module:hover .duotone-art {
    filter: brightness(1.1);
}

/* --- Accent Modules --- */
.accent-module {
    display: flex;
    align-items: center;
    justify-content: center;
}

.accent-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 1rem;
}

.accent-number {
    font-family: var(--font-headline);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}

.accent-number.dark-number {
    color: var(--slate);
}

.accent-label-light {
    color: rgba(245, 245, 242, 0.7);
}

.accent-quote {
    font-family: var(--font-headline);
    font-size: clamp(1rem, 2vw, 1.6rem);
    font-weight: 400;
    font-style: italic;
    color: var(--white);
    line-height: 1.4;
    text-align: center;
    padding: 1.5rem;
}

/* --- Node Diagrams --- */
.node-diagram-module {
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-diagram {
    width: 80%;
    height: 80%;
}

.node-diagram circle {
    animation: node-breathe 3s ease-in-out infinite;
}

.node-diagram circle:nth-child(6) { animation-delay: 0s; }
.node-diagram circle:nth-child(7) { animation-delay: 0.4s; }
.node-diagram circle:nth-child(8) { animation-delay: 0.8s; }
.node-diagram circle:nth-child(9) { animation-delay: 1.2s; }
.node-diagram circle:nth-child(10) { animation-delay: 1.6s; }

/* --- Binary Pattern --- */
.binary-pattern {
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 11px;
    word-break: break-all;
    line-height: 1.6;
    padding: 16px;
    color: var(--gray);
    overflow: hidden;
}

.binary-pattern .bit {
    display: inline;
    animation: blink-bit 2s ease-in-out infinite;
}

/* --- Crosshair Marks --- */
.crosshair {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    animation: crosshair-fade 600ms ease forwards;
    animation-delay: 500ms;
}

.module.in-view > .crosshair {
    opacity: 0.15;
}

.module:hover > .crosshair {
    opacity: 0.5;
    transition: opacity 250ms ease;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background-color: var(--gray);
    transition: background-color 250ms var(--elastic);
}

.module:hover > .crosshair::before,
.module:hover > .crosshair::after {
    background-color: var(--teal);
}

.crosshair-tl { top: 0; left: 0; }
.crosshair-tl::before { top: 8px; left: 12px; width: 12px; height: 1px; }
.crosshair-tl::after { top: 2px; left: 17px; width: 1px; height: 12px; }

.crosshair-tr { top: 0; right: 0; }
.crosshair-tr::before { top: 8px; right: 12px; width: 12px; height: 1px; }
.crosshair-tr::after { top: 2px; right: 17px; width: 1px; height: 12px; }

.crosshair-bl { bottom: 0; left: 0; }
.crosshair-bl::before { bottom: 8px; left: 12px; width: 12px; height: 1px; }
.crosshair-bl::after { bottom: 2px; left: 17px; width: 1px; height: 12px; }

.crosshair-br { bottom: 0; right: 0; }
.crosshair-br::before { bottom: 8px; right: 12px; width: 12px; height: 1px; }
.crosshair-br::after { bottom: 2px; right: 17px; width: 1px; height: 12px; }

/* --- Radar Animation --- */
.radar-line {
    animation: radar-sweep 8s linear infinite;
    transform-origin: 300px 300px;
}

.radar-blip {
    animation: radar-blip-pulse 8s ease-in-out infinite;
}

.radar-blip:nth-child(2) { animation-delay: 1s; }
.radar-blip:nth-child(3) { animation-delay: 3s; }

/* --- Footer --- */
.footer-module {
    display: flex;
    align-items: center;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 3vw;
}

/* --- Module Hover States --- */
.module:hover {
    z-index: 2;
    border-color: var(--teal);
    border-width: 2px;
    margin: -1px;
}

[data-bg="deep-blue"]:hover { background-color: #1e4568; }
[data-bg="coral"]:hover { background-color: #ea7a5f; }
[data-bg="gold"]:hover { background-color: #d9b35a; }
[data-bg="teal"]:hover { background-color: #33b5a5; }
[data-bg="violet"]:hover { background-color: #573580; }
[data-bg="white"]:hover { background-color: #f0f0ed; }
[data-bg="slate"]:hover { background-color: #272d33; }
[data-bg="briefing-slate"]:hover { background-color: #272d33; }
[data-bg="dark-coral"]:hover { background-color: #272d33; }
[data-bg="violet-gold"]:hover { background-color: #573580; }
[data-bg="blue-teal"]:hover { background-color: #1e4568; }

/* --- Scroll Snap Rows --- */
.hero-row {
    scroll-snap-align: start;
}

/* --- Binary Pattern Background (CSS) --- */
.binary-pattern-module {
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 4px,
            rgba(27, 58, 92, 0.08) 4px,
            rgba(27, 58, 92, 0.08) 8px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 4px,
            rgba(27, 58, 92, 0.08) 4px,
            rgba(27, 58, 92, 0.08) 8px
        );
}

/* --- Mobile (< 768px) --- */
@media (max-width: 768px) {
    html {
        scroll-snap-type: none;
    }

    .mosaic-row {
        flex-wrap: wrap;
    }

    .module-4x1,
    .module-hero,
    .module-2x2,
    .module-2x3,
    .module-2x1,
    .module-1x1 {
        width: 100vw;
    }

    .module-hero {
        height: 70vh;
    }

    .module-2x2 {
        height: 80vw;
        max-height: 70vh;
    }

    .module-2x3 {
        height: 100vw;
        max-height: 80vh;
    }

    .module-2x1 {
        height: 40vw;
        max-height: 30vh;
    }

    .module-1x1 {
        width: 50vw;
        height: 50vw;
        max-height: 50vh;
    }

    .nav-links {
        display: none;
    }

    .hero-headline {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .section-title {
        font-size: clamp(1.4rem, 6vw, 2.2rem);
    }

    .body-text {
        font-size: 15px;
        line-height: 1.6;
    }

    .module-content {
        padding: clamp(1.5rem, 5vw, 2.5rem);
    }

    /* Simplify variable font animations to opacity on mobile */
    .section-title .word,
    .hero-headline .word {
        transition: opacity 400ms ease;
    }

    .accent-row .module-1x1 {
        width: 50vw;
        height: 50vw;
    }

    .capability-list {
        gap: 0.5rem;
    }

    .research-tags {
        gap: 0.4rem;
    }

    /* Disable hover border thickening on mobile */
    .module:hover {
        border-width: 1px;
        margin: -0.5px;
    }
}

/* --- Very small screens --- */
@media (max-width: 480px) {
    .module-1x1 {
        width: 100vw;
        height: 60vw;
    }

    .accent-row .module-1x1 {
        width: 100vw;
        height: 60vw;
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 3vw;
    }

    .module-4x1 {
        height: auto;
        min-height: 80px;
    }

    .capability-item .label-mono {
        font-size: 10px;
    }
}
