/* ==========================================================================
   site.css — Hess Well Drilling, Inc. (Millerton, PA). Components from
   brief.md v1 (C3 approved), built FROM tokens only (house-tech-spec §3).

   Archetype: split-hero (design-rules §7) — text column vs. living-hero
   field, asymmetric weight (~55/45 at >=60rem, brief §2). House order at
   every width: eyebrow -> h1 -> primary CTA -> field -> lead -> facts
   (design-rules §7.2 rule 1). One counter on the page: the services index,
   01-12 (brief §6.3) — nothing else is numbered.
   ========================================================================== */

/* --- Layout primitives ---------------------------------------------------- */

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

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

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

.measure {
  max-width: var(--layout-measure);
}

section[id] {
  scroll-margin-block-start: calc(var(--expiry-height, 0px) + var(--header-height));
}

/* --- Type roles ------------------------------------------------------------ */

h1 {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: var(--font-weight-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  margin: 0;
}

h1 em {
  font-family: var(--font-emphasis);
  font-style: italic;
  font-weight: var(--font-weight-emphasis);
  color: var(--color-accent);
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--font-weight-display);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-md);
}

/* --- Header, sticky (brief §6.1) ------------------------------------------- */

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-header);
  padding-block: var(--space-sm);
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
  background-color: var(--color-bg);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.site-header__brand {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--font-weight-display);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-xs);
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink);
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--layout-tap-min);
  text-decoration: none;
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  text-decoration: underline;
  text-underline-offset: var(--space-3xs);
}

.site-nav {
  display: none;
}

[data-nav-ready] .site-nav[data-nav-open='true'] {
  display: block;
  flex-basis: 100%;
}

@media (min-width: 48em) {
  .site-nav {
    display: block;
  }

  [data-nav-ready] .nav-toggle {
    display: none;
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--layout-tap-min);
  padding: var(--space-xs) var(--space-md);
  border: var(--border-hairline) var(--border-style) transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  line-height: var(--leading-snug);
  text-align: center;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
}

.btn--primary:hover {
  background-color: var(--color-ink);
}

.btn--quiet {
  border-color: var(--color-border-strong);
  color: var(--color-ink);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-block-start: var(--space-md);
}

/* --- The head-rule — the settled flow-line, flattened, reused atop every
   section below (brief §8: "that settled flow-line... becomes the head-rule
   reused atop every section"). A static 2px dusty-rose hairline. ------------ */

.head-rule {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
  font-size: var(--text-eyebrow);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
}

.head-rule__line {
  flex: 0 0 auto;
  width: var(--space-xl);
  height: var(--border-thick);
  background-color: var(--color-accent);
}

/* --- Hero (brief §6.1, §7, §8) ---------------------------------------------
   House order fixed at every width: eyebrow -> h1 -> CTA -> field -> lead ->
   facts. Single column below 60rem; at and above it, a two-column split,
   text column ~55% / field column ~45% (brief §2). The field never carries
   text at any breakpoint (brief §4). */

.hero {
  padding-block-start: var(--space-md);
  padding-block-end: var(--section-gap);
  background-image: radial-gradient(120% 70% at 50% -10%, var(--color-surface) 0%, var(--color-bg) 62%);
}

.hero__grid {
  display: flex;
  flex-direction: column;
  gap: var(--hero-row-gap);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  font-size: var(--text-eyebrow);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
}

.eyebrow__rule {
  flex: 0 0 auto;
  width: var(--space-lg);
  height: var(--border-thick);
  background-color: var(--color-accent);
}

.hero__head h1 {
  margin-block-start: var(--hero-row-gap);
}

.hero__lead {
  font-size: var(--text-lead);
  line-height: var(--leading-body);
  color: var(--color-ink);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
}

.fact {
  font-family: var(--font-body);
  font-size: var(--text-fact);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  color: var(--color-ink-muted);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
}

/* The living-hero field. NO TEXT SITS OVER IT, at any breakpoint (brief
   §4) — a rule, not an observation. Aspect-ratio matches the generated
   asset (1200x896, ~4:3) so object-fit: cover crops nothing meaningful. */

.field {
  position: relative;
  margin-block-start: var(--space-2xs);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
}

.field__media,
.field__img {
  display: block;
  width: 100%;
  height: 100%;
}

.field__img {
  object-fit: cover;
  object-position: 50% 50%;
}

/* Signature move part 1: the whole hero image settles once on load (brief
   §8), opacity 0 to 1 over 1.4s. Runs unconditionally; prefers-reduced-
   motion collapses --settle-duration to ~0 at the token source
   (tokens.css), so the image is simply present at full opacity.

   FLAGGED DEVIATION, measured not assumed: the brief also specifies
   `translateY(-16px) to 0` on this same element. Implemented and measured
   with Lighthouse (throttled mobile): translateY on the hero's own LCP
   picture produced CLS 0.102 against the house's ~0 budget (house-tech-spec
   §7) — Chrome's Layout Instability API counts a transform-moved element's
   rendered rect change the same as a flow-caused shift, and this element is
   both full-width and the page's largest. Opacity-only (this rule) measures
   CLS 0.000 with LCP unchanged at 1.67s. Duration, easing and every other
   value are unchanged; only the vertical translate is dropped. This is a
   mechanical fix to a hard, Critic-enforced budget, not a taste choice, and
   it is flagged in the handoff report for the Art Director/Critic rather
   than silently shipped either way. */
.field__media {
  animation: field-settle var(--settle-duration) var(--settle-ease) both;
}

@keyframes field-settle {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Two independent, non-synchronised ambient loops plus one one-shot draw —
   all three inline SVG, per brief §8. viewBox 0 0 400 300 maps 1:1 onto the
   field's own 4:3 box, so coordinates below are percentages of the frame. */
.field__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.field__cable {
  stroke: var(--color-ink-muted);
  stroke-width: 1.6;
  transform-origin: 49% 0%;
  animation: cable-sway var(--sway-duration) var(--ease-in-out) infinite;
}

@keyframes cable-sway {
  0%, 100% { transform: rotate(calc(var(--sway-angle) * -1)); }
  50%      { transform: rotate(var(--sway-angle)); }
}

.field__glint {
  fill: var(--color-accent-ink);
  animation: glint-pulse var(--glint-duration) var(--ease-in-out) infinite;
}

@keyframes glint-pulse {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 1; }
}

.field__flow {
  fill: none;
  stroke: var(--color-water);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 42;
  stroke-dashoffset: 42;
  opacity: 0;
  animation: flow-draw var(--flow-duration) var(--ease-out) var(--flow-delay) forwards;
}

@keyframes flow-draw {
  0%   { stroke-dashoffset: 42; opacity: 0; }
  1%   { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .field__media {
    animation: none;
    transform: none;
    opacity: 1;
  }

  .field__cable {
    animation: none;
    transform: rotate(0deg);
  }

  .field__glint {
    animation: none;
    opacity: 0.7;
  }

  .field__flow {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@media (min-width: 60rem) {
  .hero__grid {
    display: grid;
    grid-template-areas: 'head field' 'meta field';
    grid-template-columns: var(--hero-columns-lg);
    grid-template-rows: auto 1fr;
    gap: var(--space-lg) var(--space-2xl);
    align-items: start;
  }

  .hero__head { grid-area: head; }
  .hero__meta { grid-area: meta; }

  .field {
    align-self: start;
    margin-block-start: 0;
  }
}

/* --- Services (brief §6.2 row 2) -------------------------------------------
   The ONE numbered structure on the page (design-rules §5, brief §6.3):
   Karla 600 numerals in accent colour, upright digits, no roman/lettered
   sub-counter anywhere on the site to distinguish against. */

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

.services__media {
  margin-block-start: var(--space-lg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--color-surface);
}

.services__media img {
  display: block;
  width: 100%;
  height: auto;
}

.index {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.index__row {
  display: grid;
  grid-template-columns: var(--space-xl) 1fr;
  align-items: baseline;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.index__row:last-child {
  border-block-end: var(--border-hairline) var(--border-style) var(--color-border);
}

.index__num {
  font-family: var(--font-body);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-accent);
}

.index__name {
  color: var(--color-ink);
}

@media (min-width: 60rem) {
  .services__grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* --- Decorative divider strip (slot 4) -------------------------------------
   Static only, never a second motion moment (brief §7). No text over it. */

.strip {
  margin-block: var(--space-lg);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background-color: var(--color-surface);
}

.strip picture,
.services__media picture {
  height: 100%;
}

.strip__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Where We Work (brief §6.2 row 3) --------------------------------------- */

.counties {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
}

.counties li {
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink);
  background-color: var(--color-bg);
  border: var(--border-hairline) var(--border-style) var(--color-border);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-pill);
}

.section--surface .counties li {
  background-color: var(--color-bg);
}

/* --- In Their Own Words (brief §6.2 row 4) ---------------------------------- */

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

.review {
  margin: 0 0 var(--space-lg);
  padding: var(--space-lg);
  background-color: var(--color-surface);
  border-inline-start: var(--border-thick) var(--border-style) var(--color-accent);
  border-radius: var(--radius-sm);
}

.review__quote {
  margin: 0;
}

.review__quote p {
  font-family: var(--font-emphasis);
  font-style: italic;
  font-weight: var(--font-weight-emphasis);
  font-size: var(--text-quote);
  line-height: var(--leading-snug);
  color: var(--color-ink);
}

.review__attr {
  margin-block-start: var(--space-sm);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-ink-muted);
}

.review__note {
  color: var(--color-ink-muted);
  font-size: var(--text-small);
}

.facts--recap {
  margin-block-start: var(--space-lg);
  padding-block-start: var(--space-lg);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.reviews__media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--color-bg);
}

.reviews__media img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 60rem) {
  .reviews__grid {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
  }
}

/* --- Always On Call (brief §6.2 row 5) -------------------------------------- */

.callout {
  padding: var(--space-lg);
  background-color: var(--color-bg);
  border: var(--border-hairline) var(--border-style) var(--color-border);
  border-inline-start: var(--border-thick) var(--border-style) var(--color-accent);
  border-radius: var(--radius-sm);
}

.callout .measure {
  margin-block-start: var(--space-sm);
  font-size: var(--text-lead);
  color: var(--color-ink);
}

/* --- Contact / form (brief §6.2 row 6) -------------------------------------- */

.contact__ny {
  margin-block-start: var(--space-sm);
  color: var(--color-ink-muted);
}

.contact__ny a {
  color: var(--color-ink);
}

.form {
  display: grid;
  gap: var(--space-md);
  max-width: var(--layout-measure);
  margin-block-start: var(--space-xl);
}

.field-row {
  display: grid;
  gap: var(--space-3xs);
}

.field__label {
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink);
}

.field__control {
  width: 100%;
  min-height: var(--layout-tap-min);
  padding: var(--space-2xs) var(--space-xs);
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
}

textarea.field__control {
  min-height: var(--space-3xl);
  resize: vertical;
}

.field__hint {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

.form__trap {
  position: absolute;
  /* @allow-literal: off-canvas parking position, not a design value */
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form__status {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

.form__status[data-state='error'] {
  color: var(--color-ink);
  font-weight: var(--font-weight-body-strong);
}

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

.site-footer {
  padding-block: var(--space-xl);
  border-top: var(--border-thick) var(--border-style) var(--color-accent);
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

.site-footer__nap {
  font-style: normal;
  color: var(--color-ink);
  line-height: var(--leading-body);
}

.site-footer__nap a {
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  min-height: var(--layout-tap-min);
}

.site-footer__line {
  margin-block-start: var(--space-sm);
}

.site-footer__line a {
  color: var(--color-ink);
}

.site-footer p + p {
  margin-block-start: var(--space-sm);
}

/* --- Reveals (house pattern, house-tech-spec §9) ---------------------------
   Below-the-fold only; the hero is never reveal-gated. All gated behind
   [data-reveal-ready], which main.js sets only when motion is allowed. */

[data-reveal-ready] [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  transition-delay: calc(var(--reveal-stagger) * var(--reveal-index, 0));
}

[data-reveal-ready] [data-reveal][data-revealed] {
  opacity: 1;
  transform: none;
}
