/* Shared blog styles  */
* { box-sizing: border-box; }

/* 1. Set Dark Mode as the Default Variables */
:root {
  --bg: #1a1a1a;
  --fg: #eaeaea;
  --muted: #9a9a9a;
  --accent: #992538;
  --post-bg: rgba(255, 255, 255, 0.03);
  --shadow: rgba(0, 0, 0, 0.6);
  --article-p: #ddd;
  --pre-bg: rgba(255, 255, 255, 0.05);
  --pre-text: #e6eef6;
}

/* 2. Overrides for Light Mode */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #efeeee;
    --fg: #222222;
    --muted: #666666;
    --accent: #b01b2e; /* Slightly adjusted for contrast */
    --post-bg: #f9f9f9;
    --shadow: rgba(0, 0, 0, 0.175);
    --article-p: #444444;
    --pre-bg: #f4f4f4;
    --pre-text: #222222;
  }
}

/* Base Styles using Variables */
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

.container { max-width: 1000px; margin: 4rem auto; padding: 2rem; }

.post {
  background: var(--post-bg); /* Use variable */
  border-radius: 10px;
  padding: 1.6rem;
  box-shadow: 0 6px 18px var(--shadow); /* Use variable */
  text-align: justify;
}

header h1 { margin: 0 0 .25rem 0; font-size: clamp(1.6rem, 4vw, 2.8rem); line-height: 1.05; }
.meta { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }

article p {
  margin: 0 0 1rem 0;
  line-height: 1.8;
  color: var(--article-p); /* Use variable */
  font-size: clamp(1rem, 2.4vw, 1.05rem);
}

section { margin-top: 1rem; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace; }

pre {
  background: var(--pre-bg); /* Use variable */
  padding: 12px;
  border-radius: 8px;
  margin-top: 1rem;
  color: var(--pre-text); /* Use variable */
  overflow: auto;
}

pre code { white-space: pre; display: block; }
code[style] { display: block; }
footer { margin-top: 2rem; text-align: center; color: var(--muted); font-size: .9rem; }
a { color: var(--accent); }

/* Responsive adjustments */
@media (max-width: 920px) { .container { padding: 1.5rem; } }
@media (max-width: 520px) {
  .container { margin: 2rem 1rem; padding: 1rem; }
  .post { padding: 1rem; }
  .meta { font-size: .9rem; }
  header h1 { font-size: clamp(1.4rem, 6vw, 1.8rem); }
}

/* 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; }