/* ==========================================================================
   South Bucks Resin & Driveways — design system
   Brand direction: "Chilterns premium" — established local craftsmanship
   for substantial period and modern homes.

   PORTABILITY: this system is shared across sibling sites. To re-skin,
   swap the BRAND TOKENS layer only. Components consume SEMANTIC TOKENS,
   never raw brand values.

   Breakpoints (mobile-first): 480px / 768px / 1100px
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BRAND TOKENS — the only layer sibling sites change
   -------------------------------------------------------------------------- */
:root {
  /* Palette */
  --woodland: #2F4A38;  /* deep Chilterns green — primary; headers/footer */
  --flint:    #F5F2EC;  /* warm flint stone — page background */
  --bronze:   #A8763E;  /* aggregate bronze — CTAs and key data ONLY */
  --chalk:    #EDEAE2;  /* section alternation */
  --ink:      #26302B;  /* body text */

  /* Derived shades (computed from palette; adjust with palette) */
  --woodland-deep: #24392B;                                   /* footer, hover on woodland */
  --bronze-deep:   #7E5527;                                   /* AA-safe bronze: text/borders on light surfaces */
  --line:          color-mix(in srgb, var(--ink) 16%, var(--flint));

  /* Typography */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif; /* display headings — period character */
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; /* prices + measurements */
}

/* --------------------------------------------------------------------------
   2. SEMANTIC TOKENS — consumed by components; rarely edited per site
   -------------------------------------------------------------------------- */
:root {
  --surface:        var(--flint);
  --surface-alt:    var(--chalk);
  --surface-invert: var(--woodland);
  --surface-invert-deep: var(--woodland-deep);

  --text:           var(--ink);
  --text-invert:    var(--flint);
  --text-muted:     color-mix(in srgb, var(--ink) 72%, var(--flint));

  --accent:         var(--bronze);       /* decorative accent, large fills */
  --accent-strong:  var(--bronze-deep);  /* accent as text or thin strokes */
  --link:           var(--woodland);
  --focus-ring:     var(--bronze-deep);

  /* Type scale (mobile first; stepped up at 768/1100).
     --text-sm is 1rem below 768px so no text renders under 16px on mobile. */
  --text-sm:   1rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2rem;
  --leading-body: 1.6;
  --leading-tight: 1.15;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  /* Shape & elevation — 6px is the maximum radius in this system */
  --radius:     6px;
  --radius-sm:  3px;
  --shadow-card: 0 1px 2px rgb(38 48 43 / 0.08), 0 4px 12px rgb(38 48 43 / 0.06);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.3, 1);
  --duration: 180ms;

  /* Layout */
  --container: 1100px;
  --tap-target: 44px;  /* minimum interactive size */
}

/* --------------------------------------------------------------------------
   3. RESET / BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

h4 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-strong);
}

.lede {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 62ch;
}

/* Prices and measurements always render in mono for scannability */
.data {
  font-family: var(--font-mono);
  font-size: 1em; /* 0.95em from 768px up; never below 16px on mobile */
  letter-spacing: -0.01em;
}

.price {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-strong); /* bronze reserved for key data */
}

/* --------------------------------------------------------------------------
   5. SIGNATURE ELEMENT — the aggregate band
   A thin textured rule of bronze-toned "aggregate" dots. Under H1s ONLY.
   Two offset dot layers at different sizes/tones create the stone texture.
   -------------------------------------------------------------------------- */
h1::after {
  content: "";
  display: block;
  width: min(11rem, 70%);
  height: 8px;
  margin-top: var(--space-3);
  background-image:
    radial-gradient(circle at 3px 3px, var(--accent) 1.7px, transparent 2.1px),
    radial-gradient(circle at 9px 6px, color-mix(in srgb, var(--accent) 62%, var(--surface)) 1.3px, transparent 1.7px),
    radial-gradient(circle at 14px 2px, color-mix(in srgb, var(--accent-strong) 80%, var(--surface)) 1.1px, transparent 1.5px);
  background-size: 18px 8px;
  background-repeat: repeat-x;
}

/* On inverted (woodland) surfaces the band's faded dots mix toward the
   dark surface instead of flint */
.invert h1::after {
  background-image:
    radial-gradient(circle at 3px 3px, var(--accent) 1.7px, transparent 2.1px),
    radial-gradient(circle at 9px 6px, color-mix(in srgb, var(--accent) 62%, var(--surface-invert)) 1.3px, transparent 1.7px),
    radial-gradient(circle at 14px 2px, color-mix(in srgb, var(--accent) 85%, var(--text-invert)) 1.1px, transparent 1.5px);
}

/* --------------------------------------------------------------------------
   6. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-7);
}

.section-alt {
  background: var(--surface-alt);
}

.grid {
  display: grid;
  gap: var(--space-5);
}

/* --------------------------------------------------------------------------
   7. INTERACTIVE STATES (global)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-invert);
  color: var(--text-invert);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-4);
}

/* --------------------------------------------------------------------------
   8. BUTTONS — bronze is reserved for the primary CTA
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 600 var(--text-base) var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.btn-cta {
  background: var(--accent-strong); /* deep bronze: AA contrast with flint text */
  color: var(--flint);
}

.btn-cta:hover {
  background: var(--accent);
  color: var(--woodland-deep);
}

.btn-secondary {
  background: transparent;
  color: var(--link);
  border-color: currentColor;
}

.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--accent-strong);
}

.invert .btn-secondary {
  color: var(--text-invert);
}

.invert .btn-secondary:hover {
  background: var(--surface-invert-deep);
  color: var(--text-invert);
}

/* --------------------------------------------------------------------------
   9. HEADER + NAV (mobile-first: toggle below 768px)
   -------------------------------------------------------------------------- */
.site-header {
  background: var(--surface-invert);
  color: var(--text-invert);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
}

.brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text-invert);
  text-decoration: none;
  padding-block: var(--space-2);
}

.brand small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: color-mix(in srgb, var(--text-invert) 78%, var(--surface-invert));
}

.nav-toggle {
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  color: var(--text-invert);
  border: 1px solid color-mix(in srgb, var(--text-invert) 45%, transparent);
  border-radius: var(--radius);
  font: 600 var(--text-sm) var(--font-body);
  cursor: pointer;
}

.site-nav {
  flex-basis: 100%;
  display: none;
}

.site-nav.is-open {
  display: block;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-3);
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-2);
  color: var(--text-invert);
  text-decoration: none;
  border-radius: var(--radius);
}

.site-nav a:hover {
  background: var(--surface-invert-deep);
  color: var(--text-invert);
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--text-invert);
  padding-left: var(--space-3);
}

/* --------------------------------------------------------------------------
   10. HERO
   -------------------------------------------------------------------------- */
.hero {
  background: var(--surface-invert);
  color: var(--text-invert);
  padding-block: var(--space-5) var(--space-6); /* tight on mobile so hero + CTA fit one viewport */
}

.hero h1,
.hero p {
  color: var(--text-invert);
}

.hero .lede {
  color: color-mix(in srgb, var(--text-invert) 85%, var(--surface-invert));
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Trust markers strip (hero) */
.trust-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-5) 0 0;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 500;
}

.trust-strip li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.trust-strip li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* --------------------------------------------------------------------------
   11. CARDS
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

.card h3 a {
  text-decoration: none;
}

.card h3 a::after {
  /* stretch the card's primary link over the whole card */
  content: "";
  position: absolute;
  inset: 0;
}

.card:has(h3 a) {
  position: relative;
}

.card:has(h3 a):hover {
  border-color: var(--woodland);
}

/* Materials comparison teaser */
.compare-card .price {
  display: block;
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.compare-card .compare-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Process steps */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: calc(var(--space-6) + var(--space-3));
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-strong);
}

/* Guide articles: direct answers and dateline */
.answer {
  border-left: 3px solid var(--accent);
  padding: var(--space-2) 0 var(--space-2) var(--space-4);
  font-weight: 500;
  max-width: 62ch;
}

.guide-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: color-mix(in srgb, var(--text-invert) 78%, var(--surface-invert));
  margin-top: var(--space-4);
}

/* Cost tables — figures always mono; wide tables scroll in their wrapper */
.table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-4);
  /* scroll hint: edge shadows appear only while more columns are off-screen */
  --table-bg: var(--surface);
  background:
    linear-gradient(to right, var(--table-bg) 30%, transparent) 0 0,
    linear-gradient(to left, var(--table-bg) 30%, transparent) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgb(38 48 43 / 0.22), transparent) 0 0,
    radial-gradient(farthest-side at 100% 50%, rgb(38 48 43 / 0.22), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 48px 100%, 48px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

.section-alt .table-wrap {
  --table-bg: var(--surface-alt);
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.cost-table caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: var(--space-2);
}

.cost-table th,
.cost-table td {
  text-align: left;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.cost-table th {
  font-weight: 600;
}

.cost-table td.figure {
  font-family: var(--font-mono);
  white-space: nowrap;
  color: var(--accent-strong);
  font-weight: 600;
}

.table-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* FAQ (details/summary) */
.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--tap-target);
  padding-block: var(--space-3);
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: var(--accent-strong);
  line-height: 1;
  flex: none;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details > p,
.faq details > ul {
  padding-bottom: var(--space-4);
  max-width: 68ch;
}


/* Project gallery — photo cards with captions */
.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: block;
}

.gallery figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding-top: var(--space-2);
}

@media (min-width: 480px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .gallery.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --------------------------------------------------------------------------
   12. TRUST STRIP / CHECKLISTS
   -------------------------------------------------------------------------- */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  padding-left: var(--space-5);
  margin-bottom: var(--space-2);
  background-image: radial-gradient(circle at 5px 5px, var(--woodland) 4px, transparent 4.5px);
  background-repeat: no-repeat;
  background-position: 0 0.45em;
}

/* --------------------------------------------------------------------------
   13. FORMS (44px+ controls, visible focus)
   -------------------------------------------------------------------------- */
label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  font: var(--text-base) var(--font-body);
  color: var(--text);
  background: #FFFFFF;
  border: 1px solid color-mix(in srgb, var(--ink) 35%, var(--flint));
  border-radius: var(--radius);
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

/* Spam honeypot — visually removed, present for bots */
.hidden-field {
  position: absolute;
  left: -9999px;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   14. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--surface-invert-deep);
  color: var(--text-invert);
  padding-block: var(--space-7) var(--space-5);
  margin-top: var(--space-8);
}

.site-footer a {
  color: var(--text-invert);
}

/* Footer column labels are styled like h4 but are not headings —
   keeps the document outline h1→h2→h3 with no jumps */
.footer-h {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}

.site-footer h4,
.site-footer .footer-h {
  color: var(--text-invert);
}

.footer-grid {
  display: grid;
  gap: var(--space-6);
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-meta {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid color-mix(in srgb, var(--text-invert) 20%, transparent);
  font-size: var(--text-sm);
  color: color-mix(in srgb, var(--text-invert) 75%, var(--surface-invert-deep));
}

/* --------------------------------------------------------------------------
   15. BREAKPOINTS — 480 / 768 / 1100
   -------------------------------------------------------------------------- */
@media (min-width: 480px) {
  :root {
    --text-3xl: 2.25rem;
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-actions .btn {
    flex: 0 0 auto;
  }
}

@media (min-width: 768px) {
  :root {
    --text-sm: 0.875rem;
    --text-2xl: 2rem;
    --text-3xl: 2.75rem;
  }

  .hero {
    padding-block: var(--space-7);
  }

  .data {
    font-size: 0.95em;
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: block;
    flex-basis: auto;
  }

  .site-nav ul {
    display: flex;
    gap: var(--space-1);
    padding: 0;
  }

  .site-nav a {
    padding-inline: var(--space-3);
  }

  .site-nav a[aria-current="page"] {
    box-shadow: inset 0 -3px 0 var(--text-invert);
    padding-left: var(--space-3);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-6);
    align-items: start;
  }
}

@media (min-width: 1100px) {
  :root {
    --text-3xl: 3.25rem;
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .section {
    padding-block: var(--space-8);
  }
}

/* --------------------------------------------------------------------------
   16. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
