/* ==========================================================================
   Foresum Panel Beaters — shared styles
   Palette from research/design-language.md; dark values measured for contrast:
     --surface dark #2A3236 = 1.43:1 vs dark ground (>=1.35 required)
     white on --brand #0E6B73 = 6.23:1; white on WhatsApp green #0F7A6B = 5.23:1
   Guard numbering (G1..G9) maps to design-language.md §7.
   ========================================================================== */

:root {
  /* Colour tokens — light (default) */
  --ground: #F3F6F6;
  --surface: #FFFFFF;
  --ink: #13191C;
  --muted: #4A565B;
  --brand: #0E6B73;          /* fills / rules / large display only */
  --brand-text: #0A5860;     /* teal text under ~20px on light surfaces */
  --gloss: #C9D3D6;          /* rules / sheen — never small text on light */
  --on-brand: #FFFFFF;       /* G5: fixed in BOTH themes */
  --accent-on-dark: #5ED3C8; /* G5: fixed in BOTH themes */
  --band: #12191C;           /* always-dark header/footer/hero/CTA band */
  --wa: #0F7A6B;             /* WhatsApp action fill (white label, 5.23:1) */

  --surface-border: #E1E7E8;
  --surface-shadow: 0 1px 2px rgba(19, 25, 28, .06), 0 8px 24px rgba(19, 25, 28, .06);
  --sheen: linear-gradient(180deg, rgba(255,255,255,.9), rgba(201,211,214,.25));

  --maxw: 1120px;
  --radius: 14px;
  --radius-sm: 9px;
  --pad: clamp(1rem, 4vw, 2rem);

  --font-head: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --ground: #0F1315;
  --surface: #2A3236;        /* measured 1.43:1 vs ground */
  --ink: #ECF0F1;
  --muted: #A7B3B8;
  --brand: #0E6B73;
  --brand-text: #5ED3C8;     /* teal text on dark surfaces */
  --gloss: #C9D3D6;
  /* --on-brand, --accent-on-dark, --band are NOT remapped (G5/G8) */
  --band: #0A0D0E;
  --surface-border: #3A444A;
  --surface-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
  --sheen: linear-gradient(180deg, rgba(255,255,255,.06), rgba(94,211,200,.04));
}

/* --------------------------------------------------------------- base --- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  /* G2: overflow-x:hidden is BANNED — layout must not need it. */
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 .5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 6vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.22rem; font-weight: 700; }

p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; display: block; }

/* G1: plain links recolor only in dark; CTAs all carry a class */
a:not([class]) { color: var(--brand-text); text-underline-offset: 2px; }
a:not([class]):hover { text-decoration: underline; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

.section { padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.section--tight { padding-block: clamp(1.75rem, 5vw, 3rem); }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand-text);
  margin: 0 0 .5rem;
}
.lead { font-size: 1.18rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 1.15em; height: 1.15em; flex: 0 0 auto; }

.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: #0B5F67; }

.btn--wa { background: var(--wa); color: #fff; }
.btn--wa:hover { filter: brightness(1.06); }

.btn--ghost {
  background: transparent;
  color: var(--brand-text);
  border-color: var(--brand);
}
.btn--ghost:hover { background: rgba(14, 107, 115, .08); }

.btn--lg { padding: 1rem 1.5rem; font-size: 1.08rem; }
.btn--block { width: 100%; justify-content: center; }

/* Buttons that sit on an ALWAYS-DARK band (G8) — fixed light text both themes */
.on-dark .btn--ghost,
.btn--ghost-ondark {
  color: var(--on-brand);
  border-color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.06);
}
.on-dark .btn--ghost:hover,
.btn--ghost-ondark:hover { background: rgba(255,255,255,.14); }

/* ------------------------------------------------------- icon wrappers --- */
/* G6: every fixed-size icon wrapper is flex-centred */
.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: rgba(14, 107, 115, .1);
  color: var(--brand-text);
}
.icon svg { width: 24px; height: 24px; }
.on-dark .icon { background: rgba(94, 211, 200, .12); color: var(--accent-on-dark); }

/* ---------------------------------------------------------------- chip --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .3rem .6rem;
  border-radius: 999px;
  background: rgba(14, 107, 115, .1);
  color: var(--brand-text);
  border: 1px solid rgba(14, 107, 115, .28);
}
/* G8: chips on always-dark bands use the fixed accent, never --brand-text */
.on-dark .chip {
  background: rgba(94, 211, 200, .14);
  color: var(--accent-on-dark);
  border-color: rgba(94, 211, 200, .4);
}

/* ---------------------------------------------------------------- card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--surface-shadow);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.card::before { /* clear-coat sheen */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 40%;
  background: var(--sheen);
  opacity: .5; pointer-events: none;
}
.card > * { position: relative; }
.card h3 { margin-top: .75rem; }

.grid { display: grid; gap: 1.25rem; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================== header === */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--band);
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--on-brand);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 64px;
}
/* G2: wordmark may shrink; sub-label hides on narrow screens */
.brand {
  display: flex; align-items: baseline; gap: .55rem;
  flex: 0 1 auto; min-width: 0;
  text-decoration: none; color: var(--on-brand);
  margin-right: auto;
}
.brand__mark {
  font-family: var(--font-head);
  font-weight: 800; font-size: 1.3rem; letter-spacing: .02em;
  color: var(--on-brand);
  white-space: nowrap;
}
.brand__sub {
  font-size: .78rem; color: var(--accent-on-dark);
  white-space: nowrap; font-weight: 600;
}

.main-nav ul {
  list-style: none; display: flex; gap: 1.4rem; margin: 0; padding: 0;
}
.main-nav a:not([class]),
.main-nav .nav-link {
  color: var(--on-brand);           /* G1/G8 */
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600; font-size: .98rem;
  white-space: nowrap;              /* G2: no mid-phrase wrap */
  padding: .4rem 0;
}
.main-nav .nav-link:hover,
.main-nav .nav-link[aria-current="page"] { color: var(--accent-on-dark); }
.main-nav .nav-link[aria-current="page"] { border-bottom: 2px solid var(--accent-on-dark); }

.header-actions { display: flex; align-items: center; gap: .6rem; }
.header-actions .btn { padding: .6rem .85rem; font-size: .9rem; }

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

.nav-burger { display: none; }

/* ============================================================== drawer === */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 13, 14, .55);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; z-index: 61;
  width: min(84vw, 340px); height: 100%;
  background: var(--band); color: var(--on-brand);
  padding: 1.25rem;
  transform: translateX(100%); transition: transform .22s ease;
  display: flex; flex-direction: column; gap: 1rem;
  overflow-y: auto;
}
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
body.drawer-open .drawer { transform: translateX(0); }

.drawer__head { display: flex; align-items: center; justify-content: space-between; }
.drawer__title { font-family: var(--font-head); font-weight: 800; }
.drawer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.drawer nav a {
  display: block; padding: .8rem 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: var(--on-brand); text-decoration: none;
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
}
.drawer nav a[aria-current="page"] { color: var(--accent-on-dark); }
.drawer__cta { display: flex; flex-direction: column; gap: .6rem; margin-top: auto; }

/* ================================================================ hero === */
.hero {
  position: relative;
  color: var(--on-brand);
  background: var(--band);
}
.hero__media { position: absolute; inset: 0; z-index: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__media::after { /* dark teal-black gradient overlay for legibility */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, rgba(10,13,14,.92) 0%, rgba(14,107,115,.72) 100%);
}
.hero__inner { position: relative; z-index: 1; padding-block: clamp(3rem, 9vw, 6rem); max-width: 42rem; }
.hero h1 { color: var(--on-brand); }
.hero .lead { color: #D9E2E2; }           /* G8: readable on dark both themes */
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero__note { margin-top: 1rem; font-size: .9rem; color: #C3CFCF; }

/* ======================================================== generic bands = */
/* .on-dark marks any always-dark band so helpers above apply (G8) */
.band-dark {
  background: var(--band); color: var(--on-brand);
}
.band-dark h2, .band-dark h3 { color: var(--on-brand); }
.band-dark p { color: #D4DDDD; }

/* CTA band — white body text, ghost buttons get a visible fill (G8) */
.cta-band { background: var(--brand); color: var(--on-brand); text-align: center; }
.cta-band h2, .cta-band p { color: var(--on-brand); }
.cta-band .btn--ghost-ondark { border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.12); }

/* ---------------------------------------------------- services / steps --- */
.service-card h3 { margin-bottom: .35rem; }
.service-card p { color: var(--muted); margin: 0; }

.steps { counter-reset: step; }
.step { position: relative; }
.step__num {
  font-family: var(--font-head); font-weight: 800; font-size: 1.1rem;
  width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand);
  margin-bottom: .75rem;
}
.on-dark .step__num { background: var(--accent-on-dark); color: var(--band); }

/* ----------------------------------------------- gallery placeholders --- */
.placeholder {
  border: 2px dashed var(--gloss);
  border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(14,107,115,.05) 12px, rgba(14,107,115,.05) 24px);
  min-height: 190px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 1.25rem; color: var(--muted);
  font-family: var(--font-head); font-weight: 600; font-size: .9rem;
}
[data-theme="dark"] .placeholder { border-color: #3A444A; }

/* ---------------------------------------------------------------- map --- */
.map-embed {
  width: 100%; border: 0; border-radius: var(--radius);
  aspect-ratio: 16 / 10; background: var(--surface);
}

/* --------------------------------------------------------------- form --- */
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field--full { grid-column: 1 / -1; }
.field label { font-family: var(--font-head); font-weight: 600; font-size: .92rem; }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 1rem;
  padding: .7rem .8rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 120px; resize: vertical; }
.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: .92rem; color: var(--muted); margin-top: .25rem; }

/* ------------------------------------------------------- contact rows --- */
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.contact-row { display: flex; gap: .9rem; align-items: flex-start; }
.contact-row a:not([class]) { font-weight: 600; }

/* ----------------------------------------------- sticky mobile WA bar --- */
.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; gap: .5rem; padding: .55rem;
  background: var(--band);
  border-top: 1px solid rgba(255,255,255,.1);
}
.mobile-bar .btn { flex: 1; justify-content: center; padding: .75rem; font-size: .95rem; }

/* ============================================================== footer === */
.site-footer {
  background: var(--band); color: var(--on-brand);
  padding-block: 2.5rem; margin-top: 2rem;
}
.site-footer h4 { color: var(--on-brand); font-size: 1rem; }
.site-footer p { color: #C3CFCF; font-size: .94rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
/* G1: footer plain links re-set to light in BOTH themes */
.site-footer a:not([class]) { color: var(--on-brand); text-decoration: none; }
.site-footer a:not([class]):hover { color: var(--accent-on-dark); text-decoration: underline; }
.footer-bottom {
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .85rem; color: #AEBABA;
}
.demo-banner {
  background: rgba(94,211,200,.1);
  border: 1px solid rgba(94,211,200,.3);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-bottom: 1.5rem;
  color: #D4DDDD; font-size: .9rem;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ========================================================= responsive === */
/* G2: off-canvas breakpoint sized so the inline nav + actions fit above it */
@media (max-width: 860px) {
  .main-nav { display: none; }
  .header-actions { display: none; }   /* G2: hide actions on mobile */
  .nav-burger { display: flex; }
  .mobile-bar { display: flex; }
  body { padding-bottom: 64px; }        /* clear the sticky mobile bar */
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* G2: below 520px hide the wordmark sub-label so the header never overflows */
@media (max-width: 520px) {
  .brand__sub { display: none; }
  .brand__mark { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* QA fixes: headings on always-dark page-intro bands, and light/dark-surface cards that sit INSIDE a dark band
   must keep the normal (swappable) text tokens, not the band's fixed light ones. */
.band-dark h1 { color: var(--on-brand); }
.band-dark .card h3 { color: var(--ink); }
.band-dark .card p { color: var(--muted); }
.band-dark .card .btn--ghost { color: var(--brand-text); border-color: var(--brand); background: transparent; }
.band-dark .card .btn--ghost:hover { background: rgba(14, 107, 115, .1); }
