/* Tools pages: a short header, then a two-pane tool (controls left, live view right). */

.tool-head { padding: clamp(7rem, 12vw, 9.5rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); }
.tool-head .wrap { display: grid; gap: 1.1rem; }
.tool-head h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); }
.tool-head .section-lede { max-width: 44rem; }
.crumbs { font: 500 0.75rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

.tool-body { padding: clamp(2rem, 4vw, 3.5rem) 0 clamp(4rem, 8vw, 6rem); }
.tool { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); overflow: hidden; }
.tool-controls { padding: clamp(1.25rem, 3vw, 2.25rem); display: grid; gap: 1.5rem; align-content: start; border-right: 1px solid var(--line); }
.tool-view { position: relative; background: var(--ground); min-height: 520px; display: grid; }
.tool-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.tool-view canvas:active { cursor: grabbing; }
.tool-view svg { width: 100%; height: auto; align-self: center; padding: clamp(1rem, 3vw, 2.5rem); }
.view-hint { position: absolute; left: 1rem; top: 1rem; font-size: 0.8125rem; color: var(--muted); pointer-events: none; }
@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .tool-controls { border-right: 0; border-bottom: 1px solid var(--line); order: 2; }
  .tool-view { min-height: 340px; }
}

/* Controls */
.ctl { display: grid; gap: 0.6rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.ctl > legend, .ctl > .ctl-label, .ctl-label { padding: 0; font-size: 0.875rem; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; width: 100%; }
.ctl-label small, legend small { font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
.ctl output, .ctl-label output { color: var(--muted); font-weight: 500; font-size: 0.875rem; }
.ctl-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ctl-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stepper { display: grid; grid-template-columns: 2.75rem 1fr 2.75rem; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--panel); }
.stepper button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 500 1.25rem/1 var(--mono); cursor: pointer; }
.stepper button:hover { color: var(--text); background: rgb(255 255 255 / 0.05); }
.stepper button:disabled { opacity: 0.3; cursor: default; background: none; }
.stepper input { appearance: textfield; -moz-appearance: textfield; width: 100%; min-width: 0; border: 0; border-inline: 1px solid var(--line); background: transparent; color: var(--text); text-align: center; font: 500 1.125rem var(--mono); padding: 0.65rem 0; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: rgb(155 225 10 / 0.06); }

.num { font: 500 1.125rem var(--mono); color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 0.65rem 0.8rem; width: 100%; min-width: 0; }
.num:focus { border-color: var(--lime); outline: none; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.95rem; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.9375rem; font-weight: 500; color: var(--muted); cursor: pointer; transition: all 0.2s; user-select: none; }
.chips span:hover { color: var(--text); border-color: rgb(255 255 255 / 0.3); }
.chips input:checked + span { border-color: var(--lime); color: var(--text); background: rgb(155 225 10 / 0.08); }
.chips input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.chips-block { display: grid; gap: 0.5rem; }
.chips-block span { display: flex; border-radius: 10px; padding: 0.8rem 1rem; }
.chips-block small { margin-left: auto; color: var(--faint); font-size: 0.8125rem; }

.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); cursor: pointer; transition: transform 0.15s; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ground), 0 0 0 4px var(--lime); }
.swatches input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 4px; }
.swatches span:hover { transform: scale(1.08); }

.readout { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.readout div { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.readout div:nth-child(odd) { padding-right: 1rem; }
.readout dt { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.readout dd { margin: 0.25rem 0 0; font-weight: 600; font-size: 1.0625rem; }
.readout dd small { display: block; color: var(--muted); font-weight: 400; font-size: 0.875rem; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
.note { color: var(--faint); font-size: 0.875rem; }
.note a { color: var(--muted); }
.warn { color: #ffb347; font-size: 0.9375rem; }

/* Tools hub and homepage band */
.tool-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
/* Five cards: three across, then two wider ones, so none is left alone on a row */
@media (min-width: 1000px) { .tool-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); } .tool-cards li { grid-column: span 2; } .tool-cards li:nth-child(n+4) { grid-column: span 3; } }
.tool-cards a { display: flex; flex-direction: column; gap: 0.8rem; height: 100%; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.tool-cards a:hover { border-color: rgb(155 225 10 / 0.5); transform: translateY(-2px); }
.tool-cards svg { width: 44px; height: 44px; color: var(--lime); }
.tool-cards h3 { font-size: 1.25rem; }
.tool-cards p { color: var(--muted); font-size: 0.9875rem; }
.tool-cards .go { margin-top: auto; padding-top: 0.4rem; font: 500 0.75rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); }

/* Material picker */
.quiz { display: grid; gap: 1.75rem; }
.result { padding: clamp(1.25rem, 3vw, 2.25rem); display: grid; gap: 1.4rem; align-content: start; }
.result-top { display: grid; gap: 0.6rem; }
.result-top .eyebrow { margin: 0; }
.result h2 { font-size: clamp(2.2rem, 4vw, 3.4rem); display: flex; align-items: center; gap: 0.9rem; }
/* A filament spool seen end-on: a ring in the material's color */
.result h2::before { content: ""; width: 0.9em; height: 0.9em; border-radius: 50%; background: radial-gradient(circle, var(--ground) 0 26%, #4a4f55 27% 33%, var(--swatch, var(--lime)) 34% 100%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); flex: none; }
.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.why li { padding-left: 1.4rem; position: relative; color: var(--muted); }
.why li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 0.55rem; height: 2px; background: var(--lime); }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.ranking li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; align-items: center; font-size: 0.9375rem; color: var(--muted); }
.ranking li:first-child { color: var(--text); font-weight: 600; }
.ranking .bar { height: 6px; border-radius: 3px; background: rgb(255 255 255 / 0.08); overflow: hidden; }
.ranking .bar i { display: block; height: 100%; width: var(--w); background: var(--lime); border-radius: 3px; transition: width 0.35s ease; }
.ranking li:not(:first-child) .bar i { background: rgb(255 255 255 / 0.35); }

/* Measuring guide */
.guide { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
.guide-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.guide-step figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); padding: clamp(1rem, 3vw, 2rem); }
.guide-step figure svg { width: 100%; height: auto; }
.guide-step .n { font: 500 0.75rem var(--mono); letter-spacing: 0.14em; color: var(--lime); }
.guide-step h2 { font-size: clamp(1.6rem, 2.8vw, 2.4rem); margin: 0.5rem 0 0.9rem; }
.guide-step p + p, .guide-step ul { margin-top: 0.8rem; }
.guide-step p, .guide-step li { color: var(--muted); }
.guide-step ul { padding-left: 1.1rem; }
@media (max-width: 860px) { .guide-step { grid-template-columns: 1fr; } .guide-step figure { order: -1; } }

/* Long-form pages (privacy): one readable column */
.prose { max-width: 68ch; display: grid; gap: 2.75rem; }
.prose section { display: grid; gap: 0.8rem; }
.prose h2 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); letter-spacing: -0.02em; line-height: 1.15; }
.prose p, .prose li { color: var(--muted); }
.prose ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.4rem; }
.prose a { color: var(--text); text-underline-offset: 0.2em; }
.prose a:hover { color: var(--lime); }
.updated { font: 500 0.75rem var(--mono); letter-spacing: 0.08em; color: var(--faint); }

.foot-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 0.9375rem; padding: 0.55rem 0; }
.foot-links a:hover { color: var(--text); }
.foot-links { grid-column: 1 / -1; padding-top: 1.25rem; border-top: 1px solid var(--line); }
@media (max-width: 520px) {
  .ctl-row-3 { gap: 0.5rem; }
  .ctl-row-3 .stepper { grid-template-columns: 1.85rem 1fr 1.85rem; }
  .ctl-row-3 .stepper button { font-size: 1.05rem; }
  .tool-view svg { padding: 0.75rem; }
}

/* Desktop: the preview stays in view while you work the controls, with the quote button on it. */
.view-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 1rem; justify-content: space-between; padding: 0.9rem 1rem 0.9rem 1.25rem; background: linear-gradient(180deg, rgb(14 16 18 / 0), rgb(14 16 18 / 0.94) 35%); }
.view-bar p { font-weight: 600; font-size: 0.9875rem; }
.view-bar p small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
@media (min-width: 901px) {
  .tool { align-items: start; }
  .tool-view.sticky { position: sticky; top: 80px; height: calc(100svh - 104px); min-height: 520px; max-height: 820px; }
}
@media (max-width: 900px) {
  .view-bar { position: sticky; bottom: 0; z-index: 5; border-top: 1px solid var(--line); background: rgb(11 12 14 / 0.96); backdrop-filter: blur(10px); }
  .view-bar-wrap { display: contents; }
}
.after { color: var(--muted); font-size: 0.875rem; }
.verdict { font-size: clamp(1.4rem, 2.2vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; display: flex; align-items: center; gap: 0.6rem; }
.verdict::before { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgb(155 225 10 / 0.18); flex: none; }
.verdict.no::before { background: var(--error); box-shadow: 0 0 0 4px rgb(255 107 90 / 0.18); }
.verdict small { display: block; font-size: 0.9375rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
@media (max-width: 900px) { .quiz { order: 0 !important; } }
@media (min-width: 901px) {
  /* Fit the drawing inside the pinned pane, clear of the quote bar */
  .tool-view.sticky svg { position: absolute; inset: 0; width: 100%; height: 100%; padding: 2rem 2rem 5.5rem; }
}
