/* ==========================================================================
   Delta Environmental Solutions
   Single stylesheet. No framework, no build step, no external requests.
   Section order: tokens, reset, base, layout, components, utilities, print.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   Colors are mean-sampled from the company logo, not invented.
   --sky and --leaf fail WCAG AA as text on light backgrounds and are
   therefore restricted to decoration. Do not use them for copy.
   -------------------------------------------------------------------------- */

:root {
  /* Brand */
  --navy:   #0d3476;
  --blue:   #064897;
  --ocean:  #0a7bc3;
  --sky:    #129ada;   /* decoration only */
  --forest: #07562a;
  --green:  #0b682e;
  --leaf:   #68b931;   /* decoration only */

  /* Neutrals */
  --ink:    #1a1d21;
  --muted:  #5a6470;
  --tint:   #f4f7fa;
  --rule:   #dde4ec;
  --white:  #ffffff;

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;
  --fs-xs:   0.8rem;
  --fs-sm:   0.9rem;
  --fs-base: 1.125rem;
  --fs-lg:   1.35rem;
  --fs-h3:   1.4rem;
  --fs-h2:   clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  --fs-h1:   clamp(2rem, 1.5rem + 2.2vw, 3rem);

  /* Space */
  --space-section: clamp(3rem, 2rem + 4vw, 5rem);
  --space-gutter:  clamp(1rem, 0.5rem + 2vw, 2rem);

  /* Measure
     Line length for running prose. Grows with the viewport instead of sitting
     at a fixed narrow column, which left too much dead space on desktop.
     Capped so lines never get so long the eye loses its place returning to
     the left margin. */
  --measure: clamp(38rem, 26rem + 22vw, 54rem);
  --page:    72rem;

  /* Motion */
  --transition: 120ms ease;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

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

body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul[class], ol[class] {
  padding: 0;
  list-style: none;
}

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

a { color: inherit; }

h1, h2, h3 { text-wrap: balance; }

/* --------------------------------------------------------------------------
   3. Base elements
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  /* Deep-linked service headings would otherwise sit flush against the top. */
  scroll-padding-top: 2rem;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  -webkit-text-size-adjust: 100%;
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy);
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--navy);
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
  color: var(--navy);
}

p + p { margin-top: 1em; }

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--transition);
}

a:hover { color: var(--ocean); }

:focus-visible {
  outline: 3px solid var(--ocean);
  outline-offset: 2px;
  border-radius: 2px;
}

strong { font-weight: 650; }

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--space-gutter);
}

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

.band--tint  { background: var(--tint); }

.band--navy  {
  background: var(--navy);
  color: var(--white);
}

.band--navy h2 { color: var(--white); }

/* Constrain running prose to a comfortable line length even in a wide band. */
.measure { max-width: var(--measure); }

.lead {
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--muted);
}

.section-intro { margin-bottom: 2.5rem; }
.section-intro .lead { margin-top: 0.75rem; }

/* Page opener: h1, lead, then running prose.
   Centered on the page, with the prose justified to both margins.
   `hyphens: auto` is not optional here — justified text without hyphenation
   opens ugly word gaps and vertical "rivers" on narrow screens. */
.hero .lead  { margin-top: 1rem; }
.hero .stack { margin-top: 2rem; }

.hero h1,
.hero .lead {
  text-align: center;
}

.hero .measure {
  margin-inline: auto;
}

/* Justify only where the line is long enough to carry it. Below 48rem a line
   holds ~35 characters, and justifying that opens large word gaps and vertical
   "rivers" — worse than a ragged right edge. */
@media (min-width: 48rem) {
  .hero .stack p {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
  }
}

/* Off-screen icon sprite holder. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   5. Components
   -------------------------------------------------------------------------- */

/* 5.1 Skip link ----------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--navy);
  color: var(--white);
  text-decoration: none;
  border-radius: 4px;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--white);
}

/* 5.2 Site header --------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--white);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}

.brand img { flex: none; }

.brand__name {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.brand__tagline {
  display: block;
  font-size: var(--fs-xs);
  line-height: 1.3;
  color: var(--muted);
  margin-top: 0.15rem;
  max-width: 44ch;
}

/* The tagline is long. Below 30rem it would push the nav off the fold. */
@media (max-width: 30rem) {
  .brand__tagline { display: none; }
}

/* 5.3 Navigation ---------------------------------------------------------- */

/* A <details> element gives a working disclosure menu with no JavaScript.
   Above 48rem it is neutered: the summary hides and the panel is always
   visible, so the element's open/closed state stops mattering. */

.nav { width: 100%; }

.nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  list-style: none;              /* remove the default disclosure triangle */
  user-select: none;
}

.nav__toggle::-webkit-details-marker { display: none; }
.nav__toggle::marker { content: ""; }

.nav__panel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.75rem;
}

.nav__links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 0.6rem 0.25rem;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.nav__links a:hover { color: var(--ocean); }

.nav__links a[aria-current="page"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.nav__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.75rem;
}

@media (min-width: 48rem) {
  .nav {
    width: auto;
    display: flex;
    align-items: center;
  }

  .nav__toggle { display: none; }

  /* Reveal the panel at desktop width whether or not the <details> is open.
     Two mechanisms are needed because browsers hide closed <details> content
     two different ways: older engines with `display:none` on non-summary
     children, newer Chromium via content-visibility on ::details-content.
     Overriding only one leaves the navigation invisible on the other. */
  .nav > .nav__panel { display: flex; }

  .nav::details-content {
    content-visibility: visible;
    block-size: auto;
  }

  .nav__panel {
    flex-direction: row;
    align-items: center;
    gap: 1.75rem;
    padding-top: 0;
  }

  .nav__links {
    flex-direction: row;
    gap: 1.5rem;
  }

  .nav__links a { padding: 0.25rem 0; }

  .nav__actions {
    padding-top: 0;
    flex-wrap: nowrap;
  }
}

/* 5.4 Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--blue);
  border-radius: 4px;
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition);
}

.btn--primary {
  background: var(--blue);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.btn--secondary {
  background: transparent;
  color: var(--blue);
}

.btn--secondary:hover {
  background: var(--blue);
  color: var(--white);
}

/* On the navy band the palette inverts — --blue on --navy has nowhere near
   enough contrast to be legible. */
.band--navy .btn--primary {
  background: var(--white);
  border-color: var(--white);
  color: var(--navy);
}

.band--navy .btn--primary:hover {
  background: var(--tint);
  border-color: var(--tint);
  color: var(--navy);
}

.band--navy .btn--secondary {
  border-color: var(--white);
  color: var(--white);
}

.band--navy .btn--secondary:hover {
  background: var(--white);
  color: var(--navy);
}

.band--navy :focus-visible { outline-color: var(--white); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 26rem) {
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }
}

/* 5.5 Service cards ------------------------------------------------------- */

/* auto-fit + minmax adapts the column count with no media queries. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.band--tint .card { background: var(--white); }

.card__icon {
  width: 32px;
  height: 32px;
  color: var(--green);
  flex: none;
}

.card h3 { margin: 0; }

.card p {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.card a {
  font-weight: 600;
  text-decoration: none;
}

.card a:hover { text-decoration: underline; }

/* A whole card that links somewhere: the heading anchor is stretched over
   the card so the entire block is clickable, while the link text stays
   meaningful for screen readers. */
.card--link { position: relative; }

.card--link h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
}

.card--link:hover {
  border-color: var(--ocean);
}

/* 5.6 Service detail (Services page) -------------------------------------- */

/* Each service group is its own alternating band; the head pairs its icon
   with the heading. */
.service__head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}

.service__head .card__icon {
  width: 36px;
  height: 36px;
  margin-top: 0.15rem;
}

.service__intro {
  color: var(--muted);
  margin-bottom: 1.5rem;
  max-width: var(--measure);
}

/* 5.7 Multi-column lists -------------------------------------------------- */

/* Used for the service bullet lists, the project-type list, and the
   industries list. Column count adapts without media queries. */
.list-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.4rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-cols li {
  position: relative;
  padding-left: 1.5rem;
  line-height: 1.5;
  padding-block: 0.25rem;
}

.list-cols li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.85em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--leaf);
}

/* 5.8 Reasons (Why Choose Us) --------------------------------------------- */

.reasons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.75rem 2.5rem;
  margin: 0;
}

.reasons dt {
  font-weight: 700;
  color: var(--navy);
  font-size: var(--fs-h3);
  line-height: 1.3;
}

.reasons dd {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

/* 5.9 Pull quote ---------------------------------------------------------- */

.statement {
  border-left: 4px solid var(--green);
  padding-left: 1.25rem;
  font-size: var(--fs-lg);
  line-height: 1.45;
  color: var(--forest);
  max-width: var(--measure);
}

/* 5.10 Bio ---------------------------------------------------------------- */

/* The headshot slot is written and styled but renders nothing until a real
   photo exists. The layout sits correctly with or without it. */
.bio {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem 2.5rem;
  align-items: start;
}

.bio__portrait { display: none; }          /* no photo yet — see spec §7.2.1 */

.bio:has(.bio__portrait img) {
  grid-template-columns: minmax(0, 14rem) 1fr;
}

.bio:has(.bio__portrait img) .bio__portrait {
  display: block;
}

.bio__portrait img {
  width: 100%;
  border-radius: 6px;
}

.credentials-heading {
  margin-top: 2rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.credentials {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
  max-width: 46rem;
}

.credentials li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.credentials li::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.5em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
}

/* 5.11 Contact details ---------------------------------------------------- */

.contact-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem 2.5rem;
  margin: 0 0 2rem;
}

.contact-details dt {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.contact-details dd {
  margin: 0.25rem 0 0;
  font-size: var(--fs-lg);
  line-height: 1.4;
  color: var(--navy);
}

.contact-details a { text-decoration: none; }
.contact-details a:hover { text-decoration: underline; }

/* The service area is a sentence, not a short value like phone or email. On
   its own full-width row at body size it reads as prose; left in the column
   grid it towered over the three short entries beside it. */
.contact-details__wide { grid-column: 1 / -1; }

.contact-details__wide dd {
  font-size: var(--fs-base);
  max-width: var(--measure);
}

/* 5.12 Closing contact band ----------------------------------------------- */

.contact-band { text-align: center; }

.contact-band p {
  margin: 0.75rem auto 1.75rem;
  max-width: 44rem;
  color: #cfdaee;
}

.contact-band .btn-row { justify-content: center; }

/* 5.13 Footer ------------------------------------------------------------- */

.site-footer {
  padding-block: 2.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

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

.site-footer__legal { margin: 0; }

/* 5.14 Legal page --------------------------------------------------------- */

/* Terms and disclaimer: one column of short clauses. These need their own
   vertical rhythm because the reset zeroes heading margins site-wide, so an
   h2 would otherwise sit flush against the paragraph it introduces. The
   headings drop to h3 size — there are nine of them and they are signposts,
   not section titles. */

.legal > h2 {
  font-size: var(--fs-h3);
  margin-top: 2.5rem;
}

.legal > h2:first-child { margin-top: 0; }

.legal > h2 + p { margin-top: 0.6rem; }

/* Sits under the h1 in the hero, which centers its own box but not this. */
.legal__updated {
  margin-top: 1rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------------------
   6. Utilities
   -------------------------------------------------------------------------- */

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

.stack > * + * { margin-top: 1.5rem; }

/* Closing sentence after a list or grid. */
.trailing { margin-top: 2rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   7. Print
   People in this industry print pages and attach them to project files.
   -------------------------------------------------------------------------- */

@media print {
  .nav, .contact-band, .skip-link { display: none; }

  body {
    font-size: 11pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }

  .band, .band--tint, .band--navy {
    background: #fff !important;
    color: #000 !important;
    padding-block: 1rem;
  }

  .card { break-inside: avoid; }

  h1, h2, h3 { color: #000; }

  a { color: #000; text-decoration: underline; }

  /* Expand link targets, since a printed page cannot be clicked. */
  main a[href^="http"]::after,
  main a[href^="mailto"]::after,
  main a[href^="tel"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    word-break: break-all;
  }
}
