/* WalkiTalki design tokens and base styles, shared by the site and the app. */
:root {
  color-scheme: dark;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #090b14;
  --bg-2: #0e1120;
  --surface: #141829;
  --surface-2: #1b2036;
  --surface-3: #242a44;
  --border: #2a3150;
  --border-strong: #3a4369;
  --text: #f3f5ff;
  --text-2: #b9c0dd;
  --text-3: #8890b3;

  --accent: #8b6cff;
  --accent-2: #22d3ee;
  --accent-ink: #ffffff;
  --accent-soft: rgba(139, 108, 255, 0.16);
  --grad: linear-gradient(135deg, #8b6cff 0%, #5b8cff 50%, #22d3ee 100%);

  --tx: #ff4d6a;          /* transmitting */
  --tx-soft: rgba(255, 77, 106, 0.18);
  --rx: #1fe3b0;          /* receiving */
  --rx-soft: rgba(31, 227, 176, 0.16);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, 0.14);
  --danger: #ff5c6c;
  --ok: #33d17a;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 24px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-l: 0 24px 60px rgba(0, 0, 0, 0.5);
  --focus: 0 0 0 3px rgba(139, 108, 255, 0.65);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fb;
  --bg-2: #eceef7;
  --surface: #ffffff;
  --surface-2: #f2f3fa;
  --surface-3: #e6e8f3;
  --border: #dde0ee;
  --border-strong: #c3c8de;
  --text: #0d1024;
  --text-2: #3c4263;
  --text-3: #636a8c;
  --accent: #6a4cf5;
  --accent-soft: rgba(106, 76, 245, 0.12);
  --tx: #e5294a;
  --tx-soft: rgba(229, 41, 74, 0.12);
  --rx: #079e78;
  --rx-soft: rgba(7, 158, 120, 0.12);
  --warn: #b26b00;
  --warn-soft: rgba(178, 107, 0, 0.12);
  --danger: #d42a3c;
  --shadow: 0 8px 24px rgba(20, 24, 60, 0.1), 0 1px 3px rgba(20, 24, 60, 0.08);
  --shadow-l: 0 24px 60px rgba(20, 24, 60, 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    color-scheme: light;
    --bg: #f5f6fb;
    --bg-2: #eceef7;
    --surface: #ffffff;
    --surface-2: #f2f3fa;
    --surface-3: #e6e8f3;
    --border: #dde0ee;
    --border-strong: #c3c8de;
    --text: #0d1024;
    --text-2: #3c4263;
    --text-3: #636a8c;
    --accent: #6a4cf5;
    --accent-soft: rgba(106, 76, 245, 0.12);
    --tx: #e5294a;
    --tx-soft: rgba(229, 41, 74, 0.12);
    --rx: #079e78;
    --rx-soft: rgba(7, 158, 120, 0.12);
    --warn: #b26b00;
    --warn-soft: rgba(178, 107, 0, 0.12);
    --danger: #d42a3c;
    --shadow: 0 8px 24px rgba(20, 24, 60, 0.1), 0 1px 3px rgba(20, 24, 60, 0.08);
    --shadow-l: 0 24px 60px rgba(20, 24, 60, 0.18);
  }
}

/* High contrast: stronger borders and text, no translucent tints. */
:root[data-contrast="high"] {
  --text-2: var(--text);
  --text-3: var(--text);
  --border: var(--text-3);
  --border-strong: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::selection { background: var(--accent-soft); }

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

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: 16px; cursor: pointer; text-decoration: none !important;
  transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(91, 108, 255, 0.35); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(91, 108, 255, 0.5); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer; flex: none;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---- form fields ---- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  background: var(--bg-2); border: 1.5px solid var(--border); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s; font-size: 16px;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.hint { font-size: 14px; color: var(--text-3); }
.error-text { color: var(--danger); font-size: 14px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important;
}
