/* =========================================================
   WriteUpCafe — topic-v2.css (2026-11-15 topic page redesign)
   One page per topic, a tab per type. Scoped under .tv2.
   Written to design-system/design.md: dark hero (H1 gold 64/900), parchment body,
   H2 36/700 and H3 28/600 in copper-dark, DM Sans 600 card titles, copper eyebrows,
   40px pill buttons, tab-chip selection, palette colours only.
   Writeup cards (.ts-wcard), blog cards (.blog-card) and the sidebar (.ts-sc) keep
   their existing styles from app.css; type cards come from series-listing.css (.slv).
   ========================================================= */

.tv2 {
  --t-bg: var(--wuc-parchment, #f5f0e8); --t-raised: var(--wuc-parchment-raised, #fbf7ef);
  --t-fg1: #1a0f06; --t-fg2: #3d2a18; --t-meta: #6b5a4a;
  --t-display: var(--wuc-copper-dark, #8b4513); --t-copper: var(--wuc-copper, #c17d3c);
  --t-gold: var(--wuc-gold-highlight, #f0c080); --t-orange: var(--wuc-primary, #e87a35);
  --t-line: rgba(139, 69, 19, 0.18); --t-line-strong: rgba(139, 69, 19, 0.35);
  --t-serif: 'Playfair Display', 'Times New Roman', Georgia, serif;
  background: var(--t-bg); color: var(--t-fg1); min-height: 70vh;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5;
}
.tv2 *, .tv2 *::before, .tv2 *::after { box-sizing: border-box; }
.tv2 [hidden] { display: none !important; }
.tv2 :focus-visible { outline: 3px solid rgba(232, 122, 53, 0.55); outline-offset: 2px; }
.tv2 h1, .tv2 h2, .tv2 h3, .tv2 p { margin: 0; }

/* ---------- hero (dark) ---------- */
.tv2-hero { background: #1a0f06; color: #e8ddd0; border-top: 1px solid rgba(193, 125, 60, 0.18); }
.tv2-hero__in {
  max-width: 1300px; margin: 0 auto; padding: 44px 48px 32px;
  display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; justify-content: space-between;
}
.tv2-hero__text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tv2-hero__side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.tv2-crumb { display: flex; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--t-copper); }
.tv2 .tv2-crumb a { color: var(--t-copper); text-decoration: none; }
.tv2 .tv2-crumb a:hover { color: var(--t-gold); }
.tv2 .tv2-title {
  font-family: var(--t-serif); font-style: normal; font-weight: 900; font-size: 64px; line-height: 1.05;
  letter-spacing: -0.02em; color: var(--t-gold); text-wrap: balance; overflow-wrap: anywhere;
}
.tv2-desc { font-size: 17px; color: #ddd0c0; max-width: 640px; text-wrap: pretty; }
.tv2-stats { font-size: 14px; color: #ddd0c0; }
.tv2-faces { display: flex; }
.tv2-face {
  width: 28px; height: 28px; border-radius: 999px; overflow: hidden; margin-left: -8px; border: 2px solid #1a0f06;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600;
}
.tv2-face:first-child { margin-left: 0; }
.tv2-face img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- buttons ---------- */
.tv2 .tv2-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent; font: 500 14px/1 'DM Sans', sans-serif; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.tv2 .tv2-btn--primary { background: var(--t-orange); color: #ffffff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.tv2 .tv2-btn--primary:hover { background: #f08a45; }
.tv2 .tv2-btn--primary:active { background: #d26a2a; box-shadow: none; }
.tv2 .tv2-btn--outline { background: transparent; border-color: var(--t-orange); color: var(--t-orange); }
.tv2 .tv2-btn--outline:hover { background: rgba(232, 122, 53, 0.08); }
.tv2 .tv2-btn[disabled] { opacity: .6; cursor: default; }
.tv2-follow__off, .tv2-follow__on { display: inline-flex; align-items: center; gap: 8px; }
.tv2-follow__on { display: none; }
.tv2 .tv2-btn.is-following { background: transparent; border-color: rgba(193, 125, 60, 0.35); color: #e8ddd0; box-shadow: none; }
.tv2 .tv2-btn.is-following:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(193, 125, 60, 0.55); }
.tv2-btn.is-following .tv2-follow__off { display: none; }
.tv2-btn.is-following .tv2-follow__on { display: inline-flex; }

/* ---------- tab bar ---------- */
.tv2-tabs { background: #120a04; border-top: 1px solid rgba(193, 125, 60, 0.18); }
.tv2-tabs__in { max-width: 1300px; margin: 0 auto; padding: 0 48px; display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.tv2-tabs__in::-webkit-scrollbar { display: none; }
.tv2 .tv2-tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 48px; font-weight: 500; font-size: 14px;
  white-space: nowrap; color: #e8ddd0; text-decoration: none; border-bottom: 2px solid transparent;
}
.tv2 .tv2-tab:hover { color: var(--t-gold); }
.tv2 .tv2-tab.is-active { color: var(--t-orange); border-bottom-color: var(--t-orange); }
.tv2-tab__n { font-size: 12px; color: rgba(221, 208, 192, 0.7); }
.tv2-tab.is-active .tv2-tab__n { color: var(--t-orange); }

/* ---------- body ---------- */
.tv2-body {
  max-width: 1300px; margin: 0 auto; padding: 40px 48px 80px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start;
}
.tv2-body.is-wide { grid-template-columns: minmax(0, 1fr); }
.tv2-body.is-wide .tv2-side { display: none; }
.tv2-main { min-width: 0; }
.tv2-panel { display: flex; flex-direction: column; gap: 44px; }
.tv2-panel[data-tv2-lazy], #tv2-p-writeups { gap: 28px; }

.tv2 .tv2-h2 { font-family: var(--t-serif); font-weight: 700; font-size: 36px; line-height: 1.2; letter-spacing: -0.015em; color: var(--t-display); text-wrap: balance; }
.tv2 .tv2-h3 { font-family: var(--t-serif); font-weight: 600; font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; color: var(--t-display); }
.tv2-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--t-copper); }
.tv2-meta { font-size: 14px; color: var(--t-meta); margin-top: 12px; }

.tv2-sec { display: flex; flex-direction: column; gap: 18px; }
.tv2-sec__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--t-line); }
.tv2 .tv2-more { font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--t-display); text-decoration: none; }
.tv2 .tv2-more:hover { color: var(--t-copper); }

.tv2-tabhead { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.tv2-tools { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.tv2-switch { display: flex; gap: 6px; }
.tv2 .tv2-chip {
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--t-fg1); font: 500 14px 'DM Sans', sans-serif; cursor: pointer;
}
.tv2 .tv2-chip:hover { background: rgba(26, 15, 6, 0.04); }
.tv2 .tv2-chip.is-active { background: rgba(232, 122, 53, 0.12); border-color: rgba(232, 122, 53, 0.35); color: var(--t-orange); }
.tv2-lang { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--t-meta); }
.tv2-lang select {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--t-line-strong); background: var(--t-raised);
  color: var(--t-fg1); font: 400 14px 'DM Sans', sans-serif; max-width: 220px;
}
.tv2-lang select:focus { outline: none; border-color: var(--t-orange); box-shadow: 0 0 0 3px rgba(232, 122, 53, 0.25); }

/* writeup + blog grids (cards themselves are app.css) */
.tv2 .tv2-grid { margin-bottom: 0; transition: opacity .15s; }
.tv2 .tv2-grid.is-busy { opacity: .45; }
.tv2-body.is-wide .tv2-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tv2 .tv2-bloggrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tv2-none { grid-column: 1 / -1; padding: 36px 16px; text-align: center; color: var(--t-meta); font-size: 14px; }
.tv2-loading { grid-column: 1 / -1; padding: 48px 16px; text-align: center; color: var(--t-meta); font-size: 14px; }

.tv2-empty, .tv2-prompt {
  padding: 32px; border-radius: 14px; border: 1px dashed rgba(139, 69, 19, 0.45);
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--t-fg2);
}
.tv2-prompt { max-width: 560px; }

/* type cards: the listing-page block without its page chrome */
.tv2 .tv2-slv { background: transparent; min-height: 0; }
.tv2 .tv2-slv .slv-eyebrow { align-self: flex-start; }
/* inside the narrower Overview column */
.tv2-slv--short .slv-list--book { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 20px; }
.tv2-slv--short .slv-list--collection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv2-slv--short .slv-list--playbook { grid-template-columns: minmax(0, 1fr); }
.tv2-slv--short .slv-book__cover { padding: 18px 14px; }
.tv2-slv--short .slv-book__cover strong { font-size: 20px; }
.tv2-slv--short .slv-book__cover strong.is-sm { font-size: 15px; }
.tv2-slv--short .slv-book__cover strong.is-xs { font-size: 12px; }
.tv2-slv--short .slv-book__desc { display: none; }

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  .tv2-hero__in { padding: 36px 32px 28px; }
  .tv2-tabs__in { padding: 0 32px; }
  .tv2-body { grid-template-columns: minmax(0, 1fr); padding: 32px 32px 60px; gap: 40px; }
  .tv2-body .ts-sidebar { position: static; }
  .tv2 .tv2-title { font-size: 48px; }
  .tv2-body.is-wide .tv2-grid, .tv2 .tv2-bloggrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- phone ---------- */
@media (max-width: 640px) {
  .tv2-hero__in { padding: 28px 16px 24px; }
  .tv2-hero__side { align-items: flex-start; }
  .tv2-tabs__in { padding: 0 16px; gap: 24px; }
  .tv2-body { padding: 28px 16px 48px; }
  .tv2 .tv2-title { font-size: 40px; }
  .tv2 .tv2-h2 { font-size: 28px; }
  .tv2 .tv2-h3 { font-size: 22px; }
  .tv2 .tv2-grid, .tv2-body.is-wide .tv2-grid, .tv2 .tv2-bloggrid { grid-template-columns: minmax(0, 1fr); }
  .tv2-slv--short .slv-list--book { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv2-slv--short .slv-list--collection { grid-template-columns: minmax(0, 1fr); }
  .tv2-empty, .tv2-prompt { padding: 24px 20px; }
}

/* loaded tabs: head, cards and prompt as a spaced column (the blogs slot is a grid) */
.tv2 [data-tv2-slot]:not(.blog-grid) { display: flex; flex-direction: column; gap: 28px; }
/* Overview: the section rule already separates the heading from the first series row */
.tv2-slv--short .slv-list--series .slv-row:first-child { border-top: 0; padding-top: 4px; }
