/**
 * Reset CSS — Dark Theme Simplicity
 * Element-level resets and base typography
 * Version: 1.1.0
 *
 * RULE: Only element selectors and accessibility classes.
 *       No component classes. No utilities.
 */

/* This declaration controls cascade priority for the entire theme.
   If you add a new @layer anywhere, update this list. Order = priority (left = lowest).
   Unlayered CSS (components, header, page CSS) always beats any layer. */
@layer base, utilities;

@layer base {

/* ========== Box Model Reset ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ========== HTML ========== */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ========== Body ========== */
body {
  margin: 0;
  padding-top: 4rem; /* Fixed header offset — SINGLE SOURCE */
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--dark-bg);
  min-height: 100vh;
}

/* ========== Headings ========== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-md);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-secondary);
}

h1 {
  font-size: 2.25rem;
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: 1.875rem;
  margin-top: var(--spacing-2xl);
  margin-bottom: var(--spacing-lg);
}

h3 {
  font-size: 1.5rem;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
}

h4 {
  font-size: 1.25rem;
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

/* ========== Paragraphs ========== */
p {
  margin: 0 0 var(--spacing-md);
  color: var(--text-primary);
}

/* ========== Links ========== */
a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--accent-blue-hover);
}

a:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========== Lists ========== */
ul, ol {
  margin: 0 0 var(--spacing-lg);
  padding-left: var(--spacing-xl);
}

/* Structural lists (nav, footer, sidebar, breadcrumbs, TOC) should not show markers.
   Blog content lists keep default markers via .entry-content specificity. */
nav ul, nav ol,
footer ul, footer ol,
.breadcrumbs ol,
.widget-area ul, .widget-area ol,
.toc-container ul, .toc-container ol,
.toc-desktop ul, .toc-desktop ol,
.toc-mobile ul, .toc-mobile ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

/* ========== Blockquotes ========== */
blockquote {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md) var(--spacing-lg);
  border-left: 4px solid var(--accent-blue-muted);
  background: rgba(26, 26, 28, 0.8);
  border-radius: var(--radius-md);
  font-style: italic;
  color: var(--text-primary);
}

/* ========== Code ========== */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.2em 0.4em;
  background-color: rgba(12, 12, 14, 0.8);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

pre {
  margin: var(--spacing-xl) 0;
  padding: var(--spacing-lg);
  background-color: rgba(12, 12, 14, 0.8);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* ========== Horizontal Rule ========== */
hr {
  margin: var(--spacing-2xl) 0;
  border: 0;
  border-top: 1px solid var(--border-color);
}

/* ========== Images & SVG ========== */
img, svg {
  display: block;
  vertical-align: middle;
}

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

/* ========== Responsive Typography Scaling ========== */
@media (min-width: 768px) {
  html { font-size: 17px; }
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.625rem; }
}

@media (min-width: 1024px) {
  html { font-size: 18px; }
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }
  h3 { font-size: 1.75rem; }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; line-height: 1.2; }
  h2 { font-size: 1.75rem; line-height: 1.3; }
  h3 { font-size: 1.5rem; }
}

/* ========== Accessibility ========== */
.screen-reader-text,
.sr-only {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--accent-blue);
  clip: auto !important;
  clip-path: none;
  color: #ffffff;
  display: block;
  font-size: 1rem;
  font-weight: 600;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-blue);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ========== Accessibility Media Queries ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --text-muted: #cccccc;
    --accent-blue: #5eafff;
    --border-color: rgba(255, 255, 255, 0.3);
  }

  .btn {
    border-width: 2px;
  }

  a {
    text-decoration: underline;
  }
}

} /* end @layer base */
