/* ============================================================
   jjw.sh — blog
   Loaded after /styles.css. The shell stays monospace; reading
   surfaces use a quiet system sans stack.
   ============================================================ */

/* ---------- navigation and access ---------- */

.blog-page .nav {
  min-width: 0;
  padding-inline: clamp(0.75rem, 4vw, 1.25rem);
}

.blog-page .nav-links {
  min-width: 0;
  flex-wrap: nowrap;
  gap: clamp(0.65rem, 4vw, 1.1rem);
}

.blog-page .nav-links a {
  white-space: nowrap;
}

.blog-page .nav-links a[aria-current] {
  color: var(--accent);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.45rem 0.7rem;
  color: var(--bg);
  background: var(--accent);
  transform: translateY(-180%);
  transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

.blog-page :where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- shared blog layout ---------- */

body.blog-page {
  overflow-wrap: anywhere;
}

.blog-main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 7rem 1.25rem 4.5rem;
  scroll-margin-top: 5rem;
}

.blog-main :where(h1, h2, h3, p, ul, ol, blockquote, pre, table, figure) {
  overflow-wrap: anywhere;
}

.blog-header {
  margin: 0 0 4.5rem;
}

.blog-eyebrow,
.post-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.blog-eyebrow {
  color: var(--accent);
  text-transform: lowercase;
}

.blog-header h1,
.post-header h1 {
  max-width: 26ch;
  margin: 0.6rem 0 1.1rem;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 2.55rem);
  font-weight: 650;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.blog-intro,
.post-summary {
  max-width: 65ch;
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.72;
}

/* ---------- index ---------- */

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

.post-item {
  max-width: 65ch;
}

.post-item + .post-item {
  margin-top: 2.75rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--border);
}

.post-item h2 {
  max-width: 42ch;
  margin: 0.45rem 0 0.65rem;
  font-size: clamp(1.18rem, 2.5vw, 1.4rem);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.post-item h2 a {
  color: var(--text);
}

.post-item h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

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

/* Keep the crossed-out word legible without overpowering the title. */
.post-item h2 del,
.post-header h1 del {
  text-decoration-thickness: 1px;
  text-decoration-color: var(--text-dim);
}

/* ---------- article ---------- */

.post-header {
  margin-bottom: 3.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.65rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

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

.post-header .post-meta {
  margin-top: 0.25rem;
}

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

.draft-notice {
  max-width: 65ch;
  margin: 2rem 0 3rem;
  padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--border);
  color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.prose {
  max-width: 65ch;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 1.02rem;
  line-height: 1.78;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose h2,
.prose h3 {
  color: var(--text);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
  scroll-margin-top: 5rem;
}

.prose h2 {
  margin: 3.3rem 0 1rem;
  font-size: 1.45rem;
}

.prose h3 {
  margin: 2.35rem 0 0.75rem;
  font-size: 1.15rem;
}

.prose p {
  margin: 0 0 1.35rem;
}

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

.prose ul,
.prose ol {
  margin: 0 0 1.4rem;
  padding-left: 1.45rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.15rem 0 0.15rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--text-dim);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose :not(pre) > code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-raised);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.prose pre {
  max-width: 100%;
  margin: 1.8rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-raised);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

.prose pre code {
  font: inherit;
  white-space: inherit;
}

.prose hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table {
  display: block;
  max-width: 100%;
  margin: 1.8rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.55;
  white-space: nowrap;
}

.prose :where(th, td) {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text);
  font-weight: 650;
  background: var(--bg-raised);
}

.prose td {
  color: var(--text-dim);
}

.prose figure {
  max-width: 100%;
  margin: 2.1rem 0;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
}

.prose figcaption {
  margin-top: 0.7rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.55;
}

.post-footer {
  max-width: 65ch;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ---------- highlights and inline asides ---------- */

.prose .md-highlight {
  color: inherit;
  background: color-mix(in srgb, var(--accent) 15%, var(--bg));
  box-shadow: inset 0 -1px color-mix(in srgb, var(--accent) 55%, transparent);
  padding: 0.04em 0.13em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Notes remain ordinary inline text until the interaction script is ready. */
.md-aside-trigger { display: none; }
.md-aside:not(.aside-ready) .md-aside-popover::before { content: " ("; }
.md-aside:not(.aside-ready) .md-aside-popover::after { content: ")"; }
.md-aside-popover { font-size: 0.9em; }

.aside-ready .md-aside-trigger {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  vertical-align: super;
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.aside-ready .md-aside-trigger:hover,
.aside-ready .md-aside-trigger[aria-expanded="true"] {
  background: var(--selection);
}

.aside-ready .md-aside-popover {
  display: block;
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 12px;
  width: min(24rem, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-raised);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  line-height: 1.65;
  font-weight: 400;
  font-style: normal;
  text-align: left;
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  overflow-wrap: anywhere;
}

.md-aside-popover[hidden] { display: none; }

@media (pointer: coarse) {
  .aside-ready .md-aside-trigger { min-width: 2rem; min-height: 2rem; }
}

@media print {
  .aside-ready .md-aside-trigger { display: none; }
  .aside-ready .md-aside-popover,
  .aside-ready .md-aside-popover[hidden] {
    display: inline;
    position: static;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .md-aside-popover::before { content: " ("; }
  .md-aside-popover::after { content: ")"; }
}

/* ---------- footer ---------- */

.blog-footer {
  max-width: 760px;
  margin-top: 0;
}

.blog-footer .back-link {
  margin-bottom: 0;
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .blog-main {
    padding-top: 5.75rem;
    padding-bottom: 3rem;
  }

  .blog-header {
    margin-bottom: 3.5rem;
  }

  .blog-header h1,
  .post-header h1 {
    max-width: 20ch;
    font-size: clamp(1.85rem, 9vw, 2.3rem);
  }

  .post-item + .post-item {
    margin-top: 2.2rem;
    padding-top: 2.2rem;
  }

  .post-header {
    margin-bottom: 2.75rem;
  }

  .prose {
    font-size: 1rem;
  }

  .prose h2 {
    margin-top: 2.7rem;
  }

  .prose pre {
    margin-inline: 0;
    padding-inline: 0.8rem;
  }
}

@media (max-width: 390px) {
  .blog-main {
    padding-inline: 1rem;
  }

  .blog-page .nav-links {
    gap: 0.55rem;
    font-size: 0.8rem;
  }

  .blog-header h1,
  .post-header h1 {
    max-width: 17ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}
