/* public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* TITANIUM PALETTE */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --brand: #4f46e5;       /* Indigo */
  --brand-dark: #4338ca;
  --brand-dim: rgba(79, 70, 229, 0.08);

  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;

  /* ANIMATIONS */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* SHADOWS */
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 25px 50px -12px rgba(0, 0, 0, 0.15);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

/* ============================================================================
   GLOBAL MOBILE SAFETY (NEW)
   Prevent page-wide horizontal scrolling caused by any overflowing child.
   ============================================================================ */
html, body { max-width: 100%; overflow-x: visible; }
main { overflow-x: clip; }


body {
  margin: 0; color: var(--text-primary); font-family: var(--font-sans);
  line-height: 1.5; -webkit-font-smoothing: antialiased; background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.03), transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.03), transparent 20%);
  min-height: 100vh;
}

button { cursor: pointer; }

.shell { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }

/* --- NAV --- */
.nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.nav-inner { display: flex; justify-content: space-between; align-items: center; }

.brand {
  font-family: var(--font-sans); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.04em;
  color: var(--text-primary); text-decoration: none; display: flex; align-items: center; gap: 10px;
  transition: opacity 0.2s;
}
.brand:hover { opacity: 0.8; }

.logo-icon {
  width: 24px; height: 24px; border: 2px solid var(--brand); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 10px var(--brand-dim);
}
.logo-icon::after { content: ""; width: 8px; height: 8px; background: var(--brand); border-radius: 1px; }
.brand span.io { color: var(--text-tertiary); font-weight: 500; }

.nav-links { display: flex; gap: 24px; font-size: 0.9rem; font-weight: 600; }
.nav-links a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--brand); }

.nav-btn {
  background: var(--text-primary); color: white; padding: 8px 18px;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; text-decoration: none; border: none;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}
.nav-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 15px rgba(15, 23, 42, 0.2); opacity: 0.95; }
/* Active nav button (current page) */
.nav-btn-current {
  pointer-events: none;
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  opacity: 0.95;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* --- HERO & LANDING PAGE ELEMENTS --- */
.hero { padding: 90px 0 60px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; background: white; color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 700; padding: 6px 14px; border-radius: 99px;
  margin-bottom: 30px; border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card); letter-spacing: 0.02em; text-transform: uppercase;
  transition: border-color 0.2s; cursor: default;
}
.badge:hover { border-color: var(--brand); }
.badge span { color: var(--brand); }

h1 {
  font-size: 4rem; line-height: 1.05; margin: 0 0 24px;
  letter-spacing: -0.04em; font-weight: 800; color: var(--text-primary);
}
.subtitle {
  font-size: 1.25rem; color: var(--text-secondary); margin: 0 auto 50px;
  font-weight: 400; max-width: 680px; line-height: 1.6;
}

.maxim {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-tertiary);
  letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 60px;
}

/* MARKETING CARDS */
.visual-card {
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 32px;
  height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth), border-color 0.2s;
}
.visual-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--border-strong);
}

.card-label {
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-tertiary); margin-bottom: 24px; display: flex; align-items: center; gap: 8px;
}

/* Contain horizontal scroll inside code blocks (NEW) */
.code-window {
  background: #1e1e20; border-radius: 10px; padding: 24px;
  font-family: var(--font-mono); font-size: 0.85rem; color: #a1a1aa; line-height: 1.7;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.kw { color: #c084fc; } .str { color: #86efac; } .fn { color: #60a5fa; } .com { color: #52525b; }

/* GRID & SECTIONS */
.section-header { margin: 100px 0 40px; text-align: center; }
.section-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 10px; color: var(--text-primary); }
.section-sub { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 12px; padding: 24px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-hover); }

.feature-title { font-weight: 700; font-size: 1rem; margin-bottom: 8px; }
.feature-desc { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* --- GLOBAL BUTTONS & INPUTS --- */
.btn-pill {
  background: var(--brand); color: white; border: none; padding: 0 24px;
  border-radius: 99px; font-weight: 600; cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  font-size: 0.9rem; white-space: nowrap; height: 100%;
}
.btn-pill:hover { background: var(--brand-dark); transform: scale(1.02); }

.btn-pill.clear { background: transparent; color: var(--text-tertiary); padding: 0 12px; }
.btn-pill.clear:hover { color: #b91c1c; background: #fee2e2; transform: scale(1); }

.icon-btn {
  background: transparent; border: none; cursor: pointer; color: var(--text-tertiary);
  width: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  transition: all 0.2s;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-page); transform: scale(1.1); }

.magic-bar {
  background: white; border: 1px solid var(--border-light);
  border-radius: 99px; padding: 6px;
  max-width: 540px; margin: 0 auto 15px;
  box-shadow: var(--shadow-float);
  display: flex; position: relative;
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s;
}
.magic-bar:hover { transform: translateY(-2px); box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.15); border-color: var(--border-strong); }

.key-input {
  flex: 1; border: none; background: transparent; border-radius: 99px;
  padding: 0 24px; font-family: var(--font-mono); font-size: 0.95rem; color: var(--text-primary);
  outline: none; letter-spacing: 0.02em; height: 48px;
}
.key-input::placeholder { color: var(--text-tertiary); }

.action-area { position: absolute; right: 6px; top: 6px; bottom: 6px; display: flex; gap: 6px; }

/* --- DASHBOARD COMPONENTS --- */
.dash-container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 80vh;
}

.stack-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 32px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stack-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -0.02em; }
.card-desc { font-size: 0.9rem; color: var(--text-secondary); margin-top: 4px; }

/* Stats & Usage */
.stats-row {
  display: flex; gap: 40px; margin-top: 24px; padding-top: 24px;
  border-top: 1px solid var(--border-light); margin-bottom: 24px;
}
.stat-item { flex: 1; }
.stat-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  color: var(--text-tertiary); letter-spacing: 0.05em; margin-bottom: 6px;
}
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); font-family: var(--font-mono); }

.usage-track {
  width: 100%; height: 8px; background-color: #f1f5f9;
  border-radius: 99px; overflow: hidden; margin-bottom: 16px;
}
.usage-bar {
  height: 100%; width: 0%; border-radius: 99px;
  transition: width 0.4s ease, background-color 0.4s ease;
}
.bar-green { background-color: #22c55e; }
.bar-amber { background-color: #f59e0b; }
.bar-red   { background-color: #ef4444; }

.limit-warning-text {
  font-size: 0.85rem; color: #ef4444; font-weight: 600;
  margin-top: -8px; display: flex; align-items: center; gap: 6px;
}

/* Vertical Plan Stack */
.plan-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

.plan-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border: 1px solid var(--border-light); border-radius: 12px;
  background: white; transition: all 0.2s ease;
}
.plan-row:not(.current-plan):hover { border-color: var(--brand); background-color: #f8fafc; }
.plan-row.current-plan { background-color: #f0fdf4; border-color: #22c55e; }

.plan-info { display: flex; flex-direction: column; }
.plan-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.plan-meta { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

/* Security Rows */
.security-stack { display: flex; flex-direction: column; }
.security-row { padding: 24px 0; }
.security-row:first-child { padding-top: 0; }
.security-row:last-child {
  padding-bottom: 0; border-top: 1px dashed var(--border-light);
  margin-top: 24px; padding-top: 24px;
}
.security-header { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; color: var(--text-primary); }
.security-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; max-width: 90%; }

/* Dashboard Toolbar & Tables */
.devices-toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.input-std {
  padding: 8px 16px; border: 1px solid var(--border-light); border-radius: 99px;
  font-family: var(--font-mono); font-size: 0.85rem; outline: none; background: white; transition: border-color 0.2s;
}
.input-std:focus { border-color: var(--brand); }

.select-std {
  padding: 8px 32px 8px 16px; border: 1px solid var(--border-light); border-radius: 99px;
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary); background-color: white; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat; background-position: right 12px top 50%; background-size: 10px auto;
}
.select-std:focus { border-color: var(--brand); color: var(--text-primary); }

.table-wrap { overflow-x: auto; overflow-y: auto; max-height: 400px; border: 1px solid var(--border-light); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  position: sticky; top: 0; z-index: 10; background: #f8fafc; text-align: left;
  padding: 12px 16px; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border-light);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-primary); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.mono-cell { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); }
.time-cell { font-size: 0.85rem; color: var(--text-tertiary); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.status-active { background: #dcfce7; color: #166534; }
.status-revoked { background: #fee2e2; color: #991b1b; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-banner {
  border-radius: 12px; padding: 12px 16px; margin-bottom: 24px;
  font-size: 0.9rem; border: 1px solid transparent; display: none;
}
.status-banner-limit { border-color: #f97316; background: #fff7ed; color: #9a3412; }
.status-banner-frozen { border-color: #fb7185; background: #fef2f2; color: #991b1b; }
.status-banner-grace { border-color: #fbbf24; background: #fffbeb; color: #92400e; }

.action-btn {
  background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary);
  padding: 4px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; margin-left: 4px;
}
.action-btn:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.action-btn.danger { border-color: #fca5a5; color: #b91c1c; }
.action-btn.danger:hover { border-color: #ef4444; color: #fff; background: #ef4444; }

/* Utilities & Footer */
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.link-text { color: inherit; text-decoration: underline; cursor: pointer; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 0.85rem; color: var(--text-secondary); }

footer {
  margin-top: 100px; padding: 40px 0; border-top: 1px solid var(--border-light);
  text-align: center; color: var(--text-tertiary); font-size: 0.85rem;
}
footer a { color: var(--text-secondary); text-decoration: none; margin: 0 12px; transition: color 0.2s; }
footer a:hover { color: var(--text-primary); }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e1e20; color: white; padding: 10px 24px; border-radius: 99px;
  font-weight: 600; font-size: 0.9rem; opacity: 0; transition: all 0.2s; z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- DOCS PAGE SPECIFIC --- */
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: 60px; margin-top: 40px; align-items: start; }
.sidebar { position: sticky; top: 100px; height: calc(100vh - 100px); overflow-y: auto; padding-bottom: 40px; }
.sidebar-group { margin-bottom: 24px; }
.sidebar-label { font-size: 0.75rem; font-weight: 800; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.sidebar-link { display: block; font-size: 0.9rem; color: var(--text-secondary); text-decoration: none; margin-bottom: 8px; transition: color 0.2s; }
.sidebar-link:hover { color: var(--brand); }
.doc-section { margin-bottom: 80px; scroll-margin-top: 100px; }
.doc-title { font-size: 2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 16px; letter-spacing: -0.03em; }
.doc-h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin: 30px 0 12px; }
.doc-p { font-size: 1rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; max-width: 720px; }
.doc-ul { margin-bottom: 20px; padding-left: 20px; max-width: 720px; }
.doc-li { margin-bottom: 10px; color: var(--text-secondary); font-size: 1rem; line-height: 1.6; }
.doc-li code { font-size: 0.9em; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; color: var(--text-primary); font-family: var(--font-mono); }
.method { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; padding: 4px 8px; border-radius: 4px; text-transform: uppercase; display: inline-block; margin-right: 12px; }
.get { background: #dcfce7; color: #15803d; }
.post { background: #dbeafe; color: #1e40af; }

/* Allow endpoint header to wrap + prevent overflow */
.endpoint-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: white; border: 1px solid var(--border-light);
  padding: 12px 16px; border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-primary);
  margin-bottom: 20px; box-shadow: var(--shadow-card);
}
.path { color: var(--text-secondary); font-weight: 500; word-break: break-word; overflow-wrap: anywhere; }

.timeline-item { display: flex; gap: 16px; margin-bottom: 24px; }
.timeline-num { width: 28px; height: 28px; background: var(--bg-page); border: 1px solid var(--border-strong); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; }
.timeline-content h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.timeline-content p { margin: 0; font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; }

.info-card { background: white; border: 1px solid var(--border-light); border-radius: 12px; padding: 18px; box-shadow: var(--shadow-card); max-width: 860px; }
.info-card-title { font-weight: 800; color: var(--text-primary); margin-bottom: 10px; }
.info-card-sub { color: var(--text-secondary); line-height: 1.7; margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-chip { background: var(--bg-subtle); border: 1px solid var(--border-light); border-radius: 12px; padding: 14px; }
.info-chip h4 { margin: 0 0 6px; font-size: 0.95rem; font-weight: 800; color: var(--text-primary); }
.info-chip p { margin: 0; font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; }

/* ============================================================================
   DOCS-ONLY: GITHUB-LIKE CODE BLOCKS (OPTION A)
   ============================================================================ */
.docs-layout .code-window {
  background: #0b1220;
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 12px;
  padding: 0;
  box-shadow: none;
}

.docs-layout .code-window pre {
  margin: 0;
  padding: 14px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #e5e7eb;
}

.docs-layout .code-window code { display: block; }

.docs-layout .copy-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.82);
  border-radius: 8px;
}

/* --- MOBILE RESPONSIVE LOGIC (FIXED: NO GLOBAL GRID->FLEX REWRITES) --- */
@media (max-width: 900px) {

  /* Keep shell comfortable on small screens */
  .shell { padding: 0 16px; }

  /* Nav: allow wrapping but keep behavior consistent */
  .nav-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
    margin-left: 0;
  }

  /* Links row */
  .nav-links {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    gap: 0;
  }
  .nav-links a {
    font-size: 0.9rem;
    padding: 5px;
  }

  /* Typography */
  h1 { font-size: 2rem; line-height: 1.2; }
  .hero { padding: 30px 0 20px; }

  /* Docs layout: 1 column + hide sidebar */
  .docs-layout { grid-template-columns: 1fr; gap: 28px; margin-top: 20px; }
  .sidebar { display: none !important; }
  .info-grid { grid-template-columns: 1fr; }

  /* MAGIC BAR MOBILE FIX (CRITICAL) */
  .magic-bar {
    max-width: 100%;
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .action-area {
    position: static;
    right: auto; top: auto; bottom: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }
  .key-input {
    width: 100%;
    padding: 0 12px !important; /* overrides inline JS paddingRight */
    font-size: 0.85rem;
  }
  .btn-pill { height: 40px; }
  .icon-btn { width: 40px; height: 40px; }

  /* Code blocks: ensure only code scrolls horizontally */
  .code-window { width: 100%; }
  .code-window pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Docs-only tightening to feel more GitHub-like */
  .docs-layout .visual-card { padding: 18px; }
  .docs-layout .card-label { margin-bottom: 12px; }
  .docs-layout .code-window pre { padding: 12px; font-size: 0.80rem; }

  /* Dashboard mobile improvements (non-breaking) */
  .stats-row { flex-direction: column; gap: 20px; }
  .devices-toolbar { flex-direction: column; align-items: stretch; }
  .plan-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .plan-row button { width: 100%; }
}
/* ============================================================================
   DOCS MOBILE + OVERFLOW FIXES
   - Prevent code blocks from widening the page
   - Make code blocks horizontally scrollable on iOS Safari
   ============================================================================ */

/* 1) Critical: allow grid children to shrink so they don't overflow the viewport */
.docs-layout .content { min-width: 0; }
.docs-layout .visual-card { min-width: 0; }
.docs-layout .code-window { min-width: 0; }

/* 2) Make the CODE WINDOW the horizontal scroller (more reliable than pre on iOS) */
.docs-layout .code-window {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
  touch-action: pan-x;               /* tell browser horizontal panning is allowed */
}

/* 3) Keep code formatting but prevent the pre element from forcing layout overflow */
.docs-layout .code-window pre {
  margin: 0;
  white-space: pre;                  /* keep single-line curl formatting */
  overflow: visible;                 /* scroller is the parent now */
  max-width: 100%;
}

/* 4) Extra safety for very long tokens (URLs/headers) */
.docs-layout .code-window code {
  overflow-wrap: normal;
}
/* ============================================================================
   HOME MOBILE FIX: stack the 3 feature cards instead of squeezing
   ============================================================================ */
@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feature-card {
    padding: 18px;
  }
}
/* ============================================================================
   DOCS MOBILE: prevent copy button from overlapping code
   ============================================================================ */
@media (max-width: 900px) {

  /* Turn code window into a column layout */
  .docs-layout .code-window {
    position: relative;
    padding-top: 44px; /* reserve space for copy button */
  }

  /* Reposition copy button so it never covers text */
  .docs-layout .code-window .copy-btn {
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    padding: 4px 8px;
    opacity: 0.85;
  }
}
/* ============================================================================
   ARTICLES HUB (/articles) - FEED + MEDIA
   ============================================================================ */

.articles-hero {
  padding: 56px 0 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
}

.articles-title {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.articles-sub {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 720px;
}

.articles-meta {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.articles-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 26px;
  margin-top: 26px;
  align-items: start;
}

a.article-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth), border-color 0.2s;
}
a.article-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.article-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(79,70,229,0.10), rgba(14,165,233,0.06));
  border-bottom: 1px solid var(--border-light);
  object-fit: cover;
  display: block;
}

.article-body { padding: 18px 18px 16px; }

.article-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}
.article-kicker .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.article-h {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--text-primary);
}

.article-desc {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.12);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.stack { display: flex; flex-direction: column; gap: 12px; }

.stack-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0 2px;
}

.stack-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.stack-note { color: var(--text-tertiary); font-size: 0.85rem; }

a.article-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth), border-color 0.2s;
}
a.article-row:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.row-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, rgba(79,70,229,0.10), rgba(14,165,233,0.06));
  border: 1px solid var(--border-light);
}
/* Media section logos (YouTube / X) */
.row-img.media-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  opacity: 0.9;
}

.row-h {
  margin: 0 0 6px;
  font-size: 0.98rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.row-meta {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.divider {
  margin: 18px 0 0;
  border-top: 1px dashed var(--border-light);
}

@media (max-width: 900px) {
  .articles-grid { grid-template-columns: 1fr; }
  .articles-hero { flex-direction: column; align-items: flex-start; }
}
/* ============================================================================
   ARTICLE PAGES (/articles/*.html) - TYPOGRAPHY + LAYOUT
   ============================================================================ */

.article-wrap { max-width: 820px; margin: 0 auto; padding: 56px 0 20px; }
.article-head { margin-bottom: 18px; }
.article-title {
  margin: 0 0 12px;
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.article-dek {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 720px;
}
.article-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}
.article-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.12);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 28px;
}

.article-card h2 {
  margin: 28px 0 12px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.article-card p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  line-height: 1.85;
  font-size: 1rem;
}
.article-card ul {
  margin: 0 0 18px;
  padding-left: 20px;
}
.article-card li {
  margin: 0 0 10px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.article-card hr {
  border: none;
  border-top: 1px dashed var(--border-light);
  margin: 28px 0 18px;
}
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--brand);
  font-weight: 800;
}
.article-back:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .article-wrap { padding: 34px 0 10px; }
  .article-title { font-size: 2rem; }
  .article-card { padding: 18px; }
}
/* Article hero image */
/* Article hero image (force clean 16:9 crop) */
.article-hero{
  width: 100%;
  height: clamp(180px, 28vw, 360px);
  object-fit: cover;
  border-radius: 16px;
  margin: 18px 0 26px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
}

/* Related articles block */
.related {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

.related-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.related-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.related-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.related-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: white;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.related-item:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.related-item .t {
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.related-item .m {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (min-width: 900px) {
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}

