/* Habitat: the free-check panel (built by js/check.js).
   Reuses the page tokens from css/site.css: --bg, --bg-2, --text, --muted, --accent, --line, --radius, --font.
   The accent colour is used only for "Serious" and the main offer button. */

html.check-open { overflow: hidden; }

.check-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- the panel: full screen, over the page ---------- */

.check {
  --check-pad: clamp(16px, 2.9vw, 48px);
  --check-ink: var(--ink, rgb(12 12 12));
  --check-strong: var(--line-strong, rgb(255 255 255 / 0.55));
  --check-ease: var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg, rgb(12 12 12));
  color: var(--text, rgb(255 255 255));
  font-family: var(--font, system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-font-smoothing: antialiased;
}
.check[open] {
  display: flex;
  flex-direction: column;
}
.check::backdrop { background: var(--bg, rgb(12 12 12)); }

/* the same faint grain as the page */
.check::before {
  content: "";
  position: fixed;
  inset: -8%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.075;
}

.check :focus-visible {
  outline: 1.5px solid var(--text, #fff);
  outline-offset: 3px;
  border-radius: 1px;
}

/* resets with zero weight, so the component classes below always win */
:where(.check) :where(p, h2, h3, ol, ul) { margin: 0; }
:where(.check) :where(ol, ul) { padding: 0; list-style: none; }
:where(.check) :where(button, input) { font: inherit; color: inherit; letter-spacing: inherit; }
:where(.check) strong { font-weight: 600; }

/* ---------- top bar: back, "Question 3 of 6", close ---------- */

.check-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 var(--check-pad);
  background: var(--bg, rgb(12 12 12));
}

.check-bar__btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--muted, rgb(165 167 170));
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s var(--check-ease);
}
.check-bar__btn:hover { color: var(--text, #fff); }
.check-bar__btn[hidden] { display: none; }
.check-bar__btn--close { grid-column: 3; justify-self: end; }

.check-bar__count {
  grid-column: 2;
  color: var(--muted, rgb(165 167 170));
  font-size: var(--fs-label, 10.5px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* thin progress line under the bar */
.check-progress {
  position: sticky;
  top: 64px;
  z-index: 2;
  height: 1px;
  margin: 0 var(--check-pad);
  background: var(--line, rgb(255 255 255 / 0.24));
}
.check-progress > span {
  position: absolute;
  inset: 0;
  background: var(--text, #fff);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--check-ease);
}
.check-progress[data-n="1"] > span { transform: scaleX(0.1667); }
.check-progress[data-n="2"] > span { transform: scaleX(0.3333); }
.check-progress[data-n="3"] > span { transform: scaleX(0.5); }
.check-progress[data-n="4"] > span { transform: scaleX(0.6667); }
.check-progress[data-n="5"] > span { transform: scaleX(0.8333); }
.check-progress[data-n="6"] > span { transform: scaleX(1); }
.check-progress[data-n="0"] { visibility: hidden; }

/* ---------- screen body ---------- */

.check-body {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 112px) var(--check-pad) 48px;
  animation: check-in 0.35s var(--check-ease) both;
}
@keyframes check-in {
  from { opacity: 0; transform: translateY(8px); }
}

.check-title {
  max-width: 20ch;
  margin-bottom: clamp(28px, 4vh, 44px);
  font-size: clamp(32px, 4.2vw, 56px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.check-title:focus { outline: none; }

.check-text {
  max-width: 56ch;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.5;
}
.check-text + .check-text { margin-top: 0.6em; }
.check-text--muted,
.check-text + .check-text { color: var(--muted, rgb(165 167 170)); }
.check-text--muted { margin-top: 24px; font-size: 15px; }

/* ---------- answers: hairline rows ---------- */

.check-options { border-top: 1px solid var(--line, rgb(255 255 255 / 0.24)); }

.check-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 60px;
  padding: 14px 4px;
  border: 0;
  border-bottom: 1px solid var(--line, rgb(255 255 255 / 0.24));
  background: none;
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s var(--check-ease), padding 0.25s var(--check-ease);
}
.check-option__arrow {
  flex: 0 0 auto;
  color: var(--muted, rgb(165 167 170));
  transition: transform 0.25s var(--check-ease), color 0.2s var(--check-ease);
}
.check-option.is-selected { background: var(--bg-2, rgb(25 25 25)); padding-left: 14px; }
.check-option.is-selected .check-option__arrow { color: var(--text, #fff); }
@media (hover: hover) {
  .check-option:hover { background: var(--bg-2, rgb(25 25 25)); padding-left: 14px; }
  .check-option:hover .check-option__arrow { color: var(--text, #fff); transform: translateX(4px); }
}

/* ---------- email ---------- */

.check-email__row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--check-strong);
  border-radius: var(--radius, 2px);
  transition: border-color 0.25s var(--check-ease);
}
.check-email__row:focus-within { border-color: var(--text, #fff); }
/* the row's border shows focus, as on the page's link box */
.check .check-email__input:focus-visible { outline: none; }

.check-email__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 64px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  font-size: clamp(18px, 1.4vw, 22px);
  font-weight: 500;
  letter-spacing: -0.02em;
  caret-color: var(--text, #fff);
  outline: none;
}
.check-email__input::placeholder { color: var(--muted, rgb(165 167 170)); opacity: 1; }
.check-email__row .check-btn { margin: 6px; min-height: 0; }

.check-note {
  margin-top: 14px;
  color: var(--muted, rgb(165 167 170));
  font-size: 14px;
}
.check-error {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
}
.check-error:empty { display: none; }

@media (max-width: 599px) {
  .check-email__row { flex-direction: column; }
  .check-email__row .check-btn { margin: 0 6px 6px; min-height: 52px; }
}

/* ---------- buttons ---------- */

.check-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 1.5em;
  border: 1px solid transparent;
  border-radius: var(--radius, 2px);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s var(--check-ease), border-color 0.2s var(--check-ease), color 0.2s var(--check-ease);
}
.check-btn--accent { background: var(--accent); color: var(--check-ink); }
.check-btn--accent:hover { background: color-mix(in oklab, var(--accent) 86%, white); }
.check-btn--accent:focus-visible { outline-color: var(--accent); }
.check-btn--light { background: var(--text, #fff); color: var(--check-ink); }
.check-btn--light:hover { background: color-mix(in oklab, var(--text, #fff) 84%, black); }
.check-btn--ghost { border-color: var(--check-strong); background: transparent; color: var(--text, #fff); }
.check-btn--ghost:hover { border-color: var(--text, #fff); }

.check-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
@media (max-width: 599px) {
  .check-actions { flex-direction: column; }
  .check-actions .check-btn { width: 100%; }
}

/* ---------- result: findings ---------- */

.check-findings { border-top: 1px solid var(--line, rgb(255 255 255 / 0.24)); }

.check-finding {
  padding: 22px 0;
  border-bottom: 1px solid var(--line, rgb(255 255 255 / 0.24));
}
.check-finding--hidden {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
}

.check-finding__label {
  display: flex;
  align-items: center;
  gap: 0.7em;
  flex: 0 0 auto;
  font-size: var(--fs-label, 10.5px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.check-finding__num,
.check-finding__dot { color: var(--muted, rgb(165 167 170)); }
.check-sev--serious { color: var(--accent); }
.check-sev--medium { color: var(--text, #fff); }
.check-sev--low { color: var(--muted, rgb(165 167 170)); }

.check-finding__title {
  max-width: 34ch;
  margin: 14px 0 12px;
  font-size: clamp(21px, 1.9vw, 28px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
.check-finding__line {
  max-width: 62ch;
  color: var(--muted, rgb(165 167 170));
  font-size: 16px;
}
.check-finding__line + .check-finding__line { margin-top: 6px; }
.check-finding__key { color: var(--text, #fff); font-weight: 500; }

/* blurred rows: plain shapes, no hidden text behind them */
.check-blur {
  display: flex;
  flex: 1 1 auto;
  gap: 10px;
  min-width: 0;
  filter: blur(5px);
}
.check-blur > span {
  height: 14px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.28);
}
.check-blur > span:first-child { flex: 0 0 22%; }
.check-blur > span:last-child { flex: 0 1 56%; }
.check-finding--hidden:nth-child(odd) .check-blur > span:last-child { flex-basis: 44%; }

/* ---------- result: the suggested offer ---------- */

.check-suggest { margin-top: 40px; }
.check-suggest__line {
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.check-suggest .check-text { margin-top: 8px; color: var(--muted, rgb(165 167 170)); }

/* ---------- ticker: the 4 real check steps ---------- */

/* pinned to the bottom, so it stays in view under long answer lists */
.check-ticker {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 8px 32px;
  width: 100%;
  margin-top: auto;
  padding: 16px max(var(--check-pad), calc((100% - 820px) / 2 + var(--check-pad))) calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line, rgb(255 255 255 / 0.24));
  background: var(--bg, rgb(12 12 12));
  color: var(--muted, rgb(165 167 170));
  font-size: 13px;
  line-height: 1.35;
}
.check-ticker[hidden] { display: none; }
@media (min-width: 760px) {
  .check-ticker { grid-template-columns: 1fr 1fr; padding-top: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
/* phones: one line that ticks through the steps; screen readers still get all 4 */
@media (max-width: 759px) {
  .check-ticker__line:not(.is-current) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.check-ticker__line {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.3s var(--check-ease);
}
.check-ticker__line.is-done,
.check-ticker__line.is-active { color: var(--text, #fff); }

.check-ticker__mark {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line, rgb(255 255 255 / 0.24));
  border-radius: 50%;
}
.check-ticker__line.is-active .check-ticker__mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--text, #fff);
  animation: check-pulse 1.1s ease-in-out infinite alternate;
}
.check-ticker__line.is-done .check-ticker__mark {
  border-color: var(--text, #fff);
  background: var(--text, #fff);
}
.check-ticker__line.is-done .check-ticker__mark::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.5px;
  width: 4px;
  height: 7px;
  border: solid var(--check-ink);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
@keyframes check-pulse {
  from { opacity: 0.25; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- reduced motion: no movement ---------- */

@media (prefers-reduced-motion: reduce) {
  .check-body { animation: none; }
  .check-progress > span,
  .check-option,
  .check-option__arrow,
  .check-ticker__line { transition: none; }
  .check-ticker__line.is-active .check-ticker__mark::after { animation: none; opacity: 1; transform: none; }
  .check-option:hover .check-option__arrow { transform: none; }
}

@media (forced-colors: active) {
  .check-btn,
  .check-option { border: 1px solid ButtonText; }
  .check-blur { display: none; }
  .check::before { display: none; }
}
