/* ===== Grain Texture ===== */
.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' 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;
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.15s; }
.reveal-delay-2 { transition-delay: 0.3s; }
.reveal-delay-3 { transition-delay: 0.45s; }

/* ===== Phone Frame ===== */
.phone-frame {
  width: 280px;
  background: #1a1a2e;
  border-radius: 2.5rem;
  padding: 10px;
  position: relative;
  box-shadow:
    0 25px 60px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 -3px 8px rgba(0, 0, 0, 0.08) inset;
  transform: rotate(-4deg);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.phone-frame:hover {
  transform: rotate(-2deg) translateY(-4px);
}

.phone-notch {
  width: 90px;
  height: 22px;
  background: #1a1a2e;
  border-radius: 0 0 1rem 1rem;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.phone-screen {
  border-radius: 2rem;
  overflow: hidden;
  background: #ECE5DD;
  position: relative;
}

.phone-chat-body {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 280px;
  background:
    linear-gradient(180deg, rgba(236,229,221,0.3) 0%, rgba(236,229,221,0) 40%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ===== Chat Messages (Phone) ===== */
.chat-msg {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.45;
  border-radius: 0.75rem;
  position: relative;
  word-break: break-word;
}

.chat-msg.sent {
  background: #D9FDD3;
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
  color: #111;
}

.chat-msg.recv {
  background: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
  color: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ===== Chat Messages (Mini — Use Case Cards) ===== */
.chat-mini {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  border-radius: 0.875rem;
  max-width: 88%;
}

.chat-mini.sent {
  background: #D9FDD3;
  margin-left: auto;
  border-bottom-right-radius: 0.25rem;
}

.chat-mini.recv {
  background: #fff;
  margin-right: auto;
  border-bottom-left-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ===== Form States ===== */
#waitlist-form button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  .phone-frame {
    width: 260px;
    transform: rotate(0deg);
  }
  .phone-frame:hover {
    transform: translateY(-4px);
  }
}

@media (max-width: 639px) {
  .phone-frame {
    width: 240px;
  }
  .phone-chat-body {
    min-height: 240px;
  }
}

/* ===== Selection ===== */
::selection {
  background: rgba(31, 175, 110, 0.15);
  color: inherit;
}

/* ===== Focus Visible ===== */
:focus-visible {
  outline: 2px solid #1FAF6E;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Smooth scroll ===== */
html {
  scroll-behavior: smooth;
}
