/*
 * Dreamy Tools — shared styles. Source: sites/dreamy-tools/core/tools.css (Dash repo).
 * Everything is scoped under .chqt / .chqt-* so nothing leaks into the theme.
 * ⚠️ Every input/select/button font-size stays ≥ 16px: below that, iPhone Safari
 * zooms the whole page when the field is focused (fenced by a test).
 */
.chqt, .chqt-hub, .chqt-content, .chqt-related {
  --chqt-ink: #2b2522;
  --chqt-muted: #6b625b;
  --chqt-line: #e8dccb;
  --chqt-paper: #fffdf9;
  --chqt-cream: #faf5ec;
  --chqt-accent: #b85042;
  --chqt-accent-ink: #ffffff;
  --chqt-gold: #d79d32;
  --chqt-sage: #a7beae;
  --chqt-radius: 16px;
  color-scheme: light;
  font-family: inherit;
  color: var(--chqt-ink);
  box-sizing: border-box;
}
.chqt *, .chqt *::before, .chqt *::after,
.chqt-hub *, .chqt-content *, .chqt-related * { box-sizing: border-box; }

/* `hidden` must win over every display rule below (.chqt-field is display:flex) */
.chqt [hidden] { display: none !important; }
.chqt-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── the tool card ─────────────────────────────────────────────────────── */
.chqt {
  background: var(--chqt-paper);
  border: 1px solid var(--chqt-line);
  border-radius: var(--chqt-radius);
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.07);
  padding: 20px;
  margin: 0 auto 2.5rem;
  max-width: 1040px;
  font-size: 16px;
  line-height: 1.5;
}
.chqt-top {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.chqt-lede { margin: 0; color: var(--chqt-muted); font-size: 15px; flex: 1 1 260px; }
.chqt-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) {
  .chqt { padding: 28px; }
  .chqt-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; }
}
.chqt-grid > * { min-width: 0; }

/* ── form ──────────────────────────────────────────────────────────────── */
.chqt-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.chqt-field { display: flex; flex-direction: column; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.chqt-field > label, .chqt-field > legend, .chqt-label {
  font-weight: 600; font-size: 15px; color: var(--chqt-ink); padding: 0;
}
.chqt-hint { font-size: 13.5px; color: var(--chqt-muted); margin: 0; }
.chqt-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chqt-input {
  position: relative; display: flex; align-items: center;
  border: 1.5px solid var(--chqt-line); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.chqt-input:focus-within { border-color: var(--chqt-accent); box-shadow: 0 0 0 3px rgba(184, 80, 66, .15); }
.chqt-input input {
  flex: 1 1 auto; min-width: 0; width: 100%;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 17px; color: var(--chqt-ink);
  padding: 12px 12px; min-height: 48px;
  -webkit-appearance: none; appearance: none; border-radius: 12px;
}
.chqt-input .chqt-unit {
  padding: 0 12px 0 0; color: var(--chqt-muted); font-size: 15px; white-space: nowrap; pointer-events: none;
}
.chqt-input--bad { border-color: #c0392b; }
.chqt select {
  font: inherit; font-size: 17px; min-height: 48px; width: 100%;
  border: 1.5px solid var(--chqt-line); border-radius: 12px; background: #fff; color: var(--chqt-ink);
  padding: 10px 12px;
}

/* segmented choices (radio buttons that look like pills) */
.chqt-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.chqt-seg button, .chqt-units button {
  font: inherit; font-size: 16px; min-height: 44px; cursor: pointer;
  border: 1.5px solid var(--chqt-line); background: #fff; color: var(--chqt-ink);
  border-radius: 999px; padding: 8px 14px; line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}
.chqt-seg button[aria-pressed="true"], .chqt-units button[aria-pressed="true"] {
  background: var(--chqt-ink); border-color: var(--chqt-ink); color: #fff;
}
.chqt-seg button:focus-visible, .chqt-units button:focus-visible, .chqt-btn:focus-visible {
  outline: 3px solid rgba(184, 80, 66, .45); outline-offset: 2px;
}
.chqt-units { display: inline-flex; gap: 6px; }
.chqt-units button { padding: 6px 12px; }

/* ── result ────────────────────────────────────────────────────────────── */
.chqt-result {
  background: var(--chqt-cream); border-radius: 14px; padding: 18px;
  min-height: 420px; /* reserved: the answer arriving must not shift the page */
  display: flex; flex-direction: column; gap: 12px;
}
.chqt-kicker { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--chqt-muted); margin: 0; font-weight: 600; }
.chqt-answer {
  font-size: clamp(30px, 7vw, 44px); line-height: 1.05; font-weight: 700; margin: 0;
  color: var(--chqt-ink); font-variant-numeric: tabular-nums;
}
.chqt-answer small { display: block; font-size: 15px; font-weight: 500; color: var(--chqt-muted); margin-top: 6px; letter-spacing: 0; }
.chqt-note { margin: 0; font-size: 15px; }
.chqt-warn { margin: 0; font-size: 14.5px; background: #fff4e5; border-left: 4px solid var(--chqt-gold); padding: 8px 10px; border-radius: 6px; }
.chqt-list { margin: 0; padding-left: 1.1em; font-size: 15px; }
.chqt-list li { margin: 2px 0; }
.chqt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 0; }
.chqt-stats div { background: #fff; border-radius: 10px; padding: 10px 12px; border: 1px solid var(--chqt-line); }
.chqt-stats dt { font-size: 12.5px; color: var(--chqt-muted); margin: 0; }
.chqt-stats dd { margin: 2px 0 0; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.chqt-diagram { background: #fff; border-radius: 10px; border: 1px solid var(--chqt-line); padding: 8px; }
.chqt-diagram svg { display: block; width: 100%; height: auto; max-height: 320px; }
.chqt-diagram figcaption { font-size: 12.5px; color: var(--chqt-muted); text-align: center; margin-top: 4px; }
.chqt-alts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chqt-alts li { background: #fff; border: 1px solid var(--chqt-line); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chqt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.chqt-btn {
  font: inherit; font-size: 16px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 9px 16px; border: 1.5px solid var(--chqt-ink);
  background: #fff; color: var(--chqt-ink);
}
.chqt-btn--primary { background: var(--chqt-accent); border-color: var(--chqt-accent); color: var(--chqt-accent-ink); }
.chqt-empty { color: var(--chqt-muted); font-size: 15px; margin: auto 0; text-align: center; }

/* ── toast ─────────────────────────────────────────────────────────────── */
.chqt-toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--chqt-ink, #2b2522); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 15px; z-index: 2147483000; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .4s;
}
.chqt-toast--out { opacity: 0; }

/* ── page copy under the tool ──────────────────────────────────────────── */
.chqt-content { max-width: 760px; margin: 0 auto; font-size: 18px; line-height: 1.7; }
.chqt-content h2 { font-size: clamp(24px, 4vw, 30px); line-height: 1.25; margin: 2.2em 0 .6em; }
.chqt-content h3 { font-size: 20px; margin: 1.6em 0 .4em; }
.chqt-content .chqt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1em 0 1.4em; border: 1px solid var(--chqt-line); border-radius: 12px; }
.chqt-content table { border-collapse: collapse; width: 100%; font-size: 16px; min-width: 460px; background: #fff; }
.chqt-content th, .chqt-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--chqt-line); vertical-align: top; }
.chqt-content thead th { background: var(--chqt-cream); font-weight: 700; }
.chqt-content tr:last-child td { border-bottom: 0; }
.chqt-content .chqt-quick {
  background: var(--chqt-cream); border-left: 5px solid var(--chqt-accent); border-radius: 10px;
  padding: 14px 18px; margin: 0 0 1.4em;
}
.chqt-faq details { border-bottom: 1px solid var(--chqt-line); padding: 12px 0; }
.chqt-faq summary { cursor: pointer; font-weight: 700; font-size: 18px; list-style-position: outside; }
.chqt-faq details > div { margin-top: 8px; }
.chqt-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--chqt-ink); color: #fff; border-radius: 14px; padding: 18px 20px; margin: 2em 0;
}
.chqt-cta p { margin: 0; font-size: 17px; flex: 1 1 280px; }
.chqt-cta a { color: #fff; }
.chqt-cta .chqt-btn { background: var(--chqt-gold); border-color: var(--chqt-gold); color: #1e1a1a; }

/* ── related tools + hub cards ─────────────────────────────────────────── */
.chqt-related { max-width: 1040px; margin: 2.5rem auto; }
.chqt-related h2, .chqt-hub h2 { font-size: 24px; margin: 0 0 .3em; }
.chqt-hub { max-width: 1040px; margin: 0 auto 2rem; }
.chqt-hub section { margin: 0 0 2.2rem; scroll-margin-top: 90px; }
.chqt-hub .chqt-hub-blurb { color: var(--chqt-muted); margin: 0 0 1em; }
.chqt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.chqt-card a {
  display: flex; gap: 12px; height: 100%; text-decoration: none; color: var(--chqt-ink);
  background: var(--chqt-paper); border: 1px solid var(--chqt-line); border-radius: 14px; padding: 16px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.chqt-card a:hover, .chqt-card a:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(60,40,20,.09); border-color: var(--chqt-gold); }
.chqt-card-icon {
  flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--chqt-cream);
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--chqt-accent);
}
.chqt-card strong { display: block; font-size: 17px; line-height: 1.3; }
.chqt-card span.chqt-card-text { display: block; font-size: 14.5px; color: var(--chqt-muted); margin-top: 3px; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .chqt-card a, .chqt-toast, .chqt-input { transition: none; }
}
