/* Blog — Magic Internet Math
   Editorial design: warm paper, EB Garamond, ink text, restrained accent.
   Modeled on the study-guide aesthetic (hashbook/txbook), NOT the hub neon theme.
   Blog pages are self-contained: they do not load main.css. */

:root {
  --paper: #faf7f1;
  --paper-deep: #f3efe6;
  --ink: #211d16;
  --ink-soft: #453e33;
  --warm-gray: #8a7f70;
  --hairline: #e3ddd1;
  --accent: #b45f1d;        /* burnt sienna */
  --accent-deep: #8a4715;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 1.2rem;
  line-height: 1.75;
  min-height: 100vh;
}

::selection { background: rgba(180, 95, 29, 0.18); }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Masthead ===== */

.masthead {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.6rem 1.25rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.masthead-brand {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.masthead-brand:hover { text-decoration: none; color: var(--accent-deep); }

.masthead-brand .brand-mark { color: var(--accent); }

.masthead-nav {
  display: flex;
  gap: 1.4rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead-nav a { color: var(--warm-gray); }
.masthead-nav a:hover { color: var(--accent-deep); text-decoration: none; }
.masthead-nav a.active { color: var(--ink); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

/* ===== Blog index ===== */

.blog-hero {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4rem 1.25rem 1rem;
  text-align: center;
}

.blog-hero h1 {
  font-size: 2.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.blog-hero p {
  margin-top: 0.9rem;
  font-style: italic;
  color: var(--warm-gray);
  font-size: 1.15rem;
}

.blog-hero::after {
  content: "❦";
  display: block;
  margin-top: 2rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.post-list {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.post-entry {
  display: block;
  color: var(--ink);
  padding: 2.2rem 0;
}

.post-entry + .post-entry { border-top: 1px solid var(--hairline); }

.post-entry:hover { text-decoration: none; }

.post-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warm-gray);
}

.post-meta .meta-tags { color: var(--accent); }

.post-entry h2 {
  margin-top: 0.55rem;
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
  transition: color 0.15s ease;
}

.post-entry:hover h2 { color: var(--accent-deep); }

.post-entry .post-subtitle {
  margin-top: 0.35rem;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.12rem;
}

.post-entry .post-excerpt {
  margin-top: 0.85rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

.post-entry .read-more {
  display: inline-block;
  margin-top: 1rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* ===== Article ===== */

.article {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 3rem;
}

.article-header { text-align: center; margin-bottom: 3rem; }

.article-header .post-meta { margin-bottom: 1.1rem; }

.article-header h1 {
  font-size: 2.7rem;
  font-weight: 500;
  line-height: 1.15;
  color: var(--ink);
}

.article-header .article-subtitle {
  margin-top: 0.9rem;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--warm-gray);
  line-height: 1.5;
}

.article-header::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 2px;
  background: var(--accent);
  margin: 2.2rem auto 0;
}

.article p { margin-bottom: 1.35rem; }

/* Reference links in body prose: visible but quiet */
.article p a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(180, 95, 29, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article p a:hover {
  color: var(--accent-deep);
  text-decoration-color: var(--accent-deep);
}

/* Drop cap on the opening paragraph */
.article p.lettrine::first-letter {
  float: left;
  font-size: 3.9em;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--accent-deep);
  font-weight: 500;
}

.article h2 {
  margin: 2.8rem 0 1.1rem;
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.article strong { font-weight: 700; color: var(--ink); }
.article em { color: inherit; }

.article code {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.78em;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.08em 0.34em;
  color: var(--accent-deep);
  white-space: nowrap;
}

.article blockquote {
  border-left: 2px solid var(--accent);
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.3rem;
  font-style: italic;
  color: var(--ink-soft);
}

.article hr {
  border: none;
  text-align: center;
  margin: 2.6rem 0;
}

.article hr::after {
  content: "· · ·";
  color: var(--warm-gray);
  letter-spacing: 0.6em;
  font-size: 1rem;
}

.article-footer {
  margin-top: 3.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.article-footer .back-link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.article-footer .article-author {
  font-style: italic;
  color: var(--warm-gray);
  font-size: 1.02rem;
}

/* ===== Comments ===== */

.comments {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.comments-title {
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--hairline);
  padding-top: 2.2rem;
  margin-bottom: 1.4rem;
}

.comments-empty {
  font-style: italic;
  color: var(--warm-gray);
}

.comment {
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--hairline);
}

.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.comment-author {
  font-weight: 600;
  color: var(--ink);
}

.comment-date {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warm-gray);
  white-space: nowrap;
}

.comment-npub {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  color: var(--warm-gray);
  word-break: break-all;
  margin: 0.15rem 0 0.5rem;
}

.comment-body {
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.comment-form { margin-top: 1.8rem; }

.comment-input {
  width: 100%;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  resize: vertical;
}

.comment-input:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.7rem;
}

.comment-submit {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent-deep);
  border: none;
  border-radius: 4px;
  padding: 0.65rem 1.4rem;
  cursor: pointer;
}

.comment-submit:hover { background: var(--accent); }
.comment-submit:disabled { opacity: 0.5; cursor: default; }

.comment-status {
  font-style: italic;
  color: var(--warm-gray);
  font-size: 0.98rem;
}

.comments-note {
  margin-top: 1.4rem;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--warm-gray);
}

/* ===== Site footer ===== */

.site-footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warm-gray);
}

.site-footer a { color: var(--warm-gray); }
.site-footer a:hover { color: var(--accent-deep); }

/* ===== Small screens ===== */

@media (max-width: 640px) {
  body { font-size: 1.12rem; }
  .blog-hero { padding-top: 2.5rem; }
  .blog-hero h1 { font-size: 2.2rem; }
  .article-header h1 { font-size: 2rem; }
  .article { padding-top: 2.5rem; }
  .post-entry h2 { font-size: 1.55rem; }
}


/* Article figures (added for blog images) */
.article figure { margin: 2.4rem 0 1.4rem; }
.article figure img { display: block; width: 100%; max-width: 100%; height: auto; border: 1px solid rgba(0,0,0,0.12); border-radius: 6px; }
.article figcaption { font-size: 0.82em; line-height: 1.5; opacity: 0.7; margin-top: 0.6rem; }
