/* The blog (/blog, /blog/<slug>), served as complete HTML by the Worker (worker/blog/render.ts).
   It sits on tools.css, which carries the manga proof-sheet tokens, header, footer, buttons, panels and halftone (mirrors src/styles/manga.css).
   Only what the blog adds is here. No purple: cobalt, zen, samurai red, gold and ink only (HANDOFF section 15). */

/* ---------- header additions: theme switch ---------- */
.nav-end { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.theme-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  border: 2px solid var(--mg-line); background: transparent; color: var(--mg-fg); cursor: pointer;
  transition: color 0.2s var(--mg-ease), background 0.2s var(--mg-ease);
}
.theme-btn:hover { color: var(--mg-accent); }
.theme-btn .i-sun { display: none; }
.dark .theme-btn .i-sun { display: block; }
.dark .theme-btn .i-moon { display: none; }
@media (max-width: 480px) { .nav-end { gap: 0.4rem; } .theme-btn { width: 2.1rem; height: 2.1rem; } }

/* ---------- shared bits ---------- */
.blog-chip {
  display: inline-block; font-weight: 800; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  border: 2px solid var(--mg-line); padding: 0.2rem 0.55rem; margin-bottom: 0.75rem;
}
.blog-chip-alt { color: var(--mg-accent); margin-left: 0.4rem; }
.blog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; color: var(--mg-fg-soft); font-size: 0.9rem; margin-top: 0.9rem; }
.blog-tag { border: 2px solid color-mix(in srgb, var(--mg-line) 40%, transparent); padding: 0 0.45rem; font-size: 0.8rem; font-weight: 700; }
.blog-muted { color: var(--mg-fg-soft); font-size: 0.9rem; }

/* ---------- covers: drawn in CSS, never from key art ---------- */
.cover {
  --cv-bg: #2f6bff; --cv-fg: #ffffff; --cv-ac: #0e0f14; --cv-dot: rgba(255, 255, 255, 0.28);
  position: relative; isolation: isolate; overflow: hidden; container-type: inline-size;
  display: flex; flex-direction: column; justify-content: space-between; gap: 0.5rem;
  aspect-ratio: 16 / 9; padding: clamp(0.7rem, 5cqw, 1.6rem);
  background-color: var(--cv-bg); color: var(--cv-fg);
}
.cover--cobalt { --cv-bg: #2f6bff; --cv-fg: #ffffff; --cv-ac: #0e0f14; --cv-dot: rgba(255, 255, 255, 0.28); }
.cover--zen { --cv-bg: #2f6b5e; --cv-fg: #f3f1ec; --cv-ac: #7bbbad; --cv-dot: rgba(243, 241, 236, 0.25); }
.cover--samurai { --cv-bg: #c5483a; --cv-fg: #fff7ee; --cv-ac: #d4a847; --cv-dot: rgba(255, 247, 238, 0.26); }
.cover--gold { --cv-bg: #d4a847; --cv-fg: #101116; --cv-ac: #101116; --cv-dot: rgba(16, 17, 22, 0.22); }
.cover--ink { --cv-bg: #101116; --cv-fg: #f3f1ec; --cv-ac: #2f6bff; --cv-dot: rgba(243, 241, 236, 0.2); }
.cover::before { content: ''; position: absolute; inset: 0; z-index: -1; }
.cover--speed::before {
  background: repeating-conic-gradient(from 0deg at 78% 56%, var(--cv-dot) 0deg 0.9deg, transparent 0.9deg 6.5deg);
  -webkit-mask-image: radial-gradient(circle at 78% 56%, transparent 10%, #000 62%); mask-image: radial-gradient(circle at 78% 56%, transparent 10%, #000 62%);
}
.cover--halftone::before {
  background-image: radial-gradient(circle at center, var(--cv-dot) 1.6px, transparent 2.2px); background-size: 10px 10px;
  -webkit-mask-image: linear-gradient(115deg, #000 0%, transparent 78%); mask-image: linear-gradient(115deg, #000 0%, transparent 78%);
}
.cover--rings::before { background: repeating-radial-gradient(circle at 84% 108%, transparent 0 1.4rem, var(--cv-dot) 1.4rem 1.55rem); }
.cover--grid::before {
  background-image: linear-gradient(var(--cv-dot) 1.5px, transparent 1.5px), linear-gradient(90deg, var(--cv-dot) 1.5px, transparent 1.5px); background-size: 2.2rem 2.2rem;
  -webkit-mask-image: linear-gradient(160deg, transparent 5%, #000 90%); mask-image: linear-gradient(160deg, transparent 5%, #000 90%);
}
.cover-kicker {
  align-self: flex-start; border: 2px solid var(--cv-fg); padding: 0.15em 0.6em;
  font-weight: 800; font-size: clamp(0.55rem, 3.1cqw, 0.8rem); letter-spacing: 0.14em; text-transform: uppercase;
}
.cover-words { display: block; font-family: var(--font-display); line-height: 0.92; overflow-wrap: anywhere; }
.cover-words span { display: block; font-size: clamp(1.5rem, 14.5cqw, 5.4rem); color: var(--cv-fg); text-shadow: 0.05em 0.05em 0 var(--cv-ac); }
.cover-words span + span { color: transparent; -webkit-text-stroke: clamp(1.5px, 0.022em, 3px) var(--cv-fg); text-shadow: none; }

/* ---------- the index ---------- */
.blog-hero { padding-bottom: 1.25rem; }
.blog-hero h1 { font-size: clamp(2.3rem, 7vw, 4.2rem); max-width: 16ch; }
.blog-hero .lede { font-size: 1.1rem; max-width: 52ch; }
.blog-list { padding: 0.5rem 0 3rem; }
.blog-tabs { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.75rem; }
.blog-tabs a {
  text-decoration: none; font-weight: 800; font-size: 0.9rem; padding: 0.55rem 1rem;
  border: 3px solid var(--mg-line); background: var(--mg-panel); box-shadow: 3px 3px 0 var(--mg-line);
  transition: transform 0.2s var(--mg-ease), box-shadow 0.2s var(--mg-ease);
}
.blog-tabs a:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--mg-line); }
.blog-tabs a[aria-current='true'] { background: var(--mg-accent); color: var(--mg-accent-ink); box-shadow: 4px 4px 0 var(--mg-line); }

.blog-grid { display: grid; gap: 1.6rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8rem; } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; } }
.blog-grid[data-show='popular'] .blog-card[data-cat='underrated'],
.blog-grid[data-show='underrated'] .blog-card[data-cat='popular'] { display: none; }
/* Six cards fill a 2-column tablet grid (3 rows) and a 3-column desktop grid: the featured card takes two columns and two rows, the next two stack beside it. */
@media (min-width: 1024px) {
  .blog-grid[data-show='all'] > .is-feature { grid-column: span 2; grid-row: span 2; }
  /* The cover takes whatever height the two rows leave, so the card has no empty band under its text. */
  .blog-grid[data-show='all'] > .is-feature .cover { aspect-ratio: auto; flex: 1 1 auto; min-height: 20rem; }
  .blog-grid[data-show='all'] > .is-feature .blog-card-body { padding: 1.6rem 1.7rem 1.8rem; }
  .blog-grid[data-show='all'] > .is-feature .blog-card-title { font-size: clamp(1.7rem, 2.4vw, 2.3rem); }
  .blog-grid[data-show='all'] > .is-feature .blog-card-deck { font-size: 1.08rem; }
}

.blog-card { min-width: 0; }
.blog-card-link {
  display: flex; flex-direction: column; height: 100%; text-decoration: none;
  border: 3px solid var(--mg-line); background: var(--mg-panel); box-shadow: 6px 6px 0 var(--mg-shadow);
  transition: transform 0.25s var(--mg-ease), box-shadow 0.25s var(--mg-ease);
}
.blog-card-link:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--mg-shadow); }
.blog-card .cover { border-bottom: 3px solid var(--mg-line); }
.blog-card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.blog-card-body .blog-chip { align-self: flex-start; }
.blog-card-title { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; }
.blog-card-deck { color: var(--mg-fg-soft); margin-top: 0.6rem; font-size: 0.97rem; line-height: 1.55; }
.blog-card .blog-meta { margin-top: auto; padding-top: 0.9rem; }

/* ---------- an article ---------- */
.blog-head { padding: 2.2rem 0 1.4rem; }
@media (min-width: 900px) { .blog-head { padding: 3.2rem 0 1.8rem; } }
.blog-head .mg-wrap > * { max-width: 52rem; }
.blog-head h1 { font-size: clamp(1.9rem, 5.6vw, 3.4rem); line-height: 1.04; }
.blog-head .lede { font-size: 1.12rem; margin-top: 1.1rem; }
.blog-crumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.85rem; font-weight: 700; margin-bottom: 1.1rem; color: var(--mg-fg-soft); }
.blog-crumbs a { text-decoration: none; }
.blog-crumbs a:hover { color: var(--mg-accent); }
.blog-hero-media { margin-bottom: 2.4rem; }
.blog-hero-media .cover { border: 3px solid var(--mg-line); box-shadow: 8px 8px 0 var(--mg-shadow); aspect-ratio: 16 / 9; }
@media (min-width: 900px) { .blog-hero-media .cover { aspect-ratio: 21 / 9; } }

.blog-column { width: min(100% - 2rem, 44rem); margin-inline: auto; }
@media (min-width: 640px) { .blog-column { width: min(100% - 3rem, 44rem); } }

.blog-video { margin: 0 0 2rem; }
.blog-video-frame { position: relative; aspect-ratio: 16 / 9; border: 3px solid var(--mg-line); box-shadow: 8px 8px 0 var(--mg-shadow); background: #000; }
.blog-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blog-video figcaption { margin-top: 0.9rem; font-size: 0.88rem; color: var(--mg-fg-soft); }

.blog-glance { padding: 1.2rem 1.25rem; margin-bottom: 2.4rem; }
.blog-glance h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; margin-bottom: 0.5rem; }
.blog-glance dl > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.1rem; padding: 0.65rem 0; border-bottom: 2px solid color-mix(in srgb, var(--mg-line) 22%, transparent); }
.blog-glance dl > div:last-child { border-bottom: 0; }
.blog-glance dt { font-weight: 800; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mg-fg-soft); }
.blog-glance dd { overflow-wrap: anywhere; }
@media (min-width: 560px) { .blog-glance dl > div { grid-template-columns: 11.5rem minmax(0, 1fr); gap: 1rem; } }
.blog-glance > .blog-muted { margin-top: 0.8rem; }

.blog-body .blog-section { margin-bottom: 0.4rem; }
.blog-section h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 3.6vw, 1.9rem); line-height: 1.08; margin: 2.2rem 0 0.8rem; text-wrap: balance; }
.blog-body p, .blog-take p, .blog-studio p, .blog-forum p { font-size: 1.06rem; line-height: 1.75; }
.blog-section p + p, .blog-take p + p { margin-top: 1rem; }
.cite { font-size: 0.7em; line-height: 0; }
.cite a { color: var(--mg-accent); font-weight: 800; text-decoration: none; padding: 0 0.12em; }
.cite a:hover { text-decoration: underline; }

.blog-take { margin: 3rem 0; padding: 1.4rem 1.3rem 1.6rem; box-shadow: 8px 8px 0 var(--mg-accent); }
@media (min-width: 640px) { .blog-take { padding: 1.9rem 2rem 2.1rem; } }
.blog-take h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 0.9rem; }
.blog-verdict { font-weight: 800; font-size: 1.18rem !important; line-height: 1.45 !important; margin-bottom: 1.1rem; }

.blog-studio { padding: 1.4rem 1.3rem; margin: 3rem 0 2.4rem; }
.blog-studio h2, .blog-forum h2, .blog-discuss h2, .blog-sources h2, .blog-more h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 3.6vw, 1.9rem); line-height: 1.1; margin-bottom: 0.7rem; }
.blog-studio-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.1rem; margin-top: 1.1rem; }
.blog-forum { margin: 2.4rem 0; }
.blog-forum p + p { margin-top: 1rem; }

.blog-sources { margin: 2.6rem 0 0; padding-bottom: 3.5rem; }
.blog-sources ol { margin: 0.4rem 0 1rem 1.3rem; display: grid; gap: 0.55rem; }
.blog-sources li { font-size: 0.95rem; line-height: 1.5; overflow-wrap: anywhere; scroll-margin-top: 6rem; }
.blog-sources li:target { background: color-mix(in srgb, var(--mg-accent) 18%, transparent); }
.blog-sources a { font-weight: 700; }

.blog-more { padding: 3.2rem 0 4.2rem; border-top: 3px solid var(--mg-line); }
.blog-more h2 { margin-bottom: 1.6rem; }

/* ---------- comments (only present when BLOG_COMMENTS=1) ---------- */
.blog-discuss { margin: 2.6rem 0; padding-top: 2.2rem; border-top: 3px solid var(--mg-line); }
.blog-discuss-note { color: var(--mg-fg-soft); font-size: 0.95rem !important; margin-bottom: 1.2rem; }
.blog-comment-list { list-style: none; display: grid; gap: 1rem; }
.blog-comment-list.is-nested { margin: 0.9rem 0 0 0.9rem; padding-left: 0.9rem; border-left: 3px solid color-mix(in srgb, var(--mg-line) 28%, transparent); }
.blog-comment { border: 3px solid var(--mg-line); background: var(--mg-panel); padding: 0.9rem 1rem; }
.blog-comment.is-reply { border-width: 2px; }
.blog-comment-head { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: baseline; font-size: 0.9rem !important; }
.blog-comment-who { font-weight: 800; text-decoration: none; }
.blog-comment-who:hover { color: var(--mg-accent); }
.blog-comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem !important; line-height: 1.6 !important; margin-top: 0.4rem; }
.blog-comment-actions { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.85rem !important; }
.blog-link-btn { font: inherit; font-weight: 800; background: none; border: 0; padding: 0; color: var(--mg-fg-soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.blog-link-btn:hover { color: var(--mg-accent); }
.blog-comment-form { margin-top: 1.4rem; display: grid; gap: 0.7rem; }
.blog-comment-form[hidden], #comment-signin[hidden] { display: none; }
.blog-comment-actions .blog-muted { align-self: center; }
.blog-comment-form .blog-comment-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin: 0; }
#comment-signin { margin-top: 1.4rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }

@media print { .blog-video, .blog-studio, .blog-forum, .blog-discuss, .blog-more, .theme-btn { display: none !important; } }
