/* ============================================================
   Dathent legal pages (Privacy / Terms / Security)
   Shared layout + styling. Matches the landing typography +
   token system but trimmed of the 3D scene and animation
   machinery — these pages are reader-first.
   ============================================================ */

:root {
  --grad-cyan: #4FC3FF;
  --grad-purple: #7A5BFF;
  --grad-magenta: #E455CF;
  --grad-accent: linear-gradient(135deg, #4FC3FF 0%, #7A5BFF 55%, #E455CF 100%);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-heading: 'Lora', Georgia, serif;
  --font-mono: 'Lora', Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root, [data-theme="dark"] {
  --bg: #050609;
  --bg-2: #0a0b11;
  --panel: #0e0f17;
  --panel-2: #14151f;
  --border: rgba(255,255,255,0.06);
  --border-2: rgba(255,255,255,0.12);
  --border-3: rgba(255,255,255,0.20);
  --text: #ededf2;
  --text-2: #a8a8b4;
  --text-3: #6b6b78;
  --text-4: #4a4a55;
  --accent: var(--grad-purple);
  --accent-soft: rgba(122,91,255,0.16);
  --accent-soft-2: rgba(122,91,255,0.30);
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-2: #ffffff;
  --panel: rgba(255,255,255,0.85);
  --panel-2: #ffffff;
  --border: rgba(10,10,20,0.07);
  --border-2: rgba(10,10,20,0.14);
  --border-3: rgba(10,10,20,0.24);
  --text: #0c0c14;
  --text-2: #4b4b56;
  --text-3: #7a7a85;
  --text-4: #9c9ca6;
  --accent: #5B47F0;
  --accent-soft: rgba(91,71,240,0.10);
  --accent-soft-2: rgba(91,71,240,0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); scroll-behavior: smooth; transition: background 360ms var(--ease); }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Editorial serif headings — match landing + app (Lora) */
.legal-hero h1, .legal-section h2, .legal-cta h3, .legal-card h4 {
  font-family: var(--font-heading);
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Top nav (matches landing minimal nav) ---------- */
.legal-nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(247,246,242,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .legal-nav {
  background: rgba(5,6,9,0.78);
}
.legal-nav-row {
  /* Desktop layout pattern:
        [logo · Home · Privacy · Terms]            [EN ▾ ☀ ☾]
     Logo + nav links cluster on the LEFT (one visual group), actions
     pushed to the RIGHT via margin-left: auto on the actions block.
     This avoids the previous "margin-right: auto on logo" approach
     which interacted badly with flex-wrap: at tablet widths where the
     row didn't quite fit, the auto margin expanded logo to fill its
     line and dumped EVERYTHING else (links + actions) onto row 2,
     producing a left-aligned wrapped strip. With margin-left: auto on
     actions, the auto-space sits in the middle — when wrap happens
     it's the actions that drop cleanly to a new line, not the logo.
     Mobile breakpoint below also pushed up (720 → 900) to catch
     tablet-portrait sizes before any wrap can trigger. */
  display: flex; align-items: center;
  padding: 16px 0;
  gap: 18px;
}
.legal-nav-logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-weight: 600; font-size: 18px; letter-spacing: -0.015em;
}
.legal-nav-logo img { height: 28px; width: auto; }
.legal-nav-links { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.legal-nav-actions {
  display: inline-flex; align-items: center; gap: 10px;
  margin-left: auto;             /* push controls to the right edge */
}

/* Mobile (≤ 900px) — repack the header as a 2-row grid:
     Row 1:  [logo (left)]                 [actions: lang + theme (right)]
     Row 2:  [        nav links, centered, full-width                    ]
   Bumped from 720 → 900 because tablet-portrait viewports (~720–880)
   were hitting the desktop flex layout but didn't have enough room
   to fit logo + 3 links + lang picker + theme toggle on one line.
   They wrapped messily ("Dathent" alone on row 1, links+actions
   bunched on row 2 with left-alignment) — exactly what the user
   screenshotted as "стало гірше". Grid kicks in earlier now so the
   layout switches cleanly before any wrap can trigger. */
@media (max-width: 900px) {
  .legal-nav-row {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 10px;
    padding: 12px 0;
    align-items: center;
  }
  .legal-nav-logo {
    grid-column: 1;
    grid-row: 1;
    font-size: 16px;
    gap: 6px;
  }
  .legal-nav-logo img { height: 24px; }
  .legal-nav-actions {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;              /* reset desktop's push-right */
    justify-self: end;
    gap: 8px;
  }
  .legal-nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    gap: 22px;
    font-size: 13.5px;
  }
  .legal-nav-links a { font-size: 13.5px; }
  .legal-nav-actions .theme-toggle,
  .legal-nav-actions .lang-dd { flex-shrink: 0; }
}
.legal-nav-links a {
  color: var(--text-2); text-decoration: none;
  font-size: 14px; letter-spacing: -0.003em;
}
.legal-nav-links a:hover { color: var(--text); }
/* Theme toggle — pill matching landing's */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-2);
}
.theme-toggle button {
  width: 28px; height: 28px;
  border-radius: 999px; border: 0;
  background: transparent; color: var(--text-3);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.theme-toggle button svg {
  width: 14px; height: 14px;
  display: block; flex-shrink: 0;
}
.theme-toggle button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft-2);
}

/* Language picker — identical markup + styles to the landing's lang-dd
   so the header looks 1:1 across all public pages. Copied verbatim from
   index.html (lines ~1141-1201). */
.lang-dd { position: relative; }
.lang-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px; height: 32px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text); cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  transition: background 140ms, border-color 140ms;
}
.lang-trigger:hover { border-color: var(--border-3); }
.lang-trigger .flag {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--text-2);
  padding: 2px 5px; background: transparent; border: 1px solid var(--border-2);
  border-radius: 4px;
}
.lang-trigger svg.caret { width: 11px; height: 11px; color: var(--text-3); transition: transform 160ms; }
.lang-dd.is-open .lang-trigger svg.caret { transform: rotate(180deg); }
.lang-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px; padding: 6px;
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(-6px) scale(0.98); pointer-events: none;
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
  z-index: 60;
  max-height: 360px; overflow-y: auto;
  backdrop-filter: blur(20px);
}
.lang-dd.is-open .lang-panel { opacity: 1; transform: none; pointer-events: auto; }
.lang-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: 0; cursor: pointer; font-family: inherit;
  color: var(--text); font-size: 13px; text-align: left;
  transition: background 100ms;
}
.lang-option:hover { background: var(--bg-2); }
.lang-option .lo-code {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--text-2);
  padding: 2px 5px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px; min-width: 32px; text-align: center; flex-shrink: 0;
}
.lang-option .lo-name { flex: 1; }
.lang-option .lo-check { width: 14px; height: 14px; color: var(--accent); opacity: 0; }
.lang-option.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.lang-option.is-active .lo-code { background: var(--accent-soft-2); border-color: transparent; color: var(--accent); }
.lang-option.is-active .lo-check { opacity: 1; }
.lang-option.is-soon { opacity: 0.7; }
.lang-option.is-soon::after {
  content: 'soon'; margin-left: 4px;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  padding: 1px 5px; background: var(--bg-2);
  border-radius: 3px;
}

/* ---------- Hero / Page header ---------- */
.legal-hero {
  padding: 64px 0 32px;
  border-bottom: 1px solid var(--border);
}
.legal-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 18px;
}
.legal-hero h1 {
  font-size: clamp(36px, 4.5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  font-weight: 500;
}
.legal-hero p.subtitle {
  font-size: 17px;
  color: var(--text-2);
  max-width: 680px;
  margin: 0 0 24px;
  letter-spacing: -0.005em;
}
.legal-meta {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--text-3);
  letter-spacing: 0.02em;
}
.legal-highlight {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ---------- Body / Two-column layout ---------- */
.legal-body { padding: 48px 0 96px; }
.legal-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  align-items: start;
}
@media (max-width: 860px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.legal-toc {
  position: sticky; top: 90px;
  font-size: 14px;
}
.legal-toc-label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}
.legal-toc-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.legal-toc-list a {
  color: var(--text-2); text-decoration: none;
  font-size: 13.5px; line-height: 1.45;
  display: block;
  padding-left: 12px;
  border-left: 2px solid transparent;
  transition: all 180ms var(--ease);
}
.legal-toc-list a:hover {
  color: var(--text);
  border-left-color: var(--accent);
}
@media (max-width: 860px) {
  .legal-toc { position: static; }
}

.legal-content { max-width: 720px; min-width: 0; }
.legal-section { margin-bottom: 48px; }
.legal-section h2 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  scroll-margin-top: 90px;
}
.legal-section p {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-2);
  margin: 0 0 14px;
}
.legal-section p strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Security page: card groups ---------- */
.legal-groups {
  display: flex; flex-direction: column;
  gap: 56px;
}
.legal-group h3 {
  font-size: 14px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 18px;
  font-weight: 500;
}
.legal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.legal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  transition: border-color 200ms var(--ease);
}
.legal-card:hover { border-color: var(--border-2); }
.legal-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.legal-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0;
}
.legal-cta {
  margin-top: 64px;
  padding: 40px 44px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 16px;
  align-items: flex-start;
}
.legal-cta h3 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.012em;
  margin: 0;
  color: var(--text);
}
.legal-cta p {
  font-size: 15px;
  color: var(--text-2);
  margin: 0;
  max-width: 600px;
  line-height: 1.55;
}
.legal-cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none !important;
  transition: transform 180ms var(--ease), filter 180ms var(--ease);
}
.legal-cta-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- Footer (matches landing) ---------- */
.legal-footer {
  padding: 32px 0 40px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.02em;
  color: var(--text-3);
}
.legal-footer-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.legal-footer-links { display: flex; gap: 18px; }
.legal-footer-row a { color: var(--text-3); text-decoration: none; }
.legal-footer-row a:hover { color: var(--text); }
@media (max-width: 600px) {
  .legal-footer-row { font-size: 10px; gap: 12px; }
}
