/*
 * couple_fit landing — shared styles for every static page.
 *
 * Tokens and component rules are copied from the design prototype
 * (doc/design/Main.dc.html: the `.proto` / `.proto.dark` variables and the
 * `.card`, `.code`/`.cc`, `.btn`/`.bp`/`.bt`, `.appstore`, `.logo`, `.av.neu`,
 * `.dashline`, `.h1`, `.sub`, `.cap`, `.toast`, `.ph-box` rules). Values that
 * the prototype set inline on the web screen are folded into named classes
 * here (`.cc` 52/24, `.copy` padding, the 32 px header logo).
 *
 * One deliberate deviation, from doc/prototype-fixes.md (P2 "аватары на
 * веб-странице сливаются с фоном, 1,09:1"): `.av.neu` gets the same 1.5 px
 * `--line2` ring as the "+" bubble between the avatars, so the two empty
 * avatars read against the page in both themes.
 *
 * Light/dark follow the OS (prefers-color-scheme). No inline styles anywhere:
 * the CSP in infrastructure/docker/nginx/prod.conf does not allow them.
 */

:root {
  color-scheme: light dark;
  --bg: #FAF8F5;
  --card: #FFFFFF;
  --line: #EDE9E4;
  --line2: #D9D2CB;
  --tx: #1A1716;
  --tx2: #6E6762;
  --btn: #1A1716;
  --btnTx: #FFFFFF;
  --fill: #F2EEE9;
  --me: #FF6B5E;
  --pt: #6676FF;
  --toastBg: #1A1716;
  --toastTx: #F4F1EE;
  --toastOk: #4CD98A;
  --toastErr: #FF5C8A;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  /* Numbers: SF Pro Rounded on Apple devices, Nunito 700 (Google Fonts) elsewhere. */
  --rnd: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --col: 393px; /* the design's screen width; the page is one centred column of it */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --card: #1D1B1A;
    --line: #2A2726;
    --line2: #403B38;
    --tx: #F4F1EE;
    --tx2: #A39C96;
    --btn: #F4F1EE;
    --btnTx: #121110;
    --fill: #262322;
    --me: #FF8377;
    --pt: #8B97FF;
    --toastBg: #F4F1EE;
    --toastTx: #1A1716;
    --toastOk: #1B7F4E;
    --toastErr: #C4281C;
  }
}

/* ---------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p, h1, h2 { margin: 0; }

a { color: inherit; -webkit-tap-highlight-color: transparent; }

button {
  font: inherit;
  color: inherit;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:where(a, button):focus-visible {
  outline: 2.5px solid var(--tx);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

/* ---------------------------------------------------------------- layout */

.topbar { border-bottom: 1px solid var(--line); }

.topbar-in {
  max-width: var(--col);
  margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
}

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

/* A desktop window is not a phone: give the column some air above it. */
@media (min-width: 600px) and (min-height: 700px) {
  .page { padding-top: 56px; }
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.ctr { align-items: center; text-align: center; }
.g8 { gap: 8px; }
.g12 { gap: 12px; }
.g20 { gap: 20px; }

/* ---------------------------------------------------------------- type */

.h1 {
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.h3 { font-size: 17px; line-height: 22px; font-weight: 600; }
.body { font-size: 17px; line-height: 23px; }
.sub { font-size: 17px; line-height: 23px; color: var(--tx2); }
.cap { font-size: 13px; line-height: 18px; color: var(--tx2); }

.num {
  font-family: var(--rnd);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ---------------------------------------------------------------- icons */

.ic {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.s16 { width: 16px; height: 16px; }
.ic.s20 { width: 20px; height: 20px; }
.ic.s28 { width: 28px; height: 28px; }
.ic.bold { stroke-width: 2.6; }

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

.btn {
  height: 56px;
  width: 100%;
  border-radius: 18px;
  border: 0;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  transition: transform .12s, background .2s, opacity .2s;
  flex: none;
  position: relative;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }

.bp { background: var(--btn); color: var(--btnTx); }
.bp:active { opacity: .86; }

.bt { background: none; color: var(--tx); height: 44px; border-radius: 12px; }
.bt:active { background: var(--fill); }

.btn.sm { height: 44px; font-size: 15px; border-radius: 14px; }
.btn.auto { width: auto; }
.btn.copy { padding: 0 14px; }

@media (hover: hover) {
  .bp:hover { opacity: .92; }
  .bt:hover { background: var(--fill); }
  .appstore:hover { background: #1A1A1A; }
}

/* ---------------------------------------------------------------- cards */

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.pad { padding: 16px; }

/* Placeholder copy (legal pages), as on the prototype's in-app document screen. */
.ph-box {
  border: 1.5px dashed var(--line2);
  border-radius: 16px;
  padding: 16px;
  color: var(--tx2);
  font-size: 15px;
  line-height: 21px;
}

/* ---------------------------------------------------------------- code cells */

.code {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.cc {
  height: 52px;
  border-radius: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
}

.code-card { width: 100%; align-items: center; }

/* ---------------------------------------------------------------- avatars, logo */

.av {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.av64 { width: 64px; height: 64px; }
/* prototype: border 1px var(--line) — see the note at the top of this file */
.av.neu { background: var(--fill); border: 1.5px solid var(--line2); color: var(--tx2); }

.pair { display: flex; align-items: center; justify-content: center; }

.dashline {
  width: 48px;
  height: 0;
  border-top: 2px dashed var(--line2);
  position: relative;
  flex: none;
}
.dashline b {
  position: absolute;
  left: 50%;
  top: -12px;
  margin-left: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx2);
}

.logo {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.logo i { display: block; border-radius: 50%; }
.logo .lg-a { background: var(--me); opacity: .95; }
.logo .lg-b { background: var(--pt); mix-blend-mode: multiply; opacity: .9; }
@media (prefers-color-scheme: dark) {
  .logo .lg-b { mix-blend-mode: screen; }
}

.logo-32 { width: 32px; height: 32px; border-radius: 10px; }
.logo-32 i { width: 13px; height: 13px; }
.logo-32 .lg-a { margin-right: -4px; }

.logo-88 { width: 88px; height: 88px; border-radius: 26px; }
.logo-88 i { width: 34px; height: 34px; }
.logo-88 .lg-a { margin-right: -12px; }

/* ---------------------------------------------------------------- App Store badge */

.appstore {
  height: 52px;
  border-radius: 12px;
  background: #000;
  color: #fff;
  border: 1px solid #444;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 14px;
  text-align: left;
  text-decoration: none;
  flex: none;
}
.appstore small { display: block; font-size: 10px; line-height: 12px; }
.appstore b { display: block; font-size: 19px; line-height: 22px; font-weight: 600; }

/* ---------------------------------------------------------------- links (legal pages) */

.links { font-size: 13px; line-height: 18px; color: var(--tx2); }
.links a,
.link {
  color: var(--tx);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- long text (legal pages) */

/* /privacy and /terms: sections are h2.h2, sub-sections h3.h3, text p.body and
   ul.list, all direct children of .page, whose 12 px gap spaces them. Headings
   get a little more room above so the sections read as sections. */
.page > .h2 { margin-top: 20px; }
.page > h3.h3 { margin: 6px 0 0; }
.list { margin: 0; padding-left: 22px; }
.list > li + li { margin-top: 8px; }
.body a { text-underline-offset: 2px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- toast */

/* The live region stays in the DOM; the toast itself is inserted into it. */
.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  width: 100%;
  max-width: calc(var(--col) - 32px);
  background: var(--toastBg);
  color: var(--toastTx);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  animation: toastIn .35s cubic-bezier(.2, 1.3, .4, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.toast .t-ok { color: var(--toastOk); }
.toast .t-err { color: var(--toastErr); }

@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }

/* Off-screen textarea for the execCommand('copy') fallback (no inline styles under the CSP). */
.clip-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
