/* =========================================================
   WriteUpCafe — topics-v2.css (2026-11-15 /topics revamp). Scoped under .tpx.
   Written to design-system/design.md (parchment): H1 48/800 and H2 28/600 in copper-dark,
   DM Sans 600 titles, copper eyebrows, 40px / 32px pill buttons with orange outline,
   tab-chip selection, 10px-radius input, dark lead card with gold title. No italics.
   ========================================================= */
.tpx {
  --x-bg: var(--wuc-parchment, #f5f0e8); --x-raised: var(--wuc-parchment-raised, #fbf7ef);
  --x-fg1: #1a0f06; --x-fg2: #3d2a18; --x-meta: #6b5a4a;
  --x-display: var(--wuc-copper-dark, #8b4513); --x-copper: var(--wuc-copper, #c17d3c);
  --x-gold: var(--wuc-gold-highlight, #f0c080); --x-orange: var(--wuc-primary, #e87a35);
  --x-line: rgba(139, 69, 19, 0.18); --x-line-strong: rgba(139, 69, 19, 0.35);
  --x-serif: 'Playfair Display', 'Times New Roman', Georgia, serif;
  background: var(--x-bg); color: var(--x-fg1); min-height: 70vh;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5;
}
.tpx *, .tpx *::before, .tpx *::after { box-sizing: border-box; }
.tpx [hidden] { display: none !important; }
.tpx h1, .tpx h2, .tpx p { margin: 0; }
.tpx a { text-decoration: none; }
.tpx :focus-visible { outline: 3px solid rgba(232, 122, 53, 0.55); outline-offset: 2px; }
.tpx-wrap { max-width: 1200px; margin: 0 auto; padding: 44px 40px 72px; display: flex; flex-direction: column; gap: 48px; }

/* head */
.tpx-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; }
.tpx-head__text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tpx-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--x-copper); }
.tpx .tpx-title { font-family: var(--x-serif); font-style: normal; font-weight: 800; font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; color: var(--x-display); }
.tpx-intro { font-size: 17px; color: var(--x-fg2); max-width: 600px; text-wrap: pretty; }
.tpx-stats { font-size: 14px; color: var(--x-meta); }

/* search + chips */
.tpx-controls { display: flex; flex-direction: column; gap: 14px; margin-top: -12px; }
.tpx-search {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--x-line-strong); background: var(--x-raised); color: var(--x-meta); cursor: text;
}
.tpx-search:focus-within { border-color: var(--x-orange); box-shadow: 0 0 0 3px rgba(232, 122, 53, 0.25); }
.tpx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 16px 'DM Sans', sans-serif; color: var(--x-fg1); }
.tpx-search input::placeholder { color: var(--x-meta); }
.tpx-bar { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; }
.tpx-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpx-label { font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--x-meta); margin-right: 6px; }
.tpx .tpx-chip {
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--x-fg1); font: 500 14px 'DM Sans', sans-serif; cursor: pointer; white-space: nowrap;
}
.tpx .tpx-chip:hover { background: rgba(26, 15, 6, 0.04); }
.tpx .tpx-chip.is-active { background: rgba(232, 122, 53, 0.12); border-color: rgba(232, 122, 53, 0.35); color: var(--x-orange); }

/* sections */
.tpx-sec { display: flex; flex-direction: column; gap: 18px; }
.tpx-sec--dir { gap: 4px; }
.tpx-sec__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--x-line); }
.tpx .tpx-h2 { font-family: var(--x-serif); font-weight: 600; font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; color: var(--x-display); }
.tpx-sub { font-size: 14px; color: var(--x-meta); }
.tpx-meta { font-size: 13px; color: var(--x-meta); }

/* pills (your topics, type groups) */
.tpx-mine { display: flex; flex-wrap: wrap; gap: 8px; }
.tpx .tpx-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--x-raised); border: 1px solid var(--x-line); color: var(--x-fg1); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.tpx .tpx-pill:hover { border-color: var(--x-orange); }
.tpx-pill span { font-size: 12px; color: var(--x-display); }
.tpx .tpx-pill--line { background: transparent; border-color: var(--x-line-strong); }
.tpx-pill--line span { color: var(--x-meta); }
.tpx-groups { display: flex; flex-direction: column; gap: 14px; }
.tpx-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpx-group .tpx-label { flex: 0 0 150px; margin-right: 0; }

/* type chips on a topic */
.tpx-tchips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.tpx .tpx-tchip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
  background: rgba(232, 122, 53, 0.12); border: 1px solid rgba(232, 122, 53, 0.35); color: var(--x-display);
  font-weight: 500; font-size: 13px; white-space: nowrap;
}
.tpx .tpx-tchip:hover { background: rgba(232, 122, 53, 0.2); }
.tpx .tpx-tchips--dark .tpx-tchip { color: var(--x-gold); }

/* follow buttons */
.tpx .tpx-follow {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--x-orange); background: transparent; color: var(--x-orange); font: 500 13px/1 'DM Sans', sans-serif;
  cursor: pointer; white-space: nowrap; transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.tpx .tpx-follow:hover { background: rgba(232, 122, 53, 0.08); }
.tpx-follow__off, .tpx-follow__on, .tpx a.tpx-follow { display: inline-flex; align-items: center; gap: 6px; }
.tpx-follow__on { display: none; }
.tpx-follow.is-following .tpx-follow__off { display: none; }
.tpx-follow.is-following .tpx-follow__on { display: inline-flex; }
.tpx .tpx-follow.is-following { border-color: var(--x-line-strong); color: var(--x-fg2); }
.tpx .tpx-follow[disabled] { opacity: .6; cursor: default; }
.tpx .tpx-follow--lead { height: 40px; padding: 0 20px; font-size: 14px; background: var(--x-orange); color: #ffffff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.tpx .tpx-follow--lead:hover { background: #f08a45; }
.tpx .tpx-follow--lead.is-following { background: transparent; border-color: rgba(193, 125, 60, 0.45); color: #e8ddd0; box-shadow: none; }
.tpx .tpx-follow--lead.is-following:hover { background: rgba(255, 255, 255, 0.04); }

/* most followed */
.tpx-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tpx-lead {
  grid-column: span 2; padding: 28px; border-radius: 14px; background: #1a0f06; color: #e8ddd0;
  display: flex; flex-direction: column; gap: 10px; justify-content: space-between; min-width: 0;
}
.tpx-lead__text { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tpx .tpx-lead__name { font-family: var(--x-serif); font-weight: 700; font-size: 36px; line-height: 1.15; letter-spacing: -0.015em; color: var(--x-gold); overflow-wrap: anywhere; }
.tpx-lead__meta { font-size: 14px; color: #ddd0c0; }
.tpx-lead__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.tpx .tpx-lead__open { font-size: 14px; font-weight: 600; color: var(--x-gold); }
.tpx .tpx-lead__open:hover { color: #e0a030; }
.tpx-card {
  padding: 24px; border-radius: 14px; border: 1px solid var(--x-line); background: var(--x-raised);
  display: flex; flex-direction: column; gap: 14px; justify-content: space-between; align-items: flex-start; min-width: 0;
}
.tpx-card__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.tpx .tpx-card__name { font-weight: 600; font-size: 22px; line-height: 1.3; color: var(--x-fg1); overflow-wrap: anywhere; }
.tpx .tpx-card__name:hover, .tpx .tpx-row__name:hover { color: var(--x-display); }

/* directory */
.tpx-dir { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }
.tpx-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--x-line); min-width: 0; }
.tpx-row.is-more { display: none; }
.tpx.is-all .tpx-row.is-more { display: flex; }
.tpx-row.is-out { display: none !important; }
.tpx-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpx .tpx-row__name { font-weight: 600; font-size: 18px; line-height: 1.35; color: var(--x-fg1); overflow-wrap: anywhere; }
.tpx-none { padding: 32px 0 8px; color: var(--x-meta); }
.tpx .tpx-link { border: 0; background: none; padding: 0; font: 600 15px 'DM Sans', sans-serif; color: var(--x-display); cursor: pointer; }
.tpx .tpx-link:hover { color: var(--x-copper); }
.tpx-allwrap { display: flex; justify-content: center; padding-top: 24px; }
.tpx .tpx-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; font: 500 14px/1 'DM Sans', sans-serif; cursor: pointer;
}
.tpx .tpx-btn--outline { background: transparent; border-color: var(--x-orange); color: var(--x-orange); }
.tpx .tpx-btn--outline:hover { background: rgba(232, 122, 53, 0.08); }

@media (max-width: 1024px) {
  .tpx-wrap { padding: 36px 32px 60px; gap: 40px; }
  .tpx-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tpx-dir { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tpx-wrap { padding: 28px 16px 48px; gap: 36px; }
  .tpx .tpx-title { font-size: 34px; }
  .tpx .tpx-h2 { font-size: 22px; }
  .tpx-top, .tpx-dir { grid-template-columns: minmax(0, 1fr); }
  .tpx-lead { grid-column: auto; padding: 24px 20px; }
  .tpx .tpx-lead__name { font-size: 30px; }
  .tpx-group .tpx-label { flex-basis: 100%; }
  .tpx-chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tpx-chips::-webkit-scrollbar { display: none; }
}
/* phone: lead + two cards are enough above the directory */
@media (max-width: 640px) { .tpx-top > :nth-child(n+4) { display: none; } }
.tpx-chips .tpx-label, .tpx .tpx-chip { flex: 0 0 auto; }
/* the search box shows focus on its frame (focus-within), not on the input inside it */
.tpx .tpx-search input:focus, .tpx .tpx-search input:focus-visible { outline: none; box-shadow: none; }

/* filter + sort bar sits on the list it changes and sticks under the site header (64px) */
.tpx-sec--dir .tpx-bar {
  position: sticky; top: 64px; z-index: 20; background: var(--x-bg);
  padding: 10px 0; border-bottom: 1px solid var(--x-line);
}
.tpx-controls { margin-top: -12px; }
/* phone: filters and sort share one row that scrolls sideways */
@media (max-width: 640px) {
  .tpx-sec--dir .tpx-bar {
    flex-wrap: nowrap; justify-content: flex-start; gap: 0 12px; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 10px 16px;
  }
  .tpx-sec--dir .tpx-bar::-webkit-scrollbar { display: none; }
  .tpx-sec--dir .tpx-bar .tpx-chips { flex: 0 0 auto; overflow: visible; max-width: none; }
  .tpx-sec--dir .tpx-bar .tpx-chips + .tpx-chips { padding-left: 12px; border-left: 1px solid var(--x-line-strong); }
}
