/* ============================================================================
   CareQuant website styles  (site/css/styles.css)
   ============================================================================

   One stylesheet for the whole site. No preprocessor, no build step.
   Sizes, colours and spacing follow the designer's Figma pages (1440px wide,
   16 Nov 2026), with a few agreed changes noted where they happen.

   CONTENTS
   --------
     1. Tokens          colours, font, type sizes, spacing. Brand values live HERE ONLY.
     2. Base            resets and defaults
     3. Shared pieces   container, sections, headings, buttons, skip link
     4. Top navigation  logo, wordmark, links, phone menu
     5. Hero            the rotating photo panel
     6. Intro           the dark band under the hero, and the animated callout box
     7. Applications    CQ Homes text and the company video
     8. Contact         the enquiry form
     9. Footer
    10. Inner pages     Company, Applications, Enquiries
    11. Long-form text  privacy page and 404

   HOUSE RULES
   -----------
   - Mobile first. The plain rules are for phones. @media (min-width: 768px)
     adds tablet, @media (min-width: 1024px) adds desktop. Never max-width.
   - Class names follow block__element--modifier (e.g. .hero__slide--2).
     "is-" classes (.is-active, .is-open, .is-drawing) are states that
     main.js switches on and off; don't use them for anything else.
   - .js on <html> means JavaScript is running (set by main.js).
   - No inline styles in the HTML. The Content Security Policy in
     src/index.js blocks them, so they would silently do nothing.
   - Colours were checked for contrast (WCAG AA). If you change a colour
     token, re-check it, especially orange, green and blue on dark grey.
   - Anything that animates has a prefers-reduced-motion rule that stops it.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. TOKENS
   Colours sampled from the design PDF.
   ------------------------------------------------------------------------- */
:root {
  --ink: #282828;             /* dark background (navigation, intro, footer) */
  --ink-2: #2f2f2f;           /* placeholder blocks on dark */
  --paper: #ffffff;
  --mist: #c4cdd9;            /* contact section */
  --text: #1a1a1a;
  --text-muted: #4a4a4a;
  --on-dark: #ffffff;
  --on-dark-muted: #d4d4d4;   /* secondary text on dark (inner pages) */
  --line-on-dark: rgba(255, 255, 255, 0.22);
  --blue: #3cbeff;            /* logo and wordmark */
  --orange: #ff8000;          /* callouts, Send button */
  --yellow: #ffc800;          /* the Local Authority callout (slide 2) */
  --green: #00c800;           /* Fred's callout */

  /* The design's typeface is not named in the files (Figma outlined it). Until the
     designer confirms it, use the system font, which has the light weights the design needs.
     When the brand font arrives: self-host it in /fonts and put its name first here. */
  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --light: 300;
  --bold: 700;

  /* Type sizes from Rob's desktop and mobile designs (17 Nov 2026). */
  --fs-body: 1rem;                               /* 16px, line height 24px */
  --fs-nav: 1.125rem;                            /* 18px */
  --fs-menu: 1.5rem;                             /* 24px: phone menu links */
  --fs-h1: 2.5rem;                               /* 40px: section headings, on every screen size */
  --fs-hero: clamp(1.8rem, 2.8vw, 2.5rem);       /* 29px on phones, 40px on desktop: hero headline */
  --fs-callout: 1.5rem;                          /* 24px */
  --fs-stat: clamp(3rem, 16.4vw, 4rem);          /* 64px: "55-60%" (shrinks on very narrow phones) */

  --container: 1280px;
  --gutter: clamp(16px, 5.5vw, 80px);
  --section-y: clamp(56px, 8vw, 104px);
  --header-h: 0px;            /* the header is not sticky, so links to #sections need no offset */
  --radius-field: 10px;       /* form fields (agreed, the design has square corners) */
  --radius-button: 5px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--light);
  line-height: 1.5;
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

strong,
b {
  font-weight: var(--bold);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

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

/* ----------------------------------------------------------------------------
   3. SHARED PIECES
   ------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section--dark  { background: var(--ink);   color: var(--on-dark); }
.section--light { background: var(--paper); color: var(--text); }
.section--mist  { background: var(--mist);  color: var(--text); }

[id] {
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.eyebrow {
  margin-bottom: 4px;
  font-weight: var(--bold);
}

.section-title {
  margin-bottom: 16px;
  font-size: var(--fs-h1);
  font-weight: var(--light);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 24px;
  border: 0;
  border-radius: var(--radius-button);
  font: inherit;
  font-weight: var(--bold);
  text-decoration: none;
  cursor: pointer;
}

/* Dark text on orange: the design's white text on this orange fails contrast (2.5:1). */
.button--accent {
  background: var(--orange);
  color: var(--ink);
}

.button--accent:hover {
  filter: brightness(1.06);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--text);
  font-weight: var(--bold);
}

.skip-link:focus {
  top: 8px;
}

/* ----------------------------------------------------------------------------
   4. TOP NAVIGATION
   Phones (Rob's mobile design, 17 Nov 2026):
            [mark CareQuant / INTELLIGENCE] ............ [menu]
            The menu opens full screen: "Menu" and a cross at the top, then the
            three links between white rules.
   Tablet+: CareQuant INTELLIGENCE   [mark]   Company  Applications  Enquiries
   The header is tall on every screen size, so it scrolls away with the page.
   ------------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 20;
  background: var(--ink);
  color: var(--on-dark);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: minmax(128px, auto) auto;   /* the logo row is the design's 128px; the second row only shows the links when JavaScript is off */
  grid-template-areas:
    "word toggle"
    "nav  nav";
  align-items: center;
  column-gap: 10px;
}

.brand {
  grid-area: word;
  display: inline-flex;
  align-items: center;
  justify-self: start;
}

.brand__wordmark {
  display: none;
  width: auto;
  height: 34px;
}

/* Phones: Rob's horizontal lock-up (mark plus the two-line name), 60px tall. */
.brand__lockup {
  width: auto;
  height: 60px;
}

.site-header__mark {
  grid-area: mark;
  display: none;
  width: auto;
  height: 30px;
}

.site-header__toggle {
  grid-area: toggle;
  position: relative;
  z-index: 2;   /* stays above the open full-screen menu, where it is the close button */
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -2px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.js .site-header__toggle {
  display: inline-grid;
}

/* The design's menu icon: three 40px bars, 4px thick. When open it becomes a
   thin cross (the bars rotate and halve in thickness), as in the design. */
.site-header__bars,
.site-header__bars::before,
.site-header__bars::after {
  display: block;
  width: 40px;
  height: 4px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Rob, 18 Nov: the icon spans from the x-height of "CareQuant" (top of the
   lower-case letters) to the baseline of "INTELLIGENCE" in the 60px lock-up:
   50.6px to 80.8px from the top of the 128px header, worked out from the
   lock-up SVG. Hence the 13.125px bar spacing and the 1.7px nudge down. */
.site-header__bars {
  --bar-gap: 13.125px;
  position: relative;
  top: 1.7px;
}

.site-header__bars::before,
.site-header__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.site-header__bars::before { top: calc(-1 * var(--bar-gap)); }
.site-header__bars::after  { top: var(--bar-gap); }

.site-header__toggle[aria-expanded="true"] .site-header__bars { background: transparent; }
.site-header__toggle[aria-expanded="true"] .site-header__bars::before { transform: translateY(var(--bar-gap)) rotate(45deg) scaleY(0.4); }
.site-header__toggle[aria-expanded="true"] .site-header__bars::after  { transform: translateY(calc(-1 * var(--bar-gap))) rotate(-45deg) scaleY(0.4); }

.site-nav {
  grid-area: nav;
  padding-bottom: 8px;
}

.js .site-nav {
  display: none;
}

/* Phones: the open menu covers the whole screen. main.js also stops the page
   scrolling behind it (html.menu-open). */
.js .site-nav.is-open {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  padding: 0 var(--gutter) 24px;
  overflow-y: auto;
  background: var(--ink);
}

html.menu-open {
  overflow: hidden;
}

/* "Menu" at the top of the open menu, level with the cross. Phones only. */
.site-nav__title {
  display: flex;
  align-items: center;
  height: 128px;
  font-size: var(--fs-menu);
  font-weight: var(--bold);
}

.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-top: 1px solid var(--on-dark);
  font-size: var(--fs-menu);
  text-decoration: none;
}

.site-nav li:last-child a {
  border-bottom: 1px solid var(--on-dark);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

@media (min-width: 768px) {
  .site-header {
    --wordmark-h: 26px;   /* 34px on desktop; the nav's baseline offset below is worked out from it */
  }

  .site-header__inner {
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto;
    grid-template-areas: "word mark nav";
    column-gap: 24px;
    min-height: 120px;
  }

  .brand__wordmark {
    display: block;
    height: var(--wordmark-h);
  }

  .brand__lockup {
    display: none;
  }

  .site-header__mark {
    display: block;
    height: 60px;
  }

  .js .site-header__toggle,
  .site-nav__title {
    display: none;
  }

  .site-nav,
  .js .site-nav {
    display: block;
    padding: 0 0 0 clamp(16px, 5vw, 80px);
  }

  .site-nav ul {
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }

  .site-nav a,
  .site-nav li:last-child a {
    min-height: 44px;
    border: 0;
    font-size: var(--fs-nav);
  }

  /* Rob, 18 Nov: the links sit on the same baseline as "CareQuant INTELLIGENCE".
     Both are centred in the header row. The wordmark's baseline is 37.7% of its
     height below its centre (measured from the SVG); the links' baseline is about
     0.36em below theirs. The difference moves the links down onto the wordmark's
     baseline at every size. If the font changes, re-check the 0.36em. */
  .site-nav a {
    position: relative;
    top: calc(var(--wordmark-h) * 0.377 - 0.36em);
  }

  /* Enquiries is bold on the desktop design. */
  .site-nav__cta {
    font-weight: var(--bold);
  }
}

@media (min-width: 1024px) {
  .site-header {
    --wordmark-h: 34px;
  }

  .site-header__inner {
    min-height: 150px;
  }

  /* The mark's inner circle (37.5% of its height) matches the height of the C in
     "CareQuant" (89.5% of the wordmark's), as in Rob's design: 82px mark, 34px wordmark. */
  .site-header__mark {
    height: 82px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header__bars,
  .site-header__bars::before,
  .site-header__bars::after {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ----------------------------------------------------------------------------
   5. HERO
   Full width, edge to edge (agreed 16 Nov 2026 over the design's inset panel:
   more modern). The headline and "+" buttons still line up with the page
   content below. Three slides are stacked on top of each other; only
   .is-active is visible.
   data-tone="light" = dark text on a light photo; "dark" = white text.
   ------------------------------------------------------------------------- */

/* Left edge of the page content, so text inside the full-width hero lines up with it.
   Uses % (of the hero's own width) rather than vw, so a desktop scrollbar can't push it out of line. */
:root {
  --content-left: max(var(--gutter), calc((100% - var(--container)) / 2));
}

.hero {
  background: var(--ink);
}

/* The hero ignores the page container so the photo runs edge to edge. */
.hero > .container {
  max-width: none;
  padding-inline: 0;
}

/* Phones (Rob's mobile design): the photo on top, the headline under it in
   white on the dark background, then a white rule. The rule sits at the same
   height on every slide (the text area is a fixed 300px, or taller if a long
   headline needs it), so the page below never jumps when the slide changes.
   Tablet and up: the headline sits on the photo (see the media query below). */
.hero__frame {
  --photo-h: min(calc(100vw * 302 / 390), 60vh);   /* the design's 390 x 302 photo, scaled to the phone */
  position: relative;
  display: grid;
  overflow: hidden;
  background: var(--ink);
}

/* The white rule under the headline (phones only). */
.hero__frame::after {
  content: "";
  position: absolute;
  right: var(--gutter);
  bottom: 0;
  left: var(--gutter);
  height: 1px;
  background: var(--on-dark);
}

.hero__slide {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  color: var(--on-dark);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.hero__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease;
}

/* Photos from the designer's PDF (extracted by tools/extract_brand.py). */
.hero__slide--1 { --hero-image: url("/images/hero-1.webp"); }
.hero__slide--2 { --hero-image: url("/images/hero-2.webp"); }
.hero__slide--3 { --hero-image: url("/images/hero-3.webp"); }

/* Phones: the photo block. Size and position copy each photo's crop in the
   mobile design (zoomed in on the people, anchored bottom right). */
.hero__slide::before {
  content: "";
  flex: none;
  height: var(--photo-h);
  background-image: var(--hero-image, none);
  background-repeat: no-repeat;
  background-size: var(--photo-zoom, cover);
  background-position: var(--photo-pos, right bottom);
}

.hero__slide--1 { --photo-zoom: 174% auto; --photo-pos: 100% 100%; }
.hero__slide--2 { --photo-zoom: 201% auto; --photo-pos: 100% 89%; }
.hero__slide--3 { --photo-zoom: 147% auto; --photo-pos: 100% 100%; }

.hero__title {
  flex: 1;
  min-height: 300px;
  padding: 34px var(--gutter) 32px;
  font-size: var(--fs-hero);
  font-weight: var(--light);
  line-height: 1.345;   /* 29px text on 39px lines, as in the mobile design */
  letter-spacing: -0.01em;
  text-wrap: pretty;    /* avoids a single word alone on the last line, where the browser supports it */
}

.hero__title strong {
  display: block;
  font-weight: var(--bold);
}

/* Phones: the "+" buttons sit on the bottom-left of the photo. */
.hero__controls {
  --cross: 24px;   /* size of each "+": 24px on phones, the design's 32px from tablet up */
  position: absolute;
  top: calc(var(--photo-h) - 44px - 8px);
  left: calc(var(--gutter) - (44px - var(--cross)) / 2);   /* the first "+" lines up with the text, not its 44px button */
  z-index: 1;
}

.hero__dots {
  display: flex;
  gap: 0;
}

.hero__dots[hidden] {
  display: none;
}

/* The "+" buttons from the design: two thin bars (2px) drawn in CSS, so every
   "+" is the same crisp shape whatever the font. A typed "+" changed weight and
   sat at a different height in each font. The buttons are 44px square for easy
   tapping; the "+" is centred inside. The active one is solid, the others faded.
   Colour comes from `color` (currentColor), so the light/dark tone rules below
   recolour the "+" and the pause button together. */
.hero__dot {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.hero__dot::before,
.hero__dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--cross);
  height: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
  transition: background-color 0.2s ease;
}

.hero__dot::after {
  width: 2px;
  height: var(--cross);
}

.hero__dot[aria-current="true"],
.hero__dot:hover {
  color: var(--on-dark);
}

/* Pause: not in the design, but required for anything that moves on its own
   (WCAG 2.2.2). Two thin bars in the same colour as the "+"; when paused
   (data-paused, set by main.js) it becomes a small play triangle. */
.hero__dot--pause::before,
.hero__dot--pause::after {
  width: 3px;
  height: calc(var(--cross) / 2);   /* half the "+" height, so it scales with them */
}

.hero__dot--pause::before { transform: translate(calc(-50% - 4px), -50%); }
.hero__dot--pause::after  { transform: translate(calc(-50% + 4px), -50%); }

.hero__dot--pause[data-paused]::before {
  width: calc(var(--cross) * 0.4);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transform: translate(-40%, -50%);
}

.hero__dot--pause[data-paused]::after {
  display: none;
}

.hero[data-tone="light"] .hero__dot { color: rgba(0, 0, 0, 0.45); }
.hero[data-tone="light"] .hero__dot[aria-current="true"],
.hero[data-tone="light"] .hero__dot:hover { color: var(--text); }

@media (min-width: 768px) {
  .hero__frame {
    height: clamp(420px, 40vw, 600px);
    background: #3a3f47;
  }

  .hero__frame::after,
  .hero__slide::before {
    display: none;
  }

  /* Tablet and up: the photo fills the whole hero and the headline sits on it.
     --hero-y is how far down each photo the crop sits. The values reproduce the
     crops in Rob's desktop design (its panel has the same 2.5:1 shape as this
     hero): slide 1 at 71%, slide 2 at 90%. Slide 3 sits a little lower than
     the design (79%), so the crop ends just below Fred's first shirt button
     (Rob, 18 Nov). */
  .hero__slide {
    display: block;
    background-image: var(--hero-overlay), var(--hero-image, none);
    background-size: cover;
    background-position: right var(--hero-y, 50%);
  }

  .hero__slide--1 { --hero-y: 71%; }
  .hero__slide--2 { --hero-y: 90%; }
  .hero__slide--3 { --hero-y: 79%; }

  /* The text sits to the left of the people, so shade from the left. */
  .hero__slide[data-tone="light"] {
    --hero-overlay: linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 55%);
    color: var(--text);
  }

  .hero__slide[data-tone="dark"] {
    --hero-overlay: linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 55%);
    color: var(--on-dark);
  }

  /* max-width is measured from the content edge, so the text wraps where the design wraps it.
     Rob, 18 Nov: no widows. The phrases in <span class="keep"> never split
     ("one connected picture", "are the same conversation", "Has his funding",
     "kept up?") and
     "balance" evens out the line lengths around them. */
  .hero__title {
    min-height: 0;
    max-width: calc(var(--content-left) + 10em);
    padding: clamp(32px, 7.5vw, 112px) 0 0 var(--content-left);
    line-height: 1.25;
    text-wrap: balance;
  }

  .hero__title .keep {
    white-space: nowrap;
  }

  .hero__slide--1 .hero__title {
    max-width: calc(var(--content-left) + 15em);   /* "Better Business, Better Care" stays on one line */
  }

  /* The design: 32px "+" with their centres 55px apart (44px button + 11px gap). */
  .hero__controls {
    --cross: 32px;
    top: auto;
    bottom: clamp(12px, 2vw, 20px);
    left: calc(var(--content-left) - (44px - var(--cross)) / 2);
  }

  .hero__dots {
    gap: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__slide,
  .hero__slide.is-active {
    transition: none;
  }
}

/* ----------------------------------------------------------------------------
   6. INTRO AND CALLOUT
   The same three columns on every slide (as in the design). Only the callout box
   changes: main.js swaps its text and replays the "draw the border" animation.
   ------------------------------------------------------------------------- */
/* Phones: 36px under the hero's white rule, 12px between paragraphs and the
   box 62px below them, as in the mobile design. */
.intro {
  padding-block: 36px 45px;
}

.intro__grid {
  display: grid;
  gap: 12px;
}

.intro__lead {
  font-size: var(--fs-body);
  font-weight: var(--bold);
  line-height: 1.5;
}

/* White, as in both designs. */
.intro p {
  color: var(--on-dark);
}

.callout {
  --accent: var(--orange);
  position: relative;
  align-self: start;
  margin-top: 50px;
  padding: 12px 20px 23px;
}

.callout[data-accent="yellow"] {
  --accent: var(--yellow);
}

.callout[data-accent="green"] {
  --accent: var(--green);
}

.callout[hidden] {
  display: none;
}

/* The border is four lines, so it can be drawn one side at a time:
   top (left to right), right (down), bottom (right to left), left (up). */
.callout__frame i {
  position: absolute;
  background: var(--accent);
}

.callout__frame i:nth-child(1) { top: 0;    left: 0;  width: 100%; height: 1.5px; transform-origin: left; }
.callout__frame i:nth-child(2) { top: 0;    right: 0; width: 1.5px; height: 100%; transform-origin: top; }
.callout__frame i:nth-child(3) { bottom: 0; right: 0; width: 100%; height: 1.5px; transform-origin: right; }
.callout__frame i:nth-child(4) { bottom: 0; left: 0;  width: 1.5px; height: 100%; transform-origin: bottom; }

/* The "x" on the top-left corner, as in the design: 19px across, centred on
   the corner. Two thin bars drawn in CSS (a typed "+" came out too small and
   changed with the font), turned 45 degrees. */
.callout::before {
  content: "";
  position: absolute;
  top: -13.5px;
  left: -13.5px;
  z-index: 1;
  width: 27px;
  height: 27px;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 100% 1.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 1.5px 100% no-repeat;
  transform: rotate(45deg);
}

.intro .callout p {
  color: var(--on-dark);
  font-size: var(--fs-callout);
  font-weight: var(--bold);
  line-height: 1.25;
}

.callout__accent {
  display: block;
  color: var(--accent);
}

/* nowrap: "55-60%" always stays on one line (Rob, 18 Nov). */
.callout__stat {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: var(--fs-stat);
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* The drawing animation, replayed by main.js when the slide changes, but only
   while the box is on screen. Order (Rob, 18 Nov): the "x" appears first, then
   the keyline draws itself clockwise from that corner, then the text fades in. */
.callout.is-drawing::before { animation: callout-x 0.25s ease-out 0s both; }
.callout.is-drawing .callout__frame i:nth-child(1) { animation: draw-x 0.22s linear 0.25s both; }
.callout.is-drawing .callout__frame i:nth-child(2) { animation: draw-y 0.22s linear 0.47s both; }
.callout.is-drawing .callout__frame i:nth-child(3) { animation: draw-x 0.22s linear 0.69s both; }
.callout.is-drawing .callout__frame i:nth-child(4) { animation: draw-y 0.22s linear 0.91s both; }
.callout.is-drawing p { animation: callout-text 0.4s ease-out 0.8s both; }

/* Waiting off screen for its turn to draw (main.js): blank until then. */
.callout.is-waiting::before,
.callout.is-waiting .callout__frame,
.callout.is-waiting p {
  opacity: 0;
}

@keyframes callout-x { from { opacity: 0; transform: rotate(45deg) scale(0.3); } to { opacity: 1; transform: rotate(45deg) scale(1); } }
@keyframes draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes callout-text { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (min-width: 768px) {
  .intro {
    padding-block: clamp(48px, 5vw, 70px) clamp(64px, 10vw, 150px);
  }

  .intro__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 40px;
  }

  /* Rob, 18 Nov: contents up a fraction, so the space above the text matches
     the 22px left inset. 14px plus the line's own space above the capitals
     makes 22px for the 24px text; the statistic has more space above its
     digits, so it moves up 0.08em more. */
  .callout {
    margin-top: 0;
    padding: 14px 22px 22px;
  }

  .callout__stat {
    margin-top: -0.08em;
  }

  /* Narrower columns than on phones, so the box text scales down a little
     (24px and 64px again on a full-width desktop). */
  .intro .callout p {
    font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  }

  .callout__stat {
    font-size: clamp(3rem, 4.5vw, 4rem);
  }
}

@media (min-width: 1024px) {
  .intro__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Four narrow columns: the statistic is a little smaller than the design's
     64px (Rob, 18 Nov), so "55-60%" fits on one line from 1024px wide up. */
  .callout__stat {
    font-size: clamp(2.6rem, 3.9vw, 3.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .callout.is-drawing::before,
  .callout.is-drawing .callout__frame i,
  .callout.is-drawing p {
    animation: none;
  }
}

/* ----------------------------------------------------------------------------
   7. APPLICATIONS (CQ Homes)
   ------------------------------------------------------------------------- */
/* Phones: spacing from the mobile design; the video runs edge to edge and
   ends the section. */
.apps {
  padding-block: 27px 0;
}

.apps__grid {
  display: grid;
  gap: 30px;
}

.features {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features h3 {
  font-size: var(--fs-body);
  font-weight: var(--bold);
}

/* Company video. 16:9. Until the file exists main.js shows "Video coming soon".
   Phones: full width, edge to edge, as in the mobile design. */
.apps__media {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 23px calc(-1 * var(--gutter)) 0;
  background: var(--ink-2);
}

.apps__media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink-2);
}

.apps__media-note {
  position: absolute;
  right: 0;
  bottom: 14px;
  left: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  text-align: center;
}

.apps__media-note[hidden] {
  display: none;
}

@media (min-width: 768px) {
  .apps {
    padding-block: clamp(56px, 6vw, 82px) clamp(64px, 11vw, 160px);
  }

  .apps__grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .features {
    gap: 16px;
  }

  .apps__media {
    grid-column: 1 / -1;
    margin: 0;
  }
}

@media (min-width: 1024px) {
  .apps__grid {
    grid-template-columns: 1fr 1fr 2fr;
    align-items: start;
  }

  .apps__media {
    grid-column: auto;
  }
}

/* ----------------------------------------------------------------------------
   8. CONTACT
   Agreed change from the design: rounded fields, Send under the message box.
   ------------------------------------------------------------------------- */
.contact {
  padding-block: clamp(40px, 3vw, 40px) clamp(56px, 8vw, 104px);
  padding-top: clamp(40px, 4vw, 48px);
}

.contact__grid {
  display: grid;
  gap: 24px;
}

.contact__intro p:last-child {
  max-width: 34ch;
}

.contact-form {
  display: grid;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border-radius: var(--radius-field);
  background: var(--paper);
}

.field:focus-within {
  box-shadow: 0 0 0 2px var(--ink);
}

.field__label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  outline: none;
}

.field textarea {
  flex: 1;
  min-height: 96px;
  resize: vertical;
}

/* Phones: full-width Send, easier to tap. "order" puts the privacy line ABOVE
   Send (it comes after it in the HTML), so people see it before they press. */
.contact-form .button {
  order: 1;
  justify-self: stretch;
}

.contact-form .form-status {
  order: 2;
}

.contact-form .button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* Spam trap field: off screen for people, still in the form for bots. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile only shows itself if it needs the visitor to click. */
.contact-form__check:empty {
  display: none;
}

.form-note {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-status {
  min-height: 1.4em;
  font-size: 0.875rem;
}

.form-status.is-success { color: #1d5e2a; font-weight: var(--bold); }
.form-status.is-error   { color: #8a1c1c; font-weight: var(--bold); }

/* Tablet and up: Name and Email left, Message right, then the privacy line
   with Send under the message box (agreed 16 Nov 2026). */
@media (min-width: 768px) {
  .contact-form {
    grid-template-columns: 1fr 1.4fr;
    grid-template-areas:
      "name    message"
      "email   message"
      "check   check"
      "note    send"
      "status  status";
  }

  .field--name          { grid-area: name; }
  .field--email         { grid-area: email; }
  .field--message       { grid-area: message; }
  .contact-form__check  { grid-area: check; }
  .contact-form .button { grid-area: send; justify-self: end; min-width: 150px; }
  .form-note            { grid-area: note; align-self: center; }
  .form-status          { grid-area: status; }
}

@media (min-width: 1024px) {
  .contact__grid {
    grid-template-columns: 1fr 3fr;
    gap: 40px;
  }
}

/* ----------------------------------------------------------------------------
   9. FOOTER
   Follows Rob's footer design (17 Nov 2026): white text and a white rule on the
   dark background, then the legal details in labelled columns with the
   copyright line under the links.
   Two agreed differences from the design: the email address under the company
   name (the law needs one) and no separate "Cookies" link (it is part of Privacy).
   ------------------------------------------------------------------------- */
.site-footer {
  padding-block: 32px 34px;
}

/* Top row. Phones (Rob's mobile design): the CQ mark centred, the tagline
   across the full width under it, no wordmark. Tablet and up: wordmark, mark,
   tagline in one row. */
.site-footer__top {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "mark"
    "tag";
  justify-items: center;
  gap: 25px 24px;
  align-items: center;
  padding-bottom: 29px;
  border-bottom: 1px solid var(--on-dark);
}

.site-footer__top .brand { grid-area: word; display: none; }
.site-footer__mark       { grid-area: mark; width: auto; height: 60px; }
.site-footer__tagline    { grid-area: tag;  width: 100%; height: auto; }

.site-footer .brand img {
  width: auto;
  height: 22px;
}

/* Bottom row. Phones: one column, in reading order (company, office,
   registration, links, copyright), with a second white rule above the links.
   Text is light weight; the company name and "Contact" are bold, as in the design. */
.site-footer__bottom {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  color: var(--on-dark);
}

.site-footer__legal {
  margin-top: 9px;
  padding-top: 2px;
  border-top: 1px solid var(--on-dark);
}

.site-footer address {
  font-style: normal;
}

.site-footer strong,
.site-footer nav a.is-strong {
  font-weight: var(--bold);
}

.site-footer__bottom a {
  text-decoration: none;
}

.site-footer__bottom a:hover {
  text-decoration: underline;
}

.site-footer nav ul {
  display: flex;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 44px tall on phones so the links are easy to tap. */
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (min-width: 768px) {
  .site-footer {
    padding-block: clamp(48px, 6vw, 80px) 40px;
  }

  .site-footer__top {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "word mark tag";
    justify-items: stretch;
    gap: 20px 24px;
    padding-bottom: clamp(32px, 4.5vw, 64px);
  }

  .site-footer__top .brand { display: inline-flex; }
  .site-footer .brand img { height: 26px; }
  .site-footer__mark      { height: 48px; justify-self: center; }
  .site-footer__tagline   { width: auto; height: 20px; justify-self: end; }

  .site-footer__legal {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  /* Tablets and up: the columns sit side by side, like the design. A flexbox
     that wraps, not a fixed grid, so on narrower screens a column that runs out
     of room drops to the next line instead of squashing its text. The links are
     always pushed to the right edge and the copyright line sits under them. */
  .site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px clamp(32px, 4.5vw, 72px);
    padding-top: 12px;
  }

  .site-footer__legal {
    margin-left: auto;
  }

  .site-footer__copy {
    flex-basis: 100%;
    text-align: right;
  }

  .site-footer nav ul {
    gap: clamp(32px, 5.5vw, 80px);
  }

  .site-footer nav a {
    min-height: 0;
  }
}

@media (min-width: 1024px) {
  .site-footer .brand img { height: 34px; }
  .site-footer__mark      { height: 80px; }   /* the design's size: 80px tall at 1440 wide */
  .site-footer__tagline   { height: 26px; }
}

/* ----------------------------------------------------------------------------
   10. INNER PAGES (Company, Applications, Enquiries)
   Built in the same style as the home page: a dark title band, then white
   sections, then an orange "talk to us" link back to Enquiries.
   ------------------------------------------------------------------------- */
.page-hero {
  padding-block: clamp(32px, 4vw, 56px) clamp(56px, 8vw, 104px);
}

.page-hero .eyebrow {
  color: var(--on-dark-muted);
}

.page-title {
  max-width: 18em;
  margin-bottom: 20px;
  font-size: var(--fs-h1);
  font-weight: var(--light);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.page-title strong {
  display: block;
}

.page-lead {
  max-width: 46em;
  color: var(--on-dark-muted);
  font-size: 1.125rem;
}

/* Photo title bands: the same edge-to-edge treatment as the home page hero.
   Each page has its own photo (free stock, sources in the README), so none
   repeats a home page hero photo. The text stays white on a dark shade,
   so the shade has to stay strong wherever text sits (it is 0.85+ there, which
   keeps the grey lead text above WCAG AA contrast on the brightest photo). On
   wider screens the shade fades out to the right, where the people are.
   To change a page's photo, change its --page-image line below (and the
   matching <link rel="preload"> in that page's <head>). --page-pos-y moves the
   photo up or down if a face gets cut off. */
.page-hero--photo {
  --page-shade: linear-gradient(180deg, rgba(40, 40, 40, 0.9) 0%, rgba(40, 40, 40, 0.85) 100%);
  background-color: var(--ink);
  background-image: var(--page-shade), var(--page-image, none);
  background-size: cover;
  background-position: 75% var(--page-pos-y, center);
}

.page-hero--company      { --page-image: url("/images/company.webp"); --page-pos-y: 30%; }
.page-hero--applications { --page-image: url("/images/applications.webp"); }
.page-hero--enquiries    { --page-image: url("/images/enquiries.webp"); --page-pos-y: 8%; }

/* Wider screens: the shade stays dark across the text column (--text-col, measured
   from the content edge so it holds at every width), then fades to show the people. */
@media (min-width: 768px) {
  .page-hero--photo {
    --text-col: 500px;
    --page-shade: linear-gradient(90deg,
      rgba(40, 40, 40, 0.92) 0,
      rgba(40, 40, 40, 0.88) calc(var(--content-left) + var(--text-col)),
      rgba(40, 40, 40, 0.15) calc(var(--content-left) + var(--text-col) + 25%),
      rgba(40, 40, 40, 0.1) 100%);
    display: grid;
    align-content: center;
    min-height: clamp(380px, 34vw, 520px);
    background-position: right var(--page-pos-y, center);
  }

  /* Keep the words on the shaded side, clear of the people in the photo. */
  .page-hero--photo .page-title { max-width: 15em; }
  .page-hero--photo .page-lead  { max-width: 26em; }
}

@media (min-width: 1024px) {
  .page-hero--photo { --text-col: 620px; }   /* the 40px headline is wider here */
}

.page-section {
  padding-block: var(--section-y);
}

.page-section + .page-section {
  padding-top: 0;
}

/* Heading on the left, text on the right (one column on phones). */
.split {
  display: grid;
  gap: 16px 40px;
}

.split p + p {
  margin-top: 14px;
}

.card-grid {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A thin accent line above each card, echoing the callout boxes. */
.card {
  padding-top: 16px;
  border-top: 1.5px solid var(--orange);
}

.card h3 {
  margin-bottom: 6px;
  font-size: var(--fs-body);
  font-weight: var(--bold);
}

.card p {
  color: var(--text-muted);
}

.cta-band {
  padding-block: clamp(40px, 6vw, 72px);
}

.cta-band__inner {
  display: grid;
  gap: 20px;
  align-items: center;
}

.cta-band p {
  max-width: 40em;
}

@media (min-width: 768px) {
  .split {
    grid-template-columns: 1fr 2fr;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  .cta-band__inner {
    grid-template-columns: 1fr auto;
  }
}

/* ----------------------------------------------------------------------------
   11. LONG-FORM TEXT (privacy page, 404)
   ------------------------------------------------------------------------- */
.simple-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh; /* ignores the phone browser's address bar */
}

.simple-page main {
  flex: 1;
  padding-block: var(--section-y);
  background: var(--paper);
  color: var(--text);
}

.prose {
  max-width: calc(72ch + 2 * var(--gutter));
}

.prose h1 {
  margin-bottom: 8px;
  font-size: var(--fs-h1);
  font-weight: var(--light);
  line-height: 1.2;
}

.prose h2 {
  margin: 32px 0 8px;
  font-size: 1.25rem;
  font-weight: var(--bold);
  line-height: 1.3;
}

.prose h3 {
  margin: 20px 0 6px;
  font-size: 1rem;
  font-weight: var(--bold);
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 4px;
}

.prose a:not(.button) {
  color: var(--text);
  text-underline-offset: 2px;
}

.prose__meta {
  font-size: 0.875rem;
}

/* Tables scroll sideways on phones instead of breaking the page. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 16px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.prose th,
.prose td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid #dde2ea;
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text);
  white-space: nowrap;
}
