/* ============================================================
   Error Fix Engine – Base Stylesheet
   Design tokens: dark-on-light, high-contrast, readable at any size
   ============================================================ */

/* ── Reset / base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:           #ffffff;
  --color-surface:      #f8f9fa;
  --color-border:       #dee2e6;
  --color-text:         #212529;
  --color-text-muted:   #6c757d;
  --color-primary:      #0d6efd;
  --color-primary-dark: #0a58ca;
  --color-accent:       #fd7e14;
  --color-code-bg:      #f3f4f6;
  --color-success:      #198754;
  --radius:             6px;
  --shadow:             0 1px 3px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --font-sans:          'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:          'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --max-width:          1180px;
  --col-article:        72ch;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--color-primary-dark); }

/* ── Layout helpers ──────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Site header ─────────────────────────────────────────────── */
.site-header {
  background: var(--color-text);
  color: #fff;
  padding: .75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.logo:hover { color: #adb5bd; text-decoration: none; }
.logo-icon { font-size: 1.3rem; }

.site-nav { display: flex; gap: 1.25rem; }
.site-nav a { color: #adb5bd; font-size: .9rem; }
.site-nav a:hover { color: #fff; text-decoration: none; }

/* ── Main ────────────────────────────────────────────────────── */
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* ── Homepage hero ───────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
}
.home-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: .6rem;
}
.hero-sub { color: var(--color-text-muted); font-size: 1.1rem; }

/* ── Tool section ────────────────────────────────────────────── */
.tool-section { margin-bottom: 2.5rem; }

.tool-heading {
  font-size: 1.35rem;
  font-weight: 700;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: .35rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.article-count {
  font-size: .78rem;
  font-weight: 500;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50px;
  padding: .15rem .6rem;
}

/* ── Error cards grid ────────────────────────────────────────── */
.error-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  list-style: none;
}

.error-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  transition: box-shadow .15s, border-color .15s;
}
.error-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--color-primary);
}

.error-card__link {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
  height: 100%;
}
.error-card__link:hover { text-decoration: none; }

.error-card__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-primary);
  font-family: var(--font-mono);
  word-break: break-all;
}

.error-card__desc {
  font-size: .82rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.error-card__ctx {
  font-size: .75rem;
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: .4rem;
  border-top: 1px solid var(--color-border);
}

/* ── Page layout (article + sidebar) ────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 780px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* ── Article body ────────────────────────────────────────────── */
.article-body { min-width: 0; }

.breadcrumb {
  font-size: .82rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); }

.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

/* ── Article HTML content ────────────────────────────────────── */
.article-content h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  margin-bottom: .5rem;
  line-height: 1.25;
}

.article-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--color-border);
}

.article-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 .5rem;
}

.article-content p { margin-bottom: 1rem; }

.article-content ul,
.article-content ol {
  margin: 0 0 1rem 1.25rem;
}
.article-content li { margin-bottom: .35rem; }

.article-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: .5rem 1rem;
  margin: 1rem 0;
  background: #eef4ff;
  color: var(--color-text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

/* ── Code styles ─────────────────────────────────────────────── */
.article-content code {
  font-family: var(--font-mono);
  font-size: .87em;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: .1em .35em;
}

.article-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  font-size: .87rem;
  line-height: 1.5;
}
.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Syntax highlighting (codehilite) */
.highlight { background: #1e1e2e; border-radius: var(--radius); }
.highlight pre { margin: 0; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 50px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.badge-tool { background: #e7f3ff; border-color: #b8d8ff; color: #0a3d78; }
.badge-context { background: #fff3cd; border-color: #ffc107; color: #6c5205; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar { position: sticky; top: 72px; }

.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.sidebar-card h3 {
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-card dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; }
.sidebar-card dt { font-size: .78rem; font-weight: 600; color: var(--color-text-muted); }
.sidebar-card dd { font-size: .82rem; }

.related-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.related-list li { font-size: .82rem; display: flex; flex-direction: column; gap: .2rem; }

.sidebar-card--cta { background: #0d6efd; border-color: #0a58ca; color: #fff; }
.sidebar-card--cta h3 { border-color: rgba(255,255,255,.3); color: #fff; }
.sidebar-card--cta p { font-size: .85rem; color: rgba(255,255,255,.85); margin-bottom: .75rem; }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--color-primary);
  font-weight: 700;
  font-size: .83rem;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  text-decoration: none;
}
.btn:hover { text-decoration: none; background: #e7f3ff; }

/* ── Ad slots ────────────────────────────────────────────────── */
.ad-slot {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--color-text-muted);
  font-size: .75rem;
  padding: .5rem;
  margin: 1.5rem 0;
}
.ad-slot--top    { min-height: 90px; }
.ad-slot--bottom { min-height: 90px; }
.ad-slot--sidebar { min-height: 250px; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  margin-top: 3rem;
  font-size: .82rem;
  color: var(--color-text-muted);
  text-align: center;
}
.site-footer p + p { margin-top: .4rem; }
.footer-links a { color: var(--color-text-muted); margin: 0 .2rem; }
.footer-links a:hover { color: var(--color-primary); }

/* ── Author byline ───────────────────────────────────────────── */
.author-byline {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  padding: .75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.author-avatar {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .03em;
}
.author-info {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.author-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--color-text);
}
.author-title {
  font-size: .78rem;
  color: var(--color-text-muted);
}
