/* Blog-only styles. Loaded after style.css, only on /blog/* pages.

   Follows the Lovable redesign (revised-codeliance.lovable.app): a lavender
   masthead, a featured post over blue post cards with cover images, a search +
   category filter row, article pages framed by a hero image and a white
   "announcement" card, a tags + related-articles footer, and a cream CTA band.

   Two type roles from the design: Epilogue (headings, light weights) and
   Space Mono for every meta/label (dates, read-times, categories, tags).

   Colours reuse the site's --blue (#245ef6) rather than the redesign's
   near-identical primary, so the shared nav and footer (styled by style.css)
   stay consistent with the page between them. Band / cream / ink / muted tones
   have no site equivalent and are taken from the redesign as-is.

   style.css is written as if it owns the whole page and leaks into blog markup:
   bare `header` applies the homepage hero background, bare `footer` forces a
   dark bg, and bare `h1/h2/h3` are centred at weight 200. Every heading below
   therefore restates text-align/weight, and article-internal header/footer are
   <div>s. */

:root {
  --blog-band: #ecf0fd; /* redesign --section-light */
  --blog-cta-bg: #fff8db; /* redesign --section-cta */
  --blog-ink: #18182f; /* redesign --foreground */
  --blog-muted: #676f7e; /* redesign --muted-foreground */
  --blog-radius: 16px; /* redesign rounded-2xl */
  --blog-mono: "Space Mono", "Courier New", monospace;
}

/* Meta/label typeface utility. */
.post-mono {
  font-family: var(--blog-mono);
}

.meta-ico {
  flex: none;
  vertical-align: -2px;
}

/* base.njk wraps every page in <main class="blog-main">. The bands run edge to
   edge, so main stays full width and each section centres its own content. */
.blog-main {
  max-width: none;
  margin: 0;
  padding: 0;
}

.blog-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Long-form text gets a narrower measure than the card grid. */
.blog-inner-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* --- Masthead band --- */
.blog-band {
  background: var(--blog-band);
  padding: 72px 0 64px;
}

.blog-band-slim {
  padding: 14px 0;
}

.blog-title {
  margin: 0 0 16px;
  color: var(--blue);
  font-size: 2.5rem;
  font-weight: 200;
  line-height: 1.15;
  letter-spacing: -1.125px;
  text-align: left;
}

.blog-index-intro {
  max-width: 42rem;
  margin: 0;
  color: var(--blog-muted);
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.625;
}

/* --- Listing --- */
.blog-list {
  padding: 40px 0 72px;
}

/* --- Featured post (newest, full width, two columns on desktop) --- */
.feat-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 40px;
  border-radius: var(--blog-radius);
  background: var(--blue);
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.feat-card:hover {
  box-shadow: 0 14px 40px rgb(24 24 47 / 18%);
}

.feat-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
}

.feat-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
}

.feat-badge {
  align-self: flex-start;
  margin-bottom: 20px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--blog-cta-bg);
  color: var(--blog-ink);
  font-family: var(--blog-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.feat-title {
  margin: 0 0 16px;
  color: #fff;
  font-size: 1.75rem;
  font-weight: 200;
  line-height: 1.25;
  letter-spacing: -0.9px;
  text-align: left;
}

.feat-desc {
  margin: 0 0 24px;
  color: rgb(255 255 255 / 75%);
  font-size: 1rem;
  line-height: 1.6;
}

.feat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: rgb(255 255 255 / 70%);
  font-size: 0.75rem;
}

/* --- Filter row (search + category pills) --- */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.blog-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 384px;
}

.blog-search-ico {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--blog-muted);
  pointer-events: none;
}

.blog-search input {
  width: 100%;
  height: 40px;
  padding: 8px 16px 8px 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--blog-band);
  color: var(--blog-ink);
  font-size: 0.8125rem;
}

.blog-search input::placeholder {
  color: var(--blog-muted);
}

.blog-search input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.blog-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-pill {
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--blog-band);
  color: var(--blog-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.cat-pill:hover {
  color: var(--blog-ink);
}

.cat-pill.is-active {
  background: var(--blue);
  color: #fff;
}

.cat-pill:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* --- Post cards (grid) --- */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  display: flex;
  overflow: hidden;
  border-radius: var(--blog-radius);
  background: var(--blue);
  transition: box-shadow 0.15s ease;
}

.post-card:hover {
  box-shadow: 0 12px 32px rgb(24 24 47 / 16%);
}

/* [hidden] alone loses to .post-card{display:flex}; restate at higher
   specificity so the filter can actually hide cards. */
.post-card[hidden],
.blog-noresults[hidden] {
  display: none;
}

.post-card-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  text-decoration: none;
}

.post-card-cover {
  display: block;
  width: 100%;
  height: 144px;
  object-fit: cover;
}

.post-card-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px;
}

.post-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

/* Category pill on a blue card: cream text on a translucent cream tint. */
.post-cat {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid rgb(255 248 219 / 30%);
  border-radius: 999px;
  background: rgb(255 248 219 / 10%);
  color: var(--blog-cta-bg);
  font-family: var(--blog-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Category pill on a light card (article header, related cards): blue on tint. */
.post-cat-onlight {
  border: 0;
  background: rgb(36 94 246 / 10%);
  color: var(--blue);
}

.post-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgb(255 255 255 / 55%);
  font-size: 0.625rem;
  white-space: nowrap;
}

.post-card-title {
  margin: 0 0 10px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.375;
  letter-spacing: normal;
  text-align: left;
}

.post-card-desc {
  margin: 0 0 20px;
  color: rgb(255 255 255 / 70%);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Pushes the meta row to the bottom so cards of differing length line up. */
.post-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
}

.post-card-byline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-author {
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
}

.pc-date {
  color: rgb(255 255 255 / 55%);
  font-size: 0.625rem;
}

.post-card-read {
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 16px;
}

.pc-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgb(255 248 219 / 70%);
  font-size: 0.625rem;
}

.blog-noresults {
  margin: 8px 0 0;
  color: var(--blog-muted);
}

.blog-empty {
  color: var(--blog-muted);
}

/* --- Article page --- */
.post-back {
  display: block;
  width: fit-content;
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.post-back:hover {
  text-decoration: underline;
}

/* Cover as a decorative backdrop; the white frame overlaps its lower edge. */
.post-hero {
  height: 260px;
  background-color: var(--blog-band);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.post-frame-wrap {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: -104px auto 0;
  padding: 0 1rem;
}

.post-frame {
  padding: 28px;
  border: 1px solid rgb(24 24 47 / 8%);
  border-radius: var(--blog-radius);
  background: #fff;
  box-shadow:
    0 20px 25px -5px rgb(0 0 0 / 10%),
    0 8px 10px -6px rgb(0 0 0 / 10%);
}

.post-frame .post-cat {
  /* Article header sits on white: use the blue-on-tint treatment. */
  font-size: 0.625rem;
}

.post-title {
  margin: 14px 0 20px;
  color: var(--blue);
  font-size: 1.75rem;
  font-weight: 200;
  line-height: 1.25;
  letter-spacing: -0.9px;
  text-align: left;
}

.post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.post-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgb(36 94 246 / 10%);
  color: var(--blue);
  font-family: var(--blog-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.post-byline-id {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.post-byline-name {
  color: var(--blog-ink);
  font-size: 0.875rem;
  font-weight: 500;
}

.post-byline-role {
  color: var(--blog-muted);
  font-size: 0.75rem;
}

.post-byline-div {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.post-byline-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blog-muted);
  font-size: 0.75rem;
}

.post-body {
  padding: 48px 0 8px;
  color: var(--blog-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* style.css sets every h1/h2 to weight 200 and centres it; body headings in the
   redesign are medium-weight, left-aligned blue, so both are restated here. */
.post-body h2 {
  margin: 40px 0 12px;
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
}

.post-body h3 {
  margin: 32px 0 12px;
  color: var(--blue);
  font-family: Epilogue, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
}

.post-body p {
  margin: 0 0 20px;
}

.post-body a {
  color: var(--blue);
}

.post-body ul {
  margin: 0 0 20px;
  padding-left: 24px;
}

.post-body ul li {
  margin: 0 0 8px;
}

/* Numbered lists mirror the design's "01 — Bold lead-in" step treatment. */
.post-body ol {
  margin: 0 0 20px;
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}

.post-body ol > li {
  position: relative;
  margin: 0 0 14px;
  padding-left: 40px;
  counter-increment: step;
}

.post-body ol > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 3px;
  color: rgb(36 94 246 / 50%);
  font-family: var(--blog-mono);
  font-size: 0.875rem;
}

.post-body ol > li strong {
  color: var(--blog-ink);
  font-weight: 600;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--blog-radius);
}

.post-body blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--blue);
  color: var(--blog-muted);
  font-style: italic;
}

.post-body code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--blog-band);
  color: var(--blog-ink);
  font-family: var(--blog-mono);
  font-size: 0.9em;
}

.post-body pre {
  margin: 0 0 24px;
  padding: 20px;
  border-radius: var(--blog-radius);
  background: var(--blog-ink);
  color: #e2e8f0;
  overflow-x: auto;
}

.post-body pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.post-body hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* --- Article footer: tags --- */
.post-tags-rule {
  margin: 40px 0 24px;
  border: 0;
  border-top: 1px solid var(--border);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 64px;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blog-band);
  color: var(--blog-muted);
  font-size: 0.75rem;
}

/* --- Related articles (white cards, no cover) --- */
.related {
  padding: 56px 0;
  background: var(--blog-band);
}

.related-title {
  margin: 0 0 24px;
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 200;
  letter-spacing: normal;
  text-align: left;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-card {
  border-radius: var(--blog-radius);
  background: #fff;
  transition: box-shadow 0.15s ease;
}

.related-card:hover {
  box-shadow: 0 12px 30px rgb(24 24 47 / 12%);
}

.related-card-wrap {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  text-decoration: none;
}

.related-card .post-cat-onlight {
  margin-bottom: 12px;
  font-size: 0.625rem;
}

.related-card-title {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  text-align: left;
}

.related-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 14px;
  color: var(--blog-muted);
  font-size: 0.75rem;
}

.related-card-link {
  margin-top: auto;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 600;
}

/* --- Call to action --- */
.blog-cta {
  padding: 64px 0;
  background: var(--blog-cta-bg);
  text-align: center;
}

.blog-cta-title {
  margin: 0 0 12px;
  color: var(--blog-ink);
  font-size: 2rem;
  font-weight: 200;
}

.blog-cta-text {
  margin: 0 0 28px;
  color: var(--blog-muted);
}

.blog-cta-btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.blog-cta-btn:hover {
  background: var(--blue-dark);
}

/* --- Desktop --- */
@media (width >= 768px) {
  .blog-title {
    font-size: 2.8125rem;
  }

  .feat-card {
    flex-direction: row;
  }

  .feat-body {
    padding: 48px;
  }

  .feat-media {
    flex: 1;
  }

  .feat-title {
    font-size: 2rem;
  }

  .post-hero {
    height: 340px;
  }

  .post-frame-wrap {
    margin-top: -144px;
  }

  .post-frame {
    padding: 40px;
  }

  .post-title {
    font-size: 2.25rem;
  }
}
