/* Base, typography and reusable clay components. Sections live in sections.css. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--clay-canvas);
  color: var(--clay-foreground);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.625;
  font-weight: 500;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--clay-accent);
}

h1,
h2,
h3,
h4,
.display {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 4px solid rgba(124, 58, 237, 0.35);
  outline-offset: 3px;
  border-radius: var(--r-control);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--r-control);
  background: var(--clay-card-solid);
  box-shadow: var(--shadow-card);
  font-weight: 700;
}

.skip-link:focus {
  top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Type scale ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: var(--clay-card-bg);
  box-shadow: var(--shadow-card);
  color: var(--clay-accent);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title {
  font-size: clamp(1.875rem, 4.2vw + 0.6rem, 3rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.section-lede {
  max-width: 40rem;
  color: var(--clay-muted);
  font-size: clamp(1rem, 0.4vw + 0.95rem, 1.125rem);
}

.section-head {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
  margin-bottom: clamp(40px, 6vw, 64px);
}

/* Gradient text is reserved for 3rem+ display sizes */
.text-gradient {
  background: linear-gradient(
    120deg,
    var(--clay-foreground) 20%,
    var(--clay-accent) 60%,
    var(--clay-accent-alt)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Ambient background blobs ---------- */

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

.ambient span {
  position: absolute;
  width: 60vh;
  height: 60vh;
  border-radius: 50%;
  filter: blur(64px);
}

.ambient span:nth-child(1) {
  top: -10%;
  left: -10%;
  background: rgba(139, 92, 246, 0.14);
  animation: clay-float 8s ease-in-out infinite;
}

.ambient span:nth-child(2) {
  top: 20%;
  right: -10%;
  background: rgba(236, 72, 153, 0.11);
  animation: clay-float-delayed 10s ease-in-out infinite 2s;
}

.ambient span:nth-child(3) {
  bottom: -15%;
  left: 20%;
  background: rgba(14, 165, 233, 0.11);
  animation: clay-float-slow 12s ease-in-out infinite 4s;
}

.ambient span:nth-child(4) {
  top: 55%;
  left: -12%;
  width: 45vh;
  height: 45vh;
  background: rgba(16, 185, 129, 0.08);
  animation: clay-float-delayed 11s ease-in-out infinite 1s;
}

/* ---------- Buttons ---------- */

.btn {
  --btn-h: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 28px;
  border: 0;
  border-radius: var(--r-control);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-bounce),
    box-shadow var(--t-fast) ease,
    background-color var(--t-fast) ease,
    color var(--t-fast) ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-4px);
}

.btn:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-pressed);
}

.btn--primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-button);
}

.btn--primary:hover {
  box-shadow: var(--shadow-button-hover);
}

.btn--secondary {
  background: var(--clay-card-solid);
  color: var(--clay-foreground);
  box-shadow: var(--shadow-button-soft);
}

.btn--ghost {
  background: transparent;
  color: var(--clay-foreground);
}

.btn--ghost:hover {
  background: rgba(124, 58, 237, 0.1);
  color: var(--clay-accent);
  transform: none;
}

.btn--sm {
  --btn-h: 44px;
  padding: 0 18px;
  font-size: 0.9375rem;
}

.btn--lg {
  --btn-h: 64px;
  padding: 0 34px;
  font-size: 1.1875rem;
}

.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3vw, 32px);
  border-radius: var(--r-card);
  background: var(--clay-card-bg);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  transition:
    transform var(--t-slow) var(--ease-soft),
    box-shadow var(--t-slow) var(--ease-soft);
}

.card--lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-card-hover);
}

.card__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card h3 {
  font-size: clamp(1.25rem, 1vw + 1rem, 1.5rem);
  font-weight: 800;
  line-height: 1.2;
}

.card p {
  color: var(--clay-muted);
}

/* ---------- Icon orbs ---------- */

.orb-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: var(--r-icon);
  color: #fff;
  box-shadow: var(--shadow-orb);
}

.orb-icon svg {
  width: 28px;
  height: 28px;
}

.orb-icon--round {
  border-radius: 50%;
}

.g-violet { background: var(--grad-violet); }
.g-pink { background: var(--grad-pink); }
.g-sky { background: var(--grad-sky); }
.g-emerald { background: var(--grad-emerald); }
.g-amber { background: var(--grad-amber); }
.g-blue { background: var(--grad-blue); }
.g-primary { background: var(--grad-primary); }

/* ---------- Recessed input ---------- */

.input {
  width: 100%;
  min-height: 64px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--clay-well);
  box-shadow: var(--shadow-pressed);
  color: var(--clay-foreground);
  font: 700 1.125rem/1 var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition:
    background-color var(--t-fast) ease,
    box-shadow var(--t-fast) ease;
}

.input::placeholder {
  color: var(--clay-muted);
  letter-spacing: 0.06em;
  text-transform: none;
  font-weight: 600;
}

.input:focus {
  outline: none;
  background: var(--clay-card-solid);
  box-shadow:
    0 0 0 4px rgba(124, 58, 237, 0.2),
    var(--shadow-card);
}

/* ---------- Pill badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  box-shadow: var(--shadow-orb);
}

/* ---------- Clay switch ---------- */

.switch {
  position: relative;
  flex: none;
  width: 64px;
  height: 36px;
  border: 0;
  padding: 0;
  border-radius: var(--r-pill);
  background: var(--clay-well);
  box-shadow: var(--shadow-pressed);
  cursor: pointer;
  transition: background var(--t-med) ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    4px 4px 8px rgba(160, 150, 180, 0.35),
    inset -2px -2px 4px rgba(160, 150, 180, 0.2);
  transition: transform var(--t-med) var(--ease-bounce);
}

.switch[aria-checked="true"] {
  background: var(--grad-emerald);
  box-shadow:
    inset 4px 4px 8px rgba(0, 0, 0, 0.12),
    inset -4px -4px 8px rgba(255, 255, 255, 0.25);
}

.switch[aria-checked="true"]::after {
  transform: translateX(28px);
}

/* ---------- Blob companion ---------- */

.blob {
  --blob-hue: 260deg;
  position: relative;
  aspect-ratio: 1;
  width: 100%;
}

.blob img,
.blob .blob__z {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.blob__body,
.blob__eyes {
  filter: hue-rotate(var(--blob-hue));
}

.blob__eyes,
.blob__acc {
  transition: opacity var(--t-fast) ease;
}

.blob:not(.is-awake) .blob__eyes,
.blob:not(.is-awake) .blob__acc {
  opacity: 0;
}

/* The z frames are drawn white for the app's dark theme; mask-tint them violet here */
/* All nine z frames live in one pre-tinted sprite strip; playback just slides the
   background, so there is a single image to load/decode and nothing swaps mid-burst. */
.blob__z {
  opacity: 0;
  pointer-events: none;
  background: url("../assets/blob/z-strip.png") 0 0 / 900% 100% no-repeat;
}

.blob__sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.blob__sparkles img {
  position: absolute;
  inset: auto;
  width: var(--s, 10%);
  height: auto;
  opacity: 0;
  transform: scale(0.2) rotate(-40deg);
  transition:
    opacity var(--t-med) ease,
    transform 600ms var(--ease-bounce);
  filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.35));
}

.blob__sparkles img.is-on {
  opacity: 1;
  transform: scale(1) rotate(0);
  animation: sparkle-twinkle 2.4s ease-in-out infinite;
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 700ms var(--ease-soft),
    transform 700ms var(--ease-soft);
  transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.no-js .reveal {
  opacity: 1;
  transform: none;
}

/* ---------- Keyframes ---------- */

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

@keyframes clay-float-delayed {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(-2deg); }
}

@keyframes clay-float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(5deg); }
}

@keyframes clay-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes sparkle-twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(0.8) rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
