/* ============================================================
   HOMEPAGE VISUAL PASS — artifacts + motion (hand-made paper-ink)
   Additive. Loaded LAST in the cascade (after studio-upgrade.css
   and the inline home-calm block). Owner: creative-director
   (Delacroix) art direction; engineering (Frank) implementation.
   Spec: ~/.hermes/org/briefs/2026-09-21-homepage-visual-pass-design.md

   HARD RAIL #1 — no-JS / reduced-motion safety:
     Every .pp-* / [data-pass] / [data-pass-reveal] element renders in
     its FINAL, visible state by default. There is no opacity:0 or
     hiding transform in base CSS. Animation is progressive enhancement:
     homepage-artifacts.js adds .pp-prep / .pp-run / .pp-draw / .pp-drawn
     / .pp-stamp-in ONLY when motion is allowed, and the JS no-ops
     entirely under prefers-reduced-motion.

   Color rule: tokens only (var(--signal), var(--ink), var(--paper),
   var(--paper-2), var(--muted), var(--leaf)). No new hues.
   ============================================================ */

/* ------------------------------------------------------------------
   §4 — Entrance recipe (shared). Transform + opacity only, GPU-cheap.
   .pp-animating carries the transition only while an entrance runs, so
   hover transitions on the same element stay fast afterward.
   ------------------------------------------------------------------ */
[data-pass],
[data-pass-reveal] { opacity: 1; }

/* Prep snaps (no transition) so the entrance does not fade content out.
   .pp-run, added a frame later, is what transitions into the visible state. */
body.home-calm [data-pass].pp-prep,
body.home-calm [data-pass-reveal].pp-prep {
  opacity: 0;
  transform: translateY(14px);
  transition: none;
}
body.home-calm [data-pass].pp-run,
body.home-calm [data-pass-reveal].pp-run {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 420ms ease, transform 420ms ease;
}

/* ------------------------------------------------------------------
   §3 A1 — Rubber stamp (shared). Red = brand claims, black = honest
   framing. One shared filter (#pp-stamp-rough) renders the grainy edge.
   ------------------------------------------------------------------ */
.pp-stamp { display: inline-block; transform: rotate(-3deg); height: auto; }
.pp-stamp.pp-stamp-black g rect { stroke: var(--ink); }
.pp-stamp.pp-stamp-black text { fill: var(--ink); }
.pp-stamp.pp-stamp-red g rect { stroke: var(--signal); }
.pp-stamp.pp-stamp-red text { fill: var(--signal); }

@keyframes pp-stamp-in {
  0%   { opacity: 0; transform: scale(1.5) rotate(-8deg); }
  62%  { opacity: 1; transform: scale(0.96) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}
.pp-stamp-in { animation: pp-stamp-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ------------------------------------------------------------------
   §3 A2 — Hand-drawn underline (squiggle). Draws in via scaleX.
   ------------------------------------------------------------------ */
.pp-underline { transform-origin: left center; }
.pp-underline.pp-draw { transform: scaleX(0); transition: none; }
.pp-underline.pp-drawn {
  transform: scaleX(1);
  transition: transform 500ms ease-out;
}

/* ------------------------------------------------------------------
   §3 A3 — Hand-drawn circle (loop). Draws in via stroke-dashoffset.
   pathLength=100 on the path normalizes the length.
   ------------------------------------------------------------------ */
.pp-circle path { stroke-dasharray: 100; stroke-dashoffset: 0; }
.pp-circle.pp-draw path { stroke-dashoffset: 100; transition: none; }
.pp-circle.pp-drawn path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 900ms ease-out;
}

/* ------------------------------------------------------------------
   §3 A4 — Torn + taped paper edge.
   ------------------------------------------------------------------ */
.pp-tape {
  position: absolute;
  top: -10px;
  left: 24px;
  width: 92px;
  height: 24px;
  background: color-mix(in srgb, var(--paper-2) 75%, transparent);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotate(-2.5deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10);
  z-index: 2;
}
.pp-torn {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px),
    98% calc(100% - 6px), 96% calc(100% - 14px), 93% calc(100% - 5px),
    90% calc(100% - 13px), 87% calc(100% - 7px), 84% calc(100% - 15px),
    80% calc(100% - 6px), 77% calc(100% - 12px), 73% calc(100% - 5px),
    70% calc(100% - 14px), 66% calc(100% - 6px), 62% calc(100% - 13px),
    58% calc(100% - 5px), 55% calc(100% - 14px), 51% calc(100% - 7px),
    47% calc(100% - 13px), 43% calc(100% - 6px), 40% calc(100% - 15px),
    36% calc(100% - 5px), 32% calc(100% - 13px), 28% calc(100% - 6px),
    24% calc(100% - 14px), 20% calc(100% - 5px), 16% calc(100% - 12px),
    12% calc(100% - 6px), 8% calc(100% - 14px), 4% calc(100% - 5px), 0 calc(100% - 11px));
}

/* ------------------------------------------------------------------
   §3 A5 — Blueprint registration mark (static, low opacity).
   ------------------------------------------------------------------ */
.pp-register { pointer-events: none; }

/* ------------------------------------------------------------------
   §3 A6 — Hand-sketched product doodle.
   ------------------------------------------------------------------ */
.pp-doodle { display: block; width: 160px; height: auto; }

/* ------------------------------------------------------------------
   §3 A7 — Ink-stroke connector (drawn dashed ink). Desktop horizontal,
   mobile vertical. Draws in via scaleX / scaleY.
   ------------------------------------------------------------------ */
.pp-connect { position: absolute; z-index: 0; pointer-events: none; }
.pp-connect-desktop {
  left: 6%;
  right: 6%;
  top: 38px;
  height: 12px;
  transform-origin: left center;
}
.pp-connect-desktop.pp-draw { transform: scaleX(0); transition: none; }
.pp-connect-desktop.pp-drawn {
  transform: scaleX(1);
  transition: transform 900ms ease-out;
}
.pp-connect-mobile {
  display: none;
  left: calc(1.2rem + 15px);
  top: 46px;
  bottom: 18px;
  width: 12px;
  transform-origin: center top;
}
.pp-connect-mobile.pp-draw { transform: scaleY(0); transition: none; }
.pp-connect-mobile.pp-drawn {
  transform: scaleY(1);
  transition: transform 900ms ease-out;
}

@media (max-width: 719px) {
  .pp-connect-desktop { display: none; }
  .pp-connect-mobile { display: block; }
}

/* ------------------------------------------------------------------
   §5.1 — Hero.
   ------------------------------------------------------------------ */
body.home-calm .pp-hero-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0 0 1.35rem;
}
body.home-calm .pp-hero-top .kicker { margin: 0; }
.pp-stamp-hero { width: min(340px, 100%); }

/* Underline sits under the signal phrase. Circle loops one word inside it.
   Existing `h1 span { color: var(--signal) }` keeps the phrase red. */
body.home-calm #hero-title { overflow: visible; }
body.home-calm .hero h1 span.pp-circled {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
body.home-calm .hero h1 span.pp-underlined {
  position: relative;
  display: inline-block;
}
.pp-circled .pp-circle {
  position: absolute;
  left: -8px;
  top: -6px;
  width: calc(100% + 16px);
  height: calc(100% + 14px);
  pointer-events: none;
  transform: rotate(-2deg);
  z-index: 0;
}
.pp-circled { z-index: 1; }
.pp-underlined .pp-underline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.16em;
  width: 100%;
  height: 0.42em;
  pointer-events: none;
}

/* Trust signals — hand-drawn red check replaces the leaf ✓. */
body.home-calm .hero-trust li::before { content: none; }
.pp-check { width: 18px; height: 18px; flex-shrink: 0; display: block; }

/* Drop the circle if it crowds the mobile H1. */
@media (max-width: 719px) {
  .pp-circled .pp-circle { display: none; }
}

/* ------------------------------------------------------------------
   §5.2 — Process: hand-stamped step badges, connector, stamps.
   ------------------------------------------------------------------ */
body.home-calm .process-steps .step::before { content: none; display: none; }
body.home-calm .pp-step-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  position: relative;
  color: var(--paper);
  font-family: "Archivo Black", Impact, sans-serif;
  font-size: 1.15rem;
}
body.home-calm .pp-step-badge svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
body.home-calm .pp-step-num { position: relative; z-index: 1; line-height: 1; }
body.home-calm .process-steps .step:nth-child(odd) .pp-step-badge { transform: rotate(-1.5deg); }
body.home-calm .process-steps .step:nth-child(even) .pp-step-badge { transform: rotate(1.5deg); }

.pp-process-wrap { position: relative; }
.pp-process-wrap .process-steps { position: relative; z-index: 1; }

.pp-stamp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
  margin-top: 0.9rem;
}
.pp-stamp-row .pp-stamp { width: 154px; }

/* ------------------------------------------------------------------
   §5.3 — Reference / proof: paper note card + honest-framing stamp.
   ------------------------------------------------------------------ */
body.home-calm .pp-note-wrap {
  position: relative;
  transform: rotate(-1deg);
  margin-top: 1.6rem;
  max-width: 62ch;
}
body.home-calm .pp-note-card {
  position: relative;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  padding: 1.5rem 1.4rem 1.7rem;
  filter: drop-shadow(6px 6px 0 var(--ink));
}
.pp-note-stamp { display: block; width: min(364px, 100%); margin: 0 0 0.85rem auto; }
body.home-calm .pp-note-card .proof-line { margin: 0; max-width: none; }

/* Entrance keeps the -1deg rotation while rising. */
body.home-calm .pp-note-wrap[data-pass-reveal].pp-prep {
  opacity: 0;
  transform: translateY(14px) rotate(-1deg);
  transition: none;
}
body.home-calm .pp-note-wrap[data-pass-reveal].pp-run {
  opacity: 1;
  transform: translateY(0) rotate(-1deg);
  transition: opacity 420ms ease, transform 420ms ease;
}

/* ------------------------------------------------------------------
   §5.4 — Notes: editorial paper cards + ink-underline draw.
   ------------------------------------------------------------------ */
body.home-calm .note-list li {
  border: 2px solid var(--ink);
  border-top-width: 2px;
  background: var(--paper-2);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 1.15rem 3rem 1.15rem 1.2rem;
  position: relative;
  margin-bottom: 0.85rem;
  transition: transform 150ms ease;
}
body.home-calm .note-list li:hover { transform: translateY(-2px); }
body.home-calm .note-list li[data-pass-reveal].pp-run:hover { transform: translateY(-2px); }
.pp-note-register {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 34px;
  height: 34px;
}

/* §6.2 — Ink-underline draw on links / note titles. */
.pp-link {
  position: relative;
  background-image: linear-gradient(var(--signal), var(--signal));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 180ms ease;
}
.pp-link:hover,
.pp-link:focus-visible { background-size: 100% 2px; }
body.home-calm .note-list a.note-title.pp-link:hover { text-decoration: none; }

/* ------------------------------------------------------------------
   §5.5 — FAQ: hand-drawn +/− and smooth grid-rows open.
   ------------------------------------------------------------------ */
body.home-calm .faq-q::after { content: none; }
.pp-faq-icon { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.pp-faq-icon .pp-faq-v {
  transform-origin: center;
  transition: transform 200ms ease, opacity 200ms ease;
}
body.home-calm .faq-item[open] .pp-faq-icon .pp-faq-v {
  transform: scaleY(0);
  opacity: 0;
}
body.home-calm .faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms ease;
  padding: 0 1rem;
}
body.home-calm .faq-a > * { overflow: hidden; min-height: 0; }
body.home-calm .faq-item[open] .faq-a {
  grid-template-rows: 1fr;
  padding-bottom: 0.9rem;
}

/* ------------------------------------------------------------------
   §5.6 — Contact: paper form, focus underline, tactile submit.
   ------------------------------------------------------------------ */
body.home-calm .contact-form .field input,
body.home-calm .contact-form .field textarea {
  border: 2px solid transparent;
  border-bottom: 2px solid var(--line);
  background-color: var(--paper);
  background-image: linear-gradient(var(--signal), var(--signal));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 220ms ease;
  padding: 0.68rem 0.35rem;
  border-radius: 0;
}
body.home-calm .contact-form .field input:focus,
body.home-calm .contact-form .field textarea:focus {
  outline: none;
  border-bottom-color: var(--line);
  background-size: 100% 2px;
}
body.home-calm .contact-form .field input:focus-visible,
body.home-calm .contact-form .field textarea:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}
body.home-calm .pp-doodle { margin-top: 1.1rem; }

/* §6.1 — Tactile button press (all .btn, .submit). */
body.home-calm .btn,
body.home-calm .submit {
  transition: transform 150ms ease, box-shadow 150ms ease;
}
body.home-calm .btn:hover,
body.home-calm .btn:focus-visible,
body.home-calm .submit:hover,
body.home-calm .submit:focus-visible {
  transform: translateY(-1px);
  box-shadow: 6px 8px 0 var(--ink);
}
body.home-calm .btn:active,
body.home-calm .submit:active {
  transform: translateY(1px);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ------------------------------------------------------------------
   §5.7 — Footer: one static register mark.
   ------------------------------------------------------------------ */
body.home-calm .studio-footer-intro { position: relative; }
.pp-register-footer {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
}

/* ------------------------------------------------------------------
   will-change is applied inline by JS to hero entrance elements only,
   then cleared when the transition ends (§4).
   Reduced motion: even if a prep class lands, content stays visible.
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  body.home-calm [data-pass].pp-prep,
  body.home-calm [data-pass-reveal].pp-prep,
  body.home-calm .pp-underline.pp-draw,
  body.home-calm .pp-connect.pp-draw {
    opacity: 1 !important;
    transform: none !important;
  }
  body.home-calm .pp-circle.pp-draw path { stroke-dashoffset: 0 !important; }
  body.home-calm .pp-stamp-in { animation: none !important; }
}

/* Tactile card physics & interactive lift across the site */
body.home-calm .step {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
body.home-calm .step:hover {
  transform: translateY(-3px) scale(1.01) !important;
  box-shadow: 8px 10px 0 var(--line) !important;
}

body.home-calm .note-list li {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
body.home-calm .note-list li:hover {
  transform: translateY(-3px) scale(1.01) !important;
  box-shadow: 8px 10px 0 var(--line) !important;
}

/* Subtle breathing glow on the primary action button */
@keyframes pulse-signal-subtle {
  0%, 100% { box-shadow: 5px 5px 0 var(--line); }
  50% { box-shadow: 6px 7px 0 var(--line), 0 0 14px rgba(230, 68, 31, 0.25); }
}
body.home-calm .btn-signal {
  animation: pulse-signal-subtle 4s ease-in-out infinite;
}
body.home-calm .btn-signal:hover {
  animation: none;
}

/* Tactile border styling on active form focus */
body.home-calm .contact-form input:focus,
body.home-calm .contact-form textarea:focus {
  background-color: #fff !important;
}
