/* =========================================================
   HERO
   ========================================================= */
.hero {
  min-height: 100svh; max-width: none; padding-top: clamp(120px, 16vh, 180px); padding-bottom: 60px;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: 40px;
  padding-inline: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  overflow: hidden;
}

.hero-copy { position: relative; z-index: 2; display: grid; gap: 26px; }
.kicker {
  justify-self: start; display: inline-flex; gap: 10px; align-items: center; font: 600 .85rem/1 var(--f-mono);
  padding: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; letter-spacing: .02em;
}
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 0 var(--signal); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero-title { font-size: clamp(3.6rem, 10.5vw, 9.6rem); line-height: .86; letter-spacing: -.055em; }
.ht-line { display: block; }
.ht-serif { font-size: .92em; line-height: .95; padding-left: .5em; color: var(--text-muted); }
.ht-strike { position: relative; display: inline-block; }
.ht-strike::after {
  content: ""; position: absolute; left: -2%; right: -2%; top: 52%; height: .14em; border-radius: 99px;
  background: linear-gradient(90deg, var(--signal), var(--flare));
  transform: scaleX(0) rotate(-3deg); transform-origin: left; animation: strike 1s .9s var(--ease) forwards;
}
@keyframes strike { to { transform: scaleX(1) rotate(-3deg); } }

.rotator { font: 600 clamp(1.25rem, 2.2vw, 1.7rem)/1.3 var(--f-display); letter-spacing: -.02em; }
.rot-word {
  display: inline-block; padding: 2px 14px 4px; border-radius: 14px; background: var(--lavender-strong); color: var(--tile-text);
  transition: background-color .4s, transform .4s var(--spring);
}
.rot-word.flip { animation: flip .5s var(--ease); }
@keyframes flip { 0% { transform: rotateX(90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.hero-sub { max-width: 52ch; color: var(--text-muted); font-size: clamp(1rem, 1.4vw, 1.15rem); }
.hero-note { color: var(--text-muted); font-size: .95rem; }

/* hero stage */
.hero-stage { position: relative; z-index: 1; }
/* ---- Hero visual: paper → scan → sign → send → delivered ----
   Composed on a fixed 560×620 canvas and scaled to fit (see js/home/hero.js). */
.hero-stage { width: 100%; max-width: 640px; justify-self: center; aspect-ratio: 560 / 620; height: auto; min-height: 0; perspective: 1600px; }
.hv {
  position: absolute; left: 50%; top: 50%; width: 560px; height: 620px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  animation: rise 1.2s .15s var(--ease) both;
}
.hv-tile {
  position: absolute; border-radius: 44px; color: var(--tile-text); padding: 22px 26px;
  font: 750 1.35rem/1 var(--f-display); letter-spacing: -.03em;
  transform: translate(calc(var(--mx, 0) * var(--d)), calc(var(--my, 0) * var(--d))) rotate(var(--r));
  transition: transform .8s var(--ease), background-color .5s;
}
.hv-tile span { opacity: .75; }
.hv-t1 { left: 20px; top: 40px; width: 240px; height: 210px; background: var(--blue-strong); --r: -8deg; --d: 22px; }
.hv-t2 { left: 330px; top: 0; width: 220px; height: 190px; background: var(--peach-strong); --r: 7deg; --d: -18px; text-align: right; }
.hv-t3 { left: 0; top: 410px; width: 230px; height: 200px; background: var(--lavender-strong); --r: 6deg; --d: -26px; display: flex; align-items: flex-end; }
.hv-t4 { left: 330px; top: 450px; width: 230px; height: 170px; background: var(--mint-strong); --r: -6deg; --d: 16px; display: flex; align-items: flex-end; justify-content: flex-end; }

.hv-lane { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.hv-lane path { stroke: url(#hv-lane-g); stroke-linecap: round; }
.hv-track { stroke-width: 2; opacity: .22; transition: opacity .5s; }
.hv[data-phase="send"] .hv-track { opacity: .45; }
/* a soft glow that travels the lane while pages are sending */
.hv-comet { stroke-width: 5; stroke-dasharray: 18 100; stroke-dashoffset: 18; opacity: 0; filter: drop-shadow(0 0 6px var(--signal)); }
.hv[data-phase="send"] .hv-comet { opacity: 1; animation: comet .82s cubic-bezier(.45, 0, .25, 1) infinite; }
@keyframes comet { from { stroke-dashoffset: 18; } to { stroke-dashoffset: -100; } }

/* the physical page */
.hv-paper {
  position: absolute; left: 34px; top: 180px; width: 210px; height: 272px; z-index: 3;
  transform: translate(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -14px)) rotate(-7deg);
  transition: transform .8s var(--ease), opacity .6s;
}
.hv-sheet {
  position: absolute; inset: 0; background: #F7F3EA; color: #232323; border-radius: 4px; padding: 26px 20px; display: grid; gap: 9px; align-content: start;
  box-shadow: 0 30px 50px -18px rgba(30, 20, 10, .45), 0 0 0 1px rgba(0,0,0,.05);
  background-image: linear-gradient(115deg, transparent 40%, rgba(0,0,0,.035) 41%, transparent 55%);
}
.hv-ph { font: 700 .66rem/1.3 var(--f-body); letter-spacing: .04em; text-align: center; margin-bottom: 8px; }
.hv-sheet i { height: 5px; background: #D8D3C7; border-radius: 3px; } .hv-sheet i.s { width: 58%; }
.hv-sigline { position: relative; margin-top: 30px; border-top: 1.5px solid #8b867c; padding-top: 3px; }
.hv-sigline small { font-size: .55rem; color: #8b867c; }
.hv-sig { position: absolute; bottom: 12px; left: 2px; width: 78%; fill: none; stroke: #1747a6; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; }
.hv[data-phase="sign"] .hv-sig { transition: stroke-dashoffset 1.3s var(--ease); stroke-dashoffset: 0; }
.hv[data-phase="send"] .hv-sig, .hv[data-phase="done"] .hv-sig { stroke-dashoffset: 0; }
.hv-fill { position: absolute; inset: 0; border-radius: 4px; background: var(--scan); opacity: 0; transition: opacity .4s; mix-blend-mode: multiply; }
.hv[data-phase="lock"] .hv-fill { opacity: .28; }
.hv-c { position: absolute; width: 26px; height: 26px; border: 4px solid var(--scan); opacity: 0; transition: transform .5s var(--spring), opacity .3s; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--scan) 70%, transparent)); }
.c1 { left: -8px; top: -8px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; transform: translate(-16px, -16px); }
.c2 { right: -8px; top: -8px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; transform: translate(16px, -16px); }
.c3 { left: -8px; bottom: -8px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; transform: translate(-16px, 16px); }
.c4 { right: -8px; bottom: -8px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; transform: translate(16px, 16px); }
.hv[data-phase="scan"] .hv-c { opacity: 1; }
.hv[data-phase="lock"] .hv-c, .hv[data-phase="sign"] .hv-c { opacity: 1; transform: none; }
.hv-beam { position: absolute; left: -12px; right: -12px; top: 0; height: 3px; border-radius: 3px; background: var(--scan); box-shadow: 0 0 22px 6px color-mix(in srgb, var(--scan) 60%, transparent); opacity: 0; }
.hv[data-phase="scan"] .hv-beam { animation: beam 1.5s ease-in-out forwards; }
@keyframes beam { 0% { top: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
.hv[data-phase="done"] .hv-paper { filter: saturate(.6) brightness(.97); }

.hv-tag {
  position: absolute; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 9px; border-radius: 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 16px 34px var(--shadow);
  font: 600 .82rem/1.2 var(--f-body); white-space: nowrap;
  opacity: 0; transform: translateY(10px) scale(.9); transition: opacity .35s, transform .5s var(--spring);
}
.hv-tag small { display: block; font-weight: 500; color: var(--text-soft); font-size: .72rem; }
.hv-tick { width: 22px; height: 22px; border-radius: 50%; background: var(--scan); color: #04262c; display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.hv-tag-edges { left: 30px; top: -50px; rotate: 7deg; }
.hv[data-phase="lock"] .hv-tag-edges, .hv[data-phase="sign"] .hv-tag-edges { opacity: 1; transform: none; }
.hv-tag-done { left: 196px; top: 520px; padding: 12px 18px 12px 12px; font-size: .9rem; }
.hv[data-phase="done"] .hv-tag-done { opacity: 1; transform: none; transition-delay: .15s; }

/* pages in flight */
.hv-fly i {
  position: absolute; left: 0; top: 0; width: 64px; height: 83px; z-index: 5; border-radius: 3px; opacity: 0;
  background: #F7F3EA linear-gradient(#D8D3C7 0 0) 10px 18px / 44px 4px no-repeat;
  box-shadow: 0 14px 24px -8px rgba(0,0,0,.35), inset 0 0 0 2px color-mix(in srgb, var(--scan) 60%, transparent);
  offset-path: path("M150 310 C 215 140, 300 340, 400 222"); offset-rotate: 0deg; offset-anchor: center; offset-distance: 0%;
}
.hv-fly i.go { animation: flyp .8s cubic-bezier(.45, 0, .25, 1) forwards; }
@keyframes flyp {
  0% { offset-distance: 0%; opacity: 0; scale: 1; rotate: -7deg; }
  12% { opacity: 1; }
  80% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; scale: .35; rotate: 3deg; }
}

/* the phone */
.hv-phone {
  position: absolute; left: 292px; top: 36px; width: 250px; z-index: 4; border-radius: 40px; padding: 9px;
  transform: rotateY(calc(-10deg + var(--mx, 0) * 10deg)) rotateX(calc(4deg + var(--my, 0) * -6deg)) rotate(3deg);
  transition: transform .8s var(--ease);
}
.hv-phone::before { top: 17px; width: 74px; height: 22px; }
.hv-phone .phone-screen { inset: 9px; border-radius: 32px; }
.hv-screen { padding: 46px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.hv-top { position: absolute; top: 18px; left: 26px; right: 24px; display: flex; justify-content: space-between; font: 600 .66rem var(--f-body); }
.hv-sig-bars { display: flex; gap: 2px; align-items: flex-end; } .hv-sig-bars i { width: 3px; background: currentColor; border-radius: 1px; }
.hv-sig-bars i:nth-child(1) { height: 4px; } .hv-sig-bars i:nth-child(2) { height: 6px; } .hv-sig-bars i:nth-child(3) { height: 8px; }
.hv-title { display: grid; font: 750 1.32rem/1.02 var(--f-display); letter-spacing: -.04em; margin-top: 4px; }
.hv-title > span { grid-area: 1 / 1; transition: opacity .4s, transform .5s var(--ease); }
.hv-title b { font-weight: 750; }
.hv-t-b { opacity: 0; transform: translateY(8px); }
.hv[data-phase="done"] .hv-t-a { opacity: 0; transform: translateY(-8px); }
.hv[data-phase="done"] .hv-t-b { opacity: 1; transform: none; }
.hv-num { display: flex; justify-content: space-between; align-items: center; background: var(--surface-muted); border-radius: 12px; padding: 8px 10px; font: 600 .74rem var(--f-body); }
.hv-num em { font-style: normal; font-size: .6rem; color: var(--tile-text); background: var(--mint-strong); padding: 2px 6px; border-radius: 99px; }
.hv-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hv-thumbs i {
  position: relative; aspect-ratio: 8.5 / 11; border-radius: 3px; background: var(--paper) linear-gradient(var(--paper-line) 0 0) 6px 9px / 60% 3px no-repeat;
  border: 1px solid var(--line-strong); transition: border-color .3s, transform .4s var(--spring);
}
.hv-thumbs i::after {
  content: "✓"; position: absolute; right: -5px; bottom: -5px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  background: var(--mint-strong); color: var(--tile-text); font-size: .55rem; font-weight: 800; transform: scale(0); transition: transform .4s var(--spring);
}
.hv-thumbs i.sent { border-color: var(--mint-strong); transform: translateY(-2px); }
.hv-thumbs i.sent::after { transform: scale(1); }
.hv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hv-steps li {
  display: flex; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 13px; font-size: .7rem; line-height: 1.25;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-soft); transition: background-color .4s, color .4s, border-color .4s;
}
.hv-steps li > div { flex: 1; min-width: 0; }
.hv-steps b { display: block; font-weight: 600; }
.hv-steps em { font-style: normal; font-weight: 500; }
.hv-steps small { display: block; font-size: .6rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: .6rem; font-weight: 800; }
.hv-steps li.active { background: var(--blue-strong); color: var(--tile-text); border-color: transparent; }
.hv-steps li.active .hv-dot { border-color: rgba(255,255,255,.6); border-top-color: var(--signal); animation: spin .8s linear infinite; }
.hv-steps li.done { background: var(--mint-strong); color: var(--tile-text); border-color: transparent; }
.hv-steps li.done .hv-dot { border: 0; background: rgba(255,255,255,.75); color: #1b7a43; }
.hv-steps li.done .hv-dot::before { content: "✓"; }
.hv-bar { display: block; height: 4px; margin-top: 4px; border-radius: 4px; background: rgba(0,0,0,.08); overflow: hidden; }
.hv-bar i { display: block; height: 100%; width: calc(var(--sent, 0) * 25%); background: var(--signal); border-radius: 4px; transition: width .5s var(--ease); }
.hv-btn { margin-top: auto; text-align: center; padding: 12px; border-radius: 999px; background: var(--surface-muted); color: var(--text-muted); font: 600 .78rem var(--f-body); transition: background-color .4s, color .4s; }
.hv[data-phase="done"] .hv-btn { background: var(--ink); color: var(--ink-text); animation: pulse 1.6s .4s ease-in-out 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--ink) 15%, transparent); } }

.hv-stamp {
  position: absolute; left: 448px; top: 446px; z-index: 6; font: 600 .7rem/1.1 var(--f-mono); letter-spacing: .14em; text-align: center;
  padding: 12px 14px; border: 2.5px solid var(--flare); color: var(--flare); border-radius: 10px; background: color-mix(in srgb, var(--canvas) 70%, transparent);
  transform: rotate(-14deg) scale(2); opacity: 0; transition: opacity .2s, transform .45s var(--spring);
}
.hv-stamp b { font-size: 1.1rem; letter-spacing: .1em; }
.hv[data-phase="done"] .hv-stamp { opacity: 1; transform: rotate(-14deg) scale(1); transition-delay: .5s; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: left; }
}
@media (max-width: 560px) {
  .hero { padding-top: 110px; }
}
