/* Field workspace: grids respond to available component width. */
.hfc {
  --ink: #253746; --blue: #1558a6; --line: #d7e0e7; --hfc-header-offset: 104px;
  container: hfc / inline-size; box-sizing: border-box;
  width: calc(100% - 48px); max-width: 1440px; margin: 24px auto; padding: 24px;
  border: 1px solid var(--line); border-radius: 10px; background: #f3f6f8; color: var(--ink);
  font: 16px/1.55 Manrope, system-ui, sans-serif; text-align: left;
}
.hfc * { box-sizing: border-box; }
.hfc [hidden] { display: none !important; }
.hfc h2 { margin: 4px 0 12px; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; color: var(--ink); }
.hfc h3 { margin: 24px 0 16px; font-size: 20px; line-height: 1.35; }
.hfc p { margin: 12px 0; }
.hfc-head { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; margin-bottom: 24px; }
.hfc-head > div { flex: 1 1 460px; }
.hfc-head p { max-width: 70ch; }
.hfc-eyebrow { font-size: 14px; font-weight: 700; color: var(--blue); }
.hfc-badge { align-self: flex-start; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.hfc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.hfc-inputs, .hfc-results { min-width: 0; }
.hfc-card { min-width: 0; padding: 24px; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.hfc-card > h3:first-child { margin-top: 0; }
.hfc label { display: block; min-width: 0; margin: 14px 0; font-size: 14px; line-height: 1.5; font-weight: 650; }
.hfc input, .hfc select, .hfc button {
  width: 100%; max-width: 100%; min-width: 0; min-height: 48px; margin: 7px 0 0; padding: 11px 12px;
  border: 1px solid #9eafbd; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.hfc input[type=number] { font-variant-numeric: tabular-nums; }
.hfc button { width: auto; cursor: pointer; border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 700; padding-inline: 18px; }
.hfc button.hfc-secondary { background: #fff; color: var(--blue); }
.hfc button:hover:not(:disabled) { filter: brightness(.94); }
.hfc button:disabled { opacity: .45; cursor: default; }
.hfc :focus-visible { outline: 3px solid #f39b35; outline-offset: 3px; }
.hfc .hfc-help, .hfc-instruction { font-size: 14px; line-height: 1.55; color: #526477; }
.hfc .hfc-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 20px; }
.hfc-source { padding: 8px 14px; margin: 16px 0; border-left: 3px solid var(--blue); background: #f3f7fc; font-size: 14px; overflow-wrap: anywhere; }
.hfc a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.hfc details { margin-top: 18px; }
.hfc summary { min-height: 48px; padding: 12px 0; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.hfc details p { font-size: 14px; line-height: 1.6; }
.hfc-component, .hfc-stage { padding: 0 0 18px; margin: 20px 0; border-bottom: 1px solid var(--line); }
.hfc-component h4, .hfc-stage h4 { margin: 0; font-size: 16px; }
.hfc-row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hfc .hfc-remove { min-width: 48px; padding: 8px 12px; background: #fff; color: #974018; border-color: #d7b7a9; font-size: 14px; }
.hfc-notice { padding: 12px 14px; border-left: 3px solid #be5713; background: #fff6e8; font-size: 14px; overflow-wrap: anywhere; }
.hfc-error { padding: 14px; margin: 14px 0; border-left: 4px solid #ad3516; background: #fff2ed; overflow-wrap: anywhere; }
.hfc-main-number { margin: 16px 0; font-size: 36px; line-height: 1.2; font-weight: 800; letter-spacing: -.025em; }
.hfc-main-number small { font-size: 18px; font-weight: 500; }
.hfc-result-card { border-top: 4px solid var(--blue); }
.hfc-ingredient { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.hfc-ingredient strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.hfc-ingredient span { flex: 1 1 180px; overflow-wrap: anywhere; }
.hfc-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin: 20px 0; }
.hfc-metrics > div { padding: 14px; border-radius: 4px; background: #f3f6f8; font-size: 14px; }
.hfc-metrics b { display: block; font-size: 24px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hfc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hfc-actions > * { flex: 1 1 180px; text-align: center; }
.hfc .hfc-file { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; margin: 7px 0 0; padding: 11px 18px; border: 1px solid var(--blue); border-radius: 5px; color: var(--blue); cursor: pointer; font-size: 16px; }
.hfc-file input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.hfc-file:focus-within { outline: 3px solid #f39b35; outline-offset: 3px; }
.hfc-footer { font-size: 13px; color: #526477; }
.hfc-stage-result, .hfc-purchase { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; overflow-wrap: anywhere; }
.hfc-purchase b { display: block; }
.hfc-result-invalid { opacity: .4; }
.hfc-print { display: none; }
.hfc-mobile-nav { position: sticky; top: var(--hfc-header-offset); z-index: 5; padding: 8px 0 12px; background: #f3f6f8; }
.hfc-mobile-nav button { width: 100%; margin: 0; }
.hfc [data-role=result], .hfc [data-role=pre-summary] { scroll-margin-top: calc(var(--hfc-header-offset) + 84px); }
@container hfc (min-width: 1120px) {
  .hfc-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
  .hfc-mobile-nav { display: none; }
}
@container hfc (max-width: 520px) {
  .hfc-card { padding: 16px; }
  .hfc-main-number { font-size: 32px; }
}
@media (max-width: 700px) {
  .hfc { --hfc-header-offset: 80px; width: 100%; margin: 16px 0; padding: 12px; border-inline: 0; border-radius: 0; }
}
body.admin-bar .hfc { --hfc-header-offset: 136px; }
/* Leave room for the full navigation immediately above the theme's menu breakpoint. */
@media (min-width: 1021px) and (max-width: 1100px) {
  body.st-tool-page:has(.hfc) .st-header .st-button { display: none; }
}
@media (max-width: 782px) { body.admin-bar .hfc { --hfc-header-offset: 126px; } }
@page { margin: 12mm; }
.hfc-flow { max-width: 1120px; }
.hfc-flow .hfc-head > div { flex-basis: 560px; }
.hfc-flow .hfc-head > button { align-self: flex-start; }
.hfc-steps { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 20px; }
.hfc-steps button { width: 100%; margin: 0; padding: 12px 8px; border-color: #aabac7; background: #fff; color: #1558a6; }
.hfc-steps button[aria-current=step] { background: #1558a6; border-color: #1558a6; color: #fff; }
.hfc-flow [data-panel] { scroll-margin-top: 130px; }
.hfc-flow .hfc-two { grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr)); }
.hfc-flow .hfc-tool-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px; background: #edf3f8; font-size: 14px; }
.hfc-tool-hint span { flex: 1 1 360px; }
.hfc-projects { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #d7e0e7; }
.hfc-projects > * { flex: 1 1 240px; }
.hfc-flow [data-role=status]:empty { display: none; }
.hfc-flow .hfc-source p { margin-block: 10px; }
.hfc-auto .hfc-head h2 { margin-top: 0; }
.hfc-auto .hfa-three { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.hfc-auto .hfc-two { grid-template-columns: repeat(auto-fit,minmax(min(100%,360px),1fr)); }
.hfc-auto [data-role=output] > *, .hfc-auto .hfa-soil { margin-top: 22px; }
.hfc-auto [data-role=summary], .hfc-auto [data-role=passes] { scroll-margin-top: 120px; }
.hfc-auto [data-role=conditions] { margin-top: 18px; }
.hfc-auto .hfa-stage-list { list-style: none; padding: 0; margin: 20px 0; }
.hfc-auto .hfa-stage-list li { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid #d7e0e7; }
.hfc-auto .hfa-stage-list li div { flex: 1 1 220px; }
.hfc-auto .hfa-stage-list span { display: block; color: #526477; margin-top: 4px; }
.hfc-auto .hfa-stage-list strong { font-size: 20px; }
.hfc-auto .hfa-brand, .hfc-auto .hfa-edit-row { padding: 16px 0; border-bottom: 1px solid #d7e0e7; }
.hfc-auto .hfa-segment { display: grid; grid-template-columns: minmax(150px,.6fr) minmax(200px,1.4fr) auto; gap: 14px; align-items: end; margin: 16px 0; }
.hfc-auto [data-role=status]:empty { display: none; }
.hfc-auto .hfa-start .hfc-actions button:first-child { flex-basis: 280px; }
@container hfc (max-width: 850px) { .hfc-auto .hfa-three { grid-template-columns: 1fr; } }
@container hfc (max-width: 650px) { .hfc-auto .hfa-segment { grid-template-columns: 1fr; } }
@container hfc (max-width: 650px) { .hfc-steps { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width:700px) { .hfc-flow [data-panel] { scroll-margin-top: 90px; } }
@media print {
  /* Remove unrelated layout, including its reserved height, from calculator printouts. */
  body:has(.hfc-flow) *:not(:has(.hfc-flow)):not(.hfc-flow):not(.hfc-flow *) { display: none !important; }
  body:has(.hfc-flow), body:has(.hfc-flow) *:has(.hfc-flow) { display: block !important; position: static !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; margin: 0 !important; }
  body * { visibility: hidden; }
  .hfc, .hfc * { visibility: visible; }
  .hfc { position: absolute; left: 0; top: 0; container-type: normal; width: 100%; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; }
  .hfc-inputs, .hfc-actions, .hfc-file, .hfc-results > .hfc-card:not(:first-child),
  .hfc-mobile-nav, .hfc-head, .hfc-result-card > [data-role=result], .hfc-result-card > .hfc-eyebrow,
  .hfc-footer, .hfc [data-role=pre-summary], .hfc-results details { display: none !important; }
  .hfc-grid { display: block; }
  .hfc-card { padding: 8px; border: 0; background: #fff; }
  .hfc-print { display: block; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 system-ui, sans-serif; }
  .hfc-flow .hfc-steps, .hfc-flow .hfc-projects, .hfc-flow button, .hfc-flow [data-role=status], .hfc-flow [data-role=error] { display: none !important; }
  .hfc-flow { position: static; }
  .hfc-auto form, .hfc-auto .hfa-soil, .hfc-auto [data-role=output] > :not(.hfa-order) { display: none !important; }
  .hfc-auto .hfa-order { margin: 0 !important; }
}

.hfc-auto .hfa-scheme { margin-top: 24px; }
.hfc-auto .hfa-stage-list strong { flex: 0 1 210px; }
.hfc-auto .hfa-stage-list strong span { font-size: 14px; font-weight: 400; }
.hfc-auto .hfa-field-help { display: block; margin-top: 8px; max-width: 76ch; color: #526477; font-size: 14px; line-height: 1.5; font-weight: 400; }
.hfc-auto { overflow-anchor: none; }
.hfc-auto [data-role=stale] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.hfc-auto .hfc-file { display: block; text-align: left; }
.hfc-auto .hfc-projects { align-items: flex-start; }
.hfc-auto .hfa-apply { position: sticky; bottom: 12px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 18px; margin-top: 16px; border: 2px solid var(--blue); border-radius: 8px; background: #fff; box-shadow: 0 4px 16px #25374624; }
.hfc-auto .hfa-apply p { flex: 1 1 280px; margin: 0; font-size: 14px; }
.hfc-auto .hfa-apply button { flex: 0 1 250px; width: auto; margin: 0; }
@media print { .hfc-auto .hfa-apply { display: none !important; } }

/* Soil detail fields remain readable when a route has several soil types. */
.hfc-auto .hfa-segment { grid-template-columns: repeat(2,minmax(0,1fr)); align-items:start; }
.hfc-auto .hfa-segment button { justify-self:start; }
@media(max-width:700px){.hfc-auto .hfa-segment{grid-template-columns:minmax(0,1fr);}}
