/* ============================================================
   style.css
   1. CSS Custom Properties
   2. Reset & Base
   3. Typography
   4. Layout
   5. Header & Navigation
   6. Homepage
   7. Blog Archive
   8. Individual Post
   9. About Page
   10. Footer
   11. Utilities
   12. Responsive
   ============================================================ */

/* ── 1. CSS Custom Properties ─────────────────────────────── */
:root {
  --bg:           #0f0f0f;
  --bg-alt:       #161616;
  --border:       #2a2a2a;
  --text:         #e4e4e4;
  --text-muted:   #aaa;
  --accent:       #c8a96e;
  --accent-dim:   #8a7048;
  --link:         #c8a96e;
  --link-hover:   #e8c98e;
  --tag-bg:       #1e1a12;
  --tag-text:     #c8a96e;
  --code-bg:      #1a1a1a;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body:    "DM Sans", system-ui, sans-serif;
  --font-mono:    "DM Mono", "Courier New", monospace;
  --space-xs:  0.375rem;
  --space-sm:  0.75rem;
  --space-md:  1.5rem;
  --space-lg:  3rem;
  --space-xl:  6rem;
  --max-width: 720px;
  --header-h:  64px;
  --transition: 150ms ease;
}

/* ── 2. Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }

/* ── 3. Typography ────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); margin-top: var(--space-lg); }
h3 { font-size: 1.2rem; margin-top: var(--space-md); }
p  { margin-bottom: var(--space-md); }
a  { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }
.post-body a { text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 500; }
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  color: var(--text-muted);
  font-style: italic;
  margin: var(--space-md) 0;
}
hr { border: none; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}
pre code { background: none; padding: 0; font-size: 0.875rem; color: var(--text); }
.post-body ul, .post-body ol { padding-left: 1.5rem; margin-bottom: var(--space-md); }
.post-body li { margin-bottom: var(--space-xs); }

/* ── 4. Layout ────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--max-width); margin-inline: auto; padding-inline: var(--space-md); }
.site-header .container {
  max-width: calc(var(--max-width) + 120px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.site-main { flex: 1; padding-top: var(--space-lg); padding-bottom: var(--space-xl); }

/* ── 5. Header & Navigation ───────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-logo { font-family: var(--font-display); font-size: 1.2rem; color: var(--text); }
.site-logo:hover { color: var(--accent); }
.site-nav { display: flex; gap: var(--space-md); }
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover, .site-nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: var(--space-xs); }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); transition: transform var(--transition); }

/* ── 6. Homepage ──────────────────────────────────────────── */
.home-hero { padding: var(--space-lg) 0 var(--space-md); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.home-hero .subtitle { color: var(--text-muted); font-size: 1.05rem; max-width: 520px; }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-md); }
.section-header h2 {
  margin-top: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
}
.section-header a { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.section-header a:hover { color: var(--accent); }
.home-section { margin-bottom: var(--space-xl); }

/* ── 7. Blog Archive ──────────────────────────────────────── */
.archive-header { padding: var(--space-lg) 0 var(--space-md); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.tag-filter { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-lg); }
.tag-filter-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.tag-filter-btn:hover, .tag-filter-btn.active { background: var(--tag-bg); border-color: var(--accent-dim); color: var(--accent); }
.post-list { display: flex; flex-direction: column; list-style: none; }
.post-item { padding: var(--space-md) 0; border-bottom: 1px solid var(--border); }
.post-item:first-child { padding-top: 0; }
.post-item-meta { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-xs); flex-wrap: wrap; }
.post-item-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.post-item h2, .post-item h3 { margin-top: 0; font-size: 1.2rem; margin-bottom: var(--space-xs); }
.post-item h2 a, .post-item h3 a { color: var(--text); }
.post-item h2 a:hover, .post-item h3 a:hover { color: var(--accent); }
.post-item p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0; }

/* ── Tag badges ───────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2em 0.55em;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--accent-dim);
  transition: background var(--transition);
}
.tag:hover { background: #2a2010; color: var(--link-hover); }

/* ── 8. Individual Post ───────────────────────────────────── */
.post { padding-top: var(--space-sm); }
.post-header { padding-bottom: var(--space-lg); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.post-tags { display: flex; gap: var(--space-xs); margin-bottom: var(--space-sm); }
.post-title { margin-bottom: var(--space-sm); }
.post-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: var(--space-sm); }
.post-description { color: var(--text-muted); font-size: 1rem; margin-bottom: 0; }
.post-body { max-width: 65ch; }
.post-body h2 { margin-top: var(--space-lg); }
.post-body h3 { margin-top: var(--space-md); }
.post-footer { margin-top: var(--space-xl); padding-top: var(--space-md); border-top: 1px solid var(--border); }
.back-link { font-size: 0.875rem; color: var(--text-muted); }
.back-link:hover { color: var(--accent); }

/* ── 9. About Page ────────────────────────────────────────── */
.about-header { padding: var(--space-lg) 0 var(--space-md); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.about-body { max-width: 65ch; }
.about-body p { color: var(--text-muted); }
.about-body strong { color: var(--text); }
.about-body ul { padding-left: 1.5rem; margin-bottom: var(--space-md); }
.about-body li { margin-bottom: var(--space-xs); }

/* ── 10. Resources Page ───────────────────────────────────── */
.resources-header { padding: var(--space-lg) 0 var(--space-md); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.resources-intro { color: var(--text-muted); font-size: 1rem; margin-bottom: 0; max-width: 52ch; }
.resources-body { max-width: 65ch; }
.resources-section { margin-bottom: var(--space-xl); }
.resources-section h2 { margin-top: 0; }
.resource-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-sm); }
.resource-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
}
.resource-name { font-weight: 500; color: var(--accent); font-family: var(--font-mono); font-size: 0.9rem; }
.resource-desc { color: var(--text-muted); font-size: 0.875rem; line-height: 1.5; }

/* ── 11. Footer ───────────────────────────────────────────── */
.site-footer { border-top: 1px solid rgba(255,255,255,0.12); padding: var(--space-lg) 0; font-size: 0.8rem; color: var(--text-muted); }
.site-footer .container { max-width: calc(var(--max-width) + 120px); display: flex; align-items: center; justify-content: space-between; }
.site-footer p { margin-bottom: 0; }
.footer-copy { flex: 1; white-space: nowrap; }
.footer-social { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-sm); }
.footer-social a { display: flex; align-items: center; color: var(--text-muted); transition: color 0.2s ease, transform 0.2s ease; }
.footer-social a:hover { color: var(--accent); transform: translateY(-2px); }
.footer-tagline { flex: 1; font-family: var(--font-mono); text-align: right; white-space: nowrap; }

/* ── 12. Utilities ────────────────────────────────────────── */
.post-item[hidden] { display: none; }

/* ── 13. Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --space-lg: 2rem; --space-xl: 3.5rem; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) 0;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: var(--space-sm) var(--space-md); border-bottom: none; }
  .site-footer .container { flex-direction: column; gap: var(--space-sm); }
  .footer-copy, .footer-tagline { flex: none; text-align: center; }
  .footer-tagline { text-align: center; }
  .section-header { flex-direction: column; gap: var(--space-xs); }
}
