@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.hidden { display: none !important; }

:root {
  --navy:    #0b2540;
  --navy2:   #153556;
  --cyan:    #0ea5e9;
  --cyan2:   #38bdf8;
  --emerald: #10b981;
  --amber:   #f59e0b;
  --card:    rgba(255,255,255,0.92);
  --text:    #0b1f2e;
  --muted:   #4a657a;
  --line:    rgba(14,165,233,0.13);
  --shadow:  0 4px 32px rgba(11,37,64,0.10), 0 1px 4px rgba(11,37,64,0.06);
  --shadow-lg: 0 8px 48px rgba(11,37,64,0.13), 0 2px 8px rgba(11,37,64,0.07);
  --ring:    0 0 0 3px rgba(14,165,233,0.22);
  --radius:  20px;
  --radius-sm: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Background ── */
.bg-anim {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(160deg, #ddf0fb 0%, #eef8ff 40%, #f5faff 70%, #ffffff 100%);
  overflow: hidden;
}
.bg-anim::before,
.bg-anim::after {
  content: "";
  position: absolute;
  inset: -40%;
  filter: blur(55px);
  opacity: 0.7;
  will-change: transform;
}
.bg-anim::before {
  background:
    radial-gradient(42% 38% at 18% 18%, rgba(56,189,248,0.42), transparent 65%),
    radial-gradient(36% 36% at 82% 26%, rgba(16,185,129,0.28), transparent 65%),
    radial-gradient(44% 42% at 52% 88%, rgba(14,165,233,0.24), transparent 65%);
  animation: floatA 20s ease-in-out infinite;
}
.bg-anim::after {
  background:
    radial-gradient(32% 32% at 38% 52%, rgba(14,165,233,0.20), transparent 65%),
    radial-gradient(30% 30% at 72% 62%, rgba(34,197,94,0.16), transparent 65%);
  animation: floatB 28s ease-in-out infinite;
  opacity: 0.55;
}
@keyframes floatA {
  0%   { transform: translate3d(-2%,-1%,0) scale(1); }
  35%  { transform: translate3d(3%,2%,0) scale(1.04); }
  70%  { transform: translate3d(-1%,4%,0) scale(1.02); }
  100% { transform: translate3d(-2%,-1%,0) scale(1); }
}
@keyframes floatB {
  0%   { transform: translate3d(2%,2%,0) scale(1); }
  40%  { transform: translate3d(-3%,1%,0) scale(1.05); }
  75%  { transform: translate3d(1%,-3%,0) scale(1.02); }
  100% { transform: translate3d(2%,2%,0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-anim::before, .bg-anim::after { animation: none; }
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(255,255,255,0.82);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy);
  flex-shrink: 0;
}
.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cyan), var(--emerald));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(14,165,233,0.30);
  flex-shrink: 0;
}
.brand__text {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.brand__title-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-shrink: 0;
}
.brand__name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.brand__by {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.brand__disc {
  display: none;
  flex-direction: column;
  gap: 0px;
  font-size: 0.67rem;
  color: rgba(74,101,122,0.65);
  border-left: 1.5px solid rgba(14,165,233,0.18);
  padding-left: 9px;
  line-height: 1.5;
  margin-left: 4px;
}
.brand__disc span { display: block; }
@media (min-width: 640px) { .brand__disc { display: flex; } }

/* ── Nav ── */
.nav-pills {
  display: flex;
  align-items: center;
  gap: 3px;
}
.nav-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nav-btn:hover { background: rgba(14,165,233,0.08); color: var(--navy); }
.nav-btn.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
  box-shadow: 0 2px 8px rgba(11,37,64,0.22);
}

/* ── Cards ── */
.card-surface {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-card { padding: 28px; animation: fadeSlide 0.22s ease; }

/* ── Hero ── */
.hero {
  padding: 30px 30px 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}

.hero__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.hero__title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 2.05rem;
  line-height: 1.12;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero__title em { font-style: normal; color: var(--cyan); }
.hero__sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.6;
}
.hero__hint {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0369a1;
  background: rgba(14,165,233,0.09);
  border: 1px solid rgba(14,165,233,0.20);
  border-radius: 999px;
  padding: 6px 14px;
  transition: opacity 0.3s ease;
  line-height: 1.3;
}

/* ── Section headings ── */
.section-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 3px;
}
.section-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--navy);
  margin-bottom: 4px;
}
.section-desc {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 20px;
  max-width: 58ch;
  line-height: 1.55;
}

/* ── Form labels ── */
.lbl {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

/* ── Inputs ── */
input[type="number"],
input[type="text"],
select,
.ui-input {
  font-family: 'Inter', sans-serif;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  border: 1.5px solid rgba(14,165,233,0.18);
  background: rgba(255,255,255,0.90);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
.ui-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: var(--ring);
  background: #fff;
}
input::placeholder { color: rgba(74,101,122,0.4); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a657a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.88rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s, background 0.12s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus  { outline: none; box-shadow: var(--ring); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; border-radius: 10px; }

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  border-color: rgba(14,165,233,0.25);
  box-shadow: 0 3px 14px rgba(14,165,233,0.26);
}
.btn-primary:hover { filter: brightness(1.07); }

.btn-accent {
  background: linear-gradient(135deg, #0b2540, #1e4976);
  color: white;
  border-color: rgba(11,37,64,0.2);
  box-shadow: 0 4px 16px rgba(11,37,64,0.22);
  font-size: 0.92rem;
  padding: 12px 24px;
  border-radius: 14px;
}
.btn-accent:hover { filter: brightness(1.14); }

.btn-ghost {
  background: rgba(255,255,255,0.65);
  color: var(--muted);
  border-color: var(--line);
}
.btn-ghost:hover { background: rgba(255,255,255,0.95); color: var(--navy); border-color: rgba(14,165,233,0.26); }

/* ── Gallons toggle ── */
.gallons-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0369a1;
  background: rgba(14,165,233,0.07);
  border: 1.5px dashed rgba(14,165,233,0.28);
  border-radius: 10px;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.gallons-toggle:hover { background: rgba(14,165,233,0.13); border-style: solid; }
.gallons-toggle .gt-chev { transition: transform 0.18s ease; display: inline-block; }
.gallons-toggle[aria-expanded="true"] .gt-chev { transform: rotate(180deg); }

/* ── Pool shape cards ── */
.pool-card {
  background: rgba(248,252,255,0.95);
  border: 1.5px solid rgba(14,165,233,0.14);
  border-radius: 16px;
  padding: 16px;
}
.pool-card__title { font-weight: 700; font-size: 0.88rem; color: var(--navy); }
.pool-card__sub   { font-size: 0.76rem; color: var(--muted); margin-bottom: 8px; margin-top: 2px; }
.pool-card input  { margin-top: 6px; }
.pool-card .btn   { width: 100%; margin-top: 10px; }

/* ── Readings grid ── */
.readings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 520px) { .readings-grid { grid-template-columns: 1fr; } }

/* ── Result cards ── */
.rec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: rgba(240,250,255,0.92);
  border: 1px solid rgba(14,165,233,0.14);
  border-radius: 13px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeSlide 0.22s ease;
}
.rec-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.rec-item--low  .rec-item__dot { background: #ef4444; }
.rec-item--low  { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.20); }
.rec-item--high .rec-item__dot { background: #ef4444; }
.rec-item--high { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.20); }
.rec-item--miss .rec-item__dot { background: #94a3b8; }
.rec-item--ok   .rec-item__dot { background: #10b981; }
.rec-item--ok { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.18); }
.rec-item--warn .rec-item__dot { background: #f59e0b; }
.rec-item--warn { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.22); }
.rec-congrats {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, rgba(16,185,129,0.07), rgba(14,165,233,0.05));
  border: 1px solid rgba(16,185,129,0.20);
  border-radius: 16px;
  animation: fadeSlide 0.22s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Divider ── */
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* ── Shock live result ── */
.shock-live-result {
  background: linear-gradient(135deg, rgba(14,165,233,0.10) 0%, rgba(56,189,248,0.07) 100%);
  border: 1.5px solid rgba(14,165,233,0.22);
  color: var(--text);
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: none;
}
.shock-live-result.visible { display: block; animation: fadeSlide 0.2s ease; }
.shock-live-result__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}
.shock-live-result__main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.shock-live-result__val {
  font-family: 'Inter', sans-serif;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 700;
  color: var(--navy);
}
.shock-live-result__unit { font-size: 0.82rem; color: var(--muted); }
.shock-live-result__alts {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.7;
}
.shock-live-result__alts strong { color: var(--navy); font-weight: 700; }

/* shock chart removed */

/* ── Chemistry guide ── */
.chem-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: rgba(255,255,255,0.75);
}
.chem-card + .chem-card { margin-top: 9px; }
.chem-card summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 17px;
  cursor: pointer;
  list-style: none;
  transition: background 0.14s;
}
.chem-card summary::-webkit-details-marker { display: none; }
.chem-card summary:hover { background: rgba(14,165,233,0.04); }
.chem-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; flex-shrink: 0;
}
.chem-card__name { font-weight: 700; font-size: 0.9rem; color: var(--navy); flex: 1; }
.chem-card__badge {
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(14,165,233,0.10); color: var(--cyan);
  letter-spacing: 0.02em;
}
.chem-card__chev {
  color: var(--muted);
  font-size: 0.72rem;
  transition: transform 0.17s ease;
  margin-left: 4px;
}
details[open] .chem-card__chev { transform: rotate(180deg); }
.chem-card__body {
  padding: 4px 17px 16px 61px;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.65;
  border-top: 1px solid var(--line);
}
.chem-card__body p + p { margin-top: 8px; }
.chem-range {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--emerald);
  background: rgba(16,185,129,0.10);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ── Disclaimer strip ── */
.inline-disc {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  padding: 11px 14px;
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: 11px;
  font-size: 0.78rem;
  color: rgba(92,67,10,0.82);
  line-height: 1.5;
}
.inline-disc__icon { font-size: 0.9rem; flex-shrink: 0; line-height: 1; }

/* ── Gap helpers ── */
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.gap-2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 500px) { .gap-2-cols { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════
   MOBILE  (≤ 640px) — desktop untouched
   ═══════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Header: logo left, nav scrolls horizontally ── */
  .site-header__inner {
    padding: 10px 14px;
    gap: 10px;
  }
  .brand__disc { display: none; }
  .brand__name { font-size: 0.92rem; }
  .brand__by   { font-size: 0.7rem; }
  .brand__mark { width: 26px; height: 26px; border-radius: 8px; }

  .nav-pills {
    gap: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
    max-width: 60%;
  }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 6px 10px; font-size: 0.75rem; white-space: nowrap; }

  /* ── Main padding ── */
  main { padding: 10px 12px 60px !important; }

  /* ── Hero ── */
  .hero { padding: 18px 16px 16px; }
  .hero__eyebrow { font-size: 0.62rem; margin-bottom: 6px; }
  .hero__title { font-size: 1.55rem; letter-spacing: -0.025em; }
  .hero__sub { font-size: 0.88rem; margin-top: 8px; }
  .hero__hint { font-size: 0.78rem; padding: 5px 12px; margin-top: 12px; }

  /* ── Section cards ── */
  .section-card { padding: 16px 14px; }
  .section-title { font-size: 1.25rem; }
  .section-desc  { font-size: 0.83rem; margin-bottom: 16px; }
  .section-eyebrow { margin-bottom: 2px; }

  /* ── Form: all 2-col grids collapse to 1 col ── */
  .gap-2-cols       { grid-template-columns: 1fr; gap: 10px; }
  .readings-grid    { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lbl              { font-size: 0.7rem; }
  input[type="number"],
  input[type="text"],
  select,
  .ui-input         { padding: 9px 11px; font-size: 0.9rem; border-radius: 10px; }

  /* ── Gallons toggle ── */
  .gallons-toggle   { font-size: 0.76rem; padding: 6px 11px; }

  /* ── Pool shape cards ── */
  .pool-card        { padding: 13px; }
  .pool-card__title { font-size: 0.84rem; }
  .pool-card input  { margin-top: 5px; }

  /* ── CTA button — full width ── */
  #calcBtn {
    width: 100%;
    justify-content: center;
    padding: 13px 18px;
    font-size: 0.92rem;
    margin-top: 10px;
  }

  /* ── Results ── */
  .rec-item         { padding: 10px 12px; font-size: 0.84rem; gap: 10px; }
  .rec-item__dot    { width: 7px; height: 7px; flex-shrink: 0; }

  /* ── Shock guide ── */
  #shockCustomSize  { max-width: 100% !important; }
  .shock-live-result { padding: 16px 16px; border-radius: 14px; }
  .shock-live-result__val { font-size: 1.8rem; }
  .shock-live-result__alts { font-size: 0.76rem; }

  /* ── Chemistry guide ── */
  .chem-card summary  { padding: 11px 13px; gap: 10px; }
  .chem-icon          { width: 28px; height: 28px; font-size: 0.85rem; border-radius: 8px; }
  .chem-card__name    { font-size: 0.85rem; }
  .chem-card__badge   { font-size: 0.66rem; padding: 2px 7px; }
  .chem-card__body    { padding: 4px 13px 14px 13px; font-size: 0.83rem; }
  .chem-card__body p + p { margin-top: 6px; }

  /* ── Disclaimer strips ── */
  .inline-disc { font-size: 0.75rem; padding: 10px 12px; gap: 8px; }
  .inline-disc__icon { font-size: 0.85rem; }

  /* ── Divider ── */
  .divider { margin: 14px 0; }
}

/* Extra small (≤ 380px) */
@media (max-width: 380px) {
  .hero__title    { font-size: 1.38rem; }
  .readings-grid  { grid-template-columns: 1fr; }
  .nav-btn        { font-size: 0.7rem; padding: 5px 8px; }
}
