/* ============================================================================
   Dropp News — app.css
   Design system compartilhado (tokens + componentes). Fonte única de verdade.
   Refined neon: violeta (#7C5CFF) -> magenta (#F5576C) sobre quase-preto.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ----------------------------------------------------------------- Tokens */
:root {
  /* core palette */
  --bg: #07060B;
  --surface-0: #0C0A14;
  --surface-1: #131120;
  --surface-2: #1A1726;
  --accent: #7C5CFF;
  --accent-2: #F5576C;
  --accent-soft: #A78BFA;
  --gradient: linear-gradient(135deg, #7C5CFF 0%, #F5576C 100%);
  --gradient-bg: linear-gradient(135deg, #7C5CFF, #9B5CFF, #F5576C);

  /* text */
  --text-1: rgba(255, 255, 255, .95);
  --text-2: rgba(255, 255, 255, .70);
  --text-3: rgba(255, 255, 255, .45);
  --text-4: rgba(255, 255, 255, .30);

  /* glass */
  --glass-bg: rgba(255, 255, 255, .035);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-darker-bg: rgba(7, 6, 11, .55);
  --glass-darker-border: rgba(255, 255, 255, .10);
  --blur: 20px;
  --blur-strong: 30px;

  /* spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;

  /* radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
  --r-pill: 100px; --r-tag: 10px;

  /* type */
  --fs-xs: .6875rem; --fs-sm: .8125rem; --fs-base: .9375rem; --fs-md: 1rem;
  --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* shadows + contained glows */
  --shadow-1: 0 4px 12px rgba(0, 0, 0, .25);
  --shadow-2: 0 12px 28px rgba(0, 0, 0, .35);
  --shadow-card-hover: 0 16px 40px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .08);
  --glow-violet: 0 0 24px rgba(124, 92, 255, .35);
  --glow-magenta: 0 0 24px rgba(245, 87, 108, .30);
  --glow-focus: 0 0 0 3px rgba(124, 92, 255, .30);

  /* z-scale */
  --z-bg: 0; --z-base: 1; --z-sticky: 100; --z-progress: 150;
  --z-dropdown: 300; --z-overlay: 400; --z-modal: 500; --z-toast: 600;

  /* motion */
  --ease-spring: cubic-bezier(.175, .885, .32, 1.275);
  --ease-out: cubic-bezier(.25, .46, .45, .94);
}

/* per-category accent (CSS-only; backend não manda cor) */
[data-category="tech"]      { --cat: #5B8DEF; }
[data-category="crypto"]    { --cat: #F5A524; }
[data-category="gaming"]    { --cat: #A855F7; }
[data-category="auto"]      { --cat: #F472B6; }
[data-category="business"]  { --cat: #818CF8; }
[data-category="science"]   { --cat: #22D3EE; }
[data-category="politics"]  { --cat: #F75A68; }
[data-category="astronomy"] { --cat: #7C5CFF; }
[data-category="finances"]  { --cat: #34D399; }
[data-category="global"]    { --cat: #FB7185; }
[data-category="health"]    { --cat: #4ADE80; }
[data-category]             { --cat: var(--accent); } /* fallback declared first-wins via specificity below */

/* ----------------------------------------------------------------- Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }

::selection { background: rgba(124, 92, 255, .35); color: #fff; }

/* ------------------------------------------------------- Animated background */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 12% -5%, rgba(124, 92, 255, .16) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 95% 105%, rgba(245, 87, 108, .12) 0%, transparent 55%),
    var(--bg);
  animation: bgBreathe 40s ease-in-out infinite;
}
@keyframes bgBreathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: .82; }
}

/* ----------------------------------------------------------------- Glass */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
}
.glass-darker {
  background: var(--glass-darker-bg);
  -webkit-backdrop-filter: blur(var(--blur-strong));
  backdrop-filter: blur(var(--blur-strong));
  border: 1px solid var(--glass-darker-border);
}
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ----------------------------------------------------------------- Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(7, 6, 11, .72);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--glass-border);
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  max-width: 1100px;
  margin: 0 auto;
  padding: .7rem 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand__logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.brand__name { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; line-height: 1; }
.brand__name b { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand__sub { font-size: var(--fs-xs); color: var(--text-3); line-height: 1; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: .5rem; }

/* round glass icon button (back / home / search-mobile) */
.btn-icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-1);
  transition: background .2s, border-color .2s, transform .2s;
}
.btn-icon:hover { background: rgba(255, 255, 255, .08); border-color: rgba(124, 92, 255, .4); }
.btn-icon:active { transform: scale(.94); }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-base);
  transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 8px 24px rgba(124, 92, 255, .32);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(124, 92, 255, .5); transform: translateY(-2px); }
.btn-ghost {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text-1);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }

/* ----------------------------------------------------------------- Avatar */
.avatar { position: relative; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-fallback {
  position: absolute; inset: 0;
  display: none; /* revelado por JS quando a imagem falha */
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff; font-weight: 700;
  text-transform: uppercase;
}

/* ----------------------------------------------------------------- Tag */
.tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  font-size: var(--fs-xs); font-weight: 600;
  border-radius: var(--r-tag);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.tags-container { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .75rem; }

/* --------------------------------------------------- Category pills + badge */
.category-pills {
  display: flex; gap: .5rem;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -ms-overflow-style: none; scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }
.category-pill {
  flex-shrink: 0; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem;
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s, box-shadow .2s;
}
.category-pill:hover { color: var(--text-1); border-color: rgba(255, 255, 255, .2); }
.category-pill.active {
  color: var(--cat);
  border-color: color-mix(in srgb, var(--cat) 50%, transparent);
  background: color-mix(in srgb, var(--cat) 16%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--cat) 28%, transparent);
}
.category-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat) 30%, transparent);
}

/* ----------------------------------------------------------------- Card */
.card, .thread-card {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  overflow: hidden;
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s var(--ease-out);
}
.card::before, .thread-card::before {
  content: '';
  position: absolute; top: 0; left: -120%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .04), transparent);
  transition: left .7s var(--ease-out);
  pointer-events: none;
}
@media (hover: hover) {
  .card:hover, .thread-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(124, 92, 255, .3);
  }
  .card:hover::before, .thread-card:hover::before { left: 120%; }
}
.card:active, .thread-card:active { transform: scale(.985); }

.thread-title { color: var(--text-1); font-weight: 700; font-size: var(--fs-md); margin-bottom: .3rem; line-height: 1.35; }
.thread-content {
  color: var(--text-2);
  font-size: var(--fs-base);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.thread-content.clamp-4 {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* interaction buttons row */
.interaction-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .6rem;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-sm); font-weight: 500;
  transition: color .2s, background .2s;
}
.interaction-btn:hover { color: var(--text-1); background: rgba(255, 255, 255, .05); }
.interaction-btn.share:hover { color: var(--accent-2); }
.view-thread {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--accent-soft); font-size: var(--fs-sm); font-weight: 600;
  transition: gap .2s, color .2s;
}
.view-thread:hover { color: var(--accent); gap: .6rem; }

/* ----------------------------------------------------------------- Skeleton */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-1);
  border-radius: var(--r-md);
}
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, .12), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-line { height: 12px; border-radius: 6px; margin: 6px 0; }
.skeleton-image { width: 100%; aspect-ratio: 16/9; border-radius: var(--r-md); }

/* ----------------------------------------------- Lazy images (blur-up) */
.thread-image, .lazy-wrap {
  position: relative;
  margin-top: .9rem;
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(110deg, #0d0b14, #15121f);
  border: 1px solid var(--glass-border);
}
.lazy-skeleton {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4); font-size: 1.5rem;
}
.lazy-skeleton::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, .1), transparent);
  animation: shimmer 1.6s infinite;
}
.lazy-img {
  width: 100%; height: auto; display: block;
  object-fit: cover;
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.03);
  transition: opacity .5s ease, filter .5s ease, transform .5s ease;
}
.lazy-img.is-loaded { opacity: 1; filter: none; transform: none; }
.lazy-wrap[data-state="loaded"] .lazy-skeleton,
.thread-image[data-state="loaded"] .lazy-skeleton { opacity: 0; }

/* ----------------------------------------------------------------- Toast */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  z-index: var(--z-toast);
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1.2rem;
  border-radius: var(--r-md);
  background: rgba(7, 6, 11, .92);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-2);
  color: var(--text-1); font-size: var(--fs-base); font-weight: 500;
  opacity: 0; transform: translateY(20px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast i { color: var(--accent); }
@media (max-width: 640px) {
  .toast { left: 1rem; right: 1rem; bottom: 1rem; justify-content: center; }
}

/* ------------------------------------------------------- Reading progress */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  z-index: var(--z-progress);
  background: rgba(255, 255, 255, .06);
}
.reading-progress__bar {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--gradient);
  box-shadow: 0 0 12px rgba(124, 92, 255, .5);
}

/* ----------------------------------------------------- Author reference */
.author-reference {
  position: fixed;
  bottom: 1.25rem; left: 1.25rem;
  z-index: var(--z-dropdown);
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem;
  border-radius: var(--r-pill);
  background: rgba(7, 6, 11, .6);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  font-size: var(--fs-xs); color: var(--text-3);
}
.author-reference a { color: var(--accent-soft); font-weight: 600; }
.author-reference a:hover { color: var(--accent); }
.beating-heart { display: inline-block; color: var(--accent-2); animation: heartbeat 2s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 10%, 30% { transform: scale(1.15); } 20% { transform: scale(1.05); } }
@media (max-width: 640px) {
  .author-reference { bottom: 1rem; left: 1rem; max-width: calc(100% - 2rem); }
}

/* ----------------------------------------------------------------- Search */
.search-desktop { position: relative; display: none; align-items: center; }
.search-mobile-btn { display: inline-flex; }
@media (min-width: 641px) {
  .search-desktop { display: flex; }
  .search-mobile-btn { display: none; }
}
.search-input {
  width: 0; opacity: 0; padding: 0;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-1); font-size: var(--fs-base);
  transition: width .3s var(--ease-out), opacity .3s, padding .3s;
}
.search-input.active { width: 240px; opacity: 1; padding: 0 1rem; }
.search-input:focus { outline: none; border-color: rgba(124, 92, 255, .5); box-shadow: var(--glow-focus); }
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-height: 60vh; overflow-y: auto;
  z-index: var(--z-dropdown);
  border-radius: var(--r-lg);
  background: rgba(7, 6, 11, .95);
  -webkit-backdrop-filter: blur(var(--blur-strong));
  backdrop-filter: blur(var(--blur-strong));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-2);
  display: none;
}
.search-results.show { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  transition: background .2s;
}
.search-result-item:hover { background: rgba(124, 92, 255, .1); }
.search-result-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.search-result-title { font-size: var(--fs-base); color: var(--text-1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.search-hint, .search-no-results, .search-loading { padding: .9rem; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }

/* mobile search overlay */
.mobile-search-overlay {
  position: fixed; inset: 0;
  z-index: var(--z-overlay);
  background: rgba(7, 6, 11, .96);
  -webkit-backdrop-filter: blur(var(--blur-strong));
  backdrop-filter: blur(var(--blur-strong));
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.mobile-search-overlay.show { opacity: 1; visibility: visible; }
.mobile-search-container { padding: 1rem; display: flex; align-items: center; gap: .6rem; }
.mobile-search-input {
  flex: 1; height: 46px; padding: 0 1rem;
  border-radius: var(--r-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-1); font-size: 16px;
}
.mobile-search-input:focus { outline: none; border-color: rgba(124, 92, 255, .5); box-shadow: var(--glow-focus); }
.mobile-search-close {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
}
.mobile-results { margin: 0 1rem; border-radius: var(--r-lg); overflow: hidden; background: var(--glass-bg); border: 1px solid var(--glass-border); display: none; }
.mobile-results.show { display: block; }

/* ----------------------------------------------------------------- Stories */
.stories-section { padding: 1rem 1rem .5rem; }
.section-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.section-bar { width: 4px; height: 26px; border-radius: var(--r-pill); background: var(--gradient); }
.section-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }
.section-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700;
}
.section-badge.live { color: #4ADE80; background: rgba(74, 222, 128, .14); border: 1px solid rgba(74, 222, 128, .3); }
.section-badge.live .dot { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.stories-container {
  display: flex; flex-wrap: nowrap; gap: .75rem;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  padding: .25rem 2px .75rem;
  -ms-overflow-style: none; scrollbar-width: none;
}
.stories-container::-webkit-scrollbar { display: none; }
.story-card { position: relative; flex: 0 0 auto; scroll-snap-align: start; width: 5.2rem; text-align: center; transition: transform .3s var(--ease-spring); }
@media (hover: hover) { .story-card:hover { transform: translateY(-4px); } }
.story-card:active { transform: scale(.95); }
.story-ring {
  position: relative;
  width: 5rem; height: 5rem; margin: 0 auto;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--gradient-bg);
  box-shadow: var(--glow-violet);
}
.story-ring.viewed { background: rgba(255, 255, 255, .14); box-shadow: none; }
.story-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2.5px solid var(--bg);
  position: relative; overflow: hidden;
}
.story-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.story-name { margin-top: .5rem; font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiple-stories-indicator {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--gradient);
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
@media (max-width: 480px) {
  .story-card { width: 4.4rem; }
  .story-ring { width: 4rem; height: 4rem; }
}

/* ----------------------------------------------------------------- Tabs */
.tab-button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .9rem;
  border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 600;
  transition: color .2s, background .2s, box-shadow .2s, border-color .2s;
}
.tab-button:hover { color: var(--text-1); }
.tab-button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 92, 255, .25), rgba(245, 87, 108, .25));
  border-color: rgba(124, 92, 255, .4);
  box-shadow: var(--glow-violet);
}

/* ----------------------------------------------------------- Banners */
.banners-carousel-container { position: relative; padding: 1rem 1rem 0; }
.banners-carousel { position: relative; border-radius: var(--r-lg); overflow: hidden; max-width: 1100px; margin: 0 auto; }
.banner-slide { position: relative; display: none; height: 220px; }
.banner-slide.active { display: block; }
@media (min-width: 768px) { .banner-slide { height: 300px; } }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1.25rem;
  background: linear-gradient(to top, rgba(7, 6, 11, .92) 0%, rgba(7, 6, 11, .15) 60%, transparent 100%);
}
.banner-category {
  align-self: flex-start;
  padding: .2rem .6rem; margin-bottom: .5rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-soft);
  background: linear-gradient(135deg, rgba(124, 92, 255, .2), rgba(245, 87, 108, .2));
  border: 1px solid rgba(124, 92, 255, .3);
}
.banner-title {
  color: #fff; font-weight: 800; font-size: 1.25rem; line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.carousel-indicators { position: absolute; top: .75rem; right: .75rem; display: flex; gap: 6px; z-index: 2; }
.carousel-indicators .indicator { width: 6px; height: 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .3); transition: width .3s, background .3s; cursor: pointer; }
.carousel-indicators .indicator.active { width: 20px; background: var(--gradient); }

/* ----------------------------------------------------------- Empty / states */
.feed-state, .state { text-align: center; padding: 3rem 1rem; color: var(--text-3); }
.state__icon {
  width: 72px; height: 72px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 92, 255, .18), rgba(245, 87, 108, .12));
  border: 1px solid rgba(124, 92, 255, .25);
  color: var(--accent-soft); font-size: 1.6rem;
}
.state__title { color: var(--text-1); font-size: var(--fs-lg); font-weight: 700; }
.state__sub { margin-top: .35rem; font-size: var(--fs-sm); }
.pill-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1.2rem; }
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500;
  transition: background .2s, border-color .2s, color .2s;
}
.pill:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: rgba(124, 92, 255, .4); color: var(--text-1); }

/* search highlight */
mark, .highlight { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; border-radius: 4px; padding: 0 3px; font-weight: 600; }

/* ----------------------------------------------------- Home modals */
body.modal-open, body.thread-modal-open { position: fixed; width: 100%; overflow: hidden; }
#storyModal, #threadModal { z-index: var(--z-modal); } /* acima do header (--z-sticky) */

/* Story modal */
.story-modal-wrapper { width: 100%; max-width: 26rem; height: 100%; max-height: 92vh; margin: auto; display: flex; }
.story-modal-content {
  position: relative; flex: 1;
  border-radius: var(--r-xl); overflow: hidden;
  background: var(--surface-1); background-size: cover; background-position: center; background-repeat: no-repeat;
}
.story-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 30%, transparent 55%, rgba(0,0,0,.85));
}
.story-progress { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; }
.story-progress-bar { height: 100%; width: 0; background: var(--gradient); border-radius: 3px; }
.story-progress-bar.complete { width: 100%; }
.story-progress-bar.animate { animation: fillProgress 5s linear forwards; }
@keyframes fillProgress { from { width: 0; } to { width: 100%; } }
.story-cta { position: absolute; bottom: 4.5rem; left: 0; right: 0; display: flex; justify-content: center; z-index: 10; }
.story-cta-button {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.4rem; border-radius: var(--r-pill);
  background: var(--gradient); color: #fff; font-weight: 600;
  box-shadow: var(--glow-violet);
}
@media (max-width: 640px) {
  .story-modal-wrapper { max-width: 100%; max-height: none; height: 100dvh; }
  .story-modal-content { border-radius: 0; }
}

/* Thread modal */
.thread-modal-wrapper {
  width: 100%; max-width: 40rem; margin: 2rem auto;
  max-height: calc(100vh - 4rem);
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg); overflow: hidden;
}
.thread-modal-header {
  position: sticky; top: 0; z-index: 2;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(7,6,11,.85);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
}
.thread-modal-body { padding: 1.25rem; overflow-y: auto; }
.thread-post { position: relative; }
.thread-post .thread-connector { left: 1.45rem; top: 3rem; bottom: -1.25rem; }
@media (max-width: 640px) {
  .thread-modal-wrapper { max-width: 100%; margin: 0; height: 100dvh; max-height: none; border-radius: 0; }
}

/* ----------------------------------------------------------- Thread page */
.thread-wrap { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem; }
.thread-header-info {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.thread-header-info::before {
  content: ''; position: absolute; top: 0; left: 1.5rem; right: 1.5rem; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .45;
}
.thread-post-card {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  transition: border-color .3s, background .3s;
}
@media (hover: hover) {
  .thread-post-card:hover { border-color: var(--glass-border); background: rgba(255, 255, 255, .045); }
}
.thread-connector {
  position: absolute; left: 2.75rem; top: 4rem; bottom: -1rem;
  width: 2px; z-index: 0;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent-2) 35%, transparent) 70%, transparent);
  opacity: .55;
}
.thread-connector::before {
  content: ''; position: absolute; top: -3px; left: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--glow-violet);
}
.post-body {
  color: var(--text-1); font-size: 1.0625rem; line-height: 1.7;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  letter-spacing: -.005em; max-width: 68ch;
}
.thread-post-card:first-child .post-body { font-size: 1.125rem; }
.post-image-container { margin-top: .9rem; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--glass-border); }
.scroll-top-btn {
  position: fixed; right: 1.5rem; bottom: 5rem;
  z-index: var(--z-dropdown);
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(124, 92, 255, .4);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .3s, transform .3s, visibility .3s;
}
.scroll-top-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 40px rgba(124, 92, 255, .6); }
.scroll-top-btn.visible { opacity: 1; visibility: visible; transform: none; }
.related-section-title { font-size: var(--fs-xl); font-weight: 800; }
@media (max-width: 640px) {
  .thread-header-info { padding: 1.25rem; }
  .thread-connector { left: 2.25rem; top: 3.5rem; }
  .post-body { font-size: .9375rem; line-height: 1.6; }
  .thread-post-card:first-child .post-body { font-size: 1.0625rem; }
  .scroll-top-btn { right: 1rem; bottom: 4.5rem; width: 2.6rem; height: 2.6rem; }
}

/* ----------------------------------------------------------- Search page */
.search-box { position: relative; max-width: 620px; margin: 0 auto; }
.search-box__input {
  width: 100%; height: 52px;
  padding: 0 52px 0 44px;
  border-radius: var(--r-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-1); font-size: 16px;
}
.search-box__input::placeholder { color: var(--text-3); }
.search-box__input:focus { outline: none; border-color: rgba(124, 92, 255, .5); box-shadow: var(--glow-focus); }
.search-box__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box__submit {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--gradient); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
}
.search-box__submit:active { transform: translateY(-50%) scale(.95); }
.results-header { max-width: 700px; margin: 1.5rem auto .75rem; }
.results-count { font-weight: 700; color: var(--text-1); font-size: var(--fs-md); }
.results-subtitle { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.results-list { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: .9rem; }
.reveal { animation: slideInUp .45s var(--ease-out) both; }
.reveal:nth-child(1) { animation-delay: 0s; }
.reveal:nth-child(2) { animation-delay: .05s; }
.reveal:nth-child(3) { animation-delay: .1s; }
.reveal:nth-child(4) { animation-delay: .15s; }
.reveal:nth-child(5) { animation-delay: .2s; }
.reveal:nth-child(6) { animation-delay: .25s; }
.reveal:nth-child(7) { animation-delay: .3s; }
.reveal:nth-child(n+8) { animation-delay: .35s; }

/* ----------------------------------------------------------- 404 page */
.glass-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
@media (hover: hover) {
  .glass-card.interactive:hover { transform: translateY(-3px); border-color: rgba(124, 92, 255, .25); box-shadow: var(--shadow-card-hover); }
}
.error-orb {
  width: 96px; height: 96px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, .3), transparent 70%);
  border: 1px solid rgba(124, 92, 255, .3);
  color: var(--accent); font-size: 2.25rem;
  box-shadow: var(--glow-violet);
}
.glitch-404 {
  font-size: 5rem; font-weight: 900; line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(124, 92, 255, .4));
  animation: pulseGlow 2.6s ease-in-out infinite alternate;
}
@keyframes pulseGlow {
  from { filter: drop-shadow(0 0 16px rgba(124, 92, 255, .35)); }
  to   { filter: drop-shadow(0 0 34px rgba(124, 92, 255, .6)); }
}
.suggest-icon {
  width: 48px; height: 48px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff; font-size: 1.1rem;
}
@media (min-width: 640px) {
  .error-orb { width: 128px; height: 128px; font-size: 3rem; }
  .glitch-404 { font-size: 8rem; }
}

/* ----------------------------------------------------------- Utilities */
.page { position: relative; z-index: var(--z-base); min-height: 60vh; }
.container-page { max-width: 1100px; margin: 0 auto; }
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(124, 92, 255, .35); border-radius: 3px; }
.slide-in-up { animation: slideInUp .5s var(--ease-out) both; }
@keyframes slideInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.float-anim { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ----------------------------------------------------------- Mobile refinements */
html { scroll-padding-top: 76px; } /* âncoras não ficam escondidas atrás do header sticky */
@media (max-width: 640px) {
  .card, .thread-card { padding: 1rem; border-radius: var(--r-md); }
  .section-title { font-size: 1.2rem; }
  .stories-section { padding: .75rem .75rem .25rem; }
  .header-container { padding: .6rem .875rem; gap: .5rem; }
  .brand__logo { width: 30px; height: 30px; }
  .brand__name { font-size: .95rem; }
  .banners-carousel-container { padding: .75rem .75rem 0; }
  .tab-button { padding: .4rem .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .animated-bg { animation: none; }
}
