/* Public pages outside the app (404, privacy, terms): same look as the homepage */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #4A8C7C;
  --brand-dark: #357060;
  --brand-teal-50: #E5F0EC;
  --text: #111110;
  --text-2: #5A5955;
  --text-3: #9E9C96;
  --border: #E4E2DC;
  --surface: #FFFFFF;
  --bg: #F7F6F1;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-bg: rgba(247, 246, 241, 0.9);
  --on-brand: #FFFFFF;
  --hover-border: #C5C3BC;
}

/* Dark: follows the device (or the sun/moon button), set on <html> by theme.js */
:root[data-theme="dark"] {
  --brand: #5FA592;
  --brand-dark: #8CC7B7;
  --brand-teal-50: #1C2A26;
  --text: #ECEAE4;
  --text-2: #A6A49C;
  --text-3: #77756E;
  --border: #302F2B;
  --surface: #1E1E1C;
  --bg: #161615;
  --nav-bg: rgba(22, 22, 21, 0.85);
  --on-brand: #0F1A17;
  --hover-border: #4A4944;
}

html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }

/* Top bar */
.pub-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.pub-logo { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; color: var(--text); text-decoration: none; }
.pub-logo img { width: 28px; height: 28px; }
.pub-nav-link { font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.pub-nav-link:hover { color: var(--text); }
.pub-nav-right { display: flex; align-items: center; gap: 16px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--hover-border); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

/* Legal documents */
.legal { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 72px 24px 96px; }
.legal-eyebrow { font-size: 14px; font-weight: 500; color: var(--brand); margin-bottom: 12px; }
.legal h1 { font-size: 44px; font-weight: 500; line-height: 1.1; letter-spacing: -0.035em; }
.legal-updated { margin-top: 14px; font-size: 14px; color: var(--text-3); }
.legal-note {
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}
.legal-toc { margin-top: 32px; padding: 0; list-style: none; columns: 2; column-gap: 24px; }
.legal-toc li { margin-bottom: 8px; break-inside: avoid; font-size: 14px; }
.legal-toc a { color: var(--text-2); text-decoration: none; }
.legal-toc a:hover { color: var(--brand); }
.legal section { margin-top: 48px; scroll-margin-top: 96px; }
.legal h2 { margin-bottom: 12px; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.legal p, .legal li { font-size: 16px; line-height: 1.7; color: var(--text-2); }
.legal p + p { margin-top: 12px; }
.legal ul { margin: 12px 0 0 20px; }
.legal ul li { margin-bottom: 6px; }
.legal strong { color: var(--text); font-weight: 500; }

/* 404 */
.notfound { flex: 1; display: flex; align-items: center; justify-content: center; padding: 72px 24px; text-align: center; }
.notfound-inner { max-width: 460px; }
.notfound-code {
  display: inline-block;
  margin-bottom: 20px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--brand-teal-50);
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-dark);
}
.notfound h1 { font-size: 40px; font-weight: 500; line-height: 1.1; letter-spacing: -0.035em; }
.notfound p { margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--text-2); }
.notfound-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 32px; }
.pub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.pub-btn.is-primary { background: var(--brand); color: var(--on-brand); }
.pub-btn.is-primary:hover { background: var(--brand-dark); }
.pub-btn.is-secondary { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pub-btn.is-secondary:hover { border-color: var(--text-3); }
.pub-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Footer */
.pub-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 40px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.pub-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.pub-footer a { color: var(--text-3); text-decoration: none; }
.pub-footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .pub-nav { padding: 16px 20px; }
  .legal { padding: 48px 20px 72px; }
  .legal h1 { font-size: 34px; }
  .legal-toc { columns: 1; }
  .legal p, .legal li { font-size: 15px; }
  .notfound h1 { font-size: 32px; }
  .notfound-actions .pub-btn { flex: 1 1 100%; }
  .pub-footer { flex-direction: column; padding: 24px 20px; text-align: center; }
  .pub-footer nav { justify-content: center; }
}
