/* =========================================================
   About Microservices — shared stylesheet
   ========================================================= */

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-nav: #0f172a;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border: #e2e8f0;
  --color-code-bg: #f1f5f9;
  --color-pro: #16a34a;
  --color-pro-bg: #f0fdf4;
  --color-pro-border: #bbf7d0;
  --color-con: #dc2626;
  --color-con-bg: #fef2f2;
  --color-con-border: #fecaca;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --nav-height: 56px;
}

html {
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

* { box-sizing: border-box; }

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  line-height: 1.75;
  margin: 0;
}

/* ── NAVBAR ── */
.site-nav {
  background-color: var(--color-nav);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.site-nav .nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand span { color: #60a5fa; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-right a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.83rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.nav-right a:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.07);
}

/* ── BREADCRUMB ── */
.breadcrumb-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.6rem 0;
}

.breadcrumb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.breadcrumb {
  margin: 0;
  padding: 0;
  background: none;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.breadcrumb-item a {
  color: var(--color-accent);
  text-decoration: none;
}

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

.breadcrumb-item.active { color: var(--color-muted); }

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--color-border);
  padding: 0 0.5rem;
}

/* ── PAGE LAYOUT ── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
}

.page-wrap.no-sidebar {
  grid-template-columns: 1fr;
  max-width: 800px;
}

@media (max-width: 900px) {
  .page-wrap { grid-template-columns: 1fr; }
  .page-sidebar { display: none; }
}

/* ── ARTICLE ── */
.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.category-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 0.85rem;
}

.article-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0 0 0.75rem;
}

.article-meta {
  font-size: 0.78rem;
  color: var(--color-muted);
  font-family: var(--font-mono);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.article-meta i { margin-right: 0.25rem; }

/* ── ARTICLE BODY ── */
.article-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 2.25rem 0 0.75rem;
  padding-top: 0.25rem;
}

.article-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 1.75rem 0 0.5rem;
}

.article-body p {
  color: var(--color-text);
  margin-bottom: 1rem;
  font-size: 0.97rem;
}

.article-body ul, .article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.article-body li {
  margin-bottom: 0.4rem;
  font-size: 0.97rem;
}

.article-body a {
  color: var(--color-accent);
  text-decoration: none;
}

.article-body a:hover { text-decoration: underline; }

.article-body figure {
  margin: 2rem 0;
  text-align: center;
}

.article-body figure img {
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.article-body figcaption {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

/* ── PROS / CONS ── */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 600px) {
  .pros-cons { grid-template-columns: 1fr; }
}

.pros-box, .cons-box {
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.pros-box {
  background: var(--color-pro-bg);
  border: 1px solid var(--color-pro-border);
}

.cons-box {
  background: var(--color-con-bg);
  border: 1px solid var(--color-con-border);
}

.pros-box h4, .cons-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.pros-box h4 { color: var(--color-pro); }
.cons-box h4 { color: var(--color-con); }

.pros-box ul, .cons-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pros-box li, .cons-box li {
  font-size: 0.88rem;
  padding: 0.2rem 0;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.pros-box li::before {
  content: '✓';
  color: var(--color-pro);
  font-weight: 700;
  flex-shrink: 0;
}

.cons-box li::before {
  content: '✗';
  color: var(--color-con);
  font-weight: 700;
  flex-shrink: 0;
}

/* ── WHEN TO USE ── */
.when-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.when-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin-bottom: 0.6rem;
}

.when-box ul {
  padding-left: 1.25rem;
  margin: 0;
}

.when-box li { font-size: 0.9rem; margin-bottom: 0.35rem; }

/* ── REFERENCES ── */
.references-section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.references-section h2 {
  font-size: 1rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.references-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.references-section li {
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.references-section li::before {
  content: '↗';
  color: var(--color-accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.references-section a {
  color: var(--color-accent);
  text-decoration: none;
}

.references-section a:hover { text-decoration: underline; }

/* ── SIDEBAR ── */
.page-sidebar {
  order: 2;
}

.sidebar-toc {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
}

.sidebar-toc h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li { margin-bottom: 0.1rem; }

.toc-list a {
  display: block;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
}

.toc-list a:hover,
.toc-list a.active {
  background: #eff6ff;
  color: var(--color-accent);
}

.sidebar-related {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-related h5 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

.related-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--color-accent);
  text-decoration: none;
  padding: 0.3rem 0;
}

.related-link:hover { text-decoration: underline; }

/* ── CATEGORY INDEX ── */
.category-hero {
  background: var(--color-nav);
  color: #f1f5f9;
  padding: 3rem 0 2.5rem;
}

.category-hero .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #60a5fa;
  margin-bottom: 0.6rem;
}

.category-hero h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.75rem;
}

.category-hero p {
  color: #94a3b8;
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0;
}

.pattern-list-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.pattern-list-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.pattern-item {
  display: flex;
  gap: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  align-items: flex-start;
}

.pattern-item:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
  color: var(--color-text);
}

.pattern-item-icon {
  width: 44px;
  height: 44px;
  background: #eff6ff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pattern-item-icon i {
  font-size: 1.2rem;
  color: var(--color-accent);
}

.pattern-item-body { flex: 1; }

.pattern-item-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.pattern-item-body p {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin: 0;
}

.pattern-item-arrow {
  color: var(--color-muted);
  align-self: center;
  transition: transform 0.15s, color 0.15s;
}

.pattern-item:hover .pattern-item-arrow {
  color: var(--color-accent);
  transform: translateX(3px);
}

.coming-soon-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── FOOTER ── */
.site-footer {
  background-color: var(--color-nav);
  color: #94a3b8;
  padding: 2.5rem 0;
}

.site-footer .footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #f1f5f9;
  margin-bottom: 0.4rem;
}

.site-footer p {
  font-size: 0.8rem;
  margin: 0;
}

.site-footer a {
  color: #60a5fa;
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #475569;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
}

.footer-ai-note {
  font-size: 0.72rem;
  color: #334155;
  margin-top: 0.75rem;
  font-style: italic;
}

.footer-ai-note a { color: #475569; }

/* ── MOBILE ── */
@media (max-width: 480px) {
  /* Navbar: hide text links, keep brand + lang toggle */
  .nav-right a {
    display: none;
  }

  /* Pattern pages: tighten page padding */
  .page-wrap {
    padding: 1.5rem 1rem 3rem;
  }

  /* Category hero: reduce vertical padding */
  .category-hero {
    padding: 2rem 0 1.5rem;
  }

  /* Pattern list items: tighter on small screens */
  .pattern-item {
    gap: 1rem;
    padding: 1.1rem;
  }

  .pattern-item-icon {
    width: 36px;
    height: 36px;
  }

  /* Breadcrumb: smaller text */
  .breadcrumb {
    font-size: 0.72rem;
  }

  /* When-to-use boxes */
  .when-box {
    padding: 1rem 1.1rem;
  }
}

@media (max-width: 360px) {
  /* Very small screens: shorten brand */
  .nav-brand::after {
    content: '';
  }
}
