/* Ruban Electrical Contractors. Fresh build, no shared chassis.
   Ledger calm on porcelain, one aubergine accent, bottom-docked control bar.
   Body type scale: 14 / 15.5 / 17 / 18.5. */

/* ---------- base ---------- */

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

html, body { overflow-x: clip; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--porcelain);
  /* ambient ledger pinstripe, static, ~2.5 percent */
  background-image: repeating-linear-gradient(
    90deg,
    rgba(34, 30, 26, 0.025) 0 1px,
    transparent 1px 72px
  );
  padding-bottom: var(--bar-h);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 var(--s2);
  letter-spacing: 0.005em;
}

h1 { font-size: clamp(34px, 5.2vw, 62px); }
h2 { font-size: clamp(25px, 3vw, 36px); }
h3 { font-size: clamp(20px, 2.2vw, 25px); }

p { margin: 0 0 var(--s2); max-width: var(--measure); }

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

svg[hidden] { display: none; }

a { color: var(--plum); text-decoration-color: rgba(107, 42, 94, 0.4); text-underline-offset: 3px; transition: text-decoration-color var(--t-ui) var(--ease-settle), color var(--t-ui) var(--ease-settle); }
a:hover { text-decoration-color: var(--plum); }

::selection { background: var(--plum); color: var(--on-plum); }

html { scrollbar-color: var(--muted) var(--porcelain); }

:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; border-radius: 1px; }
.cellar :focus-visible, .controlbar :focus-visible, .callbar :focus-visible { outline-color: var(--warm-fill); }

[id] { scroll-margin-top: 24px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(20px, 4vw, 44px); }

.skip {
  position: absolute; left: 12px; top: 12px; z-index: 300;
  background: var(--ink); color: var(--cellar-text);
  padding: 10px 18px; font-family: var(--display); font-size: 15.5px;
  transform: translateY(-200%); transition: transform var(--t-fast);
}
.skip:focus-visible { transform: none; }

.ic { width: 18px; height: 18px; flex: none; }

/* numerals read like a ledger */
.cb-phone, .menu-phone, .tel-ledger, .lede-tel { font-variant-numeric: tabular-nums; }

/* ---------- desktop bottom control bar ---------- */

.controlbar {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  height: var(--bar-h);
  display: flex; align-items: center; gap: var(--s4);
  padding-inline: clamp(16px, 3vw, 40px);
  background: var(--ink);
  color: var(--cellar-text);
  border-top: 1px solid rgba(239, 234, 224, 0.14);
}
.cb-name {
  font-family: var(--display); font-weight: 500; font-size: 15.5px;
  letter-spacing: 0.04em; color: var(--cellar-text); text-decoration: none;
  white-space: nowrap;
}
.cb-name:hover { color: #fff; }
.cb-nav { display: flex; gap: clamp(14px, 2.4vw, 34px); margin-inline: auto; }
.cb-nav a {
  font-family: var(--display); font-size: 15.5px; letter-spacing: 0.03em;
  color: var(--cellar-muted); text-decoration: none;
  padding: 6px 2px; position: relative;
}
.cb-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  border-bottom: 2px solid var(--warm-fill);
  transition: right var(--t-ui) var(--ease-settle);
}
.cb-nav a:hover, .cb-nav a[aria-current="page"] { color: var(--cellar-text); }
.cb-nav a:hover::after, .cb-nav a[aria-current="page"]::after { right: 0; }
.cb-phone {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: 0.02em;
  color: var(--cellar-text); text-decoration: none; white-space: nowrap;
}
.cb-phone .ic { color: var(--warm-fill); }
.cb-phone:hover { color: #fff; }

/* ---------- mobile top bar and menu ---------- */

.tophead { display: none; }
.menu { display: none; }

/* ---------- buttons: ruled outline, no solid accent rectangles ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 12px;
  background: transparent; color: var(--plum);
  font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: 0.04em;
  padding: 14px 26px; border: 1.5px solid var(--plum); border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
  transition: background var(--t-ui) var(--ease-settle), transform var(--t-fast) var(--ease-settle);
}
.btn:hover { background: rgba(107, 42, 94, 0.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); transition-duration: var(--t-fast); }
.btn .ic { width: 17px; height: 17px; }

.textline {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--display); font-size: 15.5px; letter-spacing: 0.02em;
  color: var(--plum); text-decoration: none;
  border-bottom: 1px solid rgba(107, 42, 94, 0.35);
  padding-bottom: 3px;
  transition: border-color var(--t-ui), gap var(--t-ui) var(--ease-settle);
}
.textline:hover { border-color: var(--plum); gap: 13px; }
.cellar .textline { color: var(--warm-fill); border-color: rgba(243, 226, 206, 0.4); }
.cellar .textline:hover { border-color: var(--warm-fill); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: min(calc(100vh - var(--bar-h)), 880px);
  display: flex; align-items: flex-end;
  isolation: isolate;
  color: var(--porcelain);
  overflow: clip;
}
.hero-img { position: absolute; inset: 0; z-index: -3; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-scrim {
  position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(180deg, rgba(34, 30, 26, 0.30) 0%, rgba(34, 30, 26, 0.18) 45%, rgba(34, 30, 26, 0.78) 100%);
}
/* the one slow ambient: the duotone breathes its warmth, ~18s */
.hero-warmth {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(160deg, rgba(107, 42, 94, 0.16), rgba(138, 107, 46, 0.10) 60%, rgba(107, 42, 94, 0.05));
  opacity: 0.25;
  animation: breathe 18s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.65; }
}

.hero-inner { width: 100%; padding-block: var(--s12) var(--s8); }

.lockup {
  display: inline-block;
  border-top: 1px solid rgba(241, 238, 231, 0.7);
  border-bottom: 1px solid rgba(241, 238, 231, 0.7);
  padding: 9px 4px;
  margin-bottom: var(--s4);
  font-family: var(--display); font-weight: 500; font-size: 14px;
  letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--porcelain);
}
.hero h1 { max-width: 13ch; text-wrap: balance; margin-bottom: var(--s3); }
.hero-line { font-size: 18.5px; color: rgba(241, 238, 231, 0.92); max-width: 46ch; }
.hero-cta { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s4); }
.hero .textline { color: var(--porcelain); border-color: rgba(241, 238, 231, 0.5); }
.hero .textline:hover { border-color: var(--porcelain); }

/* the hero call action: a ruled period lockup, no fill */
.cta-rule {
  display: inline-flex; align-items: center; gap: 12px;
  border-top: 2px solid var(--porcelain);
  border-bottom: 2px solid var(--porcelain);
  padding: 13px 6px;
  font-family: var(--display); font-weight: 600; font-size: 18.5px; letter-spacing: 0.05em;
  color: var(--porcelain); text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: transform var(--t-fast) var(--ease-settle);
}
.cta-rule .ic { color: var(--warm-fill); }
.cta-rule:hover { color: #fff; border-color: #fff; }
.cta-rule:active { transform: translateY(1px); }

/* filament warm-up: accents ease from 60 percent to full warmth (JS adds .warmed);
   opacity only, per the motion rules */
.js .warms { opacity: 0.6; transition: opacity 900ms var(--ease-settle); }
.js .warms.warmed { opacity: 1; }

/* ---------- century line signature ---------- */

.century { padding-block: var(--s12) var(--s8); }
.century-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.century-head p { color: var(--muted); margin: 0; font-size: 17px; }
.century-svg { width: 100%; height: auto; display: block; }
.century-svg .wire { stroke: var(--ink); stroke-width: 2; fill: none; }
.century-svg .node-glyph { fill: var(--panel); stroke: var(--ink); stroke-width: 1.5; transition: fill 700ms var(--ease-settle), stroke 700ms var(--ease-settle); }
.century-svg .node-mark {
  font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: 0.06em;
  fill: var(--muted); transition: fill 700ms var(--ease-settle);
  font-variant-numeric: tabular-nums;
}
.century-svg .node-label { font-family: var(--body); font-size: 13.5px; fill: var(--muted); }
.century-svg .lit .node-glyph { fill: var(--warm-fill); stroke: var(--plum); }
.century-svg .lit .node-mark { fill: var(--brass-ink); }
.century-mobile { display: none; }

/* ---------- section scaffolding ---------- */

.band { padding-block: var(--s12); }
.band-tight { padding-block: var(--s8); }

.rulehead { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s6); }
.rulehead h2 { margin: 0; white-space: nowrap; }
.rulehead::after { content: ""; flex: 1; border-bottom: 2px solid var(--ink); transform: translateY(-6px); }

/* one asymmetric photo block (about page record intro) */
.spread { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s4); align-items: center; }
.spread-photo { grid-column: 1 / span 7; }
.spread-copy { grid-column: 9 / span 4; }
.spread-photo img { width: 100%; box-shadow: 0 1px 3px rgba(34, 30, 26, 0.18); }
.spread-copy h3 { margin-bottom: var(--s1); }
.spread-copy p { color: var(--muted); font-size: 17px; }

/* catalog plates: framed photo, caption rule beneath, one per row */
.plate { margin: 0 auto var(--s12); max-width: 800px; text-align: center; }
.plate:last-child { margin-bottom: 0; }
.plate-frame {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: clamp(10px, 1.6vw, 16px);
  box-shadow: 0 1px 3px rgba(34, 30, 26, 0.14);
}
.plate-frame img { width: 100%; }
.plate-cap { padding-top: var(--s3); }
.plate-cap::before {
  content: ""; display: block; width: 76px;
  margin: 0 auto var(--s3);
  border-top: 2px solid var(--ink);
}
.plate-cap h2, .plate-cap h3 { margin-bottom: var(--s1); }
.plate-cap p { color: var(--muted); font-size: 17px; max-width: 52ch; margin-inline: auto; }
.cellar .plate-frame { background: #2B2620; border-color: rgba(239, 234, 224, 0.18); box-shadow: none; }
.cellar .plate-cap::before { border-color: var(--cellar-text); }

/* ---------- cellar band (industrial and municipal) ---------- */

.cellar { background: var(--cellar); color: var(--cellar-text); }
.cellar h2, .cellar h3 { color: var(--cellar-text); }
.cellar p { color: var(--cellar-muted); }

/* ---------- family ledger ---------- */

.family-grid { display: grid; grid-template-columns: 5fr 6fr; gap: var(--s8); align-items: center; }
.family-grid img { width: 100%; max-height: 560px; object-fit: cover; }
.ledger { list-style: none; margin: var(--s4) 0 0; padding: 0; max-width: 520px; }
.ledger li {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  padding: 14px 2px;
  border-bottom: 1px solid var(--hairline);
}
.ledger li:first-child { border-top: 1px solid var(--hairline); }
.ledger .who { font-family: var(--display); font-weight: 500; font-size: 18.5px; }
.ledger .role { color: var(--muted); font-size: 15.5px; font-style: italic; }

/* ---------- coverage: ruled township directory ---------- */

.towns {
  list-style: none; margin: 0; padding: 0;
  max-width: 720px;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s8);
  border-top: 1px solid var(--hairline);
}
.towns li {
  font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: 0.02em;
  padding: 11px 2px; border-bottom: 1px solid var(--hairline);
}
.coverage-note { color: var(--muted); font-size: 14px; margin-top: var(--s3); }

/* ---------- call band ---------- */

.callband { background: var(--panel); border-top: 1px solid var(--hairline); }
.callband-grid { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s6); align-items: center; }
.callband-grid img { width: 100%; }

/* the number as a ruled ledger row, not display type */
.tel-ledger { max-width: 560px; }
.tel-ledger .role { font-style: normal; }
.tel-ledger a {
  font-family: var(--display); font-weight: 600; font-size: 18.5px;
  color: var(--ink); text-decoration: none;
  border-bottom: 2px solid var(--plum); padding-bottom: 2px;
  transition: color var(--t-ui) var(--ease-settle);
}
.tel-ledger a:hover { color: var(--plum); }

/* ---------- page headers (inner pages) ---------- */

.pagehead { padding-block: var(--s12) var(--s6); }
.pagehead h1 { margin-bottom: var(--s2); }
.pagehead p { color: var(--muted); font-size: 18.5px; }

/* photo strip lead for inner pages */
.strip { position: relative; height: clamp(240px, 38vh, 420px); overflow: clip; }
.strip img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- about: record ledger ---------- */

.record { list-style: none; margin: 0; padding: 0; }
.record li {
  display: grid; grid-template-columns: 130px 1fr; gap: var(--s3);
  padding: 16px 2px; border-bottom: 1px solid var(--hairline); align-items: baseline;
}
.record li:first-child { border-top: 1px solid var(--hairline); }
.record .mark { font-family: var(--display); font-weight: 600; font-size: 18.5px; color: var(--brass-ink); font-variant-numeric: tabular-nums; }
.record .what { color: var(--ink); font-size: 17px; max-width: none; margin: 0; }
.record .what span { color: var(--muted); }

/* ---------- contact ---------- */

.lede-tel {
  display: inline-block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(34px, 5.4vw, 64px);
  color: var(--ink); text-decoration: none;
  border-bottom: 3px solid var(--plum); padding-bottom: 5px;
  transition: color var(--t-ui) var(--ease-settle);
}
.lede-tel:hover { color: var(--plum); }

.contact-grid { display: grid; grid-template-columns: 6fr 6fr; gap: var(--s8); align-items: start; }

.form { background: var(--panel); border: 1px solid var(--hairline); padding: var(--s4); }
.form h2 { margin-bottom: var(--s1); }
.form > p { color: var(--muted); font-size: 15.5px; }
.field { margin-block: var(--s3); }
.field label { display: block; font-family: var(--display); font-weight: 500; font-size: 15.5px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--body); font-size: 17px; color: var(--ink);
  background: var(--porcelain);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color var(--t-ui), box-shadow var(--t-ui);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--plum); box-shadow: 0 0 0 2px rgba(107, 42, 94, 0.25);
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { display: none; border: 1px solid var(--plum); background: var(--porcelain); padding: var(--s2) var(--s3); font-size: 17px; margin-top: var(--s3); }
.form-msg.show { display: block; }
.form-msg a { font-family: var(--display); font-weight: 600; }

.nap { margin-top: var(--s4); }
.nap p { margin-bottom: 6px; color: var(--muted); font-size: 15.5px; }
.nap p b { color: var(--ink); font-weight: 600; font-family: var(--display); letter-spacing: 0.02em; }

/* ---------- footer ---------- */

.foot { border-top: 2px solid var(--ink); padding-block: var(--s6) var(--s6); }
.foot-name { font-family: var(--display); font-weight: 600; font-size: 18.5px; letter-spacing: 0.05em; margin-bottom: var(--s1); }
.foot-line { font-size: 15.5px; color: var(--muted); margin-bottom: 4px; }
/* inline links get a 44px touch target without shifting the line box */
.foot-line a {
  color: var(--ink); font-family: var(--display);
  display: inline-block; padding: 12px 6px; margin: -12px -6px;
}
.foot-note { font-size: 14px; color: var(--muted); margin-top: var(--s3); max-width: 74ch; }

/* ---------- mobile sticky call bar ---------- */

.callbar { display: none; }

/* ---------- scroll reveals: gentle crossfade and rise ---------- */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--t-reveal) var(--ease-settle), transform var(--t-reveal) var(--ease-settle); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .spread { grid-template-columns: 1fr; gap: var(--s3); }
  .spread-photo, .spread-copy { grid-column: 1 / -1; }
  .family-grid, .callband-grid, .contact-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .century-desktop { display: none; }
  .century-mobile { display: block; max-width: 420px; }
  .plate { margin-bottom: var(--s8); }
}

@media (max-width: 860px) {
  :root { --bar-h: 0px; }
  body { padding-bottom: 64px; padding-top: var(--topbar-h); }
  [id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }

  .controlbar { display: none; }

  .tophead {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; inset: 0 0 auto 0; z-index: 200;
    height: var(--topbar-h);
    padding-inline: 20px;
    background: var(--porcelain);
    border-bottom: 1px solid var(--hairline);
  }
  .tophead-name {
    font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: 0.06em;
    color: var(--ink); text-decoration: none;
  }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; min-width: 44px; padding: 8px 10px;
    background: none; border: 0; cursor: pointer;
    font-family: var(--display); font-size: 15.5px; color: var(--ink);
  }
  .nav-toggle-box { display: inline-flex; flex-direction: column; gap: 5px; width: 22px; }
  .nav-toggle-box span { display: block; height: 2px; background: var(--ink); transition: transform var(--t-ui) var(--ease-settle); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-box span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-box span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  .menu {
    display: none;
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 190;
    background: var(--porcelain);
    padding: var(--s6) clamp(20px, 6vw, 44px);
    flex-direction: column; gap: 4px;
  }
  .menu.open { display: flex; }
  .menu a {
    font-family: var(--display); font-weight: 500; font-size: 26px;
    color: var(--ink); text-decoration: none;
    padding: 14px 2px; border-bottom: 1px solid var(--hairline);
    min-height: 44px;
  }
  .menu a[aria-current="page"] { color: var(--plum); }
  .menu-phone { color: var(--plum); }

  .callbar {
    display: flex;
    position: fixed; inset: auto 0 0 0; z-index: 180;
    transform: translateY(0);
    transition: transform 280ms var(--ease-settle);
  }
  .callbar.hide { transform: translateY(110%); }
  .callbar a {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px;
    font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: 0.03em;
    text-decoration: none;
  }
  .callbar-call { background: var(--plum); color: var(--on-plum); }
  .callbar-call:active { background: var(--plum-deep); }
  .callbar-write { background: var(--ink); color: var(--cellar-text); }

  .hero { min-height: min(78vh, 720px); }
  .hero-inner { padding-block: var(--s8) var(--s6); }
  .band { padding-block: var(--s8); }
  .rulehead { flex-wrap: wrap; }
  .rulehead h2 { white-space: normal; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 34px; }
  .hero-cta { gap: var(--s3); }
  .record li { grid-template-columns: 1fr; gap: 4px; }
  .towns { grid-template-columns: 1fr; }
}

/* ---------- reduced motion: a fully readable static page ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-warmth { opacity: 0.35; }
  .js .reveal { opacity: 1; transform: none; }
  .js .warms { opacity: 1; }
  .callbar { transition: none; }
}
