/*
 * Фото-аудит для анкеты.
 *
 * Design rules (docs/dating-audit-v2/14-design-direction.md):
 *  — one spacing scale, no decoration that carries no information;
 *  — the photograph is the largest element on the result screen;
 *  — band state is never colour-only;
 *  — one 180ms overlay fade, nothing else, and nothing under reduced-motion.
 */

:root {
  --bg: #f4f2ee;
  --paper: #fffdfa;
  --ink: #16130f;
  --muted: #5b564e;
  --line: #dcd6cb;
  --line-soft: #e8e3da;
  --cta: var(--bag-accent, #1a3a32);
  --cta-hover: var(--bag-accent-hi, #12291f);

  /* Band semantics. Always paired with a text label. */
  --ok: #1f6b40;
  --warn: #8a5a12;
  --bad: #9c2f24;

  --font-ui: "Graphik", system-ui, -apple-system, sans-serif;
  --font-body: "Graphik", system-ui, -apple-system, sans-serif;
  --measure: 40rem;
  --rail: 1120px;
  --header-h: 60px;
  --admin-bar-h: 0px;

  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
button, input { font: inherit; }
a { color: inherit; }

.rail {
  width: 100%;
  max-width: var(--rail);
  margin-inline: auto;
  padding-inline: clamp(1.125rem, 4vw, 2.5rem);
}

.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;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s3) var(--s4);
  text-decoration: none;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid #1b4fd8;
  outline-offset: 3px;
}

/* ------------------------------------------------------------- chrome */

.site-header {
  position: sticky;
  top: var(--admin-bar-h);
  z-index: 20;
  background: var(--bg);
  min-height: var(--header-h);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: var(--header-h);
}
.brand {
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav {
  display: flex;
  gap: var(--s4);
  font-size: 0.9375rem;
}
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--s5);
  font-size: 0.9375rem;
  color: var(--muted);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: rgba(22, 19, 15, 0.06); }
.btn-primary {
  background: var(--cta);
  border-color: var(--cta);
  color: var(--paper);
}
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }

.link-btn {
  min-height: 44px;
  padding: 0 var(--s2);
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

.kicker {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.audit-note {
  font-size: 0.875rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- hero */

.audit { padding-block: var(--s6) var(--s7); }

.audit-intro { max-width: var(--measure); }
.audit-intro h1 {
  margin-top: var(--s2);
  font-family: var(--font-ui);
  font-size: clamp(1.75rem, 5.2vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.audit-intro .lead {
  margin-top: var(--s3);
  font-size: 1.0625rem;
  color: var(--muted);
}

/* Privacy claim sits above the upload control, not in a footer. */
.audit-privacy {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s4);
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.audit-privacy-mark {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--ok);
}

/* ---------------------------------------------------------- upload zone */

.audit-zone {
  margin-top: var(--s5);
  padding: var(--s7) var(--s4);
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: var(--paper);
  text-align: center;
}
.audit-zone.is-over { border-color: var(--ink); background: #fff; }
.audit-zone-title {
  font-family: var(--font-ui);
  font-size: 1.125rem;
  font-weight: 600;
  max-width: 26rem;
  margin-inline: auto;
}
.audit-zone .btn { margin-top: var(--s4); }
.audit-zone-drop {
  margin-top: var(--s3);
  font-size: 0.9375rem;
  color: var(--muted);
}
.audit-zone .audit-note { margin-top: var(--s4); }

/* ------------------------------------------------------------ analysing */

.audit-busy {
  margin-top: var(--s5);
  padding: var(--s7) var(--s4);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  text-align: center;
}
.audit-busy-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  animation: pulse 1.1s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.audit-busy-text {
  margin-top: var(--s3);
  font-family: var(--font-ui);
  font-weight: 600;
}
.audit-progress {
  max-width: 18rem;
  height: 3px;
  margin: var(--s4) auto 0;
  background: var(--line);
}
.audit-progress > span {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width 200ms var(--ease);
}

/* --------------------------------------------------------------- result */

.audit-result { margin-top: var(--s5); }

.audit-verdict {
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
}
.audit-verdict-band {
  font-family: var(--font-ui);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
/* The result heading takes tabindex="-1" only so focus can move there and a
   screen reader announces the verdict. It is not an interactive control, so the
   ring Chromium draws on that programmatic focus points at nothing. */
[data-result-head]:focus { outline: none; }
.audit-verdict[data-band="excellent"] .audit-verdict-band { color: var(--ok); }
.audit-verdict[data-band="good"] .audit-verdict-band { color: var(--ink); }
.audit-verdict[data-band="needsWork"] .audit-verdict-band { color: var(--warn); }
.audit-verdict[data-band="replace"] .audit-verdict-band { color: var(--bad); }

.audit-verdict-score {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  margin-top: var(--s1);
  font-family: var(--font-ui);
}
.audit-verdict-score > span:first-child {
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}
.audit-verdict-max { font-size: 0.9375rem; color: var(--muted); }
.audit-verdict-note,
.audit-state-body,
.audit-state-action {
  max-width: var(--measure);
  margin-top: var(--s2);
  font-size: 0.9375rem;
  color: var(--muted);
}
.audit-state-action { color: var(--ink); }

/* The photograph: largest element on the screen. */
.audit-photo { margin-top: var(--s5); }
.audit-photo-frame {
  position: relative;
  display: inline-block;
  max-width: min(100%, 620px);
  line-height: 0;
  background: var(--paper);
  /* Clips the dim spread below to the photograph. */
  overflow: hidden;
  border-radius: 2px;
}

/* Detected face: 2px stroke with a darker outer edge so it survives both a
   white shirt and a black background, plus corner ticks for legibility. */
.audit-face {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  pointer-events: none;
  animation: face-in 180ms var(--ease) both;
}

/*
 * Dim everything outside the detected face by spreading a shadow well past the
 * frame, which the clip above cuts back to the photograph. 18% normally; 8% on
 * a dark frame, where subtracting light destroys detail instead of adding
 * contrast, and the border carries the emphasis instead. Never above 18%.
 */
.audit-photo.is-mask .audit-face {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 0 9999px rgba(0, 0, 0, 0.18);
}
.audit-photo.is-mask-dark .audit-face {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 0 9999px rgba(0, 0, 0, 0.08);
}
@keyframes face-in { from { opacity: 0; } to { opacity: 1; } }
.audit-face .c {
  position: absolute;
  width: 12px; height: 12px;
  border-color: #fff;
  border-style: solid;
  border-width: 0;
}
.audit-face .tl { top: -2px; left: -2px; border-top-width: 4px; border-left-width: 4px; }
.audit-face .tr { top: -2px; right: -2px; border-top-width: 4px; border-right-width: 4px; }
.audit-face .bl { bottom: -2px; left: -2px; border-bottom-width: 4px; border-left-width: 4px; }
.audit-face .br { bottom: -2px; right: -2px; border-bottom-width: 4px; border-right-width: 4px; }

.audit-photo-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-top: var(--s2);
  font-size: 0.875rem;
  color: var(--muted);
}

/* Top problems: below the photograph, so they read as evidence. */
.audit-problems {
  max-width: var(--measure);
  margin-top: var(--s5);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 2px;
  background: var(--paper);
}
.audit-problems.is-clean {
  border-left-color: var(--ok);
  color: var(--muted);
  font-size: 0.9375rem;
}
.audit-problems h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.audit-problems ol {
  margin-top: var(--s3);
  list-style: none;
  counter-reset: p;
}
.audit-problems li {
  counter-increment: p;
  padding-left: 1.75rem;
  position: relative;
}
.audit-problems li + li { margin-top: var(--s3); }
.audit-problems li::before {
  content: counter(p);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.25rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--muted);
}
.audit-problem-name {
  display: block;
  font-family: var(--font-ui);
  font-weight: 600;
}
.audit-problem-fix {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Full metric list: a data display, not nine decorated cards. */
.audit-metrics { margin-top: var(--s6); max-width: var(--measure); }
.audit-metrics h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.audit-metrics > .audit-note { margin-top: var(--s2); }
.metric-list {
  margin-top: var(--s3);
  list-style: none;
  border-top: 1px solid var(--line);
}
.metric {
  padding-block: var(--s3);
  border-bottom: 1px solid var(--line-soft);
}
.metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
}
.metric-label { font-family: var(--font-ui); font-weight: 600; }
.metric-score {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  flex: 0 0 auto;
  font-family: var(--font-ui);
}
.metric-score b { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.metric-state {
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric[data-state="pass"] .metric-state { color: var(--ok); }
.metric[data-state="warn"] .metric-state { color: var(--warn); }
.metric[data-state="fail"] .metric-state { color: var(--bad); }
.metric-value,
.metric-reading,
.metric-action {
  margin-top: var(--s1);
  font-size: 0.9375rem;
}
.metric-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-reading { color: var(--ink); }
.metric-action { color: var(--muted); }

.audit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s6);
}

.audit-error {
  margin-top: var(--s5);
  padding: var(--s5) var(--s4);
  border: 1px solid var(--bad);
  border-radius: 3px;
  background: var(--paper);
  max-width: var(--measure);
}
.audit-error-title {
  font-family: var(--font-ui);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--bad);
}
.audit-error p + p, .audit-error .btn { margin-top: var(--s3); }

/* ---------------------------------------------------------------- multi */

.audit-verdict.is-multi, .audit-verdict.is-state { border-bottom: 1px solid var(--line); }

.audit-best {
  max-width: var(--measure);
  margin-top: var(--s5);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 2px;
  background: var(--paper);
}
.audit-best-kicker {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.audit-best-name {
  margin-top: var(--s1);
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 600;
}

.audit-rank-title {
  margin-top: var(--s6);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.audit-rank {
  margin-top: var(--s3);
  list-style: none;
  max-width: var(--measure);
  border-top: 1px solid var(--line);
}
.rank { border-bottom: 1px solid var(--line-soft); }
.rank-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding-block: var(--s3);
}
.rank-place {
  flex: 0 0 1.25rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rank-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 2px;
}
.rank-meta {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
  min-width: 0;
}
.rank-name { font-family: var(--font-ui); font-weight: 600; }
.rank-score { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.rank-flag, .rank-tie { font-size: 0.875rem; color: var(--muted); }
.rank-flag { color: var(--bad); }
.rank-note {
  padding: 0 0 var(--s3) calc(1.25rem + var(--s3));
  font-size: 0.875rem;
  color: var(--muted);
}
.rank-details { display: none; padding-bottom: var(--s4); }
.rank.is-open .rank-details { display: block; }
.rank-details .audit-metrics { margin-top: 0; }

/* ---------------------------------------------------- paid human review */

.human {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-block: var(--s7);
}
.human-inner { max-width: 60rem; }
.human h2 {
  margin-top: var(--s2);
  font-family: var(--font-ui);
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.human-lead {
  max-width: var(--measure);
  margin-top: var(--s3);
  color: var(--muted);
}
.human-grid {
  display: grid;
  gap: var(--s4);
  margin-top: var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}
.human-card {
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.human-card h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.human-card ul {
  margin-top: var(--s3);
  padding-left: 1.1rem;
  font-size: 0.9375rem;
}
.human-card li + li { margin-top: var(--s2); }

.human-privacy {
  max-width: var(--measure);
  margin-top: var(--s5);
}
.human-privacy h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
}
.human-privacy p {
  margin-top: var(--s2);
  font-size: 0.9375rem;
  color: var(--muted);
}
.human-privacy ul {
  margin-top: var(--s3);
  padding-left: 1.1rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.human-privacy li + li { margin-top: var(--s1); }

.human-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.human-price {
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
}
.human-price b { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.human-price span { font-size: 0.9375rem; color: var(--muted); }
.human-lead-sub {
  max-width: var(--measure);
  margin-top: var(--s2);
  font-size: 1rem;
  color: var(--muted);
}
.human-author {
  display: flex;
  gap: var(--s3);
  align-items: center;
  max-width: var(--measure);
  margin-top: var(--s4);
}
.human-author img {
  width: 80px;
  height: 120px;
  object-fit: cover;
  object-position: 50% 8%;
  border-radius: 2px;
  flex-shrink: 0;
}
.human-author-name {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.human-author-cred {
  margin: 0.15em 0 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--muted);
}
.human-author-link {
  margin: 0.15em 0 0;
}
.human-author-link a {
  display: inline-block;
  min-height: 44px;
  padding-top: 0.4em;
  font-size: 0.9375rem;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 480px) {
  .human-author img {
    width: 64px;
    height: 96px;
  }
}
.human-more {
  max-width: var(--measure);
  margin-top: var(--s5);
  border-top: 1px solid var(--line-soft);
}
.human-more summary {
  padding-block: var(--s3);
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.audit-human-link {
  margin-top: var(--s4);
  font-size: 0.9375rem;
}
.audit-human-link a { text-decoration: underline; text-underline-offset: 2px; }
.metric.is-info .metric-state { color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------- support */

.support { padding-block: var(--s7); }
.support-inner { max-width: var(--measure); }
.support h2 {
  margin-top: var(--s6);
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.support h2:first-child { margin-top: 0; }
.support p { margin-top: var(--s3); }
.support a { text-decoration: underline; text-underline-offset: 2px; }

.support-metrics {
  margin-top: var(--s3);
  padding-left: 1.4rem;
  font-size: 0.9375rem;
}
.support-metrics li + li { margin-top: var(--s2); }

.faq { margin-top: var(--s4); border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line-soft); }
.faq summary {
  padding-block: var(--s3);
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.faq details p {
  margin-top: 0;
  padding-bottom: var(--s4);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* -------------------------------------------------------------- mobile */

@media (max-width: 40rem) {
  .audit { padding-block: var(--s5) var(--s6); }
  .audit-zone { padding: var(--s6) var(--s4); }
  .audit-verdict-score > span:first-child { font-size: 2rem; }
  .audit-actions .btn { width: 100%; }
  .rank-thumb { width: 44px; height: 44px; }

  /* Collapse the metric list to title + score + state; detail on expand. */
  .metric-value, .metric-reading { font-size: 0.9375rem; }
  .metric-action { font-size: 0.9375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .audit-face { animation: none; }
  .audit-busy-dot { animation: none; opacity: 0.7; }
  .audit-progress > span { transition: none; }
}

@media (prefers-contrast: more) {
  .audit-photo.is-mask .audit-face,
  .audit-photo.is-mask-dark .audit-face {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 0 9999px rgba(0, 0, 0, 0.24);
  }
}
