.aimask-page {
    --product-accent: #10b981;
    --product-accent-2: #2dd4bf;
}

.aimask-page .aigate-product-radar svg {
    animation-duration: 8s;
}

.aimask-page .aigate-hero-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 100%;
    margin-inline: auto;
}

.aimask-page .server-hero-heading-sub {
    white-space: normal;
}

/* AIMask has longer service and policy names than AIGate. Keep their rhythm
   readable without letting a single token define the width of a card. */
.aimask-page [data-tab-panel] :is(h2, h3, p, code, small) {
    overflow-wrap: anywhere;
}

.aimask-page .product-flow__header {
    grid-template-columns: minmax(0, 1.08fr) minmax(18rem, 0.62fr);
    gap: clamp(1.25rem, 3.2vw, 3rem);
}

.aimask-page .product-flow__header h2 {
    max-width: 15ch;
    font-size: clamp(1.9rem, 3.65vw, 3.1rem);
}

.aimask-page .product-flow__edge {
    display: none;
}

.aimask-architecture-map {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    grid-template-areas:
        "control control control control control"
        "source source source source source"
        "gate arrow-one worker arrow-two verifier"
        ". . ml . ."
        "caption caption caption caption caption";
    gap: 0.8rem;
    align-items: stretch;
    margin: 1.1rem 0 1.35rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 1rem;
    background:
        radial-gradient(circle at 50% 45%, rgba(45, 212, 191, 0.09), transparent 42%),
        rgba(2, 6, 23, 0.58);
}

.theme-light .aimask-architecture-map {
    border-color: rgba(5, 150, 105, 0.2);
    background: radial-gradient(circle at 50% 45%, rgba(16, 185, 129, 0.09), transparent 44%), rgba(255, 255, 255, 0.86);
}

.aimask-architecture-source,
.aimask-architecture-service,
.aimask-architecture-control,
.aimask-architecture-ml {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.8rem;
    background: rgba(15, 23, 42, 0.72);
    text-align: center;
}

.theme-light .aimask-architecture-source,
.theme-light .aimask-architecture-service,
.theme-light .aimask-architecture-control,
.theme-light .aimask-architecture-ml {
    background: rgba(248, 250, 252, 0.94);
}

.aimask-architecture-source { grid-area: source; justify-self: center; min-width: min(100%, 18rem); font: 700 0.68rem/1.2 var(--ait-font-mono); letter-spacing: 0.12em; color: #99f6e4; }
.theme-light .aimask-architecture-source { color: #047857; }
.aimask-architecture-source i { color: #2dd4bf; animation: aimask-source-pulse 1.8s ease-in-out infinite; }
.aimask-architecture-service.is-gate { grid-area: gate; }
.aimask-architecture-service.is-worker { grid-area: worker; }
.aimask-architecture-service.is-verifier { grid-area: verifier; border-color: rgba(52, 211, 153, 0.42); box-shadow: inset 0 0 24px rgba(16, 185, 129, 0.07); }
.aimask-architecture-control { grid-area: control; border-color: rgba(45, 212, 191, 0.28); }
.aimask-architecture-ml { grid-area: ml; border-color: rgba(96, 165, 250, 0.25); }
.aimask-architecture-ml::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    height: 0.85rem;
    border-left: 1px dashed rgba(96, 165, 250, 0.48);
}
.aimask-architecture-arrow { display: grid; place-items: center; color: #2dd4bf; font: 700 1.15rem/1 var(--ait-font-mono); animation: aimask-arrow-flow 1.6s ease-in-out infinite; }
.aimask-architecture-arrow:nth-of-type(1) { grid-area: arrow-one; }
.aimask-architecture-arrow:nth-of-type(2) { grid-area: arrow-two; animation-delay: 0.35s; }
.aimask-architecture-map b { display: block; color: #f8fafc; font: 700 0.82rem/1.2 var(--ait-font-mono); }
.theme-light .aimask-architecture-map b { color: #0f172a; }
.aimask-architecture-map small { display: block; color: #94a3b8; font-size: 0.68rem; line-height: 1.3; }
.theme-light .aimask-architecture-map small { color: #475569; }
.aimask-architecture-map figcaption { grid-area: caption; padding-top: 0.25rem; color: #94a3b8; font-size: 0.72rem; line-height: 1.45; text-align: center; }
.theme-light .aimask-architecture-map figcaption { color: #475569; }

@keyframes aimask-source-pulse { 50% { transform: translateX(4px); opacity: 0.55; } }
@keyframes aimask-arrow-flow { 50% { transform: translateX(3px); text-shadow: 0 0 12px rgba(45, 212, 191, 0.65); } }

@media (min-width: 901px) {
    .aimask-page .aimask-architecture-services {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    .aimask-page .aimask-architecture-services > article:nth-child(-n + 2) {
        grid-column: span 3;
    }
    .aimask-page .aimask-architecture-services > article:nth-child(n + 3) {
        grid-column: span 2;
    }
    .aimask-page [data-flow-variant="aimask"] .product-flow__node-button {
        padding: 0.65rem 0.55rem;
    }
    .aimask-page [data-flow-variant="aimask"] .product-flow__node-button strong {
        font-size: clamp(0.72rem, 1vw, 0.86rem);
        overflow-wrap: normal;
        word-break: normal;
    }
}

@media (min-width: 768px) and (max-width: 900px) {
    .aimask-page .aimask-architecture-services > article:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .aimask-page .server-page,
    .aimask-page .server-page > section,
    .aimask-page .aigate-hero-features,
    .aimask-page .aigate-control-module {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .aimask-page .server-page > section:first-of-type {
        padding-inline: 1rem !important;
        overflow: hidden;
    }
    .aimask-page .aigate-hero-features {
        grid-template-columns: minmax(0, 1fr);
    }
    .aimask-page .server-page > nav {
        padding-inline: 0.75rem;
    }
    .aimask-page .server-page > nav > div {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        box-sizing: border-box;
        padding: 0.42rem;
    }
    .aimask-page .server-page > nav .server-nav-chip {
        width: 100%;
        min-height: 2.85rem;
        padding: 0.48rem 0.35rem;
        line-height: 1.08;
    }
    .aimask-page .server-page > nav .server-nav-chip:last-child {
        grid-column: 1 / -1;
    }
    .aimask-page .server-page > nav .server-nav-chip > span > span:last-child {
        margin-top: 0.18rem;
        font-size: 0.52rem;
        letter-spacing: 0.04em;
    }
    .aimask-page .server-hero-heading-main {
        font-size: clamp(3rem, 18vw, 4.5rem) !important;
    }
    .aimask-page .server-hero-heading-sub {
        max-width: 21rem !important;
        font-size: clamp(1.08rem, 5.8vw, 1.45rem) !important;
        line-height: 1.15;
        white-space: normal;
    }
    .aimask-page .server-hero-subtitle {
        max-width: 20rem;
    }
    .aimask-page .product-flow__header {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.8rem;
    }
    .aimask-page .product-flow__header h2 {
        max-width: 18ch;
        font-size: clamp(1.75rem, 8.2vw, 2.15rem);
        line-height: 1.02;
    }
    .aimask-page #security > .grid.mb-4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .aimask-page #security > .grid.mb-4 .server-stat {
        padding: 0.75rem 0.35rem !important;
    }
    .aimask-page #security > .grid.mb-4 .text-2xl {
        font-size: 1.35rem;
        line-height: 1.1;
    }
    .aimask-page #security > .grid.mb-4 .text-xs {
        font-size: 0.63rem;
        line-height: 1.25;
    }
    .aimask-page #security article > .flex {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.6rem;
    }
    .aimask-page #security article .server-card-title {
        align-self: center;
    }
    .aimask-page #security article .server-level {
        align-self: start;
        white-space: nowrap;
    }
    .aimask-page .aigate-control-module__screen,
    .aimask-page .aigate-control-module__copy,
    .aimask-page .aigate-control-module__footer {
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .aimask-architecture-map {
        grid-template-columns: 1fr;
        grid-template-areas: "control" "source" "gate" "arrow-one" "worker" "ml" "arrow-two" "verifier" "caption";
        padding: 0.75rem;
    }
    .aimask-architecture-arrow { transform: rotate(90deg); min-height: 1rem; }
    .aimask-architecture-source,
    .aimask-architecture-service,
    .aimask-architecture-control,
    .aimask-architecture-ml { width: 100%; box-sizing: border-box; }
    .aimask-architecture-ml::before {
        left: 1.2rem;
        height: 0.8rem;
    }
}

@media (max-width: 520px) {
    .aimask-page .server-management-capability {
        grid-template-columns: 2.4rem minmax(0, 1fr);
        column-gap: 0.75rem;
        row-gap: 0.65rem;
        padding: 0.9rem !important;
    }
    .aimask-page .server-management-capability-copy {
        display: contents;
    }
    .aimask-page .server-management-capability-copy .server-card-title {
        grid-column: 2;
        align-self: center;
    }
    .aimask-page .server-management-capability-copy .server-copy {
        grid-column: 1 / -1;
        margin: 0;
        line-height: 1.55 !important;
    }
    .aimask-page [data-flow-variant="aimask"] .product-flow__map {
        gap: 1.85rem;
    }
    .aimask-page .product-flow[data-flow-variant="aimask"] .product-flow__node {
        position: relative;
        inset: auto;
        width: auto;
        height: auto;
    }
    .aimask-page [data-flow-variant="aimask"] .product-flow__edge {
        position: absolute;
        z-index: 4;
        left: 50%;
        bottom: -1.72rem;
        display: grid;
        place-items: center;
        width: max-content;
        max-width: calc(100vw - 5rem);
        height: 1.55rem;
        color: var(--flow-accent-2);
        font: 700 0.54rem/1.15 var(--ait-font-mono);
        letter-spacing: 0.08em;
        text-align: center;
        transform: translateX(-50%);
        text-shadow: 0 0 10px color-mix(in srgb, var(--flow-accent-2) 55%, transparent);
    }
    .aimask-page [data-flow-variant="aimask"] .product-flow__edge i {
        margin-top: 0.08rem;
        font-size: 0.78rem;
        font-style: normal;
        line-height: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aimask-architecture-source i,
    .aimask-architecture-arrow { animation: none; }
}
