/* ============================================================
   FinallyMe free tools: forms, result cards, hand-off, print.
   Loaded after site.css on /tools/ pages. Stable class names
   (other tool pages reuse them read-only):
   .tool .tool-form .tool-field .tool-units .tool-result
   .tool-number .tool-range .tool-how .tool-actions
   ============================================================ */
.tool [hidden],.handoff [hidden]{display:none!important}
.tool-sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Tighter hero so the tool sits above the fold on a phone */
.page-hero.tool-hero{padding:44px 0 18px}
.page-hero.tool-hero h1{font-size:clamp(32px,4.6vw,50px);max-width:none}
.page-hero.tool-hero .lede{margin-top:12px;font-size:17px}
.tool-hero + .page-body{padding-top:8px}
@media (max-width:760px){
  .page-hero.tool-hero{padding:22px 0 10px}
  .page-hero.tool-hero .crumbs{margin-bottom:10px}
  .page-hero.tool-hero .eyebrow{margin-bottom:8px}
  .page-hero.tool-hero .lede{font-size:15.5px;line-height:1.55}
}

/* ---------- The tool card: form beside (or above) the result ---------- */
.tool{--tool-accent:var(--accent);max-width:1040px;margin:0 auto;background:var(--surface);border:1px solid var(--hairline);border-radius:var(--r-xl);padding:18px;display:grid;gap:18px}
.tool > *,.tool-form > *,.tool-form fieldset{min-width:0}
.tool--protein{--tool-accent:var(--activity)}
.tool--fiber{--tool-accent:var(--food)}
.tool--water{--tool-accent:var(--water)}
.tool--weight{--tool-accent:var(--weight)}
.tool--lean{--tool-accent:var(--activity)}
@media (min-width:900px){
  .tool{grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);padding:28px;gap:28px;align-items:start}
  .tool-result{position:sticky;top:84px}
}

/* ---------- Form ---------- */
.tool-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:12px 12px;align-content:start}
.tool-form .tool-wide{grid-column:1/-1}
.tool-field{display:flex;flex-direction:column;gap:6px;min-width:0;border:0;padding:0;margin:0}
.tool-field > label,.tool-field > legend,.tool-label{font-size:13.5px;font-weight:600;color:#fff;padding:0}
.tool-field .tool-opt{font-weight:500;color:var(--text-3)}
.tool-input{position:relative;display:flex;gap:8px}
.tool-input > span.tool-wrap{position:relative;flex:1;min-width:0;display:block}
.tool-form input[type=text],.tool-form input[type=number],.tool-form input[type=date],.tool-form select{width:100%;min-height:48px;border:1px solid var(--hairline-2);border-radius:var(--r-md);padding:0 14px;font:500 16px/1.2 var(--font);background:var(--canvas);color:#fff;font-variant-numeric:tabular-nums;-webkit-appearance:none;appearance:none}
.tool-form select{padding-right:36px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ffffff' stroke-opacity='.6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;background-size:12px 8px}
.tool-form input::placeholder{color:var(--text-3)}
.tool-form input:focus,.tool-form select:focus{border-color:var(--link);outline:none;box-shadow:0 0 0 3px rgba(156,200,238,.28)}
.tool-form input[aria-invalid="true"]{border-color:#FF6B6B}
.tool-suffix{position:absolute;right:12px;top:50%;transform:translateY(-50%);font-size:14px;color:var(--text-3);pointer-events:none}
.tool-wrap input{padding-right:40px}
.tool-error{font-size:12.5px;line-height:1.4;color:#FF8A8A;min-height:0}
.tool-error:empty{display:none}
.tool-hint{font-size:12.5px;line-height:1.45;color:var(--text-3)}

/* Segmented pills: units, sex. Real radios, visually hidden */
.tool-units,.tool-seg{display:inline-flex;align-self:flex-start;max-width:100%;padding:3px;border-radius:var(--r-pill);background:rgba(255,255,255,.07);border:1px solid var(--hairline);margin:0}
.tool-seg{display:flex;align-self:stretch}
.tool-units legend,.tool-seg legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.tool-units label,.tool-seg label{position:relative;flex:1;display:flex}
.tool-units input,.tool-seg input{position:absolute;opacity:0;width:1px;height:1px;margin:0}
.tool-units span,.tool-seg span{flex:1;display:flex;align-items:center;justify-content:center;min-height:44px;min-width:88px;padding:0 16px;border-radius:var(--r-pill);font-size:14.5px;font-weight:600;color:var(--text-2);cursor:pointer;white-space:nowrap;transition:background .2s,color .2s}
.tool-seg span{min-width:0;padding:0 10px}
.tool-units input:checked + span,.tool-seg input:checked + span{background:#fff;color:#0F1115;box-shadow:var(--shadow-sm)}
.tool-units input:focus-visible + span,.tool-seg input:focus-visible + span{outline:2px solid var(--link);outline-offset:2px}
.tool-units-row{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 14px}
.tool-units-row .tool-hint{flex:1;min-width:150px}

/* Checkbox rows */
.tool-check{grid-column:1/-1;display:flex;align-items:flex-start;gap:12px;min-height:44px;padding:10px 0 2px;font-size:14.5px;line-height:1.45;color:var(--text);cursor:pointer}
.tool-check input{flex:none;width:22px;height:22px;margin:0;accent-color:var(--tool-accent);cursor:pointer}
.tool-check small{display:block;font-size:12.5px;color:var(--text-3);margin-top:2px}
.tool-check[hidden]{display:none}

/* Range slider */
.tool-form input[type=range]{width:100%;min-height:44px;accent-color:var(--tool-accent);background:transparent}
.tool-slider-out{font-weight:700;color:#fff;font-variant-numeric:tabular-nums}

/* ---------- Result card ---------- */
.tool-result{background:linear-gradient(180deg,rgba(255,255,255,.035),rgba(255,255,255,0)),var(--surface-2);border:1px solid var(--hairline-2);border-radius:var(--r-lg);padding:20px;min-width:0}
.tool-result-eyebrow{display:block;font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--text-3);margin-bottom:10px}
.tool-metric-name{display:flex;align-items:center;gap:8px;font-size:14.5px;font-weight:700;color:var(--text-2)}
.tool-metric-name::before{content:"";width:10px;height:10px;border-radius:50%;background:var(--tool-accent);flex:none}
.tool-metric-name.is-food::before{background:var(--food)}
.tool-metric-name.is-activity::before{background:var(--activity)}
.tool-number{margin-top:6px;font:800 clamp(52px,13vw,76px)/1 var(--font-display);letter-spacing:-.035em;color:#fff;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tool-number small{font-size:.36em;font-weight:700;letter-spacing:0;color:var(--text-2);margin-left:6px}
.tool-number--md{font-size:clamp(34px,8vw,44px)}
.tool-number.is-empty{color:var(--text-3)}
.tool-range{margin-top:10px;font-size:15px;line-height:1.5;color:var(--text-2)}
.tool-range b{color:#fff;font-variant-numeric:tabular-nums}
.tool-bar{position:relative;height:8px;margin:14px 0 4px;border-radius:var(--r-pill);background:rgba(255,255,255,.1);overflow:hidden}
.tool-bar > i{position:absolute;left:0;top:0;bottom:0;border-radius:inherit;background:var(--tool-accent);transition:width .35s var(--ease)}
.tool-bar-labels{display:flex;justify-content:space-between;font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums}
.tool-says{margin-top:14px;font-size:15.5px;line-height:1.6;color:var(--text)}
.tool-lines{list-style:none;margin:14px 0 0;padding:0;display:grid;gap:8px}
.tool-lines li{position:relative;padding-left:18px;font-size:14.5px;line-height:1.55;color:var(--text-2)}
.tool-lines li::before{content:"";position:absolute;left:2px;top:.62em;width:6px;height:6px;border-radius:50%;background:var(--tool-accent)}
.tool-lines li b{color:#fff;font-variant-numeric:tabular-nums}
.tool-second{margin-top:18px;padding-top:16px;border-top:1px solid var(--hairline)}
.tool-second .tool-number{font-size:clamp(34px,8vw,44px)}
.tool-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin-top:16px}
.tool-stat{background:rgba(255,255,255,.04);border:1px solid var(--hairline);border-radius:var(--r-md);padding:12px 14px;min-width:0}
.tool-stat span{display:block;font-size:12px;font-weight:600;color:var(--text-3)}
.tool-stat b{display:block;margin-top:4px;font:800 22px/1.15 var(--font-display);color:#fff;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tool-stat em{display:block;margin-top:3px;font-style:normal;font-size:12px;color:var(--text-3)}
.tool-stat.is-muted b{color:var(--text-3)}
.tool-flag{display:inline-block;margin-left:6px;padding:2px 8px;border-radius:var(--r-pill);background:rgba(255,159,10,.16);color:var(--orange);font:700 11px/1.5 var(--font);vertical-align:middle}
.tool-note{margin-top:14px;padding:12px 14px;border-radius:var(--r-md);background:rgba(255,159,10,.09);border:1px solid rgba(255,159,10,.28);font-size:13.5px;line-height:1.55;color:var(--text)}
.tool-note b{color:#fff}
.tool-note--calm{background:rgba(255,255,255,.04);border-color:var(--hairline)}
.tool-empty{margin-top:8px;font-size:15px;line-height:1.55;color:var(--text-2)}

/* How it was calculated */
.tool-how{margin-top:16px;border-top:1px solid var(--hairline);padding-top:4px}
.tool-how summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;cursor:pointer;list-style:none;font-size:14.5px;font-weight:600;color:var(--link)}
.tool-how summary::-webkit-details-marker{display:none}
.tool-how summary::after{content:"+";font-size:20px;font-weight:400;color:var(--text-3);transition:transform .25s var(--ease)}
.tool-how[open] summary::after{transform:rotate(45deg)}
.tool-how-body{padding:2px 0 6px;font-size:14px;line-height:1.65;color:var(--text-2)}
.tool-how-body p+p,.tool-how-body p+ul,.tool-how-body ul+p{margin-top:8px}
.tool-how-body ul{margin:6px 0 0 18px}
.tool-how-body code{font:600 13px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#fff;background:rgba(255,255,255,.07);padding:1px 6px;border-radius:6px;white-space:normal}
.tool-how-body a{color:var(--link)}

/* Copy link, print */
.tool-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:16px}
.tool-actions .btn{min-height:44px;padding:0 18px;font-size:15px}
.tool-status{font-size:13.5px;color:var(--food);min-height:1em}
.tool-share-note{margin-top:8px;font-size:12.5px;line-height:1.45;color:var(--text-3)}

/* Trial averages and other side boxes */
.tool-aside{margin-top:18px;background:rgba(255,255,255,.035);border:1px dashed var(--hairline-2);border-radius:var(--r-md);padding:14px 16px}
.tool-aside h3{font-size:15px;letter-spacing:0;line-height:1.3;margin:0 0 4px;color:#fff}
.tool-aside p{font-size:13.5px;line-height:1.55;color:var(--text-2)}
.tool-aside ul{margin:8px 0 0 18px}
.tool-aside li{font-size:13.5px;line-height:1.55;color:var(--text-2);margin-bottom:4px}
.tool-aside a{color:var(--link)}

/* ---------- Hand-off to the app (.handoff lives in site.css) ---------- */
.tool + .handoff{margin-top:22px}

/* Article below the tool */
.tool-article{margin-top:56px}
.prose .tool-mini{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:18px 0 24px}
.prose .tool-mini > div{background:var(--surface);border:1px solid var(--hairline);border-radius:var(--r-md);padding:14px 16px}
.prose .tool-mini b{display:block;font-size:15.5px}
.prose .tool-mini span{display:block;margin-top:4px;font-size:14px;line-height:1.5;color:var(--text-2)}
.prose .tool-sources li{font-size:15px;line-height:1.6}
.prose .tool-related{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin:18px 0 8px;padding:0;list-style:none}
.prose .tool-related li{margin:0}
.prose .tool-related a{display:block;height:100%;background:var(--surface);border:1px solid var(--hairline);border-radius:var(--r-md);padding:14px 16px;text-decoration:none;font-weight:600;color:#fff}
.prose .tool-related a span{display:block;margin-top:4px;font-size:14px;font-weight:400;line-height:1.5;color:var(--text-2)}
.prose .tool-related a:hover{border-color:var(--hairline-2);background:var(--surface-2)}

/* Hub cards */
.tool-hub-grid .card .tag{display:inline-block;margin-left:8px;font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-3);vertical-align:middle}
.tool-hub-grid .card h3{display:flex;align-items:center;flex-wrap:wrap;gap:4px 0}

.tool-print-only{display:none}

@media (max-width:420px){
  .tool{padding:14px;border-radius:var(--r-lg)}
  .tool-result{padding:16px}
  .tool-units span{min-width:60px;padding:0 12px}
}

/* ---------- Print: the result, its inputs, and the sources only ---------- */
@media print{
  @page{margin:16mm}
  :root{color-scheme:light}
  body{background:#fff!important;color:#000!important}
  .skip-link,.site-header,.get-app,.site-footer,.tool-form,.tool-actions,.tool-share-note,.handoff,.tool-article,.crumbs,.page-hero .lede,noscript{display:none!important}
  .page-hero{background:none!important;padding:0 0 8px!important}
  .page-hero h1,.page-hero .it{color:#000!important;font-size:24px!important}
  .page-hero .eyebrow{color:#555!important}
  .page-body{padding:0!important}
  .tool{display:block;border:0;padding:0;background:none;max-width:none}
  .tool-result{position:static;border:1px solid #bbb;background:none;padding:14px;font-size:12px}
  .tool-number{font-size:40px!important;margin-top:2px}
  .tool-second .tool-number{font-size:30px!important}
  .tool-range,.tool-says,.tool-lines li,.tool-how-body,.tool-note,.tool-empty{font-size:12px!important;line-height:1.45!important}
  .tool-says,.tool-lines,.tool-second,.tool-note,.tool-how{margin-top:8px!important}
  .tool-second{padding-top:8px!important}
  .tool-result *{color:#000!important;text-shadow:none!important;box-shadow:none!important}
  .tool-metric-name::before,.tool-lines li::before,.tool-bar > i{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .tool-bar{background:#ddd}
  .tool-note,.tool-stat,.tool-aside{background:none!important;border:1px solid #bbb!important}
  .tool-how{display:block}
  .tool-how summary{display:none}
  .tool-how-body{display:block!important}
  .tool-how:not([open]) .tool-how-body{display:block!important}
  .tool-print-only{display:block;margin-top:12px;font-size:12px;line-height:1.5;color:#000}
  .tool-print-only h2{font-size:15px;color:#000;margin:12px 0 4px}
  .tool-print-only ul{margin:4px 0 0 18px}
  a{color:#000!important;text-decoration:none!important}
}
