/* ==========================================================================
   Holistic Physiotherapy & Wellness — Base styles
   Global look and feel. Section-specific styling belongs in the relevant
   block's own stylesheet, not here.
   Every colour, size and space below is a token. No literal values.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* NOT scroll-behavior:smooth here. Setting it on the root makes the browser
   interpolate EVERY scroll, including the mouse wheel, which reads as laggy and
   unsteady rather than smooth. Anchor jumps get smooth scrolling from JavaScript
   instead, where it is actually wanted. */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* height:auto lets an <img> keep the aspect ratio implied by its width and
   height attributes while still scaling to its container. Those attributes are
   what let the browser reserve the right space BEFORE the image decodes, so
   text below it does not jump. The migration writes them onto every image. */
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
img { font-style: italic; background-repeat: no-repeat; background-size: cover; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* --- Typography ----------------------------------------------------------- */

/* HEADING SIZES LIVE HERE, AND ONLY HERE.
   theme.json used to carry styles.elements.h1 through h4 with the same clamp()
   values, which is two sources of truth for one scale. Worse, theme.json's
   generated CSS is a plain `h2 { font-size: ... }` at the same specificity as
   this rule, so which one won came down to load order — and the article scale
   in components.css lost, rendering blog subheadings at 46px. Those entries
   are gone from theme.json; the editor gets these sizes through
   add_editor_style() instead. If a heading size needs changing, change it in
   this file. */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-4);
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;              /* stops a lone word on the last line */
}

h1 { font-size: var(--fs-h1); font-weight: var(--fw-bold); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-semi); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-h4); font-weight: var(--fw-semi); line-height: var(--lh-snug); }
h5 { font-size: var(--fs-h5); font-weight: var(--fw-semi); line-height: var(--lh-snug); }
h6 { font-size: var(--fs-h6); font-weight: var(--fw-semi); line-height: var(--lh-snug); }

p { margin: 0 0 var(--sp-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: var(--fs-lg);
  color: var(--color-text);
  font-weight: var(--fw-normal);
}

/* Small print stays legible. 13px is the floor and only for labels. */
small, .text-sm { font-size: var(--fs-sm); }

/* Eyebrow label above a heading — the "BACK PAIN" line on article cards. */
.eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-link-accent);   /* the accessible gold, not brand gold */
  margin-bottom: var(--sp-2);
}

/* Accent / pull-quote voice — Raleway italic per the brand guide. */
blockquote, .quote {
  margin: var(--sp-6) 0;
  padding-left: var(--sp-5);
  border-left: 3px solid var(--color-btn-accent-bg);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--color-text-strong);
}

/* Brand script. Falls back to Raleway italic until the licence is confirmed —
   see assets/fonts/README.md. Never used for anything functional. */
.script {
  font-family: var(--font-script);
  font-style: italic;
  font-weight: var(--fw-normal);
  font-size: var(--fs-h3);
  color: var(--color-link-accent);
  letter-spacing: 0;
}

ul, ol { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); }

/* Prose lists want breathing room between items. Every other list on the site
   is a UI list — nav, footer columns, social icons, opening hours — and an
   unscoped `li + li` quietly adds 8px to the top of every item except the
   first. In a flex row with align-items: center that is not a wasted 8px, it
   is a visible misalignment: the line grows to 48px, the first item centres
   at +4 and its siblings sit at +8, so icon one ends up 4px above the other
   two. That is the footer social row. Scoped with :where() so the score is
   unchanged (0,0,2) and prose behaves exactly as before. */
:where(.single__body, .entry-content) li + li { margin-top: var(--sp-2); }

hr { border: 0; border-top: 1px solid var(--color-divider); margin: var(--sp-7) 0; }

/* --- Links ---------------------------------------------------------------- */

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition);
}
a:hover { color: var(--color-link-hover); }

/* An accent link ("Read More →", "View all articles →"). Uses gold-700, which
   measures 4.51:1. The brand gold #C9A56A measures 2.22:1 and fails AA. */
.link-accent {
  color: var(--color-link-accent);
  font-weight: var(--fw-semi);
  text-decoration: none;
}
.link-accent:hover { color: var(--color-link-accent-hover); text-decoration: underline; }

/* --- Focus ---------------------------------------------------------------- */
/* Visible for keyboard users, invisible for mouse users. Never remove it. */

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);
  font-weight: var(--fw-semi); text-decoration: none;
}
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 0.875rem 1.75rem;
  min-height: 44px;                       /* comfortable touch target */
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  line-height: 1.2;
  text-align: center; text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.btn--primary {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);      /* 6.48:1  AA */
  border-color: var(--color-btn-primary-bg);
}
.btn--primary:hover {
  background: var(--color-btn-primary-bg-hover);
  border-color: var(--color-btn-primary-bg-hover);
  color: var(--color-btn-primary-fg);
}

.btn--secondary {
  background: var(--color-btn-secondary-bg);
  color: var(--color-btn-secondary-fg);
  border-color: var(--color-btn-secondary-border);
}
.btn--secondary:hover {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);
}

/* Gold button — secondary use only; the brand guide assigns buttons to teal.
   Label is near-black, NOT white: white on brand gold #C9A56A measures 2.31:1
   against a 4.5:1 requirement, near-black measures 7.36:1 (AAA). */
.btn--accent {
  background: var(--color-btn-accent-bg);
  color: var(--color-btn-accent-fg);
  border-color: var(--color-btn-accent-bg);
}
.btn--accent:hover {
  background: var(--color-btn-accent-bg-hover);
  border-color: var(--color-btn-accent-bg-hover);
  color: var(--color-btn-accent-fg);
}

/* Solid white button, for use ON a dark teal panel — the booking prompt and
   the footer CTA. Dark teal label on white measures 6.48:1. Gold is not an
   option here: a gold label on dark teal is 2.80:1, which section 06 of the
   style guide lists as never. */
.btn--on-dark {
  background: var(--color-btn-primary-fg);
  color: var(--color-btn-primary-bg);
  border-color: var(--color-btn-primary-fg);
}
.btn--on-dark:hover {
  background: var(--color-surface-on-dark);
  border-color: var(--color-surface-on-dark);
  color: var(--color-btn-primary-bg-hover);
}

/* On a dark teal panel the outline button inverts. */
.on-dark .btn--secondary { color: var(--color-text-invert); border-color: var(--color-text-invert); }
.on-dark .btn--secondary:hover { background: var(--color-text-invert); color: var(--color-btn-primary-bg); }

/* --- Layout --------------------------------------------------------------- */

.container      { width: 100%; max-width: var(--width-wide); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: var(--width-content); }
.container--full   { max-width: var(--width-full); }

.section { padding-block: var(--section-y); }
/* "Soft gold tint" is a fade from the gold tint to white, as at the top of
   the team profile page, rather than a solid band (Amber, 9 Oct 2026: the
   solid tint read too dark). */
.section--tint       { background: linear-gradient(to bottom, color-mix(in srgb, var(--color-surface-calm) 55%, var(--color-surface)) 0%, var(--color-surface) 100%); }
.section--tint-cool  { background: var(--color-surface-cool); }
.section--invert     { background: var(--color-surface-invert); }

/* Anything inside a dark panel flips its text colours. Set once here so no
   block has to remember to do it. */
.section--invert, .on-dark { color: var(--color-text-invert); }
.section--invert h1, .section--invert h2, .section--invert h3,
.section--invert h4, .section--invert h5, .section--invert h6,
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4, .on-dark h5, .on-dark h6 {
  color: var(--color-heading-invert);
}
/* A LINK inside a dark panel turns white. A BUTTON does not.
   ---------------------------------------------------------
   This rule used to catch buttons too, because a button here is an <a> and
   `.on-dark a` (0,1,1) outranks `.btn--primary` (0,1,0). It caused the same
   bug twice in one afternoon and neither was visible from reading the markup:

     - the gold button on the dark teal panel rendered white on #C9A56A —
       2.22:1, against a 4.5:1 minimum;
     - once gold was dropped, the white `.btn--on-dark` button rendered white
       label on white background, i.e. invisible.

   Buttons carry their own foreground and background as a pair and must be
   allowed to keep both. Excluding .btn here fixes every variant at once,
   including any added later, rather than patching them one at a time. */
.section--invert a:not(.btn), .on-dark a:not(.btn) { color: var(--color-text-invert); }

/* On a tinted (light) panel, small text must darken — teal headings on soft
   gold measure 3.90:1, which is large-text-only. */
.section--tint p, .section--tint li,
.section--tint-cool p, .section--tint-cool li { color: var(--color-text-on-tint); }

.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }  /* auto-fill (27 Nov 2026): one or two search results keep normal card width instead of stretching across the row */

.stack > * + * { margin-top: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* --- Cards ---------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card--link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card--calm  { background: var(--color-surface-calm);  border-color: transparent; }
.card--blush { background: var(--color-surface-blush); border-color: transparent; }
.card--cool  { background: var(--color-surface-cool);  border-color: transparent; }

.card__media { margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) var(--sp-4);
               border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.card__title { font-size: var(--fs-h5); margin-bottom: var(--sp-3); }

/* Whole card clickable, without nesting links inside links. */
.card--link { position: relative; }
.card--link .card__title a::after { content: ""; position: absolute; inset: 0; }

/* --- Forms ---------------------------------------------------------------- */

label { display: block; font-weight: var(--fw-medium); margin-bottom: var(--sp-2); }

input[type="text"], input[type="email"], input[type="tel"], input[type="search"],
textarea, select {
  width: 100%;
  padding: 0.75rem var(--sp-4);
  min-height: 44px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-input);   /* 3.12:1 — meets WCAG 1.4.11 */
  border-radius: var(--radius-md);
  color: var(--color-text);
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); opacity: 1; }

/* --- Utilities ------------------------------------------------------------- */

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.measure     { max-width: var(--width-content); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* --- Figures in an article ------------------------------------------------- *
 * Every body image shows the whole picture, as big as the column allows and
 * centred (Liam, 30 Nov 2026: "big and centred", pointing at the clinic's
 * flu-season article, where three square photos fill the column).
 *
 * Until then an image with no style chosen was cropped to 16:9, and the
 * migration's square and portrait classes cropped to 1:1 and 4:5. An audit of
 * the 63 published articles on 30 Nov found 27 of their 127 images cut, some
 * by 40-55%: circles drawn into square files lost their top and bottom, and a
 * landscape photo the migration had tagged portrait lost half its width.
 *
 * The height is capped at 53rem (848px), so a tall portrait photo shrinks to
 * fit rather than taking more than a screen. A square at the full column
 * width (844px on a desktop) is under the cap, so the flu article is
 * unchanged. An image smaller than the column keeps its own size rather than
 * being stretched and blurred.
 *
 * Square, Portrait and Widescreen stay in the block's Styles panel for an
 * author who wants a crop on purpose; none were in use on 30 Nov. The
 * migration's hpw-fig--* classes are still in the content but no longer do
 * anything.
 * -------------------------------------------------------------------------- */

/* :where() keeps these at element weight, so the named styles below win. */
:where(.single__body, .entry-content) figure {
  margin: var(--sp-6) 0;
}

/* Align centre (and a dragged width) makes the figure only as wide as the
   image. The theme's own figure margin above had zeroed the sides, so such
   an image sat on the left of the column while the editor showed it in the
   middle. */
:where(.single__body, .entry-content) .wp-block-image.aligncenter {
  margin-inline: auto;
}

/* TEXT WRAP. Align left / Align right in the image block's toolbar makes the
   text that follows run down the other side of the picture, as the old
   Squarespace blog did (Liam, 30 Nov 2026). The theme had no rules for these
   two, so the choice showed in the editor and was ignored on the page.
   - An image with no width set takes up to half the column, because a
     full-width picture leaves nothing beside it to wrap.
   - A heading starts below the picture, so a new section never begins in
     the strip of space next to it.
   - On a phone the picture goes back to full width above the text, since a
     wrap there leaves a few words per line. */
@media (min-width: 40rem) {
  :where(.single__body, .entry-content) .wp-block-image:is(.alignleft, .alignright) {
    max-width: 50%;
    margin-top: var(--sp-2);
    margin-bottom: var(--sp-4);
  }
  :where(.single__body, .entry-content) .wp-block-image.alignleft {
    float: left;
    margin-left: 0;
    margin-right: var(--sp-6);
  }
  :where(.single__body, .entry-content) .wp-block-image.alignright {
    float: right;
    margin-left: var(--sp-6);
    margin-right: 0;
  }
  :where(.single__body, .entry-content) :is(h2, h3, h4) { clear: both; }
}
@media (max-width: 39.99rem) {
  :where(.single__body, .entry-content) .wp-block-image:is(.alignleft, .alignright) { margin-inline: auto; }
}
/* The article ends below a wrapped picture, never beside the author box. */
.single__body { display: flow-root; }

/* width:auto plus the two maximums keeps the picture's own proportions under
   either limit. object-fit:cover only matters when an author has set an
   aspect ratio in the block's settings: the image is then cropped to it
   rather than squashed. */
:where(.single__body, .entry-content) figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 53rem;
  margin-inline: auto;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* Squarespace wrote captions as a paragraph inside the figcaption, and the
   transform leaves that structure alone rather than rewriting the markup. */
:where(.single__body, .entry-content) figcaption {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--color-text-muted);
  text-align: center;
}

:where(.single__body, .entry-content) figcaption p { margin: 0 0 var(--sp-2); }
:where(.single__body, .entry-content) figcaption p:last-child { margin-bottom: 0; }

/* Widths written on an image in the content.
   - Migrated images carry the Squarespace file width (900px, 1080px, 1214px
     and so on) as if it had been dragged. It means nothing on this site, and
     as an inline style it beats width:auto, so a tall portrait was held at
     the full column width while the height cap cropped it. Ignored.
   - A width an author dragged with the corner handles is kept, and the
     height cap is lifted so the picture is never cropped to fit it. */
:where(.single__body, .entry-content) .wp-block-image.is-resized[class*="hpw-fig--"] img {
  width: auto !important;
}
:where(.single__body, .entry-content) .wp-block-image.is-resized:not([class*="hpw-fig--"]) img {
  max-height: none;
}

/* DELIBERATE CROPS, chosen in the block's Styles panel (register_block_style
   in inc/setup.php). Original shape is the default and needs no rule. */
.is-style-hpw-wide img {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.is-style-hpw-square   { max-width: 32rem; margin-inline: auto; }   /* 512px */
.is-style-hpw-portrait { max-width: 26rem; margin-inline: auto; }   /* 416px */
.is-style-hpw-square img   { width: 100%; aspect-ratio: 1; }
.is-style-hpw-portrait img { width: 100%; aspect-ratio: 4 / 5; }

/* Sections that in-page links jump to (at-a-glance card links, the FAQ
   shortcut): leave room for the sticky header above the heading. */
section[id] { scroll-margin-top: calc(var(--header-h) + var(--sp-5)); }
