:root {
  --bg: #050507;
  --surface: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f7f7f9;
  --muted: #9ca3af;
  --accent: #a78bfa;
  --accent2: #22d3ee;
  --accent3: #f472b6;
  --glow: rgba(167, 139, 250, 0.35);
  --torch-radius: 380px;
  --torch-fade: 520px;
  --torch-x: 50vw;
  --torch-y: 50vh;
  --mx: 0.5;
  --my: 0.5;
  --flow-speed: 10s;
  --aurora-speed: 22s;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  cursor: none;
  -webkit-font-smoothing: antialiased;
}

.nebula {
  position: fixed;
  inset: -10%;
  z-index: -3;
  background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--accent2) 18%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent3) 12%, transparent) 0%, transparent 48%),
    var(--bg);
  background-size: 220% 220%;
  animation: aurora var(--aurora-speed) ease-in-out infinite alternate;
  transform: translate(calc((var(--mx) - 0.5) * -60px), calc((var(--my) - 0.5) * -60px));
  will-change: background-position, transform;
}

@keyframes aurora {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.starfield canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.torch-glow {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: radial-gradient(circle var(--torch-radius) at var(--torch-x) var(--torch-y), var(--glow), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0.85;
}

.torch-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: rgba(5, 5, 7, 0.78);
  -webkit-mask-image: radial-gradient(circle var(--torch-radius) at var(--torch-x) var(--torch-y), transparent 0%, transparent calc(var(--torch-radius) * 0.55), rgba(0, 0, 0, 0.92) var(--torch-fade), black calc(var(--torch-fade) + 80px));
  mask-image: radial-gradient(circle var(--torch-radius) at var(--torch-x) var(--torch-y), transparent 0%, transparent calc(var(--torch-radius) * 0.55), rgba(0, 0, 0, 0.92) var(--torch-fade), black calc(var(--torch-fade) + 80px));
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--glow), inset 0 0 12px var(--glow);
  transform: translate(calc(var(--torch-x) - 11px), calc(var(--torch-y) - 11px));
  z-index: 100;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: width 0.15s, height 0.15s, border-color 0.3s;
  will-change: transform;
}

.cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: var(--text);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--glow);
}

body.cursor-hover .cursor {
  width: 44px;
  height: 44px;
  border-color: var(--accent2);
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  text-align: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 1.25rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.loaded .eyebrow {
  opacity: 1;
  transform: translateY(0);
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3.2rem, 13vw, 10rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin: 0 0 1.5rem;
  background: linear-gradient(120deg, var(--accent), var(--accent2), var(--accent3), var(--accent));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 34px color-mix(in srgb, var(--accent) 35%, transparent));
  animation: flow var(--flow-speed) ease infinite;
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition: opacity 0.9s ease 0.1s, transform 0.9s ease 0.1s;
}

.loaded .hero-title {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  color: var(--muted);
  max-width: 36rem;
  margin: 0 0 2.5rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}

.loaded .hero-subtitle {
  opacity: 1;
  transform: translateY(0);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease 0.35s, transform 0.7s ease 0.35s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.loaded .cta {
  opacity: 1;
  transform: translateY(0);
}

.cta:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 25%, transparent);
}

.concepts {
  padding: 6rem 2rem 4rem;
  position: relative;
  z-index: 1;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  text-align: center;
  margin: 0 0 3.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.loaded .section-title {
  opacity: 1;
  transform: translateY(0);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 2.5rem;
  max-width: 72rem;
  margin: 0 auto;
  perspective: 1200px;
}

.concept-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform-style: preserve-3d;
  transform: perspective(1200px) rotateX(calc(var(--rx, 0deg) * -1)) rotateY(var(--ry, 0deg)) translateZ(8px) translateY(40px);
  opacity: 0;
  transition: transform 0.15s ease, opacity 0.8s ease, box-shadow 0.25s ease;
  position: relative;
}

.concept-card.visible {
  opacity: 1;
  transform: perspective(1200px) rotateX(calc(var(--rx, 0deg) * -1)) rotateY(var(--ry, 0deg)) translateZ(8px) translateY(0);
}

.concept-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 220px at var(--glow-x, 50%) var(--glow-y, 0%), color-mix(in srgb, var(--accent) 28%, transparent), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

.concept-card:hover::before {
  opacity: 1;
}

.concept-card:hover {
  transform: perspective(1200px) rotateX(calc(var(--rx, 0deg) * -1)) rotateY(var(--ry, 0deg)) translateZ(28px) translateY(0);
  box-shadow: 0 28px 70px -14px rgba(0, 0, 0, 0.55), 0 0 50px color-mix(in srgb, var(--accent) 18%, transparent);
}

.card-visual {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  transform: translateZ(20px);
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.concept-card:hover .card-visual img {
  transform: scale(1.08);
}

.card-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
}

.card-body {
  padding: 2rem;
  transform: translateZ(30px);
}

.card-body h3 {
  font-family: 'Playfair Display', serif;
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
}

.card-body p {
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

.card-action {
  color: var(--accent2);
  font-weight: 600;
  transition: color 0.2s;
}

.concept-card:hover .card-action {
  color: #67e8f9;
}

footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .hero { padding: 1.5rem; }
  .concepts { padding: 4rem 1.5rem 3rem; }
  .cards { grid-template-columns: 1fr; gap: 1.75rem; }
  .concept-card:hover { transform: none; }
  .concept-card:hover .card-visual img { transform: none; }
  .concept-card::before { display: none; }
  .concept-card.visible { transform: translateY(0); }
}

@media (pointer: coarse) {
  :root {
    --torch-radius: 260px;
    --torch-fade: 380px;
  }
  body { cursor: auto; }
  .torch-overlay, .torch-glow, .cursor { display: none; }
  .nebula { transform: none; animation-duration: 60s; }
}

@media (prefers-reduced-motion: reduce) {
  .nebula, .hero-title, .eyebrow, .hero-subtitle, .cta, .section-title, .concept-card { transition: none; animation: none; }
  .concept-card { opacity: 1; transform: none; }
  .concept-card.visible { transform: none; }
  .torch-overlay, .torch-glow, .cursor { display: none; }
  body { cursor: auto; }
}
