/* portal.css — "Soft Light" professional theme.
   Off-white canvas, deep-navy text, soft teal/indigo accents, white cards with
   gentle shadows + gradient-border glow on hover. Bold Space Grotesk display. */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap");

/* ---- Design tokens -------------------------------------------------------- */
:root {
  --bg: #f6f8fb;
  --c1: #14b8a6;  /* teal-500   */
  --c2: #0891b2;  /* cyan-700   */
  --c3: #7c3aed;  /* violet-600 */
  --c4: #c026d3;  /* fuchsia-600*/
  --grad: linear-gradient(110deg, var(--c1) 0%, var(--c2) 30%, var(--c3) 68%, var(--c4) 100%);
  --ink: #0f172a;       /* headings  */
  --body: #475569;      /* body text */

  /* type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;

  /* spacing rhythm */
  --section-gap: 6rem;
  --section-gap-sm: 4rem;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--body);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.02em;
}

[x-cloak] { display: none !important; }

/* ---- Selection & focus --------------------------------------------------- */
::selection {
  background: rgba(20, 184, 166, 0.22);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Soft gradient mesh (painted once, no blur, no per-frame animation) -- */
.mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(45vmax 45vmax at 8% -12%, rgba(20, 184, 166, 0.14), transparent 60%),
    radial-gradient(48vmax 48vmax at 104% 6%, rgba(124, 58, 237, 0.12), transparent 60%),
    radial-gradient(42vmax 42vmax at 20% 110%, rgba(192, 38, 211, 0.08), transparent 60%),
    radial-gradient(40vmax 40vmax at 92% 96%, rgba(8, 145, 178, 0.10), transparent 60%),
    var(--bg);
}
.mesh span { display: none; }

/* Fine dot grid + top fade */
.grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 72%);
}

/* ---- Section spacing ----------------------------------------------------- */
.section-gap    { margin-top: var(--section-gap); }
.section-gap-sm { margin-top: var(--section-gap-sm); }

@media (max-width: 768px) {
  .section-gap    { margin-top: var(--section-gap-sm); }
  .section-gap-sm { margin-top: 2.5rem; }
}

/* ---- Scroll progress bar ------------------------------------------------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  z-index: 60; background: var(--grad);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
  transition: width 0.08s linear;
}

/* ---- Header scroll variants ---------------------------------------------- */
header.header-scrolled {
  padding-top: 0 !important;
  backdrop-filter: blur(20px) !important;
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

/* ---- White card with gradient-border glow on hover ---------------------- */
.card {
  position: relative;
  border-radius: 1.25rem;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.18);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s, border-color .35s;
}
.card::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
}
.card:hover {
  transform: translateY(-7px);
  box-shadow: 0 28px 60px -26px rgba(124, 58, 237, 0.35);
  border-color: transparent;
}
.card:hover::before { opacity: 1; }

/* Per-card accent glows for the bento grid */
.card-accent-violet:hover  { box-shadow: 0 28px 60px -26px rgba(139, 92, 246, 0.45); }
.card-accent-fuchsia:hover { box-shadow: 0 28px 60px -26px rgba(192, 38, 211, 0.35); }
.card-accent-teal:hover    { box-shadow: 0 28px 60px -26px rgba(20, 184, 166, 0.40); }
.card-accent-cyan:hover    { box-shadow: 0 28px 60px -26px rgba(8, 145, 178, 0.38); }
.card-accent-sky:hover     { box-shadow: 0 28px 60px -26px rgba(14, 165, 233, 0.35); }

/* ---- Rotating conic-gradient border (Chrome 85+, Safari 15.4+, FF 128+) --- */
@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.border-glow {
  position: relative;
}
.border-glow::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--border-angle),
    var(--c1), var(--c3), var(--c4), var(--c1)
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: border-spin 4s linear infinite paused;
}
.border-glow:hover::after {
  opacity: 1;
  animation-play-state: running;
}
@keyframes border-spin {
  to { --border-angle: 360deg; }
}

/* Scan-line pulse on the MediVault card's background orb */
.scan-pulse {
  animation: scan-move 6s ease-in-out infinite;
}
@keyframes scan-move {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-8px, -8px); }
}

/* ---- Glass variants ------------------------------------------------------ */
.glass {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.25);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 1.5rem;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

/* ---- Typography helpers -------------------------------------------------- */
.text-gradient {
  background: var(--grad);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }

.text-link {
  background-image: linear-gradient(var(--c1), var(--c1));
  background-size: 0% 1px;
  background-position: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s ease;
}
.text-link:hover { background-size: 100% 1px; }

/* Hero heading depth */
.hero-heading {
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 12px rgba(20, 184, 166, 0.08);
}

.kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase;
  color: #0d9488;
}

/* ---- Buttons ------------------------------------------------------------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.5rem; border-radius: 999px; font-weight: 700;
  font-family: "Space Grotesk", sans-serif; color: #ffffff;
  background: var(--grad); background-size: 200% auto;
  box-shadow: 0 12px 30px -10px rgba(20, 184, 166, 0.5);
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .2s, background-position .5s;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  transform: translateY(-2px);
  background-position: right center;
  box-shadow: 0 18px 40px -12px rgba(124, 58, 237, 0.55);
}
/* Ripple on click */
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.35s, transform 0.45s;
}
.btn-primary:active::after {
  opacity: 1;
  transform: scale(2.5);
  transition: opacity 0s, transform 0.3s;
}

.btn-ghost {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.4rem; border-radius: 999px; font-weight: 600;
  font-family: "Space Grotesk", sans-serif; color: var(--ink);
  border: 1px solid rgba(15, 23, 42, 0.15); background: rgba(255, 255, 255, 0.6);
  transition: background .2s, border-color .2s, transform .2s;
}
.btn-ghost:hover {
  background: #ffffff;
  border-color: rgba(13, 148, 136, 0.5);
  transform: translateY(-2px);
}

/* ---- Reveal on scroll ---------------------------------------------------- */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---- Marquee ------------------------------------------------------------- */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: inline-flex; gap: 3rem; white-space: nowrap; animation: scrollx 28s linear infinite; }
@keyframes scrollx { to { transform: translateX(-50%); } }

/* Depth marquee — second track moving opposite direction at half opacity */
.marquee-depth {
  position: relative;
  top: -6px;
  opacity: 0.35;
}
.marquee-depth .marquee-track {
  animation: scrollx-rev 40s linear infinite;
}
@keyframes scrollx-rev { to { transform: translateX(50%); } }

/* ---- Hero ----------------------------------------------------------------- */
#hero3d {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 55%;  /* right half only — text stays clean on left */
  z-index: 0;
  pointer-events: auto;
}
@media (max-width: 1024px) {
  #hero3d { width: 100%; opacity: 0.35; } /* fade behind text on mobile */
}
.hero-content { position: relative; z-index: 1; max-width: 45%; }  /* text on left */
@media (max-width: 1024px) {
  .hero-content { max-width: 100%; }
}

/* ---- Magnetic elements --------------------------------------------------- */
.magnetic {
  transition: transform 0.15s cubic-bezier(.2,.7,.2,1);
}

/* ---- Scrollbar ----------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #e9eef5; }
::-webkit-scrollbar-thumb { background: #c7d2e0; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #aab8cc; }

/* ---- Member cards & filter chips ----------------------------------------- */
.member-card {
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s;
}
.member-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px -18px rgba(124, 58, 237, 0.3);
}

.filter-chip {
  transition: all 0.25s ease;
  cursor: pointer;
  user-select: none;
}
.filter-chip.active,
.filter-chip:hover {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12), rgba(124, 58, 237, 0.10));
  border-color: rgba(20, 184, 166, 0.4) !important;
  color: #0d9488;
}

/* ---- Research scroller --------------------------------------------------- */
.rs-card {
  transition: transform 0.4s cubic-bezier(.2,.7,.2,1), box-shadow 0.4s;
}
.rs-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 50px -20px rgba(124, 58, 237, 0.35);
}

/* ---- Sparkle burst (hero CTA click) -------------------------------------- */
.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: sparkle-burst 1.4s ease-out forwards;
}
@keyframes sparkle-burst {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx, 30px), var(--sy, -30px)) scale(0); }
}

/* ---- Floating image tiles (hero satellites) ------------------------------ */
.float-tile {
  animation: float-drift 8s ease-in-out infinite;
}
.float-tile:nth-child(2) { animation-delay: -2s; }
.float-tile:nth-child(3) { animation-delay: -4s; }
.float-tile:nth-child(4) { animation-delay: -6s; }
@keyframes float-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-12px) rotate(3deg); }
  66%      { transform: translateY(6px) rotate(-2deg); }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .text-gradient, .marquee-track, .marquee-depth .marquee-track,
  .scan-pulse, .border-glow::after, .float-tile { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover, .member-card:hover, .rs-card:hover { transform: none; }
  .btn-primary:hover { transform: none; }
  .btn-ghost:hover { transform: none; }
}
