/* Homepage hero title artwork (generated by tools/build_hero_title.py into app/public_home.html):
   the approved design's calligraphy, traced into vector outlines. The real <h1> text stays in
   place, readable by search engines and screen readers and keeping the original line box, so
   nothing around it moves; it is only made transparent while the aria-hidden artwork is drawn
   over it. Layers: heart glow < ink (exact stroke outlines + a static SVG glow beneath them)
   < flowing light < sparkles. Only opacity / transform and one thin stroke are animated; every
   loop stops off-screen, in a hidden tab and under reduced motion. */
.home-page .hero-content h1 { position: relative; }
.home-page .hero-content h1 > .hero-title-art ~ * { color: transparent; text-shadow: none; }
.hero-title-art {
  /* 970 x 230 design pixels. 10.1em = 970px where the h1 is 96px (the 1672px-wide design), so the
     title has the design's size and place relative to the page at every width. */
  position: absolute; left: 50%; top: 50%; z-index: 1;
  width: min(10.1em, calc(100vw - 12px)); aspect-ratio: 970 / 230;
  --hta-x: -49.07%; --hta-y: -59.13%;
  translate: var(--hta-x) var(--hta-y); pointer-events: none; user-select: none;
  animation: hta-in 1500ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.hero-title-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Ink: warm white strokes with their exact traced outline; the filter adds gold and pink light. */
.hta-ink path { fill: #fffaf3; }
html[lang^="zh-CN"] .hta-tc, html:not([lang^="zh-CN"]) .hta-sc { display: none; }

/* Flowing light along the long underline. */
.hta-flow path { fill: none; stroke-linecap: round; stroke-dasharray: 110 890; stroke-dashoffset: 1000; }
.hta-flow-halo { stroke: rgba(255, 220, 170, 0.4); stroke-width: 7; }
.hta-flow-core { stroke: rgba(255, 253, 245, 0.95); stroke-width: 1.6; }
.hta-flow { animation: hta-flow-in 600ms ease 1600ms both; }
.hta-flow path { animation: hta-flow 7s cubic-bezier(0.45, 0, 0.35, 1) 1600ms infinite; }

/* The heart breathes: a blurred warm copy behind it fades in and out. */
.hta-heart { filter: blur(6px); opacity: 0.35; will-change: opacity; animation: hta-breathe 4.8s ease-in-out 1500ms infinite; }
.hta-heart path { fill: #ffc9a8; }

/* The design's sparkles: thin four-point stars with a soft halo, each twinkling on its own rhythm. */
.hta-spark { transform-box: fill-box; transform-origin: center; opacity: 0.95; animation: hta-twinkle 4.2s ease-in-out infinite; }
.hta-spark path, .hta-spark circle:last-child { fill: #fffdf8; }
.hta-spark:nth-of-type(2) { animation-duration: 5.1s; animation-delay: -1.3s; }
.hta-spark:nth-of-type(3) { animation-duration: 3.7s; animation-delay: -2.4s; }
.hta-spark:nth-of-type(4) { animation-duration: 4.8s; animation-delay: -0.6s; }
.hta-spark:nth-of-type(5) { animation-duration: 5.6s; animation-delay: -3.1s; }
.hta-spark:nth-of-type(6) { animation-duration: 4.4s; animation-delay: -1.9s; }

@keyframes hta-in { from { opacity: 0; translate: var(--hta-x) calc(var(--hta-y) + 10px); } to { opacity: 1; translate: var(--hta-x) var(--hta-y); } }
@keyframes hta-flow-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes hta-flow { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: -110; } }
@keyframes hta-breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }
@keyframes hta-twinkle { 0%, 100% { opacity: 0.7; scale: 0.82; } 50% { opacity: 1; scale: 1; } }

/* Phones: the title line is short, so the artwork sits a little higher to keep the loop under 瑜
   clear of the English subtitle. */
@media (max-width: 560px) { .hero-title-art { --hta-y: -66%; } }

/* home-title.js pauses the loops while the hero is off-screen or the tab is hidden. */
.hero-title-art.is-paused, .hero-title-art.is-paused * { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .hero-title-art, .hero-title-art * { animation: none !important; }
  .hta-flow { opacity: 0; }
  .hta-heart { opacity: 0.5; }
  .hta-spark { opacity: 0.9; }
}
