/* The free tools in the light look. Uses /home.css for everything shared
   (colours, type, nav, buttons, closing band); this file holds what a tool
   page needs on top. Edited by hand.
   Used by /tools/label-claim-checker and /tools/shelf-price-to-pocket. */

:root {
  --ok: #047857;
  --ok-bg: #E7F4EE;
  --no: #B42318;
  --no-bg: #FDECEA;
  --dep: #8A5A00;
  --dep-bg: #FFF4D6;
  --idle: #67645D;
  --idle-bg: #F2F1F0;
  --field: #C6C4C0;
  --t-tool: clamp(16px, 0.25vw + 15px, 19px);
}

/* a tool page is as tall as its content, and reads at a working size */
main > section { min-height: 0; padding: clamp(32px, 4vw, 72px) 0; }
main > .tool-hero { padding-top: clamp(104px, 10vw, 180px); padding-bottom: clamp(20px, 2vw, 40px); }
.tool-hero h1 { font-size: clamp(30px, 3.4vw, 60px); max-width: 18em; }
.tool-hero .lead { max-width: 36em; font-size: clamp(18px, 0.5vw + 16px, 24px); }
.tool-hero .private { font-size: var(--t-tool); color: var(--muted); max-width: 40em; }
main h2 { font-size: clamp(24px, 1.4vw + 16px, 40px); letter-spacing: -0.02em; line-height: 1.15; }

.tool { font-size: var(--t-tool); line-height: 1.5; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 3vw, 64px); align-items: start; }
.tool-grid > * { min-width: 0; }

/* the form */
.panel-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: clamp(18px, 1.6vw, 30px); background: var(--ground); }
.panel-box + .panel-box { margin-top: 20px; }
.panel-box h3 { font-size: 1.15em; letter-spacing: -0.01em; margin-bottom: .2em; }
.panel-box > p.hint { color: var(--muted); font-size: .92em; margin-bottom: 1em; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fields--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .92em; }
.field .unit { font-weight: 500; color: var(--muted); }
.field input[type="number"] {
  width: 100%; min-height: 46px; padding: 9px 12px; font: inherit; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--ground); border: 1.5px solid var(--field); border-radius: var(--r-sm);
}
.field input[type="number"]::placeholder { color: #8894A1; }
.field input:focus-visible, .check input:focus-visible, .tool button:focus-visible, .tool summary:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 2px;
}
.field .src { font-size: .82em; color: var(--muted); line-height: 1.35; }
.field .src a { color: var(--accent); }

.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.check label { font-weight: 500; }
.claim-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; }
.claim-groups fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.claim-groups legend { font-weight: 700; padding: 0; margin-bottom: 2px; }

.tool .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.tool .btn { font-size: 1em; }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--field); }
.btn--quiet:hover { border-color: var(--ink); }
.copied { font-size: .92em; color: var(--muted); align-self: center; min-height: 1.4em; }

/* results: a fixed-position column on wide screens, with room held so
   nothing below jumps when the first answer arrives */
.results { min-height: 320px; }
.results > h2 { margin-bottom: .5em; }
.results .empty { color: var(--muted); border: 1px dashed var(--field); border-radius: var(--r-md); padding: 22px; }
.res { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 12px; }
.res h3 { font-size: 1.08em; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.badge { display: inline-block; font-size: .8em; font-weight: 700; padding: .25em .7em; border-radius: 999px; white-space: nowrap; }
.badge--meets { color: var(--ok); background: var(--ok-bg); }
.badge--fails { color: var(--no); background: var(--no-bg); }
.badge--depends { color: var(--dep); background: var(--dep-bg); }
.badge--needs_input { color: var(--idle); background: var(--idle-bg); }
.res dl { margin: 10px 0 0; display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 4px 12px; }
.res dt { color: var(--muted); font-size: .92em; }
.res dd { margin: 0; }
.res ul { margin: 10px 0 0; padding-left: 1.15em; list-style: disc; color: var(--ink); }
.res li { margin-top: 4px; font-size: .95em; }
.res .cfr { display: inline-block; margin-top: 10px; font-weight: 600; color: var(--accent); }
.res--disclose { border-color: var(--dep); background: var(--dep-bg); }

/* the waterfall */
.route { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 14px; }
.route h3 { font-size: 1.1em; }
.route .kept { font-size: 1.5em; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.route .kept small { font-size: .6em; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.route .kept.neg { color: var(--no); }
.fall { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.fall td { padding: 5px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.fall td.amt { text-align: right; white-space: nowrap; padding-left: 12px; width: 5.5em; }
.fall td.bar { width: 34%; padding-left: 12px; }
.fall .b { display: block; height: 10px; border-radius: 3px; background: #D5D4D1; min-width: 2px; }
.fall tr.sub td, .fall tr.end td, .fall tr.start td { font-weight: 700; }
.fall tr.sub .b, .fall tr.start .b { background: var(--ink); }
.fall tr.end .b { background: var(--accent); }
.fall tr.end.neg .b { background: var(--no); }
.route .foot-note { margin-top: 10px; font-size: .9em; color: var(--muted); }
.route .need { margin-top: 10px; padding: 10px 12px; background: var(--tint); border-radius: var(--r-sm); }

.route-tabs { display: grid; gap: 20px; }
.route-set { border-top: 1px solid var(--line); padding-top: 16px; }
.route-set:first-child { border-top: 0; padding-top: 0; }
.route-set h4 { margin: 0 0 10px; font-size: 1em; }

/* plain sections under the tool */
.plain { max-width: 46em; font-size: var(--t-tool); }
.plain h2 { margin-bottom: .6em; }
.plain ul { list-style: disc; padding-left: 1.2em; }
.plain li { margin-top: .5em; color: var(--muted); }
.plain li strong { color: var(--ink); }
.plain p + p { margin-top: .8em; }
.plain a { color: var(--accent); }
.band-tint { background: var(--tint); }

.closing { min-height: 0; }

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  main > .tool-hero { padding-top: 96px; }
  .fields, .fields--3, .claim-groups { grid-template-columns: minmax(0, 1fr); }
  .fields--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool .btn { width: 100%; }
  .fall td.bar { display: none; }
  .res dl { grid-template-columns: minmax(0, 1fr); }
  .res dt { margin-top: 6px; }
}

@media print {
  .nav, .closing, .skip, .tool .actions, .no-print { display: none !important; }
  main > .tool-hero { padding-top: 0; }
  main > section { padding: 12px 0; }
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .route, .res, .panel-box { break-inside: avoid; }
  .field input[type="number"] { border-color: #999; }
  body { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
