/* ==========================================================================
   Hetts Solicitors - home page redesign
   Loaded ONLY by the home page (dev1.php while testing).

   Cascade order is declared in the page <head>:
     @layer vendor, template, home;
   Bootstrap sits in "vendor", the site-wide main.css in "template", and
   everything in this file in "home", so these rules win without !important.
   ========================================================================== */

@layer home.tokens, home.base, home.header, home.components, home.sections, home.motion;

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
@layer home.tokens {
  :root {
    /* White site for every visitor, whatever their device theme. To follow the
       device's dark mode again, change this to "light dark" (and the matching
       <meta name="color-scheme"> in the page head). */
    color-scheme: only light;

    /* Existing brand colours, unchanged */
    --brand: #28a745;        /* accent green */
    --brand-deep: #204d2a;   /* "Founded in 1828" badge green */
    --teal: #0d3035;         /* heading teal */
    --header-bg: #0f0000;    /* header near-black */
    --footer-bg: #060606;
    --paper: #fefff8;        /* cream section background */

    /* Derived: a deeper brand green that passes AA with white text */
    --brand-strong: oklch(0.5 0.135 150);
    --brand-strong-hover: color-mix(in oklch, var(--brand-strong) 86%, black);

    /* Semantic colours - plain fallbacks first (older browsers) */
    --bg: #ffffff;
    --bg-alt: #f5f7f4;
    --surface: #ffffff;
    --text: #474d4d;
    --text-muted: #5b6262;
    --heading: #0d3035;
    --accent-text: #1f7a3a;
    --border: rgb(13 48 53 / 0.13);
    --field-border: #6f8386;
    --focus: #1f7a3a;
    --glow-a: rgb(40 167 69 / 0.14);
    --glow-b: rgb(13 48 53 / 0.1);
    --shadow-color: 190 60% 12%;

    /* Type */
    --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --step--1: clamp(0.84rem, 0.81rem + 0.14vw, 0.92rem);
    --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
    --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
    --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
    --step-3: clamp(1.9rem, 1.5rem + 2vw, 3.1rem);

    /* Space, shape, depth */
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --section-space: clamp(3.5rem, 8vw, 7rem);
    --gap: clamp(0.875rem, 1.6vw, 1.25rem);
    --radius-sm: 0.625rem;
    --radius-md: 1rem;
    --radius-lg: 1.375rem;
    --shadow-sm:
      0 1px 1px hsl(var(--shadow-color) / 0.04),
      0 2px 4px hsl(var(--shadow-color) / 0.04),
      0 6px 14px hsl(var(--shadow-color) / 0.05);
    --shadow-md:
      0 1px 2px hsl(var(--shadow-color) / 0.05),
      0 6px 12px hsl(var(--shadow-color) / 0.06),
      0 18px 36px hsl(var(--shadow-color) / 0.09);
    --shadow-lg:
      0 2px 4px hsl(var(--shadow-color) / 0.05),
      0 12px 24px hsl(var(--shadow-color) / 0.08),
      0 36px 72px hsl(var(--shadow-color) / 0.14);
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

    /* Re-point the template's own variables at the new system */
    --default-font: var(--font-sans);
    --heading-font: var(--font-serif);
    --nav-font: var(--font-sans);
    --background-color: var(--bg);
    --default-color: var(--text);
    --heading-color: var(--heading);
    --accent-color: var(--brand-strong);
    --surface-color: var(--surface);
    --contrast-color: #ffffff;
    --nav-color: rgb(255 255 255 / 0.84);
    --nav-hover-color: #ffffff;
    --nav-mobile-background-color: var(--surface);
    --nav-dropdown-background-color: var(--surface);
    --nav-dropdown-color: var(--text);
    --nav-dropdown-hover-color: var(--accent-text);
  }

  /* Light / dark aware values */
  @supports (color: light-dark(#000, #fff)) {
    :root {
      --bg: light-dark(#ffffff, oklch(0.17 0.014 175));
      --bg-alt: light-dark(oklch(0.972 0.006 150), oklch(0.2 0.017 175));
      --surface: light-dark(#ffffff, oklch(0.235 0.019 175));
      --text: light-dark(oklch(0.4 0.012 200), oklch(0.87 0.012 108));
      --text-muted: light-dark(oklch(0.47 0.012 200), oklch(0.76 0.012 108));
      --heading: light-dark(#0d3035, oklch(0.96 0.014 108));
      --accent-text: light-dark(oklch(0.47 0.13 150), oklch(0.8 0.15 150));
      --border: light-dark(rgb(13 48 53 / 0.13), rgb(255 255 255 / 0.13));
      --field-border: light-dark(oklch(0.58 0.025 200), oklch(0.62 0.02 175));
      --focus: light-dark(oklch(0.45 0.14 150), oklch(0.85 0.15 150));
      --glow-a: light-dark(rgb(40 167 69 / 0.14), rgb(40 167 69 / 0.16));
      --glow-b: light-dark(rgb(13 48 53 / 0.1), rgb(60 150 160 / 0.12));
      --shadow-color: light-dark(190 60% 12%, 0 0% 0%);
    }
  }
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
@layer home.base {
  body {
    font-size: var(--step-0);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  main {
    &:focus { outline: none; }

    :is(h1, h2, h3) {
      font-family: var(--font-serif);
      font-weight: 500;
      font-optical-sizing: auto;
      letter-spacing: -0.015em;
      line-height: 1.12;
      color: var(--heading);
      text-wrap: balance;
      margin-block: 0;
    }

    p {
      text-wrap: pretty;
      margin-block: 0;
    }

    section {
      padding-block: var(--section-space);
      background-color: var(--bg);
    }
  }

  .wrap {
    inline-size: min(100% - 2 * var(--gutter), 78rem);
    margin-inline: auto;
  }

  /* One consistent, clearly visible focus ring everywhere */
  :focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 0.25rem;
  }

  .header,
  .site-footer,
  .contact-info,
  .svc-card--feature {
    --focus: #b9f5c8;
  }

  .skip-link {
    position: fixed;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 100000;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--heading);
    font-weight: 600;
    box-shadow: var(--shadow-md);
    translate: 0 -200%;

    &:focus-visible {
      translate: 0 0;
      color: var(--heading);
    }
  }

  .visually-hidden-field {
    position: absolute;
    inset-inline-start: -5000px;
  }
}

/* --------------------------------------------------------------------------
   3. Header and navigation (markup lives in the shared header.html and is
      not edited - the logo keeps its own font, size and colour)
   -------------------------------------------------------------------------- */
@layer home.header {
  .header {
    --background-color: transparent;
    background: transparent;
    padding-block: 0.5rem;
    border-block-end: 1px solid rgb(255 255 255 / 0.08);
    transition: border-color 0.3s, box-shadow 0.3s;

    /* The blur lives on a pseudo-element so the header itself never becomes
       the containing block for the fixed mobile menu. */
    &::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -1;
      background: var(--header-bg);
      transition: background-color 0.3s;
    }

    @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
      /* Solid brand colour at the top of the page, frosted once scrolled */
      &::before {
        -webkit-backdrop-filter: saturate(160%) blur(16px);
        backdrop-filter: saturate(160%) blur(16px);
      }
    }

    & > .container-xl {
      max-inline-size: none;
      inline-size: min(100% - 2 * var(--gutter), 78rem);
      padding-inline: 0;
    }

    .btn-getstarted,
    .btn-getstarted:focus {
      background: var(--brand-strong);
      color: #ffffff;
      font-family: var(--font-sans);
      font-size: 0.95rem;
      font-weight: 600;
      line-height: 1.2;
      padding: 0.65rem 1.15rem;
      margin: 0 0.5rem 0 0;
      border-radius: var(--radius-sm);
      box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 6px 16px -6px rgb(0 0 0 / 0.5);
      white-space: nowrap;
    }

    .btn-getstarted:hover,
    .btn-getstarted:focus:hover {
      background: color-mix(in oklch, var(--brand-strong) 84%, white);
      color: #ffffff;
    }
  }

  .scrolled .header {
    --background-color: transparent;
    border-block-end-color: rgb(255 255 255 / 0.14);
    box-shadow: 0 12px 30px -14px rgb(0 0 0 / 0.55);

    @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
      &::before {
        background: color-mix(in oklch, var(--header-bg) 86%, transparent);
      }
    }
  }

  /* ---- Desktop navigation ---- */
  @media (width >= 1200px) {
    .header .btn-getstarted,
    .header .btn-getstarted:focus {
      margin: 0 0 0 1.75rem;
    }

    .navmenu {
      a,
      a:focus {
        font-size: 0.95rem;
        font-weight: 500;
        letter-spacing: 0.005em;
      }

      & > ul > li > a::before {
        background-color: var(--brand);
        bottom: -10px;
        border-radius: 2px;
      }

      .dropdown ul {
        padding: 0.5rem;
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-lg);

        a {
          padding: 0.55rem 0.8rem;
          border-radius: 0.5rem;
          font-size: 0.925rem;
        }

        a:hover,
        li:hover > a,
        a:focus-visible {
          background: color-mix(in oklch, var(--brand) 12%, transparent);
        }
      }

      /* Keyboard users can open the dropdowns too */
      .dropdown:focus-within > ul {
        opacity: 1;
        top: 100%;
        visibility: visible;
      }

      .dropdown .dropdown:focus-within > ul {
        top: 0;
        left: -100%;
      }
    }
  }

  /* ---- Mobile navigation: a clean slide-in panel ---- */
  @media (width < 1200px) {
    .mobile-nav-toggle {
      display: inline-grid;
      place-items: center;
      inline-size: 2.75rem;
      block-size: 2.75rem;
      margin: 0;
      color: #ffffff;
      font-size: 1.75rem;
      line-height: 1;
      border-radius: var(--radius-sm);

      &:hover { background: rgb(255 255 255 / 0.1); }
    }

    .navmenu {
      & > ul {
        inset: 0 0 0 auto;
        inline-size: min(100%, 24rem);
        padding: 4.75rem 0.75rem 2rem;
        border-radius: 0;
        box-shadow: -24px 0 60px rgb(0 0 0 / 0.35);
        overscroll-behavior: contain;
      }

      a,
      a:focus {
        padding: 0.8rem 1rem;
        border-radius: 0.5rem;
        font-size: 1.0625rem;
        white-space: normal;
        gap: 0.75rem;
      }

      a:hover {
        background: color-mix(in oklch, var(--brand) 10%, transparent);
      }

      a i,
      a:focus i {
        flex: none;
        margin-left: 0;
      }

      .dropdown ul,
      .dropdown ul ul,
      .dropdown > .dropdown-active {
        margin: 0.25rem 0 0.5rem 1rem;
        padding: 0;
        border: 0;
        border-inline-start: 2px solid var(--border);
        border-radius: 0;
        background: transparent;
      }

      /* Only an opened sub-menu flips its own chevron */
      .dropdown.active .dropdown:not(.active) > a i {
        transform: none;
        background-color: color-mix(in srgb, var(--accent-color), transparent 90%);
        color: inherit;
      }

      .dropdown ul a,
      .dropdown ul a:focus {
        font-size: 1rem;
        font-weight: 400;
        padding-block: 0.65rem;
      }
    }

    .mobile-nav-active {
      .navmenu {
        background: rgb(0 0 0 / 0.55);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
      }

      .mobile-nav-toggle {
        top: 0.75rem;
        right: 0.75rem;
        color: var(--heading);
        font-size: 2rem;

        &:hover { background: color-mix(in oklch, var(--heading) 10%, transparent); }
      }

      .scroll-top { visibility: hidden; }
    }
  }
}

/* --------------------------------------------------------------------------
   4. Shared components
   -------------------------------------------------------------------------- */
@layer home.components {
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-block-size: 3rem;
    padding: 0.8rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s;

    i { font-size: 1.05em; line-height: 1; }
  }

  .button--primary {
    background: var(--brand-strong);
    color: #ffffff;
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.2),
      0 1px 2px hsl(var(--shadow-color) / 0.2),
      0 10px 22px -8px color-mix(in oklch, var(--brand-strong) 70%, transparent);

    &:hover {
      background: var(--brand-strong-hover);
      color: #ffffff;
      box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.2),
        0 2px 4px hsl(var(--shadow-color) / 0.2),
        0 16px 30px -10px color-mix(in oklch, var(--brand-strong) 80%, transparent);
    }
  }

  .button--ghost {
    background: color-mix(in oklch, var(--surface) 70%, transparent);
    color: var(--heading);
    border-color: color-mix(in oklch, var(--heading) 28%, transparent);

    &:hover {
      background: var(--surface);
      color: var(--heading);
      border-color: color-mix(in oklch, var(--heading) 55%, transparent);
    }
  }

  .eyebrow {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    line-height: 1.5;
    text-transform: uppercase;
    color: var(--accent-text);

    &::before {
      content: "";
      flex: none;
      inline-size: 2rem;
      block-size: 2px;
      translate: 0 -0.3em;
      background: var(--brand);
    }
  }

  .section-head {
    display: grid;
    gap: 1rem;
    max-inline-size: 42rem;

    h2 { font-size: var(--step-3); }
    p { font-size: var(--step-1); line-height: 1.5; color: var(--text-muted); }
  }

  .scroll-top {
    inline-size: 2.75rem;
    block-size: 2.75rem;
    border-radius: 50%;
    background-color: var(--brand-strong);
    box-shadow: var(--shadow-md);

    &:hover { background-color: var(--brand-strong-hover); }
  }
}

/* --------------------------------------------------------------------------
   5. Sections
   -------------------------------------------------------------------------- */
@layer home.sections {

  /* ---- Hero (#about) ---- */
  .hero {
    position: relative;
    padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(3.5rem, 8vw, 6.5rem);
    background:
      radial-gradient(60rem 36rem at 100% 0%, var(--glow-a), transparent 70%),
      radial-gradient(42rem 30rem at 0% 100%, var(--glow-b), transparent 70%),
      linear-gradient(to bottom, var(--bg), var(--bg-alt));
  }

  .hero__grid {
    display: grid;
    gap: clamp(2.5rem, 5vw, 5rem);
    align-items: center;

    @media (width >= 62rem) {
      grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    }
  }

  .hero__copy {
    container: hero-copy / inline-size;
    display: grid;
    gap: 1.5rem;
  }

  .hero__title {
    font-size: clamp(2.25rem, 1.6rem + 3vw, 4rem);
    line-height: 1.04;
    letter-spacing: -0.025em;
  }

  @supports (font-size: 1cqi) {
    .hero__title { font-size: clamp(2.25rem, 8.6cqi + 0.3rem, 4.25rem); }
  }

  .hero__lead {
    max-inline-size: 38rem;
    font-size: var(--step-1);
    line-height: 1.55;

    strong { color: var(--heading); font-weight: 600; }
  }

  .hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .hero__features {
    display: grid;
    gap: 0.85rem 2rem;
    margin: 0.5rem 0 0;
    padding: 1.5rem 0 0;
    border-block-start: 1px solid var(--border);
    list-style: none;
    font-size: 0.95rem;
    line-height: 1.5;

    li {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 0.7rem;
      align-items: start;
    }

    i {
      color: var(--accent-text);
      font-size: 1.05rem;
      line-height: 1.45;
    }
  }

  @container hero-copy (inline-size >= 32rem) {
    .hero__features { grid-template-columns: 1fr 1fr; }
  }

  .hero__media {
    position: relative;
    margin: 0;
  }

  .hero__image {
    display: block;
    inline-size: 100%;
    block-size: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    object-position: 60% 50%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--bg-alt);

    @media (width >= 62rem) {
      aspect-ratio: 5 / 4;
    }
  }

  /* Soft offset frame behind the photo */
  .hero__media::before {
    content: "";
    position: absolute;
    inset: 1.25rem -0.75rem -0.75rem 1.25rem;
    z-index: 0;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in oklch, var(--brand) 45%, transparent);
    background: color-mix(in oklch, var(--brand) 7%, transparent);
  }

  .hero__image { position: relative; z-index: 1; }

  .hero__badge {
    position: absolute;
    z-index: 2;
    inset-block-end: 0.875rem;
    inset-inline-start: 0.875rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.25rem 1rem;
    max-inline-size: calc(100% - 1.75rem);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgb(255 255 255 / 0.2);
    background: var(--brand-deep);
    color: #ffffff;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: background-color 0.25s, box-shadow 0.25s;

    @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
      background: color-mix(in oklch, var(--brand-deep) 86%, transparent);
      -webkit-backdrop-filter: blur(12px) saturate(140%);
      backdrop-filter: blur(12px) saturate(140%);
    }

    @media (width >= 62rem) {
      inset-block-end: -1.5rem;
      inset-inline-start: -1.5rem;
      padding: 1.15rem 1.5rem;
    }

    &:hover {
      color: #ffffff;
      background: var(--brand-deep);
      box-shadow: var(--shadow-lg);
    }

    p { margin: 0; display: grid; }

    strong {
      font-family: var(--font-serif);
      font-size: var(--step-1);
      font-weight: 500;
      line-height: 1.15;
      letter-spacing: -0.01em;
    }

    span {
      font-size: 0.875rem;
      color: rgb(255 255 255 / 0.86);
    }

    i {
      display: grid;
      place-items: center;
      inline-size: 2.25rem;
      block-size: 2.25rem;
      border-radius: 50%;
      background: rgb(255 255 255 / 0.14);
      transition: translate 0.25s var(--ease-out), background-color 0.25s;
    }

    &:hover i {
      background: rgb(255 255 255 / 0.24);
      translate: 3px -3px;
    }
  }

  /* ---- Services (bento grid) ---- */
  .services-v2 {
    .section-head { margin-block-end: clamp(1.75rem, 4vw, 3rem); }
  }

  .svc-wrap { container: services / inline-size; }

  .svc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
  }

  .svc-card {
    position: relative;
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: 0.6rem;
    align-content: start;
    padding: clamp(1.25rem, 2.2vw, 1.75rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s, border-color 0.3s, translate 0.3s var(--ease-out);

    h3 {
      font-size: var(--step-1);
      padding-inline-end: 2.75rem;
    }

    h3 a {
      color: inherit;
      text-decoration: none;
      outline: none;

      /* The whole card is the link target */
      &::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
      }
    }

    p {
      font-size: 0.975rem;
      line-height: 1.55;
      color: var(--text-muted);
    }

    &:hover {
      border-color: color-mix(in oklch, var(--brand) 55%, transparent);
      box-shadow: var(--shadow-md);
    }

    &:has(a:focus-visible) {
      outline: 3px solid var(--focus);
      outline-offset: 3px;
    }
  }

  .svc-card__icon {
    display: grid;
    place-items: center;
    inline-size: 3rem;
    block-size: 3rem;
    margin-block-end: 0.5rem;
    border-radius: 0.875rem;
    background: color-mix(in oklch, var(--brand) 13%, var(--surface));
    color: var(--accent-text);
    font-size: 1.35rem;
    transition: background-color 0.3s, color 0.3s;

    i { line-height: 1; }
  }

  .svc-card:hover .svc-card__icon {
    background: var(--brand-strong);
    color: #ffffff;
  }

  .svc-card__arrow {
    position: absolute;
    inset-block-start: clamp(1.25rem, 2.2vw, 1.75rem);
    inset-inline-end: clamp(1.25rem, 2.2vw, 1.75rem);
    display: grid;
    place-items: center;
    inline-size: 2.25rem;
    block-size: 2.25rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--heading);
    font-size: 0.95rem;
    pointer-events: none;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s, translate 0.3s var(--ease-out);

    i { line-height: 1; }
  }

  .svc-card:hover .svc-card__arrow {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    color: #ffffff;
    translate: 2px -2px;
  }

  /* Feature tile */
  .svc-card--feature {
    border-color: transparent;
    background:
      radial-gradient(28rem 18rem at 100% 0%, rgb(40 167 69 / 0.35), transparent 70%),
      linear-gradient(160deg, var(--brand-deep), var(--teal));
    color: #ffffff;

    h3 { color: #ffffff; }
    p { color: rgb(255 255 255 / 0.86); }

    .svc-card__icon,
    &:hover .svc-card__icon {
      background: rgb(255 255 255 / 0.14);
      color: #ffffff;
    }

    .svc-card__arrow {
      border-color: rgb(255 255 255 / 0.3);
      color: #ffffff;
    }

    &:hover {
      border-color: transparent;

      .svc-card__arrow {
        background: #ffffff;
        border-color: #ffffff;
        color: var(--brand-deep);
      }
    }
  }

  @container services (inline-size >= 34rem) {
    .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .svc-card--feature { grid-column: span 2; }
  }

  @container services (inline-size >= 48rem) {
    .svc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .svc-card--feature {
      grid-row: span 6;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      gap: 0.75rem;
      padding: clamp(1.75rem, 3vw, 2.5rem);

      .svc-card__icon {
        inline-size: 3.75rem;
        block-size: 3.75rem;
        margin-block-end: auto;
        font-size: 1.7rem;
      }

      h3 { font-size: var(--step-3); }
      p { font-size: var(--step-1); line-height: 1.45; max-inline-size: 22rem; }

      .svc-card__arrow {
        inset-block-start: clamp(1.75rem, 3vw, 2.5rem);
        inset-inline-end: clamp(1.75rem, 3vw, 2.5rem);
        inline-size: 2.75rem;
        block-size: 2.75rem;
      }
    }
  }

  @container services (inline-size >= 66rem) {
    .svc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }

  /* ---- Why choose us ---- */
  .why {
    background-color: var(--bg-alt);
  }

  .why__grid {
    display: grid;
    gap: clamp(2rem, 5vw, 5rem);

    @media (width >= 62rem) {
      grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);

      .section-head {
        position: sticky;
        inset-block-start: 7.5rem;
        align-self: start;
      }
    }
  }

  .why__steps-wrap { container: why / inline-size; }

  .why__steps {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: clamp(1.5rem, 4vw, 3rem);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  @container why (inline-size >= 36rem) {
    .why__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  .step {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: 0.6rem;
    align-content: start;
    padding-block: 1.75rem;
    border-block-start: 1px solid color-mix(in oklch, var(--heading) 18%, transparent);

    h3 { font-size: var(--step-1); }
    p { font-size: 0.975rem; line-height: 1.6; }
  }

  .step__num {
    font-family: var(--font-serif);
    font-size: var(--step-2);
    font-weight: 400;
    line-height: 1;
    font-variant-numeric: lining-nums;
    color: var(--accent-text);
  }

  /* ---- Contact ---- */
  .contact-v2__grid {
    display: grid;
    gap: var(--gap);

    @media (width >= 62rem) {
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: clamp(1.25rem, 2.5vw, 2rem);
    }
  }

  .contact-info {
    display: grid;
    align-content: start;
    gap: 1.5rem;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    border-radius: var(--radius-lg);
    background:
      radial-gradient(26rem 18rem at 100% 0%, rgb(40 167 69 / 0.28), transparent 70%),
      linear-gradient(165deg, var(--teal), #071a1d);
    color: rgb(255 255 255 / 0.88);
    box-shadow: var(--shadow-md);

    h2 { font-size: var(--step-2); color: #ffffff; }
    h3 {
      font-family: var(--font-sans);
      font-size: 0.8rem;
      font-weight: 600;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: rgb(255 255 255 / 0.74);
      margin-block-end: 0.3rem;
    }

    a {
      color: #ffffff;
      text-decoration: underline;
      text-decoration-color: rgb(255 255 255 / 0.35);
      text-underline-offset: 0.2em;

      &:hover { text-decoration-color: #ffffff; }
    }
  }

  .contact-info__list {
    display: grid;
    gap: 1.5rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;

    li {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 1rem;
      align-items: start;
    }

    p { color: #ffffff; font-size: 1.05rem; line-height: 1.5; overflow-wrap: anywhere; }
  }

  .contact-info__icon {
    display: grid;
    place-items: center;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    border-radius: 0.875rem;
    background: rgb(255 255 255 / 0.1);
    border: 1px solid rgb(255 255 255 / 0.14);
    color: #9be7ae;
    font-size: 1.2rem;

    i { line-height: 1; }
  }

  .contact-form-card {
    display: grid;
    gap: 0.75rem;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);

    h2 { font-size: var(--step-2); }
    & > p { color: var(--text-muted); }

    form { container: form / inline-size; margin-block-start: 0.75rem; }
  }

  .form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
  }

  @container form (inline-size >= 32rem) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field--full, .form-foot { grid-column: 1 / -1; }
  }

  .field {
    display: grid;
    gap: 0.4rem;

    label {
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--heading);
    }

    input,
    textarea {
      inline-size: 100%;
      padding: 0.8rem 1rem;
      border: 1px solid var(--field-border);
      border-radius: var(--radius-sm);
      background: var(--bg);
      color: var(--heading);
      font: inherit;
      font-size: 1rem;
      line-height: 1.5;
      transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;

      &::placeholder { color: var(--text-muted); opacity: 1; }

      &:hover { border-color: var(--heading); }

      &:focus-visible {
        outline: 3px solid var(--focus);
        outline-offset: 1px;
        border-color: var(--focus);
        border-radius: var(--radius-sm);
        background: var(--surface);
      }
    }

    textarea { resize: vertical; min-block-size: 9rem; }

    /* Flag a field only after the visitor has interacted with it */
    &:has(:user-invalid) {
      label { color: light-dark(#b3121f, #ff9aa2); }
      input, textarea { border-color: light-dark(#b3121f, #ff9aa2); }
    }
  }

  .form-foot {
    display: grid;
    gap: 1rem;
    justify-items: start;

    .loading,
    .error-message,
    .sent-message {
      inline-size: 100%;
      margin: 0;
      padding: 0.9rem 1.1rem;
      border-radius: var(--radius-sm);
      text-align: start;
    }

    .loading { background: var(--bg-alt); color: var(--heading); }
    .error-message { background: #b3121f; }
    .sent-message { background: var(--brand-strong); }
  }

  /* ---- Footer ---- */
  .site-footer {
    background: var(--footer-bg);
    color: rgb(255 255 255 / 0.8);
    font-size: 0.95rem;
    padding-block: clamp(3rem, 6vw, 4.5rem) 1.5rem;

    h2 {
      font-family: var(--font-sans);
      font-size: 0.8rem;
      font-weight: 600;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      color: rgb(255 255 255 / 0.74);
      margin: 0 0 0.9rem;
    }

    p { margin: 0; }
    strong { color: #ffffff; font-weight: 600; }

    a {
      color: #ffffff;
      text-decoration: none;
    }
  }

  .site-footer__grid {
    display: grid;
    gap: 2.5rem;

    @media (width >= 48rem) {
      grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
    }
  }

  .site-footer__about {
    display: grid;
    gap: 0.6rem;
    align-content: start;

    .sitename {
      font-family: var(--font-serif);
      font-size: var(--step-2);
      font-weight: 500;
      letter-spacing: -0.01em;
      line-height: 1.1;
      color: #ffffff;
    }

    a:has(.sitename) {
      justify-self: start;
      margin-block-end: 0.5rem;
    }
  }

  .site-footer__social {
    display: flex;
    gap: 0.6rem;
    margin-block: 0.9rem;

    a {
      display: grid;
      place-items: center;
      inline-size: 2.75rem;
      block-size: 2.75rem;
      border-radius: 50%;
      border: 1px solid rgb(255 255 255 / 0.22);
      font-size: 1.1rem;
      transition: background-color 0.25s, border-color 0.25s;

      &:hover {
        background: var(--brand-strong);
        border-color: var(--brand-strong);
      }

      i { line-height: 1; }
    }
  }

  /* Reserved space for the SRA badge so it cannot shift the layout */
  .sra-badge {
    max-inline-size: 190px;

    & > div {
      position: relative;
      aspect-ratio: 1 / 0.591;
      overflow: hidden;
    }

    iframe {
      position: absolute;
      inset: 0;
      inline-size: 100%;
      block-size: 100%;
      border: 0;
      margin: 0;
      padding: 0;
      background-color: transparent;
    }
  }

  .site-footer__legal {
    margin-block-start: clamp(2rem, 5vw, 3.5rem);
    padding-block-start: 1.5rem;
    border-block-start: 1px solid rgb(255 255 255 / 0.12);
    text-align: center;
    font-size: 0.875rem;
  }
}

/* --------------------------------------------------------------------------
   6. Motion - only for visitors who have not asked for reduced motion,
      and only where the browser supports each feature.
   -------------------------------------------------------------------------- */
@layer home.motion {
  @media (prefers-reduced-motion: no-preference) {

    /* Smooth cross-page transitions (takes effect on pages that opt in) */
    @view-transition { navigation: auto; }

    /* Lift on hover */
    .button:hover { translate: 0 -1px; }
    .button { transition: background-color 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s, translate 0.25s var(--ease-out); }
    .svc-card:hover { translate: 0 -3px; }

    /* Hero entrance on first render */
    .hero__copy > * {
      transition: opacity 0.7s var(--ease-out), translate 0.7s var(--ease-out);
      transition-delay: calc(var(--i, 0) * 80ms);

      @starting-style {
        opacity: 0;
        translate: 0 1rem;
      }
    }

    .hero__copy > :nth-child(2) { --i: 1; }
    .hero__copy > :nth-child(3) { --i: 2; }
    .hero__copy > :nth-child(4) { --i: 3; }
    .hero__copy > :nth-child(5) { --i: 4; }

    .hero__media {
      transition: translate 0.9s var(--ease-out), scale 0.9s var(--ease-out);

      @starting-style {
        translate: 0 1.25rem;
        scale: 0.985;
      }
    }

    /* Mobile menu slides in */
    @media (width < 1200px) {
      .mobile-nav-active .navmenu > ul {
        transition: translate 0.35s var(--ease-out), opacity 0.25s;

        @starting-style {
          translate: 100% 0;
          opacity: 0;
        }
      }
    }

    /* Scroll-driven reveals (replaces AOS on this page). Without support,
       content is simply visible. */
    @supports (animation-timeline: view()) {
      .reveal {
        animation: reveal-rise linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 60%;
      }

      .hero__image {
        animation: hero-drift linear both;
        animation-timeline: view();
        animation-range: exit 0% exit 100%;
      }
    }
  }

  @keyframes reveal-rise {
    /* transform (not translate) so it composes with the hover lift */
    from { opacity: 0; transform: translateY(1.75rem); }
    to { opacity: 1; transform: none; }
  }

  @keyframes hero-drift {
    to { object-position: 60% 35%; }
  }
}
