/* ==========================================================================
   Severn Vale Home Care: base (fonts, tokens, base, layout, shared components)
   Loaded on every page. Blocks and components have their own files in css/blocks/ and css/components/.
   Mobile first. Breakpoints (min-width): 576, 768, 1025, 1280 (desktop header).
   ========================================================================== */

/* 0. FONTS -------------------------------------------------------------
   Self-hosted Google Fonts (SIL Open Font License 1.1), latin subset, WOFF2.
   Playfair Display 500 + 500 italic (true italic face); Source Sans 3 variable (used at 400 and 600).
   "Fallback" faces are metric-adjusted local fonts to limit layout shift while web fonts load. */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/playfair-display-500-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/playfair-display-500-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-variable-latin.woff2") format("woff2-variations"),
       url("../assets/fonts/source-sans-3-variable-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-italic-variable-latin.woff2") format("woff2-variations"),
       url("../assets/fonts/source-sans-3-italic-variable-latin.woff2") format("woff2");
} /* true italic for the testimonial (added for 1.4, 10 Nov 2026) */
/* Fallback faces: size-adjust from measured advance widths (Playfair 500/Georgia 1.028, Source Sans 3 400/Arial 0.942);
   ascent/descent = font metrics (Playfair 1082/251, Source Sans 3 1024/400 per 1000) ÷ size-adjust. Measured 6 Nov 2026 in Chromium. */
@font-face {
  font-family: "Playfair Display Fallback";
  src: local("Georgia");
  size-adjust: 102.8%;
  ascent-override: 105.3%;
  descent-override: 24.4%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Source Sans 3 Fallback";
  src: local("Arial"), local("ArialMT");
  size-adjust: 94.2%;
  ascent-override: 108.7%;
  descent-override: 42.5%;
  line-gap-override: 0%;
}

/* 1. TOKENS ------------------------------------------------------------- */
:root {
  /* Brand colours: declared once, referenced everywhere */
  --color-bisque: #e6e1da;
  --color-midnight: #111d30;
  --color-desert-rose: #d9bbb2;
  --color-lighthouse: #f2f2f2;
  --color-sugar-plum: #954a70;
  --color-lilac: #d5cbeb;
  --color-lavender: #aea2c6;
  --color-warm-coral: #D65F4B;
  --color-white: #ffffff;        /* not a brand token: page background + primary button label, client instruction 6 Nov 2026 */
  /* Non-palette colours shown in the client's 1.4 visuals (10 Nov 2026) */
  --color-star: #f2b01e;          /* testimonial stars (as Concept 2) */
  --color-cqc-good: #2e7d32;      /* CQC "Good" bar in the badge; approximation until the official CQC widget is used. White on it 5.1:1 */

  /* Derived roles (no new hues: mixes of brand tokens only) */
  --color-canvas: var(--color-white);        /* page (body) background: white per client, 6 Nov 2026 */
  --color-band: var(--color-bisque);         /* header, hero and mobile menu panel: Bisque (client feedback, 10 Nov 2026; Lighthouse was used earlier the same day) */
  --color-text: var(--color-midnight);
  --color-accent-text: var(--color-sugar-plum);
  --color-rule: color-mix(in srgb, var(--color-midnight) 16%, transparent);
  --color-surface: var(--color-lighthouse);
  --color-primary: var(--color-warm-coral);
  --color-primary-label: var(--color-white);                /* 3.75:1 on Warm Coral: BELOW WCAG AA 4.5:1 for this text size (client decision) */
  --color-primary-hover: color-mix(in srgb, var(--color-warm-coral) 85%, var(--color-midnight)); /* darker = white label 4.74:1 */
  --color-focus: var(--color-midnight);
  --color-backdrop: color-mix(in srgb, var(--color-midnight) 62%, transparent);

  /* Typography: approved 6 Nov 2026. Replace here only. */
  --font-heading: "Playfair Display", "Playfair Display Fallback", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Source Sans 3 Fallback", Arial, Helvetica, sans-serif;
  --font-heading-style-accent: italic;
  --font-weight-heading: 500; /* Playfair Display Medium */
  --font-weight-body: 400;   /* Source Sans 3 Regular */
  --font-weight-strong: 600; /* Source Sans 3 SemiBold */

  --fs-eyebrow: clamp(0.9375rem, 0.86rem + 0.3vw, 1.125rem);
  --fs-h1: clamp(2.125rem, 0.6rem + 7.6vw, 3.25rem);
  --fs-lede: clamp(1.125rem, 1.03rem + 0.4vw, 1.3125rem); /* 18px minimum (client feedback 10 Nov 2026) */
  --fs-support: 1.125rem; /* email link, reassurance line, testimonial: 18px (client feedback 10 Nov 2026) */
  --fs-body: 1rem;
  --fs-nav: 1rem;
  --fs-trust-title: clamp(1.25rem, 1.05rem + 0.6vw, 1.625rem);
  --fs-h2: clamp(1.75rem, 1.25rem + 2vw, 2.75rem);   /* block headings */
  --fs-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);   /* card and sub-section headings */
  --fs-text: 1.125rem;                               /* block body text: 18px (client feedback 10 Nov 2026) */
  --lh-h1: 1.06;
  --lh-body: 1.5;
  --lh-tight: 1.2;
  --tracking-h1: -0.01em;
  --tracking-eyebrow: 0.04em;

  /* Grid system (from brief) */
  --content-max: 1400px;
  --page-padding: 15px; /* phones; increases above 576px for more side 'air' (client request, 6 Nov 2026) */
  --column-gap: clamp(30px, 5vw, 50px);
  --card-gap: 20px;

  /* Spacing foundation 10 / 20 / 30 + fluid larger steps */
  --space-1: 10px;
  --space-2: 20px;
  --space-3: 30px;
  --space-fluid-sm: clamp(30px, 4vw, 50px);
  --space-fluid-md: clamp(30px, 5vw, 70px);
  --space-section: clamp(50px, 7vw, 100px); /* top and bottom padding of every block */

  --radius-pill: 999px;
  --radius-panel: 14px;
  --tap: 44px;
  --tap-header: 48px; /* header contact + menu buttons: larger for phones (client feedback 10 Nov 2026) */

  /* Hero artwork canvas (design units). Layer positions are % of this canvas. */
  --art-ratio: 2000 / 1390;
}

/* 2. BASE ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}
html:has(dialog[open]) { overflow: hidden; } /* scroll lock while modal open; released automatically on close */

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
p, h1, h2, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--page-padding);
  top: -100px;
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--color-midnight);
  color: var(--color-lighthouse);
  font-weight: var(--font-weight-strong);
  border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; }
.icon--arrow, .icon--menu, .icon--close, .icon--mail, .icon--stroke, .chevron {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* 3. LAYOUT -------------------------------------------------------------- */
.container {
  width: min(calc(100% - 2 * var(--page-padding)), var(--content-max));
  margin-inline: auto;
}

/* 4. SHARED COMPONENTS -------------------------------------------------- */

/* Buttons ------------------------------------------------------------ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: var(--tap);
  padding: 0.65em 1.4em;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: var(--font-weight-strong);
  font-size: var(--fs-body);
  line-height: var(--lh-tight);
  text-align: center;
  text-decoration: none;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.button--lg { min-height: 54px; padding-inline: 1.75em; font-size: 1.0625rem; }

.button--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-label);
}
.button--secondary {
  background: var(--color-lighthouse); /* client request, 6 Nov 2026 (was white, originally transparent) */
  border-color: var(--color-midnight);
  color: var(--color-midnight);
}
/* Hover: darker fill (raises white-label contrast) + underline, so state is not colour alone */
.button--primary:hover { background: var(--color-primary-hover); text-decoration: underline; }
.button--secondary:hover { background: var(--color-white); text-decoration: underline; } /* fill would otherwise match the new Lighthouse default */
.button:active { transform: translateY(1px); box-shadow: inset 0 2px 0 color-mix(in srgb, var(--color-midnight) 25%, transparent); }
.button:focus-visible { outline-offset: 4px; }
.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  border-style: dashed;
  text-decoration: line-through;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-midnight);
  cursor: pointer;
}
.icon-button .icon { width: 26px; height: 26px; }
.icon-button--outline { border: 2px solid var(--color-midnight); }
.icon-button--outline .icon { width: 22px; height: 22px; }
.icon-button:hover { background: color-mix(in srgb, var(--color-midnight) 8%, transparent); }

/* Text link (quiet secondary action, e.g. "Prefer to email us?") */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0; /* no min-height (client request, 10 Nov 2026) */
  border: 0;
  background: none;
  color: var(--color-midnight);
  font-family: var(--font-body);
  font-size: var(--fs-support);
  font-weight: var(--font-weight-strong);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  cursor: pointer;
}
.text-link:hover { text-decoration-thickness: 2.5px; }
.text-link .icon { width: 1.3em; height: 1.3em; stroke-width: 1.8; }
.icon--chat { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }

/* Blocks: shared section wrapper (template-parts/blocks/*). ------------------------
   Every block is a full-width <section class="block block--bg-…"> with a .container inside.
   Background is chosen per use (page template / content), never by position. Two consecutive blocks on the same
   background share one gap instead of doubling it. */
.block { padding-block: var(--space-section); }
/* --block-bg exposes the background colour to children (e.g. the logo strip's edge fades) */
.block--bg-white     { --block-bg: var(--color-canvas); background: var(--block-bg); }
.block--bg-bisque    { --block-bg: var(--color-bisque); background: var(--block-bg); }
.block--bg-lighthouse { --block-bg: var(--color-lighthouse); background: var(--block-bg); }
.block--bg-lilac     { --block-bg: var(--color-lilac); background: var(--block-bg); }
/* Sugar Plum is 3.9:1 on Lilac (below AA for eyebrows and accents): 20% Midnight deepens it to 4.9:1 */
.block--bg-lilac     { --color-accent-text: color-mix(in srgb, var(--color-sugar-plum) 80%, var(--color-midnight)); }
.block--bg-midnight  { --block-bg: var(--color-midnight); background: var(--block-bg); color: var(--color-white); }
.block--bg-midnight :focus-visible { outline-color: var(--color-lilac); }
.block--bg-white + .block--bg-white,
.block--bg-bisque + .block--bg-bisque,
.block--bg-lighthouse + .block--bg-lighthouse,
.block--bg-lilac + .block--bg-lilac,
.block--bg-midnight + .block--bg-midnight { padding-top: 0; }
/* Repeating brand pattern ('pattern' => 'white'): the supplied Pattern White tile over the section colour, at 54px
   (half its 109px artboard: 50% larger than the 36px first used, client 17 Nov 2026). For coloured backgrounds (Lilac, Bisque, Lighthouse). */
/* Default 15% opacity for every use (client, 17 Nov 2026): a wash of the section's own colour (--block-bg) at 85% sits over the
   tile. Change --pattern-opacity to adjust. */
.block--pattern-white {
  --pattern-opacity: 15%;
  --pattern-wash: color-mix(in srgb, var(--block-bg) calc(100% - var(--pattern-opacity)), transparent);
  background-image: linear-gradient(var(--pattern-wash), var(--pattern-wash)), url("../assets/img/patterns/pattern-white.svg");
  background-size: auto, 54px 54.25px;
}
/* Bottom edge strip ('edge' => 'books', client 17 Nov 2026): the illustrated row of books repeated left to right
   along the section's bottom edge. The section's bottom padding grows by the strip's height so nothing overlaps it.
   One tile is 1072 x 259px (sharp up to 130px tall on 2x screens). Transparent background, so it suits any colour. */
.block--edge-books {
  --edge-height: clamp(80px, 9vw, 130px);
  position: relative;
  padding-block-end: calc(var(--space-section) + var(--edge-height));
}
.block--edge-books::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: var(--edge-height);
  background: url("../assets/img/borders/books.png") repeat-x left bottom / auto 100%;
  background-image: image-set(
    url("../assets/img/borders/books.avif") type("image/avif"),
    url("../assets/img/borders/books.webp") type("image/webp"),
    url("../assets/img/borders/books.png") type("image/png"));
  pointer-events: none;
}
/* Decorative motif ('motif' => 'flower-corner'): the brand flower in Lighthouse, cropped into the top right
   corner, behind the content (client mock-up, 17 Nov 2026). For white or Bisque sections: it disappears on Lighthouse. */
.block--motif-flower-corner { position: relative; isolation: isolate; overflow: hidden; }
.block--motif-flower-corner::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block-start: 0;
  inset-inline-end: 0;
  width: clamp(260px, 56vw, 820px);
  aspect-ratio: 1;
  background: url("../assets/img/motifs/flower-corner-lighthouse.svg") no-repeat top right / contain;
  pointer-events: none;
}
.block__inner { display: grid; gap: var(--space-fluid-sm); }
.block__inner > * { min-width: 0; }
.block p { max-width: 68ch; } /* comfortable line length for body text */
/* Links inside body copy (e.g. "[Good Life Club](url)" in sv_paragraphs): underlined in the text colour */
.block p a:not([class]) {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.block p a:not([class]):hover { text-decoration-thickness: 2.5px; }
.block p a:not([class])[aria-disabled="true"] { cursor: default; }
.block__footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--column-gap); }

/* Arrowed text link for contextual "Explore…" links (also .text-link) */
a.text-link { text-decoration: underline; }
.text-link .icon--arrow { width: 1.1em; height: 1.1em; }
.text-link[aria-disabled="true"] { cursor: default; }
.block--bg-midnight .text-link { color: var(--color-white); }

/* Placeholder notes: mark content still to be supplied */
.placeholder-note {
  padding: var(--space-1) 14px;
  border: 1.5px dashed var(--color-sugar-plum);
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-lilac) 35%, var(--color-lighthouse));
  color: var(--color-midnight);
  font-size: 0.9375rem;
  line-height: 1.4;
}
.nojs-note { display: none; }
.no-js .nojs-note {
  display: block;
  padding: var(--space-1) 14px;
  border: 1.5px dashed var(--color-sugar-plum);
  border-radius: 8px;
}
.no-js [data-modal-trigger] { opacity: 0.55; pointer-events: none; border-style: dashed; }

/* Content placeholder (client request, 6 Nov 2026) ------------------- */
/* Fixed 440px empty band on the white page background, marking where lower homepage sections will start. */
.content-placeholder { height: 440px; }

/* 5. RESPONSIVE: page side padding ---------------------------------------- */
@media (min-width: 576px) {
  :root { --page-padding: 24px; }
}
@media (min-width: 768px) {
  :root { --page-padding: 40px; }
}
@media (min-width: 1025px) {
  :root { --page-padding: clamp(40px, 4vw, 64px); } /* 41px at 1025, 51px at 1280, 58px at 1440 */
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: background-color 0.15s ease, transform 0.1s ease; }
  .button--primary:hover .icon--arrow { transform: translateX(3px); }
  .icon--arrow { transition: transform 0.15s ease; }
}

/* ==========================================================================
   Reveal on scroll (js/site.js "Reveal sections on scroll", client 17 Nov 2026)
   JS adds the start-state classes only when motion is allowed and the element is below the first view, then
   .is-revealed as it comes into view, then removes them all when the entrance is over. Without JS, or with
   reduced motion, nothing is hidden. The start states have no transition, so hiding is instant.
   ========================================================================== */
/* marker halfway up the books strip: the row rises once the whole strip is in view */
.reveal-marker { position: absolute; inset-inline-start: 0; inset-block-end: calc(var(--edge-height, 0px) * 0.5); width: 1px; height: 1px; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  /* groups: each child rises 14px and fades in, --reveal-stagger apart */
  .reveal > * { opacity: 0; transform: translateY(14px); }
  .reveal.is-revealed > * {
    opacity: 1;
    transform: none;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: calc(var(--reveal-i, 0) * var(--reveal-stagger, 0.1s));
  }
  /* single element (coverage map): fades in and settles */
  .reveal--single { opacity: 0; transform: translateY(14px) scale(0.98); }
  .reveal--single.is-revealed { opacity: 1; transform: none; transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
  /* books strip: the row starts just below the section's bottom edge (clipped by its own box) and rises into place */
  .reveal--books::after { background-position: left 0 top var(--edge-height); }
  .reveal--books.is-revealed::after { background-position: left 0 top 0; transition: background-position 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
}
/* Printing a half-scrolled page: show everything that hasn't been revealed yet */
@media print {
  .reveal > *, .reveal--single, .steps--reveal .steps__item { opacity: 1 !important; transform: none !important; }
  .reveal--books::after { background-position: left 0 top 0 !important; }
}
