/* ═══════════════════════════════════════════════════════════════════════
   AE Gallery — Documentation pages
   ─────────────────────────────────────────────────────────────────────
   Long-form doc chrome. Hero + sectioned content + table of contents.
   Used by /docs/packaging. Reusable for future doc pages.
   ═══════════════════════════════════════════════════════════════════════ */

body.ae-docs {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--ae-text);
  background: var(--ae-grey-light);
  margin: 0;
  min-height: 100vh;
}

#loading {
  padding: 64px 24px;
  color: var(--ae-text-muted);
  font-size: 14px;
  text-align: center;
}

/* ── Header ─────────────────────────────────────────────────────── */
.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--ae-ink-950, #0E0B2E);
  color: #fff;
}
.docs-header-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.docs-header-logo img { height: 20px; width: auto; display: block; }
.docs-header-divider {
  width: 1px; height: 18px;
  background: rgba(255,255,255,0.22);
}
.docs-header-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.68);
}
.docs-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}
.docs-user img {
  width: 28px; height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.2);
}
.docs-user a {
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-weight: 500;
}
.docs-user a:hover { color: #fff; }

/* ── Main + hero ────────────────────────────────────────────────── */
.docs-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 32px 72px;
}

.docs-hero {
  margin-bottom: 56px;
}
.docs-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ae-purple);
  padding: 4px 10px;
  background: color-mix(in srgb, var(--ae-purple) 10%, transparent);
  border-radius: 999px;
  margin-bottom: 20px;
}
.docs-hero h1 {
  font-size: clamp(32px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin: 0 0 18px;
  max-width: 720px;
}
.docs-lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ae-text-secondary);
  max-width: 680px;
  margin: 0 0 28px;
}
.docs-lede code {
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  padding: 1px 7px;
  border-radius: 5px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 14px;
  color: var(--ae-purple);
}

.docs-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 12px;
}
.docs-toc a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ae-text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 140ms ease;
}
.docs-toc a:hover {
  color: var(--ae-purple);
  background: color-mix(in srgb, var(--ae-purple) 8%, transparent);
}

/* ── Sections ───────────────────────────────────────────────────── */
.docs-section {
  padding: 40px 0 16px;
  border-top: 1px solid var(--ae-grey-border);
}
.docs-section:first-of-type { border-top: 0; padding-top: 0; }
.docs-section h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  scroll-margin-top: 24px;
}
.docs-section h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
}
.docs-section p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ae-text-secondary);
  margin: 0 0 14px;
}
.docs-section p code,
.docs-section li code {
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--ae-purple);
}
.docs-section a {
  color: var(--ae-purple);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.docs-section a:hover { color: #4A3EC1; }

.docs-muted {
  color: var(--ae-text-muted);
  font-size: 13.5px !important;
  line-height: 1.6 !important;
}

/* ── Two-up quick-start cards ───────────────────────────────────── */
.docs-two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.docs-card {
  padding: 22px 24px 24px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 14px;
}
.docs-card-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ae-purple);
  margin-bottom: 8px;
}
.docs-card h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.docs-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ae-text-secondary);
  margin: 0 0 10px;
}
.docs-card p:last-child { margin-bottom: 0; }

/* ── Claude prompt block ────────────────────────────────────────── */
.docs-prompt {
  margin: 18px 0;
  border: 1px solid var(--ae-grey-border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.docs-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--ae-ink-950, #0E0B2E);
  color: #fff;
}
.docs-prompt-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.68);
}
.docs-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 140ms ease;
}
.docs-copy-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
}
.docs-prompt-body {
  margin: 0;
  padding: 18px 22px;
  font-family: 'DM Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ae-text);
  background: #FAFBFC;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow-y: auto;
}

/* ── Rules grid ─────────────────────────────────────────────────── */
.docs-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0 12px;
}
.docs-stat-tile {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 10px;
}
.docs-stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ae-text);
}
.docs-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ae-text-muted);
  margin-top: 6px;
}
.docs-stat-sub {
  font-size: 11.5px;
  color: var(--ae-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Lists ──────────────────────────────────────────────────────── */
.docs-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-list li {
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ae-text-secondary);
}
.docs-list-muted li { background: var(--ae-grey-light); }
.docs-list-code li { font-family: 'DM Mono', ui-monospace, monospace; font-size: 13px; }
.docs-pattern {
  display: inline-block;
  background: #F6F3FF !important;
  border: 1px solid color-mix(in srgb, var(--ae-purple) 18%, transparent) !important;
  color: var(--ae-purple) !important;
  padding: 1px 7px !important;
  border-radius: 4px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12.5px;
  margin-right: 4px;
}

/* ── Types grid ─────────────────────────────────────────────────── */
.docs-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.docs-type-card {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 10px;
}
.docs-type-head {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ae-text);
}
.docs-type-sub {
  font-size: 12.5px;
  color: var(--ae-text-muted);
  margin: 4px 0 10px;
}
.docs-type-mimes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.docs-type-mimes code {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  background: var(--ae-grey-light) !important;
  border: 1px solid var(--ae-grey-border) !important;
  color: var(--ae-text-secondary) !important;
  padding: 2px 6px !important;
  border-radius: 4px;
}

/* ── Table ──────────────────────────────────────────────────────── */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: 10px;
  overflow: hidden;
  margin: 16px 0;
  font-size: 13.5px;
}
.docs-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ae-text-muted);
  background: var(--ae-grey-light);
  border-bottom: 1px solid var(--ae-grey-border);
}
.docs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ae-grey-border);
  vertical-align: top;
  color: var(--ae-text-secondary);
  line-height: 1.5;
}
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table code {
  background: var(--ae-grey-light) !important;
  border: 1px solid var(--ae-grey-border) !important;
  padding: 1px 6px !important;
  border-radius: 4px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ae-text);
}
.docs-status-ok   { color: #15803D; font-weight: 700; }
.docs-status-warn { color: #B45309; font-weight: 700; }
.docs-status-bad  { color: #991B1B; font-weight: 700; }

/* ── Folder structure pre ───────────────────────────────────────── */
.docs-structure {
  font-family: 'DM Mono', ui-monospace, 'SF Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  padding: 18px 22px;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: 10px;
  margin: 12px 0 0;
  color: var(--ae-text);
  white-space: pre;
  overflow-x: auto;
}

/* ── Troubleshoot ───────────────────────────────────────────────── */
.docs-troubleshoot {
  margin: 20px 0;
}
.docs-troubleshoot dt {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ae-text);
  margin: 22px 0 6px;
}
.docs-troubleshoot dt:first-child { margin-top: 0; }
.docs-troubleshoot dd {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ae-text-secondary);
}
.docs-troubleshoot code {
  background: var(--ae-grey-light) !important;
  border: 1px solid var(--ae-grey-border) !important;
  padding: 1px 6px !important;
  border-radius: 4px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ae-purple);
}

/* ── Footer ─────────────────────────────────────────────────────── */
.docs-footer {
  margin-top: 80px;
  border-top: 1px solid var(--ae-grey-border);
  background: #fff;
}
.docs-footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--ae-text-muted);
  flex-wrap: wrap;
}
.docs-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ae-text-secondary);
}
.docs-footer-brand strong {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--ae-text);
}
.docs-footer-meta code {
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ae-text);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .docs-main { padding: 32px 20px 48px; }
  .docs-header { padding: 12px 20px; flex-wrap: wrap; }
  .docs-hero h1 { font-size: 28px; }
  .docs-footer-inner { padding: 20px; flex-direction: column; align-items: flex-start; }
}
