/* ==========================================================================
   Solid Ground Quality & Compliance
   Earthy, neutral palette with one restrained accent (clay).
   All text and button pairings meet WCAG AA (contrast ratios noted below).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Neutrals: stone, sandstone, soil, bark, slate */
  --limewash:  #F5F5F5;  /* page background          ink on it 15.6:1 */
  --chalk:     #FFFFFF;  /* cards and panels         ink on it 16.0:1 */
  --sandstone: #E8E8E8;  /* alternate sections       ink on it 14.1:1 */
  --stone:     #D0D0D0;  /* borders, dividers, placeholders (not for text on light) */
  --bark:      #1A1A1A;  /* main text, footer bg     */
  --soil:      #595959;  /* secondary text           6.4:1 on limewash */
  --slate:     #2B2B2B;  /* dark sections, icons     limewash on it 13.0:1 */

  /* The one accent: gold, in two strengths for two jobs */
  --clay:      #DBBE79;  /* GOLD — fills, borders, icons, and text on dark sections (7.6:1 on slate). Too light for text on light backgrounds (1.7:1) */
  --clay-text: #7D6229;  /* deep gold — links and other text on light backgrounds  5.4:1 on limewash, 5.8:1 on chalk */
  --clay-dark: #C7A662;  /* hover for the gold button fill                        stays ink-on-gold at 7.5:1 */

  --font-head: "Zilla Slab", "Rockwell", "Roboto Slab", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius:   4px;
  --wrap:     1120px;
  --gutter:   clamp(20px, 5vw, 40px);
  --section:  clamp(3.25rem, 8vw, 6rem);
}

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

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

body {
  margin: 0;
  background: var(--limewash);
  color: var(--bark);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

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

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 6vw, 3.5rem); line-height: 1.08; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.35rem; line-height: 1.25; }

p { margin: 0 0 1em; text-wrap: pretty; }

a {
  color: var(--clay-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}
a:hover { color: var(--bark); }

:focus-visible {
  outline: 3px solid var(--clay-text);  /* deep gold: 5.3:1+ on light backgrounds, clears the 3:1 UI bar */
  outline-offset: 3px;
}

/* Skip link: first tab stop, visible only when focused */
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: var(--bark);
  color: var(--limewash);                       /* 13.8:1 */
  border-radius: var(--radius);
  font-weight: 600;
}
.skip-link:focus { top: 16px; color: var(--limewash); }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.center { text-align: center; }

section { padding-block: var(--section); }
.alt { background: var(--sandstone); }

.section-head { margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section-head h2 { margin: 0; }
.section-head h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 0.75rem;
  background: var(--clay);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  min-height: 48px;
  padding: 0.8rem 1.6rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn-primary { background: var(--clay); color: var(--bark); }          /* 9.7:1 */
.btn-primary:hover { background: var(--clay-dark); color: var(--bark); } /* 7.5:1 */
/* Lift only where a real hover exists; the press-down works for mouse, touch and keyboard */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
}
.btn:active { transform: scale(0.97); }

/* ---------- Header ---------- */
.site-header {
  background: var(--limewash);
  border-bottom: 1px solid var(--stone);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 14px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bark);
  text-decoration: none;
}
.brand:hover { color: var(--bark); }
.site-header { --mark: 46px; }
.brand img { width: auto; height: var(--mark); flex: none; transition: height 0.25s ease; }
.brand-text {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.1;
}
.brand-text span {
  display: block;
  margin-top: 4px;
  color: var(--soil);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.main-nav { width: 100%; }
.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.main-nav a {
  display: inline-block;
  padding: 12px 2px 9px;
  border-bottom: 3px solid transparent;
  color: var(--bark);
  font-weight: 600;
  text-decoration: none;
}
.main-nav a:hover { border-bottom-color: var(--stone); color: var(--bark); }
.main-nav a[aria-current="page"] { border-bottom-color: var(--clay); }
.main-nav a { transition: border-color 0.2s ease, color 0.2s ease; }

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(2.5rem, 7vw, 5rem);
  border-bottom: 8px solid var(--stone);
}
.hero .wrap {
  display: grid;
  gap: 2.25rem;
  align-items: center;
}
.eyebrow-line {
  margin: 0 0 1rem;
  color: var(--soil);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* Opening line of the home page headline, sits above the main H1 line */
.h1-kicker {
  display: block;
  margin-bottom: 0.4em;
  color: var(--clay-text);                      /* deep gold, 5.4:1 on limewash */
  font-size: 0.5em;
  font-weight: 500;
  line-height: 1.25;
}
.lead {
  max-width: 34em;
  margin-bottom: 1.75rem;
  color: var(--soil);
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.55;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}

/* ---------- What we solve ---------- */
.problem-list {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
.problem-list li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--chalk);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}
.problem-list img { width: 32px; height: 32px; flex: none; margin-top: 2px; }
.problem-list span { font-size: 1.1rem; line-height: 1.45; }
.problem-list + p { margin-bottom: 0; font-size: 1.2rem; font-weight: 600; }

/* ---------- Our approach ---------- */
.process {
  display: grid;
  gap: 1.75rem;
  counter-reset: step;
}
.step {
  position: relative;
  counter-increment: step;
  padding-top: calc(1.1rem + 4px);
}
.step::after {                                  /* the slate rule across the top */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--slate);
  transform-origin: left center;
}
.step::before {
  content: "0" counter(step);
  display: block;
  color: var(--clay-text);
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
}
.step-num {
  display: block;
  margin: 0.6rem 0 0.4rem;
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}
.step p { margin: 0; }

.engagement-note {
  max-width: 52rem;
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: 1.5rem 1.75rem;
  background: var(--sandstone);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}
.engagement-note p { margin: 0; font-size: 1.1rem; }

/* ---------- Three areas of support ---------- */
.service-grid { display: grid; gap: 1rem; }
.service {
  padding: 1.75rem 1.5rem;
  background: var(--chalk);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}
.service .icon { width: 56px; height: 56px; margin-bottom: 1.25rem; }
.service h3 { margin: 0; }
.more-link { margin: 1.5rem 0 0; font-weight: 600; }

/* ---------- Why Solid Ground ---------- */
.split { display: grid; gap: 2.25rem; }
.split p { max-width: 38em; }
.values-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.values-list li {
  padding: 1.25rem 1.5rem;
  background: var(--slate);
  color: var(--limewash);                     /* 9.5:1 */
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.25;
}
.values-list li:nth-child(2) { margin-inline-start: clamp(0px, 4vw, 2rem); }

/* ---------- Call to action band ---------- */
.cta-band { background: var(--slate); color: var(--limewash); }
.cta-band h2 { max-width: 22em; margin: 0 auto 1.5rem; color: var(--limewash); }
/* The gold button already passes contrast here unchanged; only the focus ring needs the
   lighter gold, since the deep link gold doesn't clear 3:1 against this dark background. */
.cta-band :focus-visible { outline-color: var(--clay); }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 1.75rem;
  background: var(--bark);
  color: var(--stone);                          /* 9.7:1 */
  font-size: 0.9375rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

/* ---------- Interior page hero (Services, Contact) ---------- */
.hero--page { padding-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.hero--page .wrap { grid-template-columns: 1fr; }
.hero--page .hero-copy { max-width: 46rem; }
.hero--page .lead { margin-bottom: 0; }
.hero-copy > p:last-child { margin-bottom: 0; }

/* ---------- Plain reading column ---------- */
.prose { max-width: 46rem; }
.prose > :last-child { margin-bottom: 0; }

/* ---------- Values row (About page) ---------- */
.values-list--row li:nth-child(2) { margin-inline-start: 0; }

/* ---------- Services page: full-width service rows ---------- */
.service-grid--detail { gap: 1.25rem; }
.service-grid--detail .service {
  display: grid;
  gap: 1rem 1.75rem;
  padding: 1.75rem 1.5rem;
}
.service-grid--detail .icon { width: 56px; height: 56px; margin: 0; }
.service-grid--detail h3 { margin-bottom: 0.5rem; }
.service-grid--detail p { max-width: 44rem; margin: 0; }
.service-grid--detail p + p { margin-top: 0.85rem; }   /* space between paragraphs in a service row */
.service-grid--detail .service[id] { scroll-margin-top: 6rem; }   /* clears the sticky header when jumping to a row */

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 2.5rem; }
.contact-grid h2 { margin-bottom: 1rem; }
.contact-detail {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.contact-detail img { width: 32px; height: 32px; flex: none; }
.contact-detail + p { margin-top: 1.25rem; max-width: 30em; }

.contact-form {
  display: grid;
  gap: 1.15rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--chalk);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}
.contact-form .field-row { display: grid; gap: 1.15rem; }
.contact-form label { display: block; margin-bottom: 0.35rem; font-weight: 600; }
.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  background: var(--limewash);
  color: var(--bark);
  border: 1px solid var(--soil);                 /* input edge, well above 3:1 */
  border-radius: var(--radius);
  font: inherit;
}
.contact-form textarea { min-height: 9.5rem; resize: vertical; }
.contact-form .btn { justify-self: start; cursor: pointer; }
.field-count {
  margin: 0.35rem 0 0;
  color: var(--soil);                            /* 6.4:1 on chalk */
  font-size: 0.875rem;
  text-align: right;
}
.field-count.is-low { color: var(--bark); font-weight: 600; }

/* ---------- Footer notes ---------- */
.footer-note { flex: 1 1 100%; max-width: 62rem; margin: 0 0 1.25rem; }
.footer-base {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--soil);
}

/* ---------- Flip tiles (home page, three areas of support) ---------- */
.flip-tile { display: grid; perspective: 1000px; }
.flip-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.flip-tile.is-flipped .flip-inner { transform: rotateY(180deg); }

/* Both faces share one grid cell, so the tile is as tall as its tallest face */
.flip-face {
  grid-area: 1 / 1;
  min-height: 13rem;
  padding: 1.5rem;
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.flip-front {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--chalk);
  transition: visibility 0s 0s;
}
.flip-front .icon { width: 56px; height: 56px; flex: none; }
.flip-front h3 { margin: auto 0 0; padding-right: 2.25rem; }

/* One button covers the front face: it is the keyboard and touch control */
.flip-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.flip-btn::after {                              /* the "+" hint, hidden from screen readers */
  content: "+";
  content: "+" / "";
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  color: var(--clay);
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
}
.flip-btn:focus-visible { outline: 3px solid var(--clay-text); outline-offset: -6px; }

.flip-back {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  background: var(--slate);
  border-color: var(--slate);
  color: var(--limewash);                       /* 9.5:1 */
  transform: rotateY(180deg);
  visibility: hidden;                           /* off the tab order and away from screen readers until flipped */
  transition: visibility 0s 0.3s;
}
.flip-back p { margin: 0; }
.flip-back-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.flip-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--limewash);
  font-weight: 600;
}
.flip-back a:hover { color: var(--sandstone); }
.flip-close {
  min-height: 44px;
  padding: 0 1rem;
  background: none;
  border: 1px solid rgba(248, 244, 235, 0.55);
  border-radius: var(--radius);
  color: var(--limewash);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.flip-close:hover { background: rgba(248, 244, 235, 0.1); }
.flip-back :focus-visible { outline-color: var(--limewash); }

/* Visibility swaps when the flip is half done; the side coming into view switches at once */
.flip-tile.is-flipped .flip-front { visibility: hidden; transition-delay: 0.3s; }
.flip-tile.is-flipped .flip-back { visibility: visible; transition-delay: 0s; }

/* A mouse flips the tile by hovering; the button is then for keyboards only */
@media (hover: hover) and (pointer: fine) {
  .flip-tile:hover .flip-inner { transform: rotateY(180deg); }
  .flip-tile:hover .flip-front { visibility: hidden; transition-delay: 0.3s; }
  .flip-tile:hover .flip-back { visibility: visible; transition-delay: 0s; }
  .flip-btn { pointer-events: none; }
}

/* ---------- Hero scrolling list (home page) ----------
   Same 4:3 footprint as the image it replaces, in the sandstone of the section below it.
   Without JavaScript, or with reduced motion, it is a static list that scrolls by hand.
   js/scroller.js adds .is-animated. */
.scroll-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--sandstone);
  color: var(--bark);                           /* 14.1:1 on sandstone */
  border: 1px solid var(--stone);
  border-radius: var(--radius);
}
.scroll-head {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--stone);
}
.scroll-label {
  margin: 0;
  color: var(--clay-text);                      /* deep gold, 4.7:1 on sandstone (bright gold is only 1.5:1) */
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scroll-viewport { flex: 1; min-height: 0; overflow-y: auto; }
.scroll-list { margin: 0; padding: 0; list-style: none; }
.scroll-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.5rem;
  border-bottom: 1px solid var(--stone);
  font-family: var(--font-head);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 500;
  line-height: 1.25;
}
.scroll-list li::before {                       /* short gold marker */
  content: "";
  flex: none;
  width: 14px;
  height: 3px;
  background: var(--clay);
}
.scroll-list--copy { display: none; }

/* Animated mode: set by js/scroller.js, never under reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .scroll-window.is-animated .scroll-viewport {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  }
  .scroll-window.is-animated .scroll-list--copy { display: block; }
  .scroll-window.is-animated .scroll-track {
    animation: scroll-up var(--scroll-duration, 36s) linear infinite;
  }
  .scroll-window.is-animated .scroll-track:hover { animation-play-state: paused; }
}
@keyframes scroll-up { to { transform: translateY(-50%); } }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Motion ----------
   Anything that moves sits inside "no-preference", so people who ask their device
   for less motion get the finished page straight away. The .js class is set by a
   one-line script in each page head and removed if js/main.js fails to load, so
   content is never left hidden. */
@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;
  }
}
@media (prefers-reduced-motion: no-preference) {
  /* Card groups rise and fade in once, a beat apart */
  .js .reveal-group > * {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease, transform 0.55s ease;
  }
  .js .reveal-group.in > * { opacity: 1; transform: none; }
  .js .reveal-group.in > :nth-child(2) { transition-delay: 0.1s; }
  .js .reveal-group.in > :nth-child(3) { transition-delay: 0.2s; }

  /* Approach steps: rule draws in, then the numeral and text follow. --d is set by js/main.js */
  .js .step::after {
    transform: scaleX(0);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) var(--d, 0s);
  }
  .js .step::before,
  .js .step > * {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease calc(var(--d, 0s) + 0.35s), transform 0.5s ease calc(var(--d, 0s) + 0.35s);
  }
  .js .step.in::after { transform: scaleX(1); }
  .js .step.in::before,
  .js .step.in > * { opacity: 1; transform: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 719px) {
  .flip-face { min-height: 7.5rem; padding: 1.1rem 1.25rem; }
  .flip-front { flex-direction: row; align-items: center; gap: 1.1rem; }
  .flip-front .icon { width: 48px; height: 48px; }
  .flip-front h3 { margin: 0; font-size: 1.2rem; }
  .flip-btn::after { top: 50%; bottom: auto; right: 0.6rem; transform: translateY(-50%); }
}

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
  .site-header { position: sticky; top: 0; z-index: 50; }
  .site-header .wrap { padding-block: 14px; transition: padding 0.25s ease; }
  .site-header.is-scrolled { --mark: 36px; }
  .site-header.is-scrolled .wrap { padding-block: 8px; }
  .main-nav { width: auto; }
  .main-nav ul { gap: 0 1.75rem; }

  .problem-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .problem-list li { flex-direction: column; gap: 0.75rem; }
  .service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .process { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
  .service-grid.service-grid--detail { grid-template-columns: minmax(0, 1fr); }
  .values-list--row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-grid--detail .service { grid-template-columns: 56px minmax(0, 1fr); }
  .contact-form .field-row { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .hero .wrap { grid-template-columns: 1.15fr 0.85fr; gap: 4rem; }
  .split { grid-template-columns: 1.35fr 1fr; gap: 4rem; align-items: start; }
  .contact-grid { grid-template-columns: 0.8fr 1.2fr; gap: 4rem; align-items: start; }
}
