.cookie-consent {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  left: 20px;
  max-width: 620px;
  padding: 24px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line, #ccc);
  background: var(--paper, #f3f0e9);
  color: var(--ink, #171a1c);
  box-shadow: 0 8px 40px #171a1c33;
  font-family: var(--body, sans-serif);
}

.cookie-consent[hidden], .cookie-consent [hidden] {
  display: none;
}

.cookie-consent h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.cookie-consent p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
}

.cookie-consent a {
  text-decoration: underline;
}

.cookie-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cookie-consent-actions button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--ink, #171a1c);
  background: var(--paper, #f3f0e9);
  color: var(--ink, #171a1c);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.cookie-consent-actions [data-consent="granted"] {
  background: var(--yellow, #f4b82f);
}

.cookie-settings {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 480px) {
  .cookie-consent {
    right: 12px;
    bottom: 12px;
    left: 12px;
    padding: 18px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
}

/* Keep forms readable without automatic input zoom on narrow phone screens. */
@media (max-width: 760px) {
  .quote-form input, .quote-form select, .quote-form textarea { font-size: 16px; }
  /* Decorative fixed grain is not needed on small screens. */
  body::before { display: none; }
}

/* Content must remain visible when animations are disabled. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .button, .service-item, .work-gallery img { transition: none; }
}

form[aria-busy="true"] .submit-button { cursor: wait; }

/* The live audit found a 20px email tap target beside the telephone link. */
.site-footer .footer-contact a, .site-footer .footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.cookie-settings { min-height: 44px; }

/* Keep the hero readable if the condensed webfont is slow or unavailable. */
@media (max-width: 760px) {
  .hero h1 { overflow-wrap: anywhere; }
}

/* Keep decorative reveals out of the way of keyboard and anchor navigation. */
.js [data-reveal]:focus-within, .js [data-reveal]:target {
  opacity: 1;
  transform: none;
  transition: none;
}

@media (max-width: 980px) {
  /* The closed mobile overlay must not expose invisible keyboard links. */
  .navigation-ready .site-nav { visibility: hidden; overflow-y: auto; }
  .navigation-ready .site-nav.is-open { visibility: visible; }
  .navigation-ready .site-nav { justify-content: flex-start; padding-bottom: 2rem; }
  .navigation-ready .site-nav a { flex-shrink: 0; }

  /* With scripting disabled, expose ordinary links instead of a dead button. */
  html:not(.navigation-ready) .site-header {
    position: relative;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--ink);
  }
  html:not(.navigation-ready) .menu-toggle { display: none; }
  html:not(.navigation-ready) .site-nav {
    position: static;
    inset: auto;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: .3rem 1rem;
    padding: 0;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    background: transparent;
  }
  html:not(.navigation-ready) .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-family: var(--body);
    font-size: .8rem;
  }
  html:not(.navigation-ready) .site-nav .nav-call { margin-top: 0; }
}

/* Fallback fonts and 320px viewports must wrap content, not widen the page. */
@media (max-width: 760px) {
  main h1, main h2, main h3 { overflow-wrap: anywhere; }
  .page-hero > *, .professional-standards > *, .published-reviews-heading > *,
  .location-card-grid > *, .content-page-grid > *, .contact-layout > *, .split-cta > *,
  .thank-you-card { min-width: 0; }
  .thank-you-card .button { width: 100%; gap: .7rem; padding-inline: 1rem; }
}

@media (max-width: 480px) {
  /* Keep complete headline words readable even before a condensed font arrives. */
  .hero h1 { font-size: clamp(2.5rem, 13.5vw, 4rem); }
  .page-hero h1, .contact-intro h1 { font-size: clamp(2.2rem, 12vw, 3.6rem); }
  .thank-you-card h1 { font-size: clamp(2rem, 10.5vw, 3rem); }
  .standards-intro h2, .published-reviews-heading h2, .split-cta h2 {
    font-size: clamp(2.2rem, 10.5vw, 3.2rem);
  }
}

/* Keep the initial header geometry stable while deferred scripts download.
   True no-JavaScript browsers retain the ordinary links above. */
@media (max-width: 980px) and (scripting: enabled) {
  html:not(.navigation-ready) .site-header { position: absolute; }
  html:not(.navigation-ready) .site-nav { display: none; }
}
