/* =========================
   BRAND SYSTEM
========================= */
:root {
  --bg-main: #F9FAFB;
  --bg-header: #FFFFFF;
  --card-bg: #FFFFFF;

  --text-primary: #0F172A;
  --text-secondary: #64748B;

  --accent: #FF8000;
  --accent-soft: #FFF1E6;

  --border-light: rgba(15, 23, 42, 0.08);
}

/* =========================
   RESET
========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* =========================
   NAV
========================= */
.navbar{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.nav-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.nav-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-width: 48px;  /* ✅ IMPORTANT */
}

.nav-center{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Manrope', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(8px) saturate(1.2);
  background: rgba(255,255,255,0.7);
  z-index: -1;
}

.navbar img {
  width: 36px;
}

/* =========================
   MAIN
========================= */
main {
  max-width: 1100px;
  margin: auto;
  padding: 72px 24px;
}

/* =========================
   HERO
========================= */
.hero h1 {
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 720px;
  margin-bottom: 14px;
}

.hero p {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 640px;
}

/* =========================
   SEARCH
========================= */
.explore-box {
  margin: 32px 0 64px;
  max-width: 640px;
}

.explore {
  display: flex;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
}

.explore input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
}

.explore button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 18px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

/* =========================
   CARDS
========================= */
.cards {
  margin-top: 48px;
}

.cards h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.cards.hidden {
  display: none;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.trend-card.focus {
  background: linear-gradient(
    180deg,
    rgba(255,128,0,0.06),
    #ffffff 60%
  );
  border-color: rgba(255,128,0,0.25);
  box-shadow: 0 14px 40px rgba(255,128,0,0.12);
}

.trend-card {
  position: relative;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);

  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 20px;
  padding: 22px;

  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 12px 30px rgba(15,23,42,0.06);

  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.trend-card:hover .badge.up {
  background: #FFE5CC;
}

.trend-card::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 10%;
  width: 80%;
  height: 1px;
  background: rgba(0,0,0,0.03);
}

.trend-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 20px 48px rgba(15,23,42,0.12);
}

/* =========================
   SIGNAL THEMES (PREMIUM)
========================= */

.trend-card[data-signal]{
  border: 1px solid rgba(255,255,255,0.08);
}

.trend-card[data-signal] .trend-tag{
  font-weight: 800;
}

/* Exploding */
.trend-card[data-signal="Exploding"]{
  background:
    radial-gradient(800px circle at 20% -10%, rgba(255,128,0,0.22), transparent 45%),
    rgba(255,255,255,0.70);
  border: 1px solid rgba(255,128,0,0.25);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 24px 70px rgba(255,128,0,0.12);
}

.trend-card[data-signal="Exploding"] .trend-tag{
  color: #FF8000;
}

/* Accelerating */
.trend-card[data-signal="Accelerating"]{
  background:
    radial-gradient(800px circle at 20% -10%, rgba(0,153,255,0.18), transparent 45%),
    rgba(255,255,255,0.70);
  border: 1px solid rgba(0,153,255,0.18);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 24px 70px rgba(0,153,255,0.10);
}

.trend-card[data-signal="Accelerating"] .trend-tag{
  color: #2AA8FF;
}

/* Early */
.trend-card[data-signal="Early"]{
  background:
    radial-gradient(800px circle at 20% -10%, rgba(0,200,140,0.14), transparent 45%),
    rgba(255,255,255,0.70);
  border: 1px solid rgba(0,200,140,0.16);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 24px 70px rgba(0,200,140,0.08);
}

.trend-card[data-signal="Early"] .trend-tag{
  color: #12C48B;
}

/* Cooling */
.trend-card[data-signal="Cooling"]{
  background:
    radial-gradient(800px circle at 20% -10%, rgba(156,163,175,0.20), transparent 45%),
    rgba(255,255,255,0.66);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 16px 46px rgba(15,23,42,0.10);
}

.trend-card[data-signal="Cooling"] .trend-tag{
  color: #94A3B8;
}

.trend-card[data-signal="Exploding"] .badge.flat{
  border-color: rgba(255,128,0,0.22);
  background: rgba(255,128,0,0.10);
  color: rgba(255,128,0,0.95);
}

.trend-card[data-signal="Accelerating"] .badge.flat{
  border-color: rgba(0,153,255,0.20);
  background: rgba(0,153,255,0.10);
  color: rgba(0,153,255,0.95);
}

.trend-card[data-signal="Early"] .badge.flat{
  border-color: rgba(0,200,140,0.18);
  background: rgba(0,200,140,0.09);
  color: rgba(0,200,140,0.95);
}



.trend-card:hover .trend-title {
  transform: translateX(3px);
}

.trend-card:hover .source {
  opacity: 0.6;
}

.trend-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.trend-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.trend-foot {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* =========================
   SIGNAL ROW
========================= */
.signal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.8rem;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;

  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  border: 1px solid rgba(15,23,42,0.08);
  color: var(--text-secondary);

  font-size: 0.75rem;
  font-weight: 500;
}

.badge.up {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #FFD4B3;
}

@keyframes pulse {
  0% { opacity: 0.85; }
  50% { opacity: 1; }
  100% { opacity: 0.85; }
}

.badge.up {
  animation: pulse 3.5s ease-in-out infinite;
}

.badge.down { color: #B84A4A; }
.badge.flat { color: #6B7280; }

.strength {
  font-weight: 500;
}

.source {
  margin-left: auto;
  font-size: 0.7rem;
  color: #94A3B8;
}

/* =========================
   DIVE SECTION
========================= */
.dive {
  margin: 80px 0;
  padding: 48px 32px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(255,128,0,.08),
    rgba(255,128,0,.02)
  );
}

.dive p {
  max-width: 640px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dive a {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

/* =========================
   DETAIL PANEL BASE
========================= */
.detail-panel {
  position: fixed;
  left: 0;
  bottom: -100%;
  width: 100%;
  max-height: 90%;
  z-index: 1000;
  border-radius: 26px 26px 0 0;
  padding: 22px 22px 18px;
  transition: bottom 0.28s ease, transform 0.28s ease;
  overflow: hidden;

  /* glass layer */
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

/* Light mode panel */
html[data-theme="light"] .detail-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 -16px 50px rgba(15, 23, 42, 0.14);
  color: #0F172A;
}

/* Dark mode panel */
html[data-theme="dark"] .detail-panel {
  background: rgba(12, 14, 18, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

/* Active slide-up */
.detail-panel.active {
  bottom: 0;
}

/* =========================
   TOP HANDLE
========================= */
.detail-header {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  margin: 0 auto 14px;
  opacity: 0.9;
}

html[data-theme="light"] .detail-header {
  background: rgba(15, 23, 42, 0.18);
}

html[data-theme="dark"] .detail-header {
  background: rgba(255, 255, 255, 0.18);
}

/* =========================
   TITLE
========================= */
.detail-panel h3 {
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 8px 0 12px;
  letter-spacing: -0.01em;
}

html[data-theme="light"] .detail-panel h3 {
  color: #0F172A;
}

html[data-theme="dark"] .detail-panel h3 {
  color: rgba(255, 255, 255, 0.96);
}

/* =========================
   BODY TEXT
========================= */
.detail-panel p {
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 10px 0;
}

html[data-theme="light"] .detail-panel p {
  color: rgba(15, 23, 42, 0.72);
}

html[data-theme="dark"] .detail-panel p {
  color: rgba(255, 255, 255, 0.72);
}

/* =========================
   DETAIL METRICS
========================= */
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 8px;
}

.detail-metrics > div {
  border-radius: 14px;
  padding: 10px 12px;
}

html[data-theme="light"] .detail-metrics > div {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .detail-metrics > div {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.detail-metrics span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.72;
  margin-bottom: 3px;
}

.detail-metrics strong {
  font-size: 0.9rem;
}

/* =========================
   DETAIL META
========================= */
.detail-meta {
  margin-top: 18px;
  padding-top: 14px;
  font-size: 0.86rem;
  line-height: 1.7;
}

html[data-theme="light"] .detail-meta {
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  color: rgba(15, 23, 42, 0.68);
}

html[data-theme="dark"] .detail-meta {
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.66);
}

/* =========================
   DETAIL CONTENT TRANSITION
========================= */
.detail-panel .detail-content {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.22s ease;
}

.detail-panel.active .detail-content {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   CLOSE BUTTON
========================= */
.detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: rgba(255, 128, 0, 0.15);
  border: 1px solid rgba(255, 128, 0, 0.35);
  z-index: 1010;
}

.detail-close svg line {
  stroke: #FF7A00;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: transform 0.2s ease;
}

/* Hover animation */
.detail-close:hover {
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 4px 12px rgba(255, 120, 0, 0.35);
}

.detail-close:active {
  transform: scale(1) rotate(90deg);
  box-shadow: 0 2px 6px rgba(255, 120, 0, 0.25);
}

/* Mobile: metrics stack */
@media (max-width: 520px){
  .detail-metrics{
    grid-template-columns: 1fr;
  }
}

/* Ambient gradient layer */
.ambient-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      800px circle at 10% 20%,
      rgba(255,128,0,0.12),
      transparent 40%
    ),
    radial-gradient(
      600px circle at 90% 80%,
      rgba(255,128,0,0.08),
      transparent 40%
    );
  transition: background-position 0.2s ease-out;
  pointer-events: none;
}

.action-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;

  padding: 8px 14px;
  border-radius: 999px;

  background: linear-gradient(
    180deg,
    rgba(255,128,0,0.22),
    rgba(255,128,0,0.12)
  );

  border: 1px solid rgba(255,128,0,0.25);
}

.action-link:hover {
  background: linear-gradient(
    180deg,
    rgba(255,128,0,0.28),
    rgba(255,128,0,0.16)
  );
}

.action-btn {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(15,23,42,0.08);
  color: #0F172A;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.55;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.action-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.8);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;

  border-top: 1px solid rgba(15,23,42,0.06);
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.0),
    rgba(255,255,255,0.4)
  );
}

.trend-card:hover .card-actions{
  opacity:1;
  transform:translateY(0);
}

@media (max-width: 640px){
  .card-actions{
    opacity:1;
    transform:none;
  }
}

/* =========================
   THEME SYSTEM
========================= */

/* Default = light */
:root {
  --bg-main: #F9FAFB;
  --bg-header: rgba(255,255,255,0.72);
  --card-bg: rgba(255,255,255,0.72);

  --text-primary: #0F172A;
  --text-secondary: #64748B;

  --border-light: rgba(15, 23, 42, 0.08);

  --accent: #FF8000;
  --accent-soft: rgba(255,128,0,0.10);

  --shadow: 0 20px 48px rgba(15,23,42,0.12);
}

/* Dark mode overrides */
[data-theme="dark"] {
  --bg-main: #070A12;
  --bg-header: rgba(15,18,28,0.65);
  --card-bg: rgba(15,18,28,0.62);

  --text-primary: rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.58);

  --border-light: rgba(255,255,255,0.10);

  --accent: #FF8000;
  --accent-soft: rgba(255,128,0,0.12);

  --shadow: 0 24px 70px rgba(0,0,0,0.45);
}

/* Apply theme tokens */
body {
  background: var(--bg-main);
  color: var(--text-primary);
}

/* Navbar glass should react to theme */
.navbar::before {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
}

/* Cards react */
.trend-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
}

/* Badges react */
.badge {
  border: 1px solid var(--border-light);
}

/* =========================
   TOGGLE UI
========================= */
.theme-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor:pointer;
}

.theme-toggle{
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 12px 30px rgba(0,0,0,0.25);
}

html[data-theme="light"] .theme-toggle{
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 14px 30px rgba(15,23,42,0.10);
}

.theme-toggle .icon{
  width:18px;
  height:18px;
  opacity:0.65;
  transition: all .2s ease;
  color:#fff;

  /* makes icons feel “designed” not emoji-ish */
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

html[data-theme="light"] .theme-toggle{
  background: rgba(255,255,255,0.65);
  border:1px solid rgba(15,23,42,0.12);
}

html[data-theme="light"] .theme-toggle .icon{
  color:#0F172A;
}

html[data-theme="dark"] .theme-toggle .moon{
  opacity:1;
}

html[data-theme="light"] .theme-toggle .sun{
  opacity:1;
}

/* =========================
   DARK MODE CARD CLEANUP
========================= */
html[data-theme="dark"] .trend-card{
  background: rgba(20, 24, 32, 0.82);  /* less glass, more premium solid */
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 18px 50px rgba(0,0,0,0.55);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

/* dark mode card title */
html[data-theme="dark"] .trend-title{
  color: rgba(255,255,255,0.92);
}

html[data-theme="dark"] .source{
  color: rgba(255,255,255,0.35);
}

/* =========================
   Dark mode polish:
========================= */

html[data-theme="dark"] .badge{
  background: rgba(0,0,0,0.32) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  color: rgba(255,255,255,0.78) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset !important;
}

html[data-theme="dark"] .card-actions{
  background: rgba(0,0,0,0.26) !important;
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

html[data-theme="dark"] .action-btn{
  background: rgba(0,0,0,0.30) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  color: rgba(255,255,255,0.82) !important;
}

html[data-theme="dark"] .action-btn:hover{
  background: rgba(0,0,0,0.42) !important;
}

html[data-theme="dark"] .action-link{
  background: linear-gradient(
    180deg,
    rgba(255,128,0,0.18),
    rgba(255,128,0,0.08)
  ) !important;
  border: 1px solid rgba(255,128,0,0.30) !important;
  color: rgba(255,170,90,1) !important;
}

/* =========================
   Detail panel dark theme
========================= */

html[data-theme="dark"] .detail-panel{
  background: rgba(10,12,16,0.96) !important;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.65);
  color: rgba(255,255,255,0.88);
}

html[data-theme="dark"] .detail-panel h3{
  color: rgba(255,255,255,0.95) !important;
}

html[data-theme="dark"] .detail-panel p,
html[data-theme="dark"] .detail-panel .detail-meta{
  color: rgba(255,255,255,0.70) !important;
}

html[data-theme="dark"] .detail-header{
  background: rgba(255,255,255,0.20) !important;
}

html[data-theme="dark"] .detail-panel .detail-meta{
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

/* Remove heavy dark slab under actions (dark mode only) */
html[data-theme="dark"] .trend-card .card-actions{
  background: transparent !important;
  border-top: 1px solid rgba(255,255,255,0.06) !important;
  padding-top: 14px;
  margin-top: 16px;
}

/* Add subtle fade instead (very light, premium) */
html[data-theme="dark"] .trend-card .card-actions::before{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 60px;
  border-radius: 0 0 20px 20px;
  pointer-events: none;

  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0),
    rgba(0,0,0,0.18)
  );
}

/* Filter animation */
.card-grid.is-filtering {
  opacity: 0.55;
  transform: translateY(6px);
  transition: all .18s ease;
}

.card-grid {
  transition: all .18s ease;
}

.trend-card {
  animation: fadeInUp .22s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

