:root {
  --primary: #4338ca;
  --secondary: #3730a3;
  --accent: #fb7185;
  --bg: #ffffff;
  --surface: #eef2ff;
  --surface-alt: #e0e7ff;
  --text: #312e81;
  --muted: #5d6a80;
  --border: #c7d2fe;
  --row-alt: #eef2ff;
  --radius: 6px;
  --shadow: 0 6px 24px rgba(67, 56, 202, 0.08);
  --shadow-lg: 0 12px 40px rgba(67, 56, 202, 0.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

img, svg { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(120deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  gap: 0.6rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}
.brand img { width: 34px; height: 34px; background: #fff; border-radius: 8px; padding: 4px; }
.nav-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
}
.nav-primary a {
  color: #fff;
  text-decoration: none;
  font-size: 0.94rem;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.nav-primary a:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 55%, #6366f1 100%);
  color: #fff;
  padding: 2.6rem 0 2.2rem;
  border-bottom: 5px solid var(--accent);
}
.hero h1 {
  margin: 0 0 0.6rem;
  font-size: 1.9rem;
  line-height: 1.2;
  font-weight: 800;
}
.hero .byline {
  color: #dbe1ff;
  font-size: 0.93rem;
  margin: 0.35rem 0 1rem;
}
.hero p.lede {
  font-size: 1.05rem;
  max-width: 780px;
  margin: 0 0 0.4rem;
  color: #eef2ff;
}
.hero .cta-row {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.btn {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-primary {
  background: #be123c;
  color: #fff;
}
.btn-primary:hover { color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
}
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,0.22); }

/* Content */
main.content { padding: 2rem 0 3rem; }

.content h2 {
  font-size: 1.45rem;
  margin: 2.2rem 0 0.75rem;
  padding-left: 0.85rem;
  border-left: 5px solid var(--accent);
  line-height: 1.25;
  color: var(--secondary);
}
.content h3 {
  font-size: 1.14rem;
  margin: 1.4rem 0 0.5rem;
  color: var(--primary);
}
.content p { margin: 0 0 1rem; }

/* Lists */
.content ul, .content ol { margin: 0.4rem 0 1.2rem; padding-left: 1.2rem; }
.content ul { list-style: none; padding-left: 0; }
.content ul li {
  padding-left: 1.6rem;
  position: relative;
  margin-bottom: 0.5rem;
}
.content ul li::before {
  content: "\27A4";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}
.content ol {
  list-style: none;
  counter-reset: cnt;
  padding-left: 0;
}
.content ol li {
  counter-increment: cnt;
  padding-left: 2.4rem;
  position: relative;
  margin-bottom: 0.6rem;
}
.content ol li::before {
  content: counter(cnt);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(251,113,133,0.35);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1.2rem 0 1.6rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.content table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  font-size: 0.95rem;
  min-width: 480px;
}
.content th {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-weight: 600;
  border-bottom: 3px solid var(--accent);
}
.content td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.content tr:nth-child(even) td { background: var(--row-alt); }

/* ToC */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  margin: 1.5rem 0 1.8rem;
}
.toc strong {
  display: block;
  color: var(--secondary);
  font-size: 0.98rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.toc ol {
  columns: 2;
  column-gap: 1.4rem;
  padding: 0;
  margin: 0;
}
.toc ol li { padding-left: 1.8rem; margin-bottom: 0.35rem; }
.toc ol li::before {
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.72rem;
}
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .toc ol { columns: 1; }
}

/* FAQ */
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 0.85rem 2.4rem 0.85rem 1rem;
  font-weight: 600;
  position: relative;
  color: var(--secondary);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "\25BC";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  transition: transform 0.2s;
  font-size: 0.75rem;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.faq details > *:not(summary) {
  padding: 0 1rem 1rem;
}

/* Callout */
.callout {
  background: var(--surface-alt);
  border-left: 5px solid var(--accent);
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  margin: 1.2rem 0 1.4rem;
}
.callout strong { color: var(--secondary); }

/* Figure */
.figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.4rem 0;
}
.figure svg { margin: 0 auto; }
.figure figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

/* Author box */
.author-box {
  margin: 2.4rem 0 1.2rem;
  padding: 1.2rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.author-box img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid var(--accent);
}
.author-box .who { font-weight: 700; color: var(--secondary); }
.author-box .role { color: var(--primary); font-size: 0.9rem; margin-bottom: 0.4rem; }
.author-box .bio { color: var(--text); font-size: 0.94rem; margin: 0; }

/* Byline */
.byline {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0.4rem 0 1rem;
}

/* Footer */
.site-footer {
  background: var(--secondary);
  color: #e0e7ff;
  padding: 2rem 0 1.4rem;
  margin-top: 3rem;
  font-size: 0.93rem;
}
.site-footer a { color: #fecdd3; }
.site-footer .foot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}
.site-footer h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 0.6rem;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 0.3rem; }
.site-footer .legal {
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 1rem;
  color: #c7d2fe;
  font-size: 0.85rem;
}

/* Utility */
.small { font-size: 0.9rem; color: var(--muted); }

@media (min-width: 700px) {
  .hero h1 { font-size: 2.3rem; }
  .content h2 { font-size: 1.65rem; }
}
@media (min-width: 980px) {
  .hero h1 { font-size: 2.6rem; }
  body { font-size: 17px; }
}

/* a11y additions */
.skip-link{position:absolute;left:-9999px;top:0;background:var(--primary);color:#fff;padding:10px 16px;border-radius:4px;z-index:1000;text-decoration:none;font-weight:700}
.skip-link:focus{left:12px;top:12px}
a:focus-visible,button:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion: reduce){*,*::before,*::after{transition-duration:.01ms !important;animation-duration:.01ms !important}}
