/* Blog pages: a Medium-style reading experience that still uses the
   site's own colours, fonts and theme toggle (global.css variables). */

:root {
  --blog-line: color-mix(in srgb, var(--color-black) 18%, transparent);
  --blog-soft: color-mix(in srgb, var(--color-black) 62%, transparent);
  --blog-serif: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
}

/* ===== Post page ===== */

.blog-article {
  /* Centred column; on narrower screens it fills the width with side padding */
  max-width: 860px;
  margin: 0 auto;
  padding: 60px 30px 40px;
}

.blog-article-head h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.4em;
}

.blog-subtitle {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
  color: var(--blog-soft);
  margin-bottom: 1.4em;
}

.blog-byline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 24px;
  line-height: 1.4;
}

.blog-byline-name {
  font-weight: 600;
  font-size: 15px;
}

.blog-byline-meta {
  font-size: 14px;
  color: var(--blog-soft);
}

/* Share bar (Medium-like thin lines above and below) */
.blog-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  margin: 0 0 30px;
  border-top: 1px solid var(--blog-line);
  border-bottom: 1px solid var(--blog-line);
}

.blog-share-label {
  font-size: 13px;
  color: var(--blog-soft);
  margin-right: 6px;
}

.blog-share-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-decoration: none;
  font-family: inherit;
}

.copy-status {
  font-size: 13px;
  color: var(--blog-soft);
  margin-left: 6px;
}

/* Small header image */
.blog-cover {
  margin: 0 0 36px;
}

.blog-cover img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 20px;
}

/* Body text */
.blog-body {
  font-family: var(--blog-serif);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.65;
  letter-spacing: -0.003em;
}

.blog-body p {
  margin-bottom: 1.5em;
}

.blog-body h2,
.blog-body h3 {
  font-family: "Poppins", sans-serif;
  margin: 1.8em 0 0.5em;
  letter-spacing: -0.01em;
}

.blog-body h2 {
  font-size: clamp(24px, 3vw, 30px);
}

.blog-body h3 {
  font-size: clamp(20px, 2.4vw, 24px);
}

.blog-body ul,
.blog-body ol {
  margin-bottom: 1.5em;
  padding-left: 1.4em;
  list-style-position: outside;
}

.blog-body ul {
  list-style-type: disc;
}

.blog-body ol {
  list-style-type: decimal;
}

.blog-body li {
  margin-bottom: 0.5em;
}

.blog-body blockquote {
  margin: 1.8em 0;
  padding-left: 22px;
  border-left: 3px solid var(--color-black);
  font-style: italic;
  font-size: 1.1em;
}

.blog-body img {
  width: 100%;
  border-radius: 20px;
  margin: 0.5em 0 1.5em;
}

.blog-body hr {
  border: 0;
  text-align: center;
  margin: 2.5em 0;
}

.blog-body hr::before {
  content: "\2022 \2022 \2022";
  letter-spacing: 0.6em;
  color: var(--blog-soft);
}

.blog-body code {
  font-family: "Source Code Pro", monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--blog-line);
}

/* Category pill under the post */
.blog-tags {
  margin: 40px 0 0;
}

.blog-tags a {
  display: inline-block;
  margin: 0 8px 8px 0;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--blog-line);
  text-decoration: none;
}

.blog-tags a:hover {
  border-color: var(--color-black);
}

.blog-article > .blog-share:last-of-type {
  margin-top: 24px;
}

/* Previous / next */
.blog-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 36px 0 0;
}

.blog-nav a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--blog-line);
  border-radius: 20px;
  text-decoration: none;
  line-height: 1.4;
  font-weight: 500;
}

.blog-nav a:hover {
  background-color: var(--color-black);
  color: var(--color-offwhite);
}

.blog-nav small {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.65;
  margin-bottom: 4px;
  font-weight: 400;
}

.blog-nav .blog-next {
  text-align: right;
}

.blog-back {
  text-align: center;
  margin: 28px 0 0;
}

.blog-back .btn {
  text-decoration: none;
}

/* ===== List page (text only) ===== */

.blog-list-wrap {
  max-width: 1020px;
  margin: 0 auto;
  padding: 60px 30px 60px;
}

.blog-list-wrap h1 {
  margin-bottom: 0.2em;
}

.blog-list-intro {
  color: var(--blog-soft);
  margin-bottom: 1.6em;
}

/* Search: a small round magnifier that opens into a search bar beside the category buttons */
.blog-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

/* The category buttons flow in the same row as the magnifier */
.blog-tools .blog-filters {
  display: contents;
}

.blog-search {
  display: flex;
  align-items: center;
  margin: 0;
  border: 1px solid var(--color-black);
  border-radius: 24px;
  height: 34px;
  box-sizing: border-box;
  overflow: hidden;
  transition: width 0.25s ease, background-color 0.2s ease;
  width: 34px;
}

.blog-search .blog-search-toggle {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent !important;
  color: var(--color-black);
  cursor: pointer;
  border-radius: 50%;
}

.blog-search .blog-search-toggle:hover {
  transform: rotate(-12deg);
}

.blog-search input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-black);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0 14px 0 2px;
}

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

.blog-search.is-open {
  width: 220px;
  max-width: 100%;
}

.blog-search:focus-within {
  outline: 2px solid var(--color-black);
  outline-offset: 2px;
}

.blog-search:not(.is-open) input {
  visibility: hidden;
}

.blog-search-status {
  margin: -8px 0 14px;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--blog-soft);
}

@media (max-width: 1024px) {
  /* Phones and tablets: 16px text stops iPhones from zooming in (which made the page wider) */
  .blog-search input {
    font-size: 16px;
  }
  .blog-search.is-open {
    width: min(150px, 100%);
  }
  /* Never let the list area push the page wider than the screen */
  .blog-list-wrap {
    overflow-x: clip;
  }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-search {
    transition: none;
  }
  .blog-search .blog-search-toggle:hover {
    transform: none;
  }
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.blog-filters button {
  margin: 0;
  font-family: inherit;
}

.blog-filters button.selected {
  background-color: var(--color-black);
  color: var(--color-offwhite);
  padding: 5px 10px;
  border-radius: 20px;
}

.blog-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog-item {
  border-top: 1px solid var(--blog-line);
}

.blog-item:last-child,
.blog-item.is-last {
  border-bottom: 1px solid var(--blog-line);
}

.blog-item a {
  display: block;
  padding: 28px 0;
  text-decoration: none;
  color: var(--color-black);
}

.blog-item-meta {
  font-size: 13px;
  color: var(--blog-soft);
  margin-bottom: 6px;
}

.blog-item h2 {
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.3;
  margin-bottom: 0.3em;
}

.blog-item p {
  margin: 0;
  font-family: var(--blog-serif);
  color: var(--blog-soft);
}

.blog-item a:hover h2 {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.blog-empty {
  margin-top: 30px;
  color: var(--blog-soft);
}

@media (max-width: 768px) {
  /* Same 20px edge as the header and footer on phones */
  .blog-article {
    padding: 36px 20px 40px;
  }

  .blog-cover img {
    max-height: 220px;
  }

  .blog-nav {
    grid-template-columns: 1fr;
  }

  .blog-nav .blog-next {
    text-align: left;
  }

  .blog-list-wrap {
    padding: 36px 20px 40px;
  }
}


/* Page numbers under the blog list */
.blog-pager {
  margin: 36px 0 0;
  text-align: center;
  font-family: "Poppins", sans-serif;
}

.blog-pager-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.blog-pager a,
.blog-pager .gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: 14px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
}

.blog-pager a {
  border: 1px solid var(--blog-line);
}

.blog-pager .gap {
  min-width: 20px;
  padding: 0;
}

.blog-pager a:hover {
  border-color: var(--color-black);
}

.blog-pager a.current {
  background-color: var(--color-black);
  color: var(--color-offwhite);
  border-color: var(--color-black);
}

.blog-pager a.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.blog-pager-status {
  margin: 14px 0 0;
  font-size: 13px;
  opacity: 0.65;
}

@media (max-width: 768px) {
  .blog-pager a {
    padding: 0 10px;
  }
}
