/* ==========================================================================
   Components — header, hero, buttons, cards, process, footer, forms
   ========================================================================== */

/* --- Paint-chip motif: the brand device ---------------------------------- */
.chipstrip { display: flex; height: 8px; width: 100%; }
.chipstrip span { flex: 1; }
.chipstrip span:nth-child(1) { background: var(--pine-900); }
.chipstrip span:nth-child(2) { background: var(--pine-700); }
.chipstrip span:nth-child(3) { background: var(--pine-500); }
.chipstrip span:nth-child(4) { background: var(--pine-300); }
.chipstrip span:nth-child(5) { background: var(--pine-100); }

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-text-mute);
  font-weight: 600;
}

/* --- Header --------------------------------------------------------------- */
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-rule); position: sticky; top: 0; z-index: 50; }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); padding-block: var(--s-4); }
.logo {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-1);
  color: var(--c-text); text-decoration: none; line-height: 1.05; letter-spacing: -.02em;
}
.logo__mark { width: 40px; height: 40px; flex: none; }
.logo__sub {
  display: block; font-family: var(--font-body); font-weight: 500;
  font-size: var(--step--1); letter-spacing: .1em; text-transform: uppercase;
  color: var(--c-text-mute); margin-top: 2px;
}
@media (max-width: 420px) { .logo__mark { width: 34px; height: 34px; } }

.nav { display: flex; align-items: center; gap: var(--s-2); }
.nav .btn { margin-left: var(--s-3); }

/* :not(.btn) matters. Without it these rules out-specify .btn--primary
   (0-1-1 beats 0-1-0) and the estimate button in the header gets the muted
   link colour on its dark green background. Any link rule scoped to a
   container needs the same guard. */
.nav a:not(.btn) {
  color: var(--c-text-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--step-0);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius);
  transition: background-color .18s var(--ease), color .18s var(--ease);
}

/* Hover fills with the accent. Keyboard focus gets the same treatment so the
   two states read identically. */
.nav a:not(.btn):hover,
.nav a:not(.btn):focus-visible {
  background: var(--c-accent);
  color: var(--c-on-accent);
}

/* The current page is marked with the light wash, not the solid fill, so it
   stays distinguishable from whatever the cursor happens to be over. */
.nav a:not(.btn)[aria-current="page"] {
  background: var(--c-accent-wash);
  color: var(--c-accent);
}

/* Needed explicitly: the hover and aria-current rules above are both 0-3-1,
   so source order alone would let aria-current beat hover on the active page.
   This is 0-4-1 and settles it. */
.nav a:not(.btn)[aria-current="page"]:hover,
.nav a:not(.btn)[aria-current="page"]:focus-visible {
  background: var(--c-accent);
  color: var(--c-on-accent);
}

.nav-toggle { display: none; background: none; border: 1px solid var(--c-rule); border-radius: var(--radius); padding: var(--s-2) var(--s-3); font: inherit; font-size: var(--step--1); cursor: pointer; color: var(--c-text); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; inset: 100% 0 auto 0; background: var(--c-surface);
    border-bottom: 1px solid var(--c-rule); flex-direction: column; align-items: stretch;
    gap: 0; padding: var(--s-2) var(--gutter) var(--s-5);
  }
  .nav[hidden] { display: none; }
  .nav a:not(.btn) {
    padding-block: var(--s-3);
    margin-inline: calc(var(--s-3) * -1);
    border-bottom: 1px solid var(--c-rule-soft);
    border-radius: 0;
  }
  .nav .btn { margin-top: var(--s-4); margin-left: 0; text-align: center; }
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block; font: inherit; font-weight: 600; line-height: 1.2;
  padding: var(--s-3) var(--s-5); border-radius: var(--radius);
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.btn--primary { background: var(--c-accent); color: var(--c-on-accent); }
.btn--primary:hover { background: var(--c-accent-hover); color: var(--c-on-accent); }
.btn--ghost { border-color: var(--c-rule); color: var(--c-text); background: transparent; }
.btn--ghost:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* --- Hero ----------------------------------------------------------------- */
.hero { background: var(--c-surface); border-bottom: 1px solid var(--c-rule); }
.hero__inner { display: grid; gap: var(--s-7); padding-block: clamp(3rem, 7vw, var(--s-9)); }
@media (min-width: 900px) { .hero__inner { grid-template-columns: 1.05fr .95fr; align-items: center; } }
.hero h1 { margin-block: var(--s-3); }
.hero__sub { font-size: var(--step-1); color: var(--c-text-soft); line-height: var(--lh-snug); }
.hero__media { aspect-ratio: 4 / 3; background: var(--c-accent-wash); border-radius: var(--radius-lg); overflow: hidden; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }

/* --- Trust bar ------------------------------------------------------------ */
.trustbar { background: var(--pine-900); color: var(--pine-100); }
.trustbar__grid { display: grid; gap: var(--s-4); padding-block: var(--s-5); }
@media (min-width: 720px) { .trustbar__grid { grid-template-columns: repeat(4, 1fr); } }
.trustbar dt { font-size: var(--step--1); letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.trustbar dd { margin: var(--s-1) 0 0; font-family: var(--font-display); font-size: var(--step-1); color: #fff; }

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-rule);
  border-radius: var(--radius-lg); padding: var(--s-6); box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.card__media { aspect-ratio: 3 / 2; background: var(--c-accent-wash); border-radius: var(--radius); margin: calc(var(--s-6) * -1) calc(var(--s-6) * -1) var(--s-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: var(--step-1); }
.card p { color: var(--c-text-soft); }
.card__link { margin-top: auto; font-weight: 600; text-decoration: none; }
.card__link::after {
  content: "\2192"; display: inline-block; margin-left: .35em;
  transition: transform .28s var(--ease-pop);
}

/* --- Interactive cards ----------------------------------------------------
   Only for tiles that actually go somewhere — the three service tiles on the
   home page. Plain .card (the info panels on Services and Contact) stays
   static, because a hover animation on something unclickable is a lie. */
.card--interactive {
  position: relative;
  transition: transform .3s var(--ease-pop),
              box-shadow .3s var(--ease),
              border-color .3s var(--ease);
}
.card--interactive:hover,
.card--interactive:focus-within {
  transform: translateY(-6px) scale(1.015);
  box-shadow: var(--shadow-2);
  border-color: var(--c-accent);
}

/* Stretched link: the whole tile is clickable, so the hover affordance is
   telling the truth. ::after is already the arrow, so this uses ::before. */
.card--interactive .card__link::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1;
}
.card--interactive:hover .card__link::after,
.card--interactive:focus-within .card__link::after { transform: translateX(5px); }

/* Slow counter-zoom on the photograph inside the frame */
.card--interactive .card__media img { transition: transform .6s var(--ease); }
.card--interactive:hover .card__media img { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .card--interactive:hover,
  .card--interactive:focus-within { transform: none; }
  .card--interactive:hover .card__media img { transform: none; }
  .card--interactive:hover .card__link::after,
  .card--interactive:focus-within .card__link::after { transform: none; }
}

/* --- Process -------------------------------------------------------------- */
.process { counter-reset: step; display: grid; gap: var(--s-6); }
@media (min-width: 900px) { .process { grid-template-columns: repeat(4, 1fr); } }
.process__item { counter-increment: step; border-top: 2px solid var(--c-accent); padding-top: var(--s-4); }
.process__item::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display); font-size: var(--step-1); color: var(--c-accent); display: block; margin-bottom: var(--s-2);
}
.process__item h3 { font-size: var(--step-1); margin-bottom: var(--s-2); }
.process__item p { color: var(--c-text-soft); font-size: var(--step-0); }

/* --- Service block (Services page) --------------------------------------- */
.service { display: grid; gap: var(--s-6); padding-block: var(--s-8); border-top: 1px solid var(--c-rule); }
@media (min-width: 900px) { .service { grid-template-columns: 1fr 1fr; gap: var(--s-8); align-items: start; } }
.service__lead { font-size: var(--step-2); font-family: var(--font-display); color: var(--c-text); line-height: var(--lh-snug); }
.list-check { list-style: none; padding: 0; }
.list-check li { padding-left: var(--s-5); position: relative; margin-block: var(--s-2); color: var(--c-text-soft); }
.list-check li::before { content: ""; position: absolute; left: 0; top: .65em; width: 10px; height: 2px; background: var(--c-accent); }

/* --- Reviews -------------------------------------------------------------- */
.quote { border-left: 3px solid var(--c-accent); padding-left: var(--s-5); }
.quote p { font-size: var(--step-1); font-family: var(--font-display); font-weight: 500; line-height: var(--lh-snug); }
.quote cite { display: block; margin-top: var(--s-3); font-style: normal; font-size: var(--step--1); letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-mute); }

/* --- Gallery -------------------------------------------------------------- */
.gallery { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gallery figure { margin: 0; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: var(--radius); background: var(--c-accent-wash); }
.gallery figcaption { font-size: var(--step--1); color: var(--c-text-mute); margin-top: var(--s-2); }

/* --- Form ----------------------------------------------------------------- */
.form { display: grid; gap: var(--s-4); max-width: 34rem; }
.field { display: grid; gap: var(--s-2); }
.field label { font-weight: 600; font-size: var(--step-0); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-rule); border-radius: var(--radius); padding: var(--s-3);
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--c-accent); }
.field textarea { min-height: 8rem; resize: vertical; }
.field__hint { font-size: var(--step--1); color: var(--c-text-mute); }

/* --- Footer --------------------------------------------------------------- */
.site-footer { background: var(--pine-900); color: var(--pine-100); margin-top: var(--s-8); }
.site-footer a:not(.btn) { color: var(--pine-100); }
.site-footer a:not(.btn):hover { color: #fff; }
.site-footer__grid { display: grid; gap: var(--s-6); padding-block: var(--s-8); }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer__mark { width: 44px; height: 44px; margin-bottom: var(--s-4); }
.site-footer h2 { font-size: var(--step-1); color: #fff; margin-bottom: var(--s-3); }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-block: var(--s-2); }
.site-footer__legal { border-top: 1px solid rgba(255,255,255,.14); padding-block: var(--s-4); font-size: var(--step--1); opacity: .8; }

/* --- TODO marker: visible only in local dev, never in production ----------
   Written as .todo.todo (specificity 0-2-0) on purpose. As a plain .todo it
   loses to any container rule like `.quote cite` or `.card p` (0-1-1) and the
   marker silently renders in the container's text colour on the amber
   background — which fails contrast and, worse, stops looking like a marker.
   `body.hide-todo .todo` is 0-2-1 so it still wins over this. */
.todo.todo {
  background: #F7EBD6; color: #7A4E0B; border: 1px dashed #E2C795;
  border-radius: 2px; padding: 0 .4em; font-size: .95em; font-style: normal;
}
body.hide-todo .todo { background: none; border-color: transparent; color: inherit; }

/* --- Back to top ----------------------------------------------------------
   Fixed, appears after one viewport of scrolling. visibility (not display) is
   what keeps it out of the tab order while hidden — display:none can't
   transition, and an invisible-but-focusable button is a keyboard trap. */
.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 40;
  width: 48px; height: 48px;          /* 48px is the minimum comfortable touch target */
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--c-accent); color: var(--c-on-accent);
  cursor: pointer;
  /* The ring is doing real work. This button is fixed, so at the bottom of the
     page it sits on the Pine 900 footer, where the accent fill is only ~1.4:1
     against the background — effectively invisible. A paper-coloured ring
     separates it there (12.3:1) and is simply not noticeable against the light
     page ground, where the fill already carries 7.8:1 on its own. */
  box-shadow: 0 0 0 2px var(--paper), var(--shadow-2);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s var(--ease),
              transform .25s var(--ease-pop),
              background-color .18s var(--ease),
              visibility 0s linear .25s;
}
.to-top.is-visible {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: 0s, 0s, 0s, 0s;
}
.to-top:hover { background: var(--c-accent-hover); }
.to-top svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .to-top { transform: none; transition: opacity .2s linear, visibility 0s linear .2s; }
  .to-top.is-visible { transition-delay: 0s; }
}

/* --- Before & after pairs -------------------------------------------------
   Both frames share one aspect ratio so the eye compares the rooms, not the
   crops. Portrait and landscape shots therefore letterbox rather than get
   cropped differently from each other. */
.ba { display: grid; gap: var(--s-3); margin-bottom: var(--s-7); }
@media (min-width: 700px) { .ba { grid-template-columns: 1fr 1fr; } }
.ba figure { margin: 0; position: relative; }
.ba img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); background: var(--c-accent-wash);
}
.ba figcaption { position: absolute; top: var(--s-3); left: var(--s-3); }
.ba__tag {
  font-family: var(--font-body); font-size: var(--step--1); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  background: var(--paper); color: var(--ink);
  padding: 4px 10px; border-radius: 2px;
}
.ba__tag--after { background: var(--c-accent); color: var(--c-on-accent); }
.ba__cap { grid-column: 1 / -1; font-size: var(--step--1); color: var(--c-text-mute); margin: 0; }

/* --- Google reviews ------------------------------------------------------- */
.reviews { display: grid; gap: var(--s-5); }
@media (min-width: 760px) { .reviews { grid-template-columns: repeat(2, 1fr); } }
.review {
  background: var(--c-surface); border: 1px solid var(--c-rule);
  border-radius: var(--radius-lg); padding: var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-3); box-shadow: var(--shadow-1);
}
.review__head { display: flex; align-items: center; gap: var(--s-3); }
.review__avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--c-accent-wash); }
.review__who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review__name { font-weight: 600; }
.review__when { font-size: var(--step--1); color: var(--c-text-mute); }
.review__stars { color: var(--c-accent); letter-spacing: .12em; font-size: var(--step-0); }
.review__text { color: var(--c-text-soft); }
.reviews__source { font-size: var(--step--1); color: var(--c-text-mute); }

/* Home page teaser. Cards are capped at a few lines and scroll internally, so
   a long review doesn't swamp the page but is still fully readable in place.
   The text is never trimmed in the source — a shortened review is a misquote —
   so screen readers and search engines always get the whole thing. */
.reviews--teaser { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.reviews--teaser .review__text {
  --teaser-lines: 5;                                  /* the one dial */
  max-height: calc(var(--teaser-lines) * var(--lh-body) * 1em);
  overflow-y: auto;
  overscroll-behavior: contain;                       /* don't scroll the page at the ends */
  padding-right: var(--s-3);                          /* keep text off the scrollbar */

  /* A visible scrollbar is the affordance — without one nobody knows there is
     more to read. Thin and in the accent rather than hidden-until-hover. */
  scrollbar-width: thin;
  scrollbar-color: var(--pine-300) transparent;
}
.reviews--teaser .review__text::-webkit-scrollbar { width: 6px; }
.reviews--teaser .review__text::-webkit-scrollbar-track { background: transparent; }
.reviews--teaser .review__text::-webkit-scrollbar-thumb {
  background: var(--pine-300); border-radius: 3px;
}
.reviews--teaser .review__text::-webkit-scrollbar-thumb:hover { background: var(--c-accent); }

/* A scrollable box has to be reachable by keyboard, or arrow keys can never
   reach the rest of the review. The generated markup adds tabindex="0"; this
   makes the focus state visible. */
.reviews--teaser .review__text:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 2px;
}

/* The fade is the discoverability fix. macOS uses overlay scrollbars that only
   appear while scrolling, so without this a capped review just looks like a
   short review that ends mid-sentence. It sits on the wrapper (which doesn't
   move) and JS switches it off once you reach the bottom, so it never covers
   the last line. No JS: no fade, scrolling still works. */
.review__scroll { position: relative; }
.review__scroll::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.4em;
  background: linear-gradient(to bottom, transparent, var(--c-surface));
  pointer-events: none; opacity: 0; transition: opacity .2s var(--ease);
}
.review__scroll.can-scroll::after { opacity: 1; }
.review__scroll.at-end::after { opacity: 0; }
