/*
  Shared styles for /blog/ - writing by John Knipper.

  Two page shapes share this sheet:
    - the index (list of posts), body class "index"
    - a single post,          body class "post"

  Palette + type stack mirror /chrome/chrome.css and /paw/paw.css so
  jkn.me feels like one site. Dark only; tuned for mobile-first reading.

  Adding a post: create /blog/<slug>/index.html (copy an existing one),
  then add one entry to /blog/posts.json. The index renders itself from
  that file. No build step - everything ships verbatim on push.
*/

@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #07040f;
  --bg-deep: #020108;
  --card: #151026;
  --card-hi: #23183d;
  --accent: #f4c35d;
  --accent-soft: rgba(244, 195, 93, 0.18);
  --text-hi: #fff5e4;
  --text-mid: #e4d7f7;
  --text-lo: #a695c6;
  --stroke: rgba(255, 255, 255, 0.18);
  --max-w: 860px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(
      1200px 800px at 20% 0%,
      #241641 0%,
      transparent 60%
    ),
    radial-gradient(900px 700px at 80% 120%, #1d1137 0%, transparent 55%),
    var(--bg-deep);
  color: var(--text-mid);
  font-family: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.62;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px 64px;
}

/* --- back link (breadcrumb) --- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-lo);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.3px;
  margin-bottom: 28px;
  transition: color 0.15s ease, transform 0.15s ease;
}

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

.back .arrow {
  transition: transform 0.15s ease;
}

.back:hover .arrow {
  transform: translateX(-3px);
}

/* --- page header (index) --- */

.page-head {
  text-align: center;
  margin-bottom: 44px;
}

.page-head h1 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--text-hi);
  font-size: clamp(34px, 6vw, 48px);
  letter-spacing: -0.5px;
  margin: 0 0 10px;
}

.page-head p {
  color: var(--text-lo);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto;
}

.tag-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -10px 0 34px;
}

.tag-filters[hidden] {
  display: none;
}

.tag-filters-label {
  margin-right: 3px;
  color: var(--text-lo);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.tag-filter {
  appearance: none;
  padding: 6px 11px;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--text-lo);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.tag-filter:hover {
  border-color: rgba(244, 195, 93, 0.5);
  color: var(--text-hi);
}

.tag-filter.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.tag-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subscribe {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--text-hi);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: border-color 0.18s ease, background 0.18s ease,
    transform 0.18s ease;
}

.subscribe:hover {
  border-color: rgba(244, 195, 93, 0.4);
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}

.subscribe svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* --- index layout: article list (left) + card feed --- */

.blog-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: start;
}

.blog-sidebar {
  position: sticky;
  top: 24px;
}

.sidebar-title {
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-lo);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--stroke);
}

.article-list {
  display: grid;
  gap: 2px;
}

.article-link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-mid);
  transition: background 0.15s ease, color 0.15s ease;
}

.article-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-hi);
}

.article-link-title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.article-link-date {
  display: block;
  font-size: 11px;
  color: var(--text-lo);
  margin-top: 2px;
}

.sidebar-loading {
  color: var(--text-lo);
  font-size: 13px;
  margin: 0;
}

@media (max-width: 640px) {
  .blog-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .blog-sidebar {
    position: static;
  }
}

/* --- post list (index) --- */

.post-list {
  display: grid;
  gap: 16px;
}

.post-card {
  display: block;
  padding: 24px 24px 22px;
  background: linear-gradient(
      160deg,
      rgba(244, 195, 93, 0.04) 0%,
      transparent 45%
    ),
    var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 195, 93, 0.4);
  box-shadow: 0 12px 30px rgba(244, 195, 93, 0.08);
}

.post-card .meta {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.post-card h2 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--text-hi);
  font-size: 22px;
  letter-spacing: -0.2px;
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.post-card h2 .arrow {
  font-family: "Manrope", sans-serif;
  color: var(--text-lo);
  font-size: 18px;
  transition: transform 0.18s ease, color 0.18s ease;
}

.post-card:hover h2 .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.post-card p {
  color: var(--text-mid);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0;
}

.empty {
  text-align: center;
  padding: 28px;
  border: 1px dashed var(--stroke);
  border-radius: 18px;
  color: var(--text-lo);
  font-size: 14px;
}

/* --- single post --- */

.post-head {
  margin-bottom: 30px;
  padding-bottom: 0;
}

.post-head .meta {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.post-head h1 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--text-hi);
  font-size: clamp(28px, 5.4vw, 42px);
  letter-spacing: -0.4px;
  line-height: 1.15;
  margin: 0;
}

.post-meta-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-bottom: 14px;
}

.post-meta-row .meta {
  display: inline;
  margin: 0;
}

.post-fact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--text-lo);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
}

.tech-level {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 1.5px;
}

.post-summary {
  margin: 0 0 34px;
  padding: 19px 21px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 72%),
    var(--card);
  border: 0;
  border-radius: 14px;
}

.post-summary .summary-label {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.post-summary p {
  margin: 0;
  color: var(--text-hi);
  font-size: 14.5px;
  line-height: 1.6;
}

.reading-progress {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.reading-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #c98f31, var(--accent));
  box-shadow: 0 0 12px rgba(244, 195, 93, 0.62);
}

.reading-progress-label {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  top: 5px;
  left: 0;
  writing-mode: vertical-rl;
  max-height: calc(100vh - 12px);
  padding: 11px 7px 11px 6px;
  background: var(--accent);
  border-radius: 0 0 9px 0;
  box-shadow: 6px 0 18px rgba(0, 0, 0, 0.35);
  color: #1b102a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.reading-progress-title {
  overflow: hidden;
  color: #1b102a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-progress-time {
  flex: none;
  padding-top: 8px;
  border-top: 1px solid rgba(27, 16, 42, 0.32);
  white-space: nowrap;
}

.reading-progress-time[hidden] {
  display: none;
}

/* The one interactive part of the spine: a single-click back-to-top.
   The container is pointer-events: none, so re-enable here; upright
   orientation keeps the arrow pointing up inside vertical-rl text. */
.reading-progress-top {
  flex: none;
  padding-top: 8px;
  border-top: 1px solid rgba(27, 16, 42, 0.32);
  text-orientation: upright;
  pointer-events: auto;
  cursor: pointer;
}

.reading-progress-top:hover {
  opacity: 0.6;
}

.reading-progress.is-active .reading-progress-label {
  opacity: 1;
  transform: translateX(0);
}

/* article prose */

article.prose {
  color: var(--text-mid);
  font-size: 16.5px;
  line-height: 1.7;
}

article.prose > * {
  margin: 0 0 20px;
}

article.prose h2 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--text-hi);
  font-size: 24px;
  letter-spacing: -0.2px;
  margin: 40px 0 14px;
}

article.prose h3 {
  color: var(--text-hi);
  font-size: 19px;
  font-weight: 700;
  margin: 30px 0 10px;
}

article.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.15s ease;
}

article.prose a:hover {
  border-bottom-color: var(--accent);
}

article.prose strong {
  color: var(--text-hi);
}

abbr.term {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-style: dashed;
  text-decoration-color: rgba(244, 195, 93, 0.88);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: help;
}

abbr.term:hover,
abbr.term:focus-visible {
  color: var(--text-hi);
  text-decoration-color: var(--accent);
  outline: none;
}

.term-definition {
  position: fixed;
  z-index: 1100;
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  padding: 9px 11px;
  background: #2b2040;
  border: 1px solid rgba(244, 195, 93, 0.42);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.48);
  color: var(--text-hi);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  pointer-events: none;
}

.term-definition[hidden] {
  display: none;
}

article.prose ul,
article.prose ol {
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

article.prose ul li,
article.prose ol li {
  position: relative;
  padding-left: 24px;
}

article.prose ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent);
  font-size: 12px;
}

article.prose ol {
  counter-reset: item;
}

article.prose ol li::before {
  counter-increment: item;
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

article.prose blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent-soft);
  color: var(--text-lo);
  font-style: italic;
}

article.prose code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13.5px;
  background: var(--card-hi);
  color: var(--text-hi);
  padding: 2px 7px;
  border-radius: 6px;
}

article.prose pre {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
}

article.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

article.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--stroke);
}

article.prose hr {
  border: 0;
  border-top: 1px solid var(--stroke);
  margin: 36px 0;
}

.post-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 44px;
}

.post-tags-label {
  margin-right: 3px;
  color: var(--text-lo);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

article.prose .post-tag {
  padding: 5px 10px;
  border: 1px solid rgba(244, 195, 93, 0.34);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.2;
}

article.prose .post-tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* --- footer --- */

footer.site-footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--stroke);
  color: var(--text-lo);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  justify-content: center;
  align-items: center;
}

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

footer.site-footer a:hover {
  color: var(--text-hi);
}

footer.site-footer .dot {
  opacity: 0.4;
}
