/*
 * TeleVault — Privacy Policy
 * Styled with the app's own design system (TeleVault DESIGN.md):
 * an ink-and-brass vault register. Flat surfaces, 1px borders, no shadows,
 * one accent (brass), Space Grotesk / Inter / IBM Plex Mono.
 */

/* ---------- Tokens ---------- */

:root {
  /* Palette (VaultColors) */
  --ink-900: #12182B;
  --ink-800: #1B2338;
  --ink-700: #2A3350;
  --brass-500: #B08D57;
  --brass-light: #CBB084;
  --brass-dark: #8F703F;
  --bone-100: #EDE6D6;
  --steel-400: #7C8AA3;
  --steel-300: #A5B2C9;
  --sync-green: #6FA287;
  --rust-500: #C1602A;

  /* Roles — light mode (inverted surfaces, per DESIGN.md) */
  --bg: var(--bone-100);
  --surface: #F6F2E9;
  --surface-2: #EFE8DA;
  --border: #D8D0BE;
  --text: var(--ink-900);
  --text-muted: #56607A;
  --accent: var(--brass-dark);
  --accent-primary: var(--brass-dark);
  --accent-soft: rgba(176, 141, 87, 0.14);
  --on-accent: var(--ink-900);
  --green: #4E8467;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1160px;

  color-scheme: light;
}

/* Dark mode — the app's default look */
:root[data-theme="dark"] {
  --bg: var(--ink-900);
  --surface: var(--ink-800);
  --surface-2: #222B44;
  --border: var(--ink-700);
  --text: var(--bone-100);
  --text-muted: var(--steel-300);
  --accent: var(--brass-500);
  --accent-primary: var(--brass-500);
  --accent-soft: rgba(176, 141, 87, 0.14);
  --on-accent: var(--ink-900);
  --green: var(--sync-green);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink-900);
    --surface: var(--ink-800);
    --surface-2: #222B44;
    --border: var(--ink-700);
    --text: var(--bone-100);
    --text-muted: var(--steel-300);
    --accent: var(--brass-500);
    --accent-primary: var(--brass-500);
    --accent-soft: rgba(176, 141, 87, 0.14);
    --on-accent: var(--ink-900);
    --green: var(--sync-green);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--brass-500);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The icon's own rounded navy plate; a hairline keeps it visible on the ink background */
.brand-icon,
.hero-icon {
  border-radius: 22%;
  box-shadow: 0 0 0 1px var(--border);
}

.brand-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.app-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dev-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-outline {
  background: var(--brass-500);
  border: 1px solid var(--brass-500);
  color: var(--on-accent);
}

.btn-outline:hover {
  background: var(--brass-light);
  border-color: var(--brass-light);
}

/* ---------- Hero ---------- */

.hero-section {
  text-align: center;
  padding: 64px 0 40px;
}

.hero-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 24px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Status dot — always paired with a text label (DESIGN.md §5) */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 20px 0 16px;
}

.hero-subtitle {
  max-width: 640px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.08rem;
}

.hero-subtitle strong {
  color: var(--text);
  font-weight: 600;
}

.policy-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta-item i {
  color: var(--accent);
}

.meta-item strong {
  color: var(--text);
  font-weight: 500;
}

/* ---------- Guarantees ---------- */

.guarantees-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 56px;
}

.guarantee-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease;
}

.guarantee-card:hover {
  border-color: var(--accent);
}

.card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.guarantee-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.guarantee-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ---------- Layout ---------- */

.content-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-bottom: 72px;
}

.sidebar {
  position: sticky;
  top: 92px;
}

.sidebar-sticky {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.toc-link i {
  width: 16px;
  text-align: center;
  font-size: 0.82rem;
}

.toc-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.toc-link.active {
  background: var(--accent-soft);
  border-left-color: var(--brass-500);
  color: var(--text);
  font-weight: 500;
}

.toc-link.active i {
  color: var(--accent);
}

/* ---------- Policy sections ---------- */

.policy-articles {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.policy-section {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Section numbers are set in the ledger mono, like entries in a register */
.section-number {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  padding-top: 6px;
}

.section-body {
  min-width: 0;
}

.section-body h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 14px;
}

.section-body h2 i {
  color: var(--accent);
  font-size: 1.05rem;
}

.section-body p {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.section-body p:last-child {
  margin-bottom: 0;
}

.section-body strong {
  color: var(--text);
  font-weight: 600;
}

.external-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}

.external-link:hover {
  text-decoration-color: currentColor;
}

.external-link i {
  font-size: 0.72em;
  margin-left: 2px;
}

.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  margin-top: 18px;
  border-radius: var(--radius);
  font-size: 0.93rem;
}

.callout-info {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brass-500);
  color: var(--text-muted);
}

.callout-info i {
  color: var(--accent);
  margin-top: 4px;
}

.callout-info strong {
  color: var(--text);
}

.security-features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.sec-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sec-item i {
  color: var(--accent);
  margin-top: 4px;
}

.sec-item strong {
  display: block;
  font-size: 0.92rem;
}

.sec-item span {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ---------- Editions ---------- */

.editions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.edition-card {
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pro-edition {
  border-color: var(--brass-500);
}

.edition-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pro-badge {
  background: var(--brass-500);
  border-color: var(--brass-500);
  color: var(--on-accent);
}

.edition-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.edition-card p {
  font-size: 0.92rem;
}

.edition-points {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edition-points li {
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.edition-points li i {
  color: var(--accent);
  margin-top: 5px;
  font-size: 0.8rem;
  width: 14px;
  flex-shrink: 0;
}

.pro-edition .edition-points li i {
  color: var(--green);
}

/* ---------- Permissions ---------- */

.permissions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.permission-card {
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.perm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.perm-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.permission-card h4 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.section-body .permission-card p {
  margin: 0;
  padding-left: 44px;
  font-size: 0.9rem;
}

.permission-card em {
  font-style: normal;
  color: var(--text);
}

/* ---------- Contact ---------- */

.contact-box {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contact-avatar {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--brass-500);
  color: var(--ink-900);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.email-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.email-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.email-text:hover {
  text-decoration: underline;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-left p {
  margin: 0;
}

.footer-left strong {
  color: var(--text);
}

.footer-subtext {
  font-size: 0.8rem;
  margin-top: 2px !important;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.back-to-top:hover {
  color: var(--accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 992px) {
  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .guarantees-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .header-cta {
    display: none;
  }

  .hero-section {
    padding: 40px 0 32px;
  }

  .hero-icon {
    width: 72px;
    height: 72px;
  }

  .policy-meta {
    flex-direction: column;
    align-items: center;
  }

  .policy-section {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px;
    gap: 4px;
  }

  .section-number {
    padding-top: 0;
  }

  .section-body h2 {
    font-size: 1.25rem;
  }

  .security-features-grid,
  .editions-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-body .permission-card p {
    padding-left: 0;
  }

  .contact-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

/* ---------- Print ---------- */

@media print {
  :root:not([data-print]) {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --border: #ccc;
    --text: #000;
    --text-muted: #333;
    --accent: #6b5330;
  }

  .site-header,
  .sidebar,
  .theme-toggle,
  .btn-copy,
  .site-footer {
    display: none !important;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .policy-section {
    break-inside: avoid;
  }
}
