/* Lune Valley Plumbing & Heating - mobile-first styles */
:root {
  --navy: #0b3c5d;
  --navy-dark: #072a41;
  --teal: #1b7f8c;
  --teal-dark: #156672;
  --focus: #0b3c5d;
  --alert: #c8322b;
  --alert-dark: #a32620;
  --bg: #ffffff;
  --bg-alt: #f0f5f8;
  --text: #1c2b36;
  --muted: #4b5d6a;
  --radius: 12px;
  --header-h: 60px;
  --callbar-h: 68px; /* height of the fixed mobile call bar */
  /* Motion settings (see also CONFIG at the top of js/main.js) */
  --fade-distance: 20px;
  --fade-duration: 600ms;
  --header-duration: 300ms;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); scroll-padding-bottom: calc(var(--callbar-h) + env(safe-area-inset-bottom) + 8px); }
body { margin: 0; color: var(--text); background: var(--bg); line-height: 1.6; font-size: 1.0625rem; padding-bottom: calc(var(--callbar-h) + env(safe-area-inset-bottom)); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Light focus ring on dark backgrounds (navy ring on light, yellow ring on dark: both clear 3:1) */
.site-header, .demo-banner, .emergency, .section-dark, .site-footer { --focus: #ffd23f; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.narrow { max-width: 720px; }
.small { font-size: .9rem; color: var(--muted); }

.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 10px 14px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; text-decoration: none; border: 2px solid transparent; font-size: 1rem; cursor: pointer; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: #156672; }
.btn-ghost { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-alert { background: var(--alert); color: #fff; }
.btn-alert:hover { background: var(--alert-dark); }
.btn-call { background: var(--alert); color: #fff; min-height: 44px; padding: 0 14px; flex: none; white-space: nowrap; }
.btn-block { width: 100%; }

/* Demo banner: slim, scrolls away with the page */
.demo-banner { background: #0f4f59; color: #fff; font-size: .9rem; line-height: 1.4; text-align: center; padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.demo-banner p { margin: 0; }
.demo-banner a { color: #fff; font-weight: 700; text-underline-offset: 2px; }

/* Sticky header, with the call button always visible */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--navy); color: #fff; height: var(--header-h); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; line-height: 1.1; min-width: 0; }
.brand small { display: block; font-weight: 500; font-size: .72rem; opacity: .85; }

/* Menu button (shown on phones only when JavaScript is on) */
.nav-toggle { display: none; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 2px solid rgba(255,255,255,.6); border-radius: 999px; background: transparent; color: #fff; cursor: pointer; }
.nav-toggle[aria-expanded="true"] { background: #fff; color: var(--navy); }

/* Nav links: the plain, always-visible version (no JavaScript, or desktop) */
.main-nav ul { display: flex; flex-wrap: wrap; gap: 0 16px; }
.main-nav a { display: inline-block; padding: 10px 4px; min-height: 44px; color: #fff; text-decoration: none; font-weight: 600; }
.main-nav a:hover { text-decoration: underline; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--bg-alt), #fff); padding: 28px 0 32px; }
.hero-grid { display: grid; gap: 24px; }
.eyebrow { color: var(--teal-dark); font-weight: 700; font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5em; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-phone { font-size: 1.9rem; font-weight: 800; margin-bottom: .6em; }
.hero-phone a { text-decoration: none; }
.hero-actions { display: flex; flex-direction: column; gap: 12px; }
.hero-img { width: 100%; max-width: 420px; margin: 0 auto; }
/* Tight inline mark; the ::after widens the tap area to at least 24x24px without affecting the layout */
.demo-mark { position: relative; padding: 0 3px; color: inherit; text-decoration: none; font-weight: 800; }
.demo-mark::after { content: ""; position: absolute; inset: -8px -4px; }
.demo-mark:hover { text-decoration: underline; }
.hero-note { margin: 16px 0 0; }

/* Emergency strip */
.emergency { background: var(--navy-dark); color: #fff; padding: 24px 0; }
.emergency-inner { display: grid; gap: 16px; }
.emergency h2 { font-size: 1.3rem; }
.emergency p { margin: 0; opacity: .9; }

/* Sections */
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--navy); color: #fff; }
.section-dark a { color: #fff; }
.section-intro { color: var(--muted); margin-bottom: 1.5em; }
.two-col { display: grid; gap: 28px; align-items: center; }

.cards { display: grid; gap: 16px; }
.card { background: #fff; border: 1px solid #d9e3ea; border-radius: var(--radius); padding: 20px; }
.card svg { color: var(--teal); margin-bottom: 8px; }
.card p { margin: 0; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0; }
.chips li { background: var(--navy); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 600; }

.trust { display: grid; gap: 16px; }
.trust li { border-left: 4px solid var(--teal); padding: 4px 0 4px 16px; }
.trust p { margin: 0; color: var(--muted); }

.disclaimer { font-size: 1.15rem; font-weight: 700; color: var(--navy); background: #fff; border-left: 5px solid var(--teal-dark); border-radius: 8px; padding: 12px 16px; }
.reviews { display: grid; gap: 16px; }
.reviews li { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid #d9e3ea; }
.reviews figure { margin: 0; }
.reviews blockquote { margin: 0 0 .75em; }
.reviews blockquote p { margin: 0; }
.reviews figcaption { font-size: .95rem; color: var(--muted); }
.stars { color: #9a5b00; letter-spacing: 2px; margin-right: 6px; }

/* FAQ */
details { border: 1px solid #d9e3ea; border-radius: var(--radius); padding: 0 16px; margin-bottom: 10px; background: #fff; }
summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 48px; }
details p { color: var(--muted); }

/* Form */
.big-phone { font-size: 2rem; font-weight: 800; margin-bottom: .3em; }
.big-phone a { text-decoration: none; }
.section-dark .small { color: #cfe0ea; }
.form { background: #fff; color: var(--text); border-radius: var(--radius); padding: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; font: inherit; padding: 12px; border: 2px solid #9fb3c0; border-radius: 8px; min-height: 48px; background: #fff; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.form-note { margin: 10px 0 0; text-align: center; color: var(--muted) !important; }
.hp { position: absolute; left: -9999px; }
.form-success { margin: 0; font-weight: 700; color: var(--navy); }
.form-success:not(:empty) { margin: 14px 0 0; padding: 14px 16px; background: #e3f3f1; border: 2px solid var(--teal-dark); border-radius: 8px; }
/* Without JavaScript the demo form cannot send anything, so hide its button (a note explains why) */
html:not(.js) .form[data-demo-form] button[type="submit"] { display: none; }

/* Footer */
.site-footer { background: var(--navy-dark); color: #dbe7ee; padding: 32px 0; }
.site-footer a { color: #fff; }
.built-by { margin: 0 0 1em; }
.demo-line { font-weight: 700; color: #fff; border-top: 1px solid rgba(255,255,255,.25); padding-top: 14px; margin: 0; }

/* Mobile bottom call bar */
.call-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgba(255,255,255,.96); box-shadow: 0 -2px 10px rgba(0,0,0,.15); z-index: 40; }
.call-bar .btn { width: 100%; }

/* Tablet and up */
@media (min-width: 720px) {
  h1 { font-size: 2.8rem; }
  h2 { font-size: 2rem; }
  .hero { padding: 56px 0; }
  .hero-grid { grid-template-columns: 1.2fr 1fr; align-items: center; }
  .hero-actions { flex-direction: row; }
  .emergency-inner { grid-template-columns: 1fr auto; align-items: center; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .trust { grid-template-columns: repeat(2, 1fr); }
  .reviews { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; }
  .footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
  .demo-line { flex-basis: 100%; }
}

@media (min-width: 960px) {
  body { padding-bottom: 0; }
  /* Desktop: the call bar becomes a small pill, shown only while the header is hidden */
  .call-bar { left: auto; right: 16px; bottom: 16px; padding: 0; background: none; box-shadow: none; opacity: 0; visibility: hidden; transition: opacity var(--header-duration) ease, visibility 0s linear var(--header-duration); }
  .header-hidden .call-bar { opacity: 1; visibility: visible; transition-delay: 0s; }
  .call-bar .btn { width: auto; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
  html { scroll-padding-bottom: 0; }
  .header-inner { gap: 24px; }
  .main-nav { order: 1; }
  .main-nav ul { gap: 0 22px; }
  .btn-call { order: 2; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

/* Very narrow phones: slightly smaller logo text so logo, call button and menu button all fit */
@media (max-width: 400px) {
  .brand { gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .brand span { font-size: .95rem; }
  .brand small { font-size: .68rem; }
  .btn-call { padding: 0 12px; gap: 6px; }
}

/* Phones and small tablets: menu button and dropdown nav */
@media (max-width: 959.98px) {
  .btn-call { margin-left: auto; }
  .js .nav-toggle { display: inline-flex; }
  .js .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--navy); border-top: 1px solid rgba(255,255,255,.18); box-shadow: 0 10px 18px rgba(0,0,0,.25); }
  .js .main-nav.is-open { display: block; }
  .js .main-nav ul { display: block; }
  .js .main-nav a { display: block; padding: 14px max(16px, env(safe-area-inset-left)); min-height: 48px; border-bottom: 1px solid rgba(255,255,255,.12); }
  /* No JavaScript: nav links sit in a row under the logo and call button, and the header scrolls normally */
  html:not(.js) .site-header { position: static; height: auto; }
  html:not(.js) .header-inner { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  html:not(.js) .main-nav { order: 3; flex-basis: 100%; }
  /* A focused form field hides the fixed call bar so it can't sit over the field when the keyboard is open */
  .field-focus .call-bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Motion effects. Everything that hides or moves content lives inside this
   media query, and the .js class is set by main.js, so with reduced motion or
   without JavaScript all content is simply visible. */
@media (prefers-reduced-motion: no-preference) {
  /* Header slides up out of view (the shadow goes too so it doesn't peek out) */
  .site-header { transition: transform var(--header-duration) ease, box-shadow var(--header-duration) ease; }
  .header-hidden .site-header { transform: translateY(calc(-100% - 12px)); box-shadow: none; }

  /* Section content fades and slides up */
  .js .fade-item { opacity: 0; transform: translateY(var(--fade-distance)); transition: opacity var(--fade-duration) ease, transform var(--fade-duration) ease; }
  .js .fade-section.is-visible .fade-item { opacity: 1; transform: none; }

  /* Typewriter: untyped text keeps its space but is invisible; cursor takes no space */
  .tw-pending .hero h1 { visibility: hidden; } /* released by main.js, or by a safety timer in init.js */
  .tw-rest { visibility: hidden; }
  .tw-typed::after { content: ""; position: absolute; margin-left: 2px; width: 0; height: .85em; border-left: .06em solid currentColor; animation: tw-blink 1s steps(1) infinite; }
  .tw-typed.tw-done::after { animation: tw-fade 600ms ease 800ms forwards; }
  @keyframes tw-blink { 50% { opacity: 0; } }
  @keyframes tw-fade { from { opacity: 1; } to { opacity: 0; } }
}
