:root {
  --teal: #0c6572;
  --teal-dark: #084a54;
  --teal-light: #e8f4f6;
  --brand: #fba919;
  --brand-light: #fff4e0;
  --warning: #e55625;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #5c6676;
  --border: #cbd5e1;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(12, 101, 114, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

/* Global site nav */
.site-nav {
  background: var(--teal-dark);
  padding: 0.65rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.site-nav-brand img {
  height: 28px;
  width: auto;
}

.site-nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  flex: 1;
}

.site-nav-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.site-nav-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.site-nav-links a.active {
  background: var(--brand);
  color: var(--teal-dark);
  font-weight: 600;
}

/* Header */
.hero {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  padding: 2.5rem 1.5rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 280px;
  height: 280px;
  background: var(--brand);
  opacity: 0.15;
  border-radius: 40% 60% 50% 50%;
  transform: rotate(-12deg);
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  background: var(--brand);
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.92;
  max-width: 720px;
}

.hero-meta {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.hero-meta a { color: var(--brand); }

.hero--compact {
  padding: 1.75rem 1.5rem 2.5rem;
}

.hero--compact h1 {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  margin-bottom: 0.25rem;
}

.wiki-breadcrumb {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.75rem;
}

.wiki-breadcrumb a {
  color: var(--brand);
  text-decoration: none;
}

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

.wiki-sidebar a.active {
  font-weight: 700;
  color: var(--warning);
}

.wiki-content {
  font-size: 0.98rem;
}

.wiki-content h2 {
  font-size: 1.2rem;
  color: var(--teal);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--brand);
}

.wiki-content h3 {
  font-size: 1.05rem;
  color: var(--teal-dark);
  margin: 1.25rem 0 0.5rem;
}

.wiki-content h4 {
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
}

.wiki-content pre {
  background: var(--teal-dark);
  color: #e8f4f6;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 1rem 0;
}

.wiki-content code {
  font-size: 0.88em;
}

.wiki-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.wiki-content table {
  font-size: 0.9rem;
}

.wiki-content img {
  max-width: 100%;
  height: auto;
}

.wiki-source {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 2rem;
  padding: 0 1.5rem;
}

.wiki-source code {
  font-size: 0.8rem;
}

/* Layout */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  margin-top: -2rem;
  position: relative;
  z-index: 2;
}

.layout--single {
  grid-template-columns: 1fr;
  margin-top: -1.5rem;
}

.card--diagram { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; margin-top: 0; }
  .toc { position: static !important; }
  .card--diagram { grid-column: auto; }
}

/* TOC */
.toc {
  position: sticky;
  top: 4rem;
  align-self: start;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

.toc h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.toc a {
  display: block;
  color: var(--teal);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--bg);
}

.toc a:hover { color: var(--warning); }

.toc .toc-back {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--brand);
  font-weight: 600;
}

main { min-width: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.35rem;
  color: var(--teal);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--brand);
}

.card h3 {
  font-size: 1.05rem;
  color: var(--teal-dark);
  margin: 1.25rem 0 0.5rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.analogy {
  background: var(--brand-light);
  border-left: 4px solid var(--brand);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-style: italic;
}

.analogy strong { font-style: normal; color: var(--teal-dark); }

.why {
  background: var(--teal-light);
  border-left: 4px solid var(--teal);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
}

.why strong { color: var(--teal); }

ul, ol { margin: 0.75rem 0 0.75rem 1.5rem; }
li { margin-bottom: 0.4rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

th {
  background: var(--teal);
  color: #fff;
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child { border-radius: 0 var(--radius) 0 0; }

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:nth-child(even) td { background: var(--bg); }

/* Hub cards */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.hub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
  display: block;
}

.hub-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
}

.hub-card .icon { font-size: 2rem; margin-bottom: 0.75rem; }

.hub-card h3 {
  color: var(--teal);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.hub-card p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.quick-link {
  background: var(--teal-light);
  color: var(--teal-dark);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.quick-link:hover {
  background: var(--brand-light);
  border-color: var(--brand);
}

/* Project cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.project-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.project-card h3 {
  color: var(--teal);
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.project-card .status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.status-live { background: #dcfce7; color: #166534; }
.status-dev { background: #fef3c7; color: #92400e; }

/* Stage cards */
.stage {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.stage-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--teal);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.stage-body { flex: 1; }
.stage-body h3 { margin-top: 0; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.35rem;
}

.tag-pr { background: #dbeafe; color: #1e40af; }
.tag-main { background: #dcfce7; color: #166534; }
.tag-skip { background: #f3f4f6; color: #4b5563; }
.tag-vps { background: #ede9fe; color: #5b21b6; }
.tag-cloud { background: #e0f2fe; color: #0369a1; }

/* Mermaid */
.diagram {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.diagram--tall { min-height: 520px; }
.diagram--wide { min-height: 280px; }

.mermaid {
  display: flex;
  justify-content: center;
  min-width: min(100%, 960px);
  margin: 0 auto;
}

.mermaid svg {
  max-width: none !important;
  width: auto !important;
  min-width: 720px;
  height: auto !important;
  font-size: 18px !important;
}

.diagram-hint {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.75rem;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.step-item .num {
  background: var(--brand);
  color: var(--teal-dark);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.deploy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.deploy-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.deploy-card h4 { color: var(--teal); font-size: 1rem; margin-bottom: 0.5rem; }
.deploy-card .icon { font-size: 1.5rem; margin-bottom: 0.5rem; }

.glossary dt { font-weight: 700; color: var(--teal); margin-top: 0.75rem; }
.glossary dd { margin-left: 0; color: var(--muted); margin-bottom: 0.5rem; }

code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--teal-dark);
}

pre.cmd {
  background: var(--teal-dark);
  color: #e8f4f6;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.9rem;
  margin: 0.75rem 0;
}

a { color: var(--teal); }
a:hover { color: var(--warning); }

.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.footer a { margin: 0 0.5rem; }

/* Entregas dashboard */
.entregas-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.entregas-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.entregas-kpi {
  text-align: center;
  padding: 0.5rem;
}

.entregas-kpi-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.2;
}

.entregas-kpi-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.entregas-heatmap-wrap {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.entregas-heatmap-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.65rem;
  color: var(--muted);
  padding-top: 2px;
  flex-shrink: 0;
}

.entregas-heatmap-labels span {
  height: 12px;
  line-height: 12px;
}

.entregas-heatmap {
  display: flex;
  gap: 3px;
}

.entregas-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.entregas-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: none;
  padding: 0;
  cursor: default;
  flex-shrink: 0;
}

.entregas-cell.level-0 { background: #e2e8f0; }
.entregas-cell.level-1 { background: #b8e0e6; }
.entregas-cell.level-2 { background: #6eb8c4; }
.entregas-cell.level-3 { background: #0c6572; }
.entregas-cell.level-4 { background: #fba919; }

.entregas-cell:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.entregas-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.entregas-tooltip {
  position: fixed;
  z-index: 200;
  background: var(--teal-dark);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  max-width: 280px;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.entregas-tip-sub {
  opacity: 0.85;
  font-size: 0.75rem;
}

.entregas-bars {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.entregas-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 36px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.entregas-bar-label {
  color: var(--text);
  font-weight: 500;
}

.entregas-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
}

.entregas-bar-fill {
  height: 100%;
  border-radius: 5px;
  min-width: 2px;
}

.entregas-bar-count {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.entregas-feed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.entregas-feed-header h2 {
  margin: 0;
}

.entregas-filter {
  display: flex;
  gap: 0.35rem;
}

.entregas-filter-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.entregas-filter-btn:hover,
.entregas-filter-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.entregas-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.entregas-day-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--bg);
}

.entregas-day-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.entregas-day-head time {
  font-weight: 700;
  color: var(--teal);
  text-transform: capitalize;
}

.entregas-day-meta {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.entregas-day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.entregas-badge {
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.entregas-pr {
  font-size: 0.72rem;
  color: var(--warning);
  font-weight: 600;
}

.entregas-day-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.entregas-day-list li {
  margin-bottom: 0.25rem;
}

.entregas-empty {
  color: var(--muted);
  font-style: italic;
}

@media print {
  .site-nav, .toc { display: none; }
  .layout { grid-template-columns: 1fr; }
  .card { break-inside: avoid; box-shadow: none; }
}
