/* Cadencia Docs — Design System */

/* ── Tokens ── */
:root {
  --indigo:        #4F46E5;
  --indigo-light:  #EEF2FF;
  --indigo-mid:    #6366F1;
  --indigo-dark:   #3730A3;
  --bg:            #F9FAFB;
  --surface:       #FFFFFF;
  --border:        #E5E7EB;
  --border2:       #D1D5DB;
  --text:          #111827;
  --text2:         #374151;
  --muted:         #6B7280;
  --subtle:        #9CA3AF;
  --green:         #10B981;
  --green-bg:      #D1FAE5;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow:        0 4px 12px rgba(0,0,0,0.08);

  /* MkDocs Material overrides */
  --md-primary-fg-color:          #4F46E5;
  --md-primary-fg-color--light:   #818CF8;
  --md-primary-fg-color--dark:    #4338CA;
  --md-accent-fg-color:           #6366F1;
  --md-default-bg-color:          #F9FAFB;
  --md-default-fg-color:          #111827;
  --md-default-fg-color--light:   #6B7280;
  --md-default-fg-color--lighter: #9CA3AF;
  --md-code-bg-color:             #F3F4F6;
  --md-code-fg-color:             #111827;
  --md-text-font:                 "Inter";
  --md-code-font:                 "JetBrains Mono";

  /* Header height */
  --md-header-height: 56px;
}

/* ── Header ── */
.md-header {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: none !important;
  height: var(--md-header-height) !important;
}
.md-header[data-md-state=shadow] {
  box-shadow: var(--shadow-sm) !important;
}
.md-header__inner {
  height: var(--md-header-height) !important;
  padding: 0 20px !important;
}
.md-header__title {
  font-weight: 700 !important;
  font-size: 15px !important;
  color: var(--text) !important;
}
/* Hide the text title — logo SVG is enough */
.md-header__title .md-header__topic { display: none !important; }

/* Logo */
.md-logo { padding: 0 !important; margin-right: 8px !important; }
.md-logo img, .md-logo svg { height: 28px !important; width: auto !important; }

/* Header icons */
.md-header__button,
.md-header__button.md-icon {
  color: var(--muted) !important;
}
.md-header__button:hover {
  color: var(--text) !important;
  background: var(--bg) !important;
  opacity: 1 !important;
}

/* ── Search ── */
.md-search__form {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
.md-search__input {
  background: transparent !important;
  color: var(--text) !important;
  font-size: 14px !important;
}
.md-search__input::placeholder { color: var(--subtle) !important; }
.md-search__output {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}
/* Remove duplicate search icon color bleed */
.md-search__icon { color: var(--muted) !important; }

/* ── Layout grid — colar sidebar na borda esquerda ── */
/* MkDocs Material usa .md-grid com max-width: 61rem + margin:0 auto no header
   e no main-inner. Isso deixa um vão à esquerda da sidebar em telas largas.
   Zeramos o max-width pra sidebar encostar na borda e o conteúdo ganhar largura
   (o max-width real do texto vive em .md-content__inner, abaixo). */
.md-grid { max-width: none !important; }
.md-main__inner { margin-top: 0 !important; }

/* ── Sidebar ── */
.md-sidebar {
  background: var(--surface) !important;
  /* Garante que a sidebar preencha toda a altura disponível da viewport */
  min-height: 100vh !important;
  height: auto !important;
}
.md-sidebar--primary {
  border-right: 1px solid var(--border) !important;
  /* Alinha com o topo da viewport (sem margem acima do header) */
  top: 0 !important;
  /* Encosta na borda esquerda — sem margin herdada do grid */
  left: 0 !important;
  margin-left: 0 !important;
}
/* Esconde TOC secundário — conteúdo usa toda a largura disponível */
.md-sidebar--secondary { display: none !important; }

/* Sidebar scroll area sem truncar */
.md-sidebar__scrollwrap { overflow-x: hidden !important; }
.md-sidebar__inner { padding: 0 8px 16px !important; }

.md-nav { font-size: 13.5px; }

/* Título de seção (ex: "Cadencia", "Infra") */
.md-nav__title {
  font-size: 10.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: var(--subtle) !important;
  padding: 16px 8px 4px !important;
  background: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Links de nav */
.md-nav__item .md-nav__link {
  color: var(--muted) !important;
  border-radius: 6px;
  padding: 0.35rem 0.6rem !important;
  margin: 1px 0;
  transition: background 0.12s, color 0.12s;
  /* NÃO sobrescrever display/flex/align-items/line-height — Material cuida disso */
}
.md-nav__item .md-nav__link:hover {
  color: var(--indigo) !important;
  background: var(--indigo-light) !important;
}
.md-nav__item .md-nav__link--active,
.md-nav__item .md-nav__link--active:hover {
  color: var(--indigo) !important;
  font-weight: 600 !important;
  background: var(--indigo-light) !important;
}

/* Ícone toggle (chevron) — usa mask-image, currentcolor afeta background-color do ::after */
.md-nav__icon { color: var(--subtle) !important; flex-shrink: 0; }

/* Seções pai */
.md-nav__item--section > .md-nav__link {
  font-weight: 600 !important;
  color: var(--text2) !important;
}

/* Texto do link: permite quebra mas não trunca */
.md-nav__link .md-ellipsis { white-space: normal !important; overflow: visible !important; }

/* ── Main content ── */
.md-main { background: var(--bg) !important; }
.md-content { background: var(--bg) !important; max-width: 100% !important; }
/* Sem max-width — preenche todo o espaço disponível (sidebar TOC já foi ocultada) */
.md-content__inner { max-width: 1080px; margin: 0 auto; padding: 40px 48px 64px; }
@media (max-width: 960px) { .md-content__inner { padding: 32px 24px 64px; } }

/* ── Typography ── */
.md-typeset h1 {
  font-size: 30px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px !important;
}
.md-typeset h2 {
  font-size: 20px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  margin-top: 40px !important;
}
.md-typeset h3 {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--text2) !important;
  margin-top: 28px !important;
}
.md-typeset p { color: var(--text2); line-height: 1.7; }

/* ── Links ── */
.md-typeset a {
  color: var(--indigo);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.md-typeset a:hover { border-bottom-color: var(--indigo); }

/* ── Inline code ── */
.md-typeset code {
  background: var(--indigo-light) !important;
  color: var(--indigo-dark) !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
  font-size: 0.85em !important;
}

/* ── Code blocks ── */
.md-typeset pre > code { background: #1E1E2E !important; color: #CDD6F4 !important; padding: 0 !important; border-radius: 0 !important; }
.md-typeset .highlight { border-radius: var(--radius-sm) !important; overflow: hidden; border: 1px solid var(--border); }
.md-typeset .highlight pre { margin: 0; padding: 16px 20px; font-size: 13px; line-height: 1.7; }

/* ── Tables ── */
.md-typeset table:not([class]) {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
  font-size: 14px !important;
}
.md-typeset table:not([class]) th {
  background: #F3F4F6 !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  color: var(--text2) !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border2) !important;
}
.md-typeset table:not([class]) td { color: var(--text2); border-color: var(--border) !important; }
.md-typeset table:not([class]) tr:hover td { background: var(--indigo-light); }

/* ── Admonitions ── */
.md-typeset .admonition,
.md-typeset details {
  border-radius: var(--radius-sm) !important;
  border-width: 0 0 0 3px !important;
  box-shadow: none !important;
  background: #F9FAFB !important;
}
.md-typeset .admonition-title,
.md-typeset summary { font-weight: 600 !important; font-size: 14px !important; }

/* ── Footer ── */
.md-footer { background: var(--surface) !important; border-top: 1px solid var(--border) !important; }
.md-footer-meta { background: #F3F4F6 !important; }
.md-footer__link { color: var(--muted) !important; }
.md-footer__link:hover { color: var(--indigo) !important; }

/* ══════════════════════════════════════════════
   HOMEPAGE — hero + cards
   (só ativo quando home.html injeta esses blocos)
   ══════════════════════════════════════════════ */

/* Expande o inner para largura total na home */
.md-content__inner:has(.docs-hero) {
  max-width: 1200px !important;
  padding: 40px 48px 80px !important;
}
@media (max-width: 768px) {
  .md-content__inner:has(.docs-hero) { padding: 24px 20px 60px !important; }
}

/* Hero */
.docs-hero {
  text-align: center;
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.docs-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--indigo-light);
  color: var(--indigo);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.docs-hero h1 {
  font-size: 40px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  border: none !important;
  padding: 0 !important;
  margin-bottom: 16px !important;
  line-height: 1.15 !important;
  color: var(--text) !important;
}
.docs-hero p {
  font-size: 18px !important;
  color: var(--muted) !important;
  max-width: 560px !important;
  margin: 0 auto !important;
  line-height: 1.6 !important;
}

/* Section labels */
.docs-section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  margin: 44px 0 16px;
}

/* Card grid */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}
.docs-grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
@media (max-width: 768px) {
  .docs-grid,
  .docs-grid-wide { grid-template-columns: 1fr; }
  .docs-hero h1 { font-size: 28px !important; }
}

/* Card */
.docs-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none !important;
  border-bottom: none !important;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  position: relative;
}
.docs-card:hover {
  border-color: var(--indigo);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-bottom: none !important;
}
.docs-card-icon {
  width: 36px;
  height: 36px;
  background: var(--indigo-light);
  color: var(--indigo);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.docs-card-icon svg { display: block; }
.docs-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.docs-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.docs-card-tag {
  display: inline-flex;
  align-items: center;
  background: var(--green-bg);
  color: #065F46;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 10px;
}
