/* Dan Builds Blog — clean, readable, operator-focused */

:root {
  --bg: #ffffff;
  --bg-alt: #f8f7f4;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #e85d04;
  --accent-hover: #d45003;
  --border: #e5e5e5;
  --code-bg: #f4f4f4;
  --max-w: 680px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111;
    --bg-alt: #1a1a1a;
    --text: #e5e5e5;
    --text-muted: #999999;
    --accent: #ff7b2e;
    --accent-hover: #ff9a5c;
    --border: #2a2a2a;
    --code-bg: #1e1e1e;
  }
}

:root[data-theme="dark"] {
  --bg: #111111;
  --bg-alt: #1a1a1a;
  --text: #e5e5e5;
  --text-muted: #999999;
  --accent: #ff7b2e;
  --accent-hover: #ff9a5c;
  --border: #2a2a2a;
  --code-bg: #1e1e1e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

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

.site-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}

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

.site-nav { display: flex; gap: 24px; align-items: center; }
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--text); }

.btn-subscribe {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-subscribe:hover { background: var(--accent-hover); }

/* Hero — homepage */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero p {
  color: var(--text-muted);
  font-size: 18px;
  max-width: 500px;
  margin: 0 auto;
}

/* Inline subscribe form */
.subscribe-inline {
  margin: 32px auto 0;
  max-width: 440px;
  display: flex;
  gap: 8px;
}
.subscribe-inline input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.subscribe-inline input:focus { border-color: var(--accent); }
.subscribe-inline input::placeholder { color: var(--text-muted); }
.subscribe-inline button {
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.subscribe-inline button:hover { background: var(--accent-hover); }

.subscribe-heading {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 16px;
  letter-spacing: -0.3px;
}

.subscribe-msg {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: var(--accent);
  min-height: 20px;
}

.subscribe-note {
  text-align: center;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Post list */
.post-list { padding: 20px 0 60px; }

.post-card {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.post-card:first-child { border-top: 1px solid var(--border); }

.post-card a { text-decoration: none; color: inherit; display: block; }

.post-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-card h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  margin-bottom: 8px;
  transition: color 0.2s;
}
.post-card a:hover h2 { color: var(--accent); }

.post-card .excerpt {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.read-more {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* Article page */
.article-header {
  padding: 48px 0 32px;
  text-align: center;
}
.article-header .post-meta { margin-bottom: 12px; }
.article-header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 16px;
}
.article-header .reading-time {
  font-size: 14px;
  color: var(--text-muted);
}

.article-body { padding: 0 0 48px; }

.article-body h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 40px 0 16px;
  letter-spacing: -0.3px;
}
.article-body h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-body p { margin-bottom: 20px; }

.article-body strong { font-weight: 600; }

.article-body ul, .article-body ol {
  margin: 16px 0 20px 24px;
}
.article-body li { margin-bottom: 6px; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 0 8px 8px 0;
}

.article-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

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

/* CTA box after article */
.article-cta {
  background: var(--bg-alt);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  margin: 48px 0;
}
.article-cta h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.article-cta p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 20px;
}
.article-cta .subscribe-inline { margin: 0 auto; }

/* Subscribe popup/modal */
.subscribe-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.subscribe-popup.active { display: flex; }

.popup-content {
  background: var(--bg);
  border-radius: 16px;
  padding: 40px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.popup-content h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.popup-content p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
}
.popup-content .subscribe-inline {
  flex-direction: column;
  max-width: 100%;
}
.popup-content .subscribe-inline button { width: 100%; }

.popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.popup-close:hover { color: var(--text); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 28px; }
  .article-header h1 { font-size: 26px; }
  .subscribe-inline { flex-direction: column; }
  .subscribe-inline button { width: 100%; }
  .site-nav { gap: 16px; }
  .popup-content { padding: 28px 20px; }
}
