/* =========================================================================
   Musa's Plumbing and General Construction — shared stylesheet
   Design language: deep navy + copper. Manrope (headings) / Public Sans (body).
   Dual theme via [data-theme] on <html>. See research/design-language.md.
   ========================================================================= */

/* ---- Colour tokens -------------------------------------------------------
   Two roles kept separate on purpose (steering §"don't give one var two jobs"):
   - --on-brand / --accent-on-dark: text/accent on ALWAYS-DARK surfaces
     (header, hero, footer, drawer, call bar, map/CTA bands). FIXED in both themes.
   - --surface: card/panel fill that legitimately flips dark in dark mode.
   ------------------------------------------------------------------------- */
:root {
  --ground: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EDF1F5;
  --ink: #14202E;
  --muted: #4B5968;
  --brand: #12365F;          /* navy fill for bands */
  --brand-text: #12365F;     /* navy small text on light */
  --copper: #A8501F;         /* CTA fill */
  --copper-text: #8F4217;    /* copper small text on light */
  --on-brand: #FFFFFF;       /* FIXED: text on always-dark surfaces */
  --accent-on-dark: #F0A56E; /* FIXED: copper accent on always-dark surfaces */
  --band: #0B2038;           /* always-dark header/footer/hero/CTA band */
  --border: #D5DCE4;
  --shadow: 0 2px 8px rgba(18, 32, 46, .08), 0 8px 24px rgba(18, 32, 46, .06);

  --font-head: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Public Sans', system-ui, sans-serif;

  --maxw: 1120px;
  --radius: 12px;
}

[data-theme="dark"] {
  --ground: #0C1118;
  --surface: #26313E;        /* computed ≈1.42:1 vs ground — measured ok */
  --surface-2: #1C2630;
  --ink: #EAEFF4;
  --muted: #A8B5C2;
  --brand: #2B5C94;
  --brand-text: #8DB8EA;
  --copper: #A8501F;
  --copper-text: #F0A56E;
  /* --on-brand, --accent-on-dark, --band stay fixed (set once below) */
  --border: #3A4857;
  --shadow: 0 2px 8px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
}
/* Fixed tokens — never remapped by theme */
:root, [data-theme="dark"] {
  --on-brand: #FFFFFF;
  --accent-on-dark: #F0A56E;
}
[data-theme="dark"] { --band: #060A10; }

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--ground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
/* No overflow-x:hidden anywhere (banned) — layout must not need it. */

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-weight: 800; font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.01em; }
h2 { font-weight: 700; font-size: clamp(1.4rem, 3.5vw, 2rem); }
h3 { font-weight: 700; font-size: 1.15rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; display: block; }

a:not([class]) { color: var(--brand-text); text-underline-offset: 2px; }
a:not([class]):hover { color: var(--copper-text); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-sm { padding: clamp(1.75rem, 4vw, 2.75rem) 0; }
.eyebrow {
  font-family: var(--font-head); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; font-size: .8rem; color: var(--copper-text); margin: 0 0 .5rem;
}
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.center { text-align: center; }
.center .lead { margin-left: auto; margin-right: auto; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  padding: .75rem 1.3rem; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: filter .15s, background .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--copper); color: #FFFFFF; border-color: var(--copper); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--brand); color: #FFFFFF; border-color: var(--brand); }
.btn-secondary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--brand-text); border-color: currentColor; }
.btn-ghost:hover { background: rgba(18, 54, 95, .08); }
.btn svg { width: 1.1em; height: 1.1em; flex: 0 0 auto; }

/* Ghost buttons on ALWAYS-DARK surfaces: fixed light tokens in BOTH themes.
   Explicit rule per surface (guard §8). */
.site-header .btn-ghost,
.hero .btn-ghost,
.band-dark .btn-ghost,
.site-footer .btn-ghost,
.drawer .btn-ghost,
.call-bar .btn-ghost {
  color: var(--on-brand);
  border-color: var(--on-brand);
}
.site-header .btn-ghost:hover,
.hero .btn-ghost:hover,
.band-dark .btn-ghost:hover,
.site-footer .btn-ghost:hover,
.drawer .btn-ghost:hover,
.call-bar .btn-ghost:hover { background: rgba(255, 255, 255, .12); }

/* ---- Chips --------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; font-family: var(--font-head);
  letter-spacing: .04em; text-transform: uppercase;
  padding: .18rem .55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
  white-space: normal;               /* allow wrap (guard §2) */
}
/* Chip on always-dark surfaces */
.band-dark .chip, .map-band .chip {
  background: rgba(255, 255, 255, .12); color: var(--on-brand);
  border-color: rgba(255, 255, 255, .28);
}

/* ---- Icon wrappers (always display:flex — guard §6) ---------------------- */
.icon {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: 10px;
  background: var(--surface-2); color: var(--brand-text);
}
.icon svg { width: 26px; height: 26px; }
.band-dark .icon, .map-band .icon {
  background: rgba(255, 255, 255, .1); color: var(--accent-on-dark);
}

/* ---- Header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--band); color: var(--on-brand);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 64px; padding: .5rem 20px;
  max-width: var(--maxw); margin: 0 auto;
}
.wordmark {
  display: flex; flex-direction: column; justify-content: center;
  text-decoration: none; color: var(--on-brand);
  flex: 0 1 auto; min-width: 0;        /* allow shrink (guard §2) */
  line-height: 1.05;
}
.wordmark .wm-name {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(1rem, 2.4vw, 1.2rem); letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wordmark .wm-sub {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-on-dark); white-space: nowrap;
}

.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.main-nav a:not([class]) {
  display: block; padding: .5rem .75rem; border-radius: 8px;
  color: var(--on-brand); text-decoration: none; font-weight: 600;
  white-space: nowrap;                 /* no mid-phrase wrap (guard §2) */
}
.main-nav a:not([class]):hover { background: rgba(255, 255, 255, .1); color: var(--on-brand); }
.main-nav a:not([class])[aria-current="page"] { color: var(--accent-on-dark); }

.header-actions { display: flex; align-items: center; gap: .5rem; }

/* Theme toggle */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 auto;
  background: transparent; color: var(--on-brand);
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px; cursor: pointer;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .12); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hamburger */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 auto;
  background: transparent; color: var(--on-brand);
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px; cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* ---- Off-canvas drawer --------------------------------------------------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6, 10, 16, .55); opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 61;
  width: min(84vw, 320px); height: 100%;
  background: var(--band); color: var(--on-brand);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 1rem;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .3);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.drawer-head .wm-name { font-family: var(--font-head); font-weight: 800; color: var(--on-brand); }
.drawer-close {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: transparent; color: var(--on-brand);
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px; cursor: pointer;
}
.drawer-close svg { width: 20px; height: 20px; }
.drawer nav ul { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.drawer nav a:not([class]) {
  display: block; padding: .8rem .5rem; color: var(--on-brand); text-decoration: none;
  font-family: var(--font-head); font-weight: 700; font-size: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.drawer nav a:not([class])[aria-current="page"] { color: var(--accent-on-dark); }
.drawer-cta { display: grid; gap: .6rem; margin-top: auto; }

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  position: relative; color: var(--on-brand);
  background: var(--band);
  background-image: linear-gradient(115deg, rgba(11, 32, 56, .92) 0%, rgba(11, 32, 56, .72) 60%, rgba(11, 32, 56, .55) 100%),
                    url("images/hero-plumbing-tools-blueprint.jpg");
  background-size: cover; background-position: center;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; padding: clamp(3rem, 8vw, 6rem) 20px; }
.hero-content { max-width: 640px; }
.hero h1 { color: var(--on-brand); }
.hero p { color: #E6EDF4; font-size: 1.15rem; }
.hero .eyebrow { color: var(--accent-on-dark); }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero-note { margin-top: 1rem; font-size: .9rem; color: #C9D6E2; }

/* ---- Trust strip --------------------------------------------------------- */
.trust-strip {
  display: flex; flex-wrap: wrap; gap: .75rem 1.75rem;   /* items wrap (guard §2) */
  align-items: center; justify-content: center;
  padding: 1rem 20px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.trust-item {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; color: var(--ink); white-space: normal;
}
.trust-item svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--copper-text); }

/* ---- Grids --------------------------------------------------------------- */
.grid { display: grid; gap: 1.25rem; }
.grid > * { min-width: 0; }               /* guard §2 */
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.card h3 { color: var(--ink); margin-top: .75rem; }
.card p { color: var(--muted); margin-bottom: 0; }
.card p:not(:last-child) { margin-bottom: 1rem; }

/* Placeholder blocks for missing content */
.placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 180px; padding: 1.5rem; font-weight: 600;
}

/* ---- Media figures ------------------------------------------------------- */
.media { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.split > * { min-width: 0; }
.split .media { aspect-ratio: 4 / 3; }

/* ---- Step band (Plan / Design / Delivery) -------------------------------- */
.band-dark {
  background: var(--band); color: var(--on-brand);
}
.band-dark h1, .band-dark h2, .band-dark h3 { color: var(--on-brand); }
.band-dark p { color: #D4DEE8; }
.band-dark .eyebrow { color: var(--accent-on-dark); }
.band-dark ul { color: #D4DEE8; }
/* Band colour rules must NOT leak into .card children (guard §10) */
.band-dark .card h3 { color: var(--ink); }
.band-dark .card p { color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.steps > * { min-width: 0; }
.step { display: flex; flex-direction: column; gap: .5rem; }
.step-num {
  font-family: var(--font-head); font-weight: 800; font-size: 1.5rem;
  color: var(--accent-on-dark);
  width: 48px; height: 48px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .08);
}

/* ---- Map band ------------------------------------------------------------ */
.map-band { background: var(--band); color: var(--on-brand); }
.map-band h2, .map-band h3 { color: var(--on-brand); }
.map-band p { color: #D4DEE8; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.map-grid > * { min-width: 0; }
.map-frame { border: 0; width: 100%; height: 340px; border-radius: var(--radius); box-shadow: var(--shadow); }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.contact-list li { display: flex; gap: .85rem; align-items: flex-start; color: var(--on-brand); }
.contact-list .ci-label { font-weight: 700; font-family: var(--font-head); color: var(--on-brand); }
.contact-list .ci-value { color: #D4DEE8; }
.contact-list a:not([class]) { color: var(--accent-on-dark); }

/* ---- CTA band ------------------------------------------------------------ */
.cta-band { text-align: center; }
.cta-band .cta-row { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1.5rem; }

/* ---- Forms --------------------------------------------------------------- */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 2.5rem); box-shadow: var(--shadow);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid > * { min-width: 0; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-family: var(--font-head); font-size: .9rem; }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 1rem;
  padding: .7rem .8rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--ground); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.form-note { font-size: .9rem; color: var(--muted); margin-top: 1rem; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--band); color: var(--on-brand); padding: 3rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; }
.footer-grid > * { min-width: 0; }
.site-footer h4 { color: var(--on-brand); font-size: 1rem; margin-bottom: .75rem; }
.site-footer p { color: #C2CFDB; font-size: .92rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.site-footer a:not([class]) { color: #C2CFDB; text-decoration: none; }
.site-footer a:not([class]):hover { color: var(--on-brand); }
.footer-word { font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; color: var(--on-brand); }
.footer-bottom {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: .82rem; color: #9FB0BF;
}
.footer-bottom .demo-note { margin-top: .5rem; }

/* ---- Mobile sticky call bar --------------------------------------------- */
.call-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--band); border-top: 1px solid rgba(255, 255, 255, .12);
  padding: .55rem; gap: .5rem;
}
.call-bar .btn { flex: 1 1 0; }

/* ---- Dark-mode link recolor (guard §1) ---------------------------------- */
[data-theme="dark"] a:not([class]) { color: var(--brand-text); }
[data-theme="dark"] a:not([class]):hover { color: var(--copper-text); }
/* Re-set explicitly for always-dark nav + footer so they stay light */
[data-theme="dark"] .main-nav a:not([class]) { color: var(--on-brand); }
[data-theme="dark"] .main-nav a:not([class]):hover { color: var(--on-brand); }
[data-theme="dark"] .main-nav a:not([class])[aria-current="page"] { color: var(--accent-on-dark); }
[data-theme="dark"] .drawer nav a:not([class]) { color: var(--on-brand); }
[data-theme="dark"] .drawer nav a:not([class])[aria-current="page"] { color: var(--accent-on-dark); }
[data-theme="dark"] .site-footer a:not([class]) { color: #C2CFDB; }
[data-theme="dark"] .site-footer a:not([class]):hover { color: var(--on-brand); }
[data-theme="dark"] .contact-list a:not([class]) { color: var(--accent-on-dark); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .main-nav { display: none; }       /* inline nav off, drawer on */
  .nav-toggle { display: flex; }
  .header-actions .btn { display: none; }  /* .header-actions buttons hidden on mobile */
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .call-bar { display: flex; }
  body { padding-bottom: 64px; }       /* room for call bar */
}
@media (max-width: 768px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .split .media { aspect-ratio: 16 / 9; }
}
@media (max-width: 520px) {
  .wordmark .wm-sub { display: none; }   /* hide sub-label (guard §2) */
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }  /* single column (guard §2) */
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-cta .btn, .cta-band .cta-row .btn { flex: 1 1 100%; }
}

/* ---- Accessibility ------------------------------------------------------- */
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--copper); color: #fff; padding: .6rem 1rem; border-radius: 8px;
  text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent-on-dark); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
