/* ============================================================
   KNOCK — Shared Design Foundation
   Tokens, reset, layout, header, footer, components.
   Linked by all pages (static HTML + React entry).
   ============================================================ */

/* --- Design tokens (mirrors apps/mobile/src/theme/) --- */
:root {
  /* Backgrounds */
  --bg: #FAF8F5;
  --bg-elevated: #F5F2EE;
  --surface: #FFFFFF;

  /* Text */
  --text-primary: #2D2A26;
  --text-secondary: #6B635A;
  --text-tertiary: #9A948C;
  --text-inverse: #FFFFFF;

  /* Accent (terracotta) */
  --accent: #DA7756;
  --accent-light: #E8956F;
  --accent-dark: #C4613F;
  --accent-tint: rgba(218, 119, 86, 0.12);

  /* Neutral */
  --beige: #C4B5A5;
  --beige-light: #D4C8BB;

  /* Semantic */
  --success: #7DAF72;
  --error: #D9534F;

  /* Borders */
  --border: #E8E4DE;
  --border-light: #F0EBE3;

  /* Shadows */
  --shadow-card: 0 1px 4px rgba(45, 42, 38, 0.06);
  --shadow-soft: 0 2px 8px rgba(45, 42, 38, 0.08);
  --shadow-elevated: 0 4px 16px rgba(45, 42, 38, 0.10);

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-rnd: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --button-height: 56px;
  --button-height-sm: 44px;
  --max-content: 680px;
  --max-container: 860px;
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Base --- */
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Site header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  max-width: var(--max-content);
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.site-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.site-logo:hover {
  opacity: 0.8;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-nav a {
  font-family: 'Manrope', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--text-primary);
}

.site-nav .nav-cta {
  color: var(--text-inverse);
  background: var(--accent);
  padding: 6px var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, transform 0.15s ease;
}

.site-nav .nav-cta:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

@media (max-width: 560px) {
  .site-header {
    padding: var(--space-3) var(--space-4);
  }

  .site-nav {
    gap: var(--space-3);
  }

  .site-nav a:not(.nav-cta) {
    display: none;
  }
}

/* --- Site footer --- */
.site-footer {
  max-width: var(--max-container);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}

.site-footer::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--border);
  margin-bottom: var(--space-2);
}

.footer-links {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-family: 'Manrope', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

/* --- Layout --- */
.container {
  width: min(var(--max-container), 100%);
  margin: 0 auto;
  padding: var(--space-6);
  position: relative;
  z-index: 1;
}

.container-narrow {
  width: min(var(--max-content), 100%);
  margin: 0 auto;
  padding: var(--space-6);
  position: relative;
  z-index: 1;
}

/* --- Card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: var(--space-6);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--button-height);
  padding: 0 var(--space-6);
  border: none;
  border-radius: var(--radius-xl);
  background: var(--accent);
  color: var(--text-inverse);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-elevated);
}

.btn:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-card);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--beige-light);
  color: var(--text-primary);
}

.btn-sm {
  height: var(--button-height-sm);
  padding: 0 var(--space-4);
  font-size: 0.875rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

/* --- Inputs --- */
.input {
  width: 100%;
  height: var(--button-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.input:disabled {
  opacity: 0.6;
}

/* --- Link styles --- */
.link-accent {
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-accent:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* --- Typography helpers --- */
.heading-display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.text-secondary {
  color: var(--text-secondary);
}

.text-tertiary {
  color: var(--text-tertiary);
}

/* --- Utilities --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Document pages (privacy, terms, support) --- */
.doc-page {
  padding-bottom: 0;
}

.doc-page h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.doc-page .last-updated {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-8);
}

.doc-page h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.doc-page p,
.doc-page li {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.72;
  margin-bottom: var(--space-3);
}

.doc-page ul {
  padding-left: 1.25rem;
  margin-bottom: var(--space-4);
}

.doc-page li {
  margin-bottom: var(--space-2);
}

.doc-page strong {
  color: var(--text-primary);
  font-weight: 600;
}

@media (max-width: 560px) {
  .container,
  .container-narrow {
    padding: var(--space-4);
  }

  .card {
    padding: var(--space-4);
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
