
/* ==========================================================
   BLOG — extra styles, loaded after styles.css
   1. Blog index
   2. Article
   3. Prose
   4. Code blocks
   5. Article footer
   6. Responsive refinements
   ========================================================== */


/* ==========================================================
   1. BLOG INDEX
   ========================================================== */

.blog-hero {
  padding-top: calc(
    var(--header-height) + clamp(56px, 9vw, 130px)
  );
  padding-bottom: clamp(40px, 6vw, 80px);
}

.blog-hero__title {
  font-size: clamp(3.4rem, 15vw, 13rem);
}

.blog-hero__lede {
  margin-top: 28px;
  max-width: 44ch;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--color-muted);
}

/* Article list */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--section-spacing);
  border-top: 1px solid var(--color-foreground);
}

.post-row {
  min-width: 0;
  border-bottom: 1px solid var(--color-border);
}

/* Clickable article row */

.post-row > a {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding-block: clamp(24px, 4vw, 44px);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

/* Article thumbnail */

.post-row__thumbnail {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: var(--color-border);
}

/* Article date */

.post-row__date {
  display: block;
  min-width: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Article content */

.post-row__body {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.post-row__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" var(--display-opsz);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.post-row__excerpt {
  max-width: 56ch;
  color: var(--color-muted);
  line-height: 1.7;
  overflow-wrap: break-word;
}

.post-row__tags {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

/* Arrow */

.post-row__arrow {
  display: none;
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 180ms ease;
}

/* Hover */

@media (hover: hover) {
  .post-row > a:hover .post-row__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
  }

  .post-row > a:hover .post-row__arrow {
    transform: translate(3px, -3px);
  }
}

/* Keyboard accessibility */

.post-row > a:focus-visible {
  outline: 2px solid var(--color-foreground);
  outline-offset: 5px;
  border-radius: 4px;
}

/* Empty blog state */

.blog-empty {
  padding-block: 40px 0;
  color: var(--color-muted);
  max-width: 44ch;
}

.blog-empty strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  color: var(--color-foreground);
  margin-bottom: 8px;
  line-height: 1.1;
}


/* ==========================================================
   1A. TABLETS
   Two-column thumbnail and content layout
   ========================================================== */

@media (min-width: 600px) {
  .post-row > a {
    grid-template-columns: minmax(200px, 42%) minmax(0, 1fr);
    column-gap: clamp(20px, 3vw, 32px);
    row-gap: 12px;
    align-items: start;
  }

  .post-row__thumbnail {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
  }

  .post-row__date {
    grid-column: 2;
    grid-row: 1;
  }

  .post-row__body {
    grid-column: 2;
    grid-row: 2;
  }
}


/* ==========================================================
   1B. DESKTOP
   Larger thumbnail with date and article beside it
   ========================================================== */

@media (min-width: 800px) {
  .post-row > a {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: clamp(24px, 3vw, 40px);
    row-gap: 12px;
  }

  .post-row__thumbnail {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 100%;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    align-self: start;
  }

  .post-row__date {
    grid-column: 2;
    grid-row: 1;
  }

  .post-row__body {
    grid-column: 2;
    grid-row: 2;
  }

  .post-row__arrow {
    display: block;
    grid-column: 3;
    grid-row: 1 / span 2;
    padding-top: 2px;
  }
}


/* ==========================================================
   1C. LARGE DESKTOPS
   ========================================================== */

@media (min-width: 1200px) {
  .post-row > a {
    grid-template-columns: minmax(340px, 380px) minmax(0, 1fr) auto;
    column-gap: 40px;
  }
}


/* ==========================================================
   2. ARTICLE
   ========================================================== */

.post-progress {
  position: fixed;
  z-index: 60;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: none;
}

.post-progress span {
  display: block;
  height: 100%;
  background: var(--color-foreground);
  transform-origin: left;
  transform: scaleX(0);
}

.post {
  padding-top: calc(
    var(--header-height) + clamp(40px, 7vw, 96px)
  );
  padding-bottom: var(--section-spacing);
}


.post__wrap {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  min-width: 0;
}

/* Keep the article heading aligned to the left */
.post__intro {
  max-width: 900px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.post__title {
  max-width: 850px;
  text-align: left;
  text-wrap: balance;
}

.post__lede {
  max-width: 680px;
  text-align: left;
  text-wrap: pretty;
}

.post__meta {
  justify-content: flex-start;
  text-align: left;
}


.post__crumb {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 28px;
}

.post__crumb a {
  border-bottom: 1px solid currentColor;
}

.post__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" var(--display-opsz);
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.post__lede {
  margin-top: 24px;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.5;
  color: var(--color-muted);
  overflow-wrap: break-word;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 32px;
  padding-block: 16px;
  border-block: 1px solid var(--color-border);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}


/* ==========================================================
   3. PROSE
   ========================================================== */


.prose {
  margin-top: 0;
  max-width: 760px;
  font-size: 1.0625rem;
  line-height: 1.85;
  text-align: left;
  overflow-wrap: break-word;
  min-width: 0;
}

.prose p {
  max-width: 70ch;
  text-wrap: pretty;
}

.prose h2,
.prose h3 {
  text-align: left;
  text-wrap: balance;
}

.prose h2 {
  margin-top: 2.5em;
  margin-bottom: 0;
}

.prose h3 {
  margin-top: 1.8em;
  margin-bottom: 0;
}

/* Make sections easier to distinguish */
.prose > section {
  margin-top: clamp(48px, 7vw, 76px);
  scroll-margin-top: calc(var(--header-height) + 24px);
}

/* Keep figures aligned with the text */
.prose figure {
  width: 100%;
  margin-block: clamp(28px, 4vw, 42px);
  margin-inline: 0;
  min-width: 0;
}

.prose figure img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 10px;
}

.prose figcaption {
  text-align: left;
  max-width: 70ch;
  margin-top: 12px;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--color-muted);
}


.prose > * + * {
  margin-top: 1.25em;
}

.prose h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" var(--display-opsz);
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  line-height: 1.1;
  margin-top: 2.2em;
  scroll-margin-top: calc(var(--header-height) + 16px);
  overflow-wrap: anywhere;
}

.prose h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  line-height: 1.15;
  margin-top: 1.8em;
  scroll-margin-top: calc(var(--header-height) + 16px);
  overflow-wrap: anywhere;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.8em;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose ul {
  list-style: disc;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose blockquote {
  margin-inline: 0;
  padding-left: 24px;
  border-left: 2px solid var(--color-foreground);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  line-height: 1.3;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: 2.4em;
}

.prose figure {
  margin-inline: 0;
  min-width: 0;
}

.prose figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.prose figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.prose :not(pre) > code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: rgba(17, 17, 17, 0.06);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}


/* ==========================================================
   4. CODE BLOCKS
   ========================================================== */

.prose pre {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  padding: 22px 24px;
  border-radius: 12px;
  background: var(--color-dark-background);
  color: var(--color-dark-foreground);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
  overflow-wrap: normal;
}

.prose pre code {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
}

.prose pre .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--color-dark-muted);
  border: 1px solid var(--color-dark-border);
  border-radius: 6px;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.prose pre :focus-visible {
  outline-color: var(--color-dark-foreground);
}


/* ==========================================================
   5. ARTICLE FOOTER
   ========================================================== */

.post-end {
  margin-top: clamp(48px, 7vw, 88px);
  padding-top: 28px;
  border-top: 1px solid var(--color-foreground);
  display: grid;
  gap: 28px;
}

.post-end__author {
  display: grid;
  gap: 6px;
}

.post-end__author strong {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
}

.post-end__author span {
  color: var(--color-muted);
  max-width: 46ch;
}

.post-end__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
}


/* ==========================================================
   6. SMALL SCREEN REFINEMENTS
   ========================================================== */

@media (max-width: 380px) {
  .post-row > a {
    gap: 12px;
    padding-block: 24px;
  }

  .post-row__title {
    font-size: clamp(1.65rem, 8vw, 1.9rem);
  }

  .post-row__excerpt {
    font-size: 0.95rem;
  }

  .prose pre {
    padding: 18px 14px;
    font-size: 0.8rem;
  }
}


/* ==========================================================
   7. REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
  .post-row__arrow {
    transition: none;
  }
}



/* Editorial table of contents */
.post-toc {
  max-width: 760px;
  margin-block: 48px 64px;
  padding: 24px 0;
  border: 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
}

.post-toc__title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
}

.post-toc ol {
  margin: 0;
  padding-left: 1.25rem;
}

.post-toc li {
  padding-block: 5px;
}

.post-toc a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
}

@media (hover: hover) {
  .post-toc a:hover {
    text-decoration: underline;
  }
}

/* Reviews: left-aligned, simple and readable */
.post-reviews {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-block: 32px;
}

.post-reviews blockquote {
  margin: 0;
  padding: 20px;
  border-left: 2px solid #14683d;
  background: rgba(20, 104, 61, 0.04);
  border-radius: 0 8px 8px 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
}

.post-reviews blockquote p {
  margin: 0 0 12px;
}

.post-reviews cite {
  font-size: 0.8rem;
  font-style: normal;
  color: var(--color-muted);
}

@media (max-width: 600px) {
  .post__wrap {
    padding-inline: max(var(--page-gutter), 18px);
  }

  .post-reviews {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-toc {
    margin-block: 36px 48px;
  }
}
