/* ==========================================================================
   MIRA MOTION CORE — «Золотая нить»
   Shared tokens + components for the landing and the service pages.
   Rules: content is visible without JS (only .js-motion hides things),
   reduced motion = no movement, animate transform/opacity/clip/mask only.
   ========================================================================== */

:root {
  --obsidian: #0f0c0a;
  --obsidian-dark: #090706;
  --obsidian-deep: #070504;
  --obsidian-raise: #17120e;
  --gold-primary: #c9a96e;
  --gold-light: #e6c88b;
  --gold-dark: #967842;
  --gold-glow: rgba(201, 169, 110, 0.25);
  --cream-primary: #faf7f2;
  --cream-secondary: rgba(250, 247, 242, 0.85);
  --cream-muted: rgba(250, 247, 242, 0.6);
  --cream-faint: rgba(250, 247, 242, 0.38);
  --hair: rgba(230, 200, 139, 0.16);
  --hair-strong: rgba(230, 200, 139, 0.32);

  --font-heading: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Montserrat', system-ui, sans-serif;

  --ease-silk: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-comb: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-pull: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%,
    1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%,
    1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%,
    1.003 76.9%, 1);

  --dur-tap: 180ms;
  --dur-ui: 420ms;
  --dur-reveal: 900ms;
  --dur-scene: 1400ms;
  --stagger: 70ms;

  --shadow-float: 0 40px 80px -40px rgba(0, 0, 0, 0.7), 0 18px 36px -18px rgba(150, 120, 66, 0.16);
  --shadow-glow: 0 0 48px rgba(201, 169, 110, 0.26);
  --inner-hi: inset 0 1px 0 rgba(255, 244, 220, 0.09);

  --bezel-r: 2rem;
  --bezel-pad: 0.375rem;
  --bezel-r-in: calc(var(--bezel-r) - var(--bezel-pad));
}

@property --reveal { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@property --sheen  { syntax: "<percentage>"; inherits: false; initial-value: -30%; }

/* --------------------------------------------------------------------------
   Thread progress (top of the viewport)
   -------------------------------------------------------------------------- */
.mm-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 1px;
  z-index: 70;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(150, 120, 66, 0), var(--gold-dark) 20%, var(--gold-light));
  transform-origin: 0 50%;
  transform: scaleX(var(--mm-progress, 0));
}
@supports (animation-timeline: scroll()) {
  .mm-progress { animation: mm-grow linear both; animation-timeline: scroll(root); }
  @keyframes mm-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* --------------------------------------------------------------------------
   Reveals (only hidden when JS + motion are on)
   -------------------------------------------------------------------------- */
.js-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 2.25rem, 0);
}
.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-reveal) var(--ease-comb), transform var(--dur-reveal) var(--ease-comb);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}
.js-motion [data-reveal="fade"] { transform: none; }

/* Service reveals ---------------------------------------------------------- */
/* СРЕЗ — стрижки */
.rv-cut { position: relative; }
.js-motion .rv-cut { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); }
.js-motion .rv-cut.is-in {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path 1.15s var(--ease-comb) calc(var(--i, 0) * var(--stagger));
}

/* РАСТЯЖКА — окрашивание: colour washes from roots to ends */
.js-motion .rv-wash {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(var(--reveal) - 22%), transparent var(--reveal));
  mask-image: linear-gradient(180deg, #000 calc(var(--reveal) - 22%), transparent var(--reveal));
}
.js-motion .rv-wash.is-in {
  --reveal: 140%;
  transition: --reveal 1.7s var(--ease-silk) calc(var(--i, 0) * var(--stagger));
}

/* ГЛЯНЕЦ — кератин */
.rv-sheen { position: relative; overflow: clip; }
.rv-sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent calc(var(--sheen) - 12%),
    rgba(255, 244, 220, 0.34) var(--sheen), transparent calc(var(--sheen) + 12%));
}
.js-motion .rv-sheen.is-in::after { --sheen: 130%; transition: --sheen 1.4s var(--ease-silk) 0.25s; }

/* ВОЛНА — укладка */
.js-motion .rv-wave { clip-path: inset(0 0 100% 0 round 0 0 50% 50%); }
.js-motion .rv-wave.is-in { clip-path: inset(0 0 0 0 round 0); transition: clip-path 1.2s var(--ease-comb); }

/* --------------------------------------------------------------------------
   Combed headings (lines rise from a mask)
   -------------------------------------------------------------------------- */
.js-motion [data-comb]:not(.is-combed) { opacity: 0; }
.comb-line { padding-bottom: 0.06em; margin-bottom: -0.06em; }

/* --------------------------------------------------------------------------
   Eyebrow pill
   -------------------------------------------------------------------------- */
.mm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.95rem 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: rgba(23, 18, 14, 0.6);
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-light);
}
.mm-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 10px var(--gold-light);
}

/* --------------------------------------------------------------------------
   Double bezel
   -------------------------------------------------------------------------- */
.mm-bezel {
  padding: var(--bezel-pad);
  border-radius: var(--bezel-r);
  background: linear-gradient(180deg, rgba(230, 200, 139, 0.07), rgba(230, 200, 139, 0.02));
  box-shadow: inset 0 0 0 1px var(--hair), var(--shadow-float);
}
.mm-bezel-core {
  position: relative;
  overflow: hidden;
  border-radius: var(--bezel-r-in);
  background: var(--obsidian-raise);
  box-shadow: var(--inner-hi);
}

/* --------------------------------------------------------------------------
   CTA: button-in-button + magnetic
   -------------------------------------------------------------------------- */
.mm-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.95rem;
  min-height: 56px;
  padding: 0.4rem 0.45rem 0.4rem 1.65rem;
  border-radius: 999px;
  border: 0;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--obsidian);
  text-decoration: none;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-primary) 55%, #b8955a 100%);
  box-shadow: 0 18px 40px -18px rgba(201, 169, 110, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  translate: var(--mx, 0) var(--my, 0);
  transition: translate var(--dur-ui) var(--ease-silk), scale var(--dur-tap) var(--ease-silk),
    box-shadow var(--dur-ui) var(--ease-silk);
  -webkit-tap-highlight-color: transparent;
}
.mm-cta::before {
  /* one shine sweep on enter */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
}
.mm-cta:hover::before,
.mm-cta:focus-visible::before { transform: translateX(120%); transition: transform 900ms var(--ease-silk); }
.mm-cta:hover { box-shadow: 0 24px 50px -18px rgba(201, 169, 110, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.mm-cta:active { scale: 0.98; }
.mm-cta:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 4px; }

.mm-cta-orb {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 12, 10, 0.12);
  box-shadow: inset 0 0 0 1px rgba(15, 12, 10, 0.08);
  transition: transform var(--dur-ui) var(--ease-silk), background var(--dur-ui) var(--ease-silk);
}
.mm-cta-orb svg { width: 16px; height: 16px; }
.mm-cta:hover .mm-cta-orb,
.mm-cta:focus-visible .mm-cta-orb { transform: translate(3px, -2px) scale(1.06); background: rgba(15, 12, 10, 0.2); }

.mm-cta--ghost {
  color: var(--cream-primary);
  background: rgba(250, 247, 242, 0.04);
  box-shadow: inset 0 0 0 1px var(--hair-strong);
}
.mm-cta--ghost::before { background: linear-gradient(105deg, transparent 35%, rgba(230, 200, 139, 0.16) 50%, transparent 65%); }
.mm-cta--ghost:hover { box-shadow: inset 0 0 0 1px rgba(230, 200, 139, 0.6); }
.mm-cta--ghost .mm-cta-orb { background: rgba(230, 200, 139, 0.1); color: var(--gold-light); }
.mm-cta--ghost:hover .mm-cta-orb { background: rgba(230, 200, 139, 0.2); }

/* --------------------------------------------------------------------------
   Pull-cord CTA («Дёрни за верёвочку — дверь и откроется»)
   -------------------------------------------------------------------------- */
.mm-pullcord {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}
.mm-pullcord-thread {
  display: block;
  width: 1px;
  height: var(--cord, 180px);
  background: linear-gradient(180deg, rgba(230, 200, 139, 0), var(--gold-light));
  transform-origin: 50% 0;
}
.mm-pullcord-tassel {
  position: relative;
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  margin-top: -2px;
  border-radius: 50%;
  text-decoration: none;
  touch-action: none;
  cursor: grab;
  color: var(--obsidian);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 250, 238, 0.85), transparent 45%),
    radial-gradient(circle at 50% 50%, var(--gold-light), var(--gold-primary) 60%, var(--gold-dark));
  box-shadow: 0 30px 60px -20px rgba(201, 169, 110, 0.55), 0 0 0 1px rgba(255, 244, 220, 0.25) inset;
  -webkit-tap-highlight-color: transparent;
}
.mm-pullcord-tassel::before {
  /* the knot */
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 14px rgba(230, 200, 139, 0.8);
}
.mm-pullcord-tassel::after {
  /* armed ring */
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(230, 200, 139, 0.55);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--dur-ui) var(--ease-silk), transform var(--dur-ui) var(--ease-silk);
}
.mm-pullcord-tassel span {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mm-pullcord-tassel:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 8px; }
.mm-pullcord.is-pulling .mm-pullcord-tassel { cursor: grabbing; }
.mm-pullcord.is-armed .mm-pullcord-tassel::after { opacity: 1; transform: scale(1); }
.mm-pullcord.is-fired .mm-pullcord-tassel { box-shadow: 0 0 80px rgba(230, 200, 139, 0.9); }
.mm-pullcord-hint {
  margin-top: 1.4rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
  text-align: center;
}
.js-motion .mm-pullcord:not(.is-touched) .mm-pullcord-tassel { animation: mm-tug 3.6s var(--ease-silk) 1.2s infinite; }
/* Braid variant: a golden plait instead of the ball («потяните за косу»).
   Artwork: /images/braid/*.svg (generated from hair fibres, see the mira-motion skill).
   --bk scales the whole hair piece; the label hangs beside the tail as a charm. */
.mm-pullcord-tassel.mm-braid {
  --bk: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: calc(64px * var(--bk));
  height: auto;
  margin-top: -1px;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.mm-braid::before, .mm-braid::after { content: none; }
.mm-braid img { display: block; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.mm-braid-top {
  position: absolute;
  top: calc(-18px * var(--bk));
  left: calc(50% - 168px * var(--bk));
  width: calc(200px * var(--bk));
  height: auto;
  transform-origin: 84% 16.2%;          /* the tie */
  transition: rotate 1100ms var(--ease-spring);
}
.mm-braid-body {
  position: relative;
  width: calc(64px * var(--bk));
  height: auto;
  margin-top: calc(20px * var(--bk));
  transform-origin: 50% 0;
  transform: scaleY(calc(1 + var(--pull, 0) * 0.0016));
  transition: transform 1000ms var(--ease-spring);
}
/* band, charm and tail ride down with the stretched plait (300 × 0.0016 = 0.48) */
.mm-braid-end {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: calc(-13px * var(--bk));
  transform: translateY(calc(var(--pull, 0) * 0.48px * var(--bk)));
  transition: transform 1000ms var(--ease-spring);
}
.mm-braid-band {
  position: relative;
  z-index: 2;
  width: calc(20px * var(--bk));
  height: calc(8px * var(--bk));
  border-radius: 999px;
  background: linear-gradient(90deg, #7d5f2f, #f4e3c3 42%, var(--gold-light) 68%, #7d5f2f);
  box-shadow: 0 0 0 0.5px rgba(60, 40, 15, 0.6), 0 0 12px rgba(230, 200, 139, 0.45);
}
.mm-braid-tail {
  width: calc(64px * var(--bk));
  height: auto;
  margin-top: calc(-4px * var(--bk));
  transform-origin: 50% 0;
}
.mm-braid-charm {
  /* a fine chain from the band, the label hanging at its end */
  --cl: calc(64px * var(--bk));
  position: absolute;
  z-index: 3;
  top: calc(4px * var(--bk));
  left: calc(50% + 8px * var(--bk));
  width: 0;
  height: 0;
  transform-origin: 0 0;
}
.mm-braid-charm::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: var(--cl);
  background: linear-gradient(180deg, var(--gold-light), rgba(230, 200, 139, 0.55));
  transform-origin: 50% 0;
  rotate: -50deg;
}
.mm-braid-cuff {
  position: absolute;
  left: calc(var(--cl) * 0.766);
  top: calc(var(--cl) * 0.643 - 3px);
  translate: -26% 0;
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 0 1.05rem;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--obsidian);
  background:
    linear-gradient(180deg, rgba(255, 250, 238, 0.55), transparent 55%),
    linear-gradient(135deg, var(--gold-light), var(--gold-primary) 55%, var(--gold-dark));
  box-shadow: 0 0 0 1px rgba(255, 244, 220, 0.35) inset, 0 12px 26px -12px rgba(201, 169, 110, 0.7);
  transition: box-shadow var(--dur-ui) var(--ease-silk), scale var(--dur-ui) var(--ease-silk);
}
.mm-braid-cuff::before {
  /* the ring the chain is threaded through */
  content: "";
  position: absolute;
  top: -5px;
  left: 26%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--gold-light);
}
.mm-braid-cuff span { font-size: 0.66rem; letter-spacing: 0.18em; }
.mm-braid-cuff::after {
  /* armed ring */
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 1px solid rgba(230, 200, 139, 0.6);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity var(--dur-ui) var(--ease-silk), transform var(--dur-ui) var(--ease-silk);
}
.mm-pullcord-tassel.mm-braid:focus-visible { outline: none; }
.mm-braid:focus-visible .mm-braid-cuff { outline: 2px solid var(--gold-light); outline-offset: 5px; }
.mm-braid:hover .mm-braid-cuff { scale: 1.05; box-shadow: 0 0 0 1px rgba(255, 244, 220, 0.5) inset, 0 0 36px rgba(230, 200, 139, 0.5); }
.mm-pullcord.is-pulling :is(.mm-braid-body, .mm-braid-end) { transition: none; }
.mm-pullcord.is-pulling .mm-braid-top { rotate: 5deg; }            /* the loose strand lifts as the plait is tugged */
.mm-pullcord:has(.mm-braid) .mm-pullcord-hint { transition: opacity var(--dur-ui) var(--ease-silk); }
.mm-pullcord.is-pulling .mm-pullcord-hint { opacity: 0; }
.mm-pullcord.is-armed .mm-braid-cuff::after { opacity: 1; transform: scale(1); }
.mm-pullcord.is-fired .mm-braid-cuff { box-shadow: 0 0 60px rgba(230, 200, 139, 0.9); }
.mm-pullcord.is-fired .mm-braid-tail { animation: mm-flick 800ms var(--ease-silk); }
@keyframes mm-flick {
  0% { rotate: 0deg; }
  30% { rotate: 7deg; }
  62% { rotate: -4deg; }
  100% { rotate: 0deg; }
}
/* idle: the piece sways on its thread; the loose strand, tail and charm follow a beat later */
.js-motion .mm-pullcord:has(.mm-braid) { animation: mm-sway 6s cubic-bezier(0.45, 0, 0.55, 1) infinite; transform-origin: 50% 0; }
.js-motion .mm-pullcord:has(.mm-braid) .mm-braid-top { animation: mm-sway-strand 6s cubic-bezier(0.45, 0, 0.55, 1) -1.2s infinite; }
.js-motion .mm-pullcord:has(.mm-braid) .mm-braid-tail { animation: mm-sway-tail 6s cubic-bezier(0.45, 0, 0.55, 1) -1.6s infinite; }
.js-motion .mm-pullcord:has(.mm-braid) .mm-braid-charm { animation: mm-sway-charm 4.4s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.js-motion .mm-pullcord:has(.mm-braid):is(.is-pulling, :not(.is-onscreen)),
.js-motion .mm-pullcord:has(.mm-braid):is(.is-pulling, :not(.is-onscreen)) :is(.mm-braid-top, .mm-braid-tail, .mm-braid-charm) { animation-play-state: paused; }
.js-motion .mm-pullcord.is-fired .mm-braid-tail { animation: mm-flick 800ms var(--ease-silk); }
@media (max-width: 767px) {
  .mm-pullcord-tassel.mm-braid { --bk: 1; }
}
@keyframes mm-sway {
  0%, 100% { rotate: -1.6deg; }
  50% { rotate: 1.6deg; }
}
@keyframes mm-sway-strand {
  0%, 100% { rotate: 2.2deg; }
  50% { rotate: -2.6deg; }
}
@keyframes mm-sway-tail {
  0%, 100% { rotate: 1.4deg; }
  50% { rotate: -1.4deg; }
}
@keyframes mm-sway-charm {
  0%, 100% { rotate: -4deg; }
  50% { rotate: 3deg; }
}

@keyframes mm-tug {
  0%, 70%, 100% { transform: translateY(0); }
  78% { transform: translateY(14px); }
  86% { transform: translateY(-4px); }
  92% { transform: translateY(2px); }
}

/* --------------------------------------------------------------------------
   Grain (fixed, never on scrolling layers)
   -------------------------------------------------------------------------- */
.mm-grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.85  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Reduced motion: nothing moves, everything visible
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-tap: 0ms; --dur-ui: 0ms; --dur-reveal: 0ms; --dur-scene: 0ms; --stagger: 0ms; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
