/* Truffle Nation Forums — brand-aligned community shell */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #6D2E46;
  --primary-dark: #5A2339;
  --primary-light: #8B4063;
  --secondary: #A26769;
  --accent: #ECE2D0;
  --gold: #C4893B;
  --bg: #FAF7F2;
  --card: #FFFFFF;
  --text: #2D2D2D;
  --text-mid: #555555;
  --text-light: #888888;
  --line: rgba(109, 46, 70, 0.10);
  --line-soft: rgba(109, 46, 70, 0.06);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(109, 46, 70, 0.08);
  --shadow-lg: 0 12px 32px rgba(109, 46, 70, 0.12);
  --header-h: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Header ─────────────────────────────────────────── */
.fx-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.fx-header-in {
  max-width: 1440px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px;
}
.fx-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.fx-logo img { height: 34px; width: auto; }
.fx-logo-text {
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.2rem;
  color: var(--primary); letter-spacing: -0.01em; white-space: nowrap;
}
.fx-logo-text span { color: var(--secondary); font-weight: 500; }

.fx-search { flex: 1; max-width: 560px; position: relative; }
.fx-search input {
  width: 100%; height: 46px; padding: 0 16px 0 44px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.fx-search input::placeholder { color: var(--text-light); }
.fx-search input:focus { border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(162, 103, 105, 0.12); }
.fx-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-light); }

.fx-header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 999px;
  font-size: 0.92rem; font-weight: 600; white-space: nowrap;
  transition: transform .16s, box-shadow .16s, background .16s, color .16s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(109, 46, 70, 0.22); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 8px 22px rgba(109, 46, 70, 0.28); }
.btn-ghost { background: var(--card); color: var(--primary); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--accent); }
.btn-gold { background: var(--gold); color: #fff; box-shadow: 0 4px 14px rgba(196, 137, 59, 0.28); }
.btn-gold:hover { background: #ad7730; }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 0.86rem; }

/* ── Layout ─────────────────────────────────────────── */
.fx-shell {
  max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: 268px minmax(0, 1fr) 320px;
  gap: 32px; padding: 32px 24px 72px;
  align-items: start;
}
.fx-rail { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 20px; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-title {
  font-family: 'Playfair Display', serif; font-size: 1.12rem; font-weight: 700;
  color: var(--primary); margin-bottom: 14px;
}

/* ── Join / lead-capture panel ──────────────────────── */
.join-panel { background: linear-gradient(160deg, #fff 0%, #FFFBF6 100%); }
.join-panel .card-title { font-size: 1.24rem; line-height: 1.3; }
.join-sub { font-size: 0.86rem; color: var(--text-mid); margin: -8px 0 16px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(162, 103, 105, 0.12);
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.field-err { color: #b3261e; font-size: 0.78rem; margin-top: 4px; display: none; }
.field.has-err input, .field.has-err textarea, .field.has-err select { border-color: #b3261e; }
.field.has-err .field-err { display: block; }
.fineprint { font-size: 0.73rem; color: var(--text-light); margin-top: 10px; line-height: 1.5; }
.form-note { padding: 12px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 14px; }
.form-note.ok { background: #EAF6EC; color: #1e5b2c; border: 1px solid #bfe3c6; }
.form-note.bad { background: #FDECEA; color: #8c1d18; border: 1px solid #f5c6c2; }

/* ── Category nav ───────────────────────────────────── */
.cat-list { display: grid; gap: 2px; }
.cat-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 8px; font-size: 0.89rem;
  color: var(--text-mid); font-weight: 500; transition: background .16s, color .16s;
}
.cat-list a:hover { background: var(--accent); color: var(--primary); }
.cat-list a.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.cat-list .count { font-size: 0.76rem; opacity: .7; font-variant-numeric: tabular-nums; }

/* ── Feed head ──────────────────────────────────────── */
.feed-head { margin-bottom: 24px; }
.eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--secondary); margin-bottom: 6px;
}
.feed-head h1 {
  font-family: 'Playfair Display', serif; font-size: 2.7rem; font-weight: 800;
  color: var(--primary); line-height: 1.08; letter-spacing: -0.02em;
}
.feed-head p { color: var(--text-mid); margin-top: 10px; max-width: 62ch; }

/* ── Post card ──────────────────────────────────────── */
.feed { display: grid; gap: 18px; }
.post-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s, border-color .2s;
}
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--line); }

.post-byline { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.post-byline img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.byline-name { font-weight: 600; font-size: 0.93rem; color: var(--text); display: flex; align-items: center; gap: 6px; }
.byline-time { font-size: 0.79rem; color: var(--text-light); }
.staff-tag {
  font-size: 0.66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--accent); color: var(--primary); padding: 2px 7px; border-radius: 999px;
}

.post-title {
  font-family: 'Playfair Display', serif; font-size: 1.42rem; font-weight: 700;
  color: var(--text); line-height: 1.28; margin-bottom: 12px; letter-spacing: -0.01em;
}
.post-card a.post-title:hover { color: var(--primary); }
.post-excerpt { color: var(--text-mid); font-size: 0.94rem; margin-bottom: 14px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.tag {
  font-size: 0.77rem; font-weight: 500; color: var(--primary);
  background: var(--accent); padding: 5px 12px; border-radius: 999px;
  transition: background .16s;
}
a.tag:hover { background: #dfd0b8; }

.post-meta {
  display: flex; align-items: center; gap: 20px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 0.83rem; color: var(--text-light); font-variant-numeric: tabular-nums;
}
.post-meta span, .post-meta button { display: inline-flex; align-items: center; gap: 6px; color: var(--text-light); font-size: 0.83rem; }
.post-meta button:hover { color: var(--primary); }
.post-meta button.is-liked { color: var(--gold); font-weight: 600; }
.post-meta .go { margin-left: auto; color: var(--primary); font-weight: 600; }

/* ── Pagination ─────────────────────────────────────── */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 34px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.88rem; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--text-mid);
}
.pager a:hover { background: var(--accent); color: var(--primary); }
.pager .is-current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .is-gap { border: none; background: none; }

/* ── Thread page ────────────────────────────────────── */
.breadcrumb { font-size: 0.82rem; color: var(--text-light); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 6px; opacity: .5; }

.thread { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow); }
.thread h1 {
  font-family: 'Playfair Display', serif; font-size: 2.05rem; font-weight: 800;
  color: var(--primary); line-height: 1.16; letter-spacing: -0.02em; margin-bottom: 14px;
}
.thread-body { margin-top: 20px; }
.thread-body p { color: var(--text-mid); margin-bottom: 16px; font-size: 1rem; }
.thread-body p:last-child { margin-bottom: 0; }
.thread-body strong { color: var(--text); font-weight: 600; }

.replies { margin-top: 34px; }
.replies h2 {
  font-family: 'Playfair Display', serif; font-size: 1.35rem; color: var(--primary);
  padding-bottom: 12px; border-bottom: 2px solid var(--accent); margin-bottom: 20px;
}
.reply {
  display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line-soft);
}
.reply:last-child { border-bottom: none; }
.reply img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.reply-main { flex: 1; min-width: 0; }
.reply-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 7px; }
.reply-body p { color: var(--text-mid); margin-bottom: 12px; font-size: 0.95rem; }
.reply-body p:last-child { margin-bottom: 0; }
.reply.is-staff { background: linear-gradient(180deg, #FFFBF5, #fff); border-radius: var(--radius); padding: 20px; border: 1px solid var(--accent); margin: 14px 0; }

/* ── Inline CTA ─────────────────────────────────────── */
.cta-band {
  background: linear-gradient(135deg, #3d1827 0%, var(--primary) 52%, #4a2033 100%);
  border-radius: var(--radius-lg); padding: 32px; color: #fff; margin: 26px 0;
}
.cta-band h3 { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; line-height: 1.25; }
.cta-band p { color: rgba(255, 255, 255, 0.82); font-size: 0.94rem; margin-bottom: 18px; }
.cta-feats { display: grid; gap: 8px; margin-bottom: 22px; }
.cta-feats li { list-style: none; display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: rgba(255, 255, 255, 0.9); }
.cta-feats li::before { content: '✓'; color: var(--gold); font-weight: 700; flex-shrink: 0; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.cta-actions .btn-white { background: #fff; color: var(--primary); }
.cta-actions .btn-white:hover { background: var(--accent); }
.cta-actions .btn-outline { border: 1.5px solid rgba(255, 255, 255, 0.5); color: #fff; }
.cta-actions .btn-outline:hover { background: rgba(255, 255, 255, 0.12); }

/* Sidebar CTA */
.side-cta { background: linear-gradient(150deg, var(--primary) 0%, #4a2033 100%); color: #fff; }
.side-cta .card-title { color: #fff; }
.side-cta p { font-size: 0.87rem; color: rgba(255, 255, 255, 0.82); margin-bottom: 16px; }
.side-cta .btn { margin-bottom: 8px; }
.side-cta-call { display: block; text-align: center; font-size: 0.88rem; font-weight: 600; color: var(--accent); }

/* ── Right rail lists ───────────────────────────────── */
.user-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.user-row:last-child { border-bottom: none; }
.user-row img { width: 38px; height: 38px; border-radius: 50%; }
.user-row .u-name { flex: 1; font-weight: 600; font-size: 0.88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .u-stat { display: inline-flex; align-items: center; gap: 4px; font-size: 0.79rem; color: var(--text-light); font-variant-numeric: tabular-nums; }

.topic-row { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.topic-row:last-child { border-bottom: none; }
.topic-row img { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.topic-row .t-title { font-size: 0.87rem; font-weight: 600; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-row:hover .t-title { color: var(--primary); }
.topic-row .t-meta { font-size: 0.75rem; color: var(--text-light); margin-top: 3px; }

/* ── Empty state ────────────────────────────────────── */
.empty { text-align: center; padding: 60px 24px; }
.empty h2 { font-family: 'Playfair Display', serif; color: var(--primary); font-size: 1.5rem; margin-bottom: 8px; }
.empty p { color: var(--text-mid); margin-bottom: 20px; }

/* ── Footer ─────────────────────────────────────────── */
.fx-footer { background: var(--primary-dark); color: rgba(255, 255, 255, 0.72); text-align: center; padding: 32px 24px; font-size: 0.85rem; }
.fx-footer a { color: var(--accent); }
.fx-footer a:hover { text-decoration: underline; }
.fx-footer .f-links { margin-bottom: 10px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

/* ── Mobile rail toggle ─────────────────────────────── */
.rail-toggle { display: none; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1180px) {
  .fx-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .fx-rail.rail-right { display: none; }
}
@media (max-width: 900px) {
  :root { --header-h: 64px; }
  .fx-shell { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 16px 56px; }
  .fx-rail { position: static; }
  .fx-rail.rail-left { order: 2; }
  .fx-feed { order: 1; }
  .fx-header-in { padding: 0 16px; gap: 12px; }
  .fx-search { display: none; }
  .fx-logo-text { display: none; }
  .feed-head h1 { font-size: 2rem; }
  .thread { padding: 24px 20px; }
  .thread h1 { font-size: 1.6rem; }
}
@media (max-width: 600px) {
  .btn { height: 42px; padding: 0 14px; font-size: 0.85rem; }
  .fx-header-actions { gap: 8px; }
  .feed-head h1 { font-size: 1.65rem; }
  .post-card { padding: 18px; }
  .post-title { font-size: 1.2rem; }
  .cta-band { padding: 24px 20px; }
  .cta-actions { flex-direction: column; }
  .cta-actions .btn { width: 100%; }
  .post-meta { gap: 14px; }
}
