/* ============================================================
   Jacob's Research Journal — Warm Modern Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #faf6f0;
  --surface:      #ffffff;
  --text:         #1c1917;
  --text-2:       #57534e;
  --text-3:       #a8a29e;
  --accent:       #b45309;
  --accent-hover: #92400e;
  --border:       #e7e5e4;
  --border-light: #f5f0eb;
  --code-bg:      #fdf4e7;
  --tag-bg:       #fef3c7;
  --tag-text:     #92400e;
  --shadow:       0 1px 3px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md:    0 4px 6px rgba(28, 25, 23, 0.07), 0 2px 4px rgba(28, 25, 23, 0.05);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Lora', Georgia, serif;

  --max-w:      680px;
  --max-w-wide: 800px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container--wide { max-width: var(--max-w-wide); }
main { flex: 1; }

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.site-title:hover { color: var(--accent); }
.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--accent); }
.rss-link {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.rss-link svg { flex-shrink: 0; }

/* ── Site Footer ───────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0;
  margin-top: 4rem;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-3);
}
.site-footer a {
  color: var(--text-2);
  font-size: 0.8125rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.site-footer a:hover { color: var(--accent); }

/* ── Homepage ──────────────────────────────────────────────── */
.home-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border-light);
}
.home-hero h1 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.home-hero p {
  font-size: 0.9375rem;
  color: var(--text-2);
  max-width: 480px;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-list-section {
  padding: 2.5rem 0;
}
.post-list-section h2 {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.25rem;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.375rem 1.5rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d6d0ca;
  color: inherit;
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.post-date {
  font-size: 0.8125rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.post-read-time {
  font-size: 0.8125rem;
  color: var(--text-3);
}
.post-read-time::before { content: "·"; margin-right: 0.625rem; }
.post-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.post-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.375rem;
  line-height: 1.35;
}
.post-card p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── Article / Post Page ───────────────────────────────────── */
.post-wrapper {
  padding: 2.5rem 0 4rem;
}
.post-header {
  margin-bottom: 2.5rem;
}
.post-header-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.post-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.625rem, 4vw, 2.125rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 1rem;
}
.post-header-byline {
  font-size: 0.875rem;
  color: var(--text-2);
}

/* ── Listen Widget ─────────────────────────────────────────── */
.listen-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin: 2rem 0 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.listen-widget-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.listen-widget-icon svg { color: white; }
.listen-widget-text { flex: 1; min-width: 180px; }
.listen-widget-text p {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
}
.listen-widget-text span {
  font-size: 0.75rem;
  color: var(--text-2);
}
.listen-widget a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.listen-widget a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Article Body ──────────────────────────────────────────── */
.post-body {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--text);
}
.post-body p { margin-bottom: 1.375rem; }
.post-body h2 {
  font-family: var(--font-sans);
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 2.5rem 0 0.875rem;
  line-height: 1.3;
}
.post-body h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.625rem;
}
.post-body h4 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  margin: 1.5rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-body ul, .post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.375rem;
}
.post-body li { margin-bottom: 0.375rem; }
.post-body a { color: var(--accent); font-style: italic; }
.post-body a:hover { color: var(--accent-hover); }
.post-body strong { font-weight: 600; font-style: normal; }
.post-body em { font-style: italic; }
.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.125rem 0 0.125rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-2);
  font-style: italic;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Code */
.post-body code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.8125em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-hover);
  font-style: normal;
}
.post-body pre {
  background: #1c1917;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid #292524;
}
.post-body pre code {
  background: none;
  padding: 0;
  color: #e7e5e4;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Tables */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  margin: 1.75rem 0;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-body th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-2);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.625rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.post-body td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  font-style: normal;
}
.post-body tr:last-child td { border-bottom: none; }
.post-body tr:hover td { background: var(--bg); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Sources */
.sources {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.sources h2 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1rem;
}
.sources ol {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-2);
  padding-left: 1.25rem;
  line-height: 1.7;
}
.sources a { color: var(--accent); font-style: normal; }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: 2rem;
  padding-top: 1.5rem;
}
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-3); }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header .container { flex-wrap: wrap; }
  .site-footer .container { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .post-body { font-size: 1rem; }
  .post-body pre { padding: 1rem; border-radius: 6px; }
  .post-body table { font-size: 0.8125rem; }
  .post-body th, .post-body td { padding: 0.5rem 0.75rem; }
  .listen-widget { padding: 0.875rem 1rem; }
}

/* ── Mobile nav toggle ─────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-2);
}
@media (max-width: 480px) {
  .nav-toggle { display: flex; align-items: center; }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 0 0.25rem;
    border-top: 1px solid var(--border-light);
    margin-top: 0.75rem;
  }
  .site-nav.open { display: flex; }
}
