/* ============================================================
   FILE: /assets/css/services.css
   STATUS: CHANGED

   Purpose: Lay out the text-only service sections and their columns.
   Future note: Keep page typography here and reuse the shared font
   and colour variables from base.css.
   ============================================================ */

/* ============================================================
   Purpose: Animate the decorative code, pencil, and cube in order.
   Future note: Keep the finished SVG visible without motion.
   ============================================================ */

.services-hero {
    position: relative;
    isolation: isolate;
    align-items: flex-start;
    min-height: 100svh;
    clip-path: inset(0 -100vmax);
}

.services-hero .hero-section__inner {
    position: relative;
    z-index: 1;
}

.services-hero-art {
    display: block;
    width: min(100%, 30rem);
    margin-inline-start: auto;
    pointer-events: none;
    overflow: visible;
}

.services-hero-trail-guide {
    visibility: hidden;
}

.services-trail-grey {
    stop-color: var(--color-grey-dark);
}

.services-trail-pink {
    stop-color: var(--color-purple-pale);
}

.services-trail-purple {
    stop-color: var(--color-purple-dark);
}

.services-hero-code {
    fill: var(--color-grey-soft);
    font-family: monospace;
    font-size: 13px;
    opacity: 0.35;
    translate: 0 -2rem;
}

.services-hero-wire,
.services-hero-pencil {
    fill: none;
    stroke: var(--color-purple-pale);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.services-hero-wire {
    stroke: var(--color-purple-dark);
    stroke-width: 3px;
    vector-effect: non-scaling-stroke;
}

.services-hero-faces {
    opacity: 0.84;
}

.services-hero-pencil {
    opacity: 0;
    fill: var(--color-purple-dark);
    stroke: var(--color-purple-light);
    transition: opacity 850ms ease-out;
}

.services-hero-art.is-drawing .services-hero-pencil {
    opacity: 1;
    transition: none;
}

.services-hero-cube {
    scale: 2.5;
    transform-origin: 305px 128px;
}

.services-hero-pencil,
.services-hero-trail {
    scale: 1.5;
    transform-origin: 305px 128px;
}

.services-hero-art.is-drawing .services-hero-faces,
.services-hero-art.is-rotating .services-hero-wire {
    visibility: hidden;
}

@media (min-width: 901px) {
    .services-hero-cube {
        translate: 119.17px 0;
    }

    .services-hero-art {
        --services-art-top: min(calc(2rem + 250px), 48svh);

        position: absolute;
        inset-block-start: var(--services-art-top);
        inset-inline-end: 0;
        width: min(30rem, calc((100svh - var(--services-art-top)) * 1.35));
        transform: translateX(-250px);
    }
}

@media (max-width: 900px) {
    /* Move the title up while keeping the code artwork below it. */
    .services-overview > section {
        padding-block: 50px;
    }

    .services-hero {
        flex-direction: column;
        gap: clamp(2rem, 14svh, 250px);
        min-height: 0;
    }

    .services-hero-art {
        width: min(100%, 30rem, 68svh);
        margin-block-start: 100px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .services-hero-code {
        animation: services-code-enter 1.2s ease-out both;
    }
}

@keyframes services-code-enter {
    from {
        opacity: 0;
        translate: 0 calc(-2rem - 40px);
    }

    to {
        opacity: var(--services-code-opacity, 0.35);
        translate: 0 -2rem;
    }
}

.services-section {
    border-block-start: 1px solid rgba(236, 196, 242, 0.15);
    scroll-margin-block-start: 7rem;
}

.services-section h2 {
    margin-block: 0 1rem;
    overflow-wrap: anywhere;
    color: var(--color-grey-mid);
}

@media (min-width: 1201px) {
    .services-section-title {
        font-size: 5rem;
    }
}

.services-section.services-contact {
    display: block;
    text-align: center;
}

.services-contact > h2 {
    font-family: var(--font-dancing);
    text-transform: none;
    font-size: 4rem;
    font-weight: 500;
    color: var(--color-purple-light);
}

.services-section.services-contact > p {
    margin-inline: auto;
    margin-block-end: 1.5rem;
}

.services-title-accent--visualisation,
.services-title-accent--dark {
    color: var(--color-purple-main);
}

.services-section > p {
    max-width: 65ch;
}

.services-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: clamp(1.5rem, 5vw, 5rem);
    margin-block-start: clamp(1.5rem, 4vw, 4rem);
}

.services-offerings {
    justify-self: center;
    text-align: left;
}

.services-offerings h3 {
    margin-block: 0 1rem;
    color: var(--color-grey-mid);
}

/* ============================================================
   Purpose: Place small decorative loops above the offering titles.
   Future note: Keep the title width independent of the artwork.
   ============================================================ */

.services-offering-heading {
    position: relative;
    padding-block-start: 3rem;
}

.services-mini-art {
    position: absolute;
    inset: 0 0 auto;
    height: 2.75rem;
    pointer-events: none;
}

.services-mini-art--cube svg {
    display: block;
    width: 2rem;
    height: calc(2rem + 4px);
    margin-block-start: 0.25rem;
}

.services-mini-art--cube.is-visible svg {
    animation: services-mini-roll 5s linear infinite;
}

@keyframes services-mini-roll {
    from {
        margin-inline-start: 0;
        opacity: 0;
        transform: rotate(0);
        animation-timing-function: ease-in;
    }

    8% {
        opacity: 1;
    }

    42% {
        margin-inline-start: calc(100% - 2rem);
        opacity: 1;
        transform: rotate(0);
        animation-timing-function: ease-out;
    }

    60%,
    70% {
        margin-inline-start: calc((100% - 2rem) / 2);
        opacity: 1;
        transform: rotate(-360deg);
    }

    90%,
    to {
        margin-inline-start: calc((100% - 2rem) / 2);
        opacity: 0;
        transform: rotate(-360deg);
    }
}

.services-mini-art--typing {
    display: grid;
    align-content: center;
    color: var(--color-purple-light);
    font-size: 0.8rem;
}

.services-mini-art--typing code {
    min-height: 1.25em;
    white-space: pre;
}

.services-mini-art--brand svg {
    display: block;
    width: 100%;
    height: 100%;
}

.services-brand-ink {
    fill: none;
    stroke: var(--color-grey-mid);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
}

.services-brand-guides {
    fill: none;
    stroke: var(--color-grey-mid);
    stroke-width: 0.6;
    opacity: 0.55;
}

.services-brand-mark {
    fill: #959595;
}

.services-brand-mark path:last-child {
    fill: #794887;
}

.services-mini-art--brand.is-visible .services-brand-mark,
.services-mini-art--brand.is-visible .services-brand-ink {
    transition: opacity 350ms ease-out;
}

.services-mini-art--brand.is-sketching .services-brand-mark {
    opacity: 0;
    transition: none;
}

.services-mini-art--brand.is-sketching .services-brand-ink {
    opacity: 1;
    transition: none;
}

.services-brand-pencil {
    visibility: hidden;
    fill: var(--color-purple-dark);
    stroke: var(--color-purple-light);
}

.services-mini-art--brand.is-visible .services-brand-pencil {
    visibility: visible;
}

.services-list {
    display: grid;
    width: fit-content;
    gap: 0.65rem;
    margin: 0 auto;
    padding-inline-start: 1.25rem;
}

.service-punch-line {
    text-align: center;
    font-family: var(--font-dancing);
    font-size: 4rem;
    color: var(--color-purple-light);
}

/* ============================================================
   Purpose: Keep the 3D detail link beneath its list in both layouts.
   ============================================================ */

.services-offering-details {
    grid-area: list;
    align-self: center;
}

.services-more {
    margin-block: 1rem 0;
    text-align: center;
}

.services-more a {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

@media (max-width: 1200px) {
    .service-punch-line {
        font-size: clamp(0.825rem, 3vw, 2.25rem);
    }
}

@media (min-width: 901px) {
    .services-section {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "title title"
            "description subheading"
            "punch list";
        column-gap: clamp(1.5rem, 5vw, 5rem);
    }

    .services-section--reversed {
        grid-template-areas:
            "title title"
            "subheading description"
            "list punch";
    }

    .services-section > h2 {
        grid-area: title;
    }

    .services-section > p {
        grid-area: description;
        align-self: end;
        margin: 0;
    }

    .services-columns,
    .services-offerings {
        display: contents;
    }

    .services-offering-heading {
        grid-area: subheading;
        align-self: end;
        justify-self: center;
    }

    .services-offerings h3 {
        margin: 0;
    }

    .services-list,
    .service-punch-line {
        align-self: center;
        margin-block-start: clamp(1.5rem, 4vw, 4rem);
    }

    .services-list {
        grid-area: list;
    }

    .service-punch-line {
        grid-area: punch;
    }

    .services-section:not(.services-section--reversed) .service-punch-line {
        padding-inline-end: 8%;
    }

    .services-section--reversed > h2 {
        text-align: right;
    }
}

@media (max-width: 900px) {
    /* Match the Home hero H1 exactly at every mobile viewport width. */
    .services-hero h1 {
        font-size: calc(clamp(1.65rem, 5.8vw, 4.6rem) + 0.8rem);
    }

    /* Centre mobile copy while keeping the service lists readable. */
    .services-overview h1,
    .services-overview h2,
    .services-overview h3,
    .services-overview p {
        text-align: center;
    }

    .services-section > p {
        margin-inline: auto;
    }

    .services-offerings h3 {
        font-size: 1.3rem;
    }

    .services-contact > h2 {
        font-size: 3.3rem;
    }

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

    /* Keep mobile artwork reductions independent of desktop sizing. */
    .services-hero-cube {
        scale: 1.25;
    }

    .services-hero-code {
        --services-code-opacity: 0.28;
        opacity: 0.28;
    }

    .service-punch-line {
        font-size: clamp(1.325rem, calc(3vw + 0.5rem), 2.75rem);
    }
}
