:root {
  --cream: #ece3f2;
  --cream-dark: #d6c6e3;
  --sage: #a8c09a;
  --sage-dark: #7a9870;
  --rose: #e8a5a5;
  --rose-dark: #d17b7b;
  --lavender: #c9b8dc;
  --lavender-deep: #a68fc7;
  --gold: #d4a94a;
  --ink: #3a2f28;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  background: linear-gradient(135deg, var(--cream) 0%, #e5d6ee 45%, var(--cream-dark) 100%);
  background-size: 200% 200%;
  background-attachment: fixed;
  animation: bgDrift 30s ease-in-out infinite alternate;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
@keyframes bgDrift {
  0%   { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

body {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

/* ── Ambient: blobs, grain, particles, cursor-glow ─────────── */
.ambient {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.6;
  will-change: transform;
  mix-blend-mode: multiply;
}
.blob-1 {
  width: 460px; height: 460px;
  top: -140px; left: -160px;
  background: var(--sage);
  animation: drift1 22s cubic-bezier(.4,0,.6,1) infinite alternate;
}
.blob-2 {
  width: 560px; height: 560px;
  top: 28%; right: -200px;
  background: var(--rose);
  animation: drift2 28s cubic-bezier(.4,0,.6,1) infinite alternate;
  opacity: 0.42;
}
.blob-3 {
  width: 500px; height: 500px;
  bottom: -160px; left: 28%;
  background: var(--lavender);
  animation: drift3 32s cubic-bezier(.4,0,.6,1) infinite alternate;
  opacity: 0.52;
}
.grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(58, 47, 40, 0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.5;
  mix-blend-mode: multiply;
  pointer-events: none;
}
@keyframes drift1 { to { transform: translate(50px, 40px) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-40px, 60px) scale(1.08); } }
@keyframes drift3 { to { transform: translate(70px, -40px) scale(1.12); } }

/* Floating particles — spawned by sparkle.js */
.particles {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none; overflow: hidden;
}
.particles .p {
  position: absolute;
  bottom: -4rem;
  left: var(--x, 50vw);
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(58, 47, 40, 0.12));
  animation: floatUp var(--dur, 14s) linear var(--delay, 0s) forwards;
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 0.9; }
  100% { transform: translate(var(--drift, 0), -110vh) rotate(360deg); opacity: 0; }
}

/* Cursor-follow glow */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 300px; height: 300px;
  margin: -150px 0 0 -150px;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle, rgba(201, 184, 220, 0.35) 0%, rgba(232, 165, 165, 0.15) 35%, transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  mix-blend-mode: screen;
  will-change: transform;
}

/* ── Main container ─────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 3;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 4vw, 2.5rem) 3rem;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  animation: fadeUp 0.9s cubic-bezier(.2,.7,.3,1) both;
}
.sparkle {
  font-size: 1.7rem;
  color: var(--gold);
  display: inline-block;
  margin-bottom: 0.3rem;
  animation: twinkle 3.2s ease-in-out infinite, floatY 5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(212, 169, 74, 0.5));
}

.title {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: 'SOFT' 60, 'opsz' 120;
  font-weight: 700;
  font-size: clamp(3.6rem, 12vw, 7rem);
  line-height: 1;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
  cursor: default;
  background: linear-gradient(
    135deg,
    var(--ink) 10%,
    var(--lavender-deep) 45%,
    var(--rose-dark) 70%,
    var(--gold) 95%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShift 9s ease-in-out infinite, titleBreath 6s ease-in-out infinite;
  transition: transform 0.4s cubic-bezier(.2,.9,.3,1.4);
}
.title:hover {
  transform: scale(1.02);
}
/* Glow copy behind the title */
.title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: inherit;
  background-size: inherit;
  -webkit-background-clip: inherit;
  background-clip: inherit;
  -webkit-text-fill-color: transparent;
  filter: blur(22px);
  opacity: 0.55;
  z-index: -1;
  animation: titleShift 9s ease-in-out infinite;
}

@keyframes titleShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes titleBreath {
  0%, 100% { letter-spacing: -0.02em; }
  50%      { letter-spacing: 0em; }
}

.tagline {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: color-mix(in srgb, var(--ink) 62%, transparent);
  margin: 0 auto;
  max-width: 36ch;
  line-height: 1.4;
}
.tagline .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px);
  animation: wordIn 0.55s cubic-bezier(.2,.7,.3,1.4) forwards;
  margin: 0 0.18em;
}
.tagline .word:nth-child(1) { animation-delay: 0.45s; }
.tagline .word:nth-child(2) { animation-delay: 0.53s; }
.tagline .word:nth-child(3) { animation-delay: 0.61s; }
.tagline .word:nth-child(4) { animation-delay: 0.69s; }
.tagline .word:nth-child(5) { animation-delay: 0.77s; }
.tagline .word:nth-child(6) { animation-delay: 0.85s; }
.tagline .word:nth-child(7) { animation-delay: 0.93s; }
.tagline .word:nth-child(8) { animation-delay: 1.01s; }
.tagline .word:nth-child(9) { animation-delay: 1.09s; }

@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ── App grid ──────────────────────────────────────────────────── */
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
  margin-bottom: 3rem;
  perspective: 1000px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.7rem 1.6rem 1.5rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 1.6rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 4px 24px rgba(58, 47, 40, 0.07);
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0) scale(1);
  transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1), box-shadow 0.35s ease, border-color 0.3s ease;
  animation: fadeUp 0.9s cubic-bezier(.2,.7,.3,1) both, cardBreathe 8s ease-in-out infinite;
  overflow: hidden;
  isolation: isolate;
}

/* Animated rainbow-border glow — only visible on hover */
.card .border-glow {
  position: absolute;
  inset: -2px;
  border-radius: 1.65rem;
  padding: 2px;
  background: conic-gradient(
    from var(--angle, 0deg),
    var(--accent, var(--lavender)),
    var(--gold),
    var(--rose),
    var(--lavender-deep),
    var(--accent, var(--lavender))
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 4;
  animation: spinBorder 3.5s linear infinite;
}
.card:hover .border-glow { opacity: 1; }
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes spinBorder {
  to { --angle: 360deg; }
}
/* Accent gradient wash */
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 55%, var(--accent, var(--lavender)) 180%);
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 0;
}
/* Shine sweep — animates across on hover */
.card::after {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 60%; height: 200%;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  transform: skewX(-20deg);
  transition: transform 0.9s cubic-bezier(.2,.8,.3,1);
  pointer-events: none;
  z-index: 1;
}
.card:hover::after,
.card:focus-visible::after {
  transform: translateX(260%) skewX(-20deg);
}

.card > * { position: relative; z-index: 2; }

.card:nth-child(1) { animation-delay: 0.15s, 0s; --accent: var(--sage); }
.card:nth-child(2) { animation-delay: 0.25s, 0.6s; --accent: var(--rose); }
.card:nth-child(3) { animation-delay: 0.35s, 1.2s; --accent: var(--gold); }
.card:nth-child(4) { animation-delay: 0.45s, 1.8s; --accent: var(--lavender); }

.card:hover,
.card:focus-visible {
  animation:
    fadeUp 0.9s cubic-bezier(.2,.7,.3,1) both,
    cardBounce 0.85s cubic-bezier(.34, 1.56, .64, 1) forwards;
  box-shadow:
    0 22px 56px rgba(58, 47, 40, 0.18),
    0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 60px color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
  outline: none;
  z-index: 5;
}
.card:hover::before,
.card:focus-visible::before {
  opacity: 0.42;
}

.card:active {
  transition-duration: 0.08s;
  transform: perspective(900px) translateY(-4px) scale(0.97);
}

@keyframes cardBreathe {
  0%, 100% { box-shadow: 0 4px 24px rgba(58, 47, 40, 0.07); }
  50%      { box-shadow: 0 8px 32px rgba(58, 47, 40, 0.11); }
}

/* Multi-stage bounce when card is hovered — springs up, overshoots,
   settles a few times. `forwards` keeps it at the elevated resting state. */
@keyframes cardBounce {
  0%   { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(0)    scale(1)    rotate(0deg); }
  22%  { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-28px) scale(1.09) rotate(-1.6deg); }
  44%  { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-2px)  scale(0.97) rotate(1.2deg); }
  64%  { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-18px) scale(1.05) rotate(-0.7deg); }
  82%  { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-8px)  scale(1.01) rotate(0.3deg); }
  100% { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-12px) scale(1.04) rotate(0deg); }
}

/* ── Icon animations ─────────────────────────────────────────── */
.card-icon {
  font-size: 2.6rem;
  line-height: 1;
  width: 3.8rem;
  height: 3.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 12px rgba(58, 47, 40, 0.08);
  transition: transform 0.45s cubic-bezier(.2,.9,.3,1.5), box-shadow 0.35s ease, background 0.35s ease;
  animation: iconBob 4.5s ease-in-out infinite;
  position: relative;
}
/* Colored glow halo on each card's accent */
.card-icon::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 1.4rem;
  background: radial-gradient(circle, var(--accent, var(--lavender)) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: -1;
  filter: blur(10px);
}
.card:hover .card-icon::after { opacity: 0.55; }

@keyframes iconBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(-2deg); }
}

/* Hover: icon goes all-in — spin, grow, settle bouncy */
.card:hover .card-icon {
  animation: iconParty 0.9s cubic-bezier(.34, 1.56, .64, 1) forwards;
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
@keyframes iconParty {
  0%   { transform: rotate(0)     scale(1);    }
  20%  { transform: rotate(-25deg) scale(1.25); }
  40%  { transform: rotate(200deg) scale(0.9);  }
  60%  { transform: rotate(340deg) scale(1.18); }
  80%  { transform: rotate(355deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1.14); }
}

.card-body h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: 'SOFT' 40, 'opsz' 36;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  color: var(--ink);
}
.card-body p {
  font-size: 0.93rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--ink) 68%, transparent);
  margin: 0 0 0.95rem;
}
.card-go {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--lavender-deep);
  display: inline-block;
  position: relative;
  transition: color 0.3s ease, letter-spacing 0.3s ease;
}
.card-go::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent, var(--lavender-deep)), var(--gold));
  border-radius: 2px;
  transition: width 0.45s cubic-bezier(.34, 1.56, .64, 1);
}
.card:hover .card-go {
  color: var(--accent, var(--rose-dark));
  letter-spacing: 0.08em;
  animation: ctaJump 0.6s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.card:hover .card-go::after { width: 100%; }
@keyframes ctaJump {
  0%   { transform: translateX(0); }
  35%  { transform: translateX(12px); }
  60%  { transform: translateX(2px); }
  80%  { transform: translateX(8px); }
  100% { transform: translateX(6px); }
}

/* Ripple — spawned on pointerdown */
.ripple {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(236, 106, 155, 0.55); /* pink */
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  animation: rippleOut 0.65s cubic-bezier(.2,.8,.3,1) forwards;
  z-index: 3;
}
@keyframes rippleOut {
  to { transform: translate(-50%, -50%) scale(40); opacity: 0; }
}

/* Coming-soon cards — same animations, just no internal gradient wash */
.card-soon {
  cursor: default;
  background: rgba(255, 255, 255, 0.55);
  border-style: dashed;
  border-color: rgba(166, 143, 199, 0.4);
}
.card-soon::before { display: none; }
.card-soon::after { display: none; }
.card-soon .card-icon {
  opacity: 0.85;
}
.card-go-soon {
  font-style: italic;
  color: color-mix(in srgb, var(--ink) 38%, transparent);
  font-weight: 500;
  cursor: default;
}
.card-go-soon::after { display: none !important; }
.card-soon:hover .card-go-soon {
  animation: none;
  transform: none;
  letter-spacing: 0.02em;
}

/* ── Title burst — spawned on tap ──────────────────────────────── */
.burst {
  position: fixed;
  font-size: 1.4rem;
  pointer-events: none;
  animation: burstOut 1.15s cubic-bezier(.2,.7,.3,1) forwards;
  z-index: 1000;
  filter: drop-shadow(0 2px 6px rgba(58, 47, 40, 0.15));
}
@keyframes burstOut {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3) rotate(180deg); opacity: 0; }
}

/* ── Footer ────────────────────────────────────────────────────── */
.foot {
  text-align: center;
  font-size: 0.88rem;
  color: color-mix(in srgb, var(--ink) 45%, transparent);
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  animation: fadeUp 1s ease 0.8s both, footFloat 6s ease-in-out infinite 2s;
}
@keyframes footFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.heart {
  color: var(--rose-dark);
  display: inline-block;
  animation: heart 2.4s ease-in-out infinite;
  transform-origin: center;
}

/* ── Shared keyframes ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
  50%      { opacity: 1;   transform: scale(1.3) rotate(28deg); }
}
@keyframes floatY {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -10px; }
}
@keyframes heart {
  0%, 100% { transform: scale(1); }
  25%      { transform: scale(1.22) rotate(-6deg); }
  50%      { transform: scale(0.96); }
  75%      { transform: scale(1.18) rotate(6deg); }
}

/* ── Responsive tightening ─────────────────────────────────────── */
@media (max-width: 520px) {
  .card { padding: 1.35rem 1.25rem 1.3rem; }
  .card-icon { font-size: 2.1rem; width: 3.2rem; height: 3.2rem; }
  .card-body h2 { font-size: 1.2rem; }
  .cursor-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
  }
  .title::after, .particles, .cursor-glow { display: none; }
}
