#grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}
::selection { background: #dbeafe; color: #1e3a8a; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

html { scroll-behavior: smooth; }

.text-gradient {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 40%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  will-change: transform;
}
.orb-1 { animation: float1 22s ease-in-out infinite; }
.orb-2 { animation: float2 26s ease-in-out infinite; }
.orb-3 { animation: float3 20s ease-in-out infinite; }
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.97); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-25px, 25px) scale(1.08); }
  66% { transform: translate(20px, -10px) scale(0.95); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15px, -30px) scale(1.03); }
}

@keyframes flowDot {
  0% { left: 0%; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { left: calc(100% - 8px); opacity: 0; }
}
@keyframes flowDotV {
  0% { top: 0%; opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { top: calc(100% - 8px); opacity: 0; }
}

.nav-scrolled {
  background: rgba(255, 255, 255, 0.85);
  border-bottom-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hero-fade {
  animation: heroFadeIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed {
  opacity: 1;
  transform: none;
}

.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.faq-icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.2) 45%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.2) 55%, transparent 60%);
  background-size: 250% 100%;
  background-position: 200% center;
  transition: background-position 0.6s ease;
}
.btn-primary:hover::after {
  background-position: -50% center;
}

.gradient-border {
  position: relative;
  background: linear-gradient(to bottom, #3b82f6, #6366f1);
  padding: 2px;
  border-radius: 1.25rem;
}
.gradient-border > div {
  background: white;
  border-radius: calc(1.25rem - 2px);
}

.card-hover {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.1);
}

.toggle-dot {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  opacity: 0;
}
.mobile-menu.open {
  opacity: 1;
}

.page-content:not(.hidden) {
  animation: pageIn 0.2s ease-out;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-card:not(.hidden) { animation: stepIn 0.35s ease-out; }
.step-summary:not(.hidden) { animation: summaryIn 0.25s ease-out; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes summaryIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.prog-line-fill {
  transition: width 0.4s ease-out;
}

/* Tooltip */
.tip {
  position: relative;
  cursor: help;
}
.tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 260px;
  white-space: normal;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}
.tip .tip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}
.tip:hover .tip-text {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Image modal */
.image-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.image-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.image-modal-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 0.75rem;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.image-modal-overlay.open img {
  transform: scale(1);
}
.image-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.image-modal-close svg {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}
