/* ============================================================
   Mark Protocol — Design System & Styles
   ============================================================
   Color palette: Navy/blue for trust, white for clarity.
   Typography: Inter (system fallback). Clean hierarchy.
   Layout: CSS Grid + Flexbox. Mobile-first.
   ============================================================ */

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

:root {
  /* Colors */
  --c-primary: #1a56db;
  --c-primary-hover: #1e40af;
  --c-primary-light: #dbeafe;
  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #94a3b8;
  --c-bg: #ffffff;
  --c-bg-alt: #f8fafc;
  --c-bg-subtle: #f1f5f9;
  --c-border: #e2e8f0;
  --c-border-strong: #cbd5e1;
  --c-success: #059669;
  --c-warning: #d97706;
  --c-danger: #dc2626;
  --c-danger-light: #fef2f2;
  --c-navy: #0f172a;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;
  --fs-5xl: 3rem;
  --lh-tight: 1.2;
  --lh-normal: 1.6;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Spacing */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;
  --s-24: 6rem;

  /* Layout */
  --max-w: 72rem;
  --max-w-narrow: 48rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  color: var(--c-text);
}
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }

p { margin-bottom: var(--s-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--c-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--c-primary-hover); text-decoration: underline; }

code, pre {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
code {
  background: var(--c-bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
}
pre {
  background: var(--c-navy);
  color: #e2e8f0;
  padding: var(--s-6);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: var(--s-6);
}
pre code { background: none; padding: 0; color: inherit; }

strong { font-weight: var(--fw-semibold); }

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
.container--narrow {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 var(--s-6);
}

/* --- Header / Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}
.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--c-text);
  text-decoration: none;
}
.nav__logo:hover { text-decoration: none; color: var(--c-text); }
.nav__logo img {
  width: 28px;
  height: 28px;
}
.nav__links {
  display: flex;
  list-style: none;
  gap: var(--s-1);
}
.nav__links a {
  display: block;
  padding: var(--s-2) var(--s-3);
  color: var(--c-text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav__links a:hover,
.nav__links a.active {
  color: var(--c-text);
  background: var(--c-bg-subtle);
  text-decoration: none;
}
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
}
.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* --- Sections --- */
.section {
  padding: var(--s-20) 0;
}
.section--alt {
  background: var(--c-bg-alt);
}
.section__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s-3);
}
.section__title {
  margin-bottom: var(--s-4);
}
.section__subtitle {
  font-size: var(--fs-lg);
  color: var(--c-text-secondary);
  max-width: 40rem;
  margin-bottom: var(--s-8);
  font-weight: var(--fw-normal);
}

/* --- Hero --- */
.hero {
  padding: var(--s-24) 0 var(--s-20);
  text-align: center;
}
.hero h1 {
  font-size: var(--fs-5xl);
  margin-bottom: var(--s-6);
  letter-spacing: -0.02em;
}
.hero__subtitle {
  font-size: var(--fs-xl);
  color: var(--c-text-secondary);
  max-width: 36rem;
  margin: 0 auto var(--s-8);
  line-height: var(--lh-normal);
}
.hero__actions {
  display: flex;
  gap: var(--s-4);
  justify-content: center;
  flex-wrap: wrap;
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  background: var(--c-bg-subtle);
  border-radius: 2rem;
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  margin-bottom: var(--s-8);
}
.hero__status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-warning);
}
.hero__status .dot--live { background: var(--c-success); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  border: none;
  line-height: 1.4;
}
.btn--primary {
  background: var(--c-primary);
  color: #fff;
}
.btn--primary:hover {
  background: var(--c-primary-hover);
  color: #fff;
  text-decoration: none;
}
.btn--secondary {
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn--secondary:hover {
  background: var(--c-bg-subtle);
  text-decoration: none;
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--s-6);
}
.card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--s-6);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  border-color: var(--c-border-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card__icon {
  width: 40px;
  height: 40px;
  background: var(--c-primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-4);
  font-size: var(--fs-xl);
}
.card__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--s-2);
}
.card__text {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  line-height: var(--lh-normal);
}

/* --- Data Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin-bottom: var(--s-6);
}
.data-table th,
.data-table td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.data-table th {
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--c-bg-alt);
}
.data-table td { color: var(--c-text); }
.data-table tbody tr:hover { background: var(--c-bg-alt); }

/* --- Stat Grid --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--s-6);
}
.stat {
  text-align: center;
  padding: var(--s-6);
}
.stat__value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  margin-bottom: var(--s-1);
}
.stat__label {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* --- Notice / Alert Boxes --- */
.notice {
  padding: var(--s-4) var(--s-6);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  margin-bottom: var(--s-6);
  border: 1px solid;
}
.notice--warning {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
}
.notice--danger {
  background: var(--c-danger-light);
  border-color: #fca5a5;
  color: #991b1b;
}
.notice--info {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}
.notice strong { display: block; margin-bottom: var(--s-1); }

/* --- Principles List --- */
.principles {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--s-4);
}
.principles li {
  padding: var(--s-4);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}
.principles li::before {
  content: "—";
  color: var(--c-primary);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

/* --- FAQ Accordion --- */
.faq-list { list-style: none; }
.faq-item {
  border-bottom: 1px solid var(--c-border);
}
.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-5) 0;
  background: none;
  border: none;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
}
.faq-question:hover { color: var(--c-primary); }
.faq-question::after {
  content: "+";
  font-size: var(--fs-xl);
  color: var(--c-text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: var(--s-4);
}
.faq-item.open .faq-question::after {
  content: "−";
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.faq-item.open .faq-answer {
  max-height: 40rem;
}
.faq-answer__inner {
  padding-bottom: var(--s-6);
  color: var(--c-text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}

/* --- Doc Links Grid --- */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--s-4);
}
.doc-link {
  display: block;
  padding: var(--s-5) var(--s-6);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.doc-link:hover {
  border-color: var(--c-primary);
  box-shadow: 0 2px 8px rgba(26,86,219,0.08);
  text-decoration: none;
}
.doc-link__title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  margin-bottom: var(--s-1);
}
.doc-link__desc {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding: var(--s-12) 0 var(--s-8);
  background: var(--c-bg-alt);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s-8);
  margin-bottom: var(--s-10);
}
.footer__brand {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  max-width: 20rem;
}
.footer__brand p { margin-top: var(--s-3); }
.footer-col h4 {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  margin-bottom: var(--s-4);
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: var(--s-2); }
.footer-col a {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}
.footer-col a:hover { color: var(--c-text); }
.footer__bottom {
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  flex-wrap: wrap;
  gap: var(--s-4);
}
.footer__bottom a { color: var(--c-text-muted); }

/* --- Page Header (inner pages) --- */
.page-header {
  padding: var(--s-16) 0 var(--s-10);
  background: var(--c-bg-alt);
  border-bottom: 1px solid var(--c-border);
}
.page-header h1 { margin-bottom: var(--s-4); }
.page-header__desc {
  font-size: var(--fs-lg);
  color: var(--c-text-secondary);
  max-width: 40rem;
}

/* --- Content sections (inner pages) --- */
.content-section {
  padding: var(--s-12) 0;
}
.content-section + .content-section {
  border-top: 1px solid var(--c-border);
}
.content-section h2 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--s-4);
}
.content-section h3 {
  font-size: var(--fs-xl);
  margin-bottom: var(--s-3);
  margin-top: var(--s-8);
}
.content-section p {
  color: var(--c-text-secondary);
  max-width: 40rem;
}
.content-section ul, .content-section ol {
  padding-left: var(--s-6);
  margin-bottom: var(--s-4);
  color: var(--c-text-secondary);
}
.content-section li {
  margin-bottom: var(--s-2);
  font-size: var(--fs-sm);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 { font-size: var(--fs-3xl); }
  .hero__subtitle { font-size: var(--fs-base); }
  h2 { font-size: var(--fs-2xl); }
  .section { padding: var(--s-12) 0; }
  .hero { padding: var(--s-16) 0 var(--s-12); }

  .nav__links { display: none; }
  .nav__links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    padding: var(--s-4) var(--s-6);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  }
  .nav__toggle { display: flex; }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-6);
  }
  .footer__brand { grid-column: 1 / -1; }
  .footer__bottom { flex-direction: column; text-align: center; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: var(--s-4); }
  .stat__value { font-size: var(--fs-2xl); }
}

@media (max-width: 480px) {
  .hero h1 { font-size: var(--fs-2xl); }
  .card-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-sm { font-size: var(--fs-sm); }
.text-muted { color: var(--c-text-secondary); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.mb-8 { margin-bottom: var(--s-8); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
