:root {
  --paper: #faf8f2;
  --card: #ffffff;
  --ink: #17241c;
  --ink-soft: #5a6a5f;
  --green: #2f6b4f;
  --green-deep: #234f3b;
  --green-wash: #eef4ef;
  --line: #e2dfd2;
  --line-soft: #eeece2;
  --clay: #b5651d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 36, 28, 0.04), 0 8px 24px rgba(23, 36, 28, 0.05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; margin: 0; }

p { margin: 0; }

/* ---------- header / footer ---------- */
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--green) 0%, var(--green-deep) 100%);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 3px;
  background: var(--paper);
  clip-path: polygon(0 100%, 0 45%, 45% 45%, 45% 0, 100% 0, 100% 100%);
}

.brand-name { font-family: var(--serif); font-size: 1.15rem; }

.head-link {
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.head-link:hover { color: var(--ink); border-color: var(--line); }

.site-foot {
  max-width: 1120px;
  margin: 44px auto 0;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.site-foot a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- home ---------- */
.home-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(250, 248, 242, 0.36) 0%, rgba(250, 248, 242, 0.28) 50%, rgba(250, 248, 242, 0.72) 100%),
    url("home-calc.jpg") center / cover no-repeat,
    var(--paper);
  background-attachment: fixed;
}

.home-body .site-head { width: 100%; }

/* Same quiet text link, just dark enough to read against the photo. */
.home-body .head-link {
  color: #142a1f;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(250, 248, 242, 0.95), 0 0 14px rgba(250, 248, 242, 0.95);
}

.home-body .head-link:hover {
  color: #091510;
  border-color: currentColor;
}

.home-body .site-foot {
  width: 100%;
  margin-top: 0;
  border-top: 0;
  text-align: center;
}

.home-slim {
  position: relative;
  /* The big glow behind the heading is wider than a phone. Clipping it here
     stops the whole page sliding sideways, without cutting the glow itself. */
  overflow-x: clip;
  flex: 1;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
    text-align: center;
}

.home-slim::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(130vh, 880px);
  height: min(130vh, 880px);
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    rgba(250, 248, 242, 0.82) 0%,
    rgba(250, 248, 242, 0.52) 46%,
    rgba(250, 248, 242, 0) 78%
  );
  pointer-events: none;
}

.home-slim > * { position: relative; z-index: 1; }

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 14px;
}

.home-slim h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 15ch;
  text-shadow: 0 1px 3px rgba(250, 248, 242, 0.95), 0 0 28px rgba(250, 248, 242, 1);
}

.home-slim .lede {
  text-shadow: 0 1px 2px rgba(250, 248, 242, 0.95), 0 0 18px rgba(250, 248, 242, 0.95);
}

.home-slim .lede { margin: 14px auto 0; max-width: 42ch; }

/* ---------- US or metric, on the home screen ---------- */

/* It stands out by colour, not by size: the same 0.95rem as the line above
   it, with the clay accent that nothing else on this screen uses. */
.unit-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 16px;
  padding: 4px;
  border: 1.5px solid rgba(181, 101, 29, 0.45);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(181, 101, 29, 0.12), 0 12px 26px rgba(181, 101, 29, 0.1);
}

.unit-switch-label {
  padding: 0 9px 0 11px;
  color: var(--clay);
  font-size: inherit;
  font-weight: 500;
}

.unit-choice {
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  padding: 5px 15px;
  background: transparent;
  color: var(--clay);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.unit-choice:hover { background: rgba(181, 101, 29, 0.12); }

.unit-choice.is-on {
  background: var(--clay);
  color: #fff;
  box-shadow: 0 2px 8px rgba(181, 101, 29, 0.32);
}

.unit-choice:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

.home-slim .search-wrap {
  width: 100%;
  max-width: 540px;
  margin-top: 28px;
  box-shadow: 0 2px 4px rgba(23, 36, 28, 0.05), 0 18px 40px rgba(23, 36, 28, 0.07);
}

.home-slim .search-wrap:hover { border-color: #c8d5ca; }

.home-slim .search-wrap:focus-within { transform: translateY(-1px); }

.home-slim #search {
  font-size: 1.05rem;
  padding: 16px 12px;
}

.buddy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.buddy-img {
  width: 76px;
  height: 76px;
  flex: none;
  border-radius: 50%;
  background: #faf8f2;
  box-shadow: 0 0 0 7px rgba(250, 248, 242, 0.55), 0 12px 26px rgba(23, 36, 28, 0.14);
}

.buddy-say {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-style: italic;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(250, 248, 242, 0.95), 0 0 16px rgba(250, 248, 242, 0.95);
  transition: opacity 0.25s ease;
}

.buddy-say.is-changing { opacity: 0; }


.lede {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 10px;
  max-width: 56ch;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 18px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0 6px 0 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 107, 79, 0.1), var(--shadow);
}

.search-icon { width: 20px; height: 20px; color: var(--ink-soft); flex: none; }

#search {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 1.02rem;
  color: var(--ink);
  padding: 13px 12px;
  min-width: 0;
}

#search::placeholder { color: #93a096; }
#search::-webkit-search-cancel-button { cursor: pointer; }

.search-go {
  flex: none;
  border: 0;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  margin-right: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-go:hover { background: var(--green-deep); }

.key-hint {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  margin-right: 12px;
  background: var(--paper);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover { border-color: var(--green); color: var(--green); }

.chip.is-on {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.chip-n {
  margin-left: 7px;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

.chip.is-on .chip-n { opacity: 0.75; }


/* ---------- result bar / cards ---------- */
.browse {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 0;
}

.browse-head {
  max-width: 640px;
  padding: 14px 0 24px;
}

.browse-head h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.35rem);
  line-height: 1.15;
  margin-bottom: 8px;
}

.browse-head h1 .q-hl {
  background: linear-gradient(transparent 64%, rgba(79, 138, 103, 0.24) 64%);
  font-style: normal;
  white-space: nowrap;
}

/* Results cards: topic spine, lift on hover, arrow slides in. */
.browse .card {
  border-left: 3px solid var(--cat, var(--line));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}


.browse .card:hover {
  transform: translateY(-4px);
  border-color: #cdd8ce;
  box-shadow: 0 2px 4px rgba(23, 36, 28, 0.05), 0 16px 32px rgba(23, 36, 28, 0.1);
}

.browse .card-go {
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.browse .card:hover .card-go {
  opacity: 1;
  transform: translateX(3px);
}

.browse .chip.is-on {
  background: var(--cat, var(--green));
  border-color: var(--cat, var(--green));
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.14);
}

.browse .chip:active {
  transform: scale(0.97);
}

.count { font-size: 0.88rem; color: var(--ink-soft); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 22px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #cdd8ce;
  box-shadow: var(--shadow);
}

.card-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  font-weight: 600;
}

.card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat, var(--green));
  flex: none;
}

.card-name {
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card-tag { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.45; }

.card-go {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--green);
  opacity: 0.6;
  transition: opacity 0.16s ease;
}

.card:hover .card-go { opacity: 1; }

.empty { color: var(--ink-soft); padding: 32px 0; }

/* ---------- calculator page ---------- */
.calc-page { max-width: 1060px; margin: 0 auto; padding: 8px 24px 0; }

.loading { color: var(--ink-soft); padding: 40px 0; }

.crumbs {
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 8px 0 26px;
}

.crumbs a { text-decoration: none; border-bottom: 1px solid var(--line); }
.crumbs a:hover { color: var(--ink); }

.calc-head { max-width: 700px; }

.intro {
  margin-top: 12px;
  font-size: 0.98rem;
  line-height: 1.6;
  color: #3f4e44;
}
.calc-head h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); line-height: 1.1; }
.calc-head .lede { margin-top: 12px; font-size: 1.02rem; }
.calc-head .eyebrow { margin-bottom: 10px; }

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 20px;
  margin-top: 32px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.panel-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-weight: 600;
  margin-bottom: 16px;
}

/* The panel's own heading row: the measurements label, and the units the
   answers will use beside it. */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-head .panel-title { margin-bottom: 0; }

/* On a calculator page the switch takes the page's own green, so it reads as
   part of the form rather than a sticker, and still stands out from the cream
   around it. It is a different colour from the home screen's clay on purpose. */
.unit-switch.is-calc {
  margin: 0;
  padding: 3px;
  gap: 2px;
  font-size: 0.8rem;
  border-color: rgba(47, 107, 79, 0.4);
  background: var(--green-wash);
  box-shadow: none;
}

.unit-switch.is-calc .unit-switch-label {
  padding: 0 7px 0 8px;
  color: var(--green-deep);
}

.unit-switch.is-calc .unit-choice {
  padding: 3px 11px;
  color: var(--green-deep);
}

.unit-switch.is-calc .unit-choice:hover { background: rgba(47, 107, 79, 0.14); }

.unit-switch.is-calc .unit-choice.is-on {
  background: var(--green);
  color: #fff;
  box-shadow: 0 1px 4px rgba(35, 79, 59, 0.35);
}

.unit-switch.is-calc .unit-choice:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.inputs { display: flex; flex-direction: column; gap: 14px; }

.field { display: block; }

.field-label {
  display: block;
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field-help {
  display: block;
  margin-top: 5px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
  opacity: 0.85;
}

.field-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcf8;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.1);
}

.field-input input,
.field-input select {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  appearance: none;
}

.field-input select {
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235b6b60' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.unit {
  flex: none;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 0 12px;
  border-left: 1px solid var(--line-soft);
  white-space: nowrap;
}

.hint { margin-top: 14px; font-size: 0.78rem; color: var(--ink-soft); }

/* ---------- extra areas ---------- */
.area { display: flex; flex-direction: column; gap: 14px; }

.area:not(:first-child) {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fcfbf6;
}

.area-head { display: none; }

.multi .area-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: -2px;
}

.area-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ink-soft);
}

.area-remove {
  padding: 2px 10px;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.area-remove:hover { color: var(--ink); border-color: var(--ink-soft); }

.add-area {
  margin-top: 2px;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
  background: none;
  border: 1px dashed #c3d3c8;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.add-area:hover { background: rgba(47, 107, 79, 0.06); border-color: var(--green); }

.add-area:disabled {
  color: var(--ink-soft);
  border-style: solid;
  border-color: var(--line);
  background: none;
  cursor: default;
  opacity: 0.7;
}

.area-list { margin-top: 14px; }

.area-list summary { cursor: pointer; font-size: 0.84rem; color: var(--ink-soft); }

.area-list ol { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }

.area-list li { font-size: 0.88rem; }

.area-list li span { color: var(--ink-soft); }

.area-list li strong { font-variant-numeric: tabular-nums; }

.diagram-panel { background: linear-gradient(180deg, #ffffff 0%, #fbfaf4 100%); }

.diagram { display: flex; align-items: center; justify-content: center; min-height: 240px; }

.diagram-svg { width: 100%; height: auto; max-height: 320px; overflow: visible; }

.dg-label { font-family: var(--sans); font-size: 12px; fill: #6a7a6e; }
.dg-soft { font-family: var(--sans); font-size: 12.5px; fill: #6a7a6e; }
.dg-value { font-family: var(--sans); font-size: 12px; fill: var(--ink); font-weight: 600; }
.dg-strong { font-family: var(--serif); font-size: 17px; fill: var(--ink); }
.dg-big { font-family: var(--serif); font-size: 30px; fill: var(--ink); }
.dg-tick { font-family: var(--sans); font-size: 11px; fill: #4a584d; }

.dg-bar, .dg-bar-v, .dg-arc { transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1); }

.dg-cell { animation: cellIn 0.32s ease both; }

@keyframes cellIn {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- answer panel ---------- */
.answer {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  padding: 26px 28px;
  background: var(--green-wash);
  border: 1px solid #d9e6dc;
  border-radius: var(--radius);
}

.answer-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  font-weight: 600;
}

.answer-value {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.answer-unit { color: var(--ink-soft); font-size: 0.9rem; }

.answer-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin: 0; }

.answer-rows .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed #cfdcd3;
  padding-bottom: 6px;
}

.answer-rows dt { font-size: 0.82rem; color: var(--ink-soft); }
.answer-rows dd { margin: 0; font-size: 0.86rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- copy sections ---------- */
.copy {
  margin-top: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px 52px;
  align-items: start;
}

.copy .block { min-width: 0; }

.copy h2 {
  font-size: 1.18rem;
  margin-bottom: 12px;
}

.copy p { color: #38473c; }

.steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 11px;
  counter-reset: step;
}

.steps[hidden] { display: none; }

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 0.94rem;
  color: #2c3b31;
}

.steps li::before {
  content: counter(step);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 19px;
  text-align: center;
  width: 24px;
  height: 20px;
  border-radius: 999px;
  background: var(--green-wash);
  color: var(--green);
  border: 1px solid #d9e6dc;
  margin-top: 1px;
}

.steps li:last-child::before {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.assumes-box {
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.assumes-box h2 { font-size: 1rem; margin-bottom: 10px; }

.assumes {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
  color: #4a584d;
}

.assumes li { margin-bottom: 6px; }
.assumes li:last-child { margin-bottom: 0; }

.faq { display: grid; }

.faq-item {
  border-top: 1px solid var(--line-soft);
  padding: 12px 0;
}

.faq-item summary {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

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

.faq-item summary::after {
  content: "+";
  color: var(--green);
  font-weight: 400;
}

.faq-item[open] summary::after { content: "–"; }

.faq-item p { margin-top: 8px; font-size: 0.92rem; color: #4a584d; }

.tips { margin: 0; padding-left: 20px; color: #38473c; }
.tips li { margin-bottom: 8px; }

.disclaimer {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 16px 18px;
  background: #f4f1e6;
  border-left: 3px solid var(--clay);
  border-radius: 6px;
  font-size: 0.86rem;
  color: #56493a;
}

/* ---------- related ---------- */
.related { margin-top: 48px; }
.related h2 { font-size: 1.15rem; margin-bottom: 16px; }
.cards-small { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards-small .card { padding: 18px; }
.cards-small .card-go { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .calc-grid,
  .answer,
  .copy { grid-template-columns: minmax(0, 1fr); }
  .calc-grid > *,
  .answer > *,
  .copy > * { min-width: 0; }
  .answer-rows { grid-template-columns: minmax(0, 1fr); }
  .home-slim { padding: 18px; }
  .home-body { background-attachment: scroll; }
  .key-hint { display: none; }
}

@media (max-width: 520px) {
  .site-head { padding: 18px 18px; }
  .home, .calc-page { padding-left: 18px; padding-right: 18px; }
  .cards { grid-template-columns: 1fr; }
  .search-go { padding: 11px 14px; }
  .panel { padding: 18px; }
  .answer { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- private visitors page ---------- */
.stats-page { padding-top: 24px; max-width: 900px; }

.stats-lock {
  margin: 26px 0 8px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 460px;
}

.stats-unlock { margin-top: 14px; }

.stats-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f1efe4;
  color: var(--ink);
  font-size: 0.92rem;
}
.stats-message.is-error { background: #f7e9e4; color: #7c3225; }

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.stats-live {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 2px 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}
.stats-live::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: live-dot 2.4s ease-in-out infinite;
}
@keyframes live-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.stats-kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-kpi-label { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.stats-kpi-value { font-size: 1.9rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.stats-kpi-note { font-size: 0.78rem; color: var(--ink-soft); }

.stats-block { margin-top: 30px; }
.stats-block h2 { font-size: 1.05rem; margin-bottom: 12px; }

.stats-days { display: flex; flex-direction: column; gap: 6px; }
.stats-day {
  display: grid;
  grid-template-columns: 58px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.stats-day.is-quiet { opacity: 0.55; }
.stats-day-label { white-space: nowrap; }
.stats-day-bar { height: 8px; border-radius: 999px; background: #ece8db; overflow: hidden; }
.stats-day-bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.stats-day-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }

.stats-list { list-style: none; margin: 0; padding: 0; }
.stats-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.94rem;
}
.stats-list li:last-child { border-bottom: 0; }
.stats-term { color: var(--ink); }
.stats-count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stats-empty { color: var(--ink-soft); font-size: 0.9rem; }

.stats-recent { list-style: none; margin: 0; padding: 0; }
.stats-recent li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.92rem;
}
.stats-recent li:last-child { border-bottom: 0; }
.stats-when { color: var(--ink-soft); white-space: nowrap; font-size: 0.82rem; }

.stats-note { margin-top: 34px; }
.stats-relock {
  margin-left: 6px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--green-deep);
  text-decoration: underline;
  cursor: pointer;
}

/* the detail added to the visitors page: range pills, bars, readouts */
.stats-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.stats-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}
.stats-pill.is-on { background: var(--green); border-color: var(--green); color: #fff; }

.stats-hint { margin: 0 0 8px; }
.stats-sub { font-size: 0.95rem; margin-top: 24px; }

.stats-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.94rem;
}
.stats-bar:last-child { border-bottom: 0; }
.stats-bar-main { display: block; min-width: 0; }
.stats-bar-note { display: block; font-size: 0.76rem; color: var(--ink-soft); margin-top: 2px; }
.stats-bar-track {
  display: block;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: #ece8db;
  overflow: hidden;
}
.stats-bar-track span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.stats-bar .stats-count { text-align: right; }

.stats-readout { display: flex; flex-direction: column; gap: 10px; }
.stats-readout-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.stats-readout-row strong { color: var(--ink); font-size: 1.1rem; font-variant-numeric: tabular-nums; }

.stats-hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  height: 74px;
  align-items: stretch;
  margin-top: 6px;
}
.stats-hour {
  display: flex;
  align-items: flex-end;
  background: #ece8db;
  border-radius: 3px;
  overflow: hidden;
}
.stats-hour > span { display: block; width: 100%; background: var(--green); border-radius: 3px; }
.stats-hours-labels {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  margin-top: 5px;
  font-size: 0.6rem;
  color: var(--ink-soft);
}
.stats-hours-labels span:nth-child(n) { white-space: nowrap; }
.stats-hours-labels span:nth-child(12) { text-align: center; }
.stats-hours-labels span:nth-child(19) { text-align: center; }

.stats-miss {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c4a35;
  background: #f7e9e4;
  border-radius: 999px;
  padding: 2px 7px;
  margin-left: 4px;
}

@media (max-width: 620px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stats-kpi-value { font-size: 1.6rem; }
}

/* ---------- small fixes: cards, reset, empty state ---------- */
/* Cards arrive with a CSS-only entrance. Because the animation ends at its
   natural state, a filtered list can never be left faded or invisible. */
.browse .card {
  animation: card-in 0.34s ease backwards;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .browse .card { animation: none; }
}

.empty-clear {
  margin-left: 6px;
  padding: 2px 10px;
  font: inherit;
  color: var(--green);
  background: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  cursor: pointer;
}

.empty-clear:hover { background: rgba(47, 107, 79, 0.08); }

.reset-link {
  margin-top: 14px;
  padding: 0;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
}

.reset-link:hover { color: var(--green); }
