/* ═══════════════════════════════════════════════════════════
   Research Journal Rank — app shell + homepage (v1, Dec 2026)
   ═══════════════════════════════════════════════════════════ */
:root {
  --rj-navy: #0f2b46;
  --rj-navy2: #163d63;
  --rj-blue: #1464a0;
  --rj-blue2: #1d7fc4;
  --rj-ink: #0f172a;
  --rj-text: #334155;
  --rj-muted: #64748b;
  --rj-line: #e5e9f0;
  --rj-bg: #f4f7fb;
  --rj-card: #ffffff;
  --rj-green: #16a34a;
  --rj-amber: #f59e0b;
  --rj-radius: 14px;
  --rj-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --rj-shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
}
body { font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

/* ── Mobile bottom navigation (app shell) ───────────────── */
.rj-bnav { display: none; }
@media (max-width: 768px) {
  .rj-bnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
    background: rgba(255, 255, 255, .97); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--rj-line); box-shadow: 0 -4px 18px rgba(15, 23, 42, .06);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: flex-end;
  }
  .rj-bnav a, .rj-bnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
    min-height: 52px; padding: 4px 0; background: none; border: 0; font: inherit;
    font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: #6b7a90; text-decoration: none; cursor: pointer;
  }
  .rj-bnav i { font-size: 19px; line-height: 1; }
  .rj-bnav .active { color: var(--rj-blue); }
  .rj-bnav .rj-bnav-cta i {
    width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--rj-blue2), var(--rj-navy)); color: #fff; font-size: 20px;
    border: 4px solid #fff; box-shadow: 0 8px 18px rgba(20, 100, 160, .35);
  }
  .rj-bnav .rj-bnav-cta { color: var(--rj-navy); }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .top-bar { display: none; }
  .compare-bar { bottom: calc(62px + env(safe-area-inset-bottom)) !important; }
  .back-to-top, .whatsapp-fab { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* ── Homepage ───────────────────────────────────────────── */
.hv2-wrap { background: var(--rj-bg); }
.hv2-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Hero */
.hv2-hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(46, 204, 113, .18), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(29, 127, 196, .35), transparent 60%),
    linear-gradient(135deg, #0b2239 0%, var(--rj-navy) 45%, #12487a 100%);
  padding: 56px 0 64px;
}
.hv2-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 42px 42px; mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hv2-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.35fr .9fr; gap: 40px; align-items: center; }
.hv2-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: 12.5px; font-weight: 600; color: #dbeafe;
}
.hv2-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .2); }
.hv2-hero h1 { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; margin: 16px 0 12px; color: #fff; }
.hv2-hero h1 span { background: linear-gradient(90deg, #7dd3fc, #86efac); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hv2-hero p.lead { font-size: 17px; line-height: 1.6; color: #c7d7ea; max-width: 620px; margin: 0 0 24px; }
.hv2-search {
  display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 16px; padding: 7px 7px 7px 16px;
  box-shadow: 0 18px 40px rgba(2, 12, 27, .35); max-width: 640px;
}
.hv2-search i { color: #94a3b8; font-size: 17px; }
.hv2-search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 16px; color: var(--rj-ink); background: transparent; padding: 10px 4px; }
.hv2-search button {
  border: 0; border-radius: 11px; padding: 12px 22px; font: inherit; font-weight: 700; font-size: 15px; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--rj-blue2), var(--rj-blue)); box-shadow: 0 6px 14px rgba(20, 100, 160, .35);
}
.hv2-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hv2-chips span { font-size: 13px; color: #9fb4cc; align-self: center; margin-right: 2px; }
.hv2-chips a {
  font-size: 13px; font-weight: 600; color: #e2ecf7; text-decoration: none; padding: 7px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); transition: background .15s, transform .15s; white-space: nowrap;
}
.hv2-chips a:hover { background: rgba(255, 255, 255, .18); transform: translateY(-1px); }
.hv2-stats {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); border-radius: 20px; padding: 22px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.hv2-stat { background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 16px; }
.hv2-stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.hv2-stat small { display: block; margin-top: 4px; font-size: 12.5px; color: #a9bfd6; font-weight: 500; }
.hv2-stat i { color: #7dd3fc; font-size: 15px; margin-bottom: 8px; display: block; }
.hv2-stats-note { grid-column: 1 / -1; font-size: 12px; color: #9fb4cc; display: flex; gap: 6px; align-items: center; }
.hv2-stats-note i { color: #34d399; }

/* Compact hero (filtered / paginated views) */
.hv2-hero.compact { padding: 30px 0 34px; }
.hv2-hero.compact .hv2-hero-grid { grid-template-columns: 1fr; }
.hv2-hero.compact h1 { font-size: clamp(24px, 3vw, 34px); margin: 10px 0 14px; }

/* Sections */
.hv2-section { padding: 40px 0 8px; }
.hv2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hv2-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; color: var(--rj-ink); margin: 0; }
.hv2-head p { margin: 4px 0 0; color: var(--rj-muted); font-size: 14.5px; }
.hv2-head a { font-size: 14px; font-weight: 700; color: var(--rj-blue); text-decoration: none; white-space: nowrap; }

/* Tools grid */
.hv2-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hv2-tool {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--rj-card); border: 1px solid var(--rj-line);
  border-radius: var(--rj-radius); text-decoration: none; box-shadow: var(--rj-shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hv2-tool:hover { transform: translateY(-2px); box-shadow: var(--rj-shadow-lg); border-color: #cfdbe8; }
.hv2-ico {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff; background: linear-gradient(135deg, var(--c1, #1d7fc4), var(--c2, #0f2b46));
}
.hv2-tool b { display: block; font-size: 15px; color: var(--rj-ink); margin-bottom: 3px; }
.hv2-tool small { display: block; font-size: 13px; line-height: 1.45; color: var(--rj-muted); }
.hv2-tool .tag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800; color: #b45309; background: #fef3c7; padding: 2px 6px; border-radius: 6px; vertical-align: middle; }

/* Subjects */
.hv2-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.hv2-subj {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--rj-card); border: 1px solid var(--rj-line);
  border-radius: 12px; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.hv2-subj:hover { border-color: #b9cfe4; box-shadow: var(--rj-shadow); }
.hv2-subj i { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #eaf2fb; color: var(--rj-blue); font-size: 15px; flex: 0 0 36px; }
.hv2-subj span { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--rj-ink); line-height: 1.3; }
.hv2-subj small { font-size: 12px; color: var(--rj-muted); font-weight: 600; }

/* Rankings block */
.hv2-rank-card { background: var(--rj-card); border: 1px solid var(--rj-line); border-radius: 18px; box-shadow: var(--rj-shadow); overflow: hidden; }
.hv2-rank-card .filters-bar { background: #fbfcfe; border-bottom: 1px solid var(--rj-line); margin: 0; padding: 14px 18px; }
.hv2-rank-card .filters-bar .container, .hv2-rank-card .table-section .container { max-width: none; padding: 0; }
.hv2-rank-card .table-section { padding: 0; background: transparent; }
.hv2-rank-card .table-wrapper { border-radius: 0; box-shadow: none; border: 0; margin: 0; }
.hv2-rank-card .journals-table thead th { background: var(--rj-navy); color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.hv2-rank-card .journals-table tbody tr { transition: background .12s; }
.hv2-rank-card .journals-table tbody tr:hover { background: #f5f9fe; }
.hv2-rank-card .journal-link { font-weight: 700; }
.hv2-rank-card .pagination { padding: 16px; margin: 0; }
.hv2-rank-note { font-size: 12.5px; color: var(--rj-muted); margin: 0; padding: 12px 18px; border-top: 1px solid var(--rj-line); }
.hv2-filter-toggle { display: none; }

/* Journal cards (mobile list) */
.hv2-cards { display: none; }
.jc { display: block; padding: 14px 16px; border-bottom: 1px solid var(--rj-line); text-decoration: none; color: inherit; }
.jc:active { background: #f3f7fc; }
.jc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--rj-muted); }
.jc-rank { color: var(--rj-navy); background: #eef3f9; border-radius: 6px; padding: 2px 7px; }
.jc-top .q-badge { font-size: 11px; padding: 2px 7px; }
.jc-sc { margin-left: auto; font-size: 11.5px; }
.jc-sc.ok { color: var(--rj-green); } .jc-sc.bad { color: #dc2626; } .jc-sc.off { color: #94a3b8; }
.jc-title { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.35; color: var(--rj-ink); }
.jc-sub { font-size: 12.5px; color: var(--rj-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.jc-stats div { background: #f6f8fb; border-radius: 10px; padding: 7px 4px; text-align: center; }
.jc-stats b { display: block; font-size: 14px; color: var(--rj-ink); }
.jc-stats small { display: block; font-size: 10.5px; color: var(--rj-muted); margin-top: 1px; }
.jc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.jc-tags span { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: #047857; }
.jc-tags span.d { background: #fff7ed; color: #c2410c; }

/* Lists (top Q1 / recently added) */
.hv2-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hv2-list { background: var(--rj-card); border: 1px solid var(--rj-line); border-radius: var(--rj-radius); box-shadow: var(--rj-shadow); padding: 6px 0; }
.hv2-list h3 { font-size: 16px; font-weight: 800; color: var(--rj-ink); margin: 0; padding: 14px 18px 8px; display: flex; gap: 8px; align-items: center; }
.hv2-list h3 i { color: var(--rj-amber); }
.hv2-list a.row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; text-decoration: none; border-top: 1px solid #f1f4f8; }
.hv2-list a.row:hover { background: #f8fafd; }
.hv2-list .num { flex: 0 0 26px; height: 26px; border-radius: 8px; background: #eef3f9; color: var(--rj-navy); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.hv2-list .t { flex: 1; min-width: 0; }
.hv2-list .t b { display: block; font-size: 14px; color: var(--rj-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv2-list .t small { font-size: 12px; color: var(--rj-muted); }

/* Trust strip */
.hv2-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 36px 0 48px; }
.hv2-trust div { background: var(--rj-card); border: 1px solid var(--rj-line); border-radius: var(--rj-radius); padding: 18px; }
.hv2-trust b { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--rj-ink); margin-bottom: 6px; }
.hv2-trust b i { color: var(--rj-blue); }
.hv2-trust p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--rj-muted); }

/* AI widget spacing inside new layout */
.hv2-wrap .ai-suggest-widget { border-radius: 18px; overflow: hidden; margin: 0; }

/* ── Tablet ── */
@media (max-width: 1024px) {
  .hv2-hero-grid { grid-template-columns: 1fr; }
  .hv2-stats { grid-template-columns: repeat(4, 1fr); padding: 14px; }
  .hv2-tools { grid-template-columns: repeat(2, 1fr); }
}

/* ── Phone: app layout ── */
@media (max-width: 768px) {
  .hv2-container { padding: 0 16px; }
  .hv2-hero { padding: 26px 0 30px; }
  .hv2-hero h1 { margin: 12px 0 8px; }
  .hv2-hero p.lead { font-size: 15px; margin-bottom: 16px; }
  .hv2-search { padding: 5px 5px 5px 12px; border-radius: 14px; }
  .hv2-search input { font-size: 16px; padding: 9px 2px; }
  .hv2-search button { padding: 11px 15px; font-size: 14px; }
  .hv2-chips { flex-wrap: nowrap; overflow-x: auto; margin: 14px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
  .hv2-chips::-webkit-scrollbar { display: none; }
  .hv2-chips span { display: none; }
  .hv2-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; border-radius: 16px; }
  .hv2-stat { padding: 12px; }
  .hv2-stat b { font-size: 20px; }
  .hv2-section { padding: 26px 0 4px; }
  .hv2-head h2 { font-size: 19px; }
  .hv2-head p { font-size: 13px; }

  /* app-icon grid */
  .hv2-tools { grid-template-columns: repeat(4, 1fr); gap: 14px 6px; background: var(--rj-card); border: 1px solid var(--rj-line); border-radius: 18px; padding: 16px 8px; box-shadow: var(--rj-shadow); }
  .hv2-tool { flex-direction: column; align-items: center; gap: 7px; padding: 0; background: none; border: 0; box-shadow: none; text-align: center; }
  .hv2-tool:hover { transform: none; box-shadow: none; }
  .hv2-ico { width: 54px; height: 54px; flex-basis: auto; border-radius: 16px; font-size: 21px; box-shadow: 0 6px 14px rgba(15, 43, 70, .18); }
  .hv2-tool b { font-size: 11.5px; font-weight: 600; line-height: 1.25; margin: 0; }
  .hv2-tool small, .hv2-tool .tag { display: none; }

  /* subjects: horizontal swipe */
  .hv2-subjects { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .hv2-subjects::-webkit-scrollbar { display: none; }
  .hv2-subj { flex: 0 0 72%; scroll-snap-align: start; }

  /* rankings: cards instead of table, filters behind a button */
  .hv2-rank-card { border-radius: 16px; }
  .hv2-rank-card .table-wrapper { display: none; }
  .hv2-cards { display: block; }
  .hv2-filter-toggle {
    display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: #fbfcfe;
    border-bottom: 1px solid var(--rj-line); padding: 13px 16px; font: inherit; font-size: 14px; font-weight: 700; color: var(--rj-ink); cursor: pointer;
  }
  .hv2-filter-toggle small { font-weight: 600; color: var(--rj-muted); font-size: 12.5px; }
  .hv2-rank-card .filters-bar { display: none; padding: 14px 16px; }
  .hv2-rank-card.filters-open .filters-bar { display: block; }
  .hv2-rank-card .filter-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
  .hv2-rank-card .filter-item { min-width: 0; }
  .hv2-rank-card .filter-item select, .hv2-rank-card .cs-display { width: 100%; min-height: 42px; font-size: 14px; }
  .hv2-rank-card .results-count { grid-column: 1 / -1; }
  .hv2-rank-card .btn-export-csv, .hv2-rank-card .btn-clear { justify-self: start; }
  .hv2-rank-card .pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .hv2-rank-card .pg-btn { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }

  .hv2-lists { grid-template-columns: 1fr; }
  .hv2-trust { grid-template-columns: 1fr; padding: 24px 0 28px; }
}

/* tool labels: long on desktop, short on phones */
.hv2-tool .sm { display: none; }
@media (max-width: 768px) {
  .hv2-tool .lg { display: none; }
  .hv2-tool .sm { display: inline; }
}

/* keep grid/flex children from stretching the page on phones */
.hv2-wrap { overflow-x: hidden; }
.hv2-hero-grid > *, .hv2-container > *, .hv2-stats > *, .hv2-tools > * { min-width: 0; }
.hv2-hero h1 { overflow-wrap: anywhere; }
