/**
 * Product Workflow Guides — corporate refined presentation.
 * Loaded only on /guides pages. Uses aic-brand.css tokens.
 */

/* ── Hero ───────────────────────────────────────────── */
.guide-hero {
  position: relative;
  padding: calc(var(--aic-header-h) + 3.5rem) 0 3.25rem;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(20, 104, 184, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 20%, rgba(27, 127, 0, 0.06), transparent 50%),
    linear-gradient(180deg, var(--aic-surface-soft) 0%, var(--aic-blue-soft) 45%, var(--aic-surface) 100%);
  overflow: hidden;
  animation: guide-hero-in 0.55s ease-out both;
}

.guide-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(11, 79, 145, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 79, 145, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 85%);
  pointer-events: none;
}

.guide-hero-inner {
  position: relative;
  max-width: 720px;
}

.guide-hero--hub .guide-hero-inner {
  max-width: 800px;
}

.guide-kicker {
  font-family: var(--aic-font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aic-blue-700);
  margin: 0 0 0.75rem;
}

.guide-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 1rem;
  color: var(--aic-navy-900);
}

.guide-lead {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--aic-text-secondary);
  margin: 0 0 1.75rem;
  max-width: 36em;
}

.guide-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.guide-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--aic-text-muted);
  margin-bottom: 1.25rem;
}

.guide-breadcrumb a {
  color: var(--aic-blue-700);
  text-decoration: none;
  font-weight: 600;
}

.guide-breadcrumb a:hover {
  text-decoration: underline;
}

.guide-breadcrumb a:focus-visible,
.guide-toc-list a:focus-visible,
.guide-prereq-list a:focus-visible,
.guide-related-inline a:focus-visible,
.guide-hero-ctas a:focus-visible,
.guide-empty a:focus-visible,
.guide-panel a:focus-visible {
  outline: none;
  box-shadow: var(--aic-focus-ring);
  border-radius: 2px;
}

/* ── Sections ───────────────────────────────────────── */
.guide-section {
  padding: 3.5rem 0 4.5rem;
}

.guide-section-head {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}

.guide-section-head h2 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.guide-section-head p {
  margin: 0;
  color: var(--aic-text-secondary);
}

/* ── Hub context (prerequisites + ecosystem) ────────── */
.guide-section--context {
  padding-top: 2.5rem;
  padding-bottom: 0;
}

.guide-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.guide-context-block {
  padding: 1.5rem 1.6rem;
  background: var(--aic-surface);
  border: 1px solid var(--aic-border);
  border-radius: var(--aic-radius);
}

.guide-context-block h2 {
  font-size: 1.15rem;
  margin: 0 0 1rem;
}

.guide-prereq-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--aic-text-secondary);
  line-height: 1.55;
}

.guide-prereq-list li + li {
  margin-top: 0.55rem;
}

.guide-prereq-list a {
  color: var(--aic-blue-700);
  font-weight: 600;
  text-decoration: none;
}

.guide-prereq-list a:hover {
  text-decoration: underline;
}

.guide-related-inline {
  margin: 1rem 0 0;
  font-size: 0.925rem;
  color: var(--aic-text-muted);
}

.guide-related-inline a {
  color: var(--aic-blue-700);
  font-weight: 600;
  text-decoration: none;
}

.guide-related-inline a:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .guide-context-grid {
    grid-template-columns: 1fr;
  }
}

.guide-category {
  margin-bottom: 2.75rem;
}

.guide-category:last-child {
  margin-bottom: 0;
}

.guide-category-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aic-text-muted);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--aic-border);
}

/* ── Cards ──────────────────────────────────────────── */
.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.guide-product-card,
.guide-menu-card {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.25rem 1.35rem;
  background: var(--aic-surface);
  border: 1px solid var(--aic-border);
  border-radius: var(--aic-radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.guide-product-card:hover,
.guide-menu-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--aic-shadow-sm);
  border-color: var(--aic-border-strong);
  text-decoration: none;
  color: inherit;
}

.guide-product-card:focus-visible,
.guide-menu-card:focus-visible {
  outline: none;
  box-shadow: var(--aic-focus-ring);
}

.guide-product-card-icon,
.guide-menu-card-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--aic-radius-sm);
  background: var(--aic-blue-soft);
  color: var(--aic-blue-700);
  font-size: 1.35rem;
}

.guide-product-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guide-product-card-body strong,
.guide-menu-card strong {
  font-family: var(--aic-font-display);
  font-size: 1.05rem;
  color: var(--aic-navy-900);
}

.guide-product-card-body span,
.guide-menu-card > span:last-child {
  font-size: 0.925rem;
  color: var(--aic-text-secondary);
  line-height: 1.45;
}

.guide-product-card-arrow {
  flex-shrink: 0;
  color: var(--aic-blue-600);
  font-size: 1.25rem;
  margin-top: 0.15rem;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.guide-product-card:hover .guide-product-card-arrow {
  transform: translateX(3px);
  opacity: 1;
}

.guide-menu-card {
  flex-direction: column;
  gap: 0.65rem;
  min-height: 9.5rem;
}

.guide-card-grid--menus {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ── Empty hub ──────────────────────────────────────── */
.guide-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--aic-surface-soft);
  border: 1px dashed var(--aic-border-strong);
  border-radius: var(--aic-radius-lg);
  color: var(--aic-text-secondary);
}

.guide-empty .material-symbols-outlined {
  font-size: 2.25rem;
  color: var(--aic-blue-600);
  margin-bottom: 0.75rem;
}

.guide-empty p {
  margin: 0 0 1.25rem;
}

/* ── Workflow layout ────────────────────────────────── */
.guide-workflow {
  padding: calc(var(--aic-header-h) + 2.5rem) 0 4rem;
  background: linear-gradient(180deg, var(--aic-surface-soft) 0%, var(--aic-surface) 28%);
  animation: guide-hero-in 0.45s ease-out both;
}

.guide-workflow-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: calc(var(--aic-header-h) + 1.25rem);
  padding: 1rem 1.1rem;
  background: var(--aic-surface);
  border: 1px solid var(--aic-border);
  border-radius: var(--aic-radius);
}

.guide-toc-label {
  font-family: var(--aic-font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aic-text-muted);
  margin: 0 0 0.65rem;
}

.guide-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.guide-toc-list a {
  color: var(--aic-blue-700);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.925rem;
}

.guide-toc-list a:hover {
  text-decoration: underline;
}

.guide-workflow-header {
  margin-bottom: 2rem;
}

.guide-workflow-header h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin: 0 0 0.75rem;
}

.guide-panel {
  margin-bottom: 2rem;
  padding: 1.5rem 1.6rem;
  background: var(--aic-surface);
  border: 1px solid var(--aic-border);
  border-radius: var(--aic-radius);
  animation: guide-panel-in 0.5s ease-out both;
}

.guide-panel--muted {
  background: var(--aic-surface-soft);
}

.guide-panel h2 {
  font-size: 1.2rem;
  margin: 0 0 1rem;
}

.guide-mermaid-stage {
  position: relative;
  margin: 0;
  overflow-x: auto;
  padding: 1rem;
  background: var(--aic-surface-soft);
  border: 1px solid var(--aic-border);
  border-radius: var(--aic-radius-sm);
  -webkit-overflow-scrolling: touch;
}

.guide-mermaid {
  margin: 0;
  text-align: center;
  font-family: var(--aic-font-body);
}

.guide-mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Shown until Mermaid paints; kept for screen readers / no-JS */
.guide-mermaid-fallback {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--aic-text-muted);
}

.guide-mermaid-stage.is-rendered .guide-mermaid-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  counter-reset: none;
}

.guide-steps li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.guide-step-num {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--aic-blue-700);
  color: #fff;
  font-family: var(--aic-font-display);
  font-size: 0.8rem;
  font-weight: 700;
}

.guide-step-text {
  padding-top: 0.2rem;
  color: var(--aic-text-primary);
  line-height: 1.55;
}

/* ── Motion ─────────────────────────────────────────── */
@keyframes guide-hero-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guide-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-hero,
  .guide-workflow,
  .guide-panel,
  .guide-product-card,
  .guide-menu-card,
  .guide-product-card-arrow {
    animation: none;
    transition: none;
  }

  .guide-product-card:hover,
  .guide-menu-card:hover {
    transform: none;
  }
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 991px) {
  .guide-workflow-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .guide-toc {
    position: static;
  }

  .guide-toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }
}

@media (max-width: 575px) {
  .guide-hero {
    padding: calc(var(--aic-header-h) + 2.25rem) 0 2.5rem;
  }

  .guide-section {
    padding: 2.5rem 0 3.25rem;
  }

  .guide-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Print ──────────────────────────────────────────── */
@media print {
  .guide-hero,
  .guide-workflow {
    padding-top: 1rem;
    background: #fff;
  }

  .guide-toc,
  .guide-hero-ctas,
  .aic-header,
  .aic-footer {
    display: none !important;
  }

  .guide-workflow-layout {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    break-inside: avoid;
    box-shadow: none;
  }
}
