/* =========================================================
   THEME-NEUTRAL BASELINE
   Prepended to every theme's CSS. Covers behavior that must work
   regardless of theme (anchor-scroll to the quote form under a sticky
   topbar) and a plain fallback for arbitrary site-authored HTML inside
   CONFIG["cost_body"] (tables, lists) that a theme's own CSS doesn't
   otherwise style.
========================================================= */
*{ box-sizing: border-box; }

/* Browsers default <figure> to `margin: 1em 40px`, which throws off any
   grid/flex pairing it sits in (e.g. an image beside a quote-form box) —
   the sibling box ends up looking like it "sticks out" below the image. */
figure{ margin: 0; }

html, body{ max-width: 100%; overflow-x: clip; }

html, body{
  scroll-behavior: smooth;
  scroll-padding-top: calc(110px + env(safe-area-inset-top));
}

#quote-panel{
  scroll-margin-top: calc(110px + env(safe-area-inset-top));
}

@media (min-width: 900px){
  html, body{ scroll-padding-top: 80px; }
  #quote-panel{ scroll-margin-top: 80px; }
}

[hidden]{ display: none !important; }

.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;
}

/* Fallback styling for arbitrary CONFIG["cost_body"] markup (tables, lists)
   that a theme's own stylesheet doesn't specifically target. */
table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 14px 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  overflow: hidden;
}
thead th{
  background: rgba(0,0,0,.04);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.12);
  white-space: nowrap;
  font-size: 13px;
}
td{
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid rgba(0,0,0,.10);
  font-size: 14px;
}
tbody tr:last-child td{ border-bottom: none; }
.table-scroll{ max-width: 100%; }
@media (max-width: 640px){
  .table-scroll{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll table{ min-width: 720px; }
}

/* Field Notebook theme: an all-weather field notebook. Yellow waterproof
   cover, top spiral, gridded pages, manila index tabs. */
:root{
  --cover:#f1c21b; --cover-d:#d7a90c; --desk:#56594a; --page:#fbfaf3; --grid:#d6e3ea; --grid-2:#bcd0db;
  --ink:#1f2328; --pencil:#4a4f57; --soft:#5d636b; --red:#c8402c; --red-d:#a2301e; --tab:#e9d9ac; --tab-2:#d9e6c4;
}
body{ margin:0; color:var(--ink); background:var(--desk); background-image:radial-gradient(rgba(255,255,255,.05) 1px, transparent 1.5px); background-size:6px 6px; font:17px/1.65 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif; }
a{ color:inherit; }

.fnb-btn, .btn{
  display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:8px 18px;
  font:800 15px/1 'Libre Franklin', sans-serif; letter-spacing:.04em; text-transform:uppercase; text-decoration:none; cursor:pointer;
  color:#fff; background:var(--red); border:2px solid var(--red-d); border-radius:4px; white-space:nowrap;
}
.fnb-btn:hover, .btn:hover{ background:var(--red-d); }
.fnb-btn:focus-visible, .btn:focus-visible{ outline:3px solid var(--cover); outline-offset:2px; }
.fnb-btn--big{ font-size:19px; min-height:52px; }
.btn.ghost{ color:var(--ink); background:transparent; border-color:var(--ink); }
.btn.ghost:hover{ background:#f0eee4; }

/* ---------- the book: yellow cover around a gridded page ---------- */
.fnb-book{
  position:relative; max-width:900px; margin:40px auto 40px; margin-right:max(140px, calc((100% - 900px) / 2));
  margin-left:max(20px, calc((100% - 900px) / 2 - 60px));
  padding:30px 16px 0; background:var(--cover); border-radius:10px 10px 12px 12px;
  box-shadow:inset 0 0 0 1px var(--cover-d), 0 30px 50px -24px rgba(0,0,0,.7);
}
.fnb-book::before{ /* the spiral along the top */
  content:""; position:absolute; left:30px; right:30px; top:-10px; height:28px;
  background:radial-gradient(ellipse 5px 13px at 50% 50%, #2b2e33 0 4px, #7d838b 4.5px 5px, transparent 5.5px) 0 0/22px 28px repeat-x;
}
.fnb-page{
  position:relative; padding:34px 44px 36px 132px; border-radius:2px;
  background-color:var(--page);
  background-image:
    linear-gradient(90deg, transparent 108px, rgba(200,64,44,.45) 108px 109px, transparent 109px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size:100% 100%, 24px 24px, 24px 24px;
  box-shadow:0 1px 0 #e7e2cf, 0 3px 0 #efeadb, 0 5px 0 #e2dcc6;
}

/* index tabs: an absolutely placed column whose nav sticks while you scroll */
.fnb-tabcol{ position:absolute; top:70px; bottom:40px; right:-122px; width:124px; }
.fnb-tabs{ position:sticky; top:24px; display:flex; flex-direction:column; gap:8px; }
.fnb-tab{
  display:flex; align-items:center; min-height:46px; padding:8px 12px 8px 18px; border-radius:0 9px 9px 0;
  background:var(--tab); border:1px solid #c7b47c; border-left:0; text-decoration:none;
  font:600 15px/1.15 'Libre Franklin', sans-serif; color:var(--ink); box-shadow:2px 2px 0 rgba(0,0,0,.15);
}
.fnb-tab--2{ background:var(--tab-2); border-color:#a9bb8c; }
.fnb-tab[aria-current="page"]{ background:var(--page); padding-left:24px; }
.fnb-tab:hover{ filter:brightness(1.05); }
.fnb-tab--cta{ min-height:64px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; color:#fff; background:var(--red); border-color:var(--red-d); }

/* page header: the printed "Name / Book no." line */
.fnb-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin:0 0 26px -88px; padding-bottom:8px; border-bottom:2px solid var(--ink); }
.fnb-brand{ display:flex; align-items:flex-end; gap:12px; text-decoration:none; }
.fnb-brand img{ display:block; width:36px; height:36px; border-radius:50%; border:1px solid var(--ink); background:#fff; }
.fnb-brand span{ display:flex; flex-direction:column; font:800 19px/1.15 'Libre Franklin', sans-serif; }

/* opening: taped photo, h1, notes, the location line */
.fnb-open{ position:relative; margin:0 0 40px; }
.fnb-open::after{ content:""; display:table; clear:both; }
.fnb-sketch{
  float:right; width:300px; margin:4px -10px 16px 28px; padding:8px 8px 4px; background:#fff; transform:rotate(1.6deg);
  box-shadow:0 2px 6px rgba(0,0,0,.2); position:relative;
}
.fnb-sketch::before, .fnb-sketch::after{
  content:""; position:absolute; width:74px; height:22px; background:rgba(245,236,200,.85); box-shadow:0 1px 1px rgba(0,0,0,.1);
}
.fnb-sketch::before{ top:-10px; left:-18px; transform:rotate(-30deg); }
.fnb-sketch::after{ top:-10px; right:-18px; transform:rotate(28deg); }
.fnb-sketch img{ display:block; width:100%; height:auto; aspect-ratio:4/3; object-fit:cover; filter:saturate(.8); }
.fnb-open h1{ margin:0 0 18px; font:800 38px/1.12 'Libre Franklin', sans-serif; letter-spacing:-.01em; }
.fnb-open h1::after{ content:""; display:block; width:180px; height:8px; margin-top:8px;
  background:linear-gradient(transparent 2px, var(--pencil) 2px 3.5px, transparent 3.5px 5.5px, var(--pencil) 5.5px 6.5px, transparent 6.5px); opacity:.7; transform:rotate(-1deg); }
.fnb-intro p{ margin:0 0 14px; font-size:19px; }
.fnb-loc{ clear:none; margin:22px 0 0; padding:14px 0 6px; }
.fnb-loc__form{ display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; }
.fnb-loc__lbl{ flex-basis:100%; margin:0; font:700 30px/1 Caveat, cursive; color:var(--ink); }
.fnb-loc__zip{
  width:190px; height:48px; padding:0 6px; border:0; border-bottom:2px solid var(--ink); background:rgba(255,255,255,.6);
  font:700 34px Caveat, cursive; letter-spacing:.2em; color:#24427a;
}
.fnb-loc__zip::placeholder{ color:#a8b0b8; letter-spacing:.04em; }
.fnb-loc__zip:focus{ outline:2px dashed var(--red); outline-offset:3px; }
.fnb-loc__form .fnb-btn{ min-height:48px; }
.fnb-loc--call{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; }

/* entries */
.fnb-entry{ position:relative; margin:0 0 38px; }
.fnb-entry h2{ margin:0 0 8px; font:800 23px/1.25 'Libre Franklin', sans-serif; }
.fnb-entry h2::after{ content:""; display:block; width:70px; height:3px; margin-top:6px; background:var(--pencil); opacity:.55; border-radius:2px; transform:rotate(-1.5deg); }
.fnb-entry p{ margin:0 0 12px; }
.fnb-entry ul{ margin:0 0 12px; padding-left:22px; }
.fnb-entry li{ margin:0 0 6px; }
.fnb-entry li::marker{ content:"\2713  "; color:var(--red); font-family:Caveat, cursive; font-size:20px; }
.fnb-box{ padding:14px 18px 4px; border:2px solid var(--pencil); border-radius:6px 14px 8px 12px; background:rgba(241,194,27,.12); transform:rotate(-.4deg); }
.fnb-box strong{ margin:0 3px; font:700 34px/1 Caveat, cursive; color:var(--red); }
.fnb-entry .table-scroll table{ margin:8px 0 12px; background:#fff; border:1.5px solid var(--pencil); border-radius:4px; }
.fnb-entry .table-scroll th{ font-size:13px; background:#f3f1e6; }
.fnb-entry .table-scroll td{ font-size:15px; }

/* life list (service area) */
.fnb-life{ margin:50px 0 0; padding-top:20px; border-top:2px solid var(--ink); }
.fnb-life h2{ margin:0 0 4px; font:800 26px/1.2 'Libre Franklin', sans-serif; }
.muted{ margin:0 0 6px; color:var(--soft); font-size:15px; }
.city-group__title{ margin:16px 0 4px; font:700 22px/1.1 Caveat, cursive; color:var(--pencil); }
.city-grid{ list-style:none; margin:0; padding:0; columns:4 150px; column-gap:18px; }
.city-grid li{ break-inside:avoid; }
.city-grid a{ display:flex; align-items:center; gap:7px; padding:2px 0; font-size:14px; text-decoration:none; }
.city-grid a::before{ content:""; flex:0 0 auto; width:10px; height:10px; border:1.5px solid var(--pencil); border-radius:2px; }
.city-grid a:hover{ color:var(--red); }

/* back cover */
.fnb-cover{ padding:26px 28px 30px; color:var(--ink); }
.fnb-cover__cta{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:14px 0; border-top:2px solid var(--ink); border-bottom:2px solid var(--ink); }
.fnb-cover__links{ display:flex; gap:18px; margin:14px 0 4px; font-size:14px; }
.fnb-cover__copy{ margin:0; font-size:14px; }

/* ---------- mobile ---------- */
@media (max-width:860px){
  .fnb-book{ margin:0; padding:22px 8px 0; border-radius:0; }
  .fnb-book::before{ left:14px; right:14px; top:-4px; height:22px; background-size:18px 22px; }
  .fnb-tabcol{ position:sticky; top:0; z-index:50; width:auto; margin:-8px -8px 10px; padding:8px 8px 0; background:var(--cover); }
  .fnb-tabs{ position:static; flex-direction:row; gap:6px; }
  .fnb-tab{ border-radius:9px 9px 0 0; border:1px solid #c7b47c; border-bottom:0; min-height:44px; padding:8px 14px; box-shadow:none; }
  .fnb-tab[aria-current="page"]{ padding-left:14px; }
  .fnb-tab--cta{ flex:1 1 auto; justify-content:center; min-height:44px; }
  .fnb-page{ padding:20px 16px 26px 16px; background-image:linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size:20px 20px, 20px 20px; }
  .fnb-head{ margin:0 0 18px; }
  .fnb-brand span{ font-size:16px; }
  .fnb-sketch{ width:132px; margin:0 -4px 8px 12px; padding:5px 5px 2px; }
  .fnb-sketch::before, .fnb-sketch::after{ width:44px; height:16px; }
  .fnb-open{ margin-bottom:30px; }
  .fnb-open h1{ font-size:27px; }
  .fnb-intro p{ font-size:17px; }
  .fnb-loc{ clear:both; padding-top:8px; }
  .fnb-loc__form{ gap:10px; }
  .fnb-loc__lbl{ font-size:27px; }
  .fnb-loc__zip{ flex:1 1 120px; width:auto; min-width:0; }
  .fnb-entry h2{ font-size:21px; }
  .city-grid{ columns:2; column-gap:12px; }
  .fnb-cover{ padding:20px 16px 26px; }
}

/* =========================================================
   STANDALONE (estimate wizard + legal pages)
========================================================= */
.est-body{ background:var(--desk); }
.est-page{
  min-height:100vh; display:grid; grid-template-rows:auto 1fr auto; max-width:1040px; margin:0 auto; background:var(--cover);
  padding:0 14px;
}
.topbar--estimate{ padding:18px 10px 12px; }
.topbar-inner--estimate{ display:flex; }
.brand--estimate{ display:flex; align-items:center; gap:12px; text-decoration:none; font:800 20px/1.15 'Libre Franklin', sans-serif; }
.brand-logo--estimate{ display:block; width:40px; height:40px; border-radius:50%; border:1px solid var(--ink); background:#fff; }
.est-main{
  padding:26px 26px 40px; background-color:var(--page);
  background-image:linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size:24px 24px, 24px 24px;
}
.est-weave{ display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); gap:34px; align-items:start; }
.est-weave-media{ padding:8px; background:#fff; transform:rotate(-1.4deg); box-shadow:0 2px 6px rgba(0,0,0,.2); }
.est-weave-media img{ display:block; width:100%; height:auto; aspect-ratio:4/3; object-fit:cover; }
.est-shell{ min-width:0; }
.est-title{ margin:0 0 12px; font:800 32px/1.15 'Libre Franklin', sans-serif; }
.est-form{ background:rgba(255,255,255,.75); border:2px solid var(--pencil); border-radius:6px 14px 8px 12px; padding:18px; }
.est-header{ margin-bottom:12px; }
.est-progress{ height:10px; border:1.5px solid var(--pencil); border-radius:6px; background:#fff; overflow:hidden; }
.est-bar{ height:100%; width:20%; background:repeating-linear-gradient(-60deg, var(--pencil) 0 2px, transparent 2px 6px); transition:width .25s; }
.est-error{ margin:10px 0; padding:6px 12px; border:2px solid var(--red); border-radius:6px; color:var(--red-d); font:700 20px Caveat, cursive; }
.est-panel label{ display:block; margin:12px 0; font:700 24px/1.1 Caveat, cursive; color:var(--ink); }
.est-panel input, .est-panel select, .est-panel textarea{
  display:block; width:100%; margin-top:4px; padding:10px 6px; border:0; border-bottom:2px solid var(--ink); background:transparent;
  font:17px 'Libre Franklin', sans-serif; color:var(--ink);
}
.est-panel textarea{ border:1.5px solid var(--ink); border-radius:4px; background:#fff; resize:vertical; }
.est-panel input:focus, .est-panel select:focus, .est-panel textarea:focus{ outline:2px dashed var(--red); outline-offset:2px; }
.est-row{ display:grid; grid-template-columns:1fr 110px 110px; gap:10px; }
.est-tcpa{ margin:12px 0 0; font-size:11px; line-height:1.4; color:var(--soft); }
.est-actions{ display:flex; justify-content:space-between; gap:10px; margin-top:16px; }
.est-thanks{ padding:16px; border:2px solid var(--pencil); border-radius:6px 14px 8px 12px; font:700 26px/1.2 Caveat, cursive; }
.legal-copy p{ margin:0 0 14px; font-size:16px; }
.est-page footer{ padding:14px 10px 20px; font-size:14px; }
@media (max-width:820px){
  .est-page{ padding:0 8px; }
  .est-main{ padding:16px 14px 30px; }
  .est-weave{ grid-template-columns:minmax(0,1fr); gap:18px; }
  .est-weave-media{ transform:none; }
  .est-weave-media img{ aspect-ratio:16/9; }
  .est-row{ grid-template-columns:1fr; }
  .est-title{ font-size:26px; }
}

/* Slash-joined service names ("Handyman/Repair/Maintenance") are one long
   unbreakable word; render_page passes its length as --h1w so phones can fit it. */
@media (max-width:760px){ h1[style*="--h1w"]{ font-size:calc((100vw - 54px) / (var(--h1w) * .56)) !important; } }

/* keep a wide (min-width:720px) cost table from widening its grid column;
   it scrolls inside its wrapper instead */
.table-scroll{ contain:inline-size; }

/* ---------- sticky nav ----------
   Desktop: the index tabs already stick beside the page. Phones: the tab row
   stays pinned on a strip of the cover. The standalone pages' top bar sticks
   too. A drop shadow fades in once content passes under (scroll-driven
   where supported). */
.topbar--estimate{ position:sticky; top:0; z-index:50; margin:0 -14px; padding-left:24px; padding-right:24px; background:var(--cover); }
@media (max-width:820px){ .topbar--estimate{ margin:0 -8px; padding-left:18px; padding-right:18px; } }
@supports (animation-timeline: scroll()){
  .topbar--estimate{ animation:fnb-lift linear both; animation-timeline:scroll(root); animation-range:0 80px; }
  @keyframes fnb-lift{ to{ box-shadow:0 8px 16px -10px rgba(0,0,0,.55); } }
}
@supports not (animation-timeline: scroll()){
  .topbar--estimate{ box-shadow:0 8px 16px -10px rgba(0,0,0,.55); }
}
@media (max-width:860px){
  @supports (animation-timeline: scroll()){
    .fnb-tabcol{ animation:fnb-lift linear both; animation-timeline:scroll(root); animation-range:0 80px; }
  }
  @supports not (animation-timeline: scroll()){
    .fnb-tabcol{ box-shadow:0 8px 16px -10px rgba(0,0,0,.55); }
  }
}
