/* ==========================================================================
   Service page — one long scrollable page of capability sections that
   alternate image-left / image-right, with optional image gallery, test-results
   and showcase blocks inside a section, plus a lightbox for enlarging images.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
/* Every section fades from white at the top to light grey at the bottom, so
   each boundary is a crisp step from grey back to white. One rule covers all
   sections: reordering or adding sections needs no changes. */
.rpd-section {
    padding-block: clamp(3rem, 6vw, 5rem);
    background: linear-gradient(180deg, var(--bg) 0%, var(--band-fade) 100%);
}

.feature {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
}

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

.feature--reverse .feature-media {
    order: 2;
}

.feature-media > img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--bg-subtle);
}

/* A loop graded onto pure white: multiply drops the white, so the part sits on
   the section gradient with no box around it. */
.feature-media video {
    display: block;
    width: 100%;
    height: auto;
    mix-blend-mode: multiply;
}

/* Technical-drawing dimensions over a video or image. Lines are hairlines at
   any size (non-scaling stroke); arrowheads scale with the picture; labels stay
   a readable fixed size, positioned in percent of the picture. Graphite
   matches the INK of the landing page drawings. */
.dim-drawing {
    --dim-ink: rgba(51, 65, 85, 0.9);
    position: relative;
}

.dim-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.dim-lines path {
    fill: none;
    stroke: var(--dim-ink);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.dim-lines .dim-ext {
    stroke-opacity: 0.45;
}

.dim-lines .dim-arrow {
    fill: var(--dim-ink);
    stroke: none;
}

.dim-label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: clamp(0.62rem, 1.1vw, 0.75rem);
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--dim-ink);
}

/* Anchored at its bottom centre, just above the dimension line. */
.dim-label--width {
    transform: translate(-50%, -100%);
}

/* Anchored at its left middle, beside the line, reading bottom to top. */
.dim-label--height {
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
}

/* site.js hides the dimensions until the drawing scrolls into view, then fades
   them in; without JavaScript they are simply there. */
.dim-drawing .dim-lines,
.dim-drawing .dim-label {
    transition: opacity 0.9s ease 0.4s;
}

.dim-drawing.dims-pending .dim-lines,
.dim-drawing.dims-pending .dim-label {
    opacity: 0;
}

.feature-body h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.feature-body p {
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.feature-body p + p {
    margin-top: 0.85rem;
}

/* Cross-links to other sections on the page, styled like .prose links. */
.feature-body a {
    color: var(--accent);
    text-underline-offset: 2px;
}

/* Two classes, so it outranks .feature-body p on specificity alone. */
.feature-body .spec-line {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--rule-strong);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: var(--accent);
}

/* A line drawing in place of a photo, framed like one. It keeps its own
   proportions (the viewBox is cropped to the drawing), so no empty box around it. */
.feature-media > .diagram {
    display: block;
    width: 100%;
    height: auto;
    padding: 1.25rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: #ffffff;
}

/* Protocols, standards or other short terms listed as chips under a text lead. */
.proto-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.4rem;
    padding: 0;
    list-style: none;
}

.proto-list li {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

/* Text above a full-width gallery, when the images are the section's focus. */
.section-lead {
    max-width: 46rem;
    margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
}

/* --------------------------------------------------------------------------
   Image gallery — full width, one large image with two smaller ones stacked
   beside it. Every image opens enlarged in the lightbox.
   -------------------------------------------------------------------------- */
.media-trio {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: clamp(0.75rem, 1.5vw, 1.25rem);
}

.lightbox-trigger {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--bg-subtle);
    cursor: zoom-in;
}

.lightbox-trigger img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The large image fills the height of the two small ones beside it. */
.media-trio .lightbox-trigger:first-child {
    grid-row: 1 / span 2;
}

.media-trio .lightbox-trigger:first-child img {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
}

.zoom-icon {
    position: absolute;
    right: 0.65rem;
    bottom: 0.65rem;
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    transition: background-color 0.25s, color 0.25s, transform 0.25s;
}

.zoom-icon svg {
    width: 1rem;
    height: 1rem;
}

.lightbox-trigger:hover img {
    transform: scale(1.03);
}

.lightbox-trigger:hover .zoom-icon,
.lightbox-trigger:focus-visible .zoom-icon {
    background: var(--accent);
    color: #ffffff;
    transform: scale(1.06);
}

/* --------------------------------------------------------------------------
   Test results — a compact supporting panel: the lab's stress-strain graph
   beside the headline figures
   -------------------------------------------------------------------------- */
.results,
.showcase {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.results h3,
.showcase h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.results {
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
    /* A translucent shade, so the panel is always a step darker than the
       section background behind it. */
    background: rgba(15, 23, 42, 0.035);
    border: 1px solid var(--rule);
    border-radius: 12px;
}

/* The lab's stress-strain graph, as a white card. */
.test-visual {
    margin: 0;
    padding: 0.75rem 0.75rem 0.6rem;
    background: #ffffff;
    border: 1px solid var(--rule);
    border-radius: 8px;
}

.test-visual img {
    display: block;
    width: 100%;
    height: auto;
}

/* Normal case, so units read correctly (MPa, not "MPA"). */
.test-visual figcaption {
    margin-top: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.test-summary h3 {
    margin-bottom: 0.5rem;
}

.test-intro {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.results-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-block: 1.1rem 0.9rem;
}

.results-highlights > div {
    padding-left: 0.8rem;
    border-left: 2px solid var(--accent);
}

.highlight-value {
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.highlight-label {
    margin-top: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1.45;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Keep symbol subscripts in their real case (Rm, Rp0.2, At), not "RM". */
.highlight-label sub {
    text-transform: none;
}

.test-source {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    line-height: 1.6;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Showcase
   -------------------------------------------------------------------------- */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.showcase-grid figure {
    margin: 0;
}

/* Showcase images open in the lightbox; the link draws the card frame and
   .lightbox-trigger img sizes the image (4:3). */
.showcase-grid .lightbox-trigger {
    border-radius: 8px;
}

/* Square cards, for stills cropped from portrait phone footage. */
.showcase-grid--square .lightbox-trigger img {
    aspect-ratio: 1 / 1;
}

/* Directly under a text lead, the lead's own bottom margin is enough. */
.section-lead + .showcase {
    margin-top: 0;
}

/* A project with two photos: they sit side by side under one caption,
   spanning two showcase columns. */
.showcase-wide {
    grid-column: span 2;
    margin: 0;
}

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

/* --------------------------------------------------------------------------
   Cross links — a row of cards pointing at related work on another page
   -------------------------------------------------------------------------- */
.cross-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

/* Exactly four cards sit two by two rather than three plus one. */
.cross-links:has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.5rem;
}

.cross-link {
    display: block;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: border-color 0.25s, transform 0.25s;
}

.cross-link:hover,
.cross-link:focus-visible {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.cross-link h3 {
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.cross-link p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.cross-link .cross-more {
    margin-top: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   Section gallery — one large photo with a row of thumbnails under it, all
   opening in the lightbox
   -------------------------------------------------------------------------- */
.media-thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.media-thumbs .lightbox-trigger {
    border-radius: 8px;
}

.showcase-grid figcaption {
    margin-top: 0.6rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.showcase-grid figcaption strong {
    display: block;
    font-weight: 600;
    color: var(--text-main);
}

/* --------------------------------------------------------------------------
   Lightbox — built by lightbox.js on a native <dialog>
   -------------------------------------------------------------------------- */
html.lightbox-open {
    overflow: hidden;
}

.lightbox {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox::backdrop {
    background: rgba(11, 18, 32, 0.9);
}

.lightbox figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100vw - 9rem);
    margin: 0;
}

.lightbox figure img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 7rem);
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
}

.lightbox figcaption {
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
    color: #cbd5e1;
}

.lightbox-button {
    position: fixed;
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.25s, border-color 0.25s;
}

.lightbox-button[hidden] {
    display: none;
}

.lightbox-button svg {
    width: 1.2rem;
    height: 1.2rem;
}

.lightbox-button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.lightbox-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 1.25rem;
}

.lightbox-next {
    right: 1.25rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .feature,
    .feature--reverse {
        grid-template-columns: 1fr;
    }
    .feature--reverse .feature-media {
        order: 0;
    }
    /* Tablets keep the side-by-side panel, with a narrower graph. */
    .results {
        grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
    }
    .showcase-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    /* All three part photos full width, so they stay the focus and the two
       smaller ones are big enough to see. */
    .media-trio {
        grid-template-columns: 1fr;
    }
    .media-trio .lightbox-trigger:first-child {
        grid-row: auto;
    }
    .media-trio .lightbox-trigger:first-child img {
        position: static;
        height: auto;
        aspect-ratio: 4 / 3;
    }
    .zoom-icon {
        width: 1.9rem;
        height: 1.9rem;
        right: 0.45rem;
        bottom: 0.45rem;
    }
    .cross-links,
    .cross-links:has(> :nth-child(4):last-child) {
        grid-template-columns: 1fr;
    }
    /* Test panel stacks: graph, then heading, text and figures. */
    .results {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .test-summary h3 {
        font-size: 1rem;
    }
    .test-intro {
        font-size: 0.85rem;
        line-height: 1.55;
    }
    .results-highlights {
        gap: 0.6rem;
        margin-block: 0.9rem 0.75rem;
    }
    .results-highlights > div {
        padding-left: 0.55rem;
    }
    .highlight-value {
        font-size: 1rem;
    }
    .highlight-label {
        font-size: 0.52rem;
        letter-spacing: 0.02em;
    }
    .test-source {
        font-size: 0.6rem;
    }
    .lightbox figure {
        max-width: calc(100vw - 1.5rem);
    }
    .lightbox figure img {
        max-height: calc(100vh - 10rem);
    }
    /* Arrows move to the bottom, clear of the image. */
    .lightbox-prev,
    .lightbox-next {
        top: auto;
        bottom: 1.25rem;
        transform: none;
    }
    .lightbox-prev {
        left: calc(50% - 3.6rem);
    }
    .lightbox-next {
        right: calc(50% - 3.6rem);
    }
}

@media (max-width: 520px) {
    .showcase-grid {
        grid-template-columns: 1fr;
    }
    .showcase-wide {
        grid-column: auto;
    }
}

/* --------------------------------------------------------------------------
   Price list inside a product section (AdmUI): name left, price right.
   -------------------------------------------------------------------------- */
.price-list {
    margin-top: 1.4rem;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--rule-strong);
}

.price-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--rule-strong);
}

.price-name {
    font-weight: 700;
    color: var(--text-main);
}

.price-amount {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-main);
}

.price-amount small {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
