/*
Theme Name: Sarauta
Theme URI: https://example.com/sarauta
Author: Sarauta
Description: Editorial theme for Sarauta — culture, business, sport, and the conversations that matter. Editors publish; readers comment, follow, and discuss. Pair with BuddyPress for profiles and following, and the Sarauta Engagement plugin for Power scores, tiers, and stories.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: sarauta
*/

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  --paper: #FBF6EC;
  --paper-2: #F5EEDE;
  --paper-3: #EDE4CE;
  --ink: #12100F;
  --ink-soft: #3A3532;
  --ink-muted: #6A6259;
  --muted: #8A817A;
  --rule: #E8DFD1;
  --rule-2: #D9CFB8;

  --terracotta: #C64C1E;
  --terracotta-2: #8B2E10;
  --gold: #C9821A;
  --forest: #2D5A3D;
  --midnight: #1E2A44;
  --clay: #7A2723;
  --link: #1E4A7A;
}

/* Category accent colors - used on badges and section icons */
.cat-politics, .badge-politics { background: #1E3A5F; }
.cat-culture, .badge-culture { background: #7A2723; }
.cat-music, .badge-music { background: #4F46E5; }
.cat-sport, .badge-sport { background: #0D9488; }
.cat-business, .badge-business { background: #334155; }
.cat-tech, .badge-tech { background: #1E4A7A; }
.cat-news, .badge-news { background: #B91C1C; }
.cat-movies, .badge-movies { background: #EA580C; }
.cat-food, .badge-food { background: var(--gold); }
.cat-football, .badge-football { background: #15803D; }
.cat-romance, .badge-romance { background: #A82256; }
.cat-jobs, .badge-jobs { background: #7A2FBD; }
.cat-fashion, .badge-fashion { background: #A21CAF; }
.cat-history, .badge-history { background: #8B5A2B; }
.cat-family, .badge-family { background: #6B8E23; }

/* ==========================================================================
   RESET + BASE
   ========================================================================== */
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 0;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.site-wrap { min-height: 100vh; }
.main-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 32px 32px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}
.main-content { min-width: 0; }
.sidebar { min-width: 0; }

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.header-top { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.header-top-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.brand {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "SOFT" 80, "opsz" 32;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand em { font-style: italic; color: var(--terracotta); font-weight: 700; }
.brand-mark {
  width: 30px; height: 30px;
  background: var(--terracotta);
  color: var(--paper);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  font-family: 'Fraunces', serif; font-style: italic;
}
.header-search { flex: 1; max-width: 420px; position: relative; }
.header-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  border-radius: 100px;
  font-family: inherit; font-size: 14px; color: var(--ink);
  outline: none;
  transition: all 0.15s;
}
.header-search input:focus { border-color: var(--terracotta); background: var(--paper); }
.header-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted);
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-btn {
  background: transparent;
  border: 1px solid var(--rule);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all 0.15s;
}
.header-btn:hover { border-color: var(--ink); }
.header-bell {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.header-bell svg { width: 18px; height: 18px; }
.header-bell[data-soon]::after {
  content: 'soon';
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: var(--paper); padding: 0 4px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--terracotta));
  color: var(--paper);
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; font-style: italic;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.login-link {
  padding: 8px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

/* Category nav */
.category-nav { padding: 12px 0; overflow-x: auto; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-nav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.nav-link {
  padding: 8px 14px; border-radius: 100px;
  font-size: 13px; color: var(--ink-soft); font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--paper-2); }
.nav-link.active { background: var(--ink); color: var(--paper); }

/* ==========================================================================
   FEED HEADER
   ========================================================================== */
.feed-top { padding: 8px 0; }
.feed-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.feed-title-line {
  font-family: 'Fraunces', serif;
  font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "SOFT" 80, "opsz" 32;
  margin-top: 2px;
}
.feed-title-line em { font-style: italic; opacity: 0.7; }

/* ==========================================================================
   POST / THREAD CARDS (feed + archive)
   ========================================================================== */
.thread-list {
  max-width: 680px;
  border: 1px solid var(--rule);
  border-bottom: 0;
  background: var(--paper);
}
.thread-row {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 0 12px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s;
}
.thread-row:hover { background: var(--paper-2); }
.thread-avatar {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  color: var(--paper);
  background: var(--midnight);
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 15px;
  text-transform: uppercase;
  overflow: hidden;
}
.thread-avatar img { width: 100%; height: 100%; object-fit: cover; }
.thread-content { display: flex; flex-direction: column; min-width: 0; }
.thread-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin: 0 0 5px;
  font-size: 11px; color: var(--muted);
}
.thread-meta .author { color: var(--ink); font-size: 13px; font-weight: 700; }
.thread-meta .dot { color: var(--muted); }
.category-badge {
  padding: 1px 8px; border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--paper);
}
.editor-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 600;
  background: var(--midnight); color: var(--paper);
}
.thread-title {
  font-family: 'Fraunces', serif;
  font-size: 17px; line-height: 1.3;
  margin: 0 0 6px;
  color: var(--ink);
}
.thread-row:hover .thread-title { color: var(--terracotta); }
.thread-preview {
  font-size: 14px; line-height: 1.5; color: var(--ink-muted);
  margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.thread-image {
  width: 100%; aspect-ratio: 16/9;
  margin: 2px 0 8px;
  border: 1px solid var(--rule); border-radius: 8px;
  overflow: hidden; background: var(--paper-3);
}
.thread-image img { width: 100%; height: 100%; object-fit: cover; }
.thread-stats {
  display: flex; align-items: center; gap: 16px;
  min-height: 34px; font-size: 12px; color: var(--muted);
}
.thread-stats a { display: inline-flex; align-items: center; gap: 5px; }
.thread-stats svg { width: 14px; height: 14px; }

/* ==========================================================================
   SINGLE POST ("THREAD") VIEW
   ========================================================================== */
.breadcrumb {
  font-size: 12px; color: var(--muted);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb a:hover { color: var(--terracotta); }
.breadcrumb .sep { color: var(--rule-2); }

.thread-main {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}
.thread-main-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.thread-main-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #C7A063, #7A4919);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 17px; font-style: italic;
  overflow: hidden;
}
.thread-main-avatar img { width: 100%; height: 100%; object-fit: cover; }
.thread-main-user { flex: 1; }
.thread-main-user .name { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.thread-main-user .meta-line { font-size: 12px; color: var(--muted); margin-top: 2px; }

.thread-main-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 500; line-height: 1.15; letter-spacing: -0.02em;
  margin: 12px 0 18px;
  color: var(--ink);
}
.thread-hero-image {
  width: 100%; max-height: 420px; object-fit: cover;
  margin: 0 0 20px; border-radius: 8px;
}
.thread-main-body {
  font-family: 'Source Serif 4', serif;
  font-size: 17px; line-height: 1.65; color: var(--ink);
}
.thread-main-body p { margin-bottom: 1.2em; }
.thread-main-body a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.thread-main-body h2, .thread-main-body h3 { font-family: 'Fraunces', serif; margin: 1.5em 0 0.5em; }
.thread-main-body blockquote {
  border-left: 3px solid var(--terracotta);
  margin: 1.5em 0; padding-left: 20px;
  font-style: italic; color: var(--ink-soft);
}

.related-post {
  margin: 28px 0 0;
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  overflow: hidden;
}
.related-post-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px 0;
}
.related-post-body { display: flex; gap: 12px; padding: 8px 14px 14px; align-items: center; }
.related-post-thumb {
  width: 80px; height: 60px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden; background: var(--paper-3);
}
.related-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-post-title { font-family: 'Fraunces', serif; font-size: 14px; line-height: 1.3; color: var(--ink); }
.related-post:hover .related-post-title { color: var(--terracotta); }

/* ==========================================================================
   COMMENTS ("DISCUSSION")
   ========================================================================== */
.comments-section { max-width: 820px; }
.comments-heading {
  font-family: 'Fraunces', serif; font-size: 18px; font-weight: 500;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 10px;
}
.comments-count { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); font-weight: 500; }

.comment-reply-form {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
.comment-reply-form textarea {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: 'Source Serif 4', serif; font-size: 15px;
  resize: vertical; min-height: 80px; outline: none;
}
.comment-reply-form textarea:focus { border-color: var(--terracotta); }
.comment-reply-form input[type="submit"] {
  padding: 8px 18px;
  background: var(--terracotta); color: var(--paper);
  border: none; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  margin-top: 10px;
}

ul.comment-list, .children { list-style: none; margin: 0; padding: 0; }
.comment-item { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.comment-item .children { margin-left: 42px; }
.comment-header-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #3B82F6, #1E40AF);
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.comment-date { font-size: 11px; color: var(--muted); }
.comment-body-text { font-family: 'Source Serif 4', serif; font-size: 15px; line-height: 1.55; color: var(--ink-soft); padding-left: 42px; margin-bottom: 8px; }
.comment-actions { display: flex; gap: 14px; padding-left: 42px; }
.comment-actions a { font-size: 12px; color: var(--muted); font-weight: 500; }
.comment-actions a:hover { color: var(--terracotta); }

/* User tier badges - rendered only when the Sarauta Engagement plugin is active */
.user-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 600; vertical-align: 1px;
}
.user-tag.fan { background: rgba(45,90,61,0.10); color: var(--forest); border: 1px solid rgba(45,90,61,0.25); }
.user-tag.topfan { background: rgba(198,76,30,0.10); color: var(--terracotta-2); border: 1px solid rgba(198,76,30,0.28); }
.user-tag.superfan { background: var(--gold); color: var(--paper); }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar-block {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}
.sb-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.sb-item {
  padding: 8px 0; border-bottom: 1px solid var(--rule);
  display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: baseline;
}
.sb-item:last-child { border-bottom: none; padding-bottom: 0; }
.sb-item:hover .sb-item-title { color: var(--terracotta); }
.sb-rank { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; color: var(--muted); }
.sb-item-title { font-size: 13px; color: var(--ink); line-height: 1.3; font-weight: 500; }
.sb-item-meta { font-size: 10px; color: var(--muted); }

.sections-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.section-chip {
  padding: 8px 10px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 8px;
  font-size: 12px; color: var(--ink); font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
  transition: all 0.15s;
}
.section-chip:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.section-chip .count { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); }
.section-chip:hover .count { color: rgba(255,255,255,0.6); }

.sb-newsletter { background: var(--ink); color: var(--paper); padding: 24px; border-radius: 12px; text-align: center; }
.sb-newsletter .sb-title { color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.1); }
.sb-newsletter h3 { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 400; margin-bottom: 8px; }
.sb-newsletter h3 em { font-style: italic; color: var(--terracotta); }
.sb-newsletter p { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 16px; }
.sb-newsletter input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px; color: var(--paper); font-size: 13px; outline: none;
  margin-bottom: 8px; text-align: center;
}
.sb-newsletter button {
  width: 100%; padding: 10px;
  background: var(--terracotta); color: var(--paper);
  border: none; border-radius: 100px; font-size: 13px; font-weight: 600;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 500;
}
.mobile-bottom-nav-inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 420px; margin: 0 auto;
}
.bottom-nav-item {
  background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; color: var(--muted);
  min-height: 52px; justify-content: center;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item .lbl { font-size: 10px; font-weight: 500; }
.bottom-nav-item.active, .bottom-nav-item[aria-current="page"] { color: var(--terracotta); }
.bottom-nav-item[data-soon] { opacity: 0.45; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { border-top: 1px solid var(--rule); padding: 40px 32px 30px; background: var(--paper-2); margin-top: 60px; }
.footer-inner { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-col h4 { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.footer-col a { display: block; font-size: 13px; color: var(--ink-soft); padding: 4px 0; }
.footer-col a:hover { color: var(--terracotta); }
.footer-tag { font-family: 'Source Serif 4', serif; font-style: italic; color: var(--ink-muted); font-size: 13px; max-width: 280px; }
.footer-bottom { max-width: 1400px; margin: 0 auto; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ==========================================================================
   404 / EMPTY STATES
   ========================================================================== */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state h1 { font-family: 'Fraunces', serif; font-size: 28px; color: var(--ink); margin-bottom: 12px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .main-wrap { grid-template-columns: 1fr; padding: 10px 20px 90px; }
  .sidebar { width: 100%; }
  .header-search { display: none; }
  .mobile-bottom-nav { display: block; }
}
@media (max-width: 600px) {
  .header-top-inner { padding: 0 16px; gap: 12px; }
  .category-nav-inner { padding: 0 16px; }
  .brand { font-size: 22px; }
  .thread-row { grid-template-columns: 40px minmax(0,1fr); padding: 14px 16px 9px; }
  .thread-main { padding: 20px 16px; }
  .thread-main-title { font-size: 22px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 20px; }
}
