/* =========================================================
   Shared motion layer — used by all three site iterations.
   Calm, deliberate movement: nothing bounces or flashes.
   Every animation is disabled under prefers-reduced-motion.
   ========================================================= */

:root {
  --m-paprika: #d36135;
  --m-rust:    #a24936;
  --m-teal:    #83bca9;
  --m-gold:    #c69a3e;
  --m-green:   #3e5641;
  --m-substack:#ff6719;
}

/* ---------- Rotating taiji ----------
   Slow enough to read as breathing, not spinning. */
.taiji {
  display: inline-block;
  width: clamp(46px, 6vw, 74px);
  height: auto;
  animation: taiji-spin 34s linear infinite;
  transform-origin: 50% 50%;
}
.taiji-lg { width: clamp(84px, 12vw, 148px); }
@keyframes taiji-spin { to { transform: rotate(360deg); } }

/* pairs with the taiji: a slow counter-rotating ring */
.ring-counter { animation: taiji-spin 52s linear infinite reverse; transform-origin: 50% 50%; }

/* ---------- Attention text ----------
   Large type that shifts through the brand palette. Applied to the
   single most important line on a page, never to body copy. */
/* Solid colour first. `color: transparent` is applied ONLY inside the
   @supports guard — otherwise a browser without background-clip:text would
   render the headline invisible, which on a live homepage is catastrophic. */
.attn { color: var(--m-rust); }

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .attn {
    background-image: linear-gradient(
      100deg,
      var(--m-rust) 0%, var(--m-paprika) 26%, var(--m-gold) 50%,
      var(--m-teal) 74%, var(--m-rust) 100%
    );
    background-size: 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: attn-shift 14s ease-in-out infinite;
  }
}
@keyframes attn-shift {
  0%, 100% { background-position:   0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* A quieter variant: colour sits still until hovered or scrolled to. */
.attn-soft { color: var(--m-paprika); transition: color 0.6s ease; }
.attn-soft:hover { color: var(--m-teal); }

/* ---------- Underline that draws itself in ---------- */
.rule-draw {
  position: relative;
  display: inline-block;
}
.rule-draw::after {
  content: "";
  position: absolute;
  left: 0; bottom: -0.16em;
  height: 2px;
  width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.85s cubic-bezier(.22,.61,.36,1);
}
.rule-draw.in::after,
[data-reveal].in .rule-draw::after { transform: scaleX(1); }

/* ---------- Substack button ----------
   An organic blob rather than a pill: the border-radius morphs slowly on
   eight axes, the gradient drifts underneath it, and a light sweep passes
   across the face. Reads hand-drawn rather than framework-default. */
.btn-substack,
.substack-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 0;
  color: #fff;
  background-image: linear-gradient(
    116deg,
    #ff6719 0%, #d36135 34%, #a24936 62%, #ff8a3d 100%
  );
  background-size: 220% 220%;
  border-radius: 62% 38% 55% 45% / 48% 56% 44% 52%;
  animation:
    blob-morph 15s ease-in-out infinite,
    blob-drift 11s ease-in-out infinite,
    substack-breathe 4.6s ease-in-out infinite;
}
/* the shape itself breathes between eight asymmetric radii */
@keyframes blob-morph {
  0%, 100% { border-radius: 62% 38% 55% 45% / 48% 56% 44% 52%; }
  33%      { border-radius: 44% 56% 38% 62% / 58% 42% 60% 40%; }
  66%      { border-radius: 56% 44% 63% 37% / 40% 61% 43% 57%; }
}
/* the gradient wanders beneath the shape */
@keyframes blob-drift {
  0%, 100% { background-position:   0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes substack-breathe {
  0%, 100% { box-shadow: 0 10px 26px -14px rgba(255,103,25,0.50); }
  50%      { box-shadow: 0 16px 38px -12px rgba(211, 97, 53,0.80); }
}
/* light sweep */
.btn-substack::before,
.substack-cta::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.42), transparent);
  transform: skewX(-18deg);
  animation: substack-sweep 5.2s ease-in-out infinite;
  z-index: -1;
}
@keyframes substack-sweep {
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}
.btn-substack:hover,
.substack-cta:hover { transform: translateY(-2px); }
/* arrow steps forward */
.btn-substack .arrow-step,
.substack-cta .arrow-step {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(.22,.61,.36,1);
}
.btn-substack:hover .arrow-step,
.substack-cta:hover .arrow-step { transform: translateX(6px); }

/* ---------- Slow float ---------- */
.float-slow { animation: float-slow 8s ease-in-out infinite; }
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

/* ---------- Reveal on scroll (shared) ---------- */
[data-motion] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s cubic-bezier(.22,.61,.36,1),
              transform 0.9s cubic-bezier(.22,.61,.36,1);
}
[data-motion].in { opacity: 1; transform: none; }

/* =========================================================
   Reduced motion — hold everything still, keep it legible.
   .attn keeps its gradient but stops moving.
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .taiji, .ring-counter, .float-slow,
  .btn-substack, .substack-cta,
  .btn-substack::before, .substack-cta::before { animation: none !important; }
  .attn { animation: none; background-position: 30% 50%; }
  .rule-draw::after { transition: none; transform: scaleX(1); }
  [data-motion] { opacity: 1 !important; transform: none !important; }
}

/* =========================================================
   Reusable dissolve
   Any heading can fracture. Wrap it:
     <span class="dissolve-line" data-dissolve>
       <span class="dl-ghost dl-a" aria-hidden="true">TEXT</span>
       <span class="dl-ghost dl-b" aria-hidden="true">TEXT</span>
       <span class="dl-front">TEXT</span>
     </span>
   js/motion.js drives the offsets from scroll position.
   ========================================================= */
.dissolve-line {
  position: relative;
  display: inline-block;
  isolation: isolate;
}
.dissolve-line .dl-ghost {
  position: absolute;
  top: 0; left: 0;
  white-space: inherit;
  pointer-events: none;
  will-change: transform, opacity, filter;
  z-index: 0;
}
.dissolve-line .dl-front {
  position: relative;
  z-index: 1;
  will-change: transform;
}
/* default palette; each page overrides these two */
.dissolve-line .dl-a { color: rgba(201, 72, 42, 0.46); }
.dissolve-line .dl-b { color: rgba(131,188,169, 0.40); }

/* =========================================================
   Worn handmade paper
   Layered fibre grain + uneven tint. No ruled lines.
   ========================================================= */
.paper-worn {
  position: relative;
  background-color: #f0ebdf;
  background-image:
    radial-gradient(ellipse 90% 60% at 12% 8%,  rgba(160,140,110,0.10), transparent 62%),
    radial-gradient(ellipse 70% 50% at 88% 26%, rgba(140,120,95,0.09),  transparent 60%),
    radial-gradient(ellipse 80% 55% at 30% 72%, rgba(150,132,104,0.08), transparent 64%),
    radial-gradient(ellipse 60% 45% at 76% 94%, rgba(120,104,82,0.07),  transparent 58%);
}
/* fibre grain, generated rather than fetched */
.paper-worn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23f)' opacity='0.5'/%3E%3C/svg%3E");
}
.paper-worn > * { position: relative; z-index: 1; }

/* torn / deckled edge for organic section breaks */
.deckle-top,
.deckle-bottom { position: relative; }
.deckle-top::before,
.deckle-bottom::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18px;
  background: inherit;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 18' preserveAspectRatio='none'%3E%3Cpath d='M0,9 C60,2 120,16 190,8 C260,1 320,15 400,9 C470,4 540,17 620,10 C690,3 760,15 840,8 C910,2 980,16 1060,9 C1120,4 1160,12 1200,8 L1200,18 L0,18 Z' fill='%23000'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 18' preserveAspectRatio='none'%3E%3Cpath d='M0,9 C60,2 120,16 190,8 C260,1 320,15 400,9 C470,4 540,17 620,10 C690,3 760,15 840,8 C910,2 980,16 1060,9 C1120,4 1160,12 1200,8 L1200,18 L0,18 Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}
.deckle-top::before    { top: -17px; transform: scaleY(-1); }
.deckle-bottom::after  { bottom: -17px; }

/* organic blob framing for images and callouts */
.organic-frame {
  border-radius: 58% 42% 47% 53% / 44% 51% 49% 56%;
  overflow: hidden;
  animation: blob-morph 22s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .organic-frame { animation: none; }
  .dissolve-line .dl-ghost { display: none; }
}

/* =========================================================
   Booking CTA — tasteful attention
   Targeted by href so every booking button on the site gets it.
   A soft ring breathes outward from the edge; nothing bounces.
   ========================================================= */
a[href*="calendar.app.google"] { position: relative; }

a[href*="calendar.app.google"].btn::after,
a[href*="calendar.app.google"].btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid currentColor;
  opacity: 0;
  pointer-events: none;
  animation: cta-ring 3.8s cubic-bezier(.22,.61,.36,1) infinite;
}
@keyframes cta-ring {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.18); opacity: 0;    }
  100% { transform: scale(1.18); opacity: 0;    }
}
/* the button itself lifts and warms very slightly on the same cadence */
a[href*="calendar.app.google"].btn-primary {
  animation: cta-breathe 3.8s ease-in-out infinite;
}
@keyframes cta-breathe {
  0%, 100% { box-shadow: 0 4px 14px -8px rgba(211,97,53,0.55); }
  50%      { box-shadow: 0 10px 26px -10px rgba(211,97,53,0.85); }
}

@media (prefers-reduced-motion: reduce) {
  a[href*="calendar.app.google"].btn::after,
  a[href*="calendar.app.google"].btn-primary::after,
  a[href*="calendar.app.google"].btn-primary { animation: none !important; }
  a[href*="calendar.app.google"].btn::after { opacity: 0; }
}
