/* Guardian Mesh — shared design tokens and base styles */

:root {
  /* Core colors */
  --bg: #fafafa;
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --text: #18181b;
  --muted: #52525b;
  --accent: #52525b;

  /* Shared design tokens */
  --gm-radius-sm: 6px;
  --gm-radius: 10px;
  --gm-radius-lg: 16px;
  --gm-radius-full: 9999px;
  --gm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --gm-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --gm-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --gm-transition: 0.2s ease;
  --gm-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --gm-font-mono: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 24px) 32px;
}

/* Page content wrapper (for pages after removing .wrap from main) */
.page-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) clamp(16px, 4vw, 24px);
}

/* Legal/policy pages - narrower for readability */
.page-legal .card {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.page-legal .card p,
.page-legal .card li {
  line-height: 1.7;
  font-size: clamp(14px, 1.8vw, 15px);
}
.page-legal .card ul,
.page-legal .card ol {
  padding-left: clamp(16px, 3vw, 24px);
}

/* Skip-to-content (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Pill navigation */
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  transition: color 0.2s, border-color 0.2s;
}
.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  border-color: var(--muted);
  outline: none;
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--gm-radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

/* Typography */
h1, h2 { margin: 0 0 10px; }
p, li { color: var(--muted); line-height: 1.5; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--muted); }
code { color: #3f3f46; background: #f4f4f5; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
ul, ol { margin: 0; padding-left: 20px; }

/* Utility */
.muted { color: var(--muted); font-size: 13px; }

/* Form elements */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 44px;
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input:hover:not(:focus), select:hover:not(:focus) {
  border-color: rgba(0, 0, 0, 0.15);
}

/* Buttons */
.cta {
  border: none;
  color: #fff;
  background: var(--text);
  border-radius: 980px;
  padding: 12px 22px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: opacity 0.2s;
}
.cta:hover { opacity: 0.85; }
.cta:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.cta-secondary {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  border-radius: 980px;
  padding: 12px 22px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.2s;
}
.cta-secondary:hover { border-color: var(--muted); }
.cta-secondary:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }

/* Code blocks */
pre, .code-block {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: #1c1c1e;
  color: #d4d4d8;
  padding: 12px;
  overflow-x: auto;
  white-space: pre;
  font-family: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--panel);
}
.stat .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.stat .value {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

/* ===== Error pages ===== */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px - 180px);
  padding: clamp(40px, 8vw, 80px) clamp(16px, 4vw, 24px);
  text-align: center;
  background: none;
  border: none;
  margin: 0;
}
.error-page-inner {
  max-width: 440px;
  margin: 0 auto;
}
.error-code {
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #d4d4d8 0%, #a1a1aa 50%, #71717a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.error-icon {
  color: var(--muted);
  opacity: 0.6;
  margin-bottom: 20px;
}
.error-icon svg {
  width: 80px;
  height: 80px;
}
.error-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.error-desc {
  font-size: clamp(0.875rem, 2vw, 1rem);
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 32px;
}
.error-actions {
  margin-bottom: 32px;
}
.error-actions .cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 0.9rem;
  text-decoration: none;
  min-height: 44px;
}
.error-links {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 3vw, 28px);
  flex-wrap: wrap;
}
.error-links a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.error-links a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ===== FAQ Accordion ===== */
.faq-hero {
  text-align: center;
  padding: clamp(32px, 6vw, 56px) clamp(16px, 4vw, 24px) clamp(20px, 4vw, 36px);
}
.faq-hero-inner {
  max-width: 600px;
  margin: 0 auto;
}
.faq-hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.faq-hero-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.faq-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.faq-group {
  margin-bottom: 32px;
}
.faq-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item[open] {
  padding-bottom: 16px;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.faq-question::-webkit-details-marker {
  display: none;
}
.faq-question::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-left: 16px;
}
.faq-item[open] .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 0 4px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}
.faq-answer p {
  margin-bottom: 10px;
}
.faq-answer p:last-child {
  margin-bottom: 0;
}

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