/*
 * content.css — styles for the public /blog/ and /help/ pages served by
 * Wagtail. Loaded only on those pages via {% block head %}. Uses the
 * brand tokens defined in base.css (--bg, --card, --indigo, --t1..t3,
 * radii, etc.) — never hardcodes colors.
 *
 * Layout overview:
 *   /blog/        : .content-head + .cat-chips + .blog-hero + .blog-grid
 *   /blog/<slug>/ : .article-head + .article-cover + .article-body
 *                   (max-width 720 centered) + .related-section
 *   /help/        : .help-layout = sidebar nav + main with category cards
 *   /help/<slug>/ : .help-layout = sidebar + article + sticky TOC
 */

/* ─── Shared head/lead ──────────────────────────────────────────────── */
.content-page,
.help-layout,
.article-page {
  padding-top: 56px;
  padding-bottom: 96px;
  min-height: calc(100vh - 200px);
}
.content-head {
  text-align: center;
  margin-bottom: 36px;
}
.content-h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 14px 0 12px;
  color: var(--t1);
}
.content-head .lead { margin: 0 auto; }

/* ─── Category chips (filter row) ───────────────────────────────────── */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 32px;
}
.cat-chip {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: .82rem;
  font-weight: 600;
  color: var(--t2);
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all .15s;
  --chip-color: var(--indigo);
}
.cat-chip:hover { color: var(--t1); border-color: var(--border-h); }
.cat-chip.is-active {
  background: color-mix(in srgb, var(--chip-color) 18%, transparent);
  color: var(--t1);
  border-color: color-mix(in srgb, var(--chip-color) 50%, transparent);
}

/* Inline category pill used on cards/hero */
.cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--chip-color, var(--indigo));
  background: color-mix(in srgb, var(--chip-color, var(--indigo)) 14%, transparent);
  --chip-color: var(--indigo);
}
.dot-sep {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--t3); display: inline-block; vertical-align: middle;
}

/* ─── Cover image fallback (gradient + title overlay) ───────────────── */
.cover-fallback {
  position: relative;
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; text-align: center;
  overflow: hidden;
}
.cover-fallback::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 50%);
}
.cover-fallback-lg { aspect-ratio: 16/7; }
.cover-fallback-title {
  position: relative; z-index: 1;
  font-size: 1.1rem; font-weight: 700; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-fallback-lg .cover-fallback-title { font-size: 1.6rem; }

/* ─── Blog hero (featured post) ─────────────────────────────────────── */
.blog-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  overflow: hidden;
  text-decoration: none;
  margin-bottom: 56px;
  transition: border-color .15s, transform .15s;
}
.blog-hero:hover { border-color: var(--border-h); transform: translateY(-2px); }
.blog-hero-media { overflow: hidden; }
.blog-hero-media img,
.blog-hero-media .cover-fallback {
  width: 100%; height: 100%; object-fit: cover; min-height: 320px;
}
.blog-hero-body {
  padding: 36px 36px 36px 8px;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.blog-hero-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: .8rem; color: var(--t3); font-weight: 500;
}
.blog-hero-title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.2;
  margin: 0;
  color: var(--t1);
  font-weight: 700;
}
.blog-hero-excerpt {
  font-size: 1rem; color: var(--t2); line-height: 1.6; margin: 0;
}
.blog-hero-cta {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--indigo); font-weight: 600; font-size: .9rem;
  margin-top: 4px;
}

/* ─── Blog grid (cards) ─────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.blog-card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.blog-card:hover { border-color: var(--border-h); transform: translateY(-3px); }
.blog-card-media {
  width: 100%; aspect-ratio: 16/9; overflow: hidden;
}
.blog-card-media img,
.blog-card-media .cover-fallback {
  width: 100%; height: 100%; object-fit: cover;
}
.blog-card-body {
  padding: 18px 18px 22px;
  display: flex; flex-direction: column; gap: 10px; flex: 1;
}
.blog-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .75rem; color: var(--t3); font-weight: 500;
}
.blog-card-read { font-weight: 600; }
.blog-card-title {
  font-size: 1.1rem; line-height: 1.35; margin: 0;
  color: var(--t1); font-weight: 700;
}
.blog-card-excerpt {
  font-size: .88rem; color: var(--t2); line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card-foot {
  display: flex; align-items: center; gap: 5px;
  margin-top: auto; padding-top: 12px;
  font-size: .76rem; color: var(--t3);
  border-top: 1px solid var(--border);
}
.blog-card-foot .material-symbols-outlined { font-size: 14px; }

.load-more-wrap {
  display: flex; justify-content: center; margin-top: 48px;
}

.empty-state {
  text-align: center; padding: 64px 16px; color: var(--t2);
}
.empty-state .material-symbols-outlined {
  font-size: 48px; color: var(--t3); margin-bottom: 12px; display: block;
}

/* ─── Single article page ───────────────────────────────────────────── */
.article-head {
  max-width: 740px;
  margin: 0 auto 36px;
  text-align: center;
}
.article-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .85rem; color: var(--t3); text-decoration: none;
  margin-bottom: 28px;
}
.article-back:hover { color: var(--indigo); }
.article-back .material-symbols-outlined { font-size: 18px; }

.article-meta {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 10px;
  font-size: .82rem; color: var(--t3); font-weight: 500;
  margin-bottom: 18px;
}
.article-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15; margin: 0 0 16px;
  font-weight: 800; color: var(--t1);
}
.article-excerpt {
  font-size: 1.1rem; color: var(--t2); line-height: 1.55;
  margin: 0 0 28px;
}
.article-author {
  display: inline-flex; align-items: center; gap: 12px;
  text-align: left;
}
.article-author-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
}
.article-author-name { font-weight: 600; color: var(--t1); font-size: .9rem; }
.article-author-sub { font-size: .76rem; color: var(--t3); }

.article-cover-wrap {
  max-width: 1100px; margin: 0 auto 48px;
}
.article-cover {
  width: 100%; border-radius: var(--r-2xl);
  aspect-ratio: 2/1; object-fit: cover;
}

/* The article body — Medium-style centered column. */
.article-body.richtext {
  max-width: 720px; margin: 0 auto;
  color: var(--t1);
  font-size: 1.08rem; line-height: 1.78;
}
.article-body.richtext p { margin: 0 0 1.4em; color: var(--t2); }
.article-body.richtext h2 {
  margin: 2.4em 0 .6em; font-size: 1.6rem; color: var(--t1); font-weight: 700;
}
.article-body.richtext h3 {
  margin: 2em 0 .5em; font-size: 1.25rem; color: var(--t1); font-weight: 700;
}
.article-body.richtext a { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }
.article-body.richtext a:hover { color: var(--violet); }
.article-body.richtext ul,
.article-body.richtext ol { margin: 0 0 1.4em 1.5em; color: var(--t2); }
.article-body.richtext li { margin-bottom: .5em; }
.article-body.richtext img {
  max-width: 100%; border-radius: var(--r-lg);
  margin: 1.5em auto; display: block;
}
.article-body.richtext blockquote {
  border-left: 3px solid var(--indigo);
  padding: 4px 0 4px 18px;
  margin: 1.6em 0;
  color: var(--t2); font-style: italic;
}
.article-body.richtext code {
  background: rgba(255,255,255,.06); padding: 2px 6px;
  border-radius: 4px; font-size: .92em;
}
.article-body.richtext pre {
  background: var(--surface); padding: 16px 18px;
  border-radius: var(--r-md); overflow-x: auto;
  border: 1px solid var(--border);
  margin: 1.5em 0;
}

/* ─── Share buttons row ─────────────────────────────────────────────── */
.article-share {
  max-width: 720px; margin: 48px auto 0;
  display: flex; align-items: center; gap: 10px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.article-share-label {
  font-size: .8rem; color: var(--t3); font-weight: 600; margin-right: 4px;
}
.share-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--t2);
  cursor: pointer;
  position: relative;
  transition: all .15s;
}
.share-btn:hover { color: var(--t1); border-color: var(--border-h); transform: translateY(-1px); }
.share-fb:hover { color: var(--fb); }
.share-wa:hover { color: #25D366; }
.share-x:hover  { color: var(--t1); }
.share-copy { padding: 0; }
.share-copy-tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface); color: var(--t1);
  padding: 3px 8px; border-radius: 4px; font-size: .7rem;
  opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap;
}
.share-copy.is-copied .share-copy-tip { opacity: 1; }

/* ─── Related posts ─────────────────────────────────────────────────── */
.related-section { margin-top: 80px; }
.related-title {
  font-size: 1.25rem; color: var(--t1); font-weight: 700;
  margin: 0 0 22px;
}

/* ─── Help layout (sidebar + main) ─────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
}
.help-article-layout {
  grid-template-columns: 260px 1fr 220px;
}

.help-sidebar {
  position: sticky; top: 84px; align-self: start;
  max-height: calc(100vh - 100px); overflow-y: auto;
  padding-right: 8px;
}
.help-sidebar-head {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 700;
  color: var(--t1);
  padding: 6px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.help-sidebar-head .material-symbols-outlined { font-size: 18px; color: var(--indigo); }
.help-sidebar-back { display: flex; align-items: center; gap: 8px; color: var(--t1); text-decoration: none; }
.help-sidebar-back:hover { color: var(--indigo); }

.help-nav-group { margin-bottom: 22px; }
.help-nav-cat {
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--t3); font-weight: 700;
  margin-bottom: 8px;
}
.help-nav-cat .material-symbols-outlined { font-size: 16px; }
.help-nav-list { list-style: none; padding: 0; margin: 0; }
.help-nav-list li { margin-bottom: 2px; }
.help-nav-list a {
  display: block;
  padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--t2); text-decoration: none;
  font-size: .9rem; line-height: 1.4;
}
.help-nav-list a:hover { color: var(--t1); background: rgba(255,255,255,.04); }
.help-nav-list a.is-active {
  color: var(--indigo); background: rgba(99,102,241,.1);
  font-weight: 600;
}
.help-nav-empty {
  font-size: .82rem; color: var(--t3); padding: 4px 10px; font-style: italic;
}

/* ─── Help main (landing) ──────────────────────────────────────────── */
.help-head { margin-bottom: 36px; }
.help-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 40px;
}
.help-card {
  display: flex; gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
}
.help-card-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: rgba(99,102,241,.12); color: var(--indigo);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.help-card-icon .material-symbols-outlined { font-size: 22px; }
.help-card-title { font-size: 1.05rem; font-weight: 700; color: var(--t1); margin: 0 0 2px; }
.help-card-sub { font-size: .78rem; color: var(--t3); margin: 0 0 10px; }
.help-card-list { list-style: none; padding: 0; margin: 0; }
.help-card-list li { margin-bottom: 4px; }
.help-card-list a {
  color: var(--t2); font-size: .88rem; text-decoration: none; line-height: 1.4;
}
.help-card-list a:hover { color: var(--indigo); }
.help-card-date {
  display: block;
  font-size: .7rem; color: var(--t3); margin-top: 1px;
}
.help-card-empty { font-size: .82rem; color: var(--t3); margin: 0; font-style: italic; }

.help-cta {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-top: 16px;
}
.help-cta .material-symbols-outlined { color: var(--indigo); font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.help-cta strong { color: var(--t1); display: block; }
.help-cta p { margin: 4px 0 0; color: var(--t2); font-size: .9rem; }
.help-cta a { color: var(--indigo); }

/* ─── Help article ─────────────────────────────────────────────────── */
.help-crumbs {
  display: flex; align-items: center; gap: 4px;
  font-size: .82rem; color: var(--t3); margin-bottom: 16px;
}
.help-crumbs a { color: var(--t3); text-decoration: none; }
.help-crumbs a:hover { color: var(--indigo); }
.help-crumbs .material-symbols-outlined { font-size: 16px; }

.help-article-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700; color: var(--t1);
  margin: 0 0 10px; line-height: 1.2;
}
.help-article-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: .8rem; color: var(--t3); margin-bottom: 28px;
}
.help-article-meta .material-symbols-outlined { font-size: 16px; color: var(--green); }

.help-article-body.richtext {
  color: var(--t1); font-size: 1rem; line-height: 1.7;
}
.help-article-body.richtext p { color: var(--t2); margin: 0 0 1.2em; }
.help-article-body.richtext h2 {
  margin: 2.2em 0 .5em;
  font-size: 1.35rem; color: var(--t1); font-weight: 700;
  padding-top: 12px; border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}
.help-article-body.richtext h3 {
  margin: 1.8em 0 .4em;
  font-size: 1.1rem; color: var(--t1); font-weight: 600;
  scroll-margin-top: 90px;
}
.help-article-body.richtext a { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }
.help-article-body.richtext ul,
.help-article-body.richtext ol { margin: 0 0 1.2em 1.4em; color: var(--t2); }
.help-article-body.richtext li { margin-bottom: .4em; }
.help-article-body.richtext code {
  background: rgba(255,255,255,.06); padding: 2px 6px;
  border-radius: 4px; font-size: .9em;
}
.help-article-body.richtext pre {
  background: var(--surface); padding: 14px 16px;
  border-radius: var(--r-md); overflow-x: auto;
  border: 1px solid var(--border); margin: 1.4em 0;
}

.help-feedback {
  margin-top: 56px; padding: 22px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--card);
}
.help-feedback strong { display: block; color: var(--t1); margin-bottom: 10px; }
.help-feedback-btns { display: flex; gap: 8px; }
.help-feedback-btns .material-symbols-outlined { font-size: 16px; margin-right: 4px; }

/* ─── Help TOC (sticky right rail) ─────────────────────────────────── */
.help-toc {
  position: sticky; top: 84px; align-self: start;
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.help-toc-head {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--t3); font-weight: 700; margin-bottom: 10px;
}
.help-toc-list { list-style: none; padding: 0; margin: 0; }
.help-toc-list li { line-height: 1.4; margin-bottom: 4px; }
.help-toc-list a {
  display: block; padding: 4px 8px;
  font-size: .82rem; color: var(--t2);
  text-decoration: none; border-left: 2px solid transparent;
}
.help-toc-list a:hover { color: var(--t1); border-left-color: var(--indigo); }
.help-toc-list .toc-h3 a { padding-left: 22px; font-size: .78rem; color: var(--t3); }

/* ─── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .blog-hero { grid-template-columns: 1fr; }
  .blog-hero-body { padding: 20px 24px 28px; }
  .blog-hero-media img,
  .blog-hero-media .cover-fallback { min-height: 220px; }

  .blog-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }

  .help-layout,
  .help-article-layout { grid-template-columns: 1fr; gap: 24px; }
  .help-sidebar {
    position: static; max-height: none;
    padding: 14px 16px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--r-md);
  }
  .help-toc { display: none; }

  .help-cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content-page, .help-layout, .article-page { padding-top: 32px; padding-bottom: 64px; }
  .blog-grid { grid-template-columns: 1fr; }
  .article-share { flex-wrap: wrap; }
  .article-cover { aspect-ratio: 4/3; }
}
