/* components.css — page sections, cards, forms, results and lists. */

/* ---------- Hero ---------- */
.hero { padding: 40px 0 32px; }
.hero__grid { display: grid; gap: 28px; align-items: center; }
.hero__lead { font-size: 1.2rem; max-width: 36em; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 8px; }
.hero__note { margin: 0; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.hero__note svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.hero__art { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.hero__art svg { display: block; width: 100%; height: auto; }
@media (min-width: 860px) {
  .hero { padding: 64px 0 48px; }
  .hero__grid { grid-template-columns: 1.15fr 1fr; gap: 48px; }
}

/* ---------- Cards ---------- */
.section-head { max-width: 46em; margin-bottom: 24px; }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); list-style: none; padding: 0; margin: 0; }
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-card__icon { width: 56px; height: 56px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; }
.project-card__icon svg { width: 40px; height: 40px; }
.project-card h3 { margin: 6px 0 0; font-size: 1.15rem; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.project-card h3 a:focus-visible { outline: none; }
.project-card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.project-card p { margin: 0; color: var(--muted); }
.project-card .card-cta { margin-top: auto; padding-top: 8px; font-weight: 650; color: var(--accent-dark); }

/* ---------- Steps ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 10px;
}
.steps h3 { margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); }

/* ---------- Prose / content ---------- */
.prose { max-width: 46em; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose li { margin-bottom: .35em; }
.prose table { margin: 1em 0; }
.content-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px var(--gutter); }
@media (min-width: 700px) { .content-wrap { padding: 36px 40px; } }

/* ---------- FAQ ---------- */
.faq { max-width: 46em; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); margin-bottom: 10px; }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 48px 14px 16px; min-height: 44px; font-weight: 650; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--accent); }
.faq details[open] summary::after { content: "−"; }
.faq .faq__a { padding: 0 16px 14px; }
.faq .faq__a p:last-child { margin: 0; }

/* ---------- Callouts ---------- */
.callout { border-radius: var(--radius-small); padding: 12px 16px; margin: 0 0 16px; border: 1px solid; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout ul { margin: 0; }
.callout--warning { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.callout--error { background: var(--error-bg); color: var(--error); border-color: #f1a9a1; }
.callout--info { background: var(--accent-soft); color: var(--text); border-color: #a9d3c0; }
.disclaimer { font-size: .92rem; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--warn-border); border-radius: var(--radius-small); padding: 12px 16px; color: var(--text); }
.disclaimer strong { display: block; margin-bottom: 2px; }

/* ---------- Tool page intro ---------- */
.tool-intro { padding: 8px 0 20px; }
.tool-intro .lead { font-size: 1.15rem; max-width: 40em; }
.reviewed { font-size: .9rem; color: var(--muted); }
.tool-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

/* ---------- Tool layout ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1000px) {
  .tool { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; }
  .tool__results { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px var(--gutter); box-shadow: var(--shadow); }
@media (min-width: 600px) { .panel { padding: 22px 24px; } }
.panel + .panel { margin-top: 20px; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.panel__head h2 { margin: 0; font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.panel__head p { margin: 0; }
.step-num { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1rem; font-weight: 800; flex: none; }
.panel--project { border-top: 4px solid var(--accent); }
.panel--assumptions { border-top: 4px solid var(--changed-border); }
.panel--results { border-top: 4px solid var(--text); }
.panel--results h2:focus { outline: none; }
.panel--results h2:focus-visible { outline: 3px solid var(--focus); }
.save-note { font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 14px; }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--accent-dark); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-weight: 650; font-size: .95rem; }
.label-unit { font-weight: 400; color: var(--muted); }
.field input[type="text"], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font-size: 1.05rem;
  background: #fff; border: 2px solid var(--border-strong); border-radius: var(--radius-small);
}
.field select { padding-right: 36px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231e293b' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.input-unit { position: relative; display: flex; }
.input-unit input { padding-right: 56px !important; }
.input-unit__suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .95rem; pointer-events: none; }
.field-help { margin: 0; font-size: .88rem; color: var(--muted); }
.field-msg { margin: 0; font-size: .9rem; font-weight: 600; min-height: 0; }
.field-msg:empty { display: none; }
.field.is-invalid input { border-color: var(--error); background: #fffafa; }
.field.is-invalid .field-msg { color: var(--error); }
.field.is-invalid .field-msg::before { content: "⚠ "; }
.field.is-warning input { border-color: var(--warn-border); }
.field.is-warning .field-msg { color: var(--warn-text); font-weight: 500; }

/* ---------- Zones ---------- */
.zone-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.zone { border: 1px solid var(--border); border-left: 5px solid var(--accent); border-radius: var(--radius-small); padding: 14px; background: var(--surface-2); }
.zone--subtract { border-left-color: var(--changed-border); background: #fffaf0; }
.zone__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.zone__sketch { flex: none; width: 64px; height: 44px; }
.zone__heading { flex: 1 1 120px; min-width: 0; }
.zone__title { margin: 0; font-size: 1.05rem; }
.zone__area { margin: 0; font-size: .9rem; color: var(--muted); }
.zone__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.zone__grid, .zone__dims { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.zone__dims { margin-top: 12px; }
.zone__extra { margin-top: 12px; max-width: 320px; }
.sketch { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.sketch .grid { fill: none; stroke-width: 1.2; opacity: .6; }
.sketch--sub { fill: #fdf0d8; stroke: var(--changed-border); stroke-dasharray: 5 4; }
.zone-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }

/* ---------- Assumptions ---------- */
.assumption-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.assumption { padding: 12px; border-radius: var(--radius-small); border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.assumption.is-changed { background: var(--changed-bg); border-color: var(--changed-border); box-shadow: inset 4px 0 0 var(--changed-border); }
.assumption__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.default-note { margin: 0; font-size: .86rem; color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge--changed { background: var(--changed-border); color: #fff; background: #8a5a12; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--border-strong); background: #fff; cursor: pointer; font-weight: 600; font-size: .92rem; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.price-details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.price-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; }
.price-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); margin-top: 8px; }

/* ---------- Results ---------- */
.results-empty { color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-small); padding: 16px; margin: 0; }
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-bottom: 16px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-small); padding: 10px 12px; }
.stat--primary { background: var(--accent-soft); border-color: #a9d3c0; }
.stat__label { margin: 0; font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat__value { margin: 0; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat--primary .stat__value { font-size: 1.45rem; color: var(--accent-dark); }
.stat__note { margin: 0; font-size: .82rem; color: var(--muted); }
.segmented { border: 0; padding: 0; margin: 0 0 14px; }
.segmented legend { font-weight: 650; font-size: .95rem; margin-bottom: 6px; padding: 0; }
.segmented__opts { display: inline-flex; border: 2px solid var(--accent); border-radius: 999px; padding: 2px; flex-wrap: wrap; }
.segmented label { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 650; color: var(--accent-dark); }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.segmented label:has(input:checked) { background: var(--accent); color: #fff; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.table-scroll { overflow-x: auto; max-width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.data-table caption { text-align: left; font-weight: 700; padding: 0 0 8px; }
.data-table th, .data-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { font-size: .85rem; color: var(--muted); border-bottom: 2px solid var(--border-strong); }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table tbody th { font-weight: 600; }
.data-table tfoot th, .data-table tfoot td { font-weight: 750; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.row--subtract th, .row--subtract td { color: var(--warn-text); }

.shopping-list { border: 2px solid var(--text); border-radius: var(--radius-small); padding: 16px; margin: 16px 0; background: #fff; }
.list__brand { margin: 0; font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.list__title { margin: 2px 0 2px; font-size: 1.3rem; }
.list__meta { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
.list__summary, .list__notes { margin: 0 0 12px; padding-left: 1.2em; font-size: .95rem; }
.list__table .check-col { width: 44px; text-align: center; }
.list__table input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); margin: 0; }
.list__table label { cursor: pointer; }
.list__order { font-weight: 800; font-size: 1.05rem; }
.list__assumptions { margin: 12px 0; font-size: .92rem; }
.list__assumptions summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.list__assumptions dl { margin: 0; display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 4px 14px; }
.list__assumptions dt { color: var(--muted); }
.list__assumptions dd { margin: 0; }
.list__disclaimer { font-size: .82rem; color: var(--muted); margin: 10px 0 4px; }
.list__url { font-size: .82rem; color: var(--muted); margin: 0; }
.list-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.copy-fallback { margin-top: 12px; }
.copy-fallback textarea { width: 100%; min-height: 160px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; padding: 10px; border: 2px solid var(--border-strong); border-radius: var(--radius-small); }
.status-line { min-height: 1.4em; margin: 8px 0 0; font-size: .92rem; font-weight: 600; color: var(--accent-dark); }
.result-extra { margin-top: 16px; }
.result-extra > summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.h-small { font-size: 1.05rem; margin: 16px 0 6px; }
.plain-list { list-style: none; padding: 0; margin: 0 0 8px; }
.plain-list li { padding: 4px 0; }

/* ---------- Mobile sticky summary ---------- */
.mobile-summary {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 2px solid var(--accent); box-shadow: 0 -4px 16px rgba(30, 41, 59, .12);
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
}
.mobile-summary__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: var(--max); margin: 0 auto; }
.mobile-summary p { margin: 0; font-weight: 700; font-size: .98rem; line-height: 1.3; }
.mobile-summary .label { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
@media (min-width: 1000px) { .mobile-summary { display: none !important; } }
@media (max-width: 999px) { .has-mobile-summary .site-footer { padding-bottom: 96px; } }

/* ---------- Ads (placeholders only) ---------- */
.ad-slot { min-height: 280px; margin: 32px auto; max-width: 970px; background: transparent; }
/* Empty placeholders take no space; once AdSense code is inside, the reserved min-height applies. */
.ad-slot:empty { display: none; }
@media (min-width: 768px) { .ad-slot { min-height: 250px; } }

/* ---------- Related tools ---------- */
.related { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.related a { display: block; min-height: 44px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-small); font-weight: 650; text-decoration: none; }
.related a:hover { border-color: var(--accent); }
.related span { display: block; font-weight: 400; color: var(--muted); font-size: .92rem; }

.example-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.example-table th, .example-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.example-table .num { text-align: right; }

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

/* Narrow screens: let the shopping-list columns wrap instead of scrolling. */
.list__table .num { white-space: normal; }
.list__table th, .list__table td { padding: 9px 6px; }
.shopping-list { container-type: inline-size; }
/* Narrow list (phones, or the results column on desktop): stack each row as a small card. */
@container (max-width: 520px) {
  /* Stack each list row as a small card so nothing scrolls sideways. */
  .list__table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .list__table, .list__table tbody { display: block; }
  .list__table tr { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .list__table tr > * { border: 0 !important; padding: 0 !important; text-align: left !important; }
  .list__table .check-col { grid-row: 1 / span 4; }
  .list__table td.num { grid-column: 2; }
  .list__table td.num::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 400; font-size: .9rem; }
  .list__assumptions dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .list__assumptions dd { margin-bottom: 6px; font-weight: 600; }
  .list__table th, .list__table td { padding: 8px 4px; }
  .shopping-list { padding: 12px 10px; }
}

/* ---------- Added with the gravel, patio, fence and raised-bed planners ---------- */
.assumption-groups { display: grid; gap: 16px; }
.assumption-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.assumption-group > legend { font-weight: 750; font-size: 1rem; padding: 0; margin-bottom: 8px; }
.subpanel { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; }
.subpanel > h3 { font-size: 1.05rem; margin-bottom: 8px; }
.field-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.choice-group { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.choice-group > legend { font-weight: 650; font-size: .95rem; padding: 0; margin-bottom: 6px; }
.choice { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius-small); background: #fff; cursor: pointer; margin-bottom: 8px; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice span small { display: block; color: var(--muted); font-size: .88rem; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 650; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.mix-total--bad { color: var(--error); font-weight: 650; }
.notice { display: flex; gap: 10px; align-items: flex-start; font-weight: 650; }
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.detail-table + .detail-table { margin-top: 18px; }
.plain-page { max-width: 46em; }
.plain-page .content-wrap { margin-top: 8px; }
.changelog { list-style: none; padding: 0; }
.changelog li { border-left: 3px solid var(--border-strong); padding: 4px 0 4px 12px; margin-bottom: 8px; }
.error-page { text-align: left; padding: 40px 0; }
.legal-flag { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); border-radius: var(--radius-small); padding: 12px 16px; font-weight: 600; }

.project-card--method { background: var(--surface-2); border-style: dashed; }

.prose > :first-child, .content-wrap > :first-child { margin-top: 0; }
