/* ========================================
   HOMEPAGE — front-page.php
   Data-first homepage. Loaded only on the front page (functions.php),
   following the helm.css / research.css pattern of one scoped stylesheet.
   Uses the base tokens from style.css only.
   ======================================== */

/* ----------------------------------------
   Shared bits
   ---------------------------------------- */

/* "What we do" is linked from the header as /#what-we-do, a native jump
   (main.js only smooth-scrolls bare "#…" links), so keep headings clear
   of the fixed header. */
.home-data .section[id] {
    scroll-margin-top: 4.5rem;
}

.home-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.home-intro {
    max-width: 60ch;
    margin: 1rem 0 0;
}

.home-more {
    margin: 2.5rem 0 0;
}

.home-more a {
    font-family: var(--sans-ui);
    font-size: 0.9rem;
    color: var(--ink-black);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}

.home-more a:hover {
    color: var(--accent-hover);
}

/* ----------------------------------------
   1. Hero
   ---------------------------------------- */

/* No breadcrumbs above the hero, so clear the fixed header
   the way the Helm hero does (helm.css) */
.home-hero {
    padding-top: 9rem;
}

.home-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 4rem;
    align-items: center;
}

.home-hero h1 {
    margin-bottom: 1.5rem;
}

.home-hero__lede {
    max-width: 52ch;
    margin-bottom: 0;
}

/* Before/after data sample */
.data-sample {
    margin: 0;
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

.data-sample__table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-paper);
    border: 1px solid var(--border-subtle);
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.4;
}

.data-sample__table caption {
    caption-side: top;
    text-align: left;
    padding: 0 0 0.5rem;
    font-family: var(--sans-ui);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
}

.data-sample__table th,
.data-sample__table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-sample__table tr:last-child td {
    border-bottom: 0;
}

.data-sample__table th {
    font-family: var(--sans-ui);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
}

/* Messy input reads as messy: dimmer, with the inconsistencies left visible */
.data-sample__table--before td {
    color: var(--charcoal);
}

.data-sample__table--before td.is-missing {
    color: var(--muted);
}

/* Clean output reads as settled: full ink, an accent rule on the left */
.data-sample__table--after {
    border-left: 3px solid var(--sage);
}

.data-sample__table--after td {
    color: var(--ink-black);
    font-weight: 600;
}

.data-sample__arrow {
    justify-self: center;
    font-family: var(--sans-ui);
    font-size: 1.25rem;
    line-height: 1;
    color: var(--accent);
    transform: rotate(90deg);
}

.data-sample__check {
    font-family: var(--sans-ui);
    font-size: 0.8rem;
    color: var(--sage);
    font-weight: 500;
}

/* ----------------------------------------
   3. How we work — the four-step loop
   ---------------------------------------- */

.home-loop {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 0;
}

.home-loop .belief-item {
    padding: 1.75rem;
}

.home-loop__n {
    display: block;
    margin-bottom: 0.75rem;
    font-family: var(--serif-display);
    font-size: 2rem;
    line-height: 1;
    color: var(--accent);
}

.home-loop .belief-item h4 {
    margin-bottom: 0.5rem;
}

/* ----------------------------------------
   4. From the lab
   ---------------------------------------- */

.home-lab {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
}

.home-lab__card {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border: 1px solid var(--light-gray);
    background: var(--bg-paper);
    color: var(--ink-black);
    text-decoration: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.home-lab__card:hover,
.home-lab__card:focus-visible {
    border-color: var(--ink-black);
    transform: translateY(-4px);
}

.home-lab__card .sans-label {
    margin-bottom: 0.75rem;
}

.home-lab__card h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.home-lab__card p:not(.sans-label) {
    font-size: 0.95rem;
    color: var(--charcoal);
    flex: 1;
}

.home-lab__link {
    font-family: var(--sans-ui);
    font-size: 0.875rem;
    color: var(--ink-black);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}

/* ----------------------------------------
   5. Talk to us
   ---------------------------------------- */

.home-cta {
    background: var(--bg-subtle);
    border-top: 1px solid var(--light-gray);
}

.home-cta__inner {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.home-cta__inner h2 {
    margin-bottom: 1rem;
}

.home-cta__inner .subtitle {
    margin-bottom: 2rem;
}

/* ----------------------------------------
   Responsive
   ---------------------------------------- */

@media (max-width: 1024px) {
    .home-loop {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .home-hero {
        padding-top: 7rem;
    }

    .home-hero__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .home-lab {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-ctas {
        flex-direction: column;
        align-items: stretch;
    }

    .home-ctas .cta-button {
        text-align: center;
    }
}

@media (max-width: 560px) {
    .home-loop {
        grid-template-columns: minmax(0, 1fr);
    }

    .data-sample {
        padding: 1rem;
    }

    /* On phones only the name column may wrap: a date or an amount
       broken across two lines stops reading as data */
    .data-sample__table {
        font-size: 0.72rem;
    }

    .data-sample__table th,
    .data-sample__table td {
        padding: 0.45rem 0.5rem;
    }

    .data-sample__table th:first-child,
    .data-sample__table td:first-child {
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-lab__card {
        transition: none;
    }

    .home-lab__card:hover,
    .home-lab__card:focus-visible {
        transform: none;
    }
}
