/* ------------------------------------------------------------
   Resin Cartridge Sizing Calculator — page-scoped styles
   Light mode only. Uses site.css design tokens (--navy, --blue, etc).
   All interactive surfaces use --navy for fills (brand blue is decorative
   only, per the redesign system) to keep AA contrast.
   ------------------------------------------------------------ */

.calc-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-12) var(--gutter) var(--space-20);
}

/* Help intro / collapsibles ----------------------------------------- */
.calc-collapse {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  margin-bottom: var(--space-6);
  overflow: hidden;
}
.calc-collapse__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 18px 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}
.calc-collapse__toggle:hover { color: var(--navy); }
.calc-collapse__arrow {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
  color: var(--navy);
}
.calc-collapse__arrow.open { transform: rotate(90deg); }
.calc-collapse__body {
  display: none;
  padding: 0 22px 22px;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-secondary);
}
.calc-collapse__body.open { display: block; }
.calc-collapse__h {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 6px;
}
.calc-collapse__body p { margin: 0 0 10px; }
.calc-collapse__list { margin: 0 0 12px; padding-left: 22px; }
.calc-collapse__list li { margin-bottom: 6px; }

.howto-link {
  background: none;
  border: none;
  color: var(--navy);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
}
.howto-body { display: none; margin-top: 12px; }
.howto-body.open { display: block; }
.howto-step { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.howto-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--text-on-navy);
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.howto-text { font-size: var(--text-base); line-height: 1.6; }

/* Catalog panel ----------------------------------------------------- */
.calc-card {
  background: var(--surface-0);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
}
.calc-card__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.calc-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 16px;
}

.calc-select,
.calc-input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-0);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.calc-select:focus,
.calc-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.12);
}

.catalog-manual-link { margin-top: 10px; }
.catalog-manual-link a {
  font-size: var(--text-sm);
  color: var(--navy);
  text-decoration: underline;
}

.catalog-info {
  display: none;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
}
.catalog-info.visible { display: block; }
.catalog-info__title { font-size: var(--text-lg); color: var(--text-primary); margin-bottom: 10px; }
.catalog-info__title strong { font-weight: 700; }

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.chip-cartridge { background: var(--navy); color: var(--text-on-navy); }
.chip-system    { background: #4a5568; color: #fff; }
.chip-sac       { background: #0f5132; color: #fff; }      /* deep green */
.chip-wac       { background: #6b3fa0; color: #fff; }      /* deep purple */

.resin-explainer {
  display: none;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-primary);
}
.resin-explainer.visible { display: block; }
.resin-explainer.sac { background: #e7f3ec; border-left: 4px solid #0f5132; }
.resin-explainer.wac { background: #efe9f6; border-left: 4px solid #6b3fa0; }

.catalog-info__desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}
.catalog-info__app {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.catalog-info__caveat {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* Capacity-provenance caveat -- distinct from the general water-conditions
   caveat above and from the confidence badge/tooltip. Not a warning about
   the customer's input (that is .warn-callout, styled amber); this is a
   statement about the product data itself, styled as an informational note
   so the two are never visually conflated. Always in normal document flow
   (no hover, no tooltip) so it is visible on touch and present when printed. */
.capacity-caveat {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary);
}
.capacity-caveat.visible { display: block; }

/* Input fields ------------------------------------------------------ */
.field-group { margin-bottom: var(--space-6); }
.field-group:last-of-type { margin-bottom: var(--space-4); }
.label-help-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.label-help-row label { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.helper-text { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 10px; line-height: 1.5; }

.grains-filled-note {
  display: none;
  margin-top: 8px;
  font-size: var(--text-sm);
  color: #0f5132;
  font-weight: 600;
}
.grains-filled-note.visible { display: inline-flex; align-items: center; gap: 6px; }
.grains-filled-note svg { width: 14px; height: 14px; }

.water-input-row { display: flex; gap: 12px; }
.water-input-row .calc-input { flex: 1 1 45%; }
.water-input-row .calc-select { flex: 1 1 55%; }

.unit-tip-bar {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-secondary);
}
.unit-tip-bar.visible { display: block; }

.reliability-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.rel-badge {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  padding: 4px 12px; border-radius: 999px; color: #fff;
}
.rel-badge.high   { background: #0f5132; }
.rel-badge.medium { background: #92600a; }
.rel-badge.low    { background: #842029; }
.reliability-note { font-size: var(--text-sm); color: var(--text-secondary); }

.ec-factor-row {
  display: none;
  align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-1);
  border-radius: var(--radius);
}
.ec-factor-row.visible { display: flex; }
.ec-factor-row label { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.ec-factor-row .calc-input { width: 90px; flex: 0 0 auto; }
.ec-factor-row span { font-size: var(--text-sm); color: var(--text-muted); }

.warn-callout {
  display: none;
  margin-top: 12px;
  padding: 14px 16px;
  background: #fdf3e3;
  border: 1px solid #e7c98a;
  border-left: 4px solid #92600a;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: #5c4209;
}
.warn-callout.visible { display: block; }
.warn-callout strong { color: #5c4209; }

.btn-calculate {
  width: 100%;
  margin-top: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 700;
  padding: 16px;
  background: var(--navy);
  color: var(--text-on-navy);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-calculate:hover { background: var(--btn-primary-hover); }

/* Result card ------------------------------------------------------- */
.result-card {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-top: 4px solid var(--blue);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
}
.result-card.visible { display: block; }
.result-headline {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
}
.result-gallons { font-size: 2.75rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.result-label { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }
.conf-badge {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  padding: 5px 13px; border-radius: 999px; color: #fff;
}
.conf-badge.high   { background: #0f5132; }
.conf-badge.medium { background: #92600a; }
.conf-badge.low    { background: #842029; }
.result-days {
  display: none;
  margin-top: 18px;
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.result-days.visible { display: block; }
.result-days strong { color: var(--navy); }
.replacement-guidance {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-mid);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Education table --------------------------------------------------- */
.edu-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.edu-table th, .edu-table td {
  border: 1px solid var(--border-light);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: var(--text-sm);
  line-height: 1.55;
}
.edu-table th { background: var(--navy); color: var(--text-on-navy); font-weight: 600; }
.edu-table td { color: var(--text-secondary); }
.edu-table .rel-badge { font-size: 12px; padding: 2px 8px; }
.edu-h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 18px 0 6px; }
.edu-p { font-size: var(--text-base); color: var(--text-secondary); line-height: 1.65; margin: 0 0 10px; }

/* Glossary ---------------------------------------------------------- */
.glossary-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .glossary-grid { grid-template-columns: 1fr 1fr; } }
.g-dt { font-size: var(--text-base); font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.g-dd { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55; }

/* Help tooltips ----------------------------------------------------- */
.help-icon-wrap { position: relative; display: inline-flex; }
.help-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.help-icon:hover, .help-icon.active { background: var(--btn-primary-hover); }
.help-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 280px;
  max-width: 80vw;
  padding: 14px 16px;
  background: var(--text-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.55;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.help-tooltip.visible { display: block; }
.help-tooltip.flip-left { left: auto; right: 0; }
.help-tooltip-close {
  position: absolute; top: 6px; right: 8px;
  width: 20px; height: 20px; padding: 0;
  background: transparent; border: 0; cursor: pointer;
  border-radius: var(--radius, 6px);
}
.help-tooltip-close::before,
.help-tooltip-close::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 12px; height: 2px; background: #cbd5e1; border-radius: 1px;
}
.help-tooltip-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.help-tooltip-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.help-tooltip-close:hover::before,
.help-tooltip-close:hover::after { background: #94a3b8; }

.disclaimer {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
  margin: var(--space-8) auto 0;
  max-width: 700px;
}

/* Action buttons (Print / Save as PDF) ------------------------------ */
.calc-actions { display: flex; gap: 12px; justify-content: flex-end; margin-bottom: var(--space-6); flex-wrap: wrap; }
.calc-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-sm); font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--btn-outline-border);
  background: var(--surface-0);
  color: var(--btn-outline-text);
  cursor: pointer;
}
.calc-action-btn:hover { background: var(--btn-outline-hover-bg); color: var(--btn-outline-hover-text); }
.calc-action-btn svg { width: 16px; height: 16px; }

@media print {
  .site-header, .site-nav--mobile, .site-footer, .calc-actions, .help-icon-wrap, .page-hero__wave { display: none !important; }
  .calc-collapse__body, .howto-body { display: block !important; }
  body { background: #fff; }
  .result-card { display: block !important; }
}
