/* Element base and shared section components for every page. Tokens and site chrome live in site.css. */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: var(--body);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
blockquote {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

section {
  padding-block: var(--s8);
}

h2 {
  font: var(--display-lg);
  color: var(--navy);
}

/* Even line lengths, so headings never end on a single word */
h1,
h2,
h3 {
  text-wrap: balance;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--s5);
  margin-bottom: var(--s6);
}

.section-head p {
  max-width: 56ch;
  margin-top: var(--s3);
  font: var(--body-lg);
  color: var(--text-muted);
}

/* Split hero: flat navy copy beside one of the client's own photos */
.hero {
  position: relative;
  padding: 0;
  background: var(--navy);
  color: var(--on-navy);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-height: 640px;
}

.hero-copy {
  padding: var(--s8) var(--s7) var(--s8) 0;
}

.hero h1 {
  font: var(--display-xl);
}

.hero-lede {
  max-width: 40ch;
  margin-top: var(--s4);
  font: var(--body-lg);
  color: var(--on-navy-muted);
}

.hero .actions {
  margin-top: var(--s5);
}

.hero-media {
  position: absolute;
  inset: 0 0 0 50%;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}

/* Breadcrumb trail at the top of inner pages */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0 0 var(--s4);
  padding: 0;
  list-style: none;
  font: var(--small);
  color: var(--text-muted);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: var(--s2);
  color: var(--line);
}

.breadcrumb a {
  color: var(--ink);
  text-underline-offset: 4px;
}

/* Split section: heading and intro on the left, content on the right */
.split,
.faq-inner {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--s7);
  align-items: start;
}

.split-intro p {
  margin-top: var(--s3);
  font: var(--body-lg);
  color: var(--text-muted);
}

/* FAQ: native disclosures on hairlines */
.faq-list details {
  border-top: 1px solid var(--line);
}

.faq-list details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 64px;
  padding-block: var(--s3);
  font: var(--label);
  font-size: 1.125rem;
  color: var(--navy);
  list-style: none;
  cursor: pointer;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary .icon {
  margin-left: auto;
  transition: transform 0.2s ease-out;
}

.faq-list details[open] summary .icon {
  transform: rotate(45deg);
}

.faq-answer {
  display: grid;
  gap: var(--s3);
  max-width: 62ch;
  padding-bottom: var(--s4);
  color: var(--text-muted);
}

.faq-answer a {
  font-weight: 600;
  color: var(--ink);
}

.faq-answer strong {
  font-weight: 600;
  color: var(--text);
}

/* Page hero: flat navy band for pages without a hero photo */
.page-hero {
  padding-block: var(--s8);
  background: var(--navy);
  color: var(--on-navy);
}

.page-hero h1 {
  max-width: 16ch;
  font: var(--display-xl);
}

.page-hero-lede {
  max-width: 48ch;
  margin-top: var(--s4);
  font: var(--body-lg);
  color: var(--on-navy-muted);
}

.page-hero .actions {
  margin-top: var(--s5);
}

/* Service cards: the client's own job photos lead each service */
.services-group + .services-group {
  border-top: 1px solid var(--line);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s6) var(--s5);
}

.service {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s2);
}

.service img {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--s2);
  border-radius: var(--radius);
  background: var(--line);
  object-fit: cover;
}

.service h3 {
  font: var(--title);
  color: var(--navy);
}

.service p {
  color: var(--text-muted);
}

.card-link {
  margin-top: var(--s1);
  font: var(--label);
  font-size: 0.9375rem;
  color: var(--ink);
  text-decoration: none;
}

.card-link .icon {
  width: 18px;
  height: 18px;
  margin-left: 6px;
  vertical-align: -4px;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

@media (hover: hover) and (pointer: fine) {
  .service:hover h3 {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
  }
}

@media (max-width: 1024px) {
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  section,
  .page-hero {
    padding-block: var(--s7);
  }

  .section-head {
    flex-direction: column;
    align-items: start;
    gap: var(--s3);
    margin-bottom: var(--s5);
  }

  .hero-inner {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    padding: var(--s7) 0 var(--s6);
  }

  .hero-media {
    position: relative;
    inset: auto;
    aspect-ratio: 4 / 3;
  }

  .split,
  .faq-inner {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }
}

@media (max-width: 520px) {
  section,
  .page-hero {
    padding-block: var(--s6);
  }

  .hero-copy {
    padding-top: var(--s6);
  }

  .service-grid {
    grid-template-columns: 1fr;
    gap: var(--s4);
  }

  .service {
    grid-template-columns: 104px minmax(0, 1fr);
    column-gap: var(--s3);
    row-gap: var(--s1);
  }

  .service img {
    grid-row: 1 / span 3;
    aspect-ratio: 1;
    margin: 0;
  }
}

.nobr {
  white-space: nowrap;
}

/* Estimate form: inline on Home, in a pop-up on every other page (site.js) */
.estimate-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4) var(--s3);
}

.field {
  display: grid;
  gap: var(--s2);
  font: var(--label);
  font-size: 0.9375rem;
  color: var(--navy);
}

.field-full {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s3);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font: var(--body);
}

.field select {
  appearance: none;
  padding-right: var(--s6);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2301283c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center / 20px;
}

.field textarea {
  min-height: 128px;
  padding-block: 14px;
  resize: vertical;
}

.consent {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--s3);
  align-items: start;
  font: var(--small);
  color: var(--text-muted);
  cursor: pointer;
}

.consent input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--ink);
}

.estimate-form .btn {
  justify-self: start;
  padding-inline: var(--s5);
}

.form-status {
  min-height: 1.5em;
  font: var(--label);
  font-size: 0.9375rem;
}

.form-honeypot {
  position: absolute;
  left: -9999px;
}

/* Reviews: quotes on hairlines, no cards or avatars */
.reviews,
.services,
.areas,
.faq {
  border-top: 1px solid var(--line);
}

.rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  font: var(--body-lg);
  color: var(--text-muted);
}

.rating strong {
  font-weight: 600;
  color: var(--text);
}

.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--accent);
}

.stars .icon {
  width: 18px;
  height: 18px;
}

.review-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s6) var(--s5);
}

.review {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

.review blockquote {
  font: var(--body-lg);
  color: var(--text);
}

.review-author {
  display: grid;
  margin-top: auto;
  font: var(--label);
}

.review-author span {
  font: var(--small);
  color: var(--text-muted);
}

/* About */
.about {
  background: var(--navy);
  color: var(--on-navy);
}

.about h2 {
  color: var(--on-navy);
}

.about-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s7);
  align-items: center;
}

.about-photo img {
  width: 100%;
  border-radius: var(--radius);
}

.about-copy > p {
  margin-top: var(--s3);
  font: var(--body-lg);
  color: var(--on-navy-muted);
}

.facts {
  margin-top: var(--s5);
  border-bottom: 1px solid var(--line-on-navy);
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  padding-block: 14px;
  border-top: 1px solid var(--line-on-navy);
}

.facts dt {
  color: var(--on-navy-muted);
}

.facts dd {
  font: var(--label);
  font-size: 1.0625rem;
}

.points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2) var(--s4);
  margin-top: var(--s4);
  padding-left: 1.1em;
  list-style: disc;
}

.points li::marker {
  color: var(--on-navy-muted);
}

.about .text-link {
  margin-top: var(--s4);
  color: var(--on-navy);
}

/* Service areas */
.areas-inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s7);
  align-items: start;
}

.areas-copy p {
  margin-top: var(--s3);
  font: var(--body-lg);
  color: var(--text-muted);
}

.areas-copy .btn {
  margin-top: var(--s5);
}

.area-group {
  border-top: 1px solid var(--line);
}

.area-group:last-child {
  border-bottom: 1px solid var(--line);
}

.area-group summary {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 64px;
  padding-block: var(--s3);
  color: var(--navy);
  list-style: none;
  cursor: pointer;
}

.area-group summary::-webkit-details-marker {
  display: none;
}

.area-group summary {
  font: var(--title);
}

.area-group summary .icon {
  margin-left: auto;
  transition: transform 0.2s ease-out;
}

.area-group[open] summary .icon {
  transform: rotate(180deg);
}

.count {
  font: var(--small);
  color: var(--text-muted);
}

.area-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3) var(--s4);
  padding-bottom: var(--s4);
}

.area-list li {
  display: grid;
}

.area-list small {
  font: var(--small);
  color: var(--text-muted);
}

/* Responsive */

/* Pop-up after the estimate form is sent (or fails) */
.form-dialog {
  width: min(440px, calc(100vw - 2 * var(--gutter)));
  padding: var(--s6) var(--s5) var(--s5);
  border: 0;
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  text-align: center;
  box-shadow: 0 24px 60px -20px rgba(1, 40, 60, 0.55);
}

.form-dialog::backdrop {
  background: rgba(1, 40, 60, 0.55);
}

.form-dialog[open] {
  animation: dialog-in 220ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

.form-dialog-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e7f4ec;
  color: #1f7a45;
}

.form-dialog-icon .icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.4;
}

.form-dialog.is-error .form-dialog-icon {
  background: #fdeee6;
  color: var(--action);
}

.form-dialog h2 {
  margin-top: var(--s3);
  font: 600 2.25rem/1 var(--font-display);
  color: var(--navy);
}

.form-dialog-text {
  margin-top: var(--s2);
  font: var(--body-lg);
  color: var(--text-muted);
}

.form-dialog .btn {
  width: 100%;
  margin-top: var(--s4);
}

.form-dialog form .btn {
  margin-top: var(--s3);
}

.form-dialog:not(.is-error) .form-dialog-call {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .form-dialog[open] { animation: none; }
}

/* The form as a pop-up on pages other than Home */
.estimate-dialog {
  width: min(680px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 2 * var(--s5));
  padding: var(--s5);
  border: 0;
  border-radius: 10px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(1, 40, 60, 0.55);
  overscroll-behavior: contain;
}

.estimate-dialog::backdrop {
  background: rgba(1, 40, 60, 0.55);
}

.estimate-dialog[open] {
  animation: dialog-in 220ms ease-out;
}

.estimate-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--s3);
}

.estimate-dialog h2 {
  font: 600 clamp(2.25rem, 4.4vw, 2.75rem) / 0.95 var(--font-display);
  letter-spacing: 0.005em;
  color: var(--navy);
}

.estimate-dialog-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
}

.estimate-dialog-close:hover {
  background: var(--paper);
}

.estimate-dialog-sub {
  margin: var(--s3) 0 var(--s5);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.estimate-dialog-sub a {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.estimate-dialog .estimate-form {
  row-gap: var(--s4);
}

/* Form type (Home and pop-up): small firm labels, quiet "optional", calm fields with a navy focus */
.estimate-form .field {
  gap: 6px;
  font: 600 0.875rem / 1.3 var(--font-body);
  letter-spacing: 0.01em;
  color: var(--navy);
}

.estimate-form .field em {
  margin-left: 4px;
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
}

.estimate-form .field input,
.estimate-form .field select,
.estimate-form .field textarea {
  min-height: 48px;
  border-color: rgba(1, 40, 60, 0.28);
  font-size: 1rem;
  transition: border-color 150ms, box-shadow 150ms;
}

.estimate-form .field textarea::placeholder {
  color: rgba(1, 40, 60, 0.42);
}

.estimate-form .field :focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(1, 76, 121, 0.16);
}

.estimate-form .consent {
  font-size: 0.8125rem;
  line-height: 1.5;
}

.estimate-form button[type="submit"] {
  min-height: 52px;
  font-size: 1.0625rem;
}

.estimate-dialog .estimate-form .btn {
  justify-self: stretch;
  margin-top: var(--s2);
}

.estimate-form .field textarea {
  min-height: 104px;
}

/* No reserved space for the status line in the pop-up; it only shows while sending */
.estimate-dialog .form-status {
  min-height: 0;
}

.estimate-dialog .form-status:empty {
  display: none;
}

/* After the first try, missing or wrong fields get a red outline */
.field :user-invalid {
  border-color: #b42318;
  box-shadow: 0 0 0 1px #b42318;
}

@media (prefers-reduced-motion: reduce) {
  .estimate-dialog[open] { animation: none; }
}

@media (max-width: 520px) {
  .estimate-form {
    grid-template-columns: 1fr;
  }

  .estimate-form .btn {
    width: 100%;
  }

  .estimate-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    padding: 0 var(--gutter) var(--s5);
    border-radius: 0;
  }

  .estimate-dialog h2 {
    font-size: 2rem;
  }

  /* Title and close stay on screen while the form scrolls */
  .estimate-dialog-head {
    position: sticky;
    top: 0;
    z-index: 1;
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--s4) var(--gutter) var(--s2);
    background: var(--white);
    box-shadow: 0 1px 0 var(--line);
  }

  .estimate-dialog-sub {
    margin-top: var(--s2);
  }
}
