/* ========================================================================
   NEXSPIRE — enhancements.css
   High-impact additions: loading screen, custom cursor, aurora, marquee
   Loaded after main.css to override/extend
   ======================================================================== */

/* ---------- Loading Screen ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-screen__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.loading-screen__logo {
  width: 80px;
  height: 80px;
}
.loading-screen__logo path,
.loading-screen__logo circle {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawLogo 1.6s var(--ease-out) forwards;
}
.loading-screen__logo circle {
  stroke-dashoffset: 0;
  animation: pulseLogo 1s 0.8s ease-out infinite;
  fill-opacity: 0;
  animation-fill-mode: forwards;
}
@keyframes drawLogo { to { stroke-dashoffset: 0; } }
@keyframes pulseLogo {
  0%, 100% { fill-opacity: 0; transform-origin: center; transform: scale(1); }
  50% { fill-opacity: 1; transform: scale(1.2); }
}
.loading-screen__text {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  color: var(--text-secondary);
  text-transform: uppercase;
  opacity: 0;
  animation: fadeInText 0.8s 0.6s var(--ease-out) forwards;
}
.loading-screen__pb {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary, rgba(148, 163, 184, .6));
  opacity: 0;
  margin-top: 0.5rem;
  animation: fadeInText 0.8s 0.95s var(--ease-out) forwards;
}
.loading-screen__pb strong {
  color: var(--accent-primary, #2E6FF7);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #2E6FF7, #00B8D4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes fadeInText { to { opacity: 1; } }
.loading-screen__bar {
  width: 120px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}
.loading-screen__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  animation: loadingBar 1.4s ease-in-out infinite;
}
@keyframes loadingBar {
  to { left: 100%; }
}

/* ---------- Custom Cursor (desktop only) ---------- */
.has-custom-cursor,
.has-custom-cursor * { cursor: none !important; }
.has-custom-cursor button,
.has-custom-cursor a { cursor: none !important; }

.custom-cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9998;
  mix-blend-mode: difference;
}
.custom-cursor.is-hidden { opacity: 0; }
.custom-cursor__dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  margin: -3px 0 0 -3px;
  transition: width 0.2s, height 0.2s, margin 0.2s;
  will-change: transform;
}
.custom-cursor__ring {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  margin: -18px 0 0 -18px;
  transition: width 0.3s, height 0.3s, margin 0.3s, border-color 0.2s, background 0.2s;
  will-change: transform;
}
.custom-cursor.is-hover .custom-cursor__dot {
  width: 0;
  height: 0;
  margin: 0;
}
.custom-cursor.is-hover .custom-cursor__ring {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}

/* ---------- Aurora gradient enhancement ---------- */
.bg-mesh {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(46, 111, 247, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(0, 184, 212, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(147, 51, 234, 0.10) 0%, transparent 60%);
  animation: auroraShift 20s ease-in-out infinite alternate;
}
@keyframes auroraShift {
  0% {
    background-position: 0% 0%, 100% 50%, 50% 100%;
  }
  100% {
    background-position: 20% 10%, 80% 60%, 30% 90%;
  }
}

/* ---------- Canvas grid (replaces particles) ---------- */
#grid-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

/* ---------- Magnetic button transition ---------- */
.btn--primary {
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-out), background 0.3s;
  will-change: transform;
}

/* ---------- Gradient text shimmer ---------- */
.gradient-text {
  background: linear-gradient(110deg, #2E6FF7 0%, #00B8D4 50%, #2E6FF7 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShimmer 6s ease-in-out infinite;
}
@keyframes gradientShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.gradient-text-alt {
  background: linear-gradient(110deg, #9333EA 0%, #2E6FF7 50%, #9333EA 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShimmer 6s ease-in-out infinite;
  animation-delay: 1.5s;
}

/* ---------- Glow on hero title ---------- */
.hero__title {
  text-shadow: 0 0 80px rgba(46, 111, 247, 0.25);
}

/* ---------- Marquee partners belt ---------- */
.marquee {
  padding: 4rem 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 20, 0.4);
  position: relative;
}
.marquee__label {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
}
.marquee__track {
  display: flex;
  gap: 4rem;
  animation: marqueeScroll 40s linear infinite;
  white-space: nowrap;
  width: max-content;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  opacity: 0.6;
  transition: all 0.3s var(--ease-out);
  font-family: var(--font-mono);
}
.marquee__item:hover {
  color: var(--text-primary);
  opacity: 1;
}
.marquee__sep {
  color: var(--accent-primary);
  font-size: 0.75rem;
  opacity: 0.4;
}
@keyframes marqueeScroll {
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; }
}

/* ---------- Section reveal: subtle clip on enter ---------- */
.section-reveal {
  clip-path: inset(20% 0 20% 0);
  opacity: 0;
  transition: clip-path 1s var(--ease-out), opacity 0.8s var(--ease-out);
}
.section-reveal.is-visible {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

/* ---------- Glow border on division cards ---------- */
.division-card--active {
  position: relative;
}
.division-card--active::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 184, 212, 0.6), rgba(46, 111, 247, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
  animation: borderRotate 6s linear infinite;
}
@keyframes borderRotate {
  to { filter: hue-rotate(360deg); }
}

/* ---------- Hero subtitle: subtle shine ---------- */
.hero__subtitle {
  position: relative;
}

/* ---------- Status pulse dot ---------- */
.hero__badge-dot {
  box-shadow:
    0 0 12px var(--accent-secondary),
    0 0 24px var(--accent-secondary);
}

/* ---------- Improved buttons hover ---------- */
.btn--primary {
  position: relative;
  overflow: hidden;
}
.btn--primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s;
}
.btn--primary:hover::before { left: 100%; }

/* ---------- Hamburger animation ---------- */
.nav__hamburger.is-active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav__hamburger.is-active span:nth-child(2) {
  opacity: 0;
}
.nav__hamburger.is-active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- Smooth font rendering ---------- */
body {
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'cv02' 1, 'cv03' 1, 'cv04' 1, 'cv11' 1;
}

/* ---------- Selection enhanced ---------- */
::selection {
  background: var(--accent-primary);
  color: #fff;
  text-shadow: none;
}

/* ---------- Disable cursor on mobile ---------- */
@media (max-width: 768px), (pointer: coarse) {
  .has-custom-cursor,
  .has-custom-cursor * { cursor: auto !important; }
  .custom-cursor { display: none !important; }
}

/* ---------- Reduced motion override ---------- */
@media (prefers-reduced-motion: reduce) {
  .gradient-text,
  .gradient-text-alt,
  .bg-mesh,
  .division-card--active::after {
    animation: none !important;
  }
  .loading-screen { display: none !important; }
}

/* ========================================================================
   INNOVATION & COE — Patents grid
   ======================================================================== */
.innovation {
  padding: var(--space-24) 0;
  position: relative;
}
.innovation__intro a {
  color: var(--accent-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.patents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.patent-card {
  position: relative;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
  isolation: isolate;
}
.patent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0.5;
  transition: opacity 0.3s;
}
.patent-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}
.patent-card:hover::before { opacity: 1; }
/* Header arranges code + status badge. When status badge is long (e.g.
 * "✓ USPTO Filed · App #64/062,885"), it wraps to a new line below the
 * code instead of getting truncated. flex-wrap + width 100% on badge
 * triggers the wrap. */
.patent-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  row-gap: 0.4rem;
}
.patent-card__code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  flex: 0 0 auto;
}
.patent-card__status {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;     /* tighter so longer text fits more easily */
  text-transform: uppercase;
  color: var(--accent-secondary);
  background: rgba(0,184,212,0.1);
  padding: 0.25rem 0.55rem;
  border-radius: 100px;
  border: 1px solid rgba(0,184,212,0.3);
  white-space: nowrap;
  line-height: 1.3;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  /* On narrow cards, allow the badge to occupy a full line below the code
   * so the App # is fully visible. align-self ensures it stays left-aligned
   * when wrapping. */
}
/* Below 380px card width (i.e. when the badge can't fit beside the code
 * without truncation), allow the badge text itself to wrap if necessary. */
@media (max-width: 420px) {
  .patent-card__status {
    white-space: normal;
    word-break: keep-all;
  }
}

/* CropConnect is the only invention with an actual USPTO filing (#64/062,885,
 * filed 11 May 2026). Distinct green "FILED" badge differentiates it visually
 * from the 10 inventions still in R&D phase. */
.patent-card__status--filed {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.4);
  font-weight: 700;
}
.patent-card--filed {
  border-color: rgba(22, 163, 74, 0.35);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.15);
}
.patent-card--filed::before {
  background: linear-gradient(90deg, #16a34a, #22c55e);
  opacity: 1;
  height: 3px;
}
.patent-card--filed:hover { border-color: #16a34a; }

/* Remaining 10 inventions: amber "IN R&D" badge with planned filing year. */
.patent-card__status--rd {
  color: #b45309;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.patent-card__domain {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.patent-card__desc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.innovation__footer {
  margin-top: 2.5rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(46,111,247,0.06), rgba(0,184,212,0.04));
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.innovation__footer p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  flex: 1;
  min-width: 280px;
}
.innovation__legal {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem !important;
}
.innovation__legal a {
  color: var(--accent-secondary);
}

/* Footer enhanced — copyright block */
.footer__copyright {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}
.footer__copyright a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer__copyright a:hover {
  color: var(--accent-secondary);
}
