/* Blog: the same tokens, fonts and header as the main page (style.css), plus the blog's own layout.
   Layout idea (design only, from a magazine-style blog): a dark hero with a subscribe field, a search and tag row,
   one large featured story beside a narrow one, then a three-column grid of cards. */

:root {
  --dark: #1b3a34;
  --peach: #b0d1bc;
  --card-radius: 4px;
}

.blog-page { background: var(--bg); color: var(--text); }
.blog-page main { display: block; }

/* ---- hero ---- */
.blog-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 124px max(24px, 4vw);          /* equal top and bottom, so the content sits at the true centre (as on the home page) */
  background: var(--dark);
  color: #fff;
  text-align: center;
}
.blog-hero::before {                      /* the same pale circle as the home page, off to one side */
  content: "";
  position: absolute;
  z-index: -1;
  width: min(760px, 110vw);
  aspect-ratio: 1;
  inset-block-end: -62%;
  inset-inline-start: -14%;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
  --min-scale: 0.6;                       /* breathes like the home page circle (same keyframes and pace) */
  animation: breathe var(--breath-duration) ease-in-out infinite;
  will-change: transform;
}
.blog-hero-inner { width: min(640px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.blog-zh {
  font-family: "LXGW WenKai Mono TC", serif;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.13em;
  color: rgba(255, 255, 255, 0.8);
}
.blog-title {
  font-weight: 400;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: #fff;
}
.blog-sub {
  max-width: 460px;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.blog-subscribe { width: min(471px, 100%); margin-top: 20px; text-align: right; }
.blog-subscribe .signup {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.32));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(27, 58, 52, 0.26);
}
.blog-subscribe .signup:has(input:hover) { border-color: rgba(255, 255, 255, 0.3); }
.blog-subscribe .signup:focus-within { border-color: rgba(255, 255, 255, 0.6); }
.blog-subscribe .signup input { color: #fff; }
.blog-subscribe .signup input::placeholder { color: rgba(255, 255, 255, 0.7); }
.blog-subscribe .signup button { margin: -1px 0 -1px -1px; background: #FF4242; }   /* our red, like the footer button */
.blog-subscribe .signup button:hover { background: #e63535; }
.blog-subscribe .form-msg { color: rgba(255, 255, 255, 0.75); }
.blog-subscribe .form-msg.is-status { color: #ffb4ab; }
.blog-subscribe .form-msg:empty { margin-top: 0; }

/* ---- toolbar: the tags, then a search icon right after the last tag (on the left) ---- */
.blog-wrap { width: min(1200px, 100%); margin-inline: auto; padding-inline: max(24px, 4vw); }
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-block: 48px 32px;
}
.blog-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-tag-btn {
  padding: 8px 16px;
  border: 0;                                /* no outline: just a soft, very transparent fill */
  border-radius: 999px;
  background: rgba(27, 58, 52, 0.04);       /* our brown (#1b3a34) at 4% */
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.blog-tag-btn:hover { background: rgba(40, 83, 75, 0.1); color: var(--accent); }
.blog-tag-btn[aria-pressed="true"] { background: rgba(40, 83, 75, 0.16); color: var(--accent); }
.blog-tag-btn:focus-visible, .blog-find-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* search: a round magnifier after the tags; clicking it opens a pill-shaped field (radius 1000px), and the X closes it */
.blog-find {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 1000px;
  background: rgba(27, 58, 52, 0.04);
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.25s, box-shadow 0.25s;
}
.blog-find:hover { background: rgba(40, 83, 75, 0.1); }
.blog-find.is-open { width: min(280px, 100%); background: #fff; box-shadow: inset 0 0 0 1px rgba(27, 58, 52, 0.12); }
.blog-find.is-open:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.blog-find-btn {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 1000px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.blog-find:hover .blog-find-btn, .blog-find.is-open .blog-find-btn { color: var(--accent); }
.blog-find.is-open .blog-find-btn { right: auto; left: 0; }   /* open: the magnifier moves to the left end, the X takes the right */
.blog-find input {
  width: 100%;
  height: 100%;
  padding: 0 38px 0 38px;                  /* X on the right, magnifier on the left */
  border: 0;
  border-radius: 1000px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  text-align: right;
  opacity: 0;
  transition: opacity 0.25s;
}
.blog-find.is-open input { opacity: 1; transition-delay: 0.12s; }
.blog-find input:focus { outline: none; }
.blog-find input::placeholder { color: rgba(16, 35, 31, 0.5); }
.blog-find input::-webkit-search-cancel-button { display: none; }   /* our own X replaces the browser's clear button */
.blog-find-close {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 1000px;
  background: none;
  color: rgba(27, 58, 52, 0.6);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, color 0.25s, visibility 0s 0.25s;
}
.blog-find.is-open .blog-find-close { opacity: 1; visibility: visible; transition-delay: 0.12s, 0s, 0s; }
.blog-find-close:hover { color: var(--accent); }
.blog-find-close:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---- the grid ---- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 24px;
  padding-bottom: 96px;
}
.blog-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.blog-card[hidden] { display: none; }
.blog-card.is-featured { grid-column: span 2; }
.blog-card a.blog-link-block { display: flex; flex-direction: column; gap: 14px; color: inherit; text-decoration: none; }
.blog-card a.blog-link-block:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }

.blog-cover {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--card-radius);
  background: var(--cover-bg, var(--accent));
  color: var(--cover-ink, #fff);
  isolation: isolate;
  box-shadow: 0 0 0 rgba(27, 58, 52, 0);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.blog-cover::before {                      /* the brand circle, a little different on every cover */
  content: "";
  position: absolute;
  z-index: -1;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cover-circle, rgba(255, 255, 255, 0.14));
  inset-block-start: var(--cover-y, 30%);
  inset-inline-start: var(--cover-x, -12%);
}
.blog-cover span {
  font-family: "LXGW WenKai Mono TC", serif;
  font-size: clamp(64px, 9vw, 120px);
  line-height: 1;
  letter-spacing: 0;
}
.blog-card:hover .blog-cover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(27, 58, 52, 0.22); }
.is-featured .blog-cover { aspect-ratio: 2 / 1; }

.blog-card h2, .blog-card h3 {
  font-weight: 400;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ink);
  transition: color 0.25s;
}
.is-featured h2, .is-featured h3 { font-size: 34px; }
.blog-card:hover h2, .blog-card:hover h3 { color: var(--accent); }

.blog-author { display: flex; align-items: center; gap: 10px; font-family: var(--font-body); font-size: 14px; color: rgba(16, 35, 31, 0.75); }
.blog-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: "LXGW WenKai Mono TC", serif;
  font-size: 13px;
  line-height: 1;
}
.blog-meta-dot { opacity: 0.5; }
.blog-read { display: inline-flex; align-items: center; gap: 5px; }   /* small clock before the reading time */
.blog-read svg { flex: none; opacity: 0.8; }
.blog-excerpt { font-family: var(--font-body); font-weight: 300; font-size: 16px; line-height: 1.7; color: var(--text); text-wrap: pretty; }
.blog-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.blog-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(27, 58, 52, 0.08);       /* same brown at 8% as the filter tags */
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.6;
  color: rgba(27, 58, 52, 0.75);
}
.blog-empty { grid-column: 1 / -1; padding-block: 48px; text-align: center; font-family: var(--font-body); font-size: 18px; color: rgba(16, 35, 31, 0.7); }

/* ---- footer ---- */
.blog-foot {
  padding: 28px 24px;
  background: var(--dark);
  color: #fff;
  text-align: center;
}
.blog-foot .cta-legal { position: static; opacity: 0.8; }

/* the header sits over the dark hero, so it starts out light */
.blog-page .top { position: absolute; z-index: 20; }   /* scrolls away with the page, so it never sits on top of the cards */
/* the link of the page you are on looks selected: a soft pill behind it */
.top .insta[aria-current="page"] {
  padding: 6px 14px 6px 12px;
  margin-block: -6px;
  border-radius: 999px;
  background: rgba(27, 58, 52, 0.08);
  font-weight: 500;
  text-decoration: none;
  pointer-events: none;
  transition: color 0.35s, background 0.35s;
}
.top.insta-light .insta[aria-current="page"] { background: rgba(255, 255, 255, 0.18); }

/* ---- article page ---- */
.post-head { padding: 160px max(24px, 4vw) 0; }
.post-head-inner { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
.post-back { align-self: flex-start; font-family: var(--font-body); font-size: 15px; color: var(--accent); text-decoration: none; }
.post-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-title { font-weight: 400; font-size: clamp(34px, 5.2vw, 56px); line-height: 1.15; letter-spacing: 0.02em; color: var(--ink); text-wrap: balance; }
.post-lede { font-family: var(--font-body); font-weight: 300; font-size: 20px; line-height: 1.7; color: rgba(16, 35, 31, 0.8); }
.post-cover-wrap { max-width: 1000px; margin: 40px auto 0; padding-inline: max(24px, 4vw); }
.post-cover-wrap .blog-cover { aspect-ratio: 2.2 / 1; }
.post-cover-wrap .blog-card:hover .blog-cover { transform: none; box-shadow: none; }
.post-body { max-width: 760px; margin: 48px auto 0; padding-inline: max(24px, 4vw); }
.post-body p { margin-bottom: 22px; font-family: var(--font-body); font-weight: 300; font-size: 20px; line-height: 1.85; color: var(--text); text-wrap: pretty; }
.post-body h2 { margin: 40px 0 14px; font-weight: 400; font-size: 30px; line-height: 1.3; color: var(--ink); }
.post-note { margin-top: 12px; padding: 20px 24px; border-radius: 4px; background: rgba(40, 83, 75, 0.08); font-family: var(--font-body); font-size: 16px; line-height: 1.7; color: var(--ink); }
.post-join {
  margin: 56px auto 0;
  max-width: 760px;
  width: calc(100% - 2 * max(24px, 4vw));
  padding: 36px 32px;
  border-radius: 4px;
  background: var(--dark);
  color: #fff;
  text-align: center;
}
.post-join h2 { font-weight: 400; font-size: 30px; line-height: 1.3; }
.post-join p { margin: 10px auto 22px; max-width: 460px; font-family: var(--font-body); font-weight: 300; font-size: 16px; line-height: 1.7; color: rgba(255, 255, 255, 0.9); }
.post-join a {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.3s;
}
.post-join a:hover { background: #1d3f38; }
.post-more { padding-block: 72px 96px; }
.post-more > h2 { margin-bottom: 28px; font-weight: 400; font-size: 32px; color: var(--ink); }
.post-more .blog-grid { padding-bottom: 0; }

/* ---- smaller screens ---- */
@media (max-width: 900px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-card.is-featured { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .blog-hero { padding: 112px 24px; }
  .blog-sub { font-size: 16px; }
  .blog-wrap { padding-inline: 24px; }
  .blog-toolbar { padding-block: 32px 24px; }
  .blog-find.is-open { width: 100%; }        /* on phones the open field takes the whole row */
  .blog-grid { grid-template-columns: 1fr; gap: 40px; padding-bottom: 72px; }
  .blog-card h2, .blog-card h3, .is-featured h2, .is-featured h3 { font-size: 24px; }
  .is-featured .blog-cover { aspect-ratio: 16 / 10; }
  .post-head { padding: 136px 24px 0; }
  .post-lede, .post-body p { font-size: 18px; }
  .post-join { padding: 28px 20px; }
  .blog-foot { padding: 24px 24px 28px; }
}
@media (prefers-reduced-motion: reduce) { .blog-cover, .blog-find, .blog-find input { transition: none; } .blog-hero::before { animation-duration: 24s; } }

img.blog-avatar { object-fit: cover; background: none; }
