/* ==========================================================================
   Greenscape Maintenance Solutions — shared stylesheet
   Palette & rules from research/design-language.md §2 (all 16 known bugs).
   ========================================================================== */

/* ----- Tokens (bug 1: separate roles; bugs 7-9: fixed accent/orange/on-brand) */
:root {
  --ground:      #F3F0E8;  /* page background */
  --surface:     #FFFFFF;  /* card fill (border in light — bug 16) */
  --ink:         #1B2A22;  /* body text */
  --muted:       #56635B;  /* secondary text */
  --brand:       #1F6B3C;  /* CTA fill */
  --brand-text:  #1F6B3C;  /* accent text / ticks / links on NORMAL surfaces */
  --accent-dark: #F5A24B;  /* accent text on ALWAYS-DARK bands — fixed (bug 1/9) */
  --orange:      #F28C28;  /* highlight fill — dark text on it (bug 8) */
  --ink-fixed:   #1B2A22;  /* dark text on orange — fixed */
  --on-brand:    #FFFFFF;  /* text on brand fills — fixed */
  --stone:       #EEF1E8;  /* text on always-dark bands — fixed */
  --band:        #1B2A22;  /* always-dark header/hero/footer/CTA/panel */

  --border:      #D8D3C6;  /* visible card border in light (bug 16) */
  --border-dark: #32413A;  /* card border in dark (≥1.2:1 vs surface) */

  --radius: 12px;
  --maxw: 1080px;
  --font-head: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, sans-serif;
}

[data-theme="dark"] {
  --ground:      #101712;
  --surface:     #1A241D;
  --ink:         #EEF1E8;
  --muted:       #BFCBC1;
  --brand:       #1F6B3C;
  --brand-text:  #7FD39A;  /* lighter accent for normal dark surfaces */
  --accent-dark: #F5A24B;
  --orange:      #F28C28;
  --ink-fixed:   #1B2A22;
  --on-brand:    #FFFFFF;
  --stone:       #EEF1E8;
  --band:        #0A0F0B;
  --border:      #32413A;
}

/* ----- Reset / base ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  overflow-wrap: anywhere;      /* bug 3 */
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 .6em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }
p  { margin: 0 0 1rem; }
a  { color: var(--brand-text); }
img { max-width: 100%; height: auto; display: block; }
ul { padding-left: 1.2em; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
/* bug 4: never combine vertical padding with .container; use a wrapper section */
.section { padding: 56px 0; }
.section--tight { padding: 36px 0; }
.muted { color: var(--muted); }
.eyebrow {
  font-family: var(--font-head); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; font-size: .8rem; color: var(--brand-text);
  margin: 0 0 .4em;
}
.center { text-align: center; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 60ch; }

/* ----- Measuring-tape tick divider ----- */
.ticks { display: flex; gap: 6px; margin: 1rem 0; }
.ticks span { width: 2px; height: 14px; background: var(--brand-text); opacity: .85; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  padding: 12px 20px; border-radius: 10px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 44px;
}
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: #185730; border-color: #185730; color: var(--on-brand); }
.btn--orange { background: var(--orange); color: var(--ink-fixed); border-color: var(--orange); }
.btn--orange:hover { background: #e07f1d; border-color: #e07f1d; color: var(--ink-fixed); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { background: rgba(0,0,0,.05); color: var(--ink); }
[data-theme="dark"] .btn--ghost:hover { background: rgba(255,255,255,.08); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ==========================================================================
   ALWAYS-DARK BANDS (bug 1): header, hero, band, footer, footer-bottom,
   job-brief panel. Explicit light-on-dark colours for all text roles.
   ========================================================================== */
.site-header, .hero, .band, .site-footer, .jb-panel {
  background: var(--band);
  color: var(--stone);
}
.site-header h1, .hero h1, .band h1, .site-footer h1, .jb-panel h1,
.site-header h2, .hero h2, .band h2, .site-footer h2, .jb-panel h2,
.site-header h3, .hero h3, .band h3, .site-footer h3, .jb-panel h3,
.site-header h4, .hero h4, .band h4, .site-footer h4, .jb-panel h4,
.site-header p, .hero p, .band p, .site-footer p, .jb-panel p,
.site-header li, .hero li, .band li, .site-footer li, .jb-panel li,
.site-header dt, .hero dt, .band dt, .site-footer dt, .jb-panel dt,
.site-header dd, .hero dd, .band dd, .site-footer dd, .jb-panel dd {
  color: var(--stone);
}
/* muted / notes / stat / img-note / eyebrow on dark bands */
.site-header .muted, .hero .muted, .band .muted, .site-footer .muted, .jb-panel .muted,
.hero .img-note, .band .img-note,
.site-footer .img-note {
  color: #C7D1C8;
}
/* accent text on dark bands uses the FIXED accent, never --brand-text (bug 1/9) */
.hero .eyebrow, .band .eyebrow, .site-footer .eyebrow, .jb-panel .eyebrow,
.hero .accent, .band .accent, .site-footer .accent, .jb-panel .accent {
  color: var(--accent-dark);
}
/* ticks on dark bands use accent-dark, never brand (bug 9) */
.hero .ticks span, .band .ticks span, .site-footer .ticks span, .jb-panel .ticks span {
  background: var(--accent-dark);
}
/* plain links on dark bands */
.site-header a:not(.btn), .hero a:not(.btn), .band a:not(.btn),
.site-footer a:not(.btn), .jb-panel a:not(.btn) {
  color: var(--accent-dark);
}

/* bug 6: link-colour rules in dark sections must NOT override button text,
   incl. :hover — explicit exceptions for every band incl. .site-header */
.site-header a.btn--primary, .hero a.btn--primary, .band a.btn--primary,
.site-footer a.btn--primary, .jb-panel a.btn--primary,
.site-header a.btn--primary:hover, .hero a.btn--primary:hover, .band a.btn--primary:hover,
.site-footer a.btn--primary:hover, .jb-panel a.btn--primary:hover { color: var(--on-brand); }

.site-header a.btn--orange, .hero a.btn--orange, .band a.btn--orange,
.site-footer a.btn--orange, .jb-panel a.btn--orange,
.site-header a.btn--orange:hover, .hero a.btn--orange:hover, .band a.btn--orange:hover,
.site-footer a.btn--orange:hover, .jb-panel a.btn--orange:hover { color: var(--ink-fixed); }

/* ghost buttons on dark bands — both a.btn--ghost and button.btn--ghost, incl hover (bug 1) */
.site-header a.btn--ghost, .hero a.btn--ghost, .band a.btn--ghost,
.site-footer a.btn--ghost, .jb-panel a.btn--ghost,
.site-header button.btn--ghost, .hero button.btn--ghost, .band button.btn--ghost,
.site-footer button.btn--ghost, .jb-panel button.btn--ghost {
  color: var(--stone); border-color: rgba(238,241,232,.5); background: transparent;
}
.site-header a.btn--ghost:hover, .hero a.btn--ghost:hover, .band a.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .jb-panel a.btn--ghost:hover,
.site-header button.btn--ghost:hover, .hero button.btn--ghost:hover, .band button.btn--ghost:hover,
.site-footer button.btn--ghost:hover, .jb-panel button.btn--ghost:hover {
  color: var(--stone); background: rgba(238,241,232,.12);
}

/* ----- Header / nav ----- */
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(238,241,232,.12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--stone); text-decoration: none; overflow-wrap: anywhere; }
.brand .accent { color: var(--accent-dark); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--stone); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:not(.btn):hover { background: rgba(238,241,232,.1); }
.nav a[aria-current="page"] { color: var(--accent-dark); }
.header-actions { display: flex; align-items: center; gap: 8px; }

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

/* ----- Hero ----- */
.hero { position: relative; }
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 64px 0; }
.hero-media { border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(238,241,232,.15); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }
.img-note { font-size: .78rem; margin-top: 8px; }

/* ----- Proof strip ----- */
.proof { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; }
.proof .stat { font-family: var(--font-head); font-weight: 600; }
.proof .stat strong { color: var(--brand-text); }

/* ----- Cards ----- */
.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border);           /* bug 16: visible border in light */
  border-radius: var(--radius); padding: 22px; min-width: 0;
}
[data-theme="dark"] .card { border-color: var(--border-dark); }
.card h3 { margin-top: 0; }
.card .card-media { border-radius: 8px; overflow: hidden; margin: -22px -22px 16px; }
.card .card-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

/* ----- Chips (also-ask / tags) ----- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: .4em; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font-size: .92rem; min-width: 0;
}
[data-theme="dark"] .chip { border-color: var(--border-dark); }

/* ----- NAP / find-us ----- */
.findus { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.findus > * { min-width: 0; }                 /* bug 3 */
dl.nap { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
dl.nap dt { font-weight: 700; font-family: var(--font-head); }
dl.nap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }  /* bug 3 */

/* ----- NEEDS CONTENT placeholder ----- */
.needs-content {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--muted); background: transparent;
}
[data-theme="dark"] .needs-content { border-color: var(--border-dark); }

/* ==========================================================================
   JOB BRIEF — Signature Feature
   ========================================================================== */
.jb { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: start; }
.jb-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 20px; margin: 0 0 20px; min-width: 0; }
[data-theme="dark"] .jb-form fieldset { border-color: var(--border-dark); }
.jb-form legend { font-family: var(--font-head); font-weight: 700; padding: 0 8px; font-size: 1.05rem; }

/* selectable tiles / chips — outline + tick, not colour alone (bug 13) */
.opt-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.opt {
  position: relative; display: inline-flex; align-items: center; gap: .5em;
  padding: 10px 16px 10px 14px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: .95rem;
  min-width: 0; line-height: 1.3;
}
[data-theme="dark"] .opt { border-color: var(--border-dark); }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .tick { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid var(--muted); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; }
.opt .tick svg { width: 12px; height: 12px; opacity: 0; }
.opt input:checked ~ .tick { border-color: var(--brand); background: var(--brand); }
.opt input:checked ~ .tick svg { opacity: 1; color: var(--on-brand); }
.opt:has(input:checked) { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 1px; }
.opt input:focus-visible ~ .tick { outline: 2px solid var(--brand-text); outline-offset: 2px; }
/* radios: round tick */
.opt--radio .tick { border-radius: 50%; }

.jb-field label.flabel { display: block; font-weight: 600; margin-bottom: 6px; }
.jb-field input[type="text"], .jb-field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; min-width: 0;
}
[data-theme="dark"] .jb-field input[type="text"], [data-theme="dark"] .jb-field textarea { border-color: var(--border-dark); }
.jb-field textarea { resize: vertical; min-height: 72px; }
.jb-field .count { font-size: .8rem; color: var(--muted); }
.dependent[hidden] { display: none; }

/* Job Brief panel — ALWAYS dark (both themes) */
.jb-panel { border-radius: var(--radius); padding: 22px; position: sticky; top: 84px; }
.jb-panel h3 { color: var(--stone); margin-top: 0; }
.jb-panel .summary-line { font-family: var(--font-head); font-weight: 600; color: var(--accent-dark); font-size: 1.05rem; }
.jb-panel ul { margin: .4rem 0 1rem; }
.jb-panel li { color: var(--stone); }
.jb-message {
  background: rgba(238,241,232,.08); border: 1px solid rgba(238,241,232,.18);
  border-radius: 10px; padding: 12px 14px; color: var(--stone); font-size: .92rem;
  white-space: pre-wrap;
}
.jb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.jb-copied { font-size: .85rem; color: var(--accent-dark); margin-top: 8px; min-height: 1.2em; }

/* ----- Footer ----- */
.site-footer { margin-top: 48px; }
.footer-top { padding: 48px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid > * { min-width: 0; }            /* bug 3 */
.footer-grid h4 { color: var(--stone); }
.footer-grid a:not(.btn) { color: var(--stone); text-decoration: none; }
.footer-grid a:not(.btn):hover { color: var(--accent-dark); text-decoration: underline; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-bottom { border-top: 1px solid rgba(238,241,232,.14); padding: 18px 0; font-size: .85rem; }
.footer-bottom .container { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; }
.demo-note {
  background: #0A0F0B; color: var(--stone); border: 1px solid rgba(238,241,232,.16);
  border-radius: 8px; padding: 10px 14px; font-size: .85rem; margin-top: 16px;
}
.demo-note strong { color: var(--accent-dark); }

/* ----- Skip link / a11y ----- */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--brand); color: var(--on-brand); padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }

/* ==========================================================================
   RESPONSIVE (bug 3: 320px safe)
   ========================================================================== */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 28px; padding: 44px 0; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .jb { grid-template-columns: 1fr; }
  .jb-panel { position: static; }
  .findus { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .nav { order: 3; width: 100%; }              /* nav on its own row ≤700px (bug 3) */
  .header-inner { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 40px 0; }
}
@media (max-width: 480px) {
  .header-cta { display: none; }               /* hide header CTA ≤480px (bug 3) */
  h1 { font-size: 1.85rem; }
  .btn { width: 100%; }
  .btn-row .btn, .jb-actions .btn { width: 100%; }
}
