/* ============================================================
   craft.css — the finish pass (Candy Chrome)
   Grain, holo borders, masked reveals, sparkle, telemetry.
   Loaded last so it wins on equal specificity.
   ============================================================ */

/* ---------- 1. fine grain, multiplied so it reads on a light page ---------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.032;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 2. masked dot grid behind the hero ---------- */

.hero-dots {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 45%, transparent) 1.4px, transparent 1.4px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(ellipse 72% 58% at 50% 0%, #000 22%, transparent 74%);
  mask-image: radial-gradient(ellipse 72% 58% at 50% 0%, #000 22%, transparent 74%);
  opacity: 0.5;
}

/* ---------- 3. numbers never jitter ---------- */

.stat-num,
.dc-price,
.dc-live-num,
.pstat b,
.inv-price,
.readout b,
.dc-chart-head b {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- 4. blur-up reveal ---------- */

.reveal {
  filter: blur(7px);
  transition:
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-in { filter: none; }

/* ---------- 5. masked line reveal on the hero headline ---------- */

.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.hero-title .line-in {
  display: block;
  transform: translateY(112%);
  animation: lineUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-title .line:nth-child(2) .line-in { animation-delay: 0.11s; }
.hero-title .line:nth-child(3) .line-in { animation-delay: 0.22s; }

@keyframes lineUp {
  to { transform: translateY(0); }
}

/* ---------- 6. sparkles drifting through the hero ---------- */

.sparkles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.sparkles i {
  position: absolute;
  width: 12px;
  height: 12px;
  opacity: 0;
  background: var(--holo);
  background-size: 200% 100%;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.6 6.6 4.8 11 12 12-7.2 1-11.4 5.4-12 12-.6-6.6-4.8-11-12-12C7.2 11 11.4 6.6 12 0z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0c.6 6.6 4.8 11 12 12-7.2 1-11.4 5.4-12 12-.6-6.6-4.8-11-12-12C7.2 11 11.4 6.6 12 0z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: twinkle 4.5s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  45%      { opacity: 1; transform: scale(1.15) rotate(45deg); }
  70%      { opacity: 0.35; transform: scale(0.75) rotate(80deg); }
}

/* ---------- 7. cursor spotlight on the domain grid ---------- */

.domain-card { position: relative; isolation: isolate; }

/* glowing 1px ring, clipped to the border via mask-composite */
.domain-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--blue) 70%, transparent),
    color-mix(in srgb, var(--pink) 40%, transparent) 45%,
    transparent 72%
  );
  -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 var(--ease);
  pointer-events: none;
  z-index: 2;
}

/* soft interior wash */
.domain-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    360px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--blue) 9%, transparent),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
  z-index: -1;
}

.domain-grid:hover .domain-card::before,
.domain-grid:hover .domain-card::after { opacity: 1; }

/* ---------- 8. the one featured listing gets a holographic orbit ---------- */

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.domain-card.is-featured {
  border-color: transparent;
  background: linear-gradient(170deg, #FFFFFF, var(--lilac-pale) 55%, var(--blush));
  box-shadow: inset 0 1px 0 #fff, 0 26px 60px -30px rgba(180, 156, 255, 0.85);
}

/* Masked to a 2px ring so it paints over the card rather than behind it —
   a negative z-index would be swallowed by the card's stacking context. */
.domain-card.is-featured > .feature-ring {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  z-index: 3;
  background: conic-gradient(
    from var(--angle),
    #FFB3D9, #C9B6FF, #9ED8FF, #BFF3EA, #FFE3B8, #FFB3D9
  );
  -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;
  pointer-events: none;
}

/* Animating a conic gradient repaints the whole card every frame, which is
   real jank on a phone. The ring is iridescent standing still; it only
   orbits while the card is actually being hovered. */
@media (hover: hover) {
  .domain-card.is-featured:hover > .feature-ring {
    animation: orbit 5s linear infinite;
  }
}

@keyframes orbit {
  to { --angle: 360deg; }
}

.feature-flag {
  position: absolute;
  top: -1px;
  right: 20px;
  transform: translateY(-50%);
  z-index: 4;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #4A2B6B;
  background: var(--holo);
  background-size: 220% 100%;
  animation: holoshift 6s linear infinite;
  padding: 4px 11px;
  border-radius: 999px;
  box-shadow: 0 4px 12px -6px rgba(180, 156, 255, 0.9);
}

/* ---------- 9. lease framing on the card ---------- */

.dc-anchor {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-top: 5px;
}

.dc-anchor b { color: var(--ink-2); font-weight: 500; }

.dc-micro {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: -4px 0 0;
}

.dc-micro span { display: inline-flex; gap: 5px; }
.dc-micro b { color: var(--ink-2); font-weight: 500; }
.dc-micro .up { color: var(--mint-deep); }
.dc-micro .down { color: var(--pink-deep); }

/* ---------- 10. magnetic primary buttons ---------- */

.magnetic { will-change: transform; }

/* ---------- 11. reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero-title .line-in { transform: none; animation: none; }
  .hero-title .caught, .stat-num em, .feature-flag, .pulse { animation: none; }
  .domain-card.is-featured > .feature-ring { animation: none; }
  .sparkles { display: none; }
  .reveal { filter: none; }
}

/* ---------- 12. view transitions when the grid re-sorts ---------- */

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*) {
    animation-duration: 0.32s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }
}
