/* ============================================================
   Global Styles
   ============================================================ */

/* --- Reset -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* --- Base --------------------------------------------------- */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Layout wrapper ---------------------------------------- */
.site-wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main {
  flex: 1;
  padding-block: var(--space-xl);
}

/* --- Typography -------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-moss);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  color: var(--color-olive);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--color-copper);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: 1.05rem;
  color: var(--color-gold);
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
}

p { margin-bottom: var(--space-md); }

/* --- Links -------------------------------------------------- */
a {
  color: var(--color-olive);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: color var(--transition), text-decoration-color var(--transition);
}
a:hover {
  color: var(--color-copper);
  text-decoration-color: var(--color-copper);
}

/* --- Inline code ------------------------------------------- */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: transparent;
  color: inherit;
  border-radius: 3px;
  padding: 0.05em 0.25em;
  white-space: nowrap;
  font-weight: 400;
  letter-spacing: -0.01em;
  opacity: 0.78;
}

/* --- Code blocks (Prism) ----------------------------------- */
pre[class*="language-"] {
  position: relative;
  border-radius: var(--radius-lg);
  margin-block: var(--space-lg);
  border: 1px solid var(--color-border);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.5rem 1.25rem;
}

/* Extra top space when language label is shown */
pre[class*="language-"]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.55rem;
  left: 1.5rem;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  pointer-events: none;
}

pre[class*="language-"] code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

/* --- Lists -------------------------------------------------- */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: var(--space-md);
}
li { margin-bottom: var(--space-xs); }

/* --- Blockquote -------------------------------------------- */
blockquote {
  border-left: 4px solid var(--color-gold);
  background: var(--color-surface);
  padding: var(--space-md) var(--space-lg);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-block: var(--space-md);
  font-style: italic;
  color: var(--color-muted);
}

/* --- Tables ------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin-block: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 480px;
}

thead {
  background: var(--gradient-brand);
}
thead th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

tbody tr { transition: background var(--transition); }
tbody tr:nth-child(even) { background: var(--color-surface); }
tbody tr:hover { background: var(--color-surface-2); }

td {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-border);
  vertical-align: top;
}

/* --- HR ----------------------------------------------------- */
hr {
  border: none;
  border-top: 2px solid var(--color-border);
  margin-block: var(--space-xl);
}

/* --- Article content wrapper ------------------------------- */
.article-body {
  line-height: 1.9;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body li {
  margin-bottom: 0.4rem;
  line-height: 1.8;
}

.article-body h2:first-of-type { margin-top: 0; }

/* --- Utility ------------------------------------------------ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.text-muted { color: var(--color-muted); }

/* --- Responsive -------------------------------------------- */
@media (max-width: 768px) {
  h2 { margin-top: var(--space-lg); }
  main { padding-block: var(--space-lg); }
}

