/* factory.css — styles for /factory/ (Tier 3: фабрики агентов под ключ).
   Reuses the tokens and components defined in ../style.css (:root custom
   properties, .landing-nav, .tg-chat, .cta-row/.cta-primary/.cta-secondary,
   .footer-links). Only the pieces this page needs are new. */

/* ── Page shell ── */
.fx-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 72px 24px 96px;
    color: var(--text);
}

.fx-hero {
    max-width: 860px;
    margin: 0 0 76px;
}

.fx-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4.4vw, 2.75rem);
    line-height: 1.14;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-bright);
    margin: 0 0 18px;
    text-wrap: balance;
}

.fx-lede {
    font-family: var(--font-body);
    font-size: 1.08rem;
    line-height: 1.62;
    color: var(--text);
    margin: 0 0 28px;
    max-width: 72ch;
}

.fx-hero .cta-row {
    align-items: flex-start;
}

/* Trust rail under the hero CTAs */
.fx-trust {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin: 26px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--border);
}

.fx-trust li {
    font-family: var(--font-body);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-dim);
    position: relative;
    padding-left: 18px;
}

.fx-trust li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.52em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

/* ── Section shell ── */
.fx-section {
    margin: 0 0 72px;
}

.fx-section > h2 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.6vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    margin: 0 0 12px;
    text-wrap: balance;
}

.fx-sub {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.62;
    color: var(--text-dim);
    margin: 0 0 26px;
    max-width: 74ch;
}

.fx-sub-tight {
    margin-bottom: 20px;
}

.fx-note {
    font-family: var(--font-body);
    font-size: 0.86rem;
    line-height: 1.58;
    color: var(--text-dim);
    margin: 16px 0 0;
    max-width: 78ch;
}

.fx-term {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-dim);
    white-space: nowrap;
}

.fx-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Latency figure (the queue finding) ── */
.fx-latency {
    margin: 0;
    /* Single source of truth for the "queue waiting" colour: the bar segment
       and its legend swatch both read this, so they can never drift apart.
       At alpha 0.50 the fill clears WCAG 1.4.11's 3:1 for meaningful non-text
       graphics on both surfaces it lands on (track 3.12:1, page background
       3.10:1; the measured floor is 0.49) and stays 2.27:1 distinct from the
       work sliver. */
    --fx-wait-fill: oklch(0.78 0.13 75 / 0.50);
}

.fx-latency-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.fx-latency-head strong {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    font-variant-numeric: tabular-nums;
}

.fx-track {
    display: flex;
    height: 56px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
}

/* The work sliver keeps its true 3.6% share; the min-width is a rendering
   floor only (it never engages above a ~84px track), so the bar cannot lie. */
.fx-track-work {
    flex: 0 0 3.6%;
    min-width: 3px;
    background: var(--primary);
}

.fx-track-wait {
    flex: 1 1 auto;
    background: var(--fx-wait-fill);
    border-left: 1px solid var(--border);
    transform-origin: left center;
    animation: fx-wait-fill 900ms var(--ease-out) both;
}

@keyframes fx-wait-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.fx-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin-top: 14px;
}

.fx-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.fx-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.fx-swatch.is-work {
    background: var(--primary);
}

.fx-swatch.is-wait {
    background: var(--fx-wait-fill);
}

/* ── Callout (neutral card; the label carries the warning signal) ── */
.fx-callout {
    margin: 30px 0 0;
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    max-width: 84ch;
}

.fx-callout-label {
    font-family: var(--font-display);
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--warning);
    margin: 0 0 10px;
}

.fx-callout p:last-child {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.64;
    color: var(--text);
    margin: 0;
}

/* ── Architecture: role lanes over an infrastructure spine ── */
.fx-arch {
    margin-top: 8px;
}

.fx-arch-group {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0 0 14px;
}

.fx-arch-group:not(:first-child) {
    margin-top: 34px;
}

.fx-arch-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 18px;
    align-items: start;
    padding: 18px 0;
    border-top: 1px solid var(--border);
}

.fx-arch-row:last-child {
    border-bottom: 1px solid var(--border);
}

/* The spine: a 1px rail marking the infrastructure band as one body */
.fx-arch-spine {
    border-left: 1px solid var(--border-strong);
    padding-left: 22px;
    margin-left: 19px;
}

.fx-arch-spine .fx-arch-row {
    border-top-color: var(--border);
}

.fx-arch-num {
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 9px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

/* Roles are solid markers; infrastructure is outlined, so the two bands read
   as different kinds of thing before a single word is parsed. */
.fx-arch-row.is-infra .fx-arch-num {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
}

.fx-arch-body h3 {
    font-family: var(--font-display);
    font-size: 1.04rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.fx-arch-body p {
    font-family: var(--font-body);
    font-size: 0.94rem;
    line-height: 1.62;
    color: var(--text);
    margin: 0;
    max-width: 74ch;
}

/* ── Anchor deployment panel ── */
.fx-anchor {
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 28px 30px 26px;
    margin-bottom: 30px;
}

.fx-anchor-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
}

.fx-anchor-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

.fx-anchor-status {
    font-family: var(--font-body);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 999px;
    padding: 3px 11px;
}

.fx-anchor-scope {
    font-family: var(--font-body);
    font-size: 0.84rem;
    color: var(--text-dim);
    margin: 0 0 6px;
}

.fx-anchor-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}

.fx-anchor-list li {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.62;
    color: var(--text);
    padding: 14px 0 14px 26px;
    border-top: 1px solid var(--border);
    position: relative;
}

.fx-anchor-list li::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 1.72em;
    width: 11px;
    height: 1px;
    background: var(--primary);
}

.fx-anchor-list li strong {
    color: var(--text-bright);
    font-weight: 600;
}

.fx-anchor-link {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    transition: border-color 200ms var(--ease-out);
}

.fx-anchor-link:hover,
.fx-anchor-link:focus-visible {
    border-bottom-color: var(--primary);
}

/* ── Telegram mockup spacing ── */
.fx-mock {
    max-width: 620px;
}

/* ── Measurement scale (0 → 4) ── */
.fx-scale {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: 0;
    margin-bottom: 18px;
}

.fx-scale-step {
    padding: 18px 22px 20px 0;
    border-top: 2px solid var(--border);
}

.fx-scale-step:last-child {
    border-top-color: var(--primary);
}

.fx-scale-num {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-bright);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.fx-scale-step p {
    font-family: var(--font-body);
    font-size: 0.87rem;
    line-height: 1.52;
    color: var(--text-dim);
    margin: 0;
    padding-right: 8px;
}

.fx-scale-note {
    font-family: var(--font-body);
    font-size: 0.88rem;
    line-height: 1.58;
    color: var(--text);
    margin: 0 0 26px;
    max-width: 74ch;
}

/* ── Bands ── */
.fx-bands {
    display: grid;
    gap: 0;
    margin: 0 0 6px;
}

.fx-band-row {
    display: grid;
    grid-template-columns: 148px 74px 1fr;
    gap: 18px;
    align-items: baseline;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.fx-band-row:last-child {
    border-bottom: 1px solid var(--border);
}

.fx-band-range {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.fx-band-row p {
    font-family: var(--font-body);
    font-size: 0.93rem;
    line-height: 1.56;
    color: var(--text);
    margin: 0;
}

.fx-band {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text);
    white-space: nowrap;
}

.fx-band.is-provisional {
    border-color: var(--warning);
    color: var(--warning);
}

.fx-band.is-scalable {
    border-color: var(--primary);
    color: var(--primary);
}

.fx-band.is-optimizing {
    border-color: var(--success);
    color: var(--success);
}

/* ── Score table ── */
.fx-table-wrap {
    overflow-x: auto;
    margin-top: 6px;
    /* Browser surface: theme the scrollbar from the palette */
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.fx-table-wrap::-webkit-scrollbar {
    height: 8px;
}

.fx-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

.fx-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.93rem;
    text-align: left;
    min-width: 620px;
}

.fx-table th {
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-strong);
    color: var(--text-bright);
    font-weight: 600;
    white-space: nowrap;
}

.fx-table tbody th {
    font-weight: 600;
    color: var(--text-bright);
}

.fx-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.fx-table td.fx-score {
    color: var(--text-bright);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fx-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    min-width: 90px;
    margin-top: 6px;
    overflow: hidden;
}

.fx-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

/* ── Growth ladder ── */
.fx-stages {
    display: grid;
    gap: 0;
}

.fx-stage {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 26px;
    align-items: start;
    padding: 22px 0;
    border-top: 1px solid var(--border);
}

.fx-stage:last-child {
    border-bottom: 1px solid var(--border);
}

.fx-stage-badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 8px;
    padding: 4px 10px;
    margin-bottom: 10px;
}

.fx-stage-head h3 {
    font-family: var(--font-display);
    font-size: 1.04rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0;
}

.fx-stage-meta {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 8px 18px;
    margin: 0;
}

.fx-stage-meta dt {
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-dim);
}

.fx-stage-meta dd {
    font-family: var(--font-body);
    font-size: 0.91rem;
    line-height: 1.56;
    color: var(--text);
    margin: 0;
}

/* ── Engagement phases ── */
.fx-phases {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fx-phase {
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

.fx-phase:last-child {
    border-bottom: 1px solid var(--border);
}

.fx-phase-head {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 18px;
    align-items: start;
}

.fx-phase-num {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.fx-phase-head h3 {
    font-family: var(--font-display);
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.fx-phase-head p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.64;
    color: var(--text);
    margin: 0;
    max-width: 74ch;
}

.fx-phase-out-label {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 16px 0 0 64px;
}

.fx-phase-out {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin: 6px 0 0 64px;
    padding: 0;
}

.fx-phase-out li {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text);
}

.fx-phase-out li::after {
    content: "·";
    margin: 0 9px;
    color: var(--border-strong);
}

.fx-phase-out li:last-child::after {
    content: none;
}

/* ── Fit columns ── */
.fx-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.fx-fit-col {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 28px;
}

.fx-fit-yes {
    border-color: var(--border-strong);
}

.fx-fit-col h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 16px;
}

.fx-fit-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fx-fit-col li {
    font-family: var(--font-body);
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--text);
    padding-left: 22px;
    position: relative;
    margin-bottom: 10px;
}

.fx-fit-col li:last-child {
    margin-bottom: 0;
}

.fx-fit-yes li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.fx-fit-no li::before {
    content: "✕";
    position: absolute;
    left: 0;
    color: var(--warning);
    font-weight: 700;
}

/* ── FAQ (native details/summary: no JS, keyboard accessible) ── */
.fx-faq {
    display: grid;
    gap: 12px;
    max-width: 860px;
}

.fx-faq-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 22px;
}

.fx-faq-item[open] {
    border-color: var(--border-strong);
}

.fx-faq-q {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
}

.fx-faq-q::-webkit-details-marker {
    display: none;
}

.fx-faq-q::after {
    content: "+";
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
}

.fx-faq-item[open] .fx-faq-q::after {
    content: "–";
}

.fx-faq-a {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.62;
    color: var(--text);
    margin: 12px 0 0;
    max-width: 76ch;
}

/* ── Closing CTA ── */
.fx-close {
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 40px 36px;
    text-align: center;
}

.fx-close h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2.6vw, 1.6rem);
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.fx-close p {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-dim);
    margin: 0 auto 24px;
    max-width: 640px;
}

.fx-close .cta-row {
    align-items: center;
    margin-bottom: 0;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .fx-stage {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 720px) {
    .fx-page {
        padding: 48px 18px 72px;
    }

    .fx-hero {
        margin-bottom: 56px;
    }

    .fx-section {
        margin-bottom: 56px;
    }

    .fx-anchor {
        padding: 22px 20px 20px;
    }

    .fx-arch-row {
        grid-template-columns: 34px 1fr;
        gap: 14px;
    }

    .fx-arch-spine {
        padding-left: 14px;
        margin-left: 16px;
    }

    .fx-band-row {
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: start;
    }

    .fx-stage-meta {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .fx-stage-meta dd {
        margin-bottom: 8px;
    }

    .fx-phase-out-label,
    .fx-phase-out {
        margin-left: 0;
    }

    .fx-scale-step {
        padding-right: 14px;
    }

    .fx-close {
        padding: 30px 22px;
    }
}

@media (max-width: 480px) {
    .fx-track {
        height: 46px;
    }

    .fx-latency-head strong {
        font-size: 1.3rem;
    }
}
