/* Anchor site — shared design system for every page.
   Tokens mirror the app (tailwind.config.js + lib/theme.ts in anchor-org/anchor).
   The *-ink colours are darker shades of the same hues for small text: the app's
   tag pairs (e.g. success on success-light) stay under WCAG AA 4.5:1. */

:root {
  color-scheme: light;
  --bg: #FAFAF8;
  --card: #FFFFFF;
  --ink: #332B23;
  --ink-muted: #665E55;
  --line: #E0DDD6;
  --line-strong: #CFCAC0;

  --accent: #D4900A;
  --accent-light: #FEF3E2;
  --accent-dark: #7A4F1A;
  --penalty: #C05A1A;
  --penalty-light: #FBE9E0;
  --penalty-ink: #A64A12;
  --success: #059669;
  --success-light: #E4F5EE;
  --success-ink: #047857;
  --friend: #6366F1;
  --friend-light: #E9E9FD;
  --friend-ink: #4F46E5;

  --dot: rgba(122, 79, 26, 0.16);
  --shadow-sm: 0 1px 2px rgba(51, 43, 35, 0.05);
  --shadow-md: 0 1px 2px rgba(51, 43, 35, 0.05), 0 12px 32px -14px rgba(51, 43, 35, 0.22);
  --shadow-lg: 0 2px 4px rgba(51, 43, 35, 0.04), 0 28px 60px -24px rgba(51, 43, 35, 0.32);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --gutter: clamp(16px, 4vw, 32px);
  --section: clamp(72px, 10vw, 128px);
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #151312;
    --card: #201D1A;
    --ink: #F2EDE6;
    --ink-muted: #B3AAA0;
    --line: #3A352E;
    --line-strong: #4A443B;
    --accent-light: #3D2E12;
    --accent-dark: #E8B84B;
    --penalty-light: #3A2013;
    --penalty-ink: #E58A52;
    --success-light: #123328;
    --success-ink: #34D399;
    --friend-light: #23234A;
    --friend-ink: #A5A8FA;
    --dot: rgba(232, 184, 75, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 28px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151312;
  --card: #201D1A;
  --ink: #F2EDE6;
  --ink-muted: #B3AAA0;
  --line: #3A352E;
  --line-strong: #4A443B;
  --accent-light: #3D2E12;
  --accent-dark: #E8B84B;
  --penalty-light: #3A2013;
  --penalty-ink: #E58A52;
  --success-light: #123328;
  --success-ink: #34D399;
  --friend-light: #23234A;
  --friend-ink: #A5A8FA;
  --dot: rgba(232, 184, 75, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 28px 60px -24px rgba(0, 0, 0, 0.7);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--ink); text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.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-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; }
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); }
.amt { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }

/* ---------- type ---------- */
.display {
  font-size: clamp(2.6rem, 6.4vw, 4.9rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.h2 {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.h3 { font-size: 1.25rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
.lede { font-size: clamp(1.08rem, 1.6vw, 1.25rem); line-height: 1.5; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }

/* A highlighter stroke, like a word marked in a diary. Text keeps full contrast. */
.marker {
  background-image: linear-gradient(transparent 60%, color-mix(in srgb, var(--accent) 42%, transparent) 60%, color-mix(in srgb, var(--accent) 42%, transparent) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-inline: 0.06em;
}
.marker.keep { white-space: nowrap; }

/* ---------- tags (app: components/Tag.tsx) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 13px; line-height: 1.3; font-weight: 600; white-space: nowrap;
  background: var(--line); color: var(--ink-muted);
}
/* Eyebrow tags carry whole phrases; they may wrap on narrow screens. */
.tag.wrap-ok { white-space: normal; max-width: 100%; }
.tag-accent { background: var(--accent-light); color: var(--accent-dark); }
.tag-success { background: var(--success-light); color: var(--success-ink); }
.tag-penalty { background: var(--penalty-light); color: var(--penalty-ink); }
.tag-friend { background: var(--friend-light); color: var(--friend-ink); }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.tag svg { flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 24px; border-radius: 999px;
  font: 600 17px/1.2 var(--font); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.btn svg { flex: none; }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.btn-sm { min-height: 40px; padding: 9px 16px; font-size: 15px; }

.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-dark); font-weight: 600; text-decoration: none;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--header-h); }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 21px/1 var(--font-display); letter-spacing: -0.3px;
  color: var(--accent-dark); text-decoration: none;
}
.brand svg { color: var(--accent); flex: none; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 500;
  color: var(--ink-muted); text-decoration: none; transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--line) 50%, transparent); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.back-link { font-size: 15px; font-weight: 500; color: var(--ink-muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* Language switch — the app's segmented pill tabs. */
.lang-toggle {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: color-mix(in srgb, var(--line) 65%, transparent);
}
.lang-toggle .lang-btn {
  position: relative; min-width: 44px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-align: center;
  color: var(--ink-muted); text-decoration: none; transition: color 0.15s ease, background-color 0.15s ease;
}
/* Extends the tap area to 44px tall without growing the pill. */
.lang-toggle .lang-btn::after { content: ""; position: absolute; inset: -6px 0; }
.lang-toggle .lang-btn:hover { color: var(--ink); }
.lang-toggle .lang-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

@media (max-width: 860px) {
  .site-nav { display: none; }
}
@media (max-width: 480px) {
  :root { --header-h: 56px; }
  .brand { font-size: 19px; }
  .back-link { display: none; }
}

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  padding: 56px 0 36px;
  font-size: 15px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
/* The app icon artwork (winking Anko), with the iOS icon corner radius. */
.footer-brand img { width: 52px; height: 52px; flex: none; border-radius: 22.5%; box-shadow: 0 0 0 1px rgba(51, 43, 35, 0.08), var(--shadow-sm); }
.footer-brand p { margin-top: 10px; color: var(--ink-muted); max-width: 260px; }
.footer-col h2 { font: 600 13px/1.3 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--ink); text-decoration: none; }
.footer-col a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 13px; }
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- document pages (privacy, terms, support) ---------- */
.doc-hero { padding: clamp(48px, 8vw, 96px) 0 clamp(28px, 4vw, 40px); }
.doc-hero .tag { margin-bottom: 20px; }
.doc-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.doc-hero .updated, .doc-hero .lede { margin-top: 16px; }
.doc-hero .updated { color: var(--ink-muted); font-size: 15px; }
.prose { max-width: 720px; margin: 0 auto; }
.doc-body { padding-bottom: clamp(64px, 9vw, 112px); }

.legal { font-size: 17px; line-height: 1.65; }
.legal h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; margin: 48px 0 14px; scroll-margin-top: calc(var(--header-h) + 16px); }
.legal h3 { font-size: 1.12rem; line-height: 1.3; font-weight: 700; margin: 30px 0 10px; }
.legal p { margin: 0 0 16px; }
.legal ul { margin: 0 0 16px; padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal li::marker { color: var(--accent); }
.legal strong { color: var(--ink); font-weight: 600; }
.legal a { color: var(--accent-dark); text-underline-offset: 3px; }
.legal table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 8px 0 24px; font-size: 15px; line-height: 1.5;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.legal th, .legal td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.legal tr:last-child th, .legal tr:last-child td { border-bottom: none; }
.legal thead th { background: var(--bg); color: var(--ink-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 520px; }

.contact-box {
  display: flex; gap: 16px; align-items: flex-start;
  margin-top: 48px; padding: 24px;
  background: var(--accent-light); border-radius: var(--radius-lg);
}
.contact-box.top { margin: 0 0 8px; }
.contact-box p { margin: 0; }
.contact-box a { color: var(--accent-dark); font-weight: 600; }
.contact-box .contact-icon {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--accent-dark);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Support page: the flat Anko beside the title (interface placement, per the character passport). */
.doc-hero.has-anko { display: grid; grid-template-columns: minmax(0, 1fr) 112px; column-gap: 28px; align-items: center; }
.doc-hero.has-anko > * { grid-column: 1; justify-self: start; }
.doc-hero.has-anko .doc-anko { grid-column: 2; grid-row: 1 / span 3; width: 112px; }
.doc-hero h1 { overflow-wrap: break-word; }
@media (max-width: 480px) {
  .doc-hero.has-anko { grid-template-columns: minmax(0, 1fr) 72px; column-gap: 16px; }
  .doc-hero.has-anko .doc-anko { width: 72px; grid-row: 1 / span 2; }
}
/* "конфіденційності" at the regular size is wider than a 320px screen. */
@media (max-width: 360px) { .doc-hero h1 { font-size: 1.8rem; } }
