/* ============================================================
   Whole-Farm ROI — additions to styles.css
   Loaded after assets/styles.css, which supplies the tokens, the shared
   components (cards, fields, hero, lines, print recap) and the print
   stylesheet. Only what is new to this page lives here.
   ============================================================ */

/* A note that sets up the fields below it, rather than qualifying them. */
.card-note-top { margin-top: 10px; }

.field-third { flex: 1 1 120px; }

/* ---------- Select, styled to match the inputs ---------- */
select {
  font-family: var(--body); font-size: 16px; color: var(--navy);
  background: var(--cream); border: 1px solid var(--rule); border-radius: 6px;
  padding: 9px 32px 9px 11px; width: 100%; min-width: 0;
  appearance: none; -webkit-appearance: none;
  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 1l5 5 5-5' fill='none' stroke='%231C222E' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select:focus-visible { outline: 2.5px solid var(--yellow); outline-offset: 1px; background-color: var(--white); }

/* ---------- The crop list ---------- */
.crops-head { margin-top: 4px; }
.crops-head .card-title { margin-bottom: 0; }
.crops-head .card-note { margin-top: 8px; }

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

/* a block is a card with a colored spine so the list reads as a list */
.block { border-left: 4px solid var(--yellow); position: relative; }
.block[data-crop="corn"] { border-left-color: var(--yellow); }
.block:not([data-crop="corn"]) { border-left-color: var(--purple); }

.block-head { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.block-crop { flex: 1 1 170px; }
.block-acres { flex: 0 1 130px; }
/* pinned to the card corner so it never competes with the fields for a row */
.block-remove {
  position: absolute; top: 12px; right: 14px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--navy-50); background: none; border: none; cursor: pointer;
  padding: 4px 4px; text-decoration: underline; text-underline-offset: 3px;
}
.block { padding-top: 34px; }
.block-remove:hover { color: var(--orange); }
.block-remove:focus-visible { outline: 2.5px solid var(--yellow); outline-offset: 2px; border-radius: 3px; }
.block-remove[disabled] { visibility: hidden; }

.block .subhead { margin-top: 16px; padding-top: 12px; }
.block .field-row { margin-top: 12px; }

/* ---------- Product chips (checkboxes) ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  position: relative; cursor: pointer; user-select: none;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--navy-80); background: var(--white);
  border: 1.5px solid var(--rule); border-radius: var(--radius-pill);
  padding: 8px 14px 8px 12px; display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.chip:hover { border-color: var(--navy-50); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--navy-50); background: transparent; flex: none;
}
.chip.is-on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip.is-on::before { background: var(--yellow); border-color: var(--yellow); }
.chip:has(input:focus-visible) { outline: 2.5px solid var(--yellow); outline-offset: 2px; }
.chip.chip-price { color: var(--navy-50); }
.chip.is-on .chip-price { color: var(--cream); opacity: .75; }
.chip-price { font-size: 9.5px; letter-spacing: 0.06em; }

/* unit hint inside a field label */
.unit-hint { font-style: normal; color: var(--navy-50); text-transform: none; letter-spacing: 0; margin-left: 4px; }

/* the per-block readout doubles as the block's own guardrail */
.block .computed { margin-top: 12px; }
.block .computed.is-neg { border-left-color: var(--orange); }
.block .computed.is-warn { border-left-color: var(--orange); color: #8f3416; background: #fdf1e6; }

/* ---------- Add a crop ---------- */
.add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.add-row .field { flex: 1 1 200px; }
.add-row .btn { flex: none; padding: 11px 22px; }

/* ---------- Result: return per dollar ---------- */
.perdollar {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 11px 15px;
  background: var(--cream); border: 1px solid var(--cream-deep); border-radius: 8px;
}
.pd-num {
  font-family: var(--display); font-size: 26px; letter-spacing: var(--tr-display);
  font-variant-numeric: tabular-nums; color: var(--navy);
}
.pd-text { font-size: 13.5px; color: var(--navy-80); }
.pd-text b { color: var(--navy); }

/* ---------- Result: by crop ---------- */
.bycrop { margin-top: 16px; }
.bycrop-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--tr-mono);
  text-transform: uppercase; color: var(--navy-50); margin: 0 0 6px;
}
.crop-table { width: 100%; border-collapse: collapse; }
.crop-table th, .crop-table td { padding: 7px 6px; text-align: left; vertical-align: baseline; }
.crop-table thead th {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: var(--tr-mono);
  text-transform: uppercase; color: var(--navy-50); font-weight: 400;
  border-bottom: 1px solid var(--rule); padding-bottom: 6px;
}
.crop-table tbody td { border-bottom: 1px dotted var(--rule); font-size: 14.5px; }
.crop-table td:first-child, .crop-table th:first-child { padding-left: 0; }
.crop-table td:last-child, .crop-table th:last-child { padding-right: 0; }
.crop-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crop-table .crop-name { font-weight: 700; color: var(--navy); }
.crop-table .crop-prods {
  display: block; font-family: var(--mono); font-size: 9px; letter-spacing: var(--tr-mono);
  text-transform: uppercase; color: var(--navy-50); margin-top: 1px;
}
.crop-table .crop-story { font-size: 12px; color: var(--navy-50); display: block; }
.crop-table td.total { font-weight: 700; }
.crop-table td.neg { color: var(--orange); }
.crop-table .empty td { color: var(--navy-50); font-style: italic; border-bottom: none; }

@media (max-width: 520px) {
  .block-acres { flex: 1 1 110px; }
  .crop-table th:nth-child(3), .crop-table td:nth-child(3) { display: none; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .perdollar { margin-top: 6pt; padding: 5pt 8pt; }
  .pd-num { font-size: 13pt; }
  .pd-text { font-size: 7.5pt; }

  .bycrop { margin-top: 7pt; }
  .bycrop-label { font-size: 6.5pt; margin-bottom: 3pt; }
  .crop-table th, .crop-table td { padding: 2.5pt 4pt; }
  .crop-table thead th { font-size: 6pt; padding-bottom: 3pt; }
  .crop-table tbody td { font-size: 8pt; }
  .crop-table .crop-prods { font-size: 5.5pt; }
  .crop-table .crop-story { font-size: 6.5pt; }

  .viewswitch { display: none !important; }
}
