@import "./tokens.css";

/* ============================================================
   Hero — signature logo-assembly animation
   Wrench icon is split into 3 crop "windows" (jaw / handle /
   knurl) that fly in from apart positions and lock together,
   the whole assembly gets a final quarter-turn, then the
   wordmark + headline settle in.
   ============================================================ */

#hero {
  min-height: calc(100svh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem 2.5rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

/* ---- logo assembly ------------------------------------------------ */

.hero-logo {
  position: relative;
  width: 130px;
  height: 177px;
  margin: 0 auto 1.75rem;
  transform: rotate(-12deg);
  transition: transform 520ms cubic-bezier(.2, .9, .25, 1.05);
}

.hero-logo.turn {
  transform: rotate(0deg);
}

.part {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0;
  transition:
    transform 650ms cubic-bezier(.2, .9, .25, 1.05),
    opacity 420ms ease;
}

.part img {
  position: absolute;
  left: 0;
  width: 130px;
  height: 177px;
  display: block;
  max-width: none;
}

/* three vertical slices of the same source image, tiled exactly
   so the assembled state has zero seam/gap */
.part-jaw {
  top: 0;
  height: 74px;
}
.part-jaw img {
  top: 0;
}

.part-handle {
  top: 74px;
  height: 67px;
}
.part-handle img {
  top: -74px;
}

.part-knurl {
  top: 141px;
  height: 36px;
}
.part-knurl img {
  top: -141px;
}

/* apart / "broken" starting positions */
.part-jaw {
  transform: translate(-46px, -64px) rotate(-28deg);
}
.part-handle {
  transform: translate(54px, 8px) rotate(20deg);
}
.part-knurl {
  transform: translate(-24px, 62px) rotate(-32deg);
}

.hero-logo.assembled .part {
  transform: translate(0, 0) rotate(0deg);
  opacity: 1;
}

.hero-logo.assembled .part-jaw {
  transition-delay: 0ms;
}
.hero-logo.assembled .part-handle {
  transition-delay: 120ms;
}
.hero-logo.assembled .part-knurl {
  transition-delay: 240ms;
}

/* ---- headline / wordmark ------------------------------------------ */

.hero-content {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 520ms ease,
    transform 520ms cubic-bezier(.2, .9, .25, 1.05);
}

.hero-content.in {
  opacity: 1;
  transform: translateY(0);
}

.hero-content h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
}

.hero-content p {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: clamp(0.95rem, 2.4vw, 1.125rem);
  line-height: 1.6;
  max-width: 34rem;
  margin: 0 auto;
}

/* ---- purpose message: scroll-triggered (or 3.5s timeout) fade-in ---- */

.hero-purpose {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: clamp(0.85rem, 2vw, 0.975rem);
  line-height: 1.65;
  max-width: 32rem;
  margin: 1.5rem auto 0;
  opacity: 0;
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2, .9, .25, 1.05);
  transform: translateY(10px);
}

.hero-purpose.in {
  opacity: 1;
  transform: translateY(0);
}

/* ---- CTA row: machined, stamped buttons — staggered in with the purpose
   message (via hero-anim.js' same reveal() call), never before the
   headline ------------------------------------------------------------ */

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.75rem;
  opacity: 0;
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2, .9, .25, 1.05);
  transform: translateY(10px);
}

.hero-cta.in {
  opacity: 1;
  transform: translateY(0);
}

.hero-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-radius: 2px;
  padding: 0.8rem 1.6rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.hero-btn-primary {
  color: var(--ink);
  background-color: var(--accent);
  border: 1px solid var(--accent);
}

.hero-btn-primary:hover {
  opacity: 0.9;
}

.hero-btn-secondary {
  color: var(--ink);
  background-color: transparent;
  border: 1px solid var(--ink);
}

.hero-btn-secondary:hover {
  background-color: rgba(26, 26, 28, 0.06);
}

/* ---- scroll cue ----------------------------------------------------- */

.scroll-cue {
  margin-top: 2.5rem;
  opacity: 0;
  transition: opacity 420ms ease;
}

.scroll-cue.show {
  opacity: 1;
  animation: scroll-cue-bob 2200ms ease-in-out 600ms infinite;
}

.scroll-cue span {
  display: block;
  width: 10px;
  height: 10px;
  /* physical properties on purpose: this is a decorative "points down"
     scroll cue, not text — it must not mirror with dir="rtl" */
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

@keyframes scroll-cue-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---- reduced motion: real alternative, not a broken state --------- */

@media (prefers-reduced-motion: reduce) {
  .hero-logo,
  .hero-logo.turn {
    transform: none;
    transition: none;
  }

  .part {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }

  .hero-content {
    transform: none;
    transition: none;
  }

  .hero-purpose {
    transform: none;
    transition: none;
  }

  .hero-cta {
    transform: none;
    transition: none;
  }

  .scroll-cue {
    transition: none;
    animation: none !important;
  }

  /* single fade owner: .hero-inner is the one thing that animates in
     reduced-motion mode; children (.hero-content/.scroll-cue) render in
     their final state immediately, no independent transition of their own */
  .hero-inner {
    opacity: 0;
    transition: opacity 300ms ease;
  }

  .hero-inner.in {
    opacity: 1;
  }
}
