/*
 * Homepage hero · Found, booked, answered (live; /?hero=v2 for the laptop and phone)
 * template-parts/hero-sheet.php · assets/js/home-hero-sheet.js
 *
 * One sheet of paper in the hero's right-hand column. Every "before" state
 * is scoped to .hs.is-live, which the script adds: without it (no
 * JavaScript) the sheet shows step 1, finished. Sizes are in em off .hs,
 * so the whole sheet scales with one font size per screen width.
 */

.hs {
  --hs-red: #c62828;
  --hs-ink: #0f172a;
  --hs-green: #1E3D2F;
  --hs-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  position: relative;
  max-width: 34rem;
  margin-left: auto;
  font-size: 15px;
}
.hs .screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hx .hx-visual.hx-visual--sheet { padding-left: 0; }

/* ── The paper ── */
.hs-sheet {
  position: relative;
  padding: 1.1em 1.5em 1.15em;
  border-radius: 14px;
  color: var(--hs-ink);
  background-color: #fffdf8;
  background-image:
    linear-gradient(rgba(30, 61, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 61, 47, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.12),
    0 56px 90px -40px rgba(0, 0, 0, 0.8);
}
.hs-sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42 0 0 0 0 .36 0 0 0 0 .3 0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── The three steps along the top ── */
.hs-rail { position: relative; display: flex; gap: 0.3em; margin: 0 0 1em; padding: 0 0 0.8em; list-style: none; border-bottom: 1px dashed rgba(30, 61, 47, 0.2); }
.hs-rail li { margin: 0; }
.hs-step {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.75em 0.3em 0.3em;
  font-family: 'Inter', sans-serif;
  font-size: 0.82em;
  font-weight: 700;
  line-height: 1;
  color: #8a93a2;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease;
}
.hs-step:hover { color: var(--hs-ink); }
.hs-step-n {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-family: var(--hs-hand);
  font-size: 1.1em;
  font-weight: 700;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.hs-step.is-on { color: var(--hs-red); background: rgba(198, 40, 40, 0.07); }
.hs-step.is-done { color: var(--hs-green); }
.hs-step.is-done .hs-step-n { color: transparent; background: var(--hs-green); border-color: var(--hs-green); }
.hs-step.is-done .hs-step-n::before { content: ''; position: absolute; left: 50%; top: 50%; width: 0.5em; height: 0.27em; border-left: 2px solid #ffffff; border-bottom: 2px solid #ffffff; transform: translate(-50%, -68%) rotate(-45deg); }
.hs-step:focus-visible { outline: 2px solid var(--hs-red); outline-offset: 2px; }

/* ── The stages, stacked so the sheet never changes height ── */
.hs-stages { display: grid; }
.hs-stage {
  grid-area: 1 / 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.4s ease, visibility 0.4s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.hs-stage:not(.is-on) { opacity: 0; visibility: hidden; transform: translateY(0.5em); }
.hs-who { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; margin: 0 0 0.75em; font-family: 'Inter', sans-serif; font-size: 0.78em; }
.hs-who b { font-size: 1.08em; font-weight: 800; letter-spacing: -0.005em; color: var(--hs-green); }
.hs-who span { font-weight: 600; color: #8a93a2; }
.hs-note {
  align-self: flex-end;
  margin: 0.6em 0.3em 0 0;
  font-family: var(--hs-hand);
  font-size: 1.7em;
  font-weight: 700;
  line-height: 1;
  color: var(--hs-red);
  transform: rotate(-3deg);
}
.hs-src { margin: auto 0 0; padding-top: 0.65em; border-top: 1px solid rgba(30, 61, 47, 0.1); font-family: 'Inter', sans-serif; font-size: 0.72em; font-weight: 500; line-height: 1.4; color: #8a93a2; }
.hs-note + .hs-src { margin-top: auto; }
.hs-stage > .hs-note { margin-bottom: 0.7em; }

/* 1 · Found */
.hs-search { display: flex; align-items: center; gap: 0.6em; padding: 0.72em 1em; font-family: 'Inter', sans-serif; font-size: 0.95em; color: var(--hs-ink); background: #ffffff; border: 1px solid #e3e1d8; border-radius: 999px; box-shadow: 0 2px 10px -5px rgba(15, 23, 42, 0.2); }
.hs-spark { width: 1.15em; height: 1.15em; flex-shrink: 0; color: #23306b; }
.hs-q { white-space: nowrap; overflow: hidden; }
.hs-caret { display: none; width: 1.5px; height: 1.15em; margin-left: -0.45em; background: var(--hs-ink); animation: hs-blink 1s steps(1) infinite; }
.hs-answer { margin-top: 0.8em; padding: 0.9em 1.05em 1em; background: #f3f1ea; border: 1px solid #e6e1d3; border-radius: 12px; }
.hs-answer-k { display: flex; align-items: center; gap: 0.4em; margin: 0 0 0.45em; font-family: 'Inter', sans-serif; font-size: 0.68em; font-weight: 800; line-height: 1; letter-spacing: 0.1em; text-transform: uppercase; color: #6b7280; }
.hs-answer-k::before { content: ''; width: 0.55em; height: 0.55em; border-radius: 50%; background: #23306b; }
.hs-answer-t { margin: 0; font-family: 'Inter', sans-serif; font-size: 1.02em; line-height: 1.55; color: #1f2937; }
.hs-answer-t strong { font-weight: 800; color: var(--hs-ink); }
.hs-name,
.hs-price { white-space: nowrap; }
.hs-facts { display: flex; flex-wrap: wrap; gap: 0.45em; margin: 0.75em 0 0; padding: 0; list-style: none; }
.hs-facts li { display: inline-flex; align-items: center; gap: 0.4em; margin: 0; padding: 0.4em 0.75em 0.4em 0.5em; font-family: 'Inter', sans-serif; font-size: 0.74em; font-weight: 700; line-height: 1.2; color: var(--hs-green); background: rgba(30, 61, 47, 0.07); border-radius: 999px; }
.hs-facts li::before { content: ''; width: 0.95em; height: 0.95em; flex-shrink: 0; border-radius: 50%; background: var(--hs-green) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4.4 8.4l2.4 2.4 4.8-5' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 0.75em no-repeat; }

/* 2 · Booked: Miles Pharmacy's own form */
.hs-browser { overflow: hidden; background: #ffffff; border: 1px solid #dfe3e1; border-radius: 12px; box-shadow: 0 12px 26px -16px rgba(15, 23, 42, 0.45); }
.hs-url { display: flex; align-items: center; gap: 0.45em; margin: 0; padding: 0.55em 0.9em; font-family: 'Inter', sans-serif; font-size: 0.72em; font-weight: 600; line-height: 1; color: #4b5563; background: #f3f4f6; border-bottom: 1px solid #e5e7eb; }
.hs-url svg { width: 0.95em; height: 0.95em; color: #9ca3af; }
.hs-book { padding: 0.95em 1.1em 1em; font-family: 'Inter', sans-serif; color: #ffffff; background: #1f4a3d; }
.hs-book-k { margin: 0 0 0.3em; font-size: 0.62em; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
.hs-book-h { margin: 0 0 0.75em; font-family: Georgia, 'Times New Roman', serif; font-size: 1.12em; line-height: 1.2; }
.hs-book-l { margin: 0 0 0.28em; font-size: 0.66em; font-weight: 600; color: rgba(255, 255, 255, 0.8); }
.hs-field { position: relative; display: flex; align-items: center; height: 2.15em; margin: 0 0 0.6em; padding: 0 0.75em; font-size: 0.8em; color: #111827; background: #ffffff; border-radius: 6px; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow 0.2s ease; }
.hs-field.is-focus { box-shadow: inset 0 0 0 1.5px #ef6a4f; }
.hs-field--select::after { content: ''; position: absolute; right: 0.8em; top: 50%; width: 0.42em; height: 0.42em; border-right: 1.5px solid #6b7280; border-bottom: 1.5px solid #6b7280; transform: translateY(-70%) rotate(45deg); }
.hs-field-v.is-ph { color: #9ca3af; }
.hs-book-btn { display: flex; align-items: center; justify-content: center; height: 2.35em; margin: 0.8em 0 0.6em; font-size: 0.8em; font-weight: 700; color: #ffffff; background: #ef6a4f; border-radius: 999px; transition: transform 0.15s ease, filter 0.15s ease; }
.hs-book-btn.is-pressed { transform: scale(0.96); filter: brightness(0.9); }
.hs-book-f { margin: 0; font-size: 0.6em; line-height: 1.45; color: rgba(255, 255, 255, 0.72); }

/* 3 · Answered */
.hs-chat { display: flex; flex-direction: column; gap: 0.5em; padding: 0.85em 0.95em 1em; font-family: 'Inter', sans-serif; background: #f4f5f7; border: 1px solid #e6e8ec; border-radius: 12px; }
.hs-time { align-self: center; margin: 0 0 0.15em; font-size: 0.66em; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #8a93a2; }
.hs-b { max-width: 86%; margin: 0; padding: 0.62em 0.82em; font-size: 0.86em; line-height: 1.45; border-radius: 1.05em; }
.hs-b--p { align-self: flex-end; color: #ffffff; background: #1a6fe0; border-bottom-right-radius: 0.3em; }
.hs-b--a { align-self: flex-start; color: var(--hs-ink); background: #ffffff; border-bottom-left-radius: 0.3em; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.hs-rt { display: inline-flex; align-self: flex-start; align-items: center; gap: 0.3em; margin: -0.05em 0 0 0.35em; font-size: 0.74em; font-weight: 700; color: #2f7a55; }
.hs-rt svg { width: 0.95em; height: 0.95em; color: #C9A44A; }
.hs-out { display: inline-flex; align-self: flex-start; align-items: center; gap: 0.45em; margin: 0.25em 0 0; padding: 0.5em 0.85em 0.5em 0.5em; font-size: 0.74em; line-height: 1.3; color: rgba(255, 255, 255, 0.8); background: linear-gradient(135deg, #1E3D2F, #285140); border-radius: 0.95em; }
.hs-out svg { width: 1.25em; height: 1.25em; flex-shrink: 0; color: #C9A44A; }
.hs-out b { font-weight: 800; color: #ffffff; }
.hs-typing { display: none; align-self: flex-start; margin: 0; padding: 0.7em 0.85em; background: #ffffff; border-radius: 1.05em; border-bottom-left-radius: 0.3em; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.hs-typing.is-on { display: block; }
.hs-typing i { display: inline-block; width: 0.42em; height: 0.42em; margin: 0 0.12em; border-radius: 50%; background: #9ca3af; animation: hs-dot 1s ease-in-out infinite; }
.hs-typing i:nth-child(2) { animation-delay: 0.15s; }
.hs-typing i:nth-child(3) { animation-delay: 0.3s; }

/* ── The pencil and its marks ── */
.hs-ink { position: absolute; left: 0; top: 0; z-index: 4; overflow: visible; pointer-events: none; }
.hs-ink path { fill: none; stroke: var(--hs-red); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; transition: opacity 0.3s ease; }
.hs-ink.is-fading path { opacity: 0; }
.hs-pencil {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  display: none;
  width: 168px;
  height: 22px;
  margin-top: -11px;
  transform-origin: 0 50%;
  pointer-events: none;
}
.hs-pencil svg { display: block; width: 100%; height: 100%; filter: drop-shadow(5px 9px 5px rgba(26, 43, 60, 0.28)); }
.hs.is-live .hs-pencil { display: block; opacity: 0; }
.hs.is-live .hs-pencil.is-shown { opacity: 1; }
.hs-pencil.is-writing svg { animation: hs-scribble 0.12s steps(2) infinite; }

/* ── Before each step plays (only once the script is running) ── */
.hs.is-live .hs-stage--found.is-typing .hs-caret { display: inline-block; }
.hs.is-live .hs-answer { opacity: 0; transform: translateY(0.4em); transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.hs.is-live .hs-answer.is-on { opacity: 1; transform: none; }
.hs.is-live .hs-w { opacity: 0; transition: opacity 0.22s ease; }
.hs.is-live .hs-w.is-on { opacity: 1; }
.hs.is-live .hs-note { clip-path: inset(-0.2em 100% -0.2em 0); }
.hs.is-live .hs-note.is-on { clip-path: inset(-0.2em -0.2em -0.2em 0); transition: clip-path var(--d, 0.6s) linear; }
.hs.is-live .hs-b,
.hs.is-live .hs-rt,
.hs.is-live .hs-out,
.hs.is-live .hs-facts li { opacity: 0; transform: translateY(0.5em) scale(0.98); transition: opacity 0.3s ease, transform 0.38s cubic-bezier(0.22, 1, 0.36, 1); }
.hs.is-live .hs-b.is-on,
.hs.is-live .hs-rt.is-on,
.hs.is-live .hs-out.is-on,
.hs.is-live .hs-facts li.is-on { opacity: 1; transform: none; }
.hs.is-still .hs-note.is-on,
.hs.is-still .hs-w,
.hs.is-still .hs-answer { transition: none; }

/* No JavaScript: step 1's name and price underlined in red ink */
.hs:not(.is-live) .hs-name,
.hs:not(.is-live) .hs-price { text-decoration: underline; text-decoration-color: var(--hs-red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.hs:not(.is-live) .hs-step { cursor: default; }

/* The three words in the line beside the sheet, underlined as each step lands */
.hs-verb { position: relative; white-space: nowrap; }
.hs-verb-ink { position: absolute; left: -3%; bottom: -0.38em; width: 106%; height: 0.55em; overflow: visible; pointer-events: none; }
.hs-verb-ink path { fill: none; stroke: #ef5350; stroke-width: 2.4; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 0.55s cubic-bezier(0.4, 0, 0.2, 1); }
.hs-verb.is-on .hs-verb-ink path { stroke-dashoffset: 0; }
.hs-verb.is-instant .hs-verb-ink path { transition: none; }

@keyframes hs-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes hs-dot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-0.25em); opacity: 1; } }
@keyframes hs-scribble { 0% { transform: translate(0, 0); } 50% { transform: translate(0.6px, -0.8px); } }

@media (prefers-reduced-motion: no-preference) {
  .hs { animation: hxRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards; }
}

/* ── Screen widths ── */
@media (max-width: 1320px) and (min-width: 1101px) {
  .hs { font-size: 14px; }
}
@media (max-width: 1100px) {
  .hs { margin: 0 auto; }
}
@media (max-width: 760px) {
  .hs { font-size: 13px; }
  .hs-sheet { padding: 0.95em 1.05em 1em; }
  .hs-pencil { width: 124px; height: 16px; margin-top: -8px; }
  .hs-who span { display: none; }
}
@media (max-width: 380px) {
  .hs { font-size: 12.2px; }
}
@media (prefers-reduced-motion: reduce) {
  .hs *, .hs *::before, .hs *::after { animation: none !important; }
}
