/* JB Carpentry & Property Maintenance — landing page
   Brand tokens: see brand/LEIA-ME.md. Mustard is an accent only:
   never small text on cream (2.6:1). On the dark ground it passes (5.9:1). */

:root {
  --coffee: #301909;
  --timber: #774A22;
  --mustard: #C28A1D;
  --mustard-hover: #D49A2A;
  --cream: #F4EBDA;
  --cream-2: #EDE1C9;
  --paper: #FFFCF6;
  --dark: #24160D;
  --dark-2: #2E1D11;
  --line-dark: #5A3A1E;
  --on-dark: #F4EBDA;
  --on-dark-2: #E3D5BB;
  --on-dark-3: #C9B89A;
  --error-dark: #8E1B12;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 6px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --header-h: 116px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--on-dark);
  background: var(--dark);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
img, picture, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.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 { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--mustard); color: var(--dark); padding: 10px 16px; border-radius: var(--radius); font-weight: 700; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; }

/* ---------- Type ---------- */
.display, .display-md, .display-sm, .display-xs {
  font-stretch: 62%;
  font-weight: 900;
  line-height: .9;
  text-transform: uppercase;
  letter-spacing: -.005em;
  text-wrap: balance;
}
.display { font-size: clamp(3.25rem, min(11.5vw, 14.5svh), 9.5rem); }
.display-md { font-size: clamp(2.5rem, 6.5vw, 4.75rem); font-weight: 850; }
.display-sm { font-size: clamp(2rem, 4.6vw, 3.75rem); font-weight: 800; line-height: .95; }
.display-xs { font-size: clamp(1.6rem, 2.6vw, 2rem); font-weight: 800; line-height: 1; }
.eyebrow { font-weight: 650; font-size: .875rem; letter-spacing: .16em; text-transform: uppercase; color: var(--mustard); }
.eyebrow-dark { color: var(--timber); }
.lead { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.55; color: var(--on-dark-2); max-width: 40ch; }
.section-lead { font-size: 1.125rem; color: var(--on-dark-2); max-width: 46ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 1rem; line-height: 1.1; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease-out), box-shadow .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-lg { min-height: 56px; padding: 16px 30px; font-size: 1.0625rem; }
.btn-block { width: 100%; }
.btn-mustard { background: var(--mustard); color: var(--dark); }
.btn-mustard:hover { background: var(--mustard-hover); transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(194, 138, 29, .8); }
.btn-outline-mustard { border-color: var(--mustard); color: var(--on-dark); }
.btn-outline-mustard:hover { background: var(--mustard); color: var(--dark); }
.btn-coffee { background: var(--coffee); color: var(--cream); }
.btn-coffee:hover { background: #4A2914; transform: translateY(-2px); }
.btn-outline-coffee { border-color: var(--coffee); color: var(--coffee); }
.btn-outline-coffee:hover { background: var(--coffee); color: var(--cream); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn-text {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 4px;
  font-weight: 650; text-decoration: none; color: var(--on-dark);
  background: linear-gradient(var(--mustard), var(--mustard)) 0 calc(100% - 6px) / 0 2px no-repeat;
  transition: background-size .3s var(--ease-out);
}
.btn-text:hover { background-size: 100% 2px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background-color .3s, box-shadow .3s, backdrop-filter .3s;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; transition: padding .3s; }
.brand { display: block; flex: none; }
/* Only the approved horizontal logo (brand/guide/jb-logo-guide.pdf), never below 280px. */
.logo-full { width: 280px; }
.site-header nav { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-weight: 550; text-decoration: none; padding: 8px 0; background: linear-gradient(var(--mustard), var(--mustard)) 0 100% / 0 2px no-repeat; transition: background-size .3s var(--ease-out); }
.nav-links a:hover { background-size: 100% 2px; }
.site-header.is-scrolled { background: rgba(36, 22, 13, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line-dark); }
.site-header.is-scrolled .header-inner { padding-block: 8px; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: max(640px, 100svh); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero-media, .hero-shade { position: absolute; inset: 0; z-index: -1; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 62% 60%; transform-origin: 70% 60%; animation: kenburns 18s var(--ease-out) both; }
.hero-shade {
  background:
    linear-gradient(90deg, rgba(36, 22, 13, .94) 0%, rgba(36, 22, 13, .72) 42%, rgba(36, 22, 13, .18) 100%),
    linear-gradient(0deg, rgba(36, 22, 13, .9) 0%, rgba(36, 22, 13, 0) 45%),
    linear-gradient(180deg, rgba(36, 22, 13, .7) 0%, rgba(36, 22, 13, 0) 22%);
}
.hero-content { display: flex; flex-direction: column; gap: 22px; padding-top: 180px; padding-bottom: clamp(56px, 9vh, 96px); }
.hero h1 { max-width: 16ch; }
.hero h1 .line { display: block; overflow: hidden; padding-bottom: .04em; }
.hero h1 .line > span { display: inline-block; }
.rule { display: block; width: 120px; height: 4px; background: var(--mustard); transform-origin: left; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; padding-top: 6px; }

.hero-in { animation: rise .9s var(--ease-out) both; animation-delay: calc(var(--d) * 110ms + 150ms); }
.hero h1 .hero-in { animation-name: rise-line; animation-duration: 1s; }
.rule.hero-in { animation-name: grow; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes rise-line { from { transform: translateY(105%); } to { transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }

/* ---------- Trust strip ---------- */
.trust { background: var(--mustard); color: var(--dark); }
.trust-list { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 28px; padding-block: 18px; font-weight: 700; font-stretch: 85%; font-size: 1.0625rem; }
.trust-list li { display: flex; align-items: center; gap: 8px; }

/* ---------- Sections ---------- */
section { position: relative; }
.services, .work, .how { padding-block: clamp(72px, 11vw, 128px); }
.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: clamp(36px, 5vw, 56px); }

/* Services: big numbered rows */
.service-list { border-top: 1px solid var(--line-dark); counter-reset: none; }
.service {
  display: grid; gap: 18px 32px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
  padding-block: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--line-dark);
  position: relative;
}
.service::before {
  content: ""; position: absolute; inset: 0 calc(var(--gutter) * -1); z-index: -1;
  background: var(--dark-2); opacity: 0; transition: opacity .35s;
}
.service-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.service-no { font-stretch: 62%; font-weight: 800; font-size: clamp(1.75rem, 3vw, 2.5rem); color: var(--mustard); min-width: 2.2ch; transition: transform .35s var(--ease-out); }
.service-head h3 { transition: color .3s; }
.tag { align-self: center; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--mustard); color: var(--dark); }
.tag-quiet { background: transparent; color: var(--on-dark-3); box-shadow: inset 0 0 0 1.5px var(--line-dark); }
.service-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 24px; color: var(--on-dark-2); }
.service-items li { position: relative; padding-left: 18px; }
.service-items li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 2px; background: var(--mustard); }
.service-img { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; background: var(--dark-2); }
.service-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out), filter .4s; }

@media (min-width: 960px) {
  .service { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 300px; align-items: center; }
  .service-items { grid-template-columns: 1fr; }
  .service-img { aspect-ratio: 4 / 3; }
}
@media (hover: hover) and (min-width: 960px) {
  .service-img img { filter: saturate(.35) brightness(.8); transform: scale(1.04); }
  .service:hover::before { opacity: 1; }
  .service:hover .service-img img { filter: none; transform: scale(1); }
  .service:hover .service-no { transform: translateX(6px); }
  .service:hover .service-head h3 { color: #fff; }
}

/* Before / after */
@property --pos { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
.compare.is-hinting { transition: --pos .55s var(--ease-out); }
.work { background: var(--dark-2); }
.compare { position: relative; margin: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1456 / 813; background: var(--dark); user-select: none; touch-action: pan-y; }
.compare img { width: 100%; height: 100%; object-fit: cover; }
.compare > picture { position: absolute; inset: 0; }
.compare-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-before picture { position: absolute; inset: 0; }
.compare::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 4px; margin-left: -2px; background: var(--mustard); pointer-events: none; }
.compare-handle {
  position: absolute; top: 50%; left: var(--pos); z-index: 2; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  display: grid; place-items: center; border-radius: 50%; background: var(--mustard); color: var(--dark);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); pointer-events: none; transition: transform .2s var(--ease-out);
}
.compare:hover .compare-handle, .compare-range:focus-visible ~ .compare-handle { transform: scale(1.08); }
.compare-range { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.compare:has(.compare-range:focus-visible) { outline: 3px solid var(--mustard); outline-offset: 4px; }
.compare-label { position: absolute; top: 16px; z-index: 1; padding: 6px 12px; border-radius: 999px; background: rgba(36, 22, 13, .85); color: var(--on-dark); font-weight: 700; font-size: .875rem; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.compare-label-before { left: 16px; }
.compare-label-after { right: 16px; }
.compare-note { position: absolute; left: 16px; bottom: 12px; z-index: 1; padding: 4px 10px; border-radius: 4px; background: rgba(36, 22, 13, .8); color: var(--on-dark-2); font-size: .8125rem; pointer-events: none; }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.step { display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: 8px; background: var(--dark-2); box-shadow: inset 0 0 0 1px var(--line-dark); }
.step p { color: var(--on-dark-2); }
.step-no { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--mustard); color: var(--dark); font-weight: 800; font-size: 1.25rem; }

/* Quote */
.quote { background: var(--cream); color: var(--coffee); padding-block: clamp(72px, 11vw, 128px); }
.quote .section-lead { color: var(--coffee); }
.quote-grid { display: flex; flex-wrap: wrap; gap: clamp(36px, 6vw, 72px); align-items: flex-start; }
.quote-intro { flex: 1 1 340px; display: flex; flex-direction: column; gap: 18px; }
.quote-direct { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
.quote-form {
  flex: 999 1 520px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px;
  padding: clamp(20px, 3vw, 32px); border-radius: 10px; background: var(--paper); box-shadow: 0 1px 0 rgba(48, 25, 9, .08), 0 24px 48px -28px rgba(48, 25, 9, .45);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend { font-weight: 650; font-size: .9375rem; padding: 0; }
.optional { font-weight: 450; color: var(--timber); }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius);
  border: 1.5px solid #B89A78; background: #fff; color: var(--coffee); transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input::placeholder, .field textarea::placeholder { color: #8A6E54; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--coffee); box-shadow: 0 0 0 3px rgba(194, 138, 29, .55); }
.field [aria-invalid="true"] { border-color: var(--error-dark); }
.error { color: var(--error-dark); font-size: .875rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border-radius: 999px;
  border: 1.5px solid #B89A78; font-weight: 600; font-size: .9375rem; transition: background-color .2s, border-color .2s, color .2s;
}
.chip:hover span { border-color: var(--coffee); }
.chip input:checked + span { background: var(--coffee); border-color: var(--coffee); color: var(--cream); }
.chip input:focus-visible + span { outline: 3px solid var(--mustard); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; flex-direction: column; gap: 10px; }
.form-status { min-height: 1.6em; font-weight: 600; }
.form-status.is-error { color: var(--error-dark); }
.form-status.is-ok { color: #2E5A1C; }

/* Footer */
.site-footer { background: var(--dark); padding-top: 64px; border-top: 4px solid var(--mustard); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px; padding-bottom: 48px; }
.footer-title { font-size: .875rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--mustard); margin-bottom: 14px; }
.footer-list { display: flex; flex-direction: column; gap: 8px; color: var(--on-dark-2); }
.footer-list a { text-decoration: none; display: inline-block; padding: 4px 0; }
.footer-list a:hover { color: var(--on-dark); text-decoration: underline; text-decoration-color: var(--mustard); text-underline-offset: 4px; }
.footer-base { padding-block: 20px 28px; border-top: 1px solid var(--line-dark); color: var(--on-dark-3); font-size: .875rem; }

/* Mobile action bar */
.mobile-bar { display: none; }

/* ---------- Scroll reveal (only when JS runs) ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); transition-delay: var(--stagger, 0ms); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Small screens ---------- */
@media (max-width: 859px) {
  /* Phone: the full 280px logo leaves no room for a nav, so the header only
     carries the logo and scrolls away; the bottom bar holds Call / Text / Quote. */
  :root { --header-h: 0px; }
  .site-header { position: absolute; }
  .site-header nav { display: none; }
  .site-header.is-scrolled { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
  .site-header.is-scrolled .header-inner { padding-block: 16px; }
  .hero-content { padding-top: 150px; }
  .hero-shade { background: linear-gradient(0deg, rgba(36, 22, 13, .96) 0%, rgba(36, 22, 13, .75) 45%, rgba(36, 22, 13, .35) 100%); }
  .trust-list { justify-content: flex-start; font-size: 1rem; }
  .quote-form { grid-template-columns: minmax(0, 1fr); }
  .compare { aspect-ratio: 4 / 3.4; }
  .compare-note { font-size: .75rem; left: 10px; bottom: 10px; }
  .compare-label { top: 10px; font-size: .75rem; }
  .compare-label-before { left: 10px; }
  .compare-label-after { right: 10px; }

  .mobile-bar {
    /* Call and Text are compact icon-over-label buttons, so the bar holds even
       at 320px and with a large system font; Free quote takes the rest. */
    display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: stretch;
    position: fixed; inset: auto 0 0 0; z-index: 60;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(36, 22, 13, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line-dark);
    transform: translateY(110%); transition: transform .35s var(--ease-out);
  }
  .mobile-bar.is-shown { transform: none; }
  .mobile-bar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; min-height: 52px; padding: 6px 12px;
    border-radius: 14px; text-decoration: none; font-weight: 650; font-size: .75rem; line-height: 1.1;
    white-space: nowrap; box-shadow: inset 0 0 0 1.5px var(--line-dark);
  }
  .mobile-bar a svg { width: 22px; height: 22px; flex: none; }
  .mobile-bar .mobile-bar-cta {
    flex-direction: row; padding-inline: 16px; border-radius: 999px;
    background: var(--mustard); color: var(--dark); box-shadow: none;
    font-size: 1rem; font-weight: 750;
  }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}


/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
