/* MeasureTwice: a warm, workshop-notebook look.
   Cream paper, kraft brown, terracotta and sage, with stitched cards and washi tape. */

:root {
  --bg: #f5ecdc;
  --surface: #fffaf0;
  --kraft: #e9d8b8;
  --text: #3b2f25;
  --muted: #7a6753;
  --border: #e0cfb1;
  --accent: #b5562f;
  --accent-2: #5f7f4f;
  --stitch: #d7bf98;
  --shadow: #d9c6a3;
  --result-bg: #fdf6e3;
  --rule: #e6d9bf;
  --margin: #e8a48a;
  --tape-1: #e7b98a;
  --tape-2: #f1cfa6;
  --grain-opacity: 0.08;
  --mustard: #f2c45a;
  --on-accent-2: #fbf6ea;
  --ink: #3b2f25;
  --on-ink: #fff6e8;
  --tint-garden: #e3ecd6;
  --tint-building: #f5e2cc;
  --tint-indoors: #dde6ee;
  --dot: rgba(255, 255, 255, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1a15;
    --surface: #2a231c;
    --kraft: #33291f;
    --text: #f1e6d4;
    --muted: #b9a88f;
    --border: #4a3d30;
    --accent: #e58a5c;
    --accent-2: #9cbf86;
    --stitch: #5a4a39;
    --shadow: #15110d;
    --result-bg: #2f271f;
    --rule: #3d3228;
    --margin: #7a4836;
    --tape-1: #8a6440;
    --tape-2: #9e7550;
    --grain-opacity: 0.05;
    --mustard: #e0b24c;
    --on-accent-2: #1f1a15;
    --ink: #f1e6d4;
    --on-ink: #1f1a15;
    --tint-garden: #2b3427;
    --tint-building: #3a2d22;
    --tint-indoors: #262d34;
    --dot: rgba(255, 255, 255, 0.07);
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  font: 17.5px/1.65 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  position: relative;
}
/* Paper grain over the whole page. */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
img { max-width: 100%; }

h1, h2, h3, h4, .logo { font-family: "Fraunces", Georgia, "Times New Roman", serif; font-weight: 600; }
.hand { font-family: "Caveat", "Segoe Print", cursive; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap:not(.home) { max-width: 820px; }

/* ---------- Perks strip ---------- */
.topbar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px;
  background: var(--accent-2); color: var(--on-accent-2);
  font-size: 0.85rem; font-weight: 700; padding: 6px 16px; text-align: center;
}
.topbar span::before { content: "✓ "; opacity: 0.85; }
@media (max-width: 560px) { .topbar span:nth-child(n+3) { display: none; } }

/* ---------- Header ---------- */
header.site {
  z-index: 10; /* keeps the search dropdown above the page */
  background: var(--kraft);
  border-bottom: 2px dashed var(--stitch);
  box-shadow: 0 6px 0 -3px var(--bg), 0 7px 0 -2px var(--border);
}
header.site .wrap { padding-top: 14px; padding-bottom: 6px; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px; flex: none;
  font-size: 1.5rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.logo img { width: 42px; height: 42px; filter: drop-shadow(0 2px 0 var(--shadow)); }
.logo em { color: var(--accent); font-style: italic; }
.logo-tag {
  font: 800 0.68rem "Nunito", sans-serif; letter-spacing: 0.08em;
  background: var(--mustard); color: #3b2f25; padding: 2px 7px; border-radius: 6px;
  transform: rotate(-6deg) translateY(-8px); margin-left: -6px;
}

/* Big rounded search bar. */
.search { position: relative; flex: 1 1 300px; max-width: 620px; }
.search input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 2px solid var(--text); border-radius: 999px;
  padding: 11px 58px 11px 20px; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 3px solid var(--mustard); outline-offset: 2px; }
.search input::-webkit-search-cancel-button { display: none; }
.search button {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: #fff;
}
.search button:hover { filter: brightness(1.08); }
.search-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 18px 40px -16px rgba(60, 35, 15, 0.45); padding: 8px; max-height: 70vh; overflow: auto;
}
.search-results a {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none;
}
.search-results a.active, .search-results a:hover { background: var(--kraft); }
.search-results img { width: 34px; height: 34px; flex: none; }
.search-results strong { display: block; font-family: "Fraunces", Georgia, serif; }
.search-results small { color: var(--muted); font-size: 0.85rem; }
.search-label, .search-empty { margin: 4px 10px 6px; font-size: 0.85rem; color: var(--muted); }
.search-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; }

/* Category links under the header, scrollable on phones. */
.catbar { display: flex; gap: 4px 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 6px; scrollbar-width: none; }
.catbar::-webkit-scrollbar { display: none; }
.catbar a {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 6px 13px 6px 8px; border-radius: 999px;
}
.catbar a:hover { background: var(--surface); color: var(--accent); }
.catbar img { width: 24px; height: 24px; }

/* ---------- Page text ---------- */
main.wrap { padding-top: 34px; padding-bottom: 56px; }
h1 { font-size: 2.2rem; line-height: 1.15; margin: 0 0 10px; display: flex; align-items: center; gap: 12px; }
h1 .h-icon { width: 52px; height: 52px; flex: none; }
/* Hand-drawn squiggle under the page title. */
h1 + .lede::before {
  content: ""; display: block; width: 150px; height: 12px; margin: -2px 0 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 12'%3E%3Cpath d='M2 7 C 14 1, 24 11, 37 6 S 61 1, 74 6 S 98 11, 112 5 S 136 2, 148 7' fill='none' stroke='%23c9744c' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
}
h2 { font-size: 1.45rem; margin: 40px 0 8px; }
h3 { font-size: 1.15rem; margin: 26px 0 4px; }
.lede { color: var(--muted); font-size: 1.08rem; margin: 0 0 30px; }
li { margin: 3px 0; }
li::marker { color: var(--accent); }

/* ---------- Calculator card ---------- */
.calc {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 22px 22px;
  box-shadow: 0 3px 0 var(--shadow), 0 14px 30px -18px rgba(80, 50, 20, 0.35);
}
/* Washi tape holding the card down. */
.calc::before {
  content: "";
  position: absolute; top: -13px; left: 50%; width: 120px; height: 26px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: repeating-linear-gradient(45deg, var(--tape-1) 0 7px, var(--tape-2) 7px 14px);
  opacity: 0.9;
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 10%, 96% 0, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%);
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; font-weight: 700; color: var(--muted); }
.fields input, .fields select {
  font: inherit; font-weight: 600; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 11px; width: 100%;
}
.fields input:focus, .fields select:focus { outline: 2.5px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* Result looks like a page torn from a ruled notepad. */
.result {
  margin-top: 22px; padding: 14px 16px 14px 48px; border-radius: 6px 12px 12px 6px;
  background-color: var(--result-bg);
  background-image:
    linear-gradient(90deg, transparent 32px, var(--margin) 32px, var(--margin) 34px, transparent 34px),
    repeating-linear-gradient(to bottom, transparent 0 27px, var(--rule) 27px 28px);
  border: 1px solid var(--border);
}
.result .big { font-family: "Fraunces", Georgia, serif; font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1.3; }
.result ul { margin: 6px 0 0; padding-left: 18px; }
.result .note { font-family: "Caveat", cursive; font-size: 1.3rem; color: var(--accent-2); margin: 8px 0 0; line-height: 1.2; }

[hidden] { display: none !important; }

/* Share and print buttons under the result. */
.calc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
.calc-actions button {
  font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  color: var(--text); background: var(--kraft);
  border: 1.5px dashed var(--stitch); border-radius: 999px; padding: 6px 14px;
}
.calc-actions button:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.calc-actions .status { font-family: "Caveat", cursive; font-size: 1.3rem; color: var(--accent-2); }

/* ---------- Quick answers (FAQ) ---------- */
.faq h3 { position: relative; padding-left: 30px; }
.faq h3::before {
  content: "Q"; position: absolute; left: 0; top: -1px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 0.8rem "Nunito", sans-serif; color: var(--surface); background: var(--accent-2);
}
.faq p { margin-top: 0; padding-left: 30px; }

/* ---------- Home: seasonal banner ---------- */
main.home { padding-top: 26px; }
.hero-banner {
  display: grid; grid-template-columns: 1.15fr 1fr; overflow: hidden;
  border-radius: 22px; border: 1px solid var(--border);
  background: var(--tint-garden); box-shadow: 0 3px 0 var(--shadow);
}
.hero-banner[data-season="summer"] { background: var(--tint-indoors); }
.hero-banner[data-season="fall"] { background: var(--tint-building); }
.hero-banner[data-season="winter"] { background: var(--tint-indoors); }
.hero-copy { padding: 38px 36px; align-self: center; }
.hero-tag {
  display: inline-block; font: 700 1.45rem/1 "Caveat", cursive; color: var(--accent);
  transform: rotate(-2deg); margin-bottom: 6px;
}
.hero-banner h1 { display: block; font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.1; margin: 0 0 12px; }
.hero-text { color: var(--muted); font-size: 1.08rem; margin: 0 0 22px; max-width: 30em; }
.btn {
  display: inline-block; background: var(--ink); color: var(--on-ink); text-decoration: none;
  font-weight: 800; padding: 12px 24px; border-radius: 999px; box-shadow: 0 3px 0 var(--shadow);
  transition: transform 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
/* Pinboard of "polaroids" on kraft paper. */
.hero-board {
  position: relative; min-height: 270px; background: var(--kraft);
  background-image: radial-gradient(var(--stitch) 1px, transparent 1.4px); background-size: 14px 14px;
}
.photo {
  position: absolute; width: 132px; padding: 10px 10px 4px; background: #fffdf8; border-radius: 4px;
  box-shadow: 0 8px 18px -8px rgba(60, 35, 15, 0.5); text-decoration: none; transition: transform 0.2s ease;
}
.photo img { display: block; width: 100%; aspect-ratio: 1; padding: 18px; background: #f6efe1; border-radius: 2px; }
.photo figcaption { font: 700 1.2rem/1.6 "Caveat", cursive; color: #3b2f25; text-align: center; }
.photo::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 58px; height: 18px; transform: translateX(-50%) rotate(3deg);
  background: repeating-linear-gradient(45deg, var(--tape-1) 0 6px, var(--tape-2) 6px 12px); opacity: 0.9;
}
.photo:nth-child(1) { left: 8%; top: 30px; transform: rotate(-6deg); }
.photo:nth-child(2) { left: 38%; top: 70px; transform: rotate(4deg); z-index: 1; }
.photo:nth-child(3) { right: 6%; top: 22px; transform: rotate(-2deg); }
.photo:hover { transform: rotate(0) scale(1.04); z-index: 2; }

/* Perks row */
.perks {
  list-style: none; padding: 0; margin: 22px 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px;
}
.perks li {
  margin: 0; padding: 12px 14px 12px 46px; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.perks li::before {
  content: "✓"; position: absolute; left: 13px; top: 13px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 800; color: var(--on-accent-2); background: var(--accent-2);
}
.perks strong { display: block; font-size: 0.98rem; }
.perks span { color: var(--muted); font-size: 0.88rem; line-height: 1.35; display: block; }

.section-title { font-size: 1.65rem; margin: 44px 0 14px; scroll-margin-top: 16px; }
.section-sub { color: var(--muted); margin: -8px 0 16px; }

/* Round category bubbles, scrollable sideways. */
.bubbles {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 4px; padding: 4px 2px 10px; margin-bottom: 4px;
}
@media (max-width: 700px) {
  .bubbles { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
  .bubbles::-webkit-scrollbar { display: none; }
}
.bubble {
  flex: none; width: 92px; scroll-snap-align: start; text-align: center;
  color: var(--text); text-decoration: none; font-size: 0.82rem; font-weight: 700; line-height: 1.25;
}
.bubble span {
  display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 50%;
  background: var(--tint); border: 2px solid transparent; transition: border-color 0.15s ease, transform 0.15s ease;
}
.bubble img { width: 42px; height: 42px; }
.bubble:hover span { border-color: var(--accent); transform: translateY(-2px); }

/* Calculator tiles: picture on top, caption under it. */
.tint-garden { --tint: var(--tint-garden); }
.tint-building { --tint: var(--tint-building); }
.tint-indoors { --tint: var(--tint-indoors); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 42vw), 1fr)); gap: 16px; }
.tile {
  display: block; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  box-shadow: 0 3px 0 var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--shadow); }
.tile-art {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3;
  background-color: var(--tint);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.6px); background-size: 16px 16px;
}
.tile-art img { width: 46%; max-width: 92px; transition: transform 0.2s ease; }
.tile:hover .tile-art img { transform: rotate(-4deg) scale(1.06); }
.tile-body { padding: 12px 14px 14px; }
.tile-body strong { display: block; font-family: "Fraunces", Georgia, serif; font-size: 1.1rem; }
.tile-body span { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.tiles-small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tiles-small .tile-art { aspect-ratio: 16 / 9; }
.tiles-small .tile-art img { width: 30%; }

/* Sticker badges */
.badge {
  position: absolute; top: 10px; left: 10px; transform: rotate(-5deg);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; box-shadow: 0 2px 0 rgba(60, 35, 15, 0.25);
}
.badge-popular { background: var(--mustard); color: #3b2f25; }
.badge-new { background: var(--accent-2); color: var(--on-accent-2); }

/* "Plan a whole project" boxes */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  box-shadow: 0 3px 0 var(--shadow); border-top: 6px solid var(--tint);
}
.project h3 { margin: 0 0 10px; font-size: 1.2rem; }
.project ol { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: step; }
.project li { margin: 0 0 6px; counter-increment: step; }
.project li a {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px;
  background: var(--tint); color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.95rem;
}
.project li a::before {
  content: counter(step); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; background: var(--surface); color: var(--muted);
}
.project li img { width: 30px; height: 30px; }
.project li a:hover { outline: 2px solid var(--accent); }
.project-go { font-weight: 800; text-decoration: none; }
.project-go:hover { text-decoration: underline; }

/* ---------- Calculator pages: breadcrumbs and related ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 0.88rem; color: var(--muted); margin: -12px 0 12px; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 700; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--text); font-weight: 700; }
.related h2 { margin-bottom: 14px; }

@media (max-width: 700px) {
  .hero-banner { grid-template-columns: 1fr; }
  .hero-copy { padding: 26px 22px 22px; }
  .hero-board { min-height: 200px; }
  .photo { width: 104px; }
  .photo img { padding: 14px; }
  .photo:nth-child(2) { top: 50px; }
}

/* ---------- Tables ---------- */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.95rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th { background: var(--kraft); font-family: "Fraunces", Georgia, serif; font-weight: 600; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px dashed var(--border); }
tr:last-child td { border-bottom: 0; }

/* Tip box with a little sticky-note feel. */
.tip {
  background: var(--kraft); border-radius: 4px 14px 14px 14px; padding: 14px 18px; margin: 24px 0;
  border-left: 4px solid var(--accent-2);
}
.tip strong { color: var(--accent-2); }

/* Ad slots: empty until you paste in an ad unit, so they take no space. */
.ad-slot { margin: 28px 0; }
.ad-slot:empty { display: none; }

/* ---------- Footer ---------- */
footer.site {
  background: var(--kraft); border-top: 2px dashed var(--stitch);
  color: var(--muted); font-size: 0.92rem;
}
footer.site .wrap { padding-top: 26px; padding-bottom: 30px; }
.foot-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin-bottom: 18px; }
.foot-cols h4 { margin: 0 0 6px; font-size: 1rem; color: var(--text); }
.foot-cols a { display: block; color: var(--muted); text-decoration: none; padding: 1px 0; }
.foot-cols a:hover { color: var(--accent); }
footer.site p { margin: 0; }

/* ---------- Printable shopping list ---------- */
.print-sheet { display: none; }
@media print {
  body::before, header.site, main, footer.site { display: none !important; }
  body { background: #fff; color: #222; }
  .print-sheet {
    display: block; max-width: 6.5in; margin: 0 auto; padding: 0.3in 0.4in;
    border: 2px dashed #c9a87a; border-radius: 14px; color: #222;
  }
  .print-sheet h2 { font-family: "Caveat", cursive; font-size: 2.6rem; margin: 0; color: #b5562f; }
  .print-sheet .for { font-family: "Fraunces", Georgia, serif; font-size: 1.2rem; margin: 0 0 12px; }
  .print-sheet h3 { font-size: 1rem; margin: 18px 0 6px; color: #5f7f4f; text-transform: uppercase; letter-spacing: 0.06em; }
  .print-sheet ul { list-style: none; padding: 0; margin: 0; }
  .print-sheet .checks li {
    display: flex; gap: 12px; align-items: center; padding: 7px 0;
    border-bottom: 1px solid #e3d6bf; font-size: 1.05rem;
  }
  .print-sheet .box { width: 16px; height: 16px; border: 2px solid #b5562f; border-radius: 3px; flex: none; }
  .print-sheet .measured li { padding: 2px 0; font-size: 0.95rem; }
  .print-sheet .from { margin: 20px 0 0; font-size: 0.8rem; color: #777; }
}
