/*
 * The home page: the hero, the night flight over downtown Dallas (flight.js)
 * behind the headline and Book a consultation; What we do, ERP, Software
 * and Devices as panels, one open at a time (home.js); Howdyline, beside
 * its example call on a phone (call.js, call.css); How we work, four steps
 * coming up over a photo of an office at night; and Talk to us, over
 * downtown Dallas at night.
 *
 * Everything that moves waits for prefers-reduced-motion: no-preference, so
 * with reduced motion the flight is one still frame, the panels open at
 * once and the call is over and still.
 */

/* ---- Hero: the night flight ---- */

/* As tall as the window allows without a viewport unit: tall on a phone,
   square on a tablet, wide from --breakpoint-lg, and never shorter than its
   words. The words sit at the bottom, over the city's lights. */
.hero {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: end;
    /* A set width, so the height limits below can't narrow it through the ratio. */
    inline-size: 100%;
    aspect-ratio: 9 / 16;
    min-block-size: var(--container-lg);
    max-block-size: calc(var(--container-3xl) + var(--space-12));
    overflow: clip;
    background: var(--background);
}

/* The dark ground the flight fades in over, with a faint dome of city light;
   it's all there is if the flight can't load. Shades at the top, under the
   header, and at the bottom, under the words. */
.hero-ground {
    position: absolute;
    z-index: var(--z-behind);
    inset: 0;
    background:
        radial-gradient(110% 70% at 50% 38%, color-mix(in srgb, var(--border-strong) 45%, transparent), transparent 70%),
        var(--background);
}

.hero-ground::before,
.hero-ground::after {
    content: "";
    position: absolute;
    z-index: var(--z-raised);
    inset: 0;
    pointer-events: none;
}

.hero-ground::before {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--background) 72%, transparent), transparent 22%);
}

/* Darker under the words: from the bottom, and from the start edge. */
.hero-ground::after {
    background:
        linear-gradient(to top, var(--background) 0%, color-mix(in srgb, var(--background) 72%, transparent) 38%, transparent 72%),
        linear-gradient(to right, color-mix(in srgb, var(--background) 55%, transparent), transparent 60%);
}

.hero-ground:dir(rtl)::after {
    background:
        linear-gradient(to top, var(--background) 0%, color-mix(in srgb, var(--background) 72%, transparent) 38%, transparent 72%),
        linear-gradient(to left, color-mix(in srgb, var(--background) 55%, transparent), transparent 60%);
}

.flight {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    opacity: 0;
}

.flight.is-live {
    opacity: 1;
}

.hero-inner {
    position: relative;
    inline-size: 100%;
    padding-block: var(--space-24) var(--space-8);
}

.hero h1 {
    margin: 0;
    font-size: var(--text-display-md);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-display);
}

.hero h1 > span {
    display: block;
}

.hero-dot {
    color: var(--primary);
}

.hero-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4) var(--space-5);
    margin-block-start: var(--space-5);
}

.hero-text {
    display: grid;
    justify-items: start;
    gap: var(--space-6);
}

.hero .lead {
    margin: 0;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-6);
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: var(--tap-target);
    color: var(--foreground);
    font-size: var(--text-ui);
    font-weight: var(--weight-medium);
    text-decoration: none;
}

.hero-link:hover {
    color: var(--green-text);
}

.hero-link .icon:dir(rtl) {
    scale: -1 1;
}

/* Where the flight is, and its pause button. The place shows from
   --breakpoint-md; the button always, once the flight is moving. */
.hero-note {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--muted-foreground);
}

.hero-place {
    display: none;
    margin: 0;
    font-size: var(--text-sm);
    letter-spacing: var(--tracking-wider);
    font-variant-numeric: tabular-nums;
}

.flight-pause {
    display: inline-grid;
    place-items: center;
    inline-size: var(--tap-target);
    block-size: var(--tap-target);
    padding: 0;
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--glass);
    color: var(--foreground);
    cursor: pointer;
}

.flight-pause:hover {
    border-color: var(--muted-foreground);
}

.flight-pause[hidden],
.flight-pause .i-play,
.flight-pause.is-paused .i-pause {
    display: none;
}

.flight-pause.is-paused .i-play {
    display: block;
}

.flight-pause svg {
    inline-size: var(--icon-size);
    block-size: var(--icon-size);
}

@media (min-width: 40rem) {
    .hero {
        aspect-ratio: 1;
    }
}

@media (min-width: 48rem) {
    .hero-place {
        display: block;
    }
}

@media (min-width: 56.25rem) {
    .hero {
        aspect-ratio: 16 / 9;
    }

    .hero-inner {
        padding-block-end: var(--space-12);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .flight {
        transition: opacity var(--duration-slowest) var(--ease-standard);
    }
}

/* ---- Shared by the sections below ---- */

.button-secondary {
    border: var(--border-width) solid var(--border-strong);
    background: transparent;
    color: var(--foreground);
    box-shadow: none;
}

.button-secondary:hover {
    border-color: var(--foreground);
    background: var(--secondary);
}

/* ---- What we do: three panels, ERP first ---- */

.services {
    padding-block: var(--space-16);
}

/* The heading, with the lead at the end of its row once there's room;
   How we work's too. */
.services-head,
.ways-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4) var(--space-12);
    margin-block-end: var(--space-12);
}

.services-head h2,
.ways-head h2 {
    margin: 0;
    font-size: var(--text-display-md);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-heading);
}

.services-head .lead,
.ways-head .lead {
    max-inline-size: var(--container-md);
    margin: 0;
    line-height: var(--leading-normal);
}

/* On a phone, rows one under another: an open one tall, its words at the
   bottom of its photo; a closed one a short row with just its name. */
.services-list {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.service {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: end;
    min-block-size: var(--container-md);
    padding: var(--space-6);
    overflow: clip;
    border-radius: var(--radius-sm);
    background: var(--card);
}

/* The photo fills the panel, behind the words; until it loads, or if it
   never does, the panel's own ground shows. */
.service-photo {
    position: absolute;
    z-index: var(--z-behind);
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    filter: saturate(0.8) contrast(1.05) brightness(0.88);
}

.service-erp .service-photo {
    object-position: 55% 50%;
}

.service-software .service-photo {
    object-position: 70% 50%;
}

.service-devices .service-photo {
    object-position: 65% 60%;
}

/* Darker under the words, and a little at the top, under the number. */
.service::after {
    content: "";
    position: absolute;
    z-index: var(--z-behind);
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to top, color-mix(in srgb, var(--background) 92%, transparent) 0%, color-mix(in srgb, var(--background) 78%, transparent) 42%, transparent 80%),
        linear-gradient(to bottom, color-mix(in srgb, var(--background) 55%, transparent), transparent 24%);
}

.service h3 {
    margin: 0;
    font-size: var(--text-3xl);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-snug);
}

/* The name is the panel's button, and it covers the whole panel, so a tap
   anywhere on it opens it. */
.service-toggle {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.service-toggle::after {
    content: "";
    position: absolute;
    inset: 0;
}

.service-toggle:focus-visible {
    outline: none;
}

.service:has(.service-toggle:focus-visible) {
    outline: var(--focus-width) solid var(--ring);
    outline-offset: var(--focus-offset);
}

.service-num {
    position: absolute;
    inset-block-start: var(--space-6);
    inset-inline-start: var(--space-6);
    color: var(--green-text);
    font-size: var(--text-ui);
    font-variant-numeric: tabular-nums;
}

.service-body {
    display: grid;
    gap: var(--space-4);
    margin-block-start: var(--space-3);
}

.service-body p {
    max-inline-size: var(--container-md);
    margin: 0;
    color: var(--muted-foreground);
}

.service-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-8);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-ui);
    font-weight: var(--weight-medium);
}

.service-items li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.service-items li::before {
    content: "";
    flex: none;
    inline-size: var(--space-2);
    aspect-ratio: 1;
    border-radius: var(--radius-full);
    background: var(--green);
}

/* Closed, on a phone: the name, with the number at the end of the row. */
.service:has([aria-expanded="false"]) {
    align-content: center;
    min-block-size: var(--space-24);
}

.service:has([aria-expanded="false"]) .service-photo {
    opacity: 0.45;
}

.service:has([aria-expanded="false"]) .service-body {
    display: none;
}

.service:has([aria-expanded="false"]) .service-num {
    display: grid;
    align-content: center;
    inset-block: 0;
    inset-inline: auto var(--space-6);
}

/* From --breakpoint-lg, side by side and as tall as each other: the open one
   wide, the closed ones narrow slices with their names standing up. */
@media (min-width: 56.25rem) {
    .services-list {
        display: flex;
        block-size: var(--container-xl);
    }

    .service {
        flex: 1 1 0;
        min-inline-size: 0;
        min-block-size: 0;
        padding: var(--space-8) var(--space-6);
    }

    .service:has([aria-expanded="true"]) {
        flex-grow: 4.6;
        padding-inline: var(--space-8);
    }

    .service-num {
        inset-block-start: var(--space-8);
    }

    .service:has([aria-expanded="true"]) .service-num {
        inset-inline-start: var(--space-8);
    }

    .service:has([aria-expanded="false"]) {
        align-content: end;
        min-block-size: 0;
    }

    .service:has([aria-expanded="false"]) .service-name {
        display: block;
        writing-mode: vertical-rl;
        scale: -1;
        white-space: nowrap;
    }

    /* Kept in the layout, out of sight, so it can fade in as its panel opens. */
    .service:has([aria-expanded="false"]) .service-body {
        display: grid;
        position: absolute;
        visibility: hidden;
        opacity: 0;
    }

    .service:has([aria-expanded="false"]) .service-num {
        display: block;
        inset-block: var(--space-8) auto;
        inset-inline: var(--space-6) auto;
    }
}

/* Side by side, the open one widens. On a phone a row opens at once, so
   home.js can keep the tapped row where it was. */
@media (prefers-reduced-motion: no-preference) {
    .service {
        transition:
            flex-grow var(--duration-slower) var(--ease-out),
            padding var(--duration-slower) var(--ease-out);
    }

    .service-photo {
        transition: opacity var(--duration-slower) var(--ease-out);
    }

    .service-body {
        transition: opacity var(--duration-slower) var(--ease-out) var(--duration-medium);
    }
}

/* ---- Howdyline: what it is, beside an example call on a phone ---- */

.howdyline {
    padding-block: var(--space-16);
}

/* The words over the phone on a phone, beside it from --breakpoint-lg. */
.howdyline > .wrap {
    display: grid;
    gap: var(--space-12);
}

.howdyline h2 {
    margin-block: var(--space-3) 0;
    font-size: var(--text-display-md);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-heading);
}

.howdyline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4) var(--space-8);
    margin-block-start: var(--space-8);
}

.howdyline-note {
    margin: 0;
    color: var(--muted-foreground);
    font-size: var(--text-ui);
}

.howdyline .voice {
    justify-self: center;
}

@media (min-width: 56.25rem) {
    .howdyline > .wrap {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
        align-items: center;
    }
}

/* ---- How we work: four steps over the foot of a photo band ---- */

.ways {
    padding-block-end: var(--space-16);
}

/* Across the page, twice as wide as it's tall within limits. It keeps its
   place while the photo loads, on the card ground. */
.ways-photo {
    position: relative;
    inline-size: 100%;
    aspect-ratio: 2 / 1;
    min-block-size: var(--container-md);
    max-block-size: var(--container-2xl);
    overflow: clip;
    background: var(--card);
}

.ways-photo img,
.talk-photo img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    filter: saturate(0.8) contrast(1.05) brightness(0.88);
}

.ways-photo img {
    object-position: 50% 40%;
}

/* Into the page at the foot, where the words come up over it, and a little
   at the top. */
.ways-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, var(--background) 0%, color-mix(in srgb, var(--background) 72%, transparent) 34%, transparent 68%),
        linear-gradient(to bottom, var(--background), transparent 22%);
}

.ways-inner {
    position: relative;
    margin-block-start: calc(-1 * var(--space-32));
}

/* One under another on a phone, two to a row from --breakpoint-md and four
   from --breakpoint-lg. */
.ways-list {
    display: grid;
    gap: var(--space-8) var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.way {
    display: grid;
    align-content: start;
    gap: var(--space-2);
    padding-block-start: var(--space-4);
    border-block-start: var(--border-width) solid var(--border-strong);
}

.way-num {
    color: var(--green-text);
    font-family: var(--font-heading);
    font-size: var(--text-ui);
    font-variant-numeric: tabular-nums;
}

.way h3 {
    margin: 0;
    font-size: var(--text-2xl);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-snug);
}

.way p {
    margin: 0;
    color: var(--muted-foreground);
}

@media (min-width: 48rem) {
    .ways-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 56.25rem) {
    .ways {
        padding-block-end: var(--space-24);
    }

    .ways-inner {
        margin-block-start: calc(-1 * (var(--space-32) + var(--space-16)));
    }

    .ways-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ---- Talk to us: over downtown Dallas at night ---- */

/* As tall as the window allows without a viewport unit, like the hero: the
   words at the top, over the night sky, and the city filling the rest. */
.talk {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: start;
    inline-size: 100%;
    aspect-ratio: 9 / 16;
    min-block-size: var(--container-xl);
    max-block-size: calc(var(--container-3xl) + var(--space-12));
    overflow: clip;
}

.talk-photo {
    position: absolute;
    z-index: var(--z-behind);
    inset: 0;
    background: var(--card);
}

.talk-photo img {
    object-position: 55% 100%;
}

/* Darker at the top, under the words, and into the footer at the foot. */
.talk-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, var(--background) 0%, color-mix(in srgb, var(--background) 82%, transparent) 45%, transparent 78%),
        linear-gradient(to top, var(--background), transparent 16%);
}

.talk-text {
    display: grid;
    justify-items: start;
    gap: var(--space-6);
    padding-block: var(--space-16);
}

.talk h2 {
    max-inline-size: var(--container-2xl);
    margin: 0;
    font-size: var(--text-display-md);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-heading);
}

.talk .lead {
    max-inline-size: var(--container-xl);
    margin: 0;
}

.talk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4) var(--space-8);
    margin-block-start: var(--space-2);
}

.talk-email {
    margin: 0;
    color: var(--muted-foreground);
    font-size: var(--text-ui);
}

.talk-email a {
    color: var(--foreground);
}

@media (min-width: 40rem) {
    .talk {
        aspect-ratio: 1;
    }
}

@media (min-width: 56.25rem) {
    .talk {
        aspect-ratio: 16 / 9;
    }

    .talk-text {
        padding-block: var(--space-24);
    }
}
