/*
 * The home page: the one front door.
 *
 * Layout only. Every colour, radius, font and spacing step comes from the
 * tokens in style.css, which mirror the Fleet's own (fleet/public/css/
 * tokens.css) - so the Fleet dashboard and this page read as one system rather
 * than two products that happen to share a logo. Cards, buttons, inputs and
 * status lines are the shared components from cnc-components.css; nothing here
 * restyles them.
 */

/* The same reset the tool pages get from style.css. The shared components in
   cnc-components.css are written expecting it. */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Anchor jumps must clear the sticky top bar, or the heading they land on sits
   underneath it. */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
}

.home-body {
    background:
        var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

.home-svg-defs {
    position: absolute;
    width: 0;
    height: 0;
}

.home-body :is(h1, h2, h3) {
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

.home-grad {
    color: var(--text-primary);
}

.home-body .hidden {
    display: none !important;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.home-nav {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky, 200);
    display: flex;
    align-items: center;
    gap: var(--large-spacing);
    padding: 14px clamp(16px, 3vw, 44px);
    background: var(--overlay-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.home-nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    margin-right: auto;
}

.home-nav-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.home-nav-names {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.home-nav-name {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.home-nav-product {
    font-size: 12px;
    color: var(--text-secondary);
}

.home-nav-links {
    display: flex;
    gap: clamp(12px, 2vw, 28px);
}

.home-nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s var(--ease, ease);
}

.home-nav-links a:hover {
    color: var(--text-primary);
}

.home-nav-cta {
    flex-shrink: 0;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    gap: clamp(28px, 4vw, 72px);
    align-items: start;
    max-width: 1360px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 88px) clamp(16px, 3vw, 44px) clamp(32px, 5vw, 72px);
}

.home-eyebrow,
.home-section-eyebrow {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-light);
}

.home-hero h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
}

.home-lede {
    margin: 20px 0 0;
    max-width: 56ch;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    color: var(--text-secondary);
}

.home-lede-list {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.home-lede-list li {
    position: relative;
    padding-left: 26px;
    color: var(--text-secondary);
}

.home-lede-list li strong {
    color: var(--text-primary);
}

.home-lede-list li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0.62em;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-round);
    background: var(--primary);
}

.home-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.home-strip i {
    width: 4px;
    height: 4px;
    border-radius: var(--radius-round);
    background: var(--text-dim);
}

/* ── The access card ─────────────────────────────────────────────────────── */

.home-access {
    position: sticky;
    top: 96px;
}

.home-access-card {
    padding: clamp(20px, 2vw, 30px);
}

.home-access-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.home-access-logo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    margin-top: 2px;
}

.home-access-head h2 {
    font-size: 1.4rem;
}

.home-access-sub {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.home-access-reason {
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--warning-rgb), 0.32);
    border-left: 3px solid var(--color-warning);
    background: rgba(var(--warning-rgb), 0.09);
    font-size: 14px;
}

.home-access-pane {
    display: grid;
    gap: 6px;
}

.home-access-note {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.home-access-note strong {
    color: var(--text-primary);
}

.home-access-submit {
    width: 100%;
    margin-top: 16px;
}

.home-access-help {
    margin: 14px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.home-access-help a {
    color: var(--primary-light);
}

.home-access-fine {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--text-dim);
}

/* The hidden twin of a real field: a person never sees it, a bot fills it in. */
.home-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.home-access-switch {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.home-access-switch:empty {
    display: none;
}

.home-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 14px;
    text-align: left;
    color: var(--primary-light);
    cursor: pointer;
}

.home-link-btn:hover {
    text-decoration: underline;
}

.home-dev-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--primary-light);
    font-size: 14px;
}

.home-access-aside {
    margin: 16px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.home-access-aside a {
    color: var(--primary-light);
}

/* Signed in: the facts, then the way through. */

.home-session-facts {
    display: grid;
    gap: 12px;
    margin: 0 0 22px;
}

.home-session-facts div {
    display: grid;
    gap: 2px;
}

.home-session-facts dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.home-session-facts dd {
    margin: 0;
    font-size: 15px;
}

.home-session-actions {
    display: grid;
    gap: 10px;
}

/* ── Sections ────────────────────────────────────────────────────────────── */

.home-section {
    max-width: 1360px;
    margin: 0 auto;
    padding: clamp(48px, 7vw, 104px) clamp(16px, 3vw, 44px);
}

.home-section-alt {
    max-width: none;
    background: var(--hover);
    border-block: 1px solid var(--border);
}

.home-section-alt > * {
    max-width: 1360px;
    margin-inline: auto;
}

.home-section-head {
    max-width: 66ch;
    margin-bottom: clamp(28px, 4vw, 52px);
}

.home-section h2 {
    font-size: clamp(1.7rem, 2.8vw, 2.6rem);
    font-weight: 700;
}

.home-section-lede {
    margin: 16px 0 0;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    color: var(--text-secondary);
}

.home-section-lede strong {
    color: var(--text-primary);
}

/* ── Feature grids ───────────────────────────────────────────────────────── */

.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
    gap: clamp(14px, 1.6vw, 22px);
}

/* Cards following a split row rather than a section heading. */
.home-feature-grid-spaced {
    margin-top: clamp(30px, 4vw, 56px);
}

.home-feature {
    padding: clamp(18px, 1.8vw, 26px);
}

.home-feature-step {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(var(--accent-rgb), 0.34);
    background: rgba(var(--accent-rgb), 0.12);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary-light);
}

.home-feature h3 {
    font-size: 1.12rem;
    margin-bottom: 10px;
}

.home-feature p {
    margin: 0;
    font-size: 14.5px;
    color: var(--text-secondary);
}

/* ── Split rows (copy beside a visual) ───────────────────────────────────── */

.home-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 64px);
    align-items: center;
}

.home-split-reverse .home-split-visual {
    order: -1;
}

.home-tick-list {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 11px;
}

.home-tick-list li {
    position: relative;
    padding-left: 28px;
    font-size: 15px;
    color: var(--text-secondary);
}

.home-tick-list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0.42em;
    width: 11px;
    height: 6px;
    border-left: 2px solid var(--primary-light);
    border-bottom: 2px solid var(--primary-light);
    transform: rotate(-45deg);
}

/* ── The live canvas panel ───────────────────────────────────────────────── */

.home-canvas-frame {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background:
        var(--bg-card);
    overflow: hidden;
}

.home-canvas-frame canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.home-canvas-caption {
    position: absolute;
    left: 16px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.home-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-round);
    background: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.22);
}

/* ── The three-stage flow ────────────────────────────────────────────────────
 * One wide canvas carrying all three brackets, with the captions beneath it on
 * the same three columns, so a caption sits under the bracket it describes.
 * Deliberately still: the panel's job is to let three presentations of one part
 * be compared, and anything moving gets compared instead. */

.home-flow {
    margin-top: clamp(30px, 4vw, 56px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        var(--bg-card);
    overflow: hidden;
}

.home-flow-canvas {
    position: relative;
    aspect-ratio: 24 / 9;
    border-bottom: 1px solid var(--border);
}

.home-flow-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* It can be dragged, so say so with the cursor as well as the hint. */
    cursor: grab;
}

.home-flow-canvas canvas:active {
    cursor: grabbing;
}

.home-flow-hint {
    position: absolute;
    right: 14px;
    bottom: 12px;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--overlay-bg);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.home-flow-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-flow-steps li {
    padding: clamp(14px, 1.6vw, 22px);
    border-left: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.home-flow-steps li:first-child {
    border-left: 0;
}

.home-flow-steps li strong {
    color: var(--text-primary);
}

.home-flow-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: var(--radius-round);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.14);
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-light);
}

/* ── Screenshots ─────────────────────────────────────────────────────────── */

.home-shot-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(276px, 1fr));
    gap: clamp(14px, 1.6vw, 22px);
    margin-top: clamp(30px, 4vw, 56px);
}

/* ── Highlight blocks ────────────────────────────────────────────────────────
 * For the capabilities that sell the product on their own: copy beside a large
 * screenshot, on a raised panel so it reads as a claim being made rather than
 * another item in a list. Alternate sides with --flip so two in a row do not
 * look like the same block twice. */

.home-highlight {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: clamp(24px, 3.5vw, 52px);
    align-items: center;
    margin-bottom: clamp(28px, 4vw, 52px);
    padding: clamp(22px, 2.6vw, 40px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background:
        var(--bg-panel);
}

.home-highlight-flip .home-highlight-copy {
    order: 2;
}

.home-highlight-badge {
    display: inline-block;
    margin-bottom: 14px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.16);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-light);
}

.home-highlight-copy h3 {
    font-size: clamp(1.3rem, 1.9vw, 1.85rem);
    font-weight: 700;
}

.home-highlight-copy > p {
    margin: 14px 0 0;
    color: var(--text-secondary);
}

.home-highlight .home-tick-list {
    margin-top: 18px;
}

.home-shot {
    margin: 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
}

.home-shot img {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: 1px solid var(--border);
}

.home-shot figcaption {
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.home-shot figcaption strong {
    color: var(--text-primary);
}

.home-shot-lg {
    box-shadow: var(--shadow-panel);
}

/* A screenshot standing on its own, rather than inside a grid or a highlight
   panel: a dashboard is unreadable at a third of the width, so it takes the
   full content column. It must come after .home-shot, whose `margin: 0` (there
   to kill the browser's default figure margin) would otherwise wipe both the
   centring and the gap below it. */
.home-shot-wide {
    max-width: 1180px;
    margin: 0 auto clamp(28px, 3.5vw, 52px);
}

/* ── Fleet call to action, closing block, footer ─────────────────────────── */

.home-fleet-cta {
    margin-top: clamp(26px, 3vw, 40px);
}

/* The closing pitch sits in a panel of its own. Left as bare centred text on
   the page background it read as leftover space rather than the last thing
   being said. */
.home-close {
    max-width: 1360px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 88px) clamp(16px, 3vw, 44px);
}

.home-close-panel {
    max-width: 780px;
    margin: 0 auto;
    padding: clamp(32px, 5vw, 60px) clamp(24px, 4vw, 56px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background:
        var(--bg-card);
    box-shadow: var(--shadow-panel);
    text-align: center;
}

.home-close-panel h2 {
    font-size: clamp(1.7rem, 2.8vw, 2.4rem);
    font-weight: 700;
}

.home-close-panel p {
    margin: 16px auto 0;
    max-width: 52ch;
    color: var(--text-secondary);
}

.home-close-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

/* The shared primary button is width:100% for sidebar panels; a centred call
   to action has to hug its own text instead. */
.home-close-cta,
.home-close-alt {
    width: auto;
    padding-inline: 28px;
    text-decoration: none;
}

.home-close-fine {
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-dim);
}

.home-footer {
    max-width: 1360px;
    margin: 0 auto;
    padding: clamp(28px, 3vw, 40px) clamp(16px, 3vw, 44px) clamp(36px, 4vw, 56px);
    border-top: 1px solid var(--border);
}

.home-footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px clamp(20px, 4vw, 48px);
}

.home-footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.home-footer-names {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.home-footer-name {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.home-footer-product {
    font-size: 12px;
    color: var(--text-secondary);
}

.home-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px clamp(18px, 2.5vw, 32px);
    font-size: 14.5px;
}

.home-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.home-footer-links a:hover {
    color: var(--text-primary);
}

.home-footer-note {
    margin-top: clamp(22px, 3vw, 32px);
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Narrow screens ─────────────────────────────────────────────────────── */

/*
 * The shared type scale is viewport-relative because it was built for machine
 * kiosks and wide desktops: on a phone every clamp() lands on its minimum, which
 * leaves the form labels at 10px and the inputs at 12px. A sub-16px input also
 * makes iOS Safari zoom the whole page the moment somebody taps it, which on a
 * sign-in form is the first thing they do. The home page is the one page here
 * that is genuinely read on phones, so it sets its own floor rather than
 * changing the scale the tool pages depend on.
 */
@media (max-width: 760px) {
    .home-body {
        --base-font-size: 16px;
        --small-font-size: 13.5px;
        --large-font-size: 18px;
        --button-height: 48px;
    }

    /* Keep the link on a line of its own rather than breaking across two. */
    .home-access-aside a {
        display: block;
        margin-top: 2px;
    }

    .home-close-actions .cnc-btn,
    .home-close-actions .cnc-btn-primary {
        width: 100%;
    }
}

@media (max-width: 1080px) {
    .home-hero,
    .home-split,
    .home-highlight {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Stacked, the copy always leads and the screenshot follows it. */
    .home-highlight-flip .home-highlight-copy {
        order: 0;
    }

    .home-access {
        position: static;
    }

    /* The way in comes first on a phone: most people arriving on one are
       signing in, not reading. */
    .home-access {
        order: -1;
    }

    .home-split-reverse .home-split-visual {
        order: 0;
    }

    .home-nav-links {
        display: none;
    }

    /* Three brackets across a phone is three unreadable brackets: give the
       canvas more height and stack the captions under it. */
    .home-flow-canvas {
        aspect-ratio: 4 / 3;
    }

    .home-flow-steps {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-flow-steps li {
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .home-flow-steps li:first-child {
        border-top: 0;
    }
}
