/* ============================================================
   TABULA RASA pet — decorative & motion layer
   Calm, architectural decor + text animations.
   ============================================================ */

:root {
  --fx-ease: cubic-bezier(.22, 1, .36, 1);
  --fx-grain-opacity: .045;
}
.dark { --fx-grain-opacity: .06; }

body { background: var(--background); }
#root > .bg-background { background: transparent; }

/* ---------- Ambient aurora (behind everything) ---------- */
.fx-aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.fx-aurora i {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  will-change: transform;
}
.fx-aurora i:nth-child(1) {
  width: 46vmax; height: 46vmax; left: -14vmax; top: 20vh;
  background: color-mix(in srgb, var(--sage) 85%, transparent);
  animation: fx-drift-a 34s ease-in-out infinite alternate;
}
.fx-aurora i:nth-child(2) {
  width: 40vmax; height: 40vmax; right: -12vmax; top: 55vh;
  background: color-mix(in srgb, var(--blush) 80%, transparent);
  animation: fx-drift-b 40s ease-in-out infinite alternate;
}
.fx-aurora i:nth-child(3) {
  width: 32vmax; height: 32vmax; left: 35vw; top: 110vh;
  background: color-mix(in srgb, var(--butter) 90%, transparent);
  animation: fx-drift-c 46s ease-in-out infinite alternate;
}
.dark .fx-aurora i { opacity: .35; }
@keyframes fx-drift-a { to { transform: translate3d(18vw, -12vh, 0) scale(1.15); } }
@keyframes fx-drift-b { to { transform: translate3d(-22vw, -30vh, 0) scale(.9); } }
@keyframes fx-drift-c { to { transform: translate3d(-15vw, -70vh, 0) scale(1.2); } }

/* ---------- Paper grain ---------- */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 90; pointer-events: none;
  opacity: var(--fx-grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.23 0 0 0 0 0.2 0 0 0 0 0.18 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: fx-grain 1.2s steps(4) infinite;
}
@keyframes fx-grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Architectural rulers on the edges (wide screens) ---------- */
.fx-rulers { display: none; }
@media (min-width: 1280px) {
  .fx-rulers {
    display: block; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  }
  .fx-rulers span {
    position: absolute; top: 96px; bottom: 32px; width: 9px;
    background:
      linear-gradient(var(--line), var(--line)) 0 0 / 1px 100% no-repeat,
      repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 24px) 0 0 / 5px 100% no-repeat,
      repeating-linear-gradient(to bottom, color-mix(in srgb, var(--foreground) 22%, transparent) 0 1px, transparent 1px 120px) 0 0 / 9px 100% no-repeat;
    opacity: .9;
  }
  .fx-rulers span:first-child { left: 18px; }
  .fx-rulers span:last-child { right: 18px; transform: scaleX(-1); }
  .fx-rulers b {
    position: absolute; left: -3px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent);
    top: calc(var(--fx-progress, 0) * 100%);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
    transition: top .25s linear;
  }
  .fx-rulers em {
    position: absolute; left: 16px; font-style: normal; font-size: 9px;
    letter-spacing: .2em; color: var(--muted); writing-mode: vertical-rl;
    top: calc(var(--fx-progress, 0) * 100% - 4px); transition: top .25s linear;
    font-variant-numeric: tabular-nums;
  }
  .fx-rulers span:last-child em { transform: scaleX(-1); }
}

/* ---------- Cursor glow ---------- */
.fx-cursor {
  position: fixed; left: 0; top: 0; z-index: -1; pointer-events: none;
  width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 62%);
  opacity: 0; transition: opacity .6s ease;
  will-change: transform;
}
.fx-cursor.is-on { opacity: 1; }
.dark .fx-cursor { background: radial-gradient(circle, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 62%); }

/* ---------- Accent serif words: shimmer + hand-drawn underline ---------- */
.fx-accent {
  position: relative; display: inline-block;
  background: linear-gradient(100deg,
    var(--accent) 0%, var(--accent) 38%,
    color-mix(in srgb, var(--accent) 45%, var(--butter)) 50%,
    var(--accent) 62%, var(--accent) 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-shimmer 7s var(--fx-ease) infinite;
  padding-right: .06em; /* italic overhang */
}
@keyframes fx-shimmer {
  0%, 55% { background-position: 100% 0; }
  100% { background-position: -60% 0; }
}
.fx-accent > .fx-swoosh {
  position: absolute; left: -2%; right: -2%; bottom: -.12em; height: .32em;
  width: 104%; overflow: visible; pointer-events: none;
}
.fx-swoosh path {
  fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .7;
  transition: stroke-dashoffset 1.3s var(--fx-ease) .35s;
}
.fx-accent[data-fx-in] .fx-swoosh path { stroke-dashoffset: 0; }

/* ---------- Eyebrow labels: growing line + letter-spacing settle ---------- */
.fx-eyebrow {
  display: inline-flex; align-items: center; gap: .9em;
}
.fx-eyebrow::before {
  content: ""; display: inline-block; height: 1px; width: 0;
  background: currentColor; transition: width 1s var(--fx-ease) .1s;
}
.fx-eyebrow[data-fx-in]::before { width: 26px; }
.fx-eyebrow:not([data-fx-in]) { letter-spacing: .55em; opacity: 0; }
.fx-eyebrow {
  transition: letter-spacing 1.1s var(--fx-ease), opacity .8s ease;
}

/* ---------- Headings: soft ink sweep (left → right) ---------- */
.fx-sweep {
  -webkit-mask-image: linear-gradient(90deg, #000 0 45%, transparent 55% 100%);
  mask-image: linear-gradient(90deg, #000 0 45%, transparent 55% 100%);
  -webkit-mask-size: 240% 100%; mask-size: 240% 100%;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transition: -webkit-mask-position 1.6s var(--fx-ease) .1s, mask-position 1.6s var(--fx-ease) .1s;
}
.fx-sweep[data-fx-in] { -webkit-mask-position: 0 0; mask-position: 0 0; }
.fx-sweep[data-fx-done] { -webkit-mask-image: none; mask-image: none; }

/* ---------- Hero title: gentle letter wave on the accent word ---------- */
.fx-hero-title .fx-accent { animation: fx-shimmer 7s var(--fx-ease) infinite, fx-float 6s ease-in-out infinite; }
@keyframes fx-float { 50% { transform: translateY(-.05em) rotate(-1deg); } }

/* ---------- Rotating seal badge in hero ---------- */
.fx-seal {
  position: absolute; z-index: 3; right: -18px; top: -22px;
  width: 112px; height: 112px; pointer-events: none;
  color: var(--foreground);
  opacity: 0; transform: scale(.6) rotate(-30deg);
  animation: fx-seal-in 1.2s var(--fx-ease) 1s forwards;
}
.fx-seal-inner {
  position: absolute; inset: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -28px rgba(59, 51, 45, .6);
}
.fx-seal svg.fx-seal-text { position: absolute; inset: 0; animation: fx-spin 22s linear infinite; }
.fx-seal svg.fx-seal-text text {
  font-size: 9.4px; letter-spacing: .24em; text-transform: uppercase; fill: currentColor;
}
.fx-seal .fx-seal-paw {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
  margin: -15px 0 0 -15px; color: var(--accent);
  animation: fx-beat 2.6s ease-in-out infinite;
}
@keyframes fx-seal-in { to { opacity: 1; transform: none; } }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@keyframes fx-beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.14); } 24% { transform: scale(.98); } 36% { transform: scale(1.08); } }
@media (max-width: 640px) { .fx-seal { width: 88px; height: 88px; right: -6px; top: -16px; } .fx-seal svg.fx-seal-text text { font-size: 9.6px; } }

/* ---------- Marquee ribbon ---------- */
.fx-marquee {
  position: relative; overflow: hidden; padding: 22px 0;
  border-block: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  opacity: 0; transform: translateY(16px);
  transition: opacity 1s ease, transform 1s var(--fx-ease);
}
.fx-marquee[data-fx-in] { opacity: 1; transform: none; }
.fx-marquee-track {
  display: flex; width: max-content;
  animation: fx-marquee 48s linear infinite;
}
.fx-marquee:hover .fx-marquee-track { animation-play-state: paused; }
.fx-marquee-group { display: flex; align-items: center; flex-shrink: 0; }
.fx-marquee-item {
  display: inline-flex; align-items: center; gap: 28px; padding-right: 28px;
  font-size: clamp(1.4rem, 3.2vw, 2.3rem); line-height: 1; white-space: nowrap;
  letter-spacing: -.02em; color: var(--foreground);
}
.fx-marquee-item:nth-child(even) {
  font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 500;
  color: var(--accent); letter-spacing: 0;
}
.fx-marquee-item:nth-child(odd) { font-weight: 600; }
.fx-marquee-star {
  width: .5em; height: .5em; flex-shrink: 0; color: var(--accent); opacity: .55;
  animation: fx-spin 9s linear infinite;
}
@keyframes fx-marquee { to { transform: translateX(-50%); } }

/* ---------- Ornamental divider between sections ---------- */
.fx-divider {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  max-width: 1500px; margin: 0 auto; padding: 0 20px;
  color: var(--accent); pointer-events: none;
}
.fx-divider::before, .fx-divider::after {
  content: ""; height: 1px; flex: 1; max-width: 220px;
  background: linear-gradient(90deg, transparent, var(--line));
  transform: scaleX(0); transition: transform 1.4s var(--fx-ease);
}
.fx-divider::before { transform-origin: right; }
.fx-divider::after { background: linear-gradient(90deg, var(--line), transparent); transform-origin: left; }
.fx-divider[data-fx-in]::before, .fx-divider[data-fx-in]::after { transform: scaleX(1); }
.fx-divider svg {
  width: 16px; height: 16px; opacity: 0; transform: rotate(-90deg) scale(.4);
  transition: opacity .8s ease .3s, transform 1.2s var(--fx-ease) .3s;
}
.fx-divider[data-fx-in] svg { opacity: .6; transform: none; }

/* ---------- Cards: cursor spotlight ---------- */
[data-fx-spot] { position: relative; }
[data-fx-spot]::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%);
  opacity: 0; transition: opacity .45s ease; z-index: 1;
}
[data-fx-spot]:hover::after { opacity: 1; }

/* ---------- Buttons: sheen ---------- */
a.rounded-full.bg-accent, a.rounded-full.bg-foreground, .soft-panel a.rounded-full {
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform .35s var(--fx-ease), background-color .2s, color .2s, border-color .2s;
}
a.rounded-full.bg-accent::before, a.rounded-full.bg-foreground::before, .soft-panel a.rounded-full::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  transform: translateX(-120%);
}
a.rounded-full.bg-accent:hover::before, a.rounded-full.bg-foreground:hover::before, .soft-panel a.rounded-full:hover::before {
  transform: translateX(120%); transition: transform .9s var(--fx-ease);
}

/* ---------- Text selection ---------- */
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--foreground); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-aurora i, body::after, .fx-marquee-track, .fx-marquee-star, .fx-seal, .fx-seal svg.fx-seal-text,
  .fx-seal .fx-seal-paw, .fx-accent, .fx-hero-title .fx-accent { animation: none !important; }
  .fx-seal { opacity: 1; transform: none; }
  .fx-cursor { display: none; }
  .fx-sweep { -webkit-mask-image: none; mask-image: none; }
  .fx-eyebrow:not([data-fx-in]) { letter-spacing: inherit; opacity: 1; }
  .fx-marquee { opacity: 1; transform: none; }
  .fx-swoosh path { stroke-dashoffset: 0; transition: none; }
  .fx-marquee-track { flex-wrap: wrap; }
}
