/* ============================================================
   Shared UI for rebuilt pages — whatsup.ai

   Load order on a rebuilt page:
     tokens.css → ui.css → nav.css → the page's own stylesheet
   (Pages not yet rebuilt load base.css instead of this file.)

   What lives here: reset, page hero, the "inputs beside results"
   tool layout, form fields and sliders, cards, buttons, status
   pills, collapsible chapters, the phone result bar, toast, and
   the per-page footer slot. Anything specific to one tool stays
   in that tool's stylesheet.

   Two font families only (DM Sans + Instrument Serif): do not
   use var(--mono) or var(--body) on pages that load this file.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select { font-family: inherit; }
a { color: var(--accent-text); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.lbl {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--dim);
}

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-text); border-color: var(--accent-text); }
.link-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  font-size: inherit; font-weight: 600; color: var(--accent-text); text-decoration: underline;
}

/* ───────────── Hero ───────────── */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: end;
}
.hero-inner { min-width: 0; }
.hero-tag {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 14px;
}
.hero-t {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px, 5.2vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero-t .accent { font-style: italic; color: var(--accent-text); }
.hero-desc {
  margin-top: 18px;
  max-width: 560px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--dim);
  text-wrap: pretty;
}

/* ───────────── Tool layout: inputs beside results ─────────────
   <main class="tool"> with two direct children, .tool-inputs and
   .tool-results (id="results" so analytics counts its children). */
.tool {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
}
.tool > noscript { grid-column: 1 / -1; }
.tool > noscript section { padding: 24px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tool > noscript h2 { font-family: var(--display); font-weight: 400; font-size: 28px; margin-bottom: 10px; }
.tool > noscript p, .tool > noscript ul { margin-bottom: 12px; color: var(--dim); }
.tool > noscript ul { padding-left: 20px; }

@media (min-width: 960px) {
  .tool { grid-template-columns: 360px minmax(0, 1fr); }
  .tool-inputs {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

.tool-inputs {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.tool-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ───────────── Fields and sliders ───────────── */
.panel-title { font-size: 20px; font-weight: 700; }
.panel-note { font-size: 14px; color: var(--muted); }
/* A labelled group of fields inside the panel: <div class="lbl panel-group">…</div> */
.panel-group { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-label { font-size: 14px; font-weight: 600; color: var(--dim); }
.field-help { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.slider-field { gap: 2px; }
.slider-val { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.small-slider-val { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.slider-range-labels { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
/* Compact slider: label on the left, live value on the right, track below */
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.slider-out { font-size: 17px; font-weight: 700; color: var(--ink); white-space: nowrap; }

/* Range inputs: 6px track, 24px thumb, 32px tall hit area */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 32px;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--ring-bg); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--ring-bg); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(15, 27, 45, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(15, 27, 45, 0.3);
}

/* Select, segmented choice, checkbox row */
.select {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%233D5068' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.select:hover { border-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.seg-btn {
  min-height: 48px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--dim);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.seg-btn:hover { border-color: var(--accent); }
.seg-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-size: 16px; color: var(--ink); cursor: pointer; }
.check-row input { flex: none; width: 20px; height: 20px; accent-color: var(--accent); }

/* ───────────── Verdict card: a tool's answer, stated first ───────────── */
.verdict-card { padding: clamp(20px, 3vw, 32px); scroll-margin-top: 16px; }
.verdict-label { font-size: 15px; font-weight: 600; color: var(--dim); }
.verdict-text {
  margin-top: 4px;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}
.verdict-sub { margin-top: 12px; max-width: 620px; font-size: 19px; line-height: 1.5; text-wrap: pretty; }

/* ───────────── Status pill ───────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
}

/* ───────────── Chapters (native <details>) ───────────── */
.chapter { overflow: hidden; }
.chapter > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary:focus-visible { outline-offset: -3px; border-radius: var(--radius-lg); }
.chapter-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  min-width: 0;
}
.chapter-sum {
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  color: var(--dim);
}
.chapter-chev { flex: none; color: var(--dim); transition: transform 0.2s; }
.chapter[open] > summary .chapter-chev { transform: rotate(180deg); }
.chapter > summary:hover .chapter-chev { color: var(--accent-text); }
.chapter-body { padding: 0 24px 24px; }
.chapter-body + .chapter-body { padding-top: 0; }
.chapter-note { margin-top: 14px; font-size: 14px; color: var(--muted); }
.chapter-lede { font-size: 16px; color: var(--dim); max-width: 640px; margin-bottom: 16px; }
.chapter-lede b { color: var(--ink); font-weight: 600; }
.chapter-line { margin-top: 18px; font-size: 19px; line-height: 1.5; text-wrap: pretty; }

/* Insight: a short personalised note */
.insight { margin-top: 14px; padding: 16px 18px; border-radius: 12px; }
.insight .title { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.insight .body { font-size: 15px; color: var(--dim); line-height: 1.6; }

/* ───────────── Phone: result pinned to the bottom ─────────────
   Markup: .sticky-result > .sticky-main (.sticky-label, .sticky-value) + a.sticky-btn.
   A page script adds .is-visible while the real result card is off screen. */
.sticky-result {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 27, 45, 0.08);
  transform: translateY(110%);
  transition: transform 0.25s ease;
}
.sticky-result.is-visible { transform: translateY(0); }
.sticky-main { display: flex; flex-direction: column; min-width: 0; }
.sticky-label { font-size: 14px; color: var(--dim); }
.sticky-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sticky-amount { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.sticky-result .status-pill { height: 24px; padding: 0 10px; font-size: 13px; }
.sticky-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
@media (max-width: 959px) {
  .sticky-result { display: flex; }
  body { padding-bottom: 84px; }
  .toast { bottom: 96px !important; }
}

/* ───────────── Share bar + further reading ───────────── */
.share-bar { padding: 16px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.share-bar p { font-size: 16px; color: var(--dim); }
.reading { padding: 20px 24px 8px; }
.reading-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.reading a {
  display: flex; align-items: center; min-height: var(--tap); padding: 8px 0;
  border-top: 1px solid var(--hairline);
  font-size: 16px; font-weight: 600; text-decoration: none;
}
.reading a:hover { text-decoration: underline; }

/* ───────────── Footer slot + toast ───────────── */
.footer-tagline { font-family: var(--display); font-size: 30px; line-height: 1.15; color: var(--ink); margin-bottom: 14px; }
.footer-share-btn {
  min-height: 48px; padding: 0 30px; margin-bottom: 18px;
  background: var(--accent); border: 0; border-radius: var(--radius-sm);
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.footer-share-btn:hover { background: var(--accent-text); }
.footer-fine { font-size: 14px; color: var(--muted); line-height: 1.7; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 500;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .check {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--green);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

/* ───────────── Narrow screens ───────────── */
@media (max-width: 640px) {
  .hero { padding: 12px 20px 24px; }
  .tool { padding: 0 16px 56px; }
  .tool-inputs { padding: 20px; }
  .chapter > summary { padding: 16px 20px; }
  .chapter-body { padding: 0 20px 20px; }
  .chapter-title { font-size: 25px; }
  .share-bar { padding: 16px 20px; }
  .reading { padding: 20px 20px 8px; }
  .toast { left: 16px; right: 16px; }
}
