/* Newborn weight-loss calculator (tool page + in-article widget). Reuses the .gtool card from styles.css. */

/* State switching, per widget so an article can host one (tool-cluster.css switches by body class instead) */
[data-wl-root] [data-state] { display: none; }
[data-wl-root][data-view="empty"] [data-state~="empty"],
[data-wl-root][data-view="result"] [data-state~="result"],
[data-wl-root][data-view="error"] [data-state~="error"] { display: block; }

/* Same as tools/tool-cluster.css so the widget also works on pages that do not load it (coral alert: it is a "call" warning) */
.pane.res .tips { margin-top: var(--s4); }
.pane.res .tips li { align-items: flex-start; }
.pane.res .tips li .dot { flex: none; width: 8px; height: 8px; margin: 9px 6px 0 6px; border-radius: 50%; background: var(--mint-on-blue); }
.res-alert { display: flex; gap: var(--s3); align-items: flex-start; margin: var(--s4) 0 0; padding: 14px 16px; border-radius: 14px; background: var(--coral-50); border: 1.5px solid #f3c4bf; color: var(--ink); font-weight: 700; line-height: 1.45; }
.res-alert[hidden] { display: none; }
.res-alert > span:first-child { display: inline-flex; flex: none; color: var(--coral-600); margin-top: 2px; }
.res-alert svg { width: 20px; height: 20px; }

.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.row3 .field { margin-top: 0; }
.err a { color: inherit; text-decoration: underline; }
.err > span:last-child { display: block; } /* styles.css makes every .err > span inline-flex, which splits text from a link */

/* Result: big % + verdict pill */
.wl-level { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 800; color: var(--ink); background: #fff; }
.wl-level::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--mint-500); }
.wl-level.near::before { background: #e0a100; }
.wl-level.call::before { background: var(--coral-600); }
.wl-top { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 4px; }
.wl-top b { font-family: var(--font-display); font-weight: 600; font-size: 64px; line-height: .95; letter-spacing: -.03em; color: #fff; }
.wl-top span { color: #fff; font-size: var(--fs-sm); line-height: 1.35; padding-bottom: 6px; }
.wl-top span small { display: block; font-size: var(--fs-xs); opacity: .9; }
.wl-title { margin: 6px 0 0; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; color: #fff; }

/* 0-12 % scale on a white card: green to 8 %, amber 8-10 %, coral above 10 % */
.wl-scale { margin-top: 16px; background: #fff; border-radius: 18px; padding: 14px 16px 12px; box-shadow: var(--shadow-chart); color: var(--ink); }
.wl-bar { position: relative; height: 12px; border-radius: 6px; margin: 22px 0 6px;
  background: linear-gradient(90deg, var(--mint-150, #bfe8d8) 0 66.67%, #ffd98a 66.67% 83.33%, #f7b4ac 83.33% 100%); }
.wl-marker { position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--navy-500); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--navy-500); }
.wl-ticks { position: relative; height: 16px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.wl-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.wl-ticks span:first-child { left: 0; transform: none; }
.wl-ticks span:last-child { right: 0; transform: none; }
.wl-applink { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid #fff; color: #fff; font-size: var(--fs-sm); font-weight: 700; }
.wl-day { margin: 10px 0 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-2); }
.wl-day b { color: var(--ink); }

/* In-article variant: stacked, sits in the prose column */
.prose .gtool.wl-inline { margin: var(--s6) 0; grid-template-columns: minmax(0, 1fr); border-radius: var(--r-lg); }
.prose .wl-inline .pane { padding: 24px; }
.prose .wl-inline > * + *, .prose .wl-inline .pane > * + * { margin-top: 0; }
.prose .wl-inline .pane-title { margin: 0 0 6px; }
.prose .wl-inline h2 { margin-top: 0; }
.prose .wl-inline .wl-intro { margin: 0 0 18px; font-size: var(--fs-sm); color: var(--ink-2); }
.prose .wl-inline .actions { margin-top: 20px; }
.prose .wl-inline ul.tips { padding-left: 0; }
.prose .wl-inline .tips li + li { margin-top: 0; }
.prose .wl-inline .res-empty h3 { margin: 0; font-size: 1.375rem; }
.prose .wl-inline .wl-tool-link { margin: 14px 0 0; font-size: var(--fs-sm); color: #fff; }
.prose .wl-inline .wl-tool-link a { color: #fff; text-decoration: underline; }

@media (max-width: 720px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 .field:last-child { grid-column: 1 / -1; }
  .wl-top b { font-size: 52px; }
  .prose .wl-inline .pane { padding: 20px 16px; }
}
