/* ============================================================
   explodingradients.com — Global Styles
   Dev / AI Engineer vibe: minimal, code fonts, light + dark
   ============================================================ */

/* ---------- CSS custom properties ---------- */
:root {
  /* Light mode (default) */
  --bg:          #fafafa;
  --bg-card:     #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #6b7280;
  --accent:      #6366f1;       /* indigo */
  --accent-dim:  #818cf8;
  --link:        #2563eb;
  --border:      #e5e7eb;
  --code-bg:     #f3f4f6;
  --quote-bg:    #f0f0ff;
  --quote-border:#6366f1;
  --sep:         #e5e7eb;
  --tag-bg:      #eef2ff;
  --tag-text:    #4338ca;

  /* Fonts */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, monospace;
  --font-serif:  'Lora', 'Georgia', serif;

  /* Layout */
  --max-w:       720px;
  --max-w-wide:  860px;
  --radius:      8px;
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0f0f0f;
    --bg-card:     #1a1a1a;
    --text:        #e5e5e5;
    --text-muted:  #9ca3af;
    --accent:      #818cf8;
    --accent-dim:  #a5b4fc;
    --link:        #60a5fa;
    --border:      #2a2a2a;
    --code-bg:     #1e1e2e;
    --quote-bg:    #1a1a2e;
    --quote-border:#818cf8;
    --sep:         #2a2a2a;
    --tag-bg:      #1e1b4b;
    --tag-text:    #a5b4fc;
  }
}

/* Manual toggle class (for JS theme switcher) */
[data-theme="dark"] {
  --bg:          #0f0f0f;
  --bg-card:     #1a1a1a;
  --text:        #e5e5e5;
  --text-muted:  #9ca3af;
  --accent:      #818cf8;
  --accent-dim:  #a5b4fc;
  --link:        #60a5fa;
  --border:      #2a2a2a;
  --code-bg:     #1e1e2e;
  --quote-bg:    #1a1a2e;
  --quote-border:#818cf8;
  --sep:         #2a2a2a;
  --tag-bg:      #1e1b4b;
  --tag-text:    #a5b4fc;
}

[data-theme="light"] {
  --bg:          #fafafa;
  --bg-card:     #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #6b7280;
  --accent:      #6366f1;
  --accent-dim:  #818cf8;
  --link:        #2563eb;
  --border:      #e5e7eb;
  --code-bg:     #f3f4f6;
  --quote-bg:    #f0f0ff;
  --quote-border:#6366f1;
  --sep:         #e5e7eb;
  --tag-bg:      #eef2ff;
  --tag-text:    #4338ca;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; }

p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
a:hover { border-bottom-color: var(--link); }

/* ---------- Code elements ---------- */
code, pre, .mono {
  font-family: var(--font-mono);
}

code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}

pre {
  background: var(--code-bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

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

/* ---------- Blockquote ---------- */
blockquote {
  margin: 2rem 0;
  padding: 0.75rem 1.5rem;
  border-left: 4px solid var(--quote-border);
  background: var(--quote-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-muted);
}

/* ---------- Layout containers ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container--wide {
  max-width: var(--max-w-wide);
}

/* ---------- Header / Nav ---------- */
.site-header {
  padding: 1.25rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}
.site-logo:hover { border-bottom-color: transparent; }

.site-logo .accent { color: var(--accent); }

.site-logo__svg {
  width: 132px;
  height: 132px;
  flex-shrink: 0;
}

/* Logo animation — stroke draw then fade-in fill */
.logo-fill {
  opacity: 0;
  animation: logoFadeIn 0.6s ease-in 1.6s forwards;
}
.logo-stroke {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: logoDraw 1.6s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
@keyframes logoDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes logoFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  background: var(--code-bg);
  border-color: var(--accent);
}

/* ---------- Homepage: article list ---------- */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro h1 {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.home-intro p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 540px;
}

/* Month-year separator */
.month-sep {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1.5rem 0 0.75rem;
  border-top: 2px solid var(--sep);
  margin-top: 1rem;
}

.month-sep:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Article card (homepage) */
.article-card {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.article-card:last-child { border-bottom: none; }
.article-card:hover { border-bottom-color: transparent; }

.article-card__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.article-card:hover .article-card__title { color: var(--accent); }

.article-card__meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-card__tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ---------- Article page ---------- */
.article-header {
  margin-bottom: 2.5rem;
}

.article-header .metadata {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.article-header h1 {
  font-size: 2.25rem;
  margin-bottom: 0;
}

.article-body ul, .article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--sep);
  margin: 3rem 0;
}

.article-body .highlight-box {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---------- Back link ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--accent); border-bottom-color: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  h1 { font-size: 1.75rem; }
  .article-header h1 { font-size: 1.75rem; }
  .site-header .container { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}
