/* ============================================================
   Hygrade Connect — Developer Documentation
   ============================================================ */

:root {
  --brand:          #00569e;
  --brand-dark:     #003d72;
  --brand-light:    #3b82c9;
  --brand-tint:     #e8f1fa;
  --accent-yellow:  #f6c528;
  --accent-red:     #e64043;
  --accent-green:   #2ca14a;

  --bg:             #ffffff;
  --bg-subtle:      #f7f9fc;
  --bg-elevated:    #ffffff;
  --bg-code:        #0d1b2a;
  --bg-code-inline: #eef2f7;

  --text:           #1a1d23;
  --text-muted:     #5b6472;
  --text-subtle:    #8a94a3;
  --text-inverse:   #f5f7fa;

  --border:         #e5e9ef;
  --border-strong:  #cfd6e0;

  --shadow-sm: 0 1px 2px rgba(10, 22, 46, 0.04), 0 1px 3px rgba(10, 22, 46, 0.06);
  --shadow-md: 0 4px 6px rgba(10, 22, 46, 0.05), 0 10px 15px rgba(10, 22, 46, 0.08);
  --shadow-lg: 0 10px 15px rgba(10, 22, 46, 0.07), 0 20px 40px rgba(10, 22, 46, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --topbar-h: 72px;
  --sidebar-w: 272px;
  --content-w: 860px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }

.brand .logo { height: 44px; width: auto; display: block; }

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
}

.brand-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}
.brand-title::before {
  content: 'Connect';
  color: var(--brand);
  font-weight: 700;
}

.topbar .topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topnav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.topnav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }

.topnav .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--brand);
  color: white;
}
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); text-decoration: none; }

.mobile-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
}

/* ============================================================
   Layout (sidebar + content)
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 16px 24px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-group { margin-bottom: 22px; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar a.sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--brand);
  color: #ffffff;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, transform 0.15s;
  letter-spacing: -0.005em;
  box-shadow: 0 1px 2px rgba(0, 69, 126, 0.25);
}
.sidebar a.sidebar-cta:hover {
  background: var(--brand-dark);
  text-decoration: none;
  color: #ffffff;
  transform: translateY(-1px);
}
.sidebar a.sidebar-cta span { font-weight: 500; opacity: 0.9; }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.sidebar-status .status-dot { margin-right: 0; }

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 6px 10px;
  margin-bottom: 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.sidebar a:hover { background: var(--bg-subtle); color: var(--text); }
.sidebar a.active {
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 600;
}
.sidebar a .pill {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  border: 1px solid var(--border);
}
.sidebar a .pill-soon { background: #fef6e0; border-color: #f4dc85; color: #7a5b00; }
.sidebar a .pill-new  { background: #e6f5eb; border-color: #a8dcb6; color: #1c6a33; }

/* ============================================================
   Content
   ============================================================ */
.content {
  padding: 48px 64px 120px;
  max-width: calc(var(--content-w) + 128px);
}

.content > :first-child { margin-top: 0; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
}

h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--text);
}

h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 56px 0 14px;
  padding-top: 8px;
  color: var(--text);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 32px 0 10px;
  color: var(--text);
}

h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 24px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 32px;
  max-width: 680px;
}

p { margin: 0 0 16px; }

ul, ol { padding-left: 22px; margin: 0 0 16px; }
li { margin-bottom: 6px; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ============================================================
   Code
   ============================================================ */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

:not(pre) > code {
  background: var(--bg-code-inline);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: #0d3b7a;
  font-weight: 500;
  border: 1px solid #dfe6ef;
}

pre[class*="language-"] {
  background: var(--bg-code) !important;
  border-radius: var(--radius-md);
  padding: 18px 20px !important;
  margin: 16px 0 !important;
  font-size: 13px !important;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid #1a2a3d;
  box-shadow: var(--shadow-sm);
}

pre[class*="language-"] code {
  font-family: var(--font-mono) !important;
  background: none !important;
  padding: 0 !important;
  border: none !important;
  font-weight: 400;
}

.code-block {
  position: relative;
  margin: 16px 0;
}

.code-block .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a2a3d;
  color: #cfd6e0;
  padding: 8px 16px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: 1px solid #1a2a3d;
  border-bottom: 1px solid #334156;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.code-block .code-header + pre[class*="language-"] {
  margin-top: 0 !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-top: none;
}

.code-block .copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: 1px solid #334156;
  color: #cfd6e0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.code-block .copy-btn svg { display: block; }
.code-block .copy-btn:hover { background: #334156; color: white; }
.code-block .copy-btn.copied { background: var(--accent-green); border-color: var(--accent-green); color: white; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; margin: 16px 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0;
}

tr:last-child td { border-bottom: none; }

td code { font-size: 12.5px; }

/* ============================================================
   Callout boxes
   ============================================================ */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border: 1px solid;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
}
.callout-icon { flex-shrink: 0; font-weight: 700; font-size: 14px; line-height: 1.5; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.callout strong { color: inherit; }

.callout-note    { background: var(--brand-tint);   border-color: #bad3ea; color: #0d3b7a; }
.callout-warn    { background: #fdf4da;             border-color: #f4dc85; color: #6d5000; }
.callout-tip     { background: #e6f5eb;             border-color: #a8dcb6; color: #1c5e33; }
.callout-danger  { background: #fde8e9;             border-color: #f2b2b4; color: #8a1e22; }

/* ============================================================
   Property / definition tables (for endpoint params, etc.)
   ============================================================ */
.props {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}
.props-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.props-row:last-child { border-bottom: none; }
.props-row .name { font-family: var(--font-mono); font-weight: 600; color: var(--text); font-size: 13px; }
.props-row .type { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-left: 8px; background: var(--bg-subtle); padding: 2px 7px; border-radius: 4px; border: 1px solid var(--border); }
.props-row .required { font-size: 11px; color: var(--accent-red); font-weight: 700; margin-left: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.props-row .desc { margin-top: 6px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.tabs-nav {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs-nav button {
  background: none;
  border: none;
  padding: 12px 20px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.15s;
}
.tabs-nav button:hover { color: var(--text); }
.tabs-nav button.active {
  color: var(--brand);
  font-weight: 600;
}
.tabs-nav button.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
}
.tab-panel { padding: 20px 22px; display: none; }
.tab-panel.active { display: block; }
.tab-panel > :first-child { margin-top: 0; }
.tab-panel > :last-child { margin-bottom: 0; }

/* ============================================================
   Landing page hero
   ============================================================ */
.hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -40px -80px 0 -80px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(0, 86, 158, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(246, 197, 40, 0.08), transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(44, 161, 74, 0.05), transparent 50%);
  z-index: -1;
  pointer-events: none;
}
.hero h1 {
  font-size: 44px;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.hero .lede { font-size: 20px; max-width: 620px; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
}

/* feature grid on landing */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 24px 0 48px;
}
.feature-card {
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: block;
  color: inherit;
  text-decoration: none;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
  text-decoration: none;
}
.feature-card .fc-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
}
.fc-icon.blue   { background: var(--brand-tint);           color: var(--brand); }
.fc-icon.yellow { background: rgba(246, 197, 40, 0.15);    color: #8a6b00; }
.fc-icon.green  { background: rgba(44, 161, 74, 0.12);     color: #1c6a33; }
.fc-icon.red    { background: rgba(230, 64, 67, 0.10);     color: #a02f32; }

.feature-card h3 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.feature-card p  { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.55; }
.feature-card .fc-more {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}
.feature-card .pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef6e0;
  color: #7a5b00;
  font-weight: 700;
  border: 1px solid #f4dc85;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================
   Key / value summary boxes (e.g. SAML endpoints)
   ============================================================ */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  font-size: 14px;
}
.kv-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 16px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .kv-key { font-weight: 600; color: var(--text-muted); font-size: 13px; }
.kv-row .kv-val { font-family: var(--font-mono); font-size: 13px; color: var(--text); word-break: break-all; }
.kv-row .kv-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  justify-self: end;
}
.kv-row .kv-copy svg { display: block; }
.kv-row .kv-copy:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--text-muted); }
.kv-row .kv-copy.copied { background: var(--accent-green); border-color: var(--accent-green); color: white; }

/* Dual production / test environment rows */
.kv-row-env {
  grid-template-columns: 220px 1fr;
  padding: 8px 16px;
}
.kv-row-env .kv-key {
  align-self: center;
}
.kv-envs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.env-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.env-tag {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid;
}
.env-prod {
  background: #e8f6ec;
  color: #1c6a33;
  border-color: #a8dcb6;
}
.env-test {
  background: #fdf4da;
  color: #7a5b00;
  border-color: #f4dc85;
}
.env-line code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  word-break: break-all;
  font-weight: 400;
}
.env-line .kv-copy {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .kv-row-env { grid-template-columns: 1fr; }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  margin-top: 64px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer a { color: var(--text-muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ============================================================
   Method badges (GET/POST/etc.)
   ============================================================ */
.method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-right: 8px;
}
.method-get    { background: #e6f2ff; color: #0050a0; }
.method-post   { background: #e8f6ec; color: #1c6a33; }
.method-put    { background: #fef6e0; color: #7a5b00; }
.method-patch  { background: #fdeed9; color: #8a4a00; }
.method-delete { background: #fde8e9; color: #8a1e22; }

.endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 8px 0 14px;
  overflow-x: auto;
}

/* ============================================================
   Status indicator
   ============================================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(44, 161, 74, 0.18);
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 900px) {
  .mobile-toggle { display: inline-flex; align-items: center; }
  .topbar .topnav { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 32px 22px 80px; }
  .hero h1 { font-size: 32px; }
  .hero .lede { font-size: 17px; }
  .kv-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 14px; }
  .kv-row .kv-copy { justify-self: start; margin-top: 4px; }
}
