/* ============================================================
   CartOS Developer Portal – Global Styles
   Color Palette: #0d2137 → #1a5fb4 → #3584e4 → #62a0ea
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --blue-900: #0d2137; --blue-800: #102a45; --blue-700: #1a4971;
    --blue-600: #1a5fb4; --blue-500: #3584e4; --blue-400: #62a0ea;
    --blue-300: #99c1f1; --blue-200: #c0d8f7; --blue-100: #daeaf8; --blue-50: #edf4fc;
    --slate-900: #0f172a; --slate-800: #1e293b; --slate-700: #334155;
    --slate-600: #475569; --slate-500: #64748b; --slate-400: #94a3b8;
    --slate-300: #cbd5e1; --slate-200: #e2e8f0; --slate-100: #f1f5f9; --slate-50: #f8fafc;
    --green-500: #22c55e; --green-100: #dcfce7;
    --amber-500: #f59e0b; --amber-100: #fef3c7;
    --red-500: #ef4444; --red-100: #fee2e2;
    --purple-500: #8b5cf6; --purple-100: #ede9fe;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); color: var(--slate-800); background: var(--slate-50); line-height: 1.65; font-size: 16px; }
a { color: var(--blue-600); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--blue-500); }
img { max-width: 100%; display: block; }

/* ── Navigation ───────────────────────────────────────────── */
.site-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(255,255,255,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--slate-200); transition: box-shadow 0.3s; }
.site-nav.scrolled { box-shadow: var(--shadow-md); }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--blue-900); text-decoration: none; }
.nav-logo { width: 28px; height: 28px; background: linear-gradient(135deg, var(--blue-600), var(--blue-400)); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 0.7rem; flex-shrink: 0; }
.nav-brand .sep { color: var(--slate-300); font-weight: 300; margin: 0 2px; }
.nav-brand .sub { color: var(--blue-500); font-weight: 500; font-size: 0.95rem; }
.nav-links { display: flex; align-items: center; gap: 0.2rem; }
.nav-links a { padding: 0.45rem 0.8rem; font-size: 0.88rem; font-weight: 500; color: var(--slate-600); border-radius: var(--radius-sm); transition: all 0.2s; }
.nav-links a:hover { color: var(--blue-600); background: var(--blue-50); }
.nav-links a.active { color: var(--blue-600); background: var(--blue-50); }
.nav-cta { background: var(--blue-600) !important; color: #fff !important; padding: 0.45rem 1rem !important; border-radius: var(--radius-sm) !important; font-weight: 600 !important; font-size: 0.85rem !important; }
.nav-cta:hover { background: var(--blue-500) !important; color: #fff !important; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-toggle svg { width: 24px; height: 24px; color: var(--slate-700); }
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--slate-200); flex-direction: column; padding: 1rem; gap: 0.25rem; box-shadow: var(--shadow-lg); }
    .nav-links.open { display: flex; }
    .nav-links a { width: 100%; padding: 0.75rem 1rem; }
}

/* ── Page Hero ────────────────────────────────────────────── */
.page-hero { padding: 7.5rem 2rem 3.5rem; background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 50%, var(--blue-600) 100%); color: #fff; position: relative; overflow: hidden; }
.page-hero::before { content: ''; position: absolute; top: -50%; right: -20%; width: 80%; height: 200%; background: radial-gradient(ellipse, rgba(98,160,234,0.12) 0%, transparent 70%); pointer-events: none; }
.page-hero::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent); }
.hero-inner { max-width: 1280px; margin: 0 auto; position: relative; z-index: 1; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); padding: 0.3rem 0.9rem; border-radius: 999px; font-size: 0.78rem; font-weight: 500; margin-bottom: 1.25rem; color: var(--blue-300); }
.page-hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; line-height: 1.15; margin-bottom: 0.85rem; letter-spacing: -0.02em; }
.page-hero .lead { font-size: 1.1rem; color: var(--blue-200); max-width: 600px; line-height: 1.7; }

/* ── Content Layout ───────────────────────────────────────── */
.content-wrap { max-width: 1280px; margin: 0 auto; padding: 3rem 2rem 6rem; }
.content-with-sidebar { display: grid; grid-template-columns: 220px 1fr; gap: 3rem; align-items: start; }
@media (max-width: 900px) { .content-with-sidebar { grid-template-columns: 1fr; } .sidebar-nav { display: none; } }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar-nav { position: sticky; top: 88px; max-height: calc(100vh - 100px); overflow-y: auto; }
.sidebar-nav h4 { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-400); margin-bottom: 0.6rem; padding-left: 0.75rem; }
.sidebar-nav ul { list-style: none; margin-bottom: 1.75rem; }
.sidebar-nav li a { display: block; padding: 0.35rem 0.75rem; font-size: 0.84rem; color: var(--slate-500); border-radius: var(--radius-sm); border-left: 2px solid transparent; transition: all 0.15s; }
.sidebar-nav li a:hover { color: var(--blue-600); background: var(--blue-50); }
.sidebar-nav li a.active { color: var(--blue-600); background: var(--blue-50); border-left-color: var(--blue-500); font-weight: 500; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content h2 { font-size: 1.55rem; font-weight: 700; color: var(--slate-900); margin: 3rem 0 1rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--slate-200); letter-spacing: -0.01em; }
.main-content h2:first-child { margin-top: 0; }
.main-content h3 { font-size: 1.15rem; font-weight: 600; color: var(--slate-800); margin: 2rem 0 0.65rem; }
.main-content h4 { font-size: 0.95rem; font-weight: 600; color: var(--slate-700); margin: 1.5rem 0 0.5rem; }
.main-content p { margin-bottom: 1rem; color: var(--slate-600); line-height: 1.75; }
.main-content ul, .main-content ol { margin: 0 0 1.25rem 1.5rem; color: var(--slate-600); }
.main-content li { margin-bottom: 0.35rem; line-height: 1.65; }

/* ── Code Blocks ──────────────────────────────────────────── */
pre { background: var(--slate-900); color: #e2e8f0; border-radius: var(--radius-md); padding: 1.15rem 1.35rem; overflow-x: auto; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.7; margin: 1rem 0 1.5rem; border: 1px solid rgba(255,255,255,0.06); }
code { font-family: var(--font-mono); font-size: 0.84em; background: var(--slate-100); color: var(--blue-700); padding: 0.12em 0.4em; border-radius: 4px; border: 1px solid var(--slate-200); }
pre code { background: none; color: inherit; padding: 0; border: none; border-radius: 0; font-size: inherit; }
.code-block { position: relative; margin: 1rem 0 1.5rem; }
.code-label { display: inline-block; background: var(--slate-800); color: var(--slate-400); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; padding: 0.3rem 0.85rem; border-radius: var(--radius-md) var(--radius-md) 0 0; letter-spacing: 0.03em; text-transform: uppercase; }
.code-block pre { margin-top: 0; border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md); }
.cm { color: #64748b; } .kw { color: #93c5fd; } .st { color: #86efac; } .nu { color: #fbbf24; } .pr { color: #c4b5fd; } .fn { color: #67e8f9; } .tg { color: #fca5a5; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--slate-200); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th { text-align: left; padding: 0.7rem 1rem; background: var(--slate-100); color: var(--slate-700); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--slate-200); }
tbody td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--slate-100); color: var(--slate-600); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--blue-50); }

/* ── Cards ─────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-md); padding: 1.5rem; transition: all 0.2s; }
.card:hover { border-color: var(--blue-300); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; color: var(--slate-900); }
.card p { font-size: 0.88rem; color: var(--slate-500); margin: 0; line-height: 1.6; }
.card-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; font-size: 1.1rem; }

/* ── Method Badges ─────────────────────────────────────────── */
.method-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; line-height: 1.6; }
.method-get { background: var(--green-100); color: #15803d; }
.method-post { background: var(--blue-100); color: var(--blue-700); }
.method-patch { background: var(--amber-100); color: #92400e; }
.method-delete { background: var(--red-100); color: #b91c1c; }
.scope-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; background: var(--purple-100); color: var(--purple-500); }

/* ── Endpoint Blocks (Expandable) ──────────────────────────── */
.endpoint { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-md); margin: 1rem 0; overflow: hidden; }
.endpoint-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.15rem; border-bottom: 1px solid transparent; cursor: pointer; transition: background 0.15s; }
.endpoint-header:hover { background: var(--slate-50); }
.endpoint-path { font-family: var(--font-mono); font-size: 0.84rem; font-weight: 500; color: var(--slate-800); }
.endpoint-desc { font-size: 0.82rem; color: var(--slate-500); margin-left: auto; }
.endpoint-chevron { color: var(--slate-400); transition: transform 0.2s; font-size: 0.75rem; margin-left: 0.5rem; }
.endpoint.open .endpoint-chevron { transform: rotate(90deg); }
.endpoint-body { padding: 1.15rem 1.25rem; display: none; border-top: 1px solid var(--slate-100); }
.endpoint.open .endpoint-body { display: block; }

/* ── Callouts ──────────────────────────────────────────────── */
.callout { padding: 1rem 1.25rem; border-radius: var(--radius-md); margin: 1.25rem 0; font-size: 0.88rem; line-height: 1.65; display: flex; gap: 0.75rem; align-items: flex-start; }
.callout-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 1px; }
.callout-info { background: var(--blue-50); border: 1px solid var(--blue-200); color: var(--blue-700); }
.callout-warn { background: var(--amber-100); border: 1px solid #fcd34d; color: #92400e; }
.callout-success { background: var(--green-100); border: 1px solid #86efac; color: #15803d; }
.callout-danger { background: var(--red-100); border: 1px solid #fca5a5; color: #b91c1c; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--slate-700); margin-bottom: 0.4rem; }
.form-hint { font-size: 0.78rem; color: var(--slate-400); margin-top: 0.25rem; }
.form-required { color: var(--red-500); }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.6rem 0.85rem; font-size: 0.9rem; font-family: var(--font-body); border: 1px solid var(--slate-300); border-radius: var(--radius-sm); background: #fff; color: var(--slate-800); transition: all 0.2s; outline: none; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(53,132,228,0.12); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-checkbox-group { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.35rem; }
.form-checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--slate-600); cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.65rem 1.5rem; font-size: 0.9rem; font-weight: 600; font-family: var(--font-body); border: none; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-500); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: #fff; color: var(--slate-700); border: 1px solid var(--slate-300); }
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-400); color: var(--slate-700); }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }

/* ── Directory Tree ────────────────────────────────────────── */
.dir-tree { background: var(--slate-900); color: var(--slate-300); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.8; margin: 1rem 0 1.5rem; overflow-x: auto; }
.dir-tree .folder { color: var(--blue-400); }
.dir-tree .file { color: var(--slate-400); }
.dir-tree .hl { color: var(--green-500); }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer { background: var(--blue-900); color: var(--blue-300); padding: 3rem 2rem 2rem; font-size: 0.85rem; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-brand { font-weight: 700; font-size: 1rem; color: #fff; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--blue-300); font-size: 0.82rem; }
.footer-links a:hover { color: #fff; }
.footer-copy { color: var(--slate-500); font-size: 0.78rem; width: 100%; text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.08); }

/* ── Utility ───────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.5s ease both; }
.fade-up-1 { animation-delay: 0.05s; } .fade-up-2 { animation-delay: 0.1s; } .fade-up-3 { animation-delay: 0.15s; }
