/* ==========================================================================
   FitBox International — CMS page templates (templates/standard, templates/service)
   Direction B "Calm Clinical". Loaded after style.css on /p/{slug} pages and the admin page preview only. Reuses the site's tokens,
   fonts, .hero, .section, .eyebrow, .btn, .stats/.stat; colours only through tokens (tests/contrast.php).
   ========================================================================== */

/* Hero ------------------------------------------------------------------- */

.page-hero {
    padding-bottom: clamp(var(--s-7), 6vw, var(--s-9));
}

.page-hero__grid {
    display: grid;
    gap: var(--s-6);
}

@media (min-width: 900px) {
    .page-hero__grid--media {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: center;
        gap: var(--s-8);
    }
}

.page-hero__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 1.2rem + 3.8vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    color: var(--ink);
    overflow-wrap: break-word;
    hyphens: auto;
    text-wrap: balance;
}

.page-hero__lead {
    margin-top: var(--s-5);
    max-width: 40rem;
}

.page-hero .btn-row {
    margin-top: var(--s-6);
}

/* Images: fixed ratio over the brand placeholder ------------------------- */

.page-img {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    background: var(--tint);
    aspect-ratio: 16 / 9;
}

.page-img--4x3 { aspect-ratio: 4 / 3; }
.page-img--3x2 { aspect-ratio: 3 / 2; }
.page-img--1x1 { aspect-ratio: 1 / 1; }

/* Brand placeholder: the logo's FB mark, visible while there is no image or when it fails to load. */
.page-img::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4.5rem;
    height: 3.5rem;
    transform: translate(-50%, -50%);
    background: url("../img/logo/fitbox-mark.png") center / contain no-repeat;
    opacity: 0.55;
}

.page-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    color: transparent; /* no alt-text flash over the placeholder while loading */
}

/* page.js marks images that failed to load; the alt text stays in the accessibility tree. */
.page-img.is-broken img {
    opacity: 0;
}

.page-section__img {
    margin-top: clamp(var(--s-6), 5vw, var(--s-8));
    max-width: 60rem;
}

/* Rich text -------------------------------------------------------------- */

.prose {
    max-width: 44rem;
    font-size: var(--fs-base);
    line-height: 1.7;
    color: var(--text);
    overflow-wrap: break-word;
}

.prose > * + * {
    margin-top: var(--s-4);
}

.prose h2,
.prose h3,
.prose h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-wrap: balance;
}

.prose h2 { font-size: var(--fs-statement); margin-top: var(--s-7); }
.prose h3 { font-size: var(--fs-h3); margin-top: var(--s-6); }
.prose h4 { font-size: 1.125rem; margin-top: var(--s-5); }

.prose > :first-child {
    margin-top: 0;
}

.prose ul,
.prose ol {
    padding-left: var(--s-5);
}

.prose li + li {
    margin-top: var(--s-2);
}

.prose blockquote {
    margin-inline: 0;
    padding-left: var(--s-5);
    border-left: 4px solid var(--teal);
    border-radius: 2px;
    font-size: var(--fs-lead);
    color: var(--ink);
}

.prose a {
    color: var(--teal-dark);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.prose a:hover {
    text-decoration-thickness: 2px;
}

/* Service page: key figures and benefits ---------------------------------- */

.page-stats {
    margin-top: clamp(var(--s-6), 5vw, var(--s-8));
}

/* Two columns on small screens: an odd last figure spans the row (no empty cell). */
@media (max-width: 899px) {
    .page-stats .stat:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (min-width: 900px) {
    .page-stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .page-stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.page-stats--1 {
    grid-template-columns: minmax(0, 1fr);
    max-width: 20rem;
}

.page-section__title {
    margin-bottom: clamp(var(--s-5), 3vw, var(--s-6));
    max-width: 40rem;
}

.page-benefits {
    display: grid;
    gap: var(--s-4) var(--s-6);
}

@media (min-width: 900px) {
    .page-benefits {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.page-benefit {
    display: flex;
    gap: var(--s-4);
    padding-block: var(--s-4);
    border-top: 1px solid var(--line);
}

.page-benefit__mark {
    position: relative;
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.15em;
    border-radius: 50%;
    background: var(--teal);
}

.page-benefit__mark::after {
    content: "";
    position: absolute;
    left: 0.48rem;
    top: 0.27rem;
    width: 0.35rem;
    height: 0.65rem;
    border: solid var(--surface);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.page-benefit__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.25;
    color: var(--ink);
}

.page-benefit__text {
    margin-top: var(--s-2);
    line-height: 1.6;
    color: var(--text);
}

/* Call to action band: a deep-teal rounded panel, inset from the page edge ------------------------------- */

.page-cta {
    margin-inline: clamp(var(--s-2), 1.5vw, var(--s-4));
    margin-bottom: var(--s-7);
    padding-block: clamp(var(--s-7), 6vw, var(--s-9));
}

.page-cta__inner .btn-row {
    margin-top: 0;
}

.page-cta__title {
    margin-bottom: var(--s-5);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h2);
    line-height: 1.05;
    color: var(--on-dark);
}

/* Map embeds (allowlisted hosts only) -------------------------------------- */

.page-map {
    margin-top: var(--s-6);
    aspect-ratio: 16 / 9;
}

.page-map iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--r-lg);
}

.page-map--preview {
    aspect-ratio: auto;
}

/* Location template (Phase 4b) ------------------------------------------- */

.loc-info {
    display: grid;
    gap: var(--s-6);
    margin-bottom: clamp(var(--s-6), 5vw, var(--s-8));
}

@media (min-width: 900px) {
    .loc-info { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
}

.loc-h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: var(--s-3);
}

.loc-h2 + * { margin-bottom: var(--s-6); }
.loc-address { color: var(--text); }
.loc-hours { display: grid; gap: var(--s-2); }
.loc-hours__row { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr; gap: var(--s-3); }
.loc-hours dt { font-weight: 600; color: var(--ink); }
.loc-hours dd { color: var(--text); }

/* Sticky "Book at …" bar: phones (portrait ≤ 767 px, or landscape with a short viewport). The page gets bottom
   padding of at least the bar's height, so the bar never covers the footer or a button at the end of the page. */
.loc-sticky { display: none; }

@media (max-width: 767px), (max-height: 500px) {
    .loc-sticky {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-top: 1px solid var(--line);
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        box-shadow: var(--shadow-3);
    }
    .loc-sticky .btn { width: 100%; }
    body.cms-page--location { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
    .menu-open .loc-sticky { display: none; }
}

/* Corporate programme page (templates/corporate) ------------------------------------------------------- */

.page-img--4x5 { aspect-ratio: 4 / 5; }
.page-img picture { display: contents; }

.corp-points {
    display: grid;
    gap: var(--s-4);
    max-width: 50rem;
}
.corp-point {
    position: relative;
    padding-left: var(--s-6);
    line-height: 1.6;
    color: var(--text);
}
.corp-point::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 2px solid var(--teal);
}

.corp-split {
    display: grid;
    gap: var(--s-6);
}
@media (min-width: 900px) {
    .corp-split--media {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        align-items: center;
        gap: var(--s-8);
    }
}

.corp-steps {
    display: grid;
    gap: var(--s-4);
    list-style: none;
    padding: 0;
    counter-reset: none;
}
@media (min-width: 700px) {
    .corp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .corp-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.corp-step {
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.corp-step__num {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--teal);
}
.corp-step__title {
    margin-top: var(--s-2);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.2;
    color: var(--ink);
}
.corp-step__text {
    margin-top: var(--s-2);
    line-height: 1.6;
    color: var(--text);
}

.corp-coaches {
    display: grid;
    gap: var(--s-6);
}
@media (min-width: 800px) {
    .corp-coaches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.corp-coach {
    display: grid;
    gap: var(--s-5);
    align-content: start;
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
}
.corp-coach__img { max-width: 22rem; }
/* Stacked card (below the 2-column grid): the portrait fills the card instead of leaving half of it empty. */
@media (max-width: 799px) {
    .corp-coach__img { max-width: none; }
}
.corp-coach__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.25;
    color: var(--ink);
}
.corp-coach__bio {
    margin-top: var(--s-3);
    line-height: 1.65;
    color: var(--text);
}
.corp-note {
    margin-top: var(--s-6);
    max-width: 46rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--ink);
}

.corp-benefit__text {
    line-height: 1.6;
    color: var(--text);
}
.corp-benefit__text strong { color: var(--ink); }

.corp-markets {
    display: grid;
    gap: var(--s-4);
}
@media (min-width: 700px) {
    .corp-markets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .corp-markets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.corp-market {
    padding: var(--s-5);
    border-top: 3px solid var(--teal);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.corp-market__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    color: var(--ink);
}
.corp-market__figure {
    margin-top: var(--s-3);
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink);
}
.corp-market__source {
    margin-top: var(--s-2);
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--text-muted);
}

.corp-faq {
    display: grid;
    gap: var(--s-3);
    max-width: 50rem;
}
.corp-faq__item {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.corp-faq__q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    min-height: var(--tap);
    padding: var(--s-4) var(--s-5);
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}
.corp-faq__q::-webkit-details-marker { display: none; }
.corp-faq__q::after {
    content: "+";
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--teal);
}
.corp-faq__item[open] > .corp-faq__q::after { content: "−"; }
.corp-faq__q:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: var(--r-lg);
}
.corp-faq__a {
    padding: 0 var(--s-5) var(--s-5);
    line-height: 1.65;
    color: var(--text);
}
.corp-faq__note { margin-top: var(--s-6); }

.corp-closing .page-cta__title { max-width: 44rem; }
.corp-closing__text { margin-bottom: var(--s-6); max-width: 40rem; }

/* About page (templates/about) -------------------------------------------------------------------------- */

.about-hero__tagline {
    margin-top: var(--s-5);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: var(--fs-sm);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--teal);
}
.about-hero__tagline + .page-hero__lead { margin-top: var(--s-3); }

.about-narrow { max-width: calc(48rem + 2 * var(--gutter)); }

.about-highlight {
    margin-block: var(--s-6);
    padding: var(--s-5) var(--s-6);
    border-left: 4px solid var(--gold);
    border-radius: var(--r-lg);
    background: var(--surface);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.35;
    color: var(--ink);
    text-wrap: pretty;
}

.about-cols {
    display: grid;
    gap: var(--s-5);
}
@media (min-width: 900px) {
    .about-cols--2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
}
.about-card {
    padding: clamp(var(--s-5), 3vw, var(--s-7));
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
}
.about-card__title {
    margin-bottom: var(--s-4);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.about-mission__text { font-size: var(--fs-lead); }
.about-mission__text strong { color: var(--ink); }

.about-values {
    display: grid;
    gap: 0;
    list-style: none;
    padding: 0;
}
.about-value {
    display: flex;
    align-items: baseline;
    gap: var(--s-4);
    padding-block: var(--s-3);
    border-top: 1px solid var(--line);
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink);
}
.about-value:first-child { border-top: 0; padding-top: 0; }
.about-value__num {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--teal);
}

.about-where__intro { line-height: 1.6; color: var(--text); }
.about-places {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-block: var(--s-5);
}
.about-place {
    padding: var(--s-2) var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink);
}

.about-people {
    display: grid;
    gap: var(--s-6);
}
@media (min-width: 900px) {
    .about-people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.about-person {
    display: grid;
    gap: var(--s-5);
    align-content: start;
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
}
.about-person__img { max-width: 22rem; }
/* Stacked card (below the 2-column grid): the portrait fills the card instead of leaving half of it empty. */
@media (max-width: 899px) {
    .about-person__img { max-width: none; }
}
/* The original page shows names and roles in capitals; the stored text is kept exactly as written. */
.about-person__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    line-height: 1.1;
    text-transform: capitalize;
    color: var(--ink);
}
.about-person__role {
    margin-top: var(--s-2);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-transform: uppercase;
    color: var(--teal);
}
.about-person__bio { margin-top: var(--s-4); }
.about-person__para {
    line-height: 1.65;
    color: var(--text);
    overflow-wrap: break-word;
}
.about-person__para + .about-person__para { margin-top: var(--s-3); }
.about-person__quote {
    margin: var(--s-5) 0 0;
    padding-left: var(--s-4);
    border-left: 4px solid var(--teal);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.35;
    color: var(--ink);
}

.about-press {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3) var(--s-6);
    margin-top: var(--s-6);
}
.about-press__item { line-height: 1.5; color: var(--text-muted); }
.about-press__label { font-family: var(--font-mono); font-size: var(--fs-sm); }
.about-press__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    font-weight: 600;
    color: var(--teal-dark);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
.about-press__link:hover { text-decoration-thickness: 2px; }

.about-quotes {
    display: grid;
    gap: var(--s-4);
}
@media (min-width: 800px) {
    .about-quotes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    .about-quotes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.about-quote {
    display: flex;
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-top: 3px solid var(--teal);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.about-quote figure { display: flex; flex-direction: column; gap: var(--s-4); margin: 0; }
.about-quote__text {
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    overflow-wrap: break-word;
}
.about-quote__who { display: grid; gap: var(--s-1); }
.about-quote__name { color: var(--ink); }
.about-quote__detail {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.about-closing .page-cta__title { max-width: 44rem; }
.about-closing__text { margin-bottom: var(--s-6); max-width: 40rem; }

/* Our services page (templates/our-services) ------------------------------------------------------------- */

.svc-grid {
    display: grid;
    gap: var(--s-4);
    max-width: 64rem;
    list-style: none;
    padding: 0;
}
@media (min-width: 640px) {
    .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
}
.svc-card {
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
}
.svc-card__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.2;
    color: var(--ink);
}
.svc-card__text {
    margin-top: var(--s-2);
    line-height: 1.6;
    color: var(--text);
}

.svc-note {
    margin-top: clamp(var(--s-6), 4vw, var(--s-8));
    max-width: 46rem;
}

.svc-band {
    padding-block: clamp(var(--s-7), 5vw, var(--s-9));
}

/* The gold tick sits in the label's own text flow: as a flex row on phones the long label was pushed onto lines of
   its own and left the tick alone above it. In the flow the centred label keeps the tick at the start of line one. */
.svc-band .eyebrow {
    display: block;
}
.svc-band .eyebrow::before {
    display: inline-block;
    vertical-align: middle;
    margin-right: var(--s-3);
}
.svc-band__inner {
    display: grid;
    gap: var(--s-3);
    justify-items: center;
    text-align: center;
}
.svc-band__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-statement);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--on-dark);
    text-wrap: balance;
}

.svc-intro {
    max-width: 44rem;
    font-size: var(--fs-lead);
    line-height: 1.6;
    color: var(--text);
}

.svc-points {
    display: grid;
    gap: var(--s-3);
    margin-top: var(--s-5);
    padding: 0;
    list-style: none;
    max-width: 46rem;
}
.svc-point {
    position: relative;
    padding-left: var(--s-6);
    line-height: 1.6;
    color: var(--text);
}
.svc-point::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 0.875rem;
    height: 2px;
    background: var(--teal);
}

.svc-note-text {
    margin-top: var(--s-5);
    max-width: 44rem;
    color: var(--text);
}

.svc-why {
    display: grid;
    gap: var(--s-5);
    max-width: 52rem;
    padding: 0;
    list-style: none;
}
.svc-why__item {
    padding-left: var(--s-6);
    border-left: 3px solid var(--teal);
}
.svc-why__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-h3);
    line-height: 1.25;
    color: var(--ink);
}
.svc-why__text {
    margin-top: var(--s-2);
    line-height: 1.6;
    color: var(--text);
}

.svc-closing .page-cta__title { max-width: 40rem; }
.svc-closing__text { margin-bottom: var(--s-6); max-width: 40rem; color: var(--on-dark-muted); }
