﻿/* ═══════════════════════════════════════════════════════════
   XCELIAS PORTAL — UNIFIED DESIGN SYSTEM
   Matching Property Explorer (Website) Aesthetic
   ═══════════════════════════════════════════════════════════ */

/* ─── Design Tokens (Property Explorer DNA) ─── */
:root {
  /* Backgrounds */
  --bg: #0f0f1a;
  --surface-glass: rgba(15, 15, 30, 0.75);
  --panel-bg: rgba(15, 15, 30, 0.6);
  --input-bg: rgba(0, 0, 0, 0.3);

  /* Text */
  --text: #e8e8f0;
  --text-muted: #9898b8;
  --text-dim: #5a5a7a;

  /* Primary gradient palette */
  --accent: #667eea;
  --accent-mid: #764ba2;
  --accent-pink: #f093fb;
  --accent-green: #50fa7b;

  /* Borders */
  --border: rgba(102, 126, 234, 0.15);
  --border-hover: rgba(102, 126, 234, 0.4);
  --glass-border: rgba(102, 126, 234, 0.2);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  --gradient-subtle: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.15) 0%,
    rgba(240, 147, 251, 0.1) 100%
  );

  /* Shadows */
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(102, 126, 234, 0.08);
  --glass-glow: 0 0 40px rgba(102, 126, 234, 0.15);
  --btn-glow: 0 8px 25px rgba(102, 126, 234, 0.4);
  --btn-glow-hover: 0 12px 35px rgba(102, 126, 234, 0.6);

  /* Radii */
  --radius: 18px;
  --radius-pill: 50px;
  --radius-sm: 12px;

  /* Font */
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Glassmorphism */
  --blur: blur(30px) saturate(200%) brightness(1.1);
  --blur-light: blur(12px);
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Radial ambient glow like Property Explorer */
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(240, 147, 251, 0.06) 0%, transparent 50%);
}

/* ═══════════════════════════════════════════════════
   PARTICLE CANVAS
   ═══════════════════════════════════════════════════ */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════
   AMBIENT ORB SYSTEM
   ═══════════════════════════════════════════════════ */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  will-change: transform, opacity;
}
.orb--1 {
  width: 600px;
  height: 600px;
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.25) 0%, transparent 70%);
  animation: orbFloat1 20s ease-in-out infinite;
}
.orb--2 {
  width: 500px;
  height: 500px;
  bottom: -10%;
  right: -5%;
  background: radial-gradient(circle, rgba(240, 147, 251, 0.2) 0%, transparent 70%);
  animation: orbFloat2 24s ease-in-out infinite;
}
.orb--3 {
  width: 350px;
  height: 350px;
  top: 40%;
  left: 55%;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.15) 0%, transparent 70%);
  animation: orbFloat3 18s ease-in-out infinite;
}
.orb--4 {
  width: 280px;
  height: 280px;
  top: 15%;
  right: 20%;
  background: radial-gradient(circle, rgba(80, 250, 123, 0.08) 0%, transparent 70%);
  animation: orbFloat1 22s ease-in-out infinite reverse;
}

@keyframes orbFloat1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.5;
  }
  25% {
    transform: translate(40px, -30px) scale(1.1);
    opacity: 0.7;
  }
  50% {
    transform: translate(-20px, 50px) scale(0.95);
    opacity: 0.4;
  }
  75% {
    transform: translate(30px, 20px) scale(1.05);
    opacity: 0.6;
  }
}
@keyframes orbFloat2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.4;
  }
  33% {
    transform: translate(-50px, -40px) scale(1.08);
    opacity: 0.6;
  }
  66% {
    transform: translate(30px, -20px) scale(0.92);
    opacity: 0.35;
  }
}
@keyframes orbFloat3 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-40px, 30px) scale(1.15);
  }
}

/* ═══════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════ */
#home-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 60px;
}

/* ═══════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════ */
.portal-header {
  width: 100%;
  max-width: 1060px;
  padding: 48px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeSlideDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* ── Animated Xcelias logo (orb version) ── */
.xc-logo-icon {
  position: relative;
  overflow: visible !important;
  flex-shrink: 0;
}
.xc-logo-ring-spin {
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#0f0f1a, #0f0f1a) padding-box,
    linear-gradient(135deg, #667eea, #f093fb, #50fa7b, #667eea) border-box;
  animation: xcRingSpin 6s linear infinite;
}
.xc-logo-ring-pulse {
  position: absolute;
  inset: -14px;
  border-radius: 26px;
  border: 1px solid rgba(102, 126, 234, 0.25);
  animation: xcRingSpin 10s linear infinite reverse;
}
@keyframes xcRingSpin {
  to {
    transform: rotate(360deg);
  }
}
.xc-orb-track {
  position: absolute;
  width: 72px;
  height: 72px;
  left: 50%;
  top: 50%;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  pointer-events: none;
}
.xc-orb-track--1 {
  animation: xcOrbitSpin 2.8s linear infinite;
}
.xc-orb-track--2 {
  animation: xcOrbitSpin 4.2s linear infinite reverse;
  animation-delay: -1.4s;
}
.xc-orb-track--3 {
  animation: xcOrbitSpin 6s linear infinite;
  animation-delay: -3s;
}
@keyframes xcOrbitSpin {
  to {
    transform: rotate(360deg);
  }
}
.xc-orb {
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.xc-orb--1 {
  background: #667eea;
  box-shadow: 0 0 10px 3px rgba(102, 126, 234, 0.8);
}
.xc-orb--2 {
  background: #f093fb;
  box-shadow: 0 0 10px 3px rgba(240, 147, 251, 0.8);
  left: 100%;
  top: 50%;
}
.xc-orb--3 {
  background: #50fa7b;
  box-shadow: 0 0 8px 2px rgba(80, 250, 123, 0.7);
}
.xc-logo-svg {
  animation: xcLogoBreath 4s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
@keyframes xcLogoBreath {
  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.4));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(240, 147, 251, 0.7))
      drop-shadow(0 0 40px rgba(102, 126, 234, 0.3));
    transform: scale(1.06);
  }
}

.logo-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.logo-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}
.logo-red {
  color: #e8372a;
  font-weight: 800;
  letter-spacing: 0.1em;
}

/* Tagline */
.header-tagline {
  display: flex;
  align-items: center;
  gap: 16px;
  animation: fadeSlideDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s both;
}
.tagline-line {
  width: 40px;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0.4;
}
.tagline-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ringPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.06);
  }
}

/* ═══════════════════════════════════════════════════
   HERO STATS BAR
   ═══════════════════════════════════════════════════ */
.hero-section {
  width: 100%;
  max-width: 1060px;
  margin-bottom: 36px;
  animation: fadeSlideDown 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s both;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 18px 36px;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--glass-shadow);
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px;
}
.hero-stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
.hero-stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-top: 4px;
}
.hero-stat-divider {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, transparent, var(--border-hover), transparent);
}

/* ═══════════════════════════════════════════════════
   CARD GRID
   ═══════════════════════════════════════════════════ */
.card-grid {
  width: 100%;
  max-width: 1060px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ═══════════════════════════════════════════════════
   PROJECT CARD
   ═══════════════════════════════════════════════════ */
.project-card {
  position: relative;
  border-radius: var(--radius);
  /* Glass surface like Property Explorer list items */
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
  outline: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);

  /* Staggered entrance */
  opacity: 0;
  transform: translateY(40px);
  animation: cardEntrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.project-card:nth-child(1) {
  animation-delay: 0.15s;
}
.project-card:nth-child(2) {
  animation-delay: 0.25s;
}
.project-card:nth-child(3) {
  animation-delay: 0.35s;
}
.project-card:nth-child(4) {
  animation-delay: 0.45s;
}
.project-card:nth-child(5) {
  animation-delay: 0.55s;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(102, 126, 234, 0.45);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.25),
    0 0 40px rgba(102, 126, 234, 0.12);
}
.project-card:active {
  transform: translateY(-2px) scale(0.995);
}

/* Shimmer sweep effect on hover */
.card-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.04) 45%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 55%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: none;
  pointer-events: none;
  z-index: 2;
  border-radius: var(--radius);
}
.project-card:hover .card-shimmer {
  transform: translateX(100%);
  transition: transform 0.8s ease;
}

/* Animated border glow */
.card-border-glow {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  background: var(--gradient-primary);
  opacity: 0;
  z-index: 0;
  transition: opacity 0.4s ease;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
}
.project-card:hover .card-border-glow {
  opacity: 0.5;
}

/* Active indicator bar (left side) */
.project-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transform: scaleY(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 3;
}
.project-card:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.card-inner {
  position: relative;
  z-index: 1;
  padding: 28px;
}

/* Featured card (Avaria) spans full width */
.card--featured {
  grid-column: 1 / -1;
}
.card-featured-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.card-featured-left {
  flex: 0 0 auto;
}
.card-featured-right {
  flex: 1;
}

/* ─── Card elements ─── */
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-icon-wrap {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  backdrop-filter: var(--blur-light);
  border: 1px solid var(--border);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.project-card:hover .card-icon-wrap {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}
.card-icon--activities {
  background: rgba(179, 52, 32, 0.12);
  border-color: rgba(179, 52, 32, 0.2);
}
.card-icon--content {
  background: rgba(198, 147, 84, 0.12);
  border-color: rgba(198, 147, 84, 0.2);
}
.card-icon--avaria {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.2);
}
.card-icon--reports {
  background: rgba(240, 147, 251, 0.12);
  border-color: rgba(240, 147, 251, 0.2);
}
.card-icon--website {
  background: rgba(102, 126, 234, 0.12);
  border-color: rgba(102, 126, 234, 0.2);
}
.card-icon--studyguide {
  background: rgba(80, 250, 123, 0.12);
  border-color: rgba(80, 250, 123, 0.2);
}
.card-icon--pitchlab {
  background: rgba(255, 130, 40, 0.12);
  border-color: rgba(255, 130, 40, 0.2);
}

.card-icon {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.card-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge--activities {
  background: rgba(179, 52, 32, 0.15);
  color: #f87171;
}
.badge--content {
  background: rgba(198, 147, 84, 0.15);
  color: #c69354;
}
.badge--avaria {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}
.badge--reports {
  background: rgba(240, 147, 251, 0.15);
  color: #f093fb;
}
.badge--website {
  background: rgba(102, 126, 234, 0.15);
  color: #a5b4fc;
}
.badge--studyguide {
  background: rgba(80, 250, 123, 0.15);
  color: #50fa7b;
}
.badge--pitchlab {
  background: rgba(255, 130, 40, 0.15);
  color: #ff8228;
  border: 1px solid rgba(255, 130, 40, 0.25);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}
.card-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 14px;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.62rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}
.card-note {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 10px;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ─── Launch Button (Property Explorer style) ─── */
.card-launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--btn-glow);
  transition:
    transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.3s ease,
    filter 0.3s ease;
}
.card-launch:hover {
  transform: translateY(-3px);
  box-shadow: var(--btn-glow-hover);
  filter: brightness(1.1);
}
.card-launch:active {
  transform: translateY(-1px);
}
.launch-arrow {
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}
.card-launch:hover .launch-arrow {
  transform: translateX(4px);
}

/* ─── Footer ─── */
.portal-footer {
  width: 100%;
  max-width: 1060px;
  text-align: center;
  padding: 48px 0 24px;
  position: relative;
  animation: fadeSlideDown 0.8s ease-out 0.7s both;
}
.footer-glow {
  width: 200px;
  height: 1px;
  margin: 0 auto 20px;
  background: var(--gradient-primary);
  opacity: 0.3;
}
.portal-footer p {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════
   PROJECT VIEW (iframe container)
   ═══════════════════════════════════════════════════ */
.project-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.project-view.hidden {
  display: none;
}

.project-topbar {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  z-index: 10;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  backdrop-filter: blur(10px);
  letter-spacing: 0.04em;
}
.back-btn:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--btn-glow);
  transform: translateY(-1px);
}

.project-topbar-title {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topbar-newtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
}
.topbar-newtab:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--btn-glow);
  transform: scale(1.1);
}

.project-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg);
}

/* ═══════════════════════════════════════════════════
   LOADING INDICATOR
   ═══════════════════════════════════════════════════ */
.iframe-loading {
  position: absolute;
  inset: 48px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  z-index: 5;
}
.iframe-loading.hidden {
  display: none;
}

.loading-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  animation: spin 1.2s linear infinite;
}
.loading-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-pink);
  animation: spin 1.2s linear infinite;
}
.loading-ring-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent-mid);
  animation: spin 0.8s linear infinite reverse;
}
.loading-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes loadingPulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════
   SCROLLBAR (Property Explorer style)
   ═══════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 999px;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */

/* ─── Ultra-wide (4K+) ─── */
@media (min-width: 1600px) {
  .card-grid {
    max-width: 1200px;
  }
  .hero-section {
    max-width: 1200px;
  }
  .portal-header {
    max-width: 1200px;
  }
  .card-inner {
    padding: 32px;
  }
  .hero-stat-num {
    font-size: 2rem;
  }
}

/* ─── Tablet landscape (769–1060px) ─── */
@media (min-width: 769px) and (max-width: 1060px) {
  .card-grid {
    max-width: 720px;
  }
  .hero-section {
    max-width: 720px;
  }
}

/* ─── Tablet / Mobile (≤768px) ─── */
@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .card-featured-layout {
    flex-direction: column;
  }
  .portal-header {
    padding: 32px 0 16px;
  }
  .logo-title {
    font-size: 1.6rem;
  }
  .card-inner {
    padding: 22px;
  }
  .hero-stats {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .hero-stat {
    padding: 8px 16px;
  }
  .hero-stat-num {
    font-size: 1.3rem;
  }
  .hero-stat-divider {
    display: none;
  }
  /* Touch-friendly buttons */
  .card-launch {
    padding: 12px 28px;
    min-height: 44px;
  }
  .back-btn {
    min-height: 44px;
    padding: 10px 18px;
  }
  .topbar-newtab {
    width: 44px;
    height: 44px;
  }
  /* Disable backdrop-filter on lower-end mobile */
  .hero-stats {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .project-topbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* ─── Small phones (≤480px) ─── */
@media (max-width: 480px) {
  #home-view {
    padding: 0 12px 40px;
  }
  .portal-header {
    padding: 24px 0 12px;
  }
  .logo-group {
    gap: 12px;
  }
  .logo-title {
    font-size: clamp(1.2rem, 6vw, 1.6rem);
  }
  .logo-sub {
    font-size: 0.6rem;
  }
  .header-tagline {
    display: none;
  }
  .hero-stats {
    padding: 10px 12px;
    border-radius: 14px;
    justify-content: space-around;
  }
  .hero-stat {
    padding: 6px 10px;
  }
  .hero-stat-num {
    font-size: 1.1rem;
  }
  .hero-stat-label {
    font-size: 0.58rem;
  }
  .card-inner {
    padding: 18px;
  }
  .card-title {
    font-size: 1.05rem;
  }
  .card-desc {
    font-size: 0.72rem;
  }
  .card-tags {
    gap: 4px;
  }
  .tag {
    font-size: 0.58rem;
    padding: 3px 9px;
  }
  .card-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .portal-footer {
    padding: 32px 0 16px;
  }
}

/* ─── Fold-style ultra-narrow (≤320px) ─── */
@media (max-width: 320px) {
  .hero-stat {
    padding: 4px 6px;
  }
  .hero-stat-num {
    font-size: 0.95rem;
  }
  .card-launch {
    width: 100%;
    justify-content: center;
  }
}

/* ─── Landscape small devices ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .portal-header {
    padding: 16px 0 8px;
  }
  .hero-section {
    margin-bottom: 16px;
  }
  .card-inner {
    padding: 16px;
  }
}

/* ─── Focus visible (keyboard navigation) ─── */
.project-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.card-launch:focus-visible,
.back-btn:focus-visible,
.topbar-newtab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #particle-canvas {
    display: none;
  }
  .orb {
    display: none;
  }
}

/* User chip */
#xcp-user-chip {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  font-size: 13px;
}
.xcp-chip-name {
  font-weight: 700;
  color: #e8e8f0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xcp-chip-role {
  font-size: 11px;
  color: #9898b8;
  white-space: nowrap;
}
.xcp-chip-signout {
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #9898b8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.xcp-chip-signout:hover {
  background: rgba(245, 101, 101, 0.15);
  border-color: rgba(245, 101, 101, 0.3);
  color: #fc8181;
}
/* Locked card */
.xcp-card-locked {
  opacity: 0.5;
  cursor: default !important;
}
.xcp-card-locked .card-launch {
  pointer-events: none;
  opacity: 0.4;
}
.xcp-lock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(245, 101, 101, 0.15);
  border: 1px solid rgba(245, 101, 101, 0.3);
  color: #fc8181;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 50px;
  letter-spacing: 0.5px;
  z-index: 2;
}
/* Access denied flash */
#xcp-access-denied {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245, 101, 101, 0.12);
  border: 1px solid rgba(245, 101, 101, 0.3);
  color: #fc8181;
  padding: 14px 24px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 99;
  white-space: nowrap;
}
#xcp-access-denied.show {
  opacity: 1;
}
