/* ==========================================================================
   Landing page — header, four service panels, footer. Nothing else.

   On desktop the page is a single fixed screen: the panels take whatever
   height the header and footer leave. On phones, and on screens too short to
   hold the grid legibly, it falls back to normal scrolling.
   ========================================================================== */

.services-screen {
    flex: 1;
    display: flex;
    min-height: 0;
}

.services-screen .container {
    display: flex;
    flex-direction: column;
    padding-block: clamp(1rem, 2.2vh, 1.75rem);
}

/* --------------------------------------------------------------------------
   The claim — one line above the panels
   -------------------------------------------------------------------------- */
.claim-band {
    padding-block: clamp(0.75rem, 2.4vh, 1.75rem);
}

.claim {
    max-width: 46rem;
    font-size: clamp(1.35rem, 2.8vw, 2.4rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.035em;
    color: var(--text-main);
}

/* The part that sets this company apart from a software house. */
.claim em {
    font-style: normal;
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   The grid. Takes any number of services: the outer edge comes from the
   wrapper's top/left rules and each cell's right/bottom rules, so nothing
   depends on the count.
   -------------------------------------------------------------------------- */
.services-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Rows share the height evenly, but never shrink below a readable floor —
       past that the grid scrolls inside the screen instead of crushing. */
    grid-auto-rows: minmax(10rem, 1fr);
    border-top: 1px solid var(--rule);
    border-left: 1px solid var(--rule);
}

.service-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    padding: clamp(1.5rem, 3.2vh, 2.5rem) clamp(1.5rem, 2.6vw, 2.5rem);
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.4s ease;
}

/* An odd final card would otherwise sit alone in half a row. */
.service-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.service-card:hover,
.service-card.is-active {
    background-color: var(--bg-subtle);
}

a.service-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -4px;
}

/* --------------------------------------------------------------------------
   Artwork — owns the right of the card so it never sits under the copy
   -------------------------------------------------------------------------- */
.service-art {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 44%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.62;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s;
}

.service-card:last-child:nth-child(odd) .service-art {
    width: 30%;
}

.service-art canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.service-card:hover .service-art,
.service-card.is-active .service-art {
    transform: scale(1.04);
    opacity: 1;
}

.service-wash {
    position: absolute;
    bottom: -160px;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    height: 320px;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(90px);
    opacity: 0.04;
    transition: opacity 0.6s;
    pointer-events: none;
    z-index: 1;
}

.service-card:hover .service-wash,
.service-card.is-active .service-wash {
    opacity: 0.12;
}

/* --------------------------------------------------------------------------
   Copy — always visible; hover is not available on touch devices
   -------------------------------------------------------------------------- */
.service-body {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    max-width: 58%;
}

.service-card:last-child:nth-child(odd) .service-body {
    max-width: 64%;
}

.service-card h2 {
    font-size: clamp(1.35rem, 2.1vw, 1.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 0.65rem;
}

.service-desc {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.service-tag {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    padding: 0.18rem 0.5rem;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: 4px;
    text-transform: uppercase;
}

.service-more {
    margin-top: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.service-more span {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover .service-more span {
    transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Desktop: lock to one screen, but only when there is room to do it well
   -------------------------------------------------------------------------- */
@media (min-width: 821px) and (min-height: 660px) {
    body.landing {
        height: 100svh;
        overflow: hidden;
    }

    /* If a future service count outgrows the screen, the grid scrolls here
       while the header and footer stay put. */
    body.landing .services-screen {
        overflow-y: auto;
    }
}

/* Height tiers. The tallest panel (two-line title, four-line description,
   link) sets the limits; each tier gives up the least important thing first.

   1. Below ~1000px the tag chips go — they repeat what the description says. */
@media (min-width: 821px) and (max-height: 999px) {
    .service-tags {
        display: none;
    }
    .service-desc {
        margin-bottom: 0;
    }
}

/* 2. Laptop heights: smaller title, and a wider copy column so descriptions
      wrap to three lines instead of four — nothing gets truncated. */
@media (min-width: 821px) and (max-height: 860px) {
    .service-card {
        padding-block: clamp(1rem, 2.6vh, 1.75rem);
    }
    .service-card h2 {
        font-size: 1.35rem;
        margin-bottom: 0.45rem;
    }
    .service-desc {
        font-size: 0.88rem;
        line-height: 1.5;
    }
    .service-body {
        max-width: 62%;
    }
    .service-art {
        width: 36%;
    }
    .service-more {
        margin-top: 0.6rem;
    }
}

/* 3. Just above the scroll fallback: tighten further, but never truncate.
      Below the lock threshold the page scrolls instead. */
@media (min-width: 821px) and (max-height: 700px) {
    .service-card h2 {
        font-size: 1.25rem;
    }
    .service-desc {
        line-height: 1.45;
    }
    .service-body {
        max-width: 64%;
    }
    .service-art {
        width: 34%;
    }
}

/* --------------------------------------------------------------------------
   Phones: one service per row, the centred one animates
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
    .services-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .service-card {
        justify-content: flex-start;
    }

    .service-art,
    .service-card:last-child:nth-child(odd) .service-art {
        position: relative;
        inset: auto;
        width: 100%;
        height: 11rem;
        margin-bottom: 1.25rem;
        opacity: 0.55;
    }

    .service-body,
    .service-card:last-child:nth-child(odd) .service-body {
        max-width: none;
    }
}
