/* base.css – Modern-Minimal Blog Style (2025)
   Typography-first, content-first design with fluid responsive patterns */

/* 1. CSS Custom Properties for 2025 Theming */
:root {
  --accent-color: #5a00d2;
  --accent-hover: #4a00b2;
  --text-color: #111;
  --bg-color: #fff;
  --code-bg: #f5f5f5;
  --border-color: #ddd;
  --muted-color: #555;
  --light-bg: #f9f9f9;
  
  /* Fluid typography scale */
  --font-size-base: clamp(1rem, 2.5vw, 1.125rem);
  --font-size-large: clamp(1.25rem, 4vw, 1.5rem);
  --font-size-small: clamp(0.875rem, 2vw, 0.9rem);
  
  /* Spacing scale */
  --space-xs: clamp(0.5rem, 2vw, 0.75rem);
  --space-sm: clamp(1rem, 3vw, 1.25rem);
  --space-md: clamp(1.5rem, 4vw, 2rem);
  --space-lg: clamp(2rem, 5vw, 3rem);
}

/* Dark mode custom properties */
@media (prefers-color-scheme: dark) {
  :root {
    --accent-color: #9f7bff;
    --accent-hover: #b899ff;
    --text-color: #eee;
    --bg-color: #111;
    --code-bg: #222;
    --border-color: #444;
    --muted-color: #999;
    --light-bg: #1a1a1a;
  }
}

/* 2. Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Utility Classes */
.hidden {
  display: none !important;
  visibility: hidden !important;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--text-color);
  scroll-behavior: smooth;
}

body {
  max-width: 66ch;
  margin: var(--space-md) auto;
  padding: 0 var(--space-sm);
}

/* 3. Fluid Headings & Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3.5vw, 1.75rem); }
h4 { font-size: clamp(1.125rem, 3vw, 1.5rem); }

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

/* 4. Modern Link Styling */
a {
  color: var(--accent-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.125em;
  transition: all 0.2s ease;
}

a:hover, a:focus {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

/* 5. Lists */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: var(--space-sm);
}

li {
  margin-bottom: 0.25rem;
}

/* 6. Code & Pre */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: var(--code-bg);
  padding: 0.125em 0.375em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background-color: var(--code-bg);
  padding: var(--space-sm);
  overflow-x: auto;
  border-radius: 6px;
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

/* 7. Blockquotes */
blockquote {
  border-left: 4px solid var(--border-color);
  margin: var(--space-sm) 0;
  padding: var(--space-xs) var(--space-sm);
  color: var(--muted-color);
  font-style: italic;
  background-color: var(--light-bg);
}

/* 8. Responsive Images & Media */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-sm) 0;
  border-radius: 4px;
}

/* 9. Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-small);
}

th, td {
  border: 1px solid var(--border-color);
  padding: var(--space-xs);
  text-align: left;
}

th {
  background-color: var(--light-bg);
  font-weight: 600;
}

/* 10. Utility Elements */
hr {
  margin: var(--space-lg) 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

small {
  color: var(--muted-color);
  font-size: var(--font-size-small);
}

/* 11. Navigation */
nav {
  margin-bottom: var(--space-md);
}

nav a {
  margin-right: var(--space-sm);
  font-weight: 500;
  text-decoration: none;
}

nav a:hover, nav a:focus {
  text-decoration: underline;
}

/* 12. Article Styling */
article {
  margin-bottom: var(--space-lg);
}

article h2 {
  font-size: var(--font-size-large);
}

article time {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-small);
  color: var(--muted-color);
}

/* 13. Enhanced Focus & Accessibility */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* 14. Print Styles */
@media print {
  body {
    max-width: none;
    margin: 0;
    padding: 1rem;
    font-size: 12pt;
    line-height: 1.4;
  }
  
  a {
    color: inherit;
    text-decoration: none;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}
  