/* ═══════════════════════════════════════════════════════════════════
   PRODUCTS & CAPABILITIES
   - Home: "What We Do" (AI first, web & mobile as a lighter strip)
   - Home: dark product bento with the VisorEngine orbit
   - Projects page: dark hero + one "chapter" per product
   ═══════════════════════════════════════════════════════════════════ */

/* ── What We Do ───────────────────────────────────────────────────── */
@media (min-width: 901px) {
    .tech-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Editorial cards: left-aligned, white, no decorative corner shapes.
   (The centred icon-on-grey-box layout is what made this read as a template.) */
.tech-grid-3 .tech-card {
    padding: 2.25rem 2rem;
    text-align: left;
    background: var(--raw-white);
}

.tech-grid-3 .tech-card::before {
    display: none;
}

.tech-grid-3 .tech-icon {
    justify-content: flex-start;
    margin-bottom: 1.75rem;
    font-size: 2.25rem;
}

.tech-grid-3 .tech-card h3 {
    font-size: 1.15rem;
    letter-spacing: 1px;
}

.tech-grid-3 .tech-badge-group {
    justify-content: flex-start;
}

.tech-grid-3 .tech-badge {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-muted);
}

/* Entrance: when a card scrolls in, a gold rule draws across its top edge and
   its content rises in sequence (icon, title, text, tags). The hidden state
   only applies while main.js has marked the card .reveal, so nothing is ever
   hidden without JavaScript; the sequence delays only apply during the reveal,
   so they never slow down hover effects afterwards. */
.tech-grid-3 .tech-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--raw-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.1s var(--ease-out) calc(var(--reveal-delay, 0s) + 0.25s);
}

.tech-grid-3 .tech-card.in-view::after {
    transform: scaleX(1);
}

.tech-grid-3 .tech-card > * {
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out), color 0.3s ease;
}

.tech-grid-3 .tech-card.reveal:not(.in-view) > * {
    opacity: 0;
    transform: translateY(14px);
}

.tech-grid-3 .tech-card.reveal.in-view > :nth-child(1) {
    transition-delay: calc(var(--reveal-delay, 0s) + 0.15s);
}

.tech-grid-3 .tech-card.reveal.in-view > :nth-child(2) {
    transition-delay: calc(var(--reveal-delay, 0s) + 0.27s);
}

.tech-grid-3 .tech-card.reveal.in-view > :nth-child(3) {
    transition-delay: calc(var(--reveal-delay, 0s) + 0.39s);
}

.tech-grid-3 .tech-card.reveal.in-view > :nth-child(4) {
    transition-delay: calc(var(--reveal-delay, 0s) + 0.51s);
}

@media (prefers-reduced-motion: reduce) {
    .tech-grid-3 .tech-card::after {
        transform: scaleX(1);
        transition: none;
    }
}

@media (max-width: 600px) {
    .tech-grid-3 .tech-card {
        padding: 1.25rem;
    }

    .tech-grid-3 .tech-icon {
        margin: 0.1rem 0 0;
        font-size: 1.6rem;
    }
}

.also-strip {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem 2rem;
    margin-top: 1.5rem;
    padding: 1.4rem 1.75rem;
    border: 1px solid var(--border-light);
}

.also-label {
    padding-right: 2rem;
    border-right: 1px solid var(--border-light);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--accent-primary);
}

.also-strip p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.also-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.also-tags span {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border-light);
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.also-tags .ph-icon {
    margin-right: 0.35rem;
    color: var(--accent-primary);
}

@media (max-width: 900px) {
    .also-strip {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }

    .also-label {
        padding-right: 0;
        border-right: 0;
    }

    .also-tags {
        justify-content: flex-start;
    }
}

/* ── Dark product section ─────────────────────────────────────────── */
.products-section {
    position: relative;
    overflow: hidden;
    color: var(--raw-white);
    background: radial-gradient(ellipse at 20% 0%, #1b261a 0%, #0f140f 50%, var(--raw-black) 100%);
}

/* A few fixed stars so the section reads as a continuation of the hero */
.products-section::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1px 1px at 8% 18%, rgba(236, 230, 214, 0.6), transparent),
        radial-gradient(1px 1px at 22% 72%, rgba(200, 162, 74, 0.7), transparent),
        radial-gradient(1.5px 1.5px at 41% 12%, rgba(236, 230, 214, 0.5), transparent),
        radial-gradient(1px 1px at 63% 84%, rgba(236, 230, 214, 0.5), transparent),
        radial-gradient(1.5px 1.5px at 78% 22%, rgba(200, 162, 74, 0.6), transparent),
        radial-gradient(1px 1px at 92% 64%, rgba(236, 230, 214, 0.5), transparent);
}

.products-section .container {
    position: relative;
}

.section-head-dark h2 {
    color: var(--raw-white);
}

.section-head-dark p {
    color: rgba(255, 255, 255, 0.65);
}

.products-foot {
    margin-top: 3rem;
    text-align: center;
}

/* ── Bento ────────────────────────────────────────────────────────── */
.bento {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.tile-core {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
}

.tile-flagship,
.tile-hub {
    grid-column: 3 / span 2;
}

/* Group labels: "The Visor Ecosystem" / "Independent Projects" */
.bento-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1.25rem;
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--raw-gold);
}

.bento-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(200, 162, 74, 0.4), transparent);
}

.bento + .bento-label {
    margin-top: 3rem;
}

.bento-pair {
    grid-template-columns: repeat(2, 1fr);
}

/* Independent projects: logo beside the text */
.bento-pair .tile-small {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: start;
    gap: 1.25rem;
}

.bento-pair .tile-meta {
    grid-column: 1 / -1;
}

.tile-hub {
    border-style: dashed;
    border-color: rgba(200, 162, 74, 0.3);
}

.tile {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.5s var(--ease-out);
}

/* Spotlight that follows the pointer (main.js writes --mx / --my) */
.tile::before,
.chapter-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(200, 162, 74, 0.14), transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Highlight in place: lifting the card let the pointer slip off its bottom edge */
.tile:hover {
    border-color: rgba(200, 162, 74, 0.4);
}

.tile:hover::before,
.chapter-visual:hover::before {
    opacity: 1;
}

.tile-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.tile-index {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.tile-status {
    padding: 0.28rem 0.6rem;
    border: 1px solid;
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.tile-status.status-live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    vertical-align: middle;
}

.tile .status-live {
    color: #a7d7b0;
    border-color: rgba(167, 215, 176, 0.3);
}

.tile .status-soon {
    color: var(--raw-gold);
    border-color: rgba(200, 162, 74, 0.45);
}

.tile .status-rd {
    color: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.2);
}

.tile-body {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.tile h3 {
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
    color: var(--raw-white);
}

.tile p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.62);
}

.tile-link {
    align-self: flex-start;
    margin-top: 1.1rem;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(200, 162, 74, 0.6);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--raw-white);
}

.tile-link .ph-icon {
    margin-left: 0.45rem;
    font-size: 0.72rem;
    color: var(--raw-gold);
    transition: transform 0.4s var(--ease-out);
}

.tile:hover .tile-link .ph-icon,
.chapter-body .tile-link:hover .ph-icon {
    transform: translateX(4px);
}

/* VisorEngine orbit */
.orbit {
    position: relative;
    width: min(100%, 340px);
    aspect-ratio: 1;
    margin: 0.5rem auto;
}

/* Safari < 15 has no aspect-ratio: give the orbit a fixed square instead */
@supports not (aspect-ratio: 1) {
    .orbit {
        width: 300px;
        height: 300px;
    }
}

.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(200, 162, 74, 0.28);
    animation: orbitSpin 40s linear infinite;
}

.orbit-ring-1 {
    inset: 17%;
}

.orbit-ring-2 {
    inset: 0;
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.16);
    animation-duration: 70s;
    animation-direction: reverse;
}

.orbit-planet {
    position: absolute;
    top: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--raw-gold);
    box-shadow: 0 0 16px rgba(200, 162, 74, 0.8);
}

.orbit-planet-soon {
    background: var(--raw-black);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: none;
}

/* Labels counter-rotate so they stay upright while their planet orbits */
.orbit-planet em {
    position: absolute;
    top: 16px;
    left: 50%;
    font-style: normal;
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.75);
    transform: translateX(-50%);
    animation: orbitCounter 40s linear infinite;
}

.orbit-ring-2 .orbit-planet em {
    animation-duration: 70s;
    animation-direction: reverse;
}

.orbit-core {
    position: absolute;
    inset: 35%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(200, 162, 74, 0.5);
    background: radial-gradient(circle, #1f2636 0%, #11151d 100%);
    box-shadow: 0 0 60px rgba(200, 162, 74, 0.15), inset 0 0 30px rgba(0, 0, 0, 0.6);
}

.orbit-core::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid rgba(200, 162, 74, 0.5);
    animation: corePulse 4s var(--ease-out) infinite;
}

.orbit-core img {
    width: 62%;
    height: auto;
}

@keyframes orbitSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes orbitCounter {
    from {
        transform: translateX(-50%) rotate(0deg);
    }

    to {
        transform: translateX(-50%) rotate(-360deg);
    }
}

@keyframes corePulse {
    from {
        transform: scale(1);
        opacity: 0.8;
    }

    to {
        transform: scale(1.9);
        opacity: 0;
    }
}

/* MLVisor flagship */
.flagship-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
    gap: 1.75rem;
}

.flagship-icon {
    width: 120px;
    height: 120px;
    border-radius: 26%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.6s var(--ease-out);
}

.tile:hover .flagship-icon {
    transform: rotate(-4deg) scale(1.04);
}

.tile .tile-tagline {
    margin-bottom: 0.9rem;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    line-height: 1.3;
    color: var(--raw-white);
}

.tile-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tile-features li .ph-icon {
    margin-right: 0.35rem;
    color: var(--raw-gold);
}

.tile-features li {
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 0.68rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
}

/* Small tiles */
.tile-logo {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    overflow: hidden;
    border-radius: 16px;
}

.tile-logo-gold {
    background: linear-gradient(135deg, #9E7C2F 0%, #C8A24A 100%);
}

.tile-logo img {
    max-width: 78%;
    max-height: 78%;
    object-fit: contain;
}

.tile-small h3 {
    font-size: 1.3rem;
}

@media (max-width: 1100px) {
    .bento {
        grid-template-columns: repeat(2, 1fr);
    }

    .tile-core,
    .tile-flagship,
    .tile-hub {
        grid-column: 1 / span 2;
        grid-row: auto;
    }
}

@media (max-width: 600px) {
    .bento {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .tile-core,
    .tile-flagship,
    .tile-hub {
        grid-column: auto;
    }

    .bento-pair {
        grid-template-columns: 1fr;
    }

    .tile {
        gap: 1rem;
        padding: 1.25rem;
    }

    .orbit {
        width: min(100%, 250px);
    }

    @supports not (aspect-ratio: 1) {
        .orbit {
            width: 250px;
            height: 250px;
        }
    }

    .flagship-grid {
        grid-template-columns: 72px 1fr;
        align-items: start;
        gap: 1rem;
    }

    .flagship-icon {
        width: 72px;
        height: 72px;
    }

    .tile h3 {
        font-size: 1.3rem;
    }

    .tile .tile-tagline {
        font-size: 1.1rem;
    }
}

/* ── Contact heading ──────────────────────────────────────────────── */
.contact-title {
    margin-bottom: 0.75rem;
    font-size: clamp(2.2rem, 4vw, 3rem);
}

.contact-lead {
    max-width: 520px;
    margin: 0 auto 2.5rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ── Projects page ────────────────────────────────────────────────── */
.page-hero.page-hero-dark {
    position: relative;
    overflow: hidden;
    padding: 200px 0 110px;
    color: var(--raw-white);
    background: radial-gradient(ellipse at 30% 40%, #1d2a1c 0%, #111611 45%, var(--raw-black) 100%);
}

.page-hero-dark::before {
    display: none;
}

.page-hero-dark .container {
    position: relative;
    z-index: 3;
}

.page-hero-dark h1 {
    margin: 0.5rem 0 1rem;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--raw-white);
}

.page-hero-dark p {
    max-width: 600px;
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
}

.page-hero-dark .breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.page-hero-dark .breadcrumb span {
    color: var(--raw-gold);
}

.page-hero-dark .breadcrumb a {
    color: rgba(255, 255, 255, 0.6);
}

.chapter {
    padding: clamp(4rem, 8vw, 6rem) 0;
    border-bottom: 1px solid var(--border-light);
    scroll-margin-top: 80px;
}

.chapter-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
}

/* The hero is the first section, so odd chapters are the 2nd, 4th... products */
.chapter:nth-of-type(odd) .chapter-visual {
    order: 2;
}

.chapter-visual {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: var(--chapter-bg, #141a14);
}

/* Fine blueprint grid, fading towards the edges */
.chapter-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(circle at center, #000 30%, transparent 75%);
    mask-image: radial-gradient(circle at center, #000 30%, transparent 75%);
}

.chapter-visual img {
    /* Reset the width/height attributes so the max-* limits below take effect */
    width: auto;
    height: auto;
    max-width: 52%;
    max-height: 52%;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.35));
    transition: transform 0.8s var(--ease-out);
}

.chapter-visual img.project-app-icon {
    width: 34%;
    max-width: 220px;
    max-height: none;
    aspect-ratio: 1;
    border-radius: 22%;
    filter: none;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.chapter-visual:hover img {
    transform: scale(1.05);
}

.chapter-num {
    position: absolute;
    left: 1.5rem;
    bottom: 0.75rem;
    font-family: var(--font-heading);
    font-size: clamp(4rem, 9vw, 7rem);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
}

.chapter-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.chapter-category {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-primary);
}

.chapter .status-live {
    color: var(--raw-green);
    border-color: rgba(47, 62, 46, 0.3);
    background: rgba(47, 62, 46, 0.06);
}

.chapter .status-soon {
    color: var(--raw-gold-dark);
    border-color: rgba(158, 124, 47, 0.4);
    background: rgba(200, 162, 74, 0.08);
}

.chapter .status-rd,
.chapter .status-lab {
    color: var(--text-muted);
    border-color: var(--border-light);
}

.chapter-body h2 {
    margin-bottom: 0.75rem;
    font-size: clamp(2.2rem, 4vw, 3rem);
}

.chapter-lead {
    margin-bottom: 1.25rem;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    line-height: 1.4;
}

.chapter-body p:not(.chapter-lead) {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.chapter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 1.5rem 0 1rem;
}

.chapter-tags span {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-light);
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chapter-body .tile-link {
    color: var(--text-main);
}

/* "In the lab": a teaser, deliberately out of focus */
.chapter-lab .chapter-visual span.lab-mark {
    font-family: var(--font-heading);
    font-size: clamp(5rem, 12vw, 9rem);
    color: rgba(200, 162, 74, 0.5);
    filter: blur(10px);
}

.chapter-lab .chapter-visual .ph-icon {
    position: absolute;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.75);
}

/* VisorHub visual: datasets, plugins and models joined on one line */
.hub-visual {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 2.75rem);
}

.hub-visual::before {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 1px;
    z-index: -1;
    background: linear-gradient(90deg, transparent, rgba(200, 162, 74, 0.6), transparent);
}

.hub-visual span {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid rgba(200, 162, 74, 0.5);
    background: #141a14;
    color: var(--raw-gold);
    font-size: 1.4rem;
    box-shadow: 0 0 30px rgba(200, 162, 74, 0.12);
}

.hub-visual span:nth-child(2) {
    width: 92px;
    height: 92px;
    font-size: 1.8rem;
}

/* Divider between the Visor ecosystem and the independent projects */
.chapters-divider {
    padding-top: clamp(3rem, 6vw, 4.5rem);
    text-align: center;
}

.chapters-divider .uppercase {
    letter-spacing: 2.5px;
}

.chapters-divider p {
    margin-top: 0.5rem;
    color: var(--text-muted);
}

/* Closing call to action */
.cta-band {
    padding: clamp(4rem, 8vw, 6rem) 0;
    text-align: center;
    color: var(--raw-white);
    background: radial-gradient(ellipse at 50% 0%, #1d2a1c 0%, var(--raw-black) 75%);
}

.cta-band h2 {
    margin: 0.75rem 0 1rem;
    font-size: clamp(2.2rem, 4vw, 3rem);
    color: var(--raw-white);
}

.cta-band p {
    max-width: 560px;
    margin: 0 auto 2rem;
    color: rgba(255, 255, 255, 0.7);
}

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

    .chapter:nth-of-type(odd) .chapter-visual {
        order: 0;
    }

    .chapter-visual {
        aspect-ratio: 16 / 10;
    }
}

@media (prefers-reduced-motion: reduce) {

    .orbit-ring,
    .orbit-planet em,
    .orbit-core::after {
        animation: none;
    }
}
