/*
Theme Name: KP Landscaping
Theme URI: https://kplandscaping.us
Author: KP Landscaping
Description: Custom theme for KP Landscaping — landscaping, hardscaping, tree work, decks and fences across Buffalo, Rochester and Batavia, NY.
Version: 2.0.0
Requires PHP: 8.1
Text Domain: kp-landscaping
*/

/* ============================================================
   KP Landscaping v2 — dark editorial design system
   Canvas #0e100f · cream #fffce1 · 5-category accent taxonomy
   Landscaping = green · Hardscaping = orange · Tree = lilac
   Snow = blue · Decks/Fences/Porches = pink
   Legacy token names are preserved and remapped so existing
   inline styles across templates resolve to the new palette.
   ============================================================ */

:root {
  /* — core surfaces & text — */
  --color-bg: #0e100f;
  --color-surface: #191919;
  --color-text: #fffce1;
  --color-muted: #7c7c6f;
  --color-hairline: #42433d;
  --color-accent: #0ae448;
  --color-accent-2: #abff84;
  --color-divider: #42433d;

  /* — category taxonomy — */
  --cat-landscaping: #abff84;
  --cat-hardscaping: #ff8709;
  --cat-tree: #9d95ff;
  --cat-snow: #00bae2;
  --cat-fdp: #fec5fb;
  --gradient-green: linear-gradient(114.41deg, #0ae448 20.74%, #abff84 65.5%);

  /* — legacy neutral ramp, remapped dark→light — */
  --color-neutral-100: #191919;
  --color-neutral-200: #202220;
  --color-neutral-300: #2b2e2b;
  --color-neutral-400: #42433d;
  --color-neutral-500: #5a5b52;
  --color-neutral-600: #7c7c6f;
  --color-neutral-700: #a3a294;
  --color-neutral-800: #d8d5bd;
  --color-neutral-900: #fffce1;

  /* — legacy accent ramp → green family — */
  --color-accent-100: #0f2b18;
  --color-accent-200: #124024;
  --color-accent-300: #136b33;
  --color-accent-400: #0dbb43;
  --color-accent-500: #0ae448;
  --color-accent-600: #3bef6d;
  --color-accent-700: #abff84;
  --color-accent-800: #cdffb2;
  --color-accent-900: #e9ffdc;

  /* — legacy accent-2 ramp → muted green-gray washes — */
  --color-accent-2-100: #161b16;
  --color-accent-2-200: #1d241d;
  --color-accent-2-300: #293229;
  --color-accent-2-400: #3a463a;
  --color-accent-2-500: #57644f;
  --color-accent-2-600: #7c8a6d;
  --color-accent-2-700: #a9b895;
  --color-accent-2-800: #d3e3bd;
  --color-accent-2-900: #131713;

  --font-heading: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --font-heading-weight: 600;
  --font-body: "Inter Tight", ui-sans-serif, system-ui, sans-serif;

  /* — type scale — */
  --text-caption: 14px;
  --text-body-sm: 16px;
  --text-body: 19px;
  --text-body-lg: 23px;
  --text-subheading: clamp(26px, 3vw, 34px);
  --text-heading-sm: clamp(32px, 4vw, 44px);
  --text-heading: clamp(40px, 5.5vw, 66px);
  --text-heading-lg: clamp(48px, 7.5vw, 101px);
  --text-display: clamp(56px, 11vw, 160px);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 14px;
  --space-4: 18px;
  --space-6: 26px;
  --space-8: 36px;

  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;

  /* depth comes from surface steps, never box-shadow */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  /* Stop the page's rubber-band overscroll from chaining into a visible
     bounce behind the sticky/fixed header and mobile nav panel on
     touch devices — that bounce is what reads as the page "floating". */
  overscroll-behavior-y: none;
}
body {
  margin: 0; text-wrap: pretty; overflow-x: clip;
  overscroll-behavior-y: none;
  background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: var(--text-body-sm);
  line-height: 1.4; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-text); text-underline-offset: 3px; transition: color .2s ease, opacity .2s ease; }
a:hover { color: var(--color-accent-2); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@keyframes kp-float { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-18px) rotate(2deg); } }
@keyframes kp-float2 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(14px); } }
@keyframes kp-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes kp-pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-accent) 45%, transparent); } 70% { box-shadow: 0 0 0 12px transparent; } }
@keyframes kp-emergency-text-blink { 0%,55% { color: var(--color-text); } 80% { color: #ff6b5b; } 100% { color: var(--color-text); } }
@keyframes kp-emergency-dot-blink { 0%,55% { background: var(--color-accent); box-shadow: 0 0 0 0 transparent; } 80% { background: #ff5b4d; box-shadow: 0 0 0 4px color-mix(in srgb, #ff5b4d 35%, transparent); } 100% { background: var(--color-accent); box-shadow: 0 0 0 0 transparent; } }
@keyframes kp-emergency-border-glow {
  0%, 100% { border-color: rgba(255,91,77,.35); box-shadow: 0 0 0 1px rgba(255,91,77,.25), 0 0 26px 2px rgba(255,91,77,.1); }
  50% { border-color: rgba(255,91,77,.85); box-shadow: 0 0 0 1px rgba(255,91,77,.6), 0 0 50px 12px rgba(255,91,77,.3); }
}

/* — continuous red urgency glow, same idea as the emergency-bar dot/text
   blink up top: this isn't a scroll-in effect, it pulses forever to keep
   reading as "urgent" for as long as the section is on screen. — */
.kp-emergency-glow { animation: kp-emergency-border-glow 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .kp-emergency-glow { animation: none; border-color: rgba(255,91,77,.6); } }

.kp-emergency-bar { background: var(--color-surface); border-bottom: 1px solid var(--color-hairline); }
.kp-emergency-link { animation: kp-emergency-text-blink 2.4s ease-in-out infinite; }
.kp-emergency-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; animation: kp-emergency-dot-blink 2.4s ease-in-out infinite; }

.kp-social-widget {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  display: flex; align-items: center; gap: 10px;
  background: var(--color-surface); border: 1px solid var(--color-hairline);
  border-radius: 9999px; padding: 8px 16px 8px 8px;
  opacity: 0; transform: translateY(16px) scale(.94);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.kp-social-widget--visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.kp-social-widget--dismissed { opacity: 0 !important; transform: translateY(10px) scale(.96) !important; pointer-events: none; }
.kp-social-msg { font-size: 12.5px; font-weight: 600; line-height: 1.25; color: var(--color-text); max-width: 168px; }
.kp-social-icons { display: flex; gap: 6px; flex: none; }
.kp-social-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: transparent; border: 1px solid var(--color-text); color: var(--color-text); flex: none; transition: transform .2s ease, border-color .2s ease, color .2s ease; }
.kp-social-icon:hover, .kp-social-icon:focus-visible { border-color: var(--color-accent-2); color: var(--color-accent-2); transform: translateY(-2px) scale(1.06); }
.kp-social-close {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-hairline); color: var(--color-text); border: 2px solid var(--color-bg);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
  opacity: .8; transition: opacity .2s ease, transform .2s ease;
}
.kp-social-close:hover { opacity: 1; transform: scale(1.12); }
@media (max-width: 560px) {
  .kp-social-widget { right: 12px; bottom: 12px; padding: 7px 12px 7px 7px; }
  .kp-social-msg { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .kp-emergency-link, .kp-emergency-dot { animation: none; }
  .kp-emergency-link { color: var(--color-text); }
  .kp-emergency-dot { background: var(--color-accent); }
}

.washed { filter: saturate(0.75) contrast(0.92) brightness(0.96); }

*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.1; letter-spacing: -0.011em; margin: 0 0 var(--space-2);
  color: var(--color-text);
}
h1 { font-size: var(--text-heading); line-height: 1.05; }
h2 { font-size: var(--text-heading-sm); line-height: 1.1; }
h3 { font-size: var(--text-subheading); line-height: 1.2; }
h4 { font-size: 21px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
p { margin: 0 0 var(--space-3); }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption { font-size: 12px; margin-top: var(--space-1); color: var(--color-muted); }
.text-muted { color: var(--color-muted); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 35%, transparent); }

.hr { height: 1px; border: 0; margin: var(--space-4) 0; background: var(--color-hairline); }

/* — display & heading utilities — */
.kp-display {
  font-size: var(--text-display); font-weight: 600; line-height: 0.92;
  letter-spacing: -0.02em; margin: 0; color: var(--color-text);
}
.kp-heading-lg { font-size: var(--text-heading-lg); font-weight: 600; line-height: 1; letter-spacing: -0.011em; }
.kp-body-lg { font-size: var(--text-body-lg); line-height: 1.38; letter-spacing: -0.01em; }

/* — eyebrow: thin accent rule + tracked-out label, editorial and premium — */
.kp-eyebrow {
  display: inline-flex; align-items: center; gap: 12px; margin-bottom: 18px;
  font-family: var(--font-body); font-weight: 500; font-size: 12.5px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-text);
}
.kp-eyebrow::before, .kp-eyebrow::after { content: none; }
.kp-eyebrow .rule { display: inline-block; width: 30px; height: 1px; background: var(--color-accent-2); flex: none; }

/* — category taxonomy labels — */
.kp-cat { font-family: var(--font-body); font-weight: 400; font-size: 19px; line-height: 1.15; }
.kp-cat-landscaping { color: var(--cat-landscaping); }
.kp-cat-hardscaping { color: var(--cat-hardscaping); }
.kp-cat-tree { color: var(--cat-tree); }
.kp-cat-snow { color: var(--cat-snow); }
.kp-cat-fdp { color: var(--cat-fdp); }
.kp-cat-seasonal { color: var(--color-accent); }

/* — hairline section divider — */
.kp-hairline { height: 1px; background: var(--color-hairline); border: 0; margin: 0; }

/* — buttons: outlined ghost pills only — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-body); font-weight: 600;
  font-size: 16px; line-height: 1.05; color: var(--color-text);
  background: transparent; border: 1px solid var(--color-text);
  padding: 13px 22px;
  border-radius: 100px;
  transition: border-color .25s ease, color .25s ease, opacity .25s ease, transform .2s cubic-bezier(.22,.61,.36,1);
}
.btn:hover { color: var(--color-text); border-color: var(--color-text); opacity: .8; }
.btn:active { transform: scale(.97); }
/* primary = the single gradient-stroked pill */
.btn-primary {
  border: 1.5px solid transparent; color: var(--color-text);
  background: linear-gradient(var(--color-bg), var(--color-bg)) padding-box, var(--gradient-green) border-box;
}
.btn-primary:hover { opacity: .85; color: var(--color-text); transform: translateY(-1px); box-shadow: none; }
.btn-primary:active { transform: scale(.97); box-shadow: none; }
.btn-secondary { border-color: var(--color-text); color: var(--color-text); }
.btn-secondary:hover { background: transparent; color: var(--color-text); opacity: .8; transform: none; }
.btn-secondary:active { transform: scale(.97); }
.btn-ghost { border-color: transparent; color: var(--color-accent-2); padding-inline: var(--space-1); }
.btn-ghost:hover { background: transparent; color: var(--color-accent); opacity: 1; }
.btn-ghost:active { transform: scale(.97); }

/* — cards: near-black panels, 8px radius, no borders, no shadows — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: 24px; border-radius: 8px; background: var(--color-surface);
  color: var(--color-text);
}
.card-kicker { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent-2); }
.card-title { font-family: var(--font-heading); font-weight: 600; font-size: 20px; line-height: 1.2; color: var(--color-text); }
.card-body { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--color-muted); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-muted); }
.elev-sm, .elev-md, .elev-lg { box-shadow: none; }

a.card {
  text-decoration: none;
  transition: transform .4s cubic-bezier(.22,.61,.36,1), background .3s ease, box-shadow .4s ease;
  will-change: transform;
}
a.card:hover, a.card:focus-visible {
  transform: translateY(-6px);
  background: var(--color-neutral-200);
  box-shadow: 0 20px 44px -16px color-mix(in srgb, var(--color-accent) 30%, transparent), 0 6px 18px rgba(0,0,0,.35);
}
a.card:active { transform: translateY(-3px); }
a.card img, a[class*="card"] img { transition: transform .7s cubic-bezier(.22,.61,.36,1); }
a.card:hover img, a[class*="card"]:hover img { transform: scale(1.05); }

/* — tags: small 8px-radius chips, colored text on dark — */
.tag {
  display: inline-flex; align-items: center; font-size: 12.5px; letter-spacing: -0.01em; padding: 4px 12px; border-radius: 8px;
  transition: transform .25s cubic-bezier(.22,.61,.36,1), border-color .25s ease, color .25s ease;
}
a.tag { text-decoration: none; }
a.tag:hover { transform: translateY(-2px); }
a.tag:active { transform: translateY(0); }
.tag-accent { background: var(--color-surface); color: var(--color-accent-2); border: 1px solid var(--color-hairline); }
.tag-accent-2 { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-hairline); }
.tag-neutral { background: var(--color-surface); color: var(--color-muted); border: 1px solid var(--color-hairline); }
.tag-outline { border: 1px solid var(--color-accent-2); color: var(--color-accent-2); background: transparent; }

/* — details/FAQ — */
details.kp-faq { border-bottom: 1px solid var(--color-hairline); padding: 18px 0; }
details.kp-faq summary { cursor: pointer; font-family: var(--font-heading); font-weight: 600; font-size: 18px; color: var(--color-text); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; transition: color .2s ease; }
details.kp-faq summary::-webkit-details-marker { display: none; }
details.kp-faq summary:hover { color: var(--color-accent-2); }
details.kp-faq summary::after { content: '+'; font-size: 22px; font-weight: 400; color: var(--color-accent); flex: none; transition: transform .25s cubic-bezier(.22,.61,.36,1); }
details.kp-faq[open] summary::after { transform: rotate(45deg); }
details.kp-faq p { animation: kp-faq-in .3s cubic-bezier(.22,.61,.36,1); }
@keyframes kp-faq-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
details.kp-faq p { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: var(--color-muted); }

/* — table — */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; color: var(--color-text); }
.table td { padding: 10px 0; border-bottom: 1px solid var(--color-hairline); vertical-align: top; }
.table td:first-child { color: var(--color-muted); white-space: nowrap; padding-right: 14px; }

/* — layout helpers — */
.kp-container { max-width: 1280px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px); }
.kp-container-narrow { max-width: 1280px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px); }
.kp-breadcrumb { font-size: 13px; padding: 22px 0 0; color: var(--color-muted); }
.kp-breadcrumb a { color: inherit; text-decoration: none; }
.kp-breadcrumb a:hover { color: var(--color-text); }

.kp-cta-band { padding: 96px 0 0; }
.kp-cta-band .inner { background: var(--color-surface); border: 1px solid var(--color-hairline); border-radius: 8px; padding: clamp(28px,4vw,48px) clamp(28px,4vw,56px); display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.kp-cta-band h2 { font-size: clamp(26px,3vw,40px); margin: 0; line-height: 1.12; letter-spacing: -0.011em; }
.kp-cta-band p { margin: 12px 0 0; font-size: 16px; line-height: 1.5; color: var(--color-muted); max-width: 52ch; }

/* photos live in contained 8px frames on the dark canvas */
.kp-blob-figure { margin: 0; border-radius: 8px; overflow: hidden; background: var(--color-surface); }
.kp-blob-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* — nav mega-menu — */
.kp-nav-item { position: relative; } .kp-nav-item::before { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: min(760px, 90vw); height: 14px; z-index: 99; }
.kp-nav-trigger {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: none; border: 0; color: var(--color-text); text-decoration: none;
  font-family: var(--font-body); font-weight: 400; font-size: 16px; padding: 10px 0;
  transition: color .2s ease;
}
.kp-nav-trigger:hover { color: var(--color-accent-2); }
.kp-nav-trigger .caret { font-size: 10px; transition: transform .15s ease; display: inline-block; }
.kp-nav-item.kp-open .kp-nav-trigger .caret { transform: rotate(180deg); }
.kp-mega {
  position: absolute; top: calc(100% + 14px); left: 50%;
  background: var(--color-surface); border: 1px solid var(--color-hairline);
  border-radius: 8px; padding: 28px; z-index: 100;
  width: max-content; max-width: min(760px, 90vw);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity .25s cubic-bezier(.22,.61,.36,1), transform .25s cubic-bezier(.22,.61,.36,1), visibility .25s;
}
.kp-nav-item.kp-open .kp-mega,
.kp-nav-item:hover .kp-mega { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.kp-mega-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 28px; }
.kp-mega-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.kp-mega-heading {
  font-size: 14px; letter-spacing: 0; text-transform: none; font-weight: 400;
  margin-bottom: 4px; color: var(--color-accent-2);
}
.kp-mega-heading.kp-cat-landscaping { color: var(--cat-landscaping); }
.kp-mega-heading.kp-cat-hardscaping { color: var(--cat-hardscaping); }
.kp-mega-heading.kp-cat-tree { color: var(--cat-tree); }
.kp-mega-heading.kp-cat-snow { color: var(--cat-snow); }
.kp-mega-heading.kp-cat-fdp { color: var(--cat-fdp); }
.kp-mega-heading.kp-cat-seasonal { color: var(--color-accent); }
.kp-mega-col a {
  color: var(--color-text); text-decoration: none; font-size: 14.5px; display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .2s ease, transform .2s ease;
}
.kp-mega-col a:hover { color: var(--color-accent-2); transform: translateX(3px); }
.kp-mega-col a::before { content: '›'; color: var(--color-muted); flex: none; }
.kp-mega-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-hairline); }
.kp-mega-footer a { color: var(--color-accent-2); text-decoration: none; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 4px; transition: gap .2s ease; }
.kp-mega-footer a:hover { gap: 8px; text-decoration: underline; }
@media (max-width: 900px) {
  /* No hover on touch: only the click-toggled .kp-open state shows the panel. */
  .kp-mega {
    position: static; transform: none; width: auto; max-width: none; margin-top: 10px;
    display: none; opacity: 1; visibility: visible; pointer-events: auto;
  }
  .kp-nav-item.kp-open .kp-mega { display: block; }
  .kp-mega-grid { grid-template-columns: 1fr; }
}

/* — nav logo: bumped up from 60px for more presence; header height is
   re-measured into --kp-header-h on load/resize (see header.php script),
   so the hero offset and the mobile dropdown's top/max-height adapt
   automatically, no manual sync needed. Mobile gets a smaller bump than
   desktop to keep clear of the 42px hamburger button next to it. — */
.kp-site-logo { height: 80px; transition: height .25s ease; }
@media (max-width: 900px) {
  .kp-site-logo { height: 66px; }
}

/* — mobile hamburger + collapsible primary nav — */
.kp-mobile-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 42px; height: 42px; flex: none;
  background: transparent; border: 1px solid var(--color-hairline); border-radius: 8px;
  cursor: pointer; padding: 0;
}
.kp-mobile-toggle span {
  display: block; width: 18px; height: 1.5px; background: var(--color-text);
  transition: transform .25s cubic-bezier(.22,.61,.36,1), opacity .2s ease;
}
.kp-mobile-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.kp-mobile-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.kp-mobile-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 900px) {
  .kp-mobile-toggle { display: flex; }
  .kp-primary-nav {
    display: none !important;
    position: fixed; top: var(--kp-header-h, 120px); left: 0; right: 0; z-index: 59;
    max-height: calc(100svh - var(--kp-header-h, 120px));
    overflow-y: auto; overflow-x: hidden;
    /* flex-direction:column + the base row's inline flex-wrap:wrap is a classic
       trap: in column mode, wrapping starts a new COLUMN (side-by-side) once
       content exceeds the container height, instead of scrolling. That's what
       was shoving "Service Areas / About / Gallery / Blog / CTA" into a second
       column off to the right the moment the Services mega-panel expanded
       past one screen height. Force nowrap so it only ever grows taller,
       scrollable via overflow-y above. */
    flex-direction: column !important; flex-wrap: nowrap !important;
    align-items: stretch !important; gap: 0 !important;
    /* Solid, not translucent: this is a full slide-down menu, not a thin bar
       over the hero, so it doesn't need to read the video through it — and a
       solid fill sidesteps any backdrop-filter support gaps entirely. */
    background: #0b0c0b;
    border-bottom: 1px solid var(--color-hairline);
    padding: 8px clamp(20px,5vw,64px) 24px;
  }
  .kp-primary-nav.kp-nav-open { display: flex !important; }
  .kp-primary-nav > a {
    width: 100%; padding: 14px 2px !important; border-bottom: 1px solid var(--color-hairline);
  }
  .kp-primary-nav .kp-nav-item { width: 100%; }
  .kp-primary-nav .kp-nav-trigger {
    width: 100%; justify-content: space-between; padding: 14px 2px !important;
    border-bottom: 1px solid var(--color-hairline);
  }
  .kp-primary-nav .btn-primary { margin-top: 16px; width: 100%; justify-content: center; }

  /* The desktop open-state rule below applies `transform: translate(-50%, 0)`
     unconditionally (same selector, higher specificity than the plain
     `.kp-mega` reset above), which on a statically-positioned mobile block
     shoves it half its own width off-screen. Cancel it here, and flatten the
     dropdown into the nav flow instead of floating it as a nested card. */
  .kp-nav-item.kp-open .kp-mega { transform: none !important; }
  .kp-mega {
    background: transparent; border: 0; border-radius: 0;
    padding: 4px 0 18px; width: 100%; max-width: none;
  }
  .kp-mega-grid { gap: 20px; }
  .kp-mega-col { gap: 10px; }
  .kp-mega-col a { white-space: normal; overflow: visible; text-overflow: clip; padding: 4px 0; }
  .kp-mega-footer { margin-top: 4px; padding-top: 14px; }
}

@media (max-width: 640px) {
  h1 { font-size: clamp(32px, 9vw, 40px); }
  h2 { font-size: clamp(26px, 7vw, 32px); }
}

/* — gallery — */
.kp-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 220px; gap: 24px;
}
.kp-gallery-tile {
  margin: 0; border-radius: 8px; overflow: hidden; background: var(--color-surface);
}
.kp-gallery-tile-tall { grid-row: span 2; }
.kp-gallery-tile img { transition: transform .7s cubic-bezier(.22,.61,.36,1); }
.kp-gallery-tile:hover img { transform: scale(1.07); }

/* — footer grid: 4 columns desktop, collapses on smaller screens.
   The grid previously had its column tracks hardcoded inline with no
   breakpoint at all, forcing a ~575px-wide grid inside a ~390px mobile
   viewport (min-content sizing refuses to shrink columns below their
   longest word), which is what actually caused the page-wide horizontal
   overflow / "floating on swipe" symptom sitewide, since footer.php
   renders on every page. — */
.kp-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; }
@media (max-width: 780px) {
  .kp-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .kp-footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .kp-footer-grid { grid-template-columns: 1fr; }
}

/* — fixed-ratio content+sidebar grids: same overflow trap as the footer
   grid (min-content sizing on a hardcoded fr/px track refuses to shrink
   below the sidebar's/TOC's longest word, forcing the page wider than the
   viewport). Every OTHER grid in this theme uses repeat(auto-fit,minmax())
   which is intrinsically responsive and needs no override; these three
   hardcoded patterns are the only exceptions, across service.php,
   location-service.php, sub-service-fdp.php, service-fdp.php (the shared
   "At a glance" / "Typical investment" sidebar), contact.php, and
   legal.php. — */
@media (max-width: 860px) {
  .kp-service-grid, .kp-contact-grid, .kp-legal-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .kp-spec-aside { position: static !important; top: auto !important; }
}

/* — kp_hero_split()'s decorative corner blob sits at right:-160px inside a
   section with overflow:visible (intentional bleed on wide screens). Below
   860px that bleed extends past the viewport edge and lets the whole page
   scroll/swipe sideways even though the blob itself is invisible. Used on
   every service, sub-service, location-service and town page hero. — */
@media (max-width: 860px) {
  .kp-hero-split { overflow-x: hidden !important; }
}

/* — rounded frame overrides — */
.card, .kp-dialog { border-radius: 8px; }

/* ============================================================
   Cinematic video hero (home page)
   ============================================================ */
.font-garamond { font-family: "EB Garamond", "Garamond", "Times New Roman", serif; }

.kp-cinema-hero {
  position: relative;
  min-height: min(88svh, 900px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
  /* pull the section up behind the glass header so the video bleeds to the
     very top of the viewport instead of starting below an opaque bar */
  margin-top: calc(-1 * var(--kp-header-h, 120px));
  padding: calc(var(--kp-header-h, 120px) + clamp(48px, 8vh, 96px)) clamp(20px, 5vw, 64px) clamp(48px, 8vh, 96px);
}
.kp-cinema-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; z-index: 0;
}
.kp-cinema-overlay {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(1,1,1,0.18) 0%, rgba(1,1,1,0.55) 100%),
    linear-gradient(180deg, rgba(1,1,1,0.62) 0%, rgba(1,1,1,0.38) 45%, var(--color-bg) 99%);
}
.kp-cinema-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.kp-cinema-title {
  font-family: "EB Garamond", "Garamond", "Times New Roman", serif;
  font-weight: 400; color: #fff;
  font-size: clamp(40px, 8.4vw, 118px);
  line-height: 1.08; letter-spacing: -0.01em;
  margin: 0 0 clamp(20px, 3vh, 32px);
}
.kp-w { display: inline-block; white-space: pre; }
.kp-cinema-sub {
  color: rgba(255, 252, 225, 0.72); font-weight: 300;
  font-size: clamp(15px, 1.6vw, 19px); line-height: 1.65;
  max-width: 52ch; margin: 0 0 clamp(28px, 4vh, 40px);
}
.kp-cinema-ctas { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.kp-cinema-stats {
  display: flex; gap: 28px; flex-wrap: wrap; align-items: center; justify-content: center;
  margin-top: clamp(32px, 5vh, 48px);
}
.kp-cinema-stats .sep { width: 1px; height: 34px; background: rgba(255, 252, 225, 0.25); }

/* per-character staggered fade (JS splits text; no-JS keeps text visible) */
.kp-split-ready .kp-c { opacity: 0; transform: translateY(0.12em); display: inline-block; }
.kp-split-in .kp-c {
  opacity: 1; transform: translateY(0);
  transition: opacity .5s ease, transform .5s ease;
  transition-delay: calc(var(--ci) * 0.07s + var(--base, 0s));
}

/* entrance fades for subtitle / CTA / stats */
.kp-fade-up { opacity: 0; transform: translateY(20px); }
.kp-fade-up.kp-in { opacity: 1; transform: translateY(0); transition: opacity .8s ease, transform .8s ease; transition-delay: var(--d, 0s); }

@media (prefers-reduced-motion: reduce) {
  .kp-split-ready .kp-c, .kp-fade-up { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* liquid glass control (spec) */
.liquid-glass {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 13px; font-weight: 500;
  padding: 15px 28px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; cursor: pointer;
  transition: background .3s ease, box-shadow .3s ease, transform .15s ease;
}
@media (min-width: 640px) { .liquid-glass { padding: 16px 40px; letter-spacing: 0.2em; } }
.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%,
    rgba(255,255,255,0.15) 80%, rgba(255,255,255,0.45) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.liquid-glass:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15);
  color: #fff;
}
.liquid-glass:active { transform: scale(0.98); }
