/* Inputs: Static FINCHIP markup and theme tokens.
 * Outputs: hero presentation and responsive states.
 * Role: Preserves the supplied Finch visual system for the independent homepage. */
/* Static Hero. Reuses the established 1160px container, landing font and button tokens. */
.hero-section {
  padding-block: 80px 88px;
  background: var(--surface);
  scroll-margin-top: 96px;
}
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr);
  align-items: center;
  column-gap: 48px;
  min-height: 540px;
}
.hero-copy { min-width: 0; }
.hero-brand {
  margin: 0 0 24px;
  color: var(--meta-color);
  font: 600 12px/1.5 var(--font-ui);
  letter-spacing: .18em;
}
.hero-copy h1 {
  margin: 0;
  color: var(--text-primary);
  font: 500 clamp(50px, 4.1vw, 60px)/1.06 var(--font-landing);
  letter-spacing: -.045em;
}
.hero-copy h1 > span { display: block; white-space: nowrap; }
.hero-description {
  max-width: 44ch;
  text-wrap: balance;
  margin: 26px 0 0;
  color: var(--copy-color);
  font: 400 18px/1.7 var(--font-landing);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}
.hero-section .hero-button {
  min-height: 58px;
  padding-inline: 24px;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease;
}
.hero-section .button-dark:hover { transform: none; }
.hero-section .hero-button-primary {
  position: relative;
  isolation: isolate;
  gap: 30px;
  padding-inline: 29px 24px;
  border-color: #27303d;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 500 16px/1.3 var(--font-ui);
}
.hero-button-arrow { font-size: 26px; font-weight: 300; line-height: 1; transition: transform .2s ease; }
.hero-button-primary:hover .hero-button-arrow { transform: translateX(3px); }
.hero-button-secondary {
  border-color: var(--card-border);
  background: var(--surface);
  color: var(--text-primary);
}
.hero-button-secondary:hover { background: var(--surface-muted); }
.hero-button-secondary > span[aria-hidden] { font-size: 18px; }
.hero-visual-slot {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 480px;
}
.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
}
.hero-visual img {
  display: block;
  width: min(100%, 440px);
  height: auto;
  aspect-ratio: 720 / 719;
  object-fit: contain;
}
.hero-visual figcaption {
  margin-top: 18px;
  color: var(--meta-color);
  font: 400 12px/1.5 var(--font-ui);
  letter-spacing: .025em;
  text-align: center;
}
.hero-section + .protocol-section { padding-top: 48px; }

@media (max-width: 1100px) {
  .hero-layout { column-gap: 32px; grid-template-columns: minmax(0, 1.45fr) minmax(0, .55fr); }
  .hero-copy h1 { font-size: clamp(44px, 4.8vw, 54px); }
  .hero-visual-slot { min-height: 400px; }
}
@media (max-width: 900px) {
  .hero-section { padding-block: 64px 72px; }
  .hero-layout { min-height: 490px; column-gap: 24px; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
  .hero-copy h1 { font-size: 52px; line-height: 1.06; }
  .hero-copy h1 > span { white-space: normal; }
  .hero-description { font-size: 17px; margin-top: 24px; }
  .hero-section .hero-button { padding-inline: 18px; }
  .hero-section .hero-button-primary { gap: 20px; padding-inline: 22px 18px; font-size: 15px; }
  .hero-actions { gap: 10px; }
  .hero-visual-slot { min-height: 340px; }
}
@media (max-width: 700px) {
  .hero-section { padding-block: 52px 48px; scroll-margin-top: 88px; }
  .hero-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; row-gap: 36px; }
  .hero-brand { margin-bottom: 20px; }
  .hero-copy h1 { font-size: clamp(40px, 10.8vw, 52px); line-height: 1.07; letter-spacing: -.04em; }
  .hero-description { max-width: 43ch; margin-top: 24px; font-size: 17px; line-height: 1.65; }
  .hero-actions { margin-top: 26px; gap: 12px; }
  .hero-visual-slot { min-height: 300px; }
  .hero-visual img { width: min(100%, 300px); }
  .hero-visual figcaption { margin-top: 12px; }
  .hero-section + .protocol-section { padding-top: 40px; }
}
@media (max-width: 440px) {
  .hero-actions { flex-direction: column; align-items: flex-start; }
  .hero-section .hero-button { width: auto; max-width: 100%; }
  .hero-section .hero-button-primary { justify-content: space-between; }
  .hero-visual img { width: min(100%, 270px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-button-primary::before,
  .hero-button-primary::after,
  .hero-button-arrow { transition: none; }
}
@media print {
  .hero-section { padding-block: 28px; }
  .hero-layout { min-height: 0; }
}

/* Consistent CTA rhythm and crisp, matching arrow strokes. */
.hero-actions { gap: 20px; margin-top: 28px; }
.hero-section .hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  gap: 22px;
  padding-inline: 26px;
  font-size: 15px;
}
.hero-section .hero-button-primary { gap: 26px; padding-inline: 28px 24px; }
.hero-button-arrow { display: block; width: 22px; height: 22px; flex: 0 0 22px; }
.hero-button-secondary:hover .hero-button-arrow { transform: translate(2px, -2px); }
@media (max-width: 700px) {
  .hero-actions { gap: 16px; margin-top: 24px; }
  .hero-section .hero-button { min-height: 54px; gap: 18px; padding-inline: 22px; }
}
@media (max-width: 440px) {
  .hero-actions { gap: 14px; }
  .hero-section .hero-button { justify-content: space-between; padding-inline: 24px; }
}

/* A quieter external-link accent on the secondary CTA. */
.hero-section .hero-button-secondary { gap: 14px; padding-inline: 26px; }
.hero-button-secondary .hero-button-arrow {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
  stroke-width: 1.65;
}
.hero-button-secondary:hover .hero-button-arrow { transform: translate(1px, -1px); }
@media (max-width: 440px) {
  .hero-section .hero-button-secondary { justify-content: center; }
}

.hero-section .hero-button-primary { gap: 18px; }
.hero-button-primary .hero-button-arrow {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
  stroke-width: 1.65;
}
.hero-button-primary:hover .hero-button-arrow { transform: translateX(1px); }
.visit-link { gap: 14px; }
.button-external-arrow { display: block; width: 17px; height: 17px; flex: 0 0 17px; transition: transform .2s ease; }
.visit-link:hover .button-external-arrow { transform: translate(1px, -1px); }
@media (prefers-reduced-motion: reduce) {
  .button-external-arrow { transition: none; }
}

/* Flight pivots at the shoulder; the body stays stable while the wings beat. */
.finch-flight { display: block; width: min(100%, 440px); height: auto; overflow: visible; }
.finch-flight-body { animation: finch-hover 2.4s ease-in-out infinite; transform-origin: 420px 450px; }
.finch-wing-near { transform-origin: 310px 540px; animation: finch-wingbeat 2.4s cubic-bezier(.45,0,.55,1) infinite; }
.finch-wing-far { transform-origin: 310px 540px; opacity: .42; animation: finch-far-wingbeat 2.4s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes finch-wingbeat {
  0%,100% { transform: rotate(-7deg) skewX(-2deg) scaleY(1); }
  45% { transform: rotate(27deg) skewX(-12deg) scaleY(.36); }
  62% { transform: rotate(23deg) skewX(-8deg) scaleY(.44); }
}
@keyframes finch-far-wingbeat {
  0%,100% { transform: translate(-22px, 5px) rotate(-18deg) scale(.88, .94); }
  48% { transform: translate(-22px, 5px) rotate(15deg) scale(.88, .28); }
  65% { transform: translate(-22px, 5px) rotate(10deg) scale(.88, .38); }
}
@keyframes finch-hover {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  48% { transform: translateY(-16px) rotate(1deg); }
}
@media (max-width: 700px) { .finch-flight { width: min(100%, 340px); } }
@media (prefers-reduced-motion: reduce) {
  .finch-flight-body, .finch-wing-near, .finch-wing-far { animation: none; }
  .finch-wing-far { transform: translate(-22px,5px) rotate(-18deg) scale(.88,.94); }
}

.finch-flight-source { display: none; }
.finch-mosaic { display: block; width: min(100%, 440px); aspect-ratio: 1; height: auto; }
@media (max-width: 700px) { .finch-mosaic { width: min(100%, 340px); } }

/* Approved bitmap artwork: preserve the pixel texture without stretching. */
.hero-visual .finch-bitmap-bird {
  width: min(125%, 540px);
  max-width: none;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  animation: bitmap-bird-hover 4.8s ease-in-out infinite;
  transform-origin: 65% 55%;
}
@keyframes bitmap-bird-hover {
  0%,100% { transform: translateY(5px) rotate(-.5deg); opacity: .93; }
  50% { transform: translateY(-7px) rotate(.5deg); opacity: 1; }
}
@media (max-width: 700px) {
  .hero-visual .finch-bitmap-bird { width: min(110%, 440px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-visual .finch-bitmap-bird { animation: none; }
}

/* Eight painted poses, with a stationary head and a complete recovery stroke. */
.finch-flight-sprite {
  width: min(125%, 500px);
  max-width: none;
  aspect-ratio: 1;
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0 0;
  animation: finch-painted-wingbeat 1.15s steps(1, end) infinite, finch-painted-lift 2.3s ease-in-out infinite;
}
@keyframes finch-painted-wingbeat {
  0% { background-position: 0 0; }
  12.5% { background-position: 33.333333% 0; }
  25% { background-position: 66.666667% 0; }
  37.5% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
  62.5% { background-position: 33.333333% 100%; }
  75% { background-position: 66.666667% 100%; }
  87.5% { background-position: 100% 100%; }
}
@keyframes finch-painted-lift {
  0%, 100% { transform: translateY(3px); }
  50% { transform: translateY(-4px); }
}
@media (max-width: 700px) { .finch-flight-sprite { width: min(100%, 370px); } }
@media (prefers-reduced-motion: reduce) { .finch-flight-sprite { animation: none; } }
.hero-visual .finch-flight-sprite { width: min(100%, 440px); }

/* One capsule surface, one perimeter, and a compact colored glow. There is no
   dark outer border or inherited dark hover shadow outside the SVG stroke. */
.hero-section .hero-button-primary,
.hero-section .hero-button-primary:hover {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.hero-button-primary::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -5px;
  border-radius: inherit;
  background: linear-gradient(105deg,#53d7ef 0%,#aaa5f3 35%,#f68dcc 68%,#ffac81 100%);
  filter: blur(10px);
  opacity: .8;
  pointer-events: none;
  transition: opacity .25s ease, filter .25s ease;
}
.hero-button-primary:is(:hover,:focus-visible)::before { opacity: .95; filter: blur(11px); }
.hero-button-primary::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px;
  border-radius: inherit;
  background: #181619;
  box-shadow: none;
  pointer-events: none;
}
.hero-button-outline {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  overflow: visible;
  pointer-events: none;
}
.hero-button-outline rect {
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  stroke-width: 2;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
  transition: opacity .18s ease, stroke-dashoffset 0s .18s;
}
.hero-button-primary:is(:hover,:focus-visible) .hero-button-outline rect {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset .85s cubic-bezier(.4,0,.2,1), opacity .12s ease;
}
.hero-button-primary .hero-button-arrow {
  transform: rotate(-45deg);
  transition: color .25s ease, transform .25s ease;
}
.hero-button-primary:is(:hover,:focus-visible) .hero-button-arrow {
  color: #ff583c;
  transform: translateX(2px) rotate(0deg);
}
.hero-section .hero-button-primary:focus-visible { outline: 2px solid #748aa9; outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) {
  .hero-button-primary::before,
  .hero-button-primary .hero-button-arrow,
  .hero-button-outline rect,
  .hero-button-primary:is(:hover,:focus-visible) .hero-button-outline rect { transition: none; }
}

/* The original bird is rendered on the shared particle canvas, not as a sprite. */
.hero-official-bird { width: 100%; height: 400px; }
.official-bird-source { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
@media (max-width: 700px) { .hero-official-bird { height: 340px; } }

/* All diagonal link arrows share the same horizontal resting geometry. */
a .link-arrow,
.hero-button-secondary .link-arrow,
.visit-link .link-arrow {
  display: inline-block;
  width: 17px; height: 17px; flex: 0 0 17px;
  vertical-align: middle;
  transform: rotate(-45deg);
  transform-origin: center;
  transition: transform .25s cubic-bezier(.22,.61,.36,1);
}
a:is(:hover,:focus-visible) .link-arrow,
.hero-button-secondary:is(:hover,:focus-visible) .link-arrow,
.visit-link:is(:hover,:focus-visible) .link-arrow { transform: translateX(2px) rotate(0deg); }
.source-arrow { display: inline-flex; align-items: center; }
@media (prefers-reduced-motion: reduce) {
  a .link-arrow, .hero-button-secondary .link-arrow, .visit-link .link-arrow { transition: none; }
}
