/* SlabQuote — paper-and-stone palette, one stylesheet, no framework. */
:root {
  --paper: #f3efe7;
  --paper-2: #ece6da;
  --ink: #23211d;
  --ink-soft: #5f584d;
  --line: #d9d1c2;
  --stone: #2f3436;
  --accent: #7a5a3a;
  --accent-soft: #efe2d2;
  --ok: #2f5d46;
  --warn: #8a4b12;
  --bad: #8f2d2d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 33, 29, 0.06), 0 8px 24px rgba(35, 33, 29, 0.05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--accent); }

.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-link {
  position: absolute; left: 12px; top: -48px; background: var(--stone); color: #fff;
  padding: 8px 14px; border-radius: 8px; z-index: 20; transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

.site-header {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: var(--paper); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--stone); color: #f6f2ea; font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px; letter-spacing: 0.04em;
}
.site-nav { display: flex; gap: 16px; margin-left: auto; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.pill {
  white-space: nowrap; flex: 0 0 auto;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); background: #fff;
}
.pill.is-pro { background: var(--stone); color: #fff; border-color: var(--stone); }

main { max-width: 1120px; margin: 0 auto; padding: 0 20px 60px; }

.hero { padding: 54px 0 26px; max-width: 820px; }
.kicker {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
.hero-sub { font-size: 1.08rem; color: var(--ink-soft); max-width: 680px; margin: 16px 0 22px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.proof {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 18px 0 0; margin: 26px 0 0;
  border-top: 1px solid var(--line); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px;
  color: var(--ink-soft);
}
.proof strong { color: var(--ink); }

.btn {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; font-weight: 600;
  border-radius: 999px; padding: 10px 18px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; display: inline-block; line-height: 1.2;
}
.btn-primary { background: var(--stone); color: #fff; }
.btn-primary:hover { background: #23282a; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.section { padding: 34px 0 10px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.section-sub { margin: 8px 0 0; color: var(--ink-soft); max-width: 720px; }

.panel {
  min-width: 0;
  position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head-tight { margin: 18px 0 8px; }
.panel-kicker {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 4px;
}
.panel-title { font-size: 1.02rem; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
input, select {
  font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); min-width: 0; width: 100%;
}
input[type="number"] { font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; position: relative; }
.piece-table, .cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.piece-table th, .piece-table td, .cost-table th, .cost-table td {
  text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.piece-table th, .cost-table th {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); font-weight: 600;
}
.piece-table input { padding: 6px 8px; font-size: 14px; }
.piece-table td:first-child { min-width: 140px; }
.piece-table select { min-width: 118px; }
.piece-table .row-remove { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; }
.piece-table .row-remove:hover { color: var(--bad); }
.cost-table td:nth-child(2) { color: var(--ink-soft); font-size: 12.5px; }
.cost-table th:last-child, .cost-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-table tfoot th, .cost-table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; padding-top: 10px; }
.cost-table tfoot tr:last-child td, .cost-table tfoot tr:last-child th { font-size: 1.02rem; }
.empty-cell { color: var(--ink-soft); font-size: 14px; padding: 14px 8px; }

.result { position: sticky; top: 76px; }
.result-price { font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 700; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.result-sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0 0 14px; }
.result-grid dt { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.result-grid dd { margin: 2px 0 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.result .btn { width: 100%; text-align: center; }
.warn-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 7px; }
.warn-list li {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12.5px; line-height: 1.45;
  padding: 8px 10px; border-radius: 9px; background: #fdf6ec; color: var(--warn); border: 1px solid #f0e0c8;
}
.warn-list li.is-bad { background: #fdf1f1; color: var(--bad); border-color: #f0d2d2; }
.warn-list:empty { display: none; }

.layout-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.slab-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.slab-card h3 { font-size: 0.95rem; display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.slab-card h3 span { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; color: var(--ink-soft); font-weight: 400; }
.slab-svg { width: 100%; height: auto; display: block; background: var(--paper-2); border-radius: 8px; }
.slab-svg .piece { fill: #d8cfc0; stroke: #6d655a; stroke-width: 1.4; }
.slab-svg .piece.alt { fill: #cfd6d2; }
.slab-svg .piece.leg { fill: #c9d6cf; stroke-dasharray: 2 1.2; }
.grade-tag { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; color: var(--ink-soft); margin: -4px 0 6px; }
.layout-spare { margin-top: 4px; }
.panel-sub { margin-top: 14px; }
.grade-totals caption, .grade-table caption { text-align: left; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); padding-bottom: 6px; }
.grade-table td, .grade-totals td { font-variant-numeric: tabular-nums; }
.grade-table .btn { padding: 4px 10px; font-size: 12px; }
.slab-svg .piece-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 3.4px; fill: #35302a; }
.slab-svg .remnant { fill: #efe9dd; stroke: #b9ae9c; stroke-width: 0.8; stroke-dasharray: 3 3; }
.layout-legend { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.pricing .plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plan ul { padding-left: 18px; margin: 10px 0; color: var(--ink-soft); }
.plan li { margin-bottom: 5px; }
.plan-price { font-size: 2rem; font-weight: 700; margin: 4px 0; }
.plan-price span { font-size: 0.95rem; color: var(--ink-soft); font-weight: 400; }
.plan-pro { border-color: var(--accent); background: linear-gradient(180deg, #fffdf9, #fff); }
.license-form { margin-top: 14px; }
.license-form .field-row { grid-template-columns: 1fr auto; align-items: end; }

.prose h3 { margin: 18px 0 6px; font-size: 1.02rem; }
.prose p, .prose li { color: var(--ink-soft); }
.prose code { background: var(--paper-2); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }
.prose ul { padding-left: 20px; }

.compliance-note { margin: 44px 0 0; padding: 16px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.compliance-note p { margin: 0; color: var(--ink-soft); font-size: 13.5px; max-width: 860px; }
.site-footer { border-top: 1px solid var(--line); padding: 22px; text-align: center; color: var(--ink-soft); }
.site-footer p { margin: 4px 0; }
.micro { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(12px);
  background: var(--stone); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; z-index: 30; max-width: 90vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

.print-doc { display: none; }

@media (max-width: 900px) {
  .grid-main { grid-template-columns: 1fr; }
  .result { position: static; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pricing .plan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main { padding: 0 14px 40px; }
  .site-nav { display: none; }
  .section-head { flex-wrap: wrap; }
  .field-row { grid-template-columns: 1fr; }
  .proof { font-size: 12px; gap: 6px 14px; }
  .piece-table td:first-child { min-width: 92px; }
  .piece-table input { padding: 5px 6px; font-size: 13px; }
}


@media (max-width: 560px) {
  .piece-table thead { display: none; }
  .piece-table, .piece-table tbody, .piece-table tr, .piece-table td { display: block; width: 100%; }
  .piece-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
    border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; position: relative;
  }
  .piece-table td { padding: 0; border: 0; }
  .piece-table td:first-child { grid-column: 1 / -1; min-width: 0; }
  .piece-table td::before {
    display: block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 3px;
  }
  .piece-table td:nth-child(2)::before { content: "Length (in)"; }
  .piece-table td:nth-child(3)::before { content: "Depth (in)"; }
  .piece-table td:nth-child(4)::before { content: "Qty"; }
  .piece-table td:nth-child(5)::before { content: "Edge"; }
  .piece-table td:nth-child(6)::before { content: "Waterfall"; }
  .piece-table td:nth-child(7)::before { content: "Grade"; }
  .piece-table td:last-child { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; background: #fff; border-radius: 50%; }
  .piece-table .row-remove { width: 26px; height: 26px; padding: 0; }
  .piece-table td:last-child::before { content: none; }
  .table-wrap { overflow-x: visible; }
  .table-wrap-scroll { overflow-x: auto; }
  .table-wrap-scroll table { min-width: 540px; }
}

@media print {
  body { background: #fff; }
  body > *:not(.print-doc) { display: none !important; }
  .print-doc { display: block; padding: 0; }
  .print-doc h1 { font-size: 20pt; }
  .print-doc h2 { font-size: 12pt; margin: 14pt 0 6pt; }
  .print-doc table { width: 100%; border-collapse: collapse; font-size: 9pt; table-layout: fixed; }
  .print-doc th, .print-doc td { border-bottom: 1px solid #ccc; padding: 4pt 3pt; text-align: left; overflow-wrap: anywhere; }
  .print-doc thead th:nth-child(1) { width: 22%; }
  .print-doc thead th:nth-child(2) { width: 20%; }
  .print-doc thead th:nth-child(3) { width: 18%; }
  .print-doc thead th:nth-child(4) { width: 14%; }
  .print-doc thead th:nth-child(5) { width: 26%; }
  .print-doc td:last-child, .print-doc th:last-child { text-align: right; }
  .print-doc .print-meta { font-size: 8.5pt; color: #555; }
  .print-doc .slab-svg { width: 62%; }
  .print-doc .print-slabs { display: flex; flex-wrap: wrap; gap: 8pt; }
}

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