/* Shared card surface (matches product pages) */
.card-style {
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

/* AI Library (AP002) — professional product page */

.ai-library-page {
  --ai-emerald: #059669;
  --ai-emerald-dark: #047857;
  --ai-emerald-light: #34d399;
  --ai-navy: #0a1929;
  --ai-slate: #475569;
  --ai-border: #e2e8f0;
  --ai-surface: #ffffff;
  --ai-bg: #f8fafc;
  --ai-hero-gradient: linear-gradient(135deg, #0a1929 0%, #134e4a 45%, #059669 100%);
  background: var(--ai-bg);
  color: var(--text-primary, #0a1929);
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
}

.ai-library-page .navbar.scrolled {
  background: var(--glass-bg, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(12px);
}

.ai-library-page .navbar .nav-link {
  color: var(--text-primary, #0a1929);
}

.ai-library-page .navbar .logo-text {
  color: var(--primary-color, #0a1929);
}

.ai-public-nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Typography */
.ai-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ai-emerald-light);
  margin: 0 0 10px;
}

.ai-title {
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin: 0 0 14px;
  line-height: 1.12;
  font-weight: 800;
}

.ai-marketing-lead,
.ai-subtitle {
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 54ch;
}

.ai-marketing-hero .ai-marketing-lead {
  color: rgba(255, 255, 255, 0.92);
}

.ai-marketing-hero .ai-eyebrow {
  color: var(--ai-emerald-light);
}

.ai-marketing-hero .ai-title {
  color: #fff;
}

/* Hero */
.ai-marketing-hero {
  background: var(--ai-hero-gradient);
  color: #fff;
  padding: 56px 0 64px;
}

.ai-marketing-hero-grid {
  display: grid;
  gap: 36px;
  align-items: center;
  max-width: 1200px;
}

@media (min-width: 900px) {
  .ai-marketing-hero-grid {
    grid-template-columns: 1fr 1.05fr;
  }
}

.ai-hero-highlights {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ai-hero-highlights li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.ai-highlight-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ai-marketing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.ai-hero-note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
}

.ai-marketing-visual {
  margin: 0;
}

.ai-hero-art,
.ai-pipeline-art {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

.ai-hero-art {
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ai-visual-caption {
  margin-top: 10px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

/* Buttons */
.ai-btn-primary {
  background: linear-gradient(135deg, var(--ai-emerald), var(--ai-emerald-dark));
  border: none;
  color: #fff;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.35);
}

.ai-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: inherit;
  font-weight: 600;
}

.ai-marketing-hero .ai-btn-outline {
  color: #fff;
}

.ai-not-section .ai-btn-outline,
.ai-faq-section .ai-btn-outline,
.ai-contact-section .ai-btn-outline {
  border-color: var(--ai-border);
  color: var(--ai-navy);
}

.ai-btn-lg {
  padding: 12px 22px;
  font-size: 1rem;
}

.ai-btn-block {
  width: 100%;
  text-align: center;
}

/* What it is / is not */
.ai-not-section {
  padding: 56px 0;
}

.ai-not-grid {
  padding: 32px;
}

.ai-not-grid h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
}

.ai-not-columns {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .ai-not-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.ai-not-card {
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--ai-border);
}

.ai-not-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.ai-not-card ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
  color: var(--ai-slate);
  font-size: 0.92rem;
}

.ai-not-card--yes {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.ai-not-card--yes h3 {
  color: var(--ai-emerald-dark);
}

.ai-not-card--no {
  background: #fef2f2;
  border-color: #fecaca;
}

.ai-not-card--no h3 {
  color: #b91c1c;
}

/* How it works */
.ai-how-section {
  padding: 56px 0;
  background: var(--ai-bg);
}

.ai-how-head {
  max-width: 720px;
  margin-bottom: 28px;
}

.ai-how-head h2 {
  margin: 0 0 10px;
  font-size: 1.75rem;
}

.ai-how-head p {
  color: var(--ai-slate);
  margin: 0;
}

.ai-pipeline-visual {
  padding: 16px;
  margin-bottom: 28px;
}

.ai-pipeline-art {
  border-radius: 12px;
  border: 1px solid var(--ai-border);
}

.ai-feature-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 640px) {
  .ai-feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.ai-feature-card {
  padding: 22px;
  position: relative;
}

.ai-feature-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--ai-emerald-dark);
}

.ai-feature-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ai-slate);
}

.ai-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ai-emerald), var(--ai-emerald-dark));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* FAQ */
.ai-faq-section {
  padding: 56px 0;
  background: #fff;
  border-top: 1px solid var(--ai-border);
}

.ai-faq-grid {
  display: grid;
  gap: 32px;
}

@media (min-width: 900px) {
  .ai-faq-grid {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: start;
  }
}

.ai-faq-intro h2 {
  margin: 0 0 10px;
  font-size: 1.75rem;
}

.ai-faq-list {
  display: grid;
  gap: 12px;
}

.ai-faq-item {
  padding: 0;
  overflow: hidden;
}

.ai-faq-item summary {
  padding: 16px 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.ai-faq-item summary::-webkit-details-marker {
  display: none;
}

.ai-faq-item summary::after {
  content: '+';
  float: right;
  color: var(--ai-emerald);
  font-weight: 700;
}

.ai-faq-item[open] summary::after {
  content: '−';
}

.ai-faq-item p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--ai-slate);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Contact CTA */
.ai-contact-section {
  padding: 56px 0 72px;
}

.ai-contact-grid {
  display: grid;
  gap: 32px;
  padding: 32px;
  align-items: start;
}

@media (min-width: 768px) {
  .ai-contact-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.ai-contact-grid h2 {
  margin: 0 0 12px;
}

.ai-contact-list {
  margin: 16px 0 0;
  padding-left: 20px;
  line-height: 1.7;
  color: var(--ai-slate);
}

.ai-contact-label {
  font-weight: 700;
  margin: 0 0 12px;
}

/* Access gate */
.ai-access-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 25, 41, 0.92);
  backdrop-filter: blur(8px);
}

.ai-access-gate[hidden],
.ai-app-shell[hidden],
.ai-public-landing[hidden],
.ai-panel[hidden],
.ai-editor-overlay[hidden],
.ai-api-offline[hidden] {
  display: none !important;
}

.ai-access-card {
  width: min(440px, 100%);
  padding: 28px 24px;
}

.ai-access-card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.ai-access-card .ai-eyebrow {
  color: var(--ai-emerald);
}

.ai-access-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.ai-field-help {
  font-size: 0.82rem;
  color: var(--ai-slate);
  margin: 6px 0 0;
}

/* Workspace */
.ai-workspace-header {
  background: linear-gradient(180deg, #ecfdf5 0%, var(--ai-bg) 100%);
  border-bottom: 1px solid var(--ai-border);
  padding: 24px 0;
}

.ai-workspace-header-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.ai-workspace-header .ai-eyebrow {
  color: var(--ai-emerald);
}

.ai-workspace-title {
  margin: 0;
  font-size: 1.5rem;
}

.ai-workspace-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ai-workspace-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ai-slate);
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 999px;
  padding: 6px 12px;
}

.ai-workspace-steps li span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ai-emerald);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.ai-workspace-main {
  padding: 28px 16px 56px;
}

/* Forms */
.ai-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 14px 0 6px;
}

.ai-input,
.ai-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  font: inherit;
  box-sizing: border-box;
  background: var(--ai-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-input:focus,
.ai-textarea:focus {
  outline: none;
  border-color: var(--ai-emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.ai-textarea {
  min-height: 120px;
  resize: vertical;
}

.ai-hint {
  font-size: 0.85rem;
  color: var(--ai-slate);
  margin: 6px 0 0;
}

.ai-hint--warn { color: #b45309; }
.ai-hint--ok { color: var(--ai-emerald-dark); }

.ai-field-grid {
  display: grid;
  gap: 0 16px;
}

@media (min-width: 640px) {
  .ai-field-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.ai-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.92rem;
  cursor: pointer;
}

.ai-check-row input {
  margin-top: 4px;
}

/* Tabs */
.ai-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  padding: 6px;
}

.ai-tab {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ai-slate);
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-tab[aria-selected="true"] {
  background: #ecfdf5;
  color: var(--ai-emerald-dark);
}

.ai-tab-icon {
  font-size: 1rem;
}

/* Cards */
.ai-card {
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ai-card-title,
.ai-section-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.ai-form-sections {
  max-width: 820px;
}

.ai-section-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.ai-section-head .ai-step-num {
  margin-bottom: 0;
  flex-shrink: 0;
}

.ai-legal-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 16px;
  margin: 12px 0;
}

.ai-legal-box label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.5;
  cursor: pointer;
}

.ai-legal-box label + label {
  margin-top: 12px;
}

.ai-legal-box input {
  margin-top: 4px;
}

.ai-file-row {
  margin-top: 10px;
}

.ai-file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px dashed var(--ai-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ai-emerald-dark);
  background: #f8fafc;
}

.ai-file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ai-size-row {
  margin-top: 8px;
}

.ai-range {
  width: 100%;
  accent-color: var(--ai-emerald);
}

.ai-stats-line {
  font-weight: 500;
}

/* Progress */
.ai-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-top: 12px;
}

.ai-progress-fill {
  background: linear-gradient(90deg, var(--ai-emerald), var(--ai-emerald-light));
  height: 100%;
  width: 0;
  transition: width 0.35s ease;
}

/* Banners */
.ai-entitlement-banner {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 500;
}

.ai-entitlement-banner--free {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.ai-entitlement-banner--paid {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.ai-dictionary-banner {
  border-left: 4px solid var(--ai-emerald);
  background: #f0fdf4;
}

.ai-enterprise-banner {
  border-left: 4px solid #2563eb;
}

.ai-enterprise-banner--ready {
  border-left-color: var(--ai-emerald);
}

.ai-enterprise-banner--warn {
  border-left-color: #d97706;
}

.ai-enterprise-blockers {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.6;
}

.ai-api-offline {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* Book list */
.ai-book-list {
  display: grid;
  gap: 14px;
}

.ai-book-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ai-book-item h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.ai-book-meta {
  font-size: 0.85rem;
  color: var(--ai-slate);
}

.ai-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-status-badge--draft { background: #e2e8f0; color: #475569; }
.ai-status-badge--edited { background: #dbeafe; color: #1d4ed8; }
.ai-status-badge--published { background: #d1fae5; color: var(--ai-emerald-dark); }

.ai-empty-state {
  color: var(--ai-slate);
  font-size: 0.95rem;
  padding: 24px;
  text-align: center;
  background: var(--ai-surface);
  border: 1px dashed var(--ai-border);
  border-radius: 12px;
}

.ai-panel-intro {
  margin-bottom: 16px;
}

/* Actions */
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ai-actions--sticky {
  position: sticky;
  bottom: 16px;
  background: linear-gradient(180deg, transparent, var(--ai-bg) 24%);
  padding-top: 24px;
  z-index: 5;
}

/* Editor */
.ai-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ai-editor-modal {
  width: min(920px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
}

.ai-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.ai-editor-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.ai-editor-close {
  border: none;
  background: #f1f5f9;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ai-slate);
}

.ai-editor-textarea {
  min-height: 320px;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Validation */
.ai-validation-panel {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.ai-validation-list {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.ai-validation-list li.pass { color: var(--ai-emerald-dark); }
.ai-validation-list li.fail { color: #b91c1c; }

/* Footer */
.ai-footer {
  padding: 40px 0;
  text-align: center;
  color: var(--ai-slate);
  font-size: 0.9rem;
  border-top: 1px solid var(--ai-border);
  background: #fff;
}

.ai-footer a {
  color: var(--ai-emerald-dark);
  font-weight: 600;
}

@media (max-width: 640px) {
  .ai-marketing-hero {
    padding: 40px 0 48px;
  }

  .ai-workspace-steps {
    width: 100%;
  }

  .ai-workspace-steps li {
    flex: 1 1 45%;
    justify-content: center;
  }
}
