/* PaintCalc — "paint store counter" light theme.
   Warm kraft-paper surfaces, ink text, terracotta primary + deep teal accent:
   a hardware-store look distinct from the dark instrument-panel and developer
   palettes on sibling nxtolerance sites. Colors flow through base vars. */

:root {
  --bg: #f7f2e9;
  --surface: #fffdf7;
  --surface-2: #f0e8d8;
  --text: #2b241c;
  --text-dim: #6f6455;
  --border: #ddd2bd;
  --pc-teal: #0e7490;
  --pc-ochre: #d97706;
  --pc-sage: #4d7c0f;
  --pc-swatches: linear-gradient(90deg, #9a3412 0 20%, #d97706 20% 40%, #fbbf24 40% 60%, #4d7c0f 60% 80%, #0e7490 80% 100%);
}
html {
  color-scheme: light;
}

/* ---------- calculator shell ---------- */
.pc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.4rem 0 1.8rem;
  box-shadow: 0 14px 40px -30px rgba(90, 60, 20, 0.55);
  overflow: hidden;
}
/* a paint-swatch strip along the top edge */
.pc::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--pc-swatches);
}
@media (min-width: 54rem) {
  .prose .pc {
    width: min(62rem, calc(100vw - 2.5rem));
  }
}

/* ---------- mode tabs ---------- */
.pc-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1rem 0;
  flex-wrap: wrap;
}
.pc-tabs button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.pc-tabs button.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- input grid ---------- */
.pc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.6rem, 1fr));
  gap: 0.7rem 0.8rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background:
    repeating-linear-gradient(90deg, transparent 0 2.2rem, rgba(154, 52, 18, 0.04) 2.2rem calc(2.2rem + 1px)),
    var(--surface-2);
}
.pc-f {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.pc-f-wide {
  grid-column: span 2;
}
.pc-f > span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pc-f > span u {
  text-decoration: none;
  color: var(--primary);
}
.pc-f small {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.pc input[type="text"],
.pc select {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.38rem 0.5rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem; /* 44px tap target */
}
.pc select {
  font-family: var(--font);
  font-size: 0.86rem;
}
.pc input:focus,
.pc select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ---------- toggles ---------- */
.pc-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pc-checks label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
}
.pc-checks input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
}

/* ---------- sub panels (ceiling / trim) ---------- */
.pc-sub {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pc-sub .pc-fields {
  border-bottom: 0;
  background: var(--surface-2);
}
.pc-sub-head {
  padding: 0.65rem 1rem 0;
}

/* ---------- hero ---------- */
.pc-hero {
  display: block;
  padding: 1.2rem 1rem 1rem;
  font-size: 1.05rem;
  line-height: 1.5;
  text-align: center;
}
.pc-hero strong {
  font-family: var(--mono);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
.pc-herosub {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.pc-hint {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ---------- result cards ---------- */
.pc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.4rem, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.pc-card {
  background: var(--surface);
  padding: 0.75rem 0.85rem;
  min-width: 0;
}
.pc-card .k {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.pc-card strong {
  font-family: var(--mono);
  font-size: 1.12rem;
  font-weight: 800;
  display: block;
  white-space: nowrap;
}
.pc-card small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  line-height: 1.35;
}
.pc-card.is-key strong {
  color: var(--primary);
}

/* ---------- composition bar ---------- */
.pc-barwrap {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
}
.pc-bar {
  display: flex;
  height: 1.1rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}
.pc-bar span {
  display: block;
  min-width: 0;
}
.pc-bar .seg-walls { background: var(--primary); }
.pc-bar .seg-ceil { background: var(--pc-teal); }
.pc-bar .seg-trim { background: var(--pc-ochre); }
.pc-bar .seg-ded {
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--border) 6px 8px);
}
.pc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.pc-legend i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  margin-right: 0.3rem;
  vertical-align: -0.08rem;
}
.pc-legend .l-walls i { background: var(--primary); }
.pc-legend .l-ceil i { background: var(--pc-teal); }
.pc-legend .l-trim i { background: var(--pc-ochre); }
.pc-legend .l-ded i {
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 3px, var(--border) 3px 4px);
  border: 1px solid var(--border);
}

/* ---------- plan table ---------- */
.pc-plan {
  border-top: 1px solid var(--border);
}
.pc-plan summary {
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 2.75rem;
  box-sizing: border-box;
}
.pc-plan table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.pc-plan th,
.pc-plan td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-top: 1px solid var(--border);
}
.pc-plan th {
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pc-plan td.num,
.pc-plan th.num {
  font-family: var(--mono);
  text-align: right;
}
.pc-plan tr.is-total td {
  font-weight: 700;
  background: var(--surface-2);
}

/* ---------- notes ---------- */
.pc-notes {
  margin: 0;
  padding: 0.8rem 1.2rem 1rem 2rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.pc-notes li + li {
  margin-top: 0.3rem;
}
.pc-notes li::marker {
  color: var(--primary);
}

/* ---------- mobile ---------- */
@media (max-width: 40rem) {
  .pc-f-wide {
    grid-column: span 1;
  }
  .pc-hero strong {
    font-size: 1.35rem;
  }
  .pc-plan th,
  .pc-plan td {
    padding: 0.4rem 0.4rem;
  }
}
