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

:root {
  --bg:       #f8f9fb;
  --surface:  #ffffff;
  --primary:  #2d2a6e;
  --accent:   #5b5bd6;
  --accent-light: #ededfc;
  --text:     #1a1a2e;
  --muted:    #64648a;
  --border:   #ddddf0;
  --code-bg:  #f0f0f8;
  --radius:   8px;
  --shadow:   0 1px 4px rgba(45,42,110,.08);
}

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  color: var(--primary);
  line-height: 1.25;
  margin-bottom: .5rem;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }
p  { margin-bottom: 1rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: .3rem; }

code, kbd {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace;
  font-size: .875em;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
pre code { background: none; padding: 0; font-size: .85rem; }

/* ── Layout ───────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.05rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-header .logo img { height: 32px; width: auto; }
.site-header .logo:hover { text-decoration: none; }

nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
nav a {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .15s;
}
nav a:hover, nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

.site-main {
  flex: 1;
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ── Containers ───────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.container-full {
  height: calc(100vh - 57px);
  display: flex;
  flex-direction: column;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #3f3b9e 100%);
  color: white;
  padding: 4rem 1.5rem;
  text-align: center;
}
.hero h1 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.hero .tagline {
  font-size: 1.15rem;
  color: rgba(255,255,255,.85);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .6rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: opacity .15s;
  border: none;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-outline { background: transparent; color: white; border: 2px solid rgba(255,255,255,.6); }
.btn-accent  { background: var(--accent); color: white; }

/* ── Cards ────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; color: var(--primary); }
.card p  { margin-bottom: 0; color: var(--muted); font-size: .95rem; }
.card .card-icon { font-size: 1.6rem; margin-bottom: .75rem; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
th {
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 600;
  text-align: left;
  padding: .6rem .85rem;
  border-bottom: 2px solid var(--border);
}
td {
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

.badge-required {
  display: inline-block;
  background: #fee2e2;
  color: #991b1b;
  font-size: .75rem;
  font-weight: 600;
  padding: .1em .5em;
  border-radius: 4px;
}
.badge-optional {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  font-size: .75rem;
  font-weight: 600;
  padding: .1em .5em;
  border-radius: 4px;
}

/* ── Page header ──────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 1.5rem;
}
.page-header .container { padding-top: 0; padding-bottom: 0; }
.page-header h1 { margin-bottom: .3rem; }
.page-header p  { color: var(--muted); margin-bottom: 0; }

/* ── Breadcrumbs ──────────────────────────────────────────────── */
.breadcrumb {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .35rem; }

/* ── Notice / callout ─────────────────────────────────────────── */
.notice {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

/* ── Docs nav links ───────────────────────────────────────────── */
.doc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.doc-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.doc-link:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(91,91,214,.12);
  text-decoration: none;
}
.doc-link strong { display: block; color: var(--primary); margin-bottom: .25rem; }
.doc-link span { font-size: .875rem; color: var(--muted); }

/* ── Validator ────────────────────────────────────────────────── */
.validator-form {
  display: grid;
  gap: 1rem;
}
.validator-form label {
  font-weight: 600;
  color: var(--primary);
  display: block;
  margin-bottom: .35rem;
}
.validator-form select,
.validator-form textarea {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: .875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  background: var(--surface);
  color: var(--text);
}
.validator-form select { font-family: inherit; }
.validator-form textarea { height: 280px; resize: vertical; }
.validator-result {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  display: none;
}
.validator-result.pass { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.validator-result.fail { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.validator-result pre { background: transparent; border: none; padding: 0; margin: .5rem 0 0; font-size: .8rem; color: inherit; }

/* ── Swagger UI container ─────────────────────────────────────── */
.site-main:has(#swagger-ui) { display: flex; flex-direction: column; }
.swagger-wrap { flex: 1; padding: 0; }
#swagger-ui { flex: 1; }
#swagger-ui .swagger-ui .topbar { display: none; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  .site-header { flex-wrap: wrap; gap: .75rem; }
  .nav-toggle { display: flex; }
  nav {
    display: none;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
    padding: .75rem 0 .25rem;
    border-top: 1px solid var(--border);
  }
  nav.nav-open { display: flex; }
  nav a { font-size: 1rem; padding: .35rem 0; }
}
