@import url("../site.css");

:root {
  /* Fraunces for the blog's display titles; body prose stays Lora, UI stays Inter. */
  --font-display: "Fraunces", Georgia, serif;
}

body {
  line-height: 1.55;
}

/* ── Layout ─────────────────────────────────────── */

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 24px 96px;
}

/* ── Header ─────────────────────────────────────── */

.header { margin-bottom: 36px; }

.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

/* ── "why donut hole?" footer tooltip ───────────── */

.why-name {
  position: relative;
  display: inline-block;
}

.why-name-trigger {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.why-name-trigger:hover { color: var(--text); }

.why-bubble {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: min(420px, 78vw);
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.why-name:hover .why-bubble,
.why-name:focus-within .why-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.why-bubble p { margin: 0 0 0.7em; }
.why-bubble p:last-child { margin-bottom: 0; }

.why-quote {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text);
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

/* ── Links ──────────────────────────────────────── */

.back-link {
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* ── Filter chips ───────────────────────────────── */

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 40px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.label {
  color: var(--muted);
  font-size: 0.83rem;
  min-width: 48px;
}

.chip {
  appearance: none;
  border: 0;
  background: none;
  padding: 2px 2px;
  font-size: 0.83rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1.5;
}
.chip:hover { color: var(--text); }
.chip.active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ── Year groups ────────────────────────────────── */

.year-block { margin-bottom: 36px; }

.year-heading {
  margin: 0 0 0;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Entry rows ─────────────────────────────────── */

.entry {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 0 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.entry-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: 0.77rem;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.entry-read {
  font-size: 0.69rem;
  opacity: 0.75;
}

.entry-main { min-width: 0; }

.entry-title {
  margin: 0 0 4px;
  font-size: 0.97rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.entry-title a {
  text-decoration: none;
  transition: color 0.15s;
}
.entry-title a:hover { color: var(--accent); }

.entry.is-draft .entry-title { color: var(--muted); font-weight: 500; }

.entry-excerpt {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.entry.is-draft .entry-excerpt { opacity: 0.75; }

.tag-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.69rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* Topic (research / life) reads as the primary axis: soft, muted terracotta tint. */
.tag-research,
.tag-life {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  color: color-mix(in srgb, var(--accent) 72%, var(--text));
}

/* Type (thoughts / knowledge) stays the quieter neutral outlined pill. */
.tag-type {
  background: none;
}

/* ── Empty state ────────────────────────────────── */

.empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 14px 16px;
  font-size: 0.88rem;
}

/* ── Footer ─────────────────────────────────────── */

.footer-note { display: none; }

.site-footer {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer p {
  margin: 0;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capy {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.capy svg {
  display: block;
  flex: 0 0 auto;
}

/* Back-to-top button styles live in site.css (imported above). */

/* ── Post page ──────────────────────────────────── */

.post-page {
  max-width: 800px;
}

.post-page .post-nav {
  margin: 0 0 48px;
}

.post-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.post-date {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
}

.post-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.post-dek {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.reading-time::before {
  content: "·";
  margin: 0 0.5em;
  color: var(--border);
}

/* ── Prev / next pager ──────────────────────────── */

.post-pager {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 48%;
  text-decoration: none;
}

.pager-next {
  margin-left: auto;
  text-align: right;
}

.pager-dir {
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.pager-title {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
  transition: color 0.15s;
}

.pager-link:hover .pager-title { color: var(--accent); }

/* ── Post body ──────────────────────────────────── */

.post-body {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.78;
}

.post-body > *:first-child { margin-top: 0; }

.post-body p { margin: 0 0 1.25em; }

.post-body h2 {
  font-family: var(--font-sans);
  margin: 2.2em 0 0.6em;
  font-size: 0.97rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}

.post-body li { margin: 0.45em 0; }
.post-body li ul { margin: 0.45em 0 0.65em; }

.post-body em { font-style: italic; }

.post-body a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.post-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.2em 0;
}

.post-placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ── Table of contents (side rail) ──────────────── */

/* Anchor jumps land a little below the top instead of flush against it. */
html { scroll-behavior: smooth; }
.post-body h2,
.post-body h3 { scroll-margin-top: 90px; }

/* Hidden by default; only shown when the viewport is wide enough to fit a
   rail beside the centered 800px column (built in post.js). */
.post-toc { display: none; }

@media (min-width: 1280px) {
  .post-toc {
    display: block;
    position: fixed;
    top: 140px;
    left: max(24px, calc(50% - 640px));
    width: 200px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 12px;
  }

  .post-toc-title {
    margin: 0 0 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .post-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--border);
  }

  .post-toc li { margin: 0; }
  .post-toc .toc-sub a { padding-left: 24px; }

  .post-toc a {
    display: block;
    padding: 5px 0 5px 14px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
  }

  .post-toc a:hover { color: var(--text); }

  .post-toc a.is-active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
  }
}
