/* ============================================================
   RGU — Research Portal  •  Shared Theme
   Matches the main RGU site: Sora type, violet/indigo/sky
   palette, glassmorphism, dark heroes & footer.
   ============================================================ */

:root {
  --r-ink: #0b1020;
  --r-ink-2: #080810;
  --r-ink-3: #050508;
  --r-text: #1e293b;
  --r-muted: #64748b;
  --r-bg: #f8fafc;
  --r-violet: #7c3aed;
  --r-violet-d: #6d28d9;
  --r-indigo: #4f46e5;
  --r-sky: #0ea5e9;
  --r-cyan: #38bdf8;
  --r-emerald: #10b981;
  --r-lime: #a3e635;
  --r-border: rgba(15, 23, 42, 0.08);
  --r-grad: linear-gradient(100deg, #7c3aed 0%, #4f46e5 45%, #0ea5e9 100%);
  --r-grad-soft: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(14, 165, 233, 0.12));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: #fff; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: "Sora", system-ui, sans-serif;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--r-text);
  background: var(--r-bg);
}

/* ---- Brand helpers ---- */
.r-grad-text {
  background: var(--r-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.r-grad-bg { background: var(--r-grad); }

/* ---- Hero decoration ---- */
.r-hero-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 54px 54px;
}
.r-blob { position: absolute; border-radius: 50%; filter: blur(120px); pointer-events: none; }

/* ============================================================
   NAVBAR
   ============================================================ */
.r-nav { transition: box-shadow .3s ease, background .3s ease; }
.r-nav .r-link { white-space: nowrap; }
.r-nav a.r-link { position: relative; }
.r-nav a.r-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  height: 2px; width: 0;
  background: var(--r-grad);
  transition: width .28s ease;
}
.r-nav a.r-link:hover::after,
.r-nav a.r-link.is-active::after { width: 100%; }
.r-nav a.r-link.is-active { color: var(--r-violet-d); }

/* Dropdown */
.r-dd { position: relative; }
.r-dd-panel {
  position: absolute; top: calc(100% + 14px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, transform .22s ease;
  min-width: 280px; z-index: 60;
}
.r-dd:hover .r-dd-panel,
.r-dd:focus-within .r-dd-panel {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.r-dd-panel::before {
  content: ""; position: absolute; top: -7px; left: 50%;
  width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg);
  background: #fff; border-left: 1px solid var(--r-border); border-top: 1px solid var(--r-border);
}

/* ============================================================
   GENERIC SECTION + CARD UTILITIES
   ============================================================ */
.r-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
}
.r-card {
  background: #fff;
  border: 1px solid var(--r-border);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -16px rgba(16, 24, 40, .18);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .35s ease, border-color .35s ease;
}
.r-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 48px -18px rgba(79, 70, 229, .35);
  border-color: rgba(124, 58, 237, .28);
}
.r-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  border-radius: 999px; padding: .35rem .8rem;
  font-size: .72rem; font-weight: 600;
  border: 1px solid var(--r-border); background: #fff; color: var(--r-muted);
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.r-reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1); }
.r-reveal.is-in { opacity: 1; transform: none; }
.r-reveal.d1 { transition-delay: .08s; }
.r-reveal.d2 { transition-delay: .16s; }
.r-reveal.d3 { transition-delay: .24s; }
.r-reveal.d4 { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  .r-reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   METRIC BAR CHARTS (CSS-only, recreated from R&D deck)
   ============================================================ */
.r-bars { display: flex; align-items: flex-end; gap: clamp(6px, 2vw, 22px); height: 240px; padding-top: 28px; }
.r-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.r-bar {
  width: 100%; max-width: 64px; border-radius: 8px 8px 3px 3px;
  position: relative; height: 0;
  transition: height 1.1s cubic-bezier(.22,1,.36,1);
}
.r-bar .r-bar-val {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: clamp(11px, 1.4vw, 14px); font-weight: 800; color: #be123c; white-space: nowrap;
}
.r-bar-x { margin-top: 10px; font-size: clamp(9px, 1.2vw, 12px); font-weight: 600; color: var(--r-muted); text-align: center; line-height: 1.1; }
.r-bar-grad-purple { background: linear-gradient(180deg, #312e81 0%, #7c3aed 45%, #f59e0b 88%, #fde047 100%); }
.r-bar-grad-green  { background: linear-gradient(180deg, #16a34a 0%, #052e16 50%, #7f1d1d 78%, #ef4444 100%); }

/* ============================================================
   DATA TABLE PAGES
   ============================================================ */
.r-table-wrap {
  border: 1px solid var(--r-border);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 18px 40px -28px rgba(16,24,40,.25);
}
.r-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-height: 78vh; overflow-y: auto; }
table.r-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.r-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: #0b1020; color: #e8ecff;
  text-align: left; font-weight: 600; font-size: 12px;
  letter-spacing: .03em; padding: 13px 14px; white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
table.r-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--r-border);
  vertical-align: top; color: #334155; line-height: 1.5;
}
table.r-table tbody tr:hover td { background: rgba(124, 58, 237, .045); }
table.r-table td.r-col-sno { font-weight: 700; color: #0b1020; white-space: nowrap; }
table.r-table td.r-col-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-amount { font-weight: 700; color: #047857; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Year section divider row */
tr.r-group-row th {
  position: sticky; top: 42px; z-index: 4;
  background: linear-gradient(90deg, rgba(124,58,237,.12), rgba(14,165,233,.10));
  color: #4c1d95; text-align: left; font-weight: 700; font-size: 12.5px;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 14px; border-top: 1px solid rgba(124,58,237,.2); border-bottom: 1px solid rgba(124,58,237,.18);
}
tr.r-total-row td {
  background: rgba(16, 185, 129, .08);
  font-weight: 700; color: #065f46; border-bottom: 1px solid rgba(16,185,129,.25);
}
tr.r-status-granted td .r-pill { background: #dcfce7; color: #166534; }
.r-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: #ede9fe; color: #5b21b6; white-space: nowrap;
}
.r-pill-filed { background: #e0f2fe; color: #075985; }
.r-pill-granted { background: #dcfce7; color: #166534; }
.r-pill-published { background: #fef3c7; color: #92400e; }

/* search */
.r-search {
  width: 100%; border: 1px solid var(--r-border); border-radius: 999px;
  padding: 12px 18px 12px 44px; font-family: inherit; font-size: 14px; color: var(--r-text);
  background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
.r-search:focus { border-color: var(--r-violet); box-shadow: 0 0 0 4px rgba(124,58,237,.12); }
.r-no-results { display: none; padding: 40px; text-align: center; color: var(--r-muted); }

/* numbered prose for regulations */
.r-prose h3 { font-weight: 700; color: var(--r-ink); }
.r-prose p, .r-prose li { color: #475569; line-height: 1.75; }
.r-toc a { color: #475569; }
.r-toc a:hover { color: var(--r-violet-d); }

/* back to top */
#r-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 46px; height: 46px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--r-grad); color: #fff; display: none; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -8px rgba(79,70,229,.6);
}
#r-top.show { display: flex; }

/* ---------------- Popup modal ---------------- */
#r-popup-modal { display: none; }
#r-popup-modal.items-center { display: flex; }
.r-popup-inner { position: relative; }
.r-popup-close { border: none; cursor: pointer; font-size: 14px; line-height: 1; }
.r-popup-content { background: transparent; }
.r-popup-image { display: block; border-radius: 12px; max-height: 85vh; width: 100%; height: auto; }

@media (max-width: 640px) {
  .r-popup-inner { padding: 10px; }
  .r-popup-image { border-radius: 8px; max-height: 70vh; }
}
