/* Two halves: Clinical Guardian (left) and Stock Control (right), AHS on the seam.
   Colours from each product's brand; type from clinicalguardian.com. */

@font-face { font-family: Switzer; src: url(../assets/fonts/Switzer-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Switzer; src: url(../assets/fonts/Switzer-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Switzer; src: url(../assets/fonts/Switzer-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* Registered so the split position can be transitioned */
@property --split {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 50%;
}

:root {
    --ink: #071e1a;
    --paper: #fffdf8;
    --muted: #4b6b64;
    --cg-bg: #071e1a;
    --cg-accent: #5effe8;
    --sc-bg: #043b5c;
    --sc-accent: #5edeff;

    --ease: cubic-bezier(.65, 0, .35, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --pad: clamp(1.5rem, 4vw, 4rem);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Switzer, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
}
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; }
a { color: inherit; }

/* ---------- Split ---------- */
.split {
    --split: 50%;
    position: relative;
    display: grid;
    grid-template-columns: var(--split) 1fr;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    background: var(--cg-bg); /* fills any sub-pixel gap at the seam while it moves */
    transition: --split .9s var(--ease);
}
.split:has(.half--cg:hover) { --split: 58%; }
.split:has(.half--sc:hover) { --split: 42%; }

.half {
    position: relative; overflow: hidden;
    display: flex; align-items: flex-end;
    padding: var(--pad);
    padding-top: 14rem;
    color: #fff; text-decoration: none;
    isolation: isolate;
}
.half--cg { background: var(--cg-bg); --accent: var(--cg-accent); }
.half--sc { background: var(--sc-bg); --accent: var(--sc-accent); }
.half:focus-visible { outline: 3px solid var(--accent); outline-offset: -6px; }

/* The non-hovered half steps back a little */
.split:has(.half:hover) .half:not(:hover) .half__content { opacity: .55; }

.half__content { position: relative; z-index: 1; max-width: 30rem; transition: opacity .6s var(--ease); }
.half__kicker { font-size: .85rem; color: var(--accent); margin-bottom: 1.5rem; }
.half__logo { height: clamp(4.5rem, 8vw, 7.5rem); width: auto; margin-bottom: 1.75rem; }
.half__desc { font-size: clamp(1rem, 1.2vw, 1.15rem); color: rgba(255, 255, 255, .78); }

/* Extra detail opens up when a half is hovered */
.half__more {
    max-height: 0; opacity: 0; overflow: hidden; margin-top: 0;
    font-size: .95rem; color: rgba(255, 255, 255, .6);
    transition: max-height .7s var(--ease), opacity .5s var(--ease), margin .7s var(--ease);
}
.half:hover .half__more, .half:focus-visible .half__more { max-height: 6rem; opacity: 1; margin-top: 1rem; }

.half__link {
    position: relative; display: inline-block; margin-top: 1.75rem;
    font-weight: 500; color: var(--accent);
}
.half__link::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
    background: currentColor; transform: scaleX(0); transform-origin: left;
    transition: transform .6s var(--ease);
}
.half:hover .half__link::after { transform: scaleX(1); }

/* ---------- Background marks ---------- */
.mark {
    position: absolute; z-index: -1;
    top: -8%; height: 62%; width: auto; aspect-ratio: 1;
    opacity: .1;
    translate: calc(var(--mx, 0) * 28px) calc(var(--my, 0) * 28px);
    transition: opacity .8s var(--ease), scale 1.2s var(--ease-out), translate .9s var(--ease-out);
}
/* Marks bleed off the outer top corners, mirroring each other either side of the seam */
.mark--cg { left: -10%; transform-origin: top left; }
.mark--sc { right: -8%; transform-origin: top right; }
.half:hover .mark { opacity: .18; scale: 1.05; }

/* ---------- Seam (AHS) ---------- */
.seam {
    position: absolute; top: 0; left: var(--split); z-index: 2;
    translate: -50% 0;
    width: min(21rem, 30vw);
    padding: 2rem 2rem 1.75rem;
    background: var(--paper);
    text-align: center;
}
.seam__logo { width: 9.5rem; margin: 0 auto 1.1rem; }
.seam__line { font-size: .9rem; color: var(--muted); }
.seam__contact {
    display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem 1.25rem;
    margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid rgba(7, 30, 26, .12);
    font-size: .85rem;
}
.seam__contact a { text-decoration: none; color: var(--ink); transition: color .3s; }
.seam__contact a:hover { color: #00ab94; }

/* ---------- Footer strip ---------- */
.strip {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem 3rem;
    padding: 2.5rem var(--pad);
    font-size: .85rem; color: var(--muted);
    background: #fff; /* matches the NHS badge's white background */
}
.strip__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2.75rem; list-style: none; margin: 0; padding: 0; }
.strip__badges img { height: clamp(4rem, 6vw, 5.5rem); width: auto; }
.strip__legal { display: grid; gap: .2rem; text-align: right; }
.strip__legal a { color: var(--ink); text-decoration: none; }
.strip__legal a:hover { color: #00ab94; }

/* ---------- Load sequence ---------- */
/* Halves open outward from the seam */
.half--cg { animation: open-left 1.3s var(--ease) both; }
.half--sc { animation: open-right 1.3s var(--ease) both; }
@keyframes open-left { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes open-right { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

/* AHS tab drops in from the top once the halves have parted */
.seam { animation: drop 1s var(--ease-out) .75s both; }
@keyframes drop { from { translate: -50% -100%; } to { translate: -50% 0; } }

/* Shield halves slide together */
.mark__l { animation: from-left 1.4s var(--ease-out) .9s both; }
.mark__r { animation: from-right 1.4s var(--ease-out) .9s both; }
@keyframes from-left { from { transform: translateX(-60px); opacity: 0; } }
@keyframes from-right { from { transform: translateX(60px); opacity: 0; } }

/* Stock Control squares stack in one by one */
.mark__sq { transform-box: fill-box; transform-origin: center; animation: pop .7s var(--ease-out) both; }
.mark__sq--1 { animation-delay: .95s; }
.mark__sq--2 { animation-delay: 1.1s; }
.mark__sq--3 { animation-delay: 1.25s; }
@keyframes pop { from { transform: scale(0); } }

/* Content rises in, staggered */
.half__kicker, .half__logo, .half__desc, .half__link { animation: rise 1s var(--ease-out) both; }
.half__kicker { animation-delay: 1s; }
.half__logo { animation-delay: 1.08s; }
.half__desc { animation-delay: 1.16s; }
.half__link { animation-delay: 1.24s; }
@keyframes rise { from { opacity: 0; translate: 0 24px; } }

/* ---------- Narrow screens: stack the halves, seam becomes the header ---------- */
@media (max-width: 860px) {
    .split { grid-template-columns: 1fr; }
    .half { min-height: 78svh; padding-top: 6rem; }
    .seam {
        position: relative; left: auto; translate: none;
        grid-row: 1; width: 100%;
        padding: 1.5rem;
        display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem;
        text-align: left;
    }
    .seam__logo { width: 6.5rem; margin: 0; }
    .seam__line { display: none; }
    .seam__contact { margin: 0; padding: 0; border: 0; justify-content: flex-end; }
    .half__more { max-height: none; opacity: 1; margin-top: 1rem; }
    .half--cg { animation-name: open-down; }
    .half--sc { animation-name: open-down; animation-delay: .2s; }
    @keyframes open-down { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
    .seam { animation-name: fade; animation-delay: 0s; }
    @keyframes fade { from { opacity: 0; } }
    .mark { height: 55%; }
    .strip { flex-direction: column; align-items: flex-start; }
    .strip__legal { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
