/* ============================================================
   Gervais Heating and A/C — Andover, MA
   Quiet excellence. Warm paper + moss. Editorial restraint.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Warm paper (light, default) */
  --paper: #f5f1ea;
  --paper-2: #ecE6dc;
  --paper-3: #e1d9cb;
  --ink: #1f1c17;
  --ink-2: #4a4338;
  --ink-3: #7a7164;
  --rule: rgba(31, 28, 23, 0.12);
  --rule-2: rgba(31, 28, 23, 0.07);
  --accent: #2f3d2a;       /* deep moss */
  --accent-2: #4a6240;     /* mid moss */
  --accent-soft: #e3e8da;  /* moss tint */
  --gold: #8a6a1f;         /* restrained italic accent ink for stars */
  --field-bg: #ffffff;
  --field-rule: rgba(31, 28, 23, 0.18);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --max: 1140px;
  --gutter: clamp(20px, 5vw, 56px);

  --serif: 'Fraunces', 'Iowan Old Style', 'Charter', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --paper-2: #1d1a14;
    --paper-3: #25211a;
    --ink: #ece6d8;
    --ink-2: #b3aa97;
    --ink-3: #847c6c;
    --rule: rgba(236, 230, 216, 0.12);
    --rule-2: rgba(236, 230, 216, 0.06);
    --accent: #94b080;
    --accent-2: #b6c9a7;
    --accent-soft: #232a1d;
    --gold: #d2b15a;
    --field-bg: #1d1a14;
    --field-rule: rgba(236, 230, 216, 0.18);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv11';
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 12px 16px; z-index: 1000; border-radius: 4px;
}
.skip-link:focus { left: 16px; top: 16px; }

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Eyebrow + section titles ---------- */
.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 22px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.012em;
  color: var(--ink);
  max-width: 22ch;
}
.section-title__soft { color: var(--ink-3); font-style: italic; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule-2);
}
.nav__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: baseline; gap: 24px;
}
.nav__brand {
  display: inline-flex; align-items: baseline; gap: 10px;
  transition: opacity 200ms var(--ease-out);
}
.nav__brand:hover { opacity: 0.75; }
.nav__brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.nav__brand-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.nav__links {
  display: none;
  margin-left: auto;
  gap: 28px;
}
.nav__links a {
  font-size: 14px;
  color: var(--ink-2);
  position: relative;
  transition: color 180ms var(--ease-out);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: -4px;
  height: 1px; background: var(--ink);
  transition: right 220ms var(--ease-out);
}
.nav__links a:hover::after { right: 0; }
.nav__phone {
  margin-left: auto;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color 180ms var(--ease-out);
}
.nav__phone:hover { color: var(--accent-2); }

@media (min-width: 760px) {
  .nav__links { display: inline-flex; }
  .nav__phone { margin-left: 0; }
}

/* ---------- Sticky CTA (mobile only) ---------- */
.cta-sticky {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 160ms var(--ease-out);
  font-variant-numeric: tabular-nums;
}
.cta-sticky:active { transform: scale(0.985); }
.cta-sticky__label { font-size: 13px; opacity: 0.7; letter-spacing: 0.04em; text-transform: uppercase; }
.cta-sticky__num { font-size: 17px; }

@media (min-width: 760px) {
  .cta-sticky { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 9vw, 96px) var(--gutter) clamp(48px, 7vw, 80px);
  position: relative;
}
.hero__inner {
  max-width: 880px;
}
.hero__lede {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6.4vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 6px 0 44px;
  max-width: 18ch;
  opacity: 0;
  animation: fadeUp 700ms var(--ease-out) 80ms forwards;
}
.hero__lede-em {
  font-style: italic;
  color: var(--accent);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* The rating — the "quiet flex" */
.rating {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: clamp(18px, 3vw, 32px);
  row-gap: 6px;
  align-items: center;
  padding: 24px 0 28px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 0 0 36px;
  opacity: 0;
  animation: fadeUp 700ms var(--ease-out) 200ms forwards;
}
.rating__num {
  grid-column: 1; grid-row: 1 / span 2;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(64px, 12vw, 132px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: lining-nums;
}
.rating__stars {
  grid-column: 2; grid-row: 1;
  display: inline-flex;
  gap: 4px;
  align-self: end;
  color: var(--gold);
}
.rating__star {
  width: 16px; height: 16px;
  fill: currentColor;
}
.rating__cap {
  grid-column: 2; grid-row: 2;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 38ch;
  align-self: start;
}
.rating__cap strong { color: var(--ink); font-weight: 600; }
.rating__cap-soft { color: var(--ink-3); }

/* CTAs */
.hero__actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 0 0 44px;
  opacity: 0;
  animation: fadeUp 700ms var(--ease-out) 320ms forwards;
}

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-rule: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-rule);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 160ms var(--ease-out),
              background 180ms var(--ease-out),
              color 180ms var(--ease-out),
              border-color 180ms var(--ease-out);
  font-variant-numeric: tabular-nums;
}
.btn:active { transform: scale(0.97); }
.btn--primary { --btn-bg: var(--ink); --btn-fg: var(--paper); }
.btn--primary:hover { --btn-bg: var(--accent); }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-rule: var(--rule);
}
.btn--ghost:hover {
  --btn-bg: var(--paper-2);
  --btn-rule: var(--ink-3);
}
.btn--block { width: 100%; padding: 16px 22px; font-size: 16px; }

/* Hero meta — small key/value table */
.hero__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  border-top: 1px solid var(--rule-2);
  padding-top: 24px;
  max-width: 640px;
  opacity: 0;
  animation: fadeUp 700ms var(--ease-out) 440ms forwards;
}
.hero__meta li {
  display: flex; flex-direction: column; gap: 2px;
}
.hero__meta-k {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hero__meta-v {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

@media (min-width: 720px) {
  .hero__meta { grid-template-columns: repeat(4, 1fr); }
}

/* Hero side quote, wider screens only */
.hero__quote { display: none; }
@media (min-width: 1080px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; align-items: end; }
  .hero__inner { grid-column: 1; }
  .hero__quote {
    display: block;
    grid-column: 2;
    margin-bottom: 12px;
    padding-left: 24px;
    border-left: 1px solid var(--rule);
    font-family: var(--serif);
    font-style: italic;
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink-2);
    max-width: 28ch;
  }
}

/* ---------- Work / Services ---------- */
.work {
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.work__head {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 88px) var(--gutter) clamp(28px, 4vw, 40px);
}
.work__list {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(48px, 7vw, 72px);
  display: grid;
  gap: 0;
}
.work__row {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: clamp(16px, 3vw, 28px);
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  position: relative;
  transition: background 200ms var(--ease-out);
}
.work__row:last-child { border-bottom: 1px solid var(--rule); }
.work__row:hover { background: var(--paper-2); }
.work__num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
  letter-spacing: 0.02em;
}
.work__body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 2.4vw, 24px);
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}
.work__body p {
  font-size: 15.5px;
  color: var(--ink-2);
  max-width: 56ch;
  line-height: 1.55;
}
.work__rail { display: none; }

@media (min-width: 860px) {
  .work__row { grid-template-columns: 80px 1fr 1px; }
  .work__rail {
    display: block;
    background: var(--rule);
    height: 100%;
    justify-self: end;
  }
}

/* ---------- Towns ---------- */
.towns {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}
.towns__head {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 80px) var(--gutter) clamp(20px, 3vw, 28px);
}
.towns__lead {
  margin-top: 18px;
  font-size: 16px;
  color: var(--ink-2);
  max-width: 56ch;
  line-height: 1.6;
}
.towns__list {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(56px, 7vw, 80px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.towns__list li {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: transform 180ms var(--ease-out), border-color 200ms var(--ease-out);
}
.towns__list li:hover {
  border-color: var(--accent-2);
  transform: translateY(-1px);
}
.towns__pin {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- About ---------- */
.about {
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.about__copy {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--gutter) clamp(28px, 4vw, 48px);
  display: grid;
  gap: 32px;
}
.about__prose p {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0 0 18px;
}
.about__prose p:last-child { margin-bottom: 0; }
.about__prose strong { color: var(--ink); font-weight: 600; }

@media (min-width: 920px) {
  .about__copy {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 80px;
    align-items: start;
  }
}

.about__facts {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(56px, 7vw, 80px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
}
.about__facts > div {
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}
.about__facts dt {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.about__facts dd {
  margin: 0 0 8px;
}
.about__facts-num {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 56px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: lining-nums;
}
.about__facts-num em {
  font-style: italic;
  color: var(--accent);
}
.about__facts p {
  font-size: 14.5px;
  color: var(--ink-2);
  max-width: 32ch;
  margin: 0;
  line-height: 1.5;
}

@media (min-width: 760px) {
  .about__facts {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 48px;
  }
}
@media (min-width: 1080px) {
  .about__facts {
    grid-template-columns: repeat(4, 1fr);
    column-gap: 40px;
  }
  .about__facts > div { border-bottom: none; }
}

/* ---------- Quote / Request ---------- */
.quote {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}
.quote__inner {
  max-width: 840px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--gutter) clamp(72px, 9vw, 120px);
}
.quote__lead {
  margin: 18px 0 36px;
  font-size: 16px;
  color: var(--ink-2);
  max-width: 56ch;
}
.quote__phone {
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--ink-3);
  transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out);
  font-variant-numeric: tabular-nums;
}
.quote__phone:hover { color: var(--accent); border-color: var(--accent); }

.form { margin-top: 12px; }
.form__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
@media (min-width: 640px) {
  .form__grid { grid-template-columns: 1fr 1fr; }
  .field--full { grid-column: 1 / -1; }
}

.field { display: grid; gap: 8px; }
.field__label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.field__opt { color: var(--ink-3); font-weight: 400; }
.field__input {
  background: var(--field-bg);
  border: 1px solid var(--field-rule);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15.5px;
  color: var(--ink);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
  width: 100%;
}
.field__input::placeholder { color: var(--ink-3); }
.field__input:hover { border-color: var(--ink-3); }
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea.field__input { resize: vertical; min-height: 96px; line-height: 1.5; }
select.field__input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%23847c6c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 38px;
}

.form__success {
  padding: 18px 20px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.55;
}
.form__success strong { color: var(--accent); font-weight: 600; }
.form__success a {
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */
.foot {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding-bottom: 80px; /* room for mobile sticky CTA */
}
@media (min-width: 760px) { .foot { padding-bottom: 0; } }

.foot__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 6vw, 64px) var(--gutter) clamp(28px, 4vw, 40px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}
@media (min-width: 720px) {
  .foot__inner { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 40px; }
}
.foot__brand {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 12px;
}
.foot__addr {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 14px;
}
.foot__phone {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}
.foot__phone:hover { color: var(--accent); border-color: var(--accent); }

.foot__head {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
}
.foot__list { display: grid; gap: 10px; font-size: 14.5px; color: var(--ink-2); }
.foot__list li { display: flex; justify-content: space-between; gap: 16px; }
.foot__list a { transition: color 180ms var(--ease-out); }
.foot__list a:hover { color: var(--ink); }
.foot__list li span:last-child { color: var(--ink); }

.foot__rule {
  height: 1px;
  background: var(--rule);
  margin-left: var(--gutter);
  margin-right: var(--gutter);
}
.foot__bottom {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--gutter) 28px;
  display: flex; flex-direction: column; gap: 8px;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-3);
}
.foot__bottom a {
  color: var(--ink-2);
  transition: color 180ms var(--ease-out);
}
.foot__bottom a:hover { color: var(--accent); }
.foot__copy, .foot__built { margin: 0; }
@media (min-width: 640px) {
  .foot__bottom { flex-direction: row; align-items: center; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero__lede, .rating, .hero__actions, .hero__meta {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- Touch hover gating ---------- */
@media (hover: none) {
  .work__row:hover { background: transparent; }
  .towns__list li:hover { transform: none; border-color: var(--rule); }
  .nav__brand:hover { opacity: 1; }
}
