/* =============================================================================
   Blog — index cards + article reading page
   -----------------------------------------------------------------------------
   Independent, framer-free styling for blog.html (index) and blog-post.html
   (single post). Reuses the shared design tokens (design-system.css) and the
   bordered-canvas section shell (.selected-projects* from projects.css); adds
   only the blog-specific pieces: linkable cards and long-form prose.
   ============================================================================= */

/* ---- Index: post cards --------------------------------------------------- */
/* Fluid backdrop for the Blog heading, matching the homepage and Projects
   treatments while keeping the text above a soft readability veil. */
.blog-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.blog-hero__fluid {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blog-hero__fluid-mount {
  width: 100%;
  height: 100%;
}

.blog-hero > .selected-projects__header {
  position: relative;
  z-index: 2;
}

.blog-hero::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    76% 98% at 50% 50%,
    rgba(var(--readability-scrim-rgb), 0.88) 0%,
    rgba(var(--readability-scrim-rgb), 0.66) 48%,
    rgba(var(--readability-scrim-rgb), 0) 84%
  );
  pointer-events: none;
  content: "";
}

.blog-hero-active .selected-projects__title,
.blog-hero-active .selected-projects__intro {
  text-shadow: 0 1px 10px rgba(var(--readability-scrim-rgb), 0.7), 0 0 3px rgba(var(--readability-scrim-rgb), 0.55);
}

/* Cards live inside .selected-projects__grid, so they mirror the project-card
   border treatment (hairline grid) while behaving as full-card links. */
.blog-index-page .selected-projects__grid {
  grid-template-columns: minmax(0, 1fr);
}

.blog-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 32px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  color: inherit;
  text-decoration: none;
  transition: background-color 180ms ease;
  animation: project-card-in 320ms ease both;
}

.blog-card:nth-child(2n) {
  border-right: 0;
}

.blog-index-page .blog-card,
.blog-index-page .blog-card:nth-child(2n) {
  min-height: auto;
  padding: 40px;
  border-right: 0;
}

.blog-card:hover {
  background: var(--color-bg-surface);
}

.blog-card:focus-visible {
  outline: 2px solid var(--color-accent-info);
  outline-offset: -2px;
}

.blog-card__title {
  margin: 0 0 10px;
  color: var(--color-text-primary);
  font-size: 22px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: 0;
}

.blog-card__excerpt {
  max-width: 520px;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
}

.blog-card__cta {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  margin-top: 64px;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.blog-card__cta svg {
  transition: transform 160ms ease;
}

.blog-card:hover .blog-card__cta {
  border-color: var(--color-text-secondary);
  background: var(--color-border);
}

.blog-card:hover .blog-card__cta svg {
  transform: translateX(4px);
}

/* ---- Article: reading page ---------------------------------------------- */
.blog-post {
  width: 100%;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: "Geist", "Geist Placeholder", sans-serif;
}

/* The sticky nav already draws the top divider. */
.blog-post-page .blog-post {
  border-top: 0;
}

.blog-post__inner {
  width: calc(100% - 128px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 72px 40px 96px;
  border-right: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
}

.blog-post__col {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.blog-post__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  transition: color 160ms ease;
}

.blog-post__back svg {
  transition: transform 160ms ease;
}

.blog-post__back:hover {
  color: var(--color-text-primary);
}

.blog-post__back:hover svg {
  transform: translateX(-3px);
}

.blog-post__back:focus-visible {
  outline: 2px solid var(--color-accent-info);
  outline-offset: 3px;
}

.blog-post__meta {
  margin: 0 0 20px;
  color: var(--color-text-tertiary);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.blog-post__meta span {
  margin: 0 8px;
  opacity: 0.6;
}

.blog-post__title {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
}

.blog-post__lead {
  margin: 24px 0 0;
  color: var(--color-text-secondary);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0;
}

.blog-post__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin: 44px 0 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg-surface);
}

.blog-post__cover::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 96px;
  height: 3px;
  background: var(--blog-accent, var(--color-accent-info));
  content: "";
}

.blog-post__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Prose */
.blog-post__body {
  margin-top: 40px;
}

.blog-post__body > * {
  margin: 0;
}

.blog-post__body > * + * {
  margin-top: 24px;
}

.blog-post__body p {
  color: var(--color-text-secondary);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0;
}

.blog-post__body strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.blog-post__body h2 {
  margin-top: 48px;
  color: var(--color-text-primary);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

.blog-post__body ul {
  padding-left: 22px;
  color: var(--color-text-secondary);
  font-size: 18px;
  line-height: 1.7;
}

.blog-post__body li + li {
  margin-top: 10px;
}

.blog-post__body li::marker {
  color: var(--color-text-tertiary);
}

.blog-post__body blockquote {
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--blog-accent, var(--color-accent-info));
  color: var(--color-text-primary);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

.blog-post__body blockquote cite {
  display: block;
  margin-top: 12px;
  color: var(--color-text-tertiary);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0;
  text-transform: uppercase;
}

.blog-post__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 720px;
  margin: 56px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.blog-post__footer-note {
  margin: 0;
  color: var(--color-text-tertiary);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  line-height: 20px;
  letter-spacing: 0;
}

.blog-post__footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
}

.blog-post__footer-link svg {
  transition: transform 160ms ease;
}

.blog-post__footer-link:hover svg {
  transform: translateX(-3px);
}

.blog-post__footer-link:focus-visible {
  outline: 2px solid var(--color-accent-info);
  outline-offset: 3px;
}

/* Empty state — post slug not found. */
.blog-post__missing {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.blog-post__missing h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
}

.blog-post__missing p {
  margin: 16px 0 32px;
  color: var(--color-text-secondary);
  font-size: 17px;
  line-height: 1.6;
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1199.98px) {
  .blog-post__inner {
    width: calc(100% - 48px);
  }
}

@media (max-width: 809.98px) {
  .blog-index-page .blog-card,
  .blog-index-page .blog-card:nth-child(2n) {
    min-height: auto;
    padding: 36px;
    border-right: 0;
  }

  .blog-post__inner {
    width: 100%;
    padding: 48px 24px 72px;
    border-right: 0;
    border-left: 0;
  }

  .blog-post__back {
    margin-bottom: 32px;
  }

  .blog-post__title {
    font-size: 32px;
    line-height: 1.12;
  }

  .blog-post__lead {
    font-size: 17px;
  }

  .blog-post__body p,
  .blog-post__body ul {
    font-size: 17px;
  }

  .blog-post__body h2 {
    font-size: 23px;
  }

  .blog-post__body blockquote {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-card {
    animation: none;
    transition: none;
  }

  .blog-card__cta,
  .blog-card__cta svg,
  .blog-post__back svg,
  .blog-post__footer-link svg {
    transition: none;
  }
}
