/* ============================================================
   WISTERIA · HERO + MARQUEE
   The bloom scene, the promise, the product, the roll call.
   ============================================================ */

/* ============================================================
   1 · SHELL
   ============================================================ */
.hero {
  --hero-top: clamp(62px, 5.6vw, 78px);
  position: relative;
  overflow-x: clip;
  min-height: min(94svh, 900px);
  display: flex;
  align-items: center;
  background: var(--w-bone);
  padding-block:
    calc(var(--hero-top) + clamp(2rem, 4.6vh, 3.5rem))
    clamp(2.5rem, 5.5vh, 4rem);
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  align-items: center;
  gap: clamp(2.75rem, 5vw, 4.5rem);
}

.hero__copy { max-width: min(100%, 42rem); }

/* ============================================================
   2 · THE BLOOM SCENE
   ============================================================ */
.hero__sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero__scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  /* no z-index / transform here — the bloom layer must be able to
     blend against the bone page beneath it */
}

.hero__layer {
  position: absolute;
  inset: 0;
  transform: translate3d(var(--px, 0), var(--py, 0), 0);
  will-change: transform;
}

/* --- Mesh bloom (canvas, drawn tiny and scaled up) ----------- */
.hero__layer--bloom {
  mix-blend-mode: multiply;
  opacity: .6;
  filter: blur(30px) saturate(1.24);
}
.hero__canvas {
  position: absolute;
  inset: -14%;
  width: 128%;
  max-width: none;
  height: 128%;
}

/* --- Hanging racemes ---------------------------------------- */
.hero__raceme {
  position: absolute;
  left: var(--x);
  top: var(--top);
  width: calc(64px * var(--s));
  transform-origin: 50% 0;
  animation: hero-sway var(--dur) var(--ease-soft) infinite alternate;
  animation-delay: var(--delay);
  will-change: transform;
  opacity: .32;
  filter: blur(2.2px);
}
.hero__raceme svg { width: 100%; height: auto; max-width: none; }
.hero__raceme--near { opacity: .52; filter: blur(1.1px); }

.wst-stem { stroke: var(--w-sage); opacity: .45; }
.wst-b1 { fill: var(--w-wisteria-lt); }
.wst-b2 { fill: var(--w-wisteria); }
.wst-b3 { fill: var(--w-wisteria-dk); }
.wst-b4 { fill: var(--w-plum); }

@keyframes hero-sway {
  from { transform: rotate(calc(var(--sway) * -1)); }
  to   { transform: rotate(var(--sway)); }
}

/* --- Drifting petals ---------------------------------------- */
.hero__petal {
  position: absolute;
  left: var(--x);
  top: var(--y);
  opacity: 0;
  animation: hero-petal var(--dur) linear infinite;
  animation-delay: var(--delay);
  will-change: transform, opacity;
}
.hero__petal svg { width: 20px; height: 22px; fill: var(--w-wisteria); }
.hero__petal:nth-child(3n) svg   { fill: var(--w-rose); }
.hero__petal:nth-child(4n+1) svg { fill: var(--w-wisteria-lt); }
.hero__petal--near { filter: blur(3.5px); }

@keyframes hero-petal {
  0%   { opacity: 0;         transform: translate3d(0, -22px, 0) rotate(-8deg) scale(var(--s)); }
  11%  { opacity: var(--o); }
  50%  { transform: translate3d(var(--dx), 42px, 0) rotate(64deg) scale(var(--s)); }
  84%  { opacity: var(--o); }
  100% { opacity: 0;         transform: translate3d(calc(var(--dx) * -.32), 104px, 0) rotate(138deg) scale(var(--s)); }
}

/* --- The veil: fades the bloom back into the paper -----------
   The type sits on clean bone; the bloom is a light source that
   gathers to the right, around and behind the device.          */
.hero__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(74% 64% at 62% 48%, transparent 0%, transparent 30%, var(--w-bone) 92%),
    linear-gradient(to bottom, var(--w-bone) 0%, transparent 5%, transparent 84%, var(--w-bone) 100%);
}

/* --- Paused / static states --------------------------------- */
.hero.is-paused .hero__petal,
.hero.is-paused .hero__raceme,
.hero.is-paused .hero__phone { animation-play-state: paused; }

.hero.is-static .hero__petal {
  animation: none;
  opacity: var(--o);
  transform: translate3d(0, 18px, 0) rotate(28deg) scale(var(--s));
}
.hero.is-static .hero__raceme,
.hero.is-static .hero__phone { animation: none; }

/* ============================================================
   3 · COPY
   ============================================================ */
.hero__eyebrow { --reveal-delay: 60ms; }

.hero__title {
  margin-top: clamp(1rem, 2vw, 1.5rem);
  max-width: 15ch;
}
/* The <h1> uses [data-reveal] only as a trigger for .is-in —
   the motion is carried entirely by the masked line primitive. */
.hero__title[data-reveal] {
  opacity: 1;
  transform: none;
  filter: none;
  transition: none;
  will-change: auto;
}
.hero__title .reveal-line {
  padding-block-end: .17em;
  margin-block-end: -.17em;
  padding-inline: .1em;
  margin-inline: -.1em;
}
.hero__title .reveal-line > span { transform: translateY(126%); }
.hero__title.is-in .reveal-line > span { transform: none; }
.hero__title .reveal-line:nth-child(1) { --reveal-delay: 140ms; }
.hero__title .reveal-line:nth-child(2) { --reveal-delay: 250ms; }
.hero__title .reveal-line:nth-child(3) { --reveal-delay: 360ms; }
.hero__title .em { letter-spacing: -0.01em; padding-right: .06em; }

.hero__lead {
  --reveal-delay: 540ms;
  margin-top: clamp(1.35rem, 2.5vw, 1.9rem);
  max-width: 44ch;
}

.hero__actions {
  --reveal-delay: 660ms;
  margin-top: clamp(1.75rem, 3vw, 2.4rem);
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}
.hero__cta { flex: none; }

.hero__fine {
  --reveal-delay: 760ms;
  margin-top: clamp(1.1rem, 2vw, 1.5rem);
  font-size: var(--t-xs);
  color: var(--text-3);
  letter-spacing: .004em;
}

/* ============================================================
   4 · THE DEVICE
   ============================================================ */
.hero__device {
  justify-self: center;
  transform: translate3d(var(--px, 0), var(--py, 0), 0);
  will-change: transform;
}
.hero__device-in { --reveal-delay: 420ms; }

/* NOTE FOR THE LEAD — base.css sets
     --phone-scale: calc(var(--phone-w) / 390)
   which resolves to a *length* (e.g. 0.84px), so transform:scale()
   is invalid and .phone__screen renders unscaled, bursting out of
   the frame. Until that is fixed in base.css this section drives the
   frame from a unitless --phone-n instead. Geometry is identical to
   the intended design, so the override is a no-op once base is fixed. */
.hero__phone {
  --phone-n: 272;
  --phone-w: calc(var(--phone-n) * 1px);
  --phone-scale: calc((var(--phone-n) - 20) / 390);
  height: calc((844 * (var(--phone-n) - 20) / 390 + 20) * 1px);
  animation: hero-float 9s var(--ease-soft) infinite alternate;
  will-change: transform;
}
@keyframes hero-float {
  from { transform: translate3d(0, -8px, 0) rotate(-.4deg); }
  to   { transform: translate3d(0, 9px, 0) rotate(.45deg); }
}

/* base.css sizes .phone__island in fixed px, so it reads huge once the
   frame is scaled down. Tie it to the frame instead. (Lead: worth
   moving into base.css so every mockup on the site matches.) */
.hero__phone .phone__island {
  width: calc(112px * var(--phone-scale));
  height: calc(32px * var(--phone-scale));
  top: calc(10px + 11px * var(--phone-scale));
}

/* ---- Screen shell ---- */
.hero__screen {
  display: flex;
  flex-direction: column;
  background: var(--w-bone-2);
}
.hero__screen .phone__status {
  flex: none;
  background: var(--w-white);
}
.hero__app-time { display: inline-flex; align-items: baseline; gap: 7px; }
.hero__app-time b {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-3);
}
.hero__screen .phone__status-right { color: var(--w-ink); }

/* ---- App header ---- */
.hero__app-head {
  flex: none;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 6px;
  background: var(--w-white);
  border-bottom: 1px solid var(--border);
}
.hero__app-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.032em;
  line-height: 1;
  font-variation-settings: "SOFT" 22, "WONK" 0, "opsz" 48;
}
.hero__app-bloom { width: 9px; height: 9px; flex: none; }
.hero__app-acts { display: flex; gap: 9px; }
.hero__app-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--w-bone-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.hero__app-btn svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: var(--w-ink);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero__app-dot {
  position: absolute;
  top: 1px; right: 1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--w-terra);
  box-shadow: 0 0 0 2px var(--w-white);
}

/* ---- Feed ---- */
.hero__feed { flex: 1; min-height: 0; padding: 12px; }

.hero__post {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--w-white);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--border), var(--sh-sm);
  overflow: hidden;
}
.hero__post-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 13px 12px;
}
.hero__avatar {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(158deg, var(--w-rose) 0%, var(--w-wisteria) 62%, var(--w-plum) 100%);
  color: var(--w-white);
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1;
}
.hero__post-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hero__post-who b { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; }
.hero__post-who em { font-style: normal; font-size: 13px; color: var(--text-3); }
.hero__post-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--w-wisteria) 14%, transparent);
  color: var(--w-wisteria-dk);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.hero__post-tag svg { fill: currentColor; }

.hero__post-img {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(168deg,
    var(--w-terra-lt) 0%,
    var(--w-rose) 36%,
    var(--w-wisteria) 68%,
    var(--w-plum) 100%);
}
.hero__post-img::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(72% 52% at 26% 14%,
    color-mix(in srgb, var(--w-terra-lt) 78%, transparent) 0%, transparent 72%);
}
.hero__post-glyph {
  position: relative;
  font-family: var(--font-display);
  font-size: 126px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--w-white);
  opacity: .38;
  transform: translateY(-2px);
}

.hero__post-acts {
  flex: none;
  display: flex;
  gap: 19px;
  padding: 13px 15px 7px;
  font-size: 15px;
  font-weight: 500;
}
.hero__act { display: inline-flex; align-items: center; gap: 7px; }
.hero__act svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: var(--w-ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.hero__post-cap { padding: 0 15px; font-size: 14.5px; color: var(--text-2); }
.hero__post-cap b { color: var(--text); font-weight: 600; }
.hero__post-more { padding: 3px 15px 14px; font-size: 14px; color: var(--text-3); }

/* ---- Tab bar ---- */
.hero__tabs {
  position: relative;
  z-index: 2;
  flex: none;
  height: 92px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  padding-top: 13px;
  background: var(--w-white);
  border-top: 1px solid var(--border);
}
.hero__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1;
  color: var(--text-3);
}
.hero__tab svg {
  width: 23px; height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero__tab.is-active { color: var(--w-terra); }
.hero__tab--mid { color: var(--text-2); }
.hero__fab {
  width: 56px; height: 56px;
  margin-top: -27px;
  margin-bottom: 4px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--w-terra);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--w-plum) 22%, transparent),
    0 10px 20px -6px color-mix(in srgb, var(--w-terra) 62%, transparent);
}
.hero__fab svg { width: 26px; height: 26px; stroke: var(--w-white); stroke-width: 1.7; }

/* ============================================================
   5 · MARQUEE
   ============================================================ */
.marquee {
  position: relative;
  overflow: hidden;
  background: var(--w-bone);
  border-block: 1px solid var(--border);
}
.marquee__viewport {
  --fade: clamp(44px, 10vw, 170px);
  padding-block: clamp(1rem, 2.3vw, 1.7rem);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black var(--fade), black calc(100% - var(--fade)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, black var(--fade), black calc(100% - var(--fade)), transparent 100%);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-roll 52s linear infinite;
  will-change: transform;
}
.marquee__viewport:hover .marquee__track,
.marquee__viewport:focus-within .marquee__track { animation-play-state: paused; }

@keyframes marquee-roll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.marquee__set { flex: none; display: flex; align-items: center; margin: 0; }
.marquee__item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--t-d3);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.014em;
  font-variation-settings: "SOFT" 28, "WONK" 1, "opsz" 72;
  color: var(--w-plum);
}
.marquee__item:nth-child(even) {
  font-style: italic;
  color: var(--w-wisteria-dk);
}
/* the little bloom that separates each phrase */
.marquee__item::after {
  content: "";
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  margin-inline: clamp(1.15rem, 3vw, 2.5rem);
  background-image:
    radial-gradient(circle, var(--w-wisteria) 49%, transparent 51%),
    radial-gradient(circle, var(--w-wisteria-lt) 49%, transparent 51%),
    radial-gradient(circle, var(--w-terra) 49%, transparent 51%);
  background-size: 58% 58%, 50% 50%, 54% 54%;
  background-position: 0 18%, 100% 32%, 50% 100%;
  background-repeat: no-repeat;
  opacity: .85;
}

/* ============================================================
   6 · BREAKPOINTS
   ============================================================ */
@media (max-width: 400px) { .hero__phone { --phone-n: 248; } }
@media (min-width: 620px)  { .hero__phone { --phone-n: 300; } }

@media (min-width: 1000px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .hero__device { justify-self: end; }
  /* the headline keeps clean paper under it — the bloom lives right */
  .hero__veil {
    background:
      linear-gradient(to right, var(--w-bone) 0%, transparent 42%),
      radial-gradient(70% 66% at 60% 46%, transparent 0%, transparent 26%, var(--w-bone) 94%),
      linear-gradient(to bottom, var(--w-bone) 0%, transparent 5%, transparent 84%, var(--w-bone) 100%);
  }
}

@media (min-width: 1180px) {
  .hero__inner { gap: clamp(2rem, 3.4vw, 3.25rem); }
  .hero__phone { --phone-n: 348; }
}
@media (min-width: 1440px) { .hero__phone { --phone-n: 376; } }

/* Keep the bloom from crowding small screens */
@media (max-width: 1000px) {
  .hero__raceme { width: calc(64px * var(--s) * .62); opacity: .2; filter: blur(3px); }
  .hero__raceme--near { opacity: .34; filter: blur(1px); }
  .hero__layer--bloom { opacity: .5; }
}
@media (max-width: 620px) {
  .hero__raceme { width: calc(64px * var(--s) * .46); }
  .hero__petal--near { display: none; }
}

@media (max-width: 520px) {
  .hero__title { max-width: none; }
  .hero__actions > .btn { flex: 1 1 auto; }
  .marquee__item::after { margin-inline: 1rem; }
}
