:root {
  --paper: #f3f4f8;
  --card: #ffffff;
  --ink: #1c1d26;
  --muted: #5b5e70;
  --line: #d9dce6;
  --cobalt: #2c46e8;
  --cobalt-deep: #1f33b8;
  --sun: #ffc83d;
  --pink: #ff9ac8;
  --mint: #4fd1a1;
  --sky: #9ec5ff;
  --display: "Unbounded", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", Roboto, Arial, sans-serif;
  box-sizing: border-box;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
body.nav-open { overflow: hidden; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.blog-wrap { width: min(1180px, 100%); margin: 0 auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }

/* Navigation */
.blog-header {
  position: sticky;
  z-index: 50;
  top: 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.blog-header.scrolled { border-color: var(--line); box-shadow: 0 8px 30px rgba(28, 29, 38, .05); }
.blog-nav { min-height: 4.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.blog-brand {
  font: 800 1rem var(--display);
  letter-spacing: -.015em;
  text-decoration: none;
  white-space: nowrap;
}
.blog-brand span { color: var(--cobalt); }
.blog-nav-links { display: flex; align-items: center; gap: clamp(1rem, 3vw, 1.8rem); list-style: none; margin: 0; padding: 0; font-weight: 700; }
.blog-nav-links a { text-decoration: none; }
.blog-nav-links a:hover, .blog-nav-links a[aria-current="page"] { color: var(--cobalt); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.blog-nav-toggle { display: none; width: 2.75rem; height: 2.75rem; border: 2px solid var(--ink); border-radius: 50%; background: transparent; cursor: pointer; }
.blog-nav-toggle span, .blog-nav-toggle span::before, .blog-nav-toggle span::after { display: block; width: 18px; height: 2px; margin: auto; background: currentColor; content: ""; transition: transform .2s ease, opacity .2s ease; }
.blog-nav-toggle span::before { transform: translateY(-6px); }
.blog-nav-toggle span::after { transform: translateY(4px); }
body.nav-open .blog-nav-toggle span { background: transparent; }
body.nav-open .blog-nav-toggle span::before { background: var(--ink); transform: translateY(2px) rotate(45deg); }
body.nav-open .blog-nav-toggle span::after { background: var(--ink); transform: rotate(-45deg); }

/* Index hero */
.blog-hero { overflow: hidden; border-bottom: 1px solid var(--line); }
.blog-hero-inner { position: relative; min-height: 37rem; display: grid; align-items: center; padding-block: clamp(4.5rem, 10vw, 8rem); }
.blog-hero-copy { position: relative; z-index: 2; max-width: 850px; }
.kicker { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1.25rem; font-weight: 700; color: var(--cobalt); letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.kicker::before { width: 2rem; height: 3px; background: currentColor; content: ""; }
.blog-hero h1, .article-title {
  margin: 0;
  font: 800 clamp(3rem, 8.2vw, 7.2rem)/.96 var(--display);
  letter-spacing: -.05em;
}
.blog-hero h1 { max-width: 10.5ch; }
.blog-hero h1 span { color: var(--cobalt); }
.blog-hero-copy > p:not(.kicker) { max-width: 43rem; margin: 1.5rem 0 0; color: var(--muted); font-size: clamp(1.1rem, 2vw, 1.35rem); line-height: 1.5; }
.hero-doodles { position: absolute; z-index: 1; inset: 0; pointer-events: none; }
.hero-note {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 9rem;
  min-height: 4rem;
  padding: .9rem 1.2rem;
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 6px 0 var(--ink);
  font: 700 .9rem var(--display);
  color: #1c1d26;
}
.hero-note:nth-child(1) { top: 17%; right: 4%; background: var(--sun); transform: rotate(7deg); }
.hero-note:nth-child(2) { top: 47%; right: 16%; background: var(--pink); transform: rotate(-6deg); }
.hero-note:nth-child(3) { right: 2%; bottom: 13%; background: var(--mint); transform: rotate(4deg); }
.hero-orbit { position: absolute; right: -8rem; top: 50%; width: 31rem; aspect-ratio: 1; border: 2px dashed var(--cobalt); border-radius: 50%; transform: translateY(-50%); opacity: .28; }

/* Posts */
.posts-section { padding-block: clamp(4rem, 8vw, 7rem); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.section-heading h2 { margin: 0; font: 800 clamp(2rem, 4vw, 3.5rem)/1 var(--display); letter-spacing: -.04em; }
.section-heading p { max-width: 34rem; margin: 0; color: var(--muted); }
.featured-post { margin-bottom: clamp(3rem, 7vw, 5.5rem); }
.featured-card { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(18rem, .85fr); min-height: 30rem; overflow: hidden; background: var(--cobalt); color: #fff; border-radius: 24px; box-shadow: 9px 10px 0 var(--ink); }
.featured-image { min-height: 25rem; overflow: hidden; background: var(--sky); }
.featured-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .55s cubic-bezier(.2,.8,.2,1); }
.featured-card:hover .featured-image img { transform: scale(1.035); }
.featured-copy { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: clamp(2rem, 5vw, 4rem); }
.post-label { display: inline-flex; align-items: center; align-self: flex-start; padding: .4rem .75rem; border-radius: 999px; background: var(--sun); color: #1c1d26; font-weight: 700; font-size: .82rem; }
.featured-copy h2 { margin: 0; font: 700 clamp(2rem, 4.3vw, 4rem)/1.05 var(--display); letter-spacing: -.045em; }
.featured-copy p { margin: 1rem 0 0; max-width: 38rem; color: #e4e8ff; font-size: 1.12rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1rem; font-size: .9rem; color: var(--muted); }
.featured-copy .post-meta { color: #e4e8ff; }
.post-meta span + span::before { margin-right: 1rem; content: "•"; opacity: .6; }
.post-link { display: inline-flex; align-items: center; gap: .55rem; align-self: flex-start; font-weight: 700; text-underline-offset: 5px; }
.post-link::after { content: "↗"; font-size: 1.2em; transition: transform .2s ease; }
.post-link:hover::after { transform: translate(3px, -3px); }

.post-tools { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.topic-filters { display: flex; gap: .6rem; flex-wrap: wrap; }
.filter-button { border: 2px solid var(--ink); border-radius: 999px; padding: .55rem 1rem; background: transparent; font-weight: 700; cursor: pointer; }
.filter-button:hover, .filter-button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.post-search { position: relative; min-width: min(100%, 19rem); }
.post-search input { width: 100%; border: 2px solid var(--line); border-radius: 999px; padding: .65rem 1rem .65rem 2.6rem; background: var(--card); color: var(--ink); }
.post-search::before { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); content: "⌕"; font-size: 1.25rem; }
.posts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.2rem, 3vw, 2rem); }
.post-card { display: grid; grid-template-columns: minmax(9rem, .8fr) minmax(0, 1.2fr); min-height: 17rem; overflow: hidden; border: 2px solid var(--ink); border-radius: 20px; background: var(--card); box-shadow: 5px 6px 0 var(--ink); transition: transform .2s ease, box-shadow .2s ease; }
.post-card:hover { transform: translate(-2px, -3px); box-shadow: 8px 10px 0 var(--ink); }
.post-card-image { min-height: 100%; background: var(--line); overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover img { transform: scale(1.04); }
.post-card-copy { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(1.25rem, 3vw, 2rem); }
.post-card h3 { margin: .9rem 0 .7rem; font: 700 clamp(1.2rem, 2vw, 1.55rem)/1.15 var(--display); letter-spacing: -.03em; }
.post-card p { margin: 0 0 1.2rem; color: var(--muted); line-height: 1.48; }
.post-card .post-meta { margin-top: auto; }
.post-card .post-link { margin-top: 1rem; }
.post-stats { display: flex; gap: .75rem; margin-top: .8rem; color: var(--muted); font-size: .85rem; }
.empty-state { max-width: 38rem; padding: 2rem; border: 2px dashed var(--line); border-radius: 18px; color: var(--muted); }
.empty-state[hidden] { display: none; }
.loading-card { min-height: 18rem; border-radius: 20px; background: linear-gradient(100deg, var(--line) 30%, #fff 50%, var(--line) 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; opacity: .65; }
@keyframes shimmer { to { background-position: -220% 0; } }

.blog-cta { padding-block: clamp(3rem, 7vw, 6rem); }
.blog-cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(2rem, 5vw, 4rem); border-radius: 24px; background: var(--sun); color: #1c1d26; }
.blog-cta h2 { max-width: 13ch; margin: 0; font: 800 clamp(2rem, 4vw, 3.5rem)/1.05 var(--display); letter-spacing: -.04em; }
.blog-cta p { max-width: 31rem; margin: .75rem 0 0; }
.pill-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: .85rem 1.35rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; }
.pill-button:hover { background: var(--cobalt); border-color: var(--cobalt); }

/* Article */
.article-main { padding: clamp(3rem, 7vw, 6rem) 0 clamp(5rem, 9vw, 8rem); }
.article-shell { width: min(1180px, 100%); margin: 0 auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
.back-link { display: inline-flex; gap: .55rem; align-items: center; margin-bottom: clamp(2.5rem, 6vw, 5rem); color: var(--muted); font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--cobalt); }
.article-head { max-width: 980px; }
.article-title { max-width: 13ch; font-size: clamp(2.7rem, 7vw, 6rem); }
.article-dek { max-width: 46rem; margin: 1.4rem 0 1.2rem; color: var(--muted); font-size: clamp(1.15rem, 2vw, 1.4rem); }
.article-cover { margin: clamp(2.5rem, 6vw, 5rem) 0; border: 2px solid var(--ink); border-radius: 24px; overflow: hidden; box-shadow: 8px 9px 0 var(--ink); background: var(--sky); }
.article-cover[hidden] { display: none; }
.article-cover img { width: 100%; max-height: 42rem; object-fit: cover; }
.article-layout { display: grid; grid-template-columns: minmax(0, 44rem) 13rem; justify-content: center; gap: clamp(3rem, 8vw, 7rem); align-items: start; }
.article-body { min-width: 0; font-size: 1.16rem; line-height: 1.78; }
.article-body > :first-child { margin-top: 0; }
.article-body h2, .article-body h3, .article-body h4 { margin: 2.4em 0 .75em; font-family: var(--display); line-height: 1.15; letter-spacing: -.035em; }
.article-body h2 { font-size: clamp(1.8rem, 4vw, 2.65rem); }
.article-body h3 { font-size: clamp(1.45rem, 3vw, 2rem); }
.article-body h4 { font-size: 1.25rem; }
.article-body a { color: var(--cobalt); text-underline-offset: 4px; }
.article-body blockquote { margin: 2rem 0; padding: 1.4rem 1.6rem; border-left: 7px solid var(--cobalt); border-radius: 0 14px 14px 0; background: var(--card); font-size: 1.2em; font-weight: 700; }
.article-body pre { max-width: 100%; overflow: auto; margin: 2rem 0; padding: 1.25rem; border-radius: 14px; background: #1c1d26; color: #f3f4f8; }
.article-body :not(pre) > code { padding: .12rem .35rem; border-radius: 5px; background: color-mix(in srgb, var(--cobalt) 10%, var(--card)); font-size: .92em; }
.article-body hr { margin: 3rem 0; border: 0; border-top: 2px solid var(--line); }
.article-body li + li { margin-top: .45rem; }
.article-actions { position: sticky; top: 7rem; display: grid; gap: .8rem; }
.action-button { display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%; padding: .75rem .9rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); cursor: pointer; font-weight: 700; }
.action-button:hover, .action-button[aria-pressed="true"] { background: var(--pink); }
.action-button:disabled { opacity: .55; cursor: wait; }
.article-actions small { color: var(--muted); text-align: center; }
.article-actions[hidden] { display: none; }
.external-article { max-width: 44rem; padding: 2rem; border-radius: 18px; background: var(--card); border: 2px solid var(--ink); }

/* Comments */
.comments { max-width: 720px; margin: clamp(5rem, 10vw, 8rem) auto 0; padding-top: 3rem; border-top: 2px solid var(--ink); }
.comments[hidden] { display: none; }
.comments h2 { margin: 0; font: 800 clamp(2rem, 4vw, 3rem)/1 var(--display); letter-spacing: -.04em; }
.comments-intro { margin: .75rem 0 2rem; color: var(--muted); }
.comment-form { display: grid; gap: 1rem; padding: clamp(1.25rem, 4vw, 2rem); border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.comment-form label { display: grid; gap: .4rem; font-weight: 700; }
.comment-form input, .comment-form textarea { width: 100%; border: 2px solid var(--line); border-radius: 11px; padding: .75rem .9rem; background: var(--paper); color: var(--ink); font-weight: 400; }
.comment-form textarea { min-height: 9rem; resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cobalt) 18%, transparent); }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.form-row small { color: var(--muted); }
.form-submit { border: 0; border-radius: 999px; padding: .8rem 1.25rem; background: var(--cobalt); color: #fff; cursor: pointer; font-weight: 700; }
.form-submit:disabled { opacity: .6; cursor: wait; }
.form-status { margin: 0; padding: .75rem 1rem; border-radius: 10px; background: color-mix(in srgb, var(--sky) 25%, var(--paper)); }
.form-status[data-state="success"] { background: color-mix(in srgb, var(--mint) 25%, var(--paper)); }
.form-status[data-state="error"] { background: color-mix(in srgb, #ff6159 15%, var(--paper)); }
.form-status[hidden] { display: none; }
.comment-list { display: grid; gap: 1.25rem; margin: 2.5rem 0 0; padding: 0; list-style: none; }
.comment { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.comment-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.comment-head strong { font-family: var(--display); font-size: .95rem; }
.comment-head time { color: var(--muted); font-size: .85rem; }
.comment p { margin: .55rem 0 0; white-space: pre-wrap; }
.no-comments { color: var(--muted); }

.article-error { max-width: 680px; margin: 5rem auto; padding: 2rem; border: 2px solid var(--ink); border-radius: 18px; background: var(--sun); }
.article-error h1 { margin: 0 0 .75rem; font: 800 2rem/1.1 var(--display); }
.article-error[hidden] { display: none; }

.blog-footer { padding: 2rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--muted); }
.blog-footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.blog-footer nav { display: flex; gap: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 960px) {
  .hero-doodles { opacity: .55; transform: translateX(13%); }
  .featured-card { grid-template-columns: 1fr; }
  .featured-image { max-height: 28rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .post-card { grid-template-columns: minmax(11rem, .72fr) minmax(0, 1.28fr); }
  .article-layout { grid-template-columns: minmax(0, 44rem); }
  .article-actions { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 24rem; }
  .article-actions small { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .blog-nav-toggle { display: block; }
  .blog-nav-links { position: fixed; inset: 4.75rem 0 0; z-index: 49; flex-direction: column; justify-content: center; gap: 1.5rem; background: var(--paper); opacity: 0; pointer-events: none; transform: translateY(-1rem); transition: opacity .2s ease, transform .2s ease; }
  .blog-nav-links a { font: 700 1.25rem var(--display); }
  body.nav-open .blog-nav-links { opacity: 1; pointer-events: auto; transform: none; }
  .blog-hero-inner { min-height: 34rem; }
  .hero-doodles { opacity: .25; transform: translateX(35%); }
  .section-heading, .blog-cta-inner { align-items: flex-start; flex-direction: column; }
  .post-tools { align-items: stretch; flex-direction: column; }
  .post-search { width: 100%; }
  .article-actions { grid-template-columns: 1fr; max-width: none; }
  .article-actions small { grid-column: auto; }
}

@media (max-width: 560px) {
  .blog-nav-links { align-items: flex-start; padding-inline: 2rem; }
  .blog-hero h1 { font-size: clamp(2.7rem, 14vw, 4.25rem); }
  .hero-note { min-width: 7rem; font-size: .75rem; }
  .post-card { grid-template-columns: 1fr; }
  .post-card-image { min-height: 13rem; max-height: 16rem; }
  .featured-card { box-shadow: 5px 6px 0 var(--ink); }
  .featured-image { min-height: 17rem; }
  .form-row { align-items: stretch; flex-direction: column; }
  .form-submit { width: 100%; }
}
