/* ==========================================================================
   Essays theme - light & clean, built for reading
   ========================================================================== */

/* Variables */
:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-soft-hover: #f1f3f5;
  --text: #1f2328;
  --text-soft: #59636e;
  --text-faint: #8b949e;
  --border: #e6e8eb;
  --accent: #2b5cdf;
  --accent-hover: #1d4ec3;
  --measure: 720px;
  --radius: 8px;
}

/* Reset */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

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

/* Header */
.site-header {
  padding: 56px 0 32px;
  text-align: center;
}

.site-title {
  font-size: 1.9em;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-title a:hover {
  color: var(--accent);
}

.site-subtitle {
  color: var(--text-soft);
  margin: 8px 0 0;
  font-size: 0.95em;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin: 24px 0 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 6px 14px;
  color: var(--text-soft);
  font-size: 0.9em;
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover {
  color: var(--accent);
  background: var(--bg-soft);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: rgba(43, 92, 223, 0.08);
}

/* Content */
.content {
  padding: 16px 0 64px;
}

/* Post (list + article) */
.post {
  margin: 0 0 48px;
  padding: 0 0 48px;
  border-bottom: 1px solid var(--border);
  display: flow-root;
  position: relative;
}

.post:last-of-type {
  border-bottom: none;
}

/* Listing card */
.post:not(.post-full) {
  margin: 0 0 24px;
  padding: 24px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border-bottom: none;
  transition: background 0.15s;
}

.post:not(.post-full):hover {
  background: var(--bg-soft-hover);
}

.post-title {
  margin: 0 0 6px;
  font-size: 1.5em;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--accent);
}

/* Make the whole post card clickable via the title link */
.post-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-meta {
  color: var(--text-faint);
  font-size: 0.88em;
  margin: 0 0 16px;
}

.post-meta a {
  color: var(--text-soft);
}

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

.post-summary {
  color: var(--text);
}

.post-summary p:last-child { margin-bottom: 0; }

.post-summary h1,
.post-summary h2,
.post-summary h3,
.post-summary h4 {
  font-size: 1em;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

/* Post thumbnail (index listing) */
.post-thumb {
  float: right;
  width: 112px;
  height: 112px;
  margin: 4px 0 4px 22px;
  border-radius: var(--radius);
  object-fit: cover;
  display: block;
}

.read-more {
  display: inline-block;
  margin: 20px 0 0;
  padding: 7px 16px;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--accent);
  background: rgba(43, 92, 223, 0.08);
  border-radius: 999px;
  transition: background 0.15s;
}

.post:hover .read-more {
  background: rgba(43, 92, 223, 0.14);
}

/* Full article */
.post-full { margin-top: 64px; }
.post-header { margin-bottom: 32px; }

.post-full .post-title {
  font-size: 2.1em;
  line-height: 1.2;
}

/* Post hero image (article) */
.post-hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0 0 32px;
}

/* Typography: article body (serif for reading essays) */
.post-content {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "URW Palladio L",
               P052, Palatino, "Times New Roman", serif;
  font-size: 1.08em;
  line-height: 1.75;
}

.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, sans-serif;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.post-content h1 { font-size: 1.6em; margin: 1.6em 0 0.6em; }
.post-content h2 { font-size: 1.35em; margin: 1.6em 0 0.6em; }
.post-content h3 { font-size: 1.15em; margin: 1.4em 0 0.5em; }
.post-content h4 { font-size: 1em; margin: 1.2em 0 0.4em; }

.post-content p { margin: 1em 0; }

.post-content a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(31, 35, 40, 0.45);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.post-content a:hover {
  text-decoration-color: var(--text);
  text-decoration-thickness: 2px;
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--border);
  color: var(--text-soft);
  font-style: italic;
}

.post-content ul,
.post-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.post-content li { margin: 0.4em 0; }

.post-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.post-content pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.5;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.86em;
}

.post-content img {
  border-radius: var(--radius);
  margin: 1.5em 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.post-content th {
  background: var(--bg-soft);
  font-weight: 600;
}

/* Update notice (inline editorial note) */
.update-notice {
  margin: 0 0 2em;
  padding: 12px 16px 13px;
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.update-notice > .update-label {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, sans-serif;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.update-notice .update-date {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
  font-weight: 500;
}

.update-notice > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95em;
}

.update-notice a {
  white-space: nowrap;
}

/* Hide editorial update notice in listing previews */
.post-summary .update-notice {
  display: none;
}

/* Inline corrections (errata) — struck term that opens a popover note */
.correction {
  font: inherit;
  color: var(--text);
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline dotted var(--text-faint);
  text-underline-offset: 3px;
}

.correction > s {
  color: var(--text-faint);
  text-decoration-color: var(--text-faint);
  text-decoration-thickness: 1.5px;
}

.correction:hover {
  text-decoration-color: var(--accent);
}

.correction:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.correction-popover {
  inset: 14vh 0 auto;
  margin: 0 auto;
  width: fit-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 16px 20px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  font-size: 0.95em;
  line-height: 1.55;
}

.correction-popover p {
  margin: 0;
}

.correction-popover strong {
  color: var(--accent);
  font-weight: 600;
}

/* Post footer (meta) */
.post-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.88em;
}

.post-footer p { margin: 0 0 4px; }

.tag-list a {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
}

.tag-list a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Generic page/list titles */
.page-title {
  font-size: 1.5em;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 32px;
}

.list-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-soft);
  margin: 0 0 32px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.list li:last-child { border-bottom: none; }

.list a {
  color: var(--accent);
  text-decoration: none;
}

.list a:hover { text-decoration: underline; }

/* Archive list */
.archive-list dt {
  color: var(--text-faint);
  font-size: 0.85em;
  margin-top: 12px;
}

.archive-list dt:first-child { margin-top: 0; }

.archive-list dd {
  margin: 0 0 4px;
}

.archive-list a {
  color: var(--text);
  text-decoration: none;
}

.archive-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Pagination */
.pagination ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 32px 0 0;
  padding: 0;
  font-size: 0.9em;
}

.pagination li { display: inline-block; }

.pagination a {
  display: inline-block;
  padding: 6px 12px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pagination a:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
}

.pagination .current {
  padding: 6px 12px;
  color: var(--text-soft);
}

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

.site-footer p { margin: 0; }

/* Responsive */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header { padding: 40px 0 24px; }
  .post-full .post-title { font-size: 1.7em; }
  .post-full { margin-top: 48px; }
  .post-thumb { width: 84px; height: 84px; margin-left: 16px; }
}
