/* Unified design system for static marketing/blog/docs pages.
   Matches the React SPA design in src/index.css. */
:root {
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;

  --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;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 42px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.14);

  --color-primary: #1769e5;
  --color-primary-700: #1450b8;
  --color-primary-100: #dde9ff;
  --color-neutral-100: #f1f5f9;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e1;
  --color-neutral-500: #64748b;
  --color-neutral-700: #334155;
  --color-neutral-900: #0f172a;
  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --color-danger: #b91c1c;
  --color-danger-bg: #fef2f2;
  --color-background: #f5f8fd;
  --color-surface: #ffffff;
  --color-border: #d6e2f1;
  --color-border-hover: #b9d0ec;
  --header-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: rgba(255, 255, 255, 0.8);
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.92)), var(--color-surface);

  --content-max-width: 1120px;

  --text-color: var(--color-neutral-900);
  --muted-color: var(--color-neutral-500);
  --border-color: var(--color-border);
  --bg-soft: #f5f8ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text-color);
  font-size: var(--font-size-base);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  background:
    radial-gradient(1300px 520px at 4% -4%, rgba(23, 105, 229, 0.13), transparent 62%),
    radial-gradient(940px 520px at 96% -10%, rgba(148, 189, 255, 0.24), transparent 56%),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fe 40%, #f7fbff 100%);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  color: var(--text-color);
  line-height: 1.25;
}

h1 {
  margin: 0 0 var(--space-4);
  font-size: clamp(var(--font-size-xl), 1.7vw + 0.95rem, var(--font-size-2xl));
}

h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-xl);
}

h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
}

p {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-base);
  overflow-wrap: anywhere;
}

li,
td,
th {
  overflow-wrap: anywhere;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

img,
svg,
pre,
table {
  max-width: 100%;
}

pre {
  overflow-x: auto;
}

code {
  overflow-wrap: anywhere;
}

/* ── Header (matches React SPA Header) ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--color-border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
}

.app-header-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-weight: 800;
  text-decoration: none;
}

.app-brand:hover {
  text-decoration: none;
}

.app-brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1d4ed8;
  background: #eff6ff;
}

.app-brand-logo svg {
  width: 16px;
  height: 16px;
}

.app-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.app-nav-link {
  color: var(--color-neutral-700);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.app-nav-link:hover {
  text-decoration: none;
  border-color: var(--color-neutral-300);
  background: var(--color-neutral-100);
}

.app-nav-link.is-active {
  color: var(--color-primary-700);
  border-color: var(--color-primary-100);
  background: var(--color-neutral-100);
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

/* ── Main content ── */
.site-main {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-12);
  animation: page-fade-in 400ms ease both;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Footer (matches React SPA Footer) ── */
.app-footer {
  margin-top: var(--space-8);
  border-top: 1px solid var(--color-border);
  background: var(--footer-bg);
}

.app-footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

@media (min-width: 768px) {
  .app-footer-inner {
    flex-direction: row;
    align-items: flex-start;
  }
}

.app-footer small {
  color: #64748b;
  font-size: 0.85rem;
}

.app-footer-links {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  width: 100%;
}

@media (min-width: 768px) {
  .app-footer-links {
    width: auto;
    margin-left: auto;
  }
}

.footer-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-group-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-neutral-700);
  margin-bottom: 2px;
}

.footer-group a {
  color: var(--color-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.footer-group a:hover {
  text-decoration: underline;
}

/* ── Doc / article ── */
.doc-article {
  max-width: 780px;
  margin: 1rem auto 2rem;
}

.doc-content {
  line-height: 1.78;
}

.doc-eeat {
  font-size: 0.85rem;
  color: var(--muted-color);
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.eeat-divider {
  margin: 0 0.5rem;
  opacity: 0.6;
}

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

/* ── Ad container ── */
.ad-container {
  margin: 1.25rem auto;
  max-width: var(--content-max-width);
  min-height: 200px;
  padding: 0.75rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-neutral-100);
}

.ad-label {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted-color);
}

/* ── Widgets ── */
.widget-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.widget {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

/* ── Newsletter ── */
.newsletter {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin: 1.5rem 0;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.newsletter form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.newsletter input {
  flex: 1 1 220px;
  padding: var(--space-3);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  font: inherit;
}

.newsletter button {
  border: 1px solid #0f54be;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #2f7df3, #1769e5);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  font-weight: 700;
  font: inherit;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-nav-toggle {
    display: inline-flex;
  }

  .app-nav {
    position: absolute;
    right: 1rem;
    top: 3.5rem;
    width: min(260px, calc(100% - 2rem));
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-3);
    display: none;
    flex-direction: column;
    gap: var(--space-1);
    z-index: 30;
  }

  .app-nav-link {
    display: block;
    padding: 10px 12px;
  }

  .app-nav.is-open {
    display: flex;
  }

  .widget-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .app-footer-links {
    gap: 20px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: var(--font-size-sm);
  }

  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.12rem;
  }

  h3 {
    font-size: var(--font-size-base);
  }
}