/* hero */
.hero {
  padding: 6.5rem 0 5rem;
  background:
    radial-gradient(1200px 300px at 50% 10%, rgba(207,84,158,0.06), transparent 20%),
    linear-gradient(180deg, rgba(0,0,0,0.1), transparent);
  border-bottom: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
}

.hero-inner {
  max-width: 980px;
  margin: 0 auto;
}

.hero-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  margin: 0 0 0.6rem;
  letter-spacing: 0.04em;
  color: var(--text);
  position: relative;
  display: inline-block;
  overflow: hidden;
}

/* Arcane Magic Particles */
.magic-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  max-width: 100%;
}

.arcane-text {
  position: relative;
  display: inline-block;
}

.arcane-letter {
  display: inline-block;
  animation: letterFloat 3s ease-in-out infinite;
}

.arcane-letter:nth-child(1) { animation-delay: 0s; }
.arcane-letter:nth-child(2) { animation-delay: 0.1s; }
.arcane-letter:nth-child(3) { animation-delay: 0.2s; }
.arcane-letter:nth-child(4) { animation-delay: 0.3s; }
.arcane-letter:nth-child(5) { animation-delay: 0.4s; }
.arcane-letter:nth-child(6) { animation-delay: 0.5s; }
.arcane-letter:nth-child(7) { animation-delay: 0.6s; }
.arcane-letter:nth-child(8) { animation-delay: 0.7s; }
.arcane-letter:nth-child(9) { animation-delay: 0.8s; }
.arcane-letter:nth-child(10) { animation-delay: 0.9s; }
.arcane-letter:nth-child(11) { animation-delay: 1s; }
.arcane-letter:nth-child(12) { animation-delay: 1.1s; }
.arcane-letter:nth-child(13) { animation-delay: 1.2s; }
.arcane-letter:nth-child(14) { animation-delay: 1.3s; }
.arcane-letter:nth-child(15) { animation-delay: 1.4s; }
.arcane-letter:nth-child(16) { animation-delay: 1.5s; }

@keyframes letterFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.hero-sub {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 1.08rem;
}

/* CTA */
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.btn.primary {
  background: #d4c5b9;
  color: #1a1a1a;
  border-radius: 8px;
  padding: 0.9rem 1.4rem;
  font-size: 1.02rem;
  transition: transform var(--anim-fast) ease, box-shadow var(--anim-fast) ease, background var(--anim-fast) ease;
  cursor: pointer;
}

.btn.primary:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
  background: #dccfc4;
}

.btn.primary:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.btn.outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  transition: transform var(--anim-fast) ease, border-color var(--anim-fast) ease, box-shadow var(--anim-fast) ease;
  cursor: pointer;
}

.btn.outline:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.btn.outline:active {
  transform: translateY(-2px);
}

/* cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 3rem auto;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  padding: 1.6rem;
  border-radius: var(--radius);
  min-height: 140px;
  transition: transform var(--anim) cubic-bezier(.2,.9,.3,1), box-shadow var(--anim) cubic-bezier(.2,.9,.3,1), border-color var(--anim) ease;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(8px) scale(.995);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: inherit;
  transition: left 0.5s ease;
}

.cards .card-link:nth-child(1) .card {
  border-top-color: #5da9a4;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow1 3s ease-in-out infinite, cardFloat 4s ease-in-out infinite;
  animation-delay: 80ms, 80ms, 0.5s;
}

.cards .card-link:nth-child(2) .card {
  border-top-color: #d4894a;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow2 3s ease-in-out infinite, cardFloat 4.2s ease-in-out infinite;
  animation-delay: 160ms, 160ms, 0.7s;
}

.cards .card-link:nth-child(3) .card {
  border-top-color: #8b6ba8;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow3 3s ease-in-out infinite, cardFloat 4.4s ease-in-out infinite;
  animation-delay: 240ms, 240ms, 0.9s;
}

.cards .card-link:nth-child(4) .card {
  border-top-color: #c95b7a;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow4 3s ease-in-out infinite, cardFloat 4.6s ease-in-out infinite;
  animation-delay: 320ms, 320ms, 1.1s;
}

.cards .card-link:nth-child(5) .card {
  border-top-color: #9bc95b;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow5 3s ease-in-out infinite, cardFloat 4.8s ease-in-out infinite;
  animation-delay: 400ms, 400ms, 1.3s;
}

.cards .card-link:nth-child(6) .card {
  border-top-color: #c9a04a;
  animation: cardIn var(--anim) cubic-bezier(.2,.9,.3,1) forwards, borderGlow6 3s ease-in-out infinite, cardFloat 5s ease-in-out infinite;
  animation-delay: 480ms, 480ms, 1.5s;
}

@keyframes borderGlow1 {
  0%, 100% { border-top-color: #5da9a4; }
  50% { border-top-color: #7dc9c4; }
}

@keyframes borderGlow2 {
  0%, 100% { border-top-color: #d4894a; }
  50% { border-top-color: #f4a96a; }
}

@keyframes borderGlow3 {
  0%, 100% { border-top-color: #8b6ba8; }
  50% { border-top-color: #ab8bc8; }
}

@keyframes borderGlow4 {
  0%, 100% { border-top-color: #c95b7a; }
  50% { border-top-color: #e97b9a; }
}

@keyframes borderGlow5 {
  0%, 100% { border-top-color: #9bc95b; }
  50% { border-top-color: #bbe97b; }
}

@keyframes borderGlow6 {
  0%, 100% { border-top-color: #c9a04a; }
  50% { border-top-color: #e9c06a; }
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.005); }
}

.card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  border-color: rgba(255,255,255,0.08);
}

.card:active {
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}

.card .icon {
  font-size: 1.6rem;
  color: var(--accent);
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  flex-shrink: 0;
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
  color: var(--text);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

/* responsive */
@media (max-width: 1000px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
    margin: 2.5rem auto;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 3rem 0 2.5rem;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
    margin: 0 0 0.5rem;
  }

  .hero-sub {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .hero-cta {
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .btn.primary,
  .btn.outline {
    padding: 0.75rem 1.2rem;
    font-size: 0.95rem;
    width: 100%;
    max-width: 280px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin: 1.5rem auto;
    max-width: 500px;
    justify-items: center;
  }

  .card {
    padding: 1rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 420px;
  }

  .card .icon {
    margin-bottom: 0.75rem;
  }

  .card h3 {
    font-size: 1.05rem;
  }

  .card p {
    font-size: 0.92rem;
  }

  .search {
    min-width: 0;
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: center;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .footer-links a {
    margin-left: 0;
    margin-right: 0.75rem;
  }

  /* Reduce animation intensity on mobile */
  .card:hover {
    transform: translateY(-4px) scale(1.005);
  }

  @keyframes cardFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.002); }
  }

  @keyframes letterFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }
}

@media (max-width: 420px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero-title {
    font-size: 1.85rem;
    letter-spacing: 0.02em;
  }

  .hero-sub {
    font-size: 0.9rem;
    padding: 0 1rem;
  }

  .btn.primary,
  .btn.outline {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }

  .card {
    padding: 0.85rem;
  }

  .card .icon {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  .footer-inner small {
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
  }

  .footer-links {
    width: 100%;
    justify-content: center;
  }

  .footer-links a {
    font-size: 0.9rem;
  }
}

/* entrance animation: staggered cards */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.995);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
