/* ==========================================================================
   TWAIN EDU — Blog (public pages: /blog and /blog/:slug)
   Medium-style reading layout on the Twain design system tokens (index.css).
   ========================================================================== */

.page-blog {
  background: #fff;
  color: var(--ink);
  --blog-text: #2A2238;
  --blog-muted: #6B6478;
  --blog-line: #ECE8F1;
  --blog-col: 700px;
}

.blog-main {
  padding: 132px 16px 72px;
}

/* ---------- Feed (/blog) ---------- */

.blog-feed { max-width: 1040px; margin: 0 auto; }

.blog-head { max-width: var(--blog-col); margin: 0 auto 40px; text-align: left; }
.blog-feed .blog-head { margin-left: 0; }

.blog-kicker {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--twain-purple);
  margin: 0 0 8px;
}

.blog-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
}

.blog-lede { font-size: 18px; color: var(--blog-muted); margin: 0; }
.blog-lede a { color: var(--twain-purple); }

.feed-featured {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 36px;
  align-items: center;
  padding-bottom: 40px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--blog-line);
}
.feed-featured-img img,
.feed-item-img img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: var(--blog-line);
  transition: transform 0.45s var(--ease-smooth), filter 0.45s;
}
.feed-featured-img:hover img,
.feed-item-img:hover img { transform: scale(1.015); filter: saturate(1.08); }
.feed-featured-img { display: block; overflow: hidden; border-radius: 14px; }

.feed-featured h2,
.feed-item h2 {
  font-family: var(--font-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 6px 0 10px;
}
.feed-featured h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; }
.feed-item h2 { font-size: 22px; line-height: 1.25; }
.feed-featured h2 a,
.feed-item h2 a { color: inherit; text-decoration: none; }
.feed-featured h2 a:hover,
.feed-item h2 a:hover { color: var(--twain-purple); }

.feed-sub {
  font-size: 17px;
  line-height: 1.5;
  color: var(--blog-muted);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-meta { font-size: 14px; color: var(--blog-muted); margin: 0; }
.feed-author { font-family: var(--font-primary); font-weight: 700; font-size: 14px; color: var(--ink); margin: 0; }
.feed-tag {
  display: inline-block;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 700;
  color: var(--twain-purple);
  text-decoration: none;
}
.feed-tag:hover { color: var(--twain-purple-dark); text-decoration: underline; }

.feed-list { max-width: var(--blog-col); }
.feed-item {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 28px;
  align-items: center;
  padding: 30px 0;
  border-bottom: 1px solid var(--blog-line);
}
.feed-item-img { display: block; overflow: hidden; border-radius: 10px; }
.feed-item-img img { border-radius: 10px; }

.feed-pager {
  max-width: var(--blog-col);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  font-size: 15px;
  color: var(--blog-muted);
}
.feed-pager a { font-family: var(--font-primary); font-weight: 700; color: var(--twain-purple); }

.blog-empty { max-width: var(--blog-col); margin: 0 auto; min-height: 50vh; }

/* ---------- Article (/blog/:slug) ---------- */

.post { max-width: var(--blog-col); margin: 0 auto; }

.post-crumbs { font-family: var(--font-primary); font-size: 14px; color: var(--blog-muted); margin-bottom: 18px; }
.post-crumbs a { color: var(--twain-purple); font-weight: 700; }

.post-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
}
.post-subtitle {
  font-family: var(--font-secondary);
  font-weight: 300;
  font-size: clamp(19px, 2.4vw, 22px);
  line-height: 1.45;
  color: var(--blog-muted);
  margin: 0 0 28px;
}

.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--blog-line);
  border-bottom: 1px solid var(--blog-line);
  margin-bottom: 36px;
}
.post-byline { display: flex; align-items: center; gap: 12px; }
.post-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-primary); font-weight: 700; font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--twain-purple) 0%, var(--twain-lilac) 100%);
}
.post-author { font-family: var(--font-primary); font-weight: 700; font-size: 15px; color: var(--ink); }
.post-meta { font-size: 14px; color: var(--blog-muted); }

.post-share { display: flex; gap: 4px; }
.share-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--blog-muted);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.share-btn:hover, .share-btn:focus-visible { color: var(--twain-purple); background: rgba(81, 44, 137, 0.08); }
.share-btn.is-copied { color: var(--brand-xr); }

.post-cover { margin: 0 -40px 40px; }
.post-cover img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 14px;
  background: var(--blog-line);
}

/* Body copy — Medium-like rhythm */
.post-body {
  font-family: var(--font-secondary);
  font-size: 20px;
  line-height: 1.7;
  color: var(--blog-text);
  overflow-wrap: break-word;
}
.post-body > * + * { margin-top: 1.4em; }
.post-body p { margin: 0; }
.post-body p + p { margin-top: 1.4em; }
.post-body h2, .post-body h3, .post-body h4 {
  font-family: var(--font-primary);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 1.8em 0 0.2em;
}
.post-body h2 { font-size: 28px; line-height: 1.25; }
.post-body h3 { font-size: 23px; line-height: 1.3; }
.post-body h4 { font-size: 20px; }
.post-body a { color: var(--twain-purple); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post-body a:hover { color: var(--twain-purple-dark); }
.post-body blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 22px;
  border-left: 3px solid var(--twain-lilac);
  font-style: italic;
  color: var(--ink);
}
.post-body ul, .post-body ol { padding-left: 1.4em; margin: 1.2em 0 0; }
.post-body li + li { margin-top: 0.5em; }
.post-body pre, .post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: #F6F3FA;
  border-radius: 6px;
}
.post-body code { padding: 2px 5px; }
.post-body pre { padding: 18px 20px; overflow-x: auto; line-height: 1.5; }
.post-body hr { border: 0; text-align: center; margin: 2.4em 0; }
.post-body hr::before { content: '· · ·'; letter-spacing: 0.6em; color: var(--blog-muted); font-size: 24px; }

.post-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 44px 0 0; }
.post-tags a {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: #F4F0F8;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s;
}
.post-tags a:hover { background: rgba(216, 132, 249, 0.22); }

.post-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 36px; padding: 16px 0;
  border-top: 1px solid var(--blog-line);
}
.post-socials { display: flex; align-items: center; gap: 6px; }
.post-socials-label { font-family: var(--font-primary); font-weight: 700; font-size: 14px; color: var(--ink); margin-right: 6px; }
.post-socials a {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%;
  color: #fff; background: var(--twain-purple);
  transition: background-color 0.2s, transform 0.2s var(--ease-smooth);
}
.post-socials a:hover { background: var(--twain-purple-dark); transform: translateY(-2px); }
.post-socials svg { width: 18px; height: 18px; }

.post-cta {
  max-width: var(--blog-col);
  margin: 56px auto 0;
  padding: 32px;
  border-radius: 18px;
  color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(216, 132, 249, 0.35) 0%, transparent 55%),
              linear-gradient(150deg, var(--eggplant-950) 0%, var(--twain-purple-deep) 100%);
}
.post-cta-kicker { font-family: var(--font-primary); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--twain-lilac); margin: 0 0 8px; }
.post-cta-title { font-family: var(--font-primary); font-weight: 700; font-size: 24px; line-height: 1.3; margin: 0 0 20px; color: #fff; }
.post-cta-btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: var(--twain-purple);
  text-decoration: none;
  transition: background-color 0.2s, transform 0.2s var(--ease-smooth);
}
.post-cta .post-cta-btn { background: #fff; color: var(--twain-purple); }
.post-cta-btn:hover { transform: translateY(-1px); color: #fff; background: var(--twain-purple-dark); text-decoration: none; }
.post-cta .post-cta-btn:hover { background: var(--twain-lilac); color: var(--eggplant-950); }

.blog-footer { background-color: var(--eggplant-950); }
.footer-social { display: flex; gap: 14px; font-size: 26px; margin: 6px 0 12px; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .post-cover { margin-left: -16px; margin-right: -16px; }
  .post-cover img { border-radius: 0; }
  .feed-featured { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 600px) {
  .blog-main { padding-top: 112px; }
  .post-body { font-size: 18px; }
  .feed-item { grid-template-columns: 1fr 96px; gap: 16px; padding: 22px 0; }
  .feed-item h2 { font-size: 18px; }
  .feed-item .feed-sub { display: none; }
  .feed-item-img img { aspect-ratio: 1 / 1; }
  .post-cta { padding: 24px; }
}
