/* Membership price calculator (membership.html only).
   The card, eyebrow, heading, buttons and disclaimer come from the site
   stylesheet; this file styles only what is new. Spacing uses the 4/8/12/16/
   24/32 scale. Colours are the site's: blue #5BA3D0 controls with cream text
   (the primary-button treatment), dark blue #2C6285 for the chosen state,
   #3F8AB8 for prices and titles, ink #1F2A37 and secondary #51607A for text.

   Flow is vertical: intro → family panel (stepper + age grid) → estimate head
   (label + billing toggle) → three tier cards → help line → fine print.
   Panels and cards are cream with the blue outline, like the site's other
   outline cards; the controls are solid blue like the site's buttons. */

.calc { position: relative; }

/* The section and the tier links rely on the `hidden` attribute as a gate.
   Any display rule below would override it, so pin it here. */
.calc [hidden], .calc-link[hidden] { display: none !important; }

.calc .peds-intro { margin-bottom: 24px; }
.calc__sub { font-size: clamp(16px, 1.3vw, 18px); line-height: 1.55; color: #51607A; margin: 12px 0 0; max-width: 32em; }

/* ---- labels (the same title style for "How many children?", "How old?" and "Child N") ---- */
.calc__label {
  font-family: "DM Sans", "Inter", system-ui, sans-serif; font-weight: 800; font-size: 16px;
  line-height: 1.3; color: #1F2A37; margin: 0 0 10px;
}

/* ---- family panel (cream, blue outline) ----
   Header row: the question as a serif title on the left, the counter on the
   right, the same left/right pairing as the "Your estimate" row below. */
.calc__family { background: #F5F1E8; border: 1.5px solid #5BA3D0; border-radius: var(--peds-r, 16px); padding: 24px; }
.calc__family.is-sizing { overflow: hidden; }   /* while its height animates (set by JS) */
.calc__family-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.calc__title {
  font-family: "Bookmania", "Cormorant Garamond", Georgia, serif; font-weight: 400;
  font-size: clamp(24px, 2.4vw, 30px); line-height: 1.1; color: #3F8AB8; margin: 0;
}
.calc__ages {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px 24px;
  margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(91, 163, 208, 0.32);
}

/* Segmented pills: unchosen = the site's empty outline button (cream fill, blue
   edge, blue text); chosen = the site's solid blue with cream text and a check.
   Hover on an unchosen pill is a light tint, not the full flip, so hover never
   looks like a selection. Colour changes take the site's 0.25s; nothing moves. */
.calc__seg { display: flex; flex-wrap: wrap; gap: 8px; }
.calc__pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: #F5F1E8; border: 1.5px solid #5BA3D0; color: #5BA3D0;
  font-family: "DM Sans", "Inter", system-ui, sans-serif; font-weight: 700; font-size: 14px; line-height: 1;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
.calc__pill:hover { background: rgba(91, 163, 208, 0.14); }
.calc__pill[aria-pressed="true"], .calc__pill[aria-pressed="true"]:hover { background: #5BA3D0; border-color: #5BA3D0; color: #F5F1E8; font-weight: 800; }
.calc__save { font-weight: 600; color: #3F8AB8; margin-left: 2px; }
.calc__pill[aria-pressed="true"] .calc__save, .calc__pill[aria-pressed="true"]:hover .calc__save { color: #F5F1E8; }
.calc__pill-check { display: none; width: 14px; height: 14px; flex: 0 0 auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat; }
.calc__pill[aria-pressed="true"] .calc__pill-check { display: inline-block; }
.calc__pill:focus-visible, .calc__step:focus-visible { outline: 3px solid #2C6285; outline-offset: 2px; }

/* Stepper: blue circles, same flip on hover, dark blue while pressed */
.calc__stepper { display: inline-flex; align-items: center; gap: 12px; }
.calc__step {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid #5BA3D0; background: #5BA3D0;
  color: #F5F1E8; font-family: "DM Sans", "Inter", system-ui, sans-serif; font-weight: 800; font-size: 20px; line-height: 1;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
.calc__step:hover:not(:disabled) { background: #F5F1E8; color: #5BA3D0; }
.calc__step:active:not(:disabled) { background: #2C6285; border-color: #2C6285; color: #fff; }
.calc__step:disabled { opacity: .4; cursor: default; }
.calc__count {
  display: inline-block; min-width: 32px; text-align: center;
  font-family: "DM Sans", "Inter", system-ui, sans-serif; font-weight: 800; font-size: 24px; color: #1F2A37;
}

/* ---- estimate head: label left, billing toggle right ---- */
.calc__results-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; margin: 32px 0 12px;
}
.calc__results-head .calc__label { margin: 0; }

/* ---- tier cards (cream, blue outline). Name and copy at the top; the price
   anchors just above the button, so the three prices and buttons line up. ---- */
.calc__tiers { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 960px) { .calc__tiers { grid-template-columns: repeat(3, 1fr); } }
.calc__tier {
  display: flex; flex-direction: column; gap: 8px;
  background: #F5F1E8; border: 1.5px solid #5BA3D0; border-radius: var(--peds-r, 16px); padding: 24px;
}
.calc__tier[aria-current="true"] { border-color: #2C6285; }
.calc__tier-name {
  font-family: "Bookmania", "Cormorant Garamond", Georgia, serif; font-weight: 400;
  font-size: clamp(28px, 2.8vw, 36px); line-height: 1.08; color: #3F8AB8; margin: 0;
}
.calc__who { font-size: 14px; line-height: 1.5; color: #51607A; margin: 0; }
.calc__price { margin-top: auto; padding-top: 16px; }
.calc__amount {
  font-family: "DM Sans", "Inter", system-ui, sans-serif; font-weight: 800; font-size: clamp(30px, 3vw, 40px);
  line-height: 1.05; color: #3F8AB8; margin: 0;
}
.calc__unit { font-size: 14px; font-weight: 700; color: #51607A; margin-left: 4px; white-space: nowrap; }   /* "/mo" sits beside the number */
.calc__amount--empty { color: rgba(63, 138, 184, 0.35); }   /* placeholder dash while no price can be shown */
.calc__year { font-family: "DM Sans", "Inter", system-ui, sans-serif; font-size: 14px; font-weight: 600; color: #51607A; margin: 4px 0 0; }
.calc__hint { font-family: "DM Sans", "Inter", system-ui, sans-serif; font-size: 14px; font-weight: 700; color: #51607A; margin: 0; line-height: 1.4; }
.calc__tier .peds-btn { width: 100%; margin-top: 4px; }   /* hover: the site's own cream/blue flip */

/* Rolling digits. Every digit is a 1em-tall window over a strip of 0–9 twice;
   the script slides the strip so a digit rolls up or down to the new value.
   Non-digits ($ . ,) are plain 1em cells so everything shares one baseline.
   Tabular figures by construction: this DM Sans build has no tnum feature, so
   each column is as wide as the widest digit (the strip holds all ten) and the
   digit is centred in it. Widths never change when a digit rolls. */
.calc__num { display: inline-flex; align-items: flex-end; position: relative; }
.calc__num-cells { display: inline-flex; align-items: flex-end; }
.calc__glyph, .calc__reel { display: inline-block; height: 1em; line-height: 1; }
.calc__reel { overflow: hidden; }
.calc__reel-strip { display: block; will-change: transform; }
.calc__reel-strip span { display: block; height: 1em; line-height: 1; text-align: center; }
.calc__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.calc__help { font-size: 14px; line-height: 1.5; color: #51607A; margin: 16px 0 0; text-align: center; }
.calc__fine { margin-top: 24px; }

/* Tier-card button to the calculator: the site's cream/blue-outline CTA, beside
   "Talk to Dr. Trey" in each tier's .peds-cta-row. Revealed with the section;
   until then the row holds the primary button alone. Slightly tighter sides than
   the tier's 36px so the pair fits on one line in the tier column at 1440. */
.peds-ztier__id .calc-link.peds-btn { padding-left: 24px; padding-right: 24px; }

/* ---- phones ---- */
@media (max-width: 600px) {
  .calc__family, .calc__tier { padding: 16px; }
  .calc__ages { grid-template-columns: 1fr; }
  .calc__seg > .calc__pill { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 13px; }
  .calc__billing > .calc__pill { flex: 1 1 0; }
  .calc__results-head { margin-top: 24px; }
}

/* ---- motion: the site's curve (see .peds-fade-in in peds-overrides.css) ----
   Panel and cards fade in on scroll through the site's own .peds-fade-in
   classes (added by price-calculator.js). Interaction motion: digits roll,
   the family panel animates its height when rows come and go, new rows rise
   in, the count and the check mark pop, a hint fades in, and a tier link
   flashes the card it highlights. Off under prefers-reduced-motion; pill and
   stepper colours flip like the site's buttons. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes calc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes calc-tick { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes calc-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
  @keyframes calc-flash { from { background-color: rgba(91, 163, 208, 0.22); } to { background-color: #F5F1E8; } }
  .calc-rise { animation: calc-rise .45s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .calc-tick { animation: calc-tick .35s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .calc-pop { animation: calc-pop .3s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .calc-flash { animation: calc-flash .65s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .calc__pill[aria-pressed="true"] .calc__pill-check { animation: calc-pop .3s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .calc__family.is-sizing { transition: height .4s cubic-bezier(0.22, 0.61, 0.36, 1); }
  .calc__reel-strip { transition: transform .6s cubic-bezier(0.22, 0.61, 0.36, 1); }
  .calc__pill, .calc__step { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }
}
