/* ═══════════════════════════════════════════
   PERSONAL SITE — "The Builder's Notebook"
   Editorial warmth meets craftsman precision
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,600&family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg:        #1a1816;
  --bg-warm:   #1f1c19;
  --bg-card:   #252220;
  --bg-hover:  #2d2926;
  --border:    #3a3530;
  --border-lt: #4a4440;
  --text:      #e8e2d8;
  --text-dim:  #a09888;
  --text-faint:#706858;
  --heading:   #f0ece4;
  --accent:    #d4a53c;
  --accent-lt: #e8c56a;
  --accent-dim:#d4a53c22;
  --accent-med:#d4a53c44;
  --serif:     'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:      'Lora', 'Georgia', serif;
  --mono:      'IBM Plex Mono', 'SF Mono', monospace;
  --max-w:     1080px;
  --r:         6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  min-height: 100vh;
  /* Subtle warm grain texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-lt); }

h1, h2, h3, h4 { font-family: var(--serif); color: var(--heading); font-weight: 600; line-height: 1.25; }
h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin-bottom: 1rem; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 2rem; }

/* ── NAV ─────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
nav .container { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; padding-bottom: 1rem; }
.nav-logo { font-family: var(--serif); font-size: 1.3rem; color: var(--accent); font-weight: 700; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

/* ── HERO ────────────────────────── */
.hero { padding: 5rem 0 4rem; position: relative; }
.hero::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 60px; height: 2px; background: var(--accent);
}
.hero-grid { display: grid; grid-template-columns: auto 1fr; gap: 3rem; align-items: center; }
.hero-avatar {
  width: 160px; height: 160px; border-radius: 50%;
  border: 3px solid var(--accent-dim); object-fit: cover;
  filter: sepia(10%) contrast(1.05);
}
.hero-label { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.75rem; }
.hero h1 { margin-bottom: 0.75rem; }
.hero h1 em { font-style: italic; color: var(--accent-lt); }
.hero-sub { color: var(--text-dim); font-size: 1.05rem; max-width: 540px; line-height: 1.8; }

/* ── SECTION DIVIDERS ────────────── */
section { padding: 4rem 0; }
.sec-head {
  display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border); padding-bottom: 1rem;
}
.sec-num { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
.sec-head h2 { flex-shrink: 0; }
.sec-head::after { content: ''; flex: 1; }
.sec-label { font-family: var(--mono); font-size: 0.75rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; margin-left: auto; }

/* ── STATS BAR ───────────────────── */
.stats-bar {
  display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; margin: 2rem 0;
}
.stat-item {
  flex: 1; text-align: center; padding: 1.25rem 1rem;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-num { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--accent); display: block; }
.stat-label { font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── CARDS ────────────────────────── */
.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.75rem; position: relative;
  transition: border-color 0.3s, transform 0.2s;
  display: block; text-decoration: none; color: inherit;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); color: inherit; }
.card-tag {
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.75rem;
  display: inline-block;
}
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0; line-height: 1.65; }
.card-arrow {
  position: absolute; top: 1.75rem; right: 1.75rem;
  color: var(--text-faint); font-size: 1.1rem; transition: color 0.3s;
}
.card:hover .card-arrow { color: var(--accent); }

/* ── TIMELINE ────────────────────── */
.timeline { position: relative; padding-left: 3rem; margin-top: 1rem; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--accent), var(--accent-dim), transparent);
}
.tl-item { position: relative; margin-bottom: 2.5rem; padding-bottom: 0.5rem; }
.tl-item::before {
  content: ''; position: absolute; left: -2.9rem; top: 0.6rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--accent-dim);
}
.tl-year { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); margin-bottom: 0.25rem; }
.tl-item h3 { font-family: var(--serif); margin-bottom: 0.4rem; }
.tl-item p { color: var(--text-dim); font-size: 0.9rem; line-height: 1.7; margin-bottom: 0.5rem; }
.tl-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent);
  border: 1px solid var(--accent-dim); padding: 0.15rem 0.5rem;
  border-radius: 3px;
}
.tl-links { margin-top: 0.4rem; font-size: 0.85rem; }
.tl-links a { margin-right: 1rem; }

/* ── GIST / BLOG CARDS ───────────── */
.gist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.gist-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.25rem;
  transition: border-color 0.3s; display: block; text-decoration: none; color: inherit;
}
.gist-card:hover { border-color: var(--accent); color: inherit; }
.gist-card h4 { font-family: var(--serif); font-size: 1rem; margin-bottom: 0.4rem; color: var(--heading); }
.gist-card p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.5rem; line-height: 1.6; }
.gist-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--accent); }

/* ── BLOG LIST ───────────────────── */
.blog-list { list-style: none; }
.blog-list li {
  border-bottom: 1px solid var(--border); padding: 1.25rem 0;
  display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: baseline;
}
.blog-list li:last-child { border-bottom: none; }
.blog-date { font-family: var(--mono); font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }
.blog-title { font-family: var(--serif); font-weight: 600; }
.blog-title a { color: var(--heading); }
.blog-title a:hover { color: var(--accent); }
.blog-read { font-family: var(--mono); font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }

/* ── PULLQUOTE ───────────────────── */
.pullquote {
  border-left: 3px solid var(--accent); padding: 1.5rem 2rem;
  margin: 2rem 0; background: var(--accent-dim); border-radius: 0 var(--r) var(--r) 0;
  font-family: var(--serif); font-style: italic; font-size: 1.1rem;
  color: var(--heading); line-height: 1.7;
}

/* ── PRINCIPLES GRID ─────────────── */
.principles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.principle {
  padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-card);
}
.principle-num { font-family: var(--mono); font-size: 2rem; color: var(--accent-dim); font-weight: 700; line-height: 1; margin-bottom: 0.75rem; }
.principle h4 { font-family: var(--serif); margin-bottom: 0.5rem; }
.principle p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0; }

/* ── TABLE ───────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { font-family: var(--mono); font-size: 0.7rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── CTA BUTTONS ─────────────────── */
.btn {
  display: inline-block; font-family: var(--mono); font-size: 0.8rem;
  letter-spacing: 0.06em; padding: 0.7rem 1.6rem; border-radius: var(--r);
  border: 1px solid var(--accent); color: var(--accent);
  text-transform: uppercase; transition: all 0.2s;
}
.btn:hover { background: var(--accent-dim); color: var(--accent-lt); }
.btn-fill { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-fill:hover { background: var(--accent-lt); color: var(--bg); }

/* ── FOOTER ──────────────────────── */
footer {
  padding: 3rem 0; text-align: center;
  border-top: 1px solid var(--border); margin-top: 2rem;
}
footer .foot-links { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem; flex-wrap: wrap; }
footer .foot-links a { font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
footer .foot-links a:hover { color: var(--accent); }
footer p { color: var(--text-faint); font-size: 0.8rem; font-family: var(--mono); }

/* ── RESPONSIVE ──────────────────── */
@media (max-width: 700px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-avatar { margin: 0 auto; }
  .hero-sub { margin: 0 auto; }
  .stats-bar { flex-wrap: wrap; }
  .stat-item { min-width: 33%; }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.7rem; }
  .blog-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .card-row { grid-template-columns: 1fr; }
}
