/* Jungle Haus site: the few page pieces the design system leaves to the
   build. Built only from tokens.css roles and values; components.css
   stays as the design system has it. */

html { background: var(--canvas); }
body { margin: 0; }
.jh-site { min-height: 100vh; display: flex; flex-direction: column; }
.jh-site > main { flex: 1 0 auto; }
img { max-width: 100%; }
/* hidden always wins over a component's display (buttons, notices, steps). */
.jh-site [hidden] { display: none !important; }

/* Skip link: hidden until focused. */
.jh-skip {
  position: absolute; left: var(--space-16); top: var(--space-12); z-index: var(--layer-skip);
  padding: var(--space-12) var(--space-20); border-radius: var(--radius-pill);
  background: var(--action); color: var(--on-action); font-weight: var(--weight-emphasis); text-decoration: none;
  transform: translateY(-200%);
}
.jh-skip:focus { transform: none; }
main:focus { outline: none; }
.jh-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header: the name and one Apply now button ---------- */
/* Until the other pages exist there is no menu, so the button stays in
   the header at every width. */
.jh-header--simple { grid-template-columns: 1fr auto; }
.jh-header--simple .jh-header-end { grid-column: 2; }
@container jh (max-width: 900px) {
  .jh-header--simple .jh-header-cta { display: inline-flex; }
}
@container jh (max-width: 520px) {
  .jh-header--simple .jh-header-cta { min-height: var(--target-compact); padding: var(--space-8) var(--space-20); }
}

/* The open phone menu ends in its own Apply now (Header.astro; the
   design system's .jh-nav-footer, shown only in the sheet). While the menu
   is open the header's own button steps back, so the screen has one Apply
   now, not two (JH Review 1, A13). It keeps its place, so nothing moves.
   The menu's button stays at the foot of the sheet while a long list
   (Services open) scrolls under it, so Apply now is always in view. */
@container jh (max-width: 900px) {
  .jh-header.is-menu-open .jh-header-cta { opacity: 0; visibility: hidden; }
  .jh-nav-footer {
    position: sticky; bottom: calc(-1 * var(--space-32)); z-index: 1;
    margin-bottom: calc(-1 * var(--space-32)); padding-block: var(--space-16) var(--space-32);
    background: var(--canvas);
  }
}

/* ---------- Footer: two short link groups ---------- */
.jh-footer--launch .jh-footer-top { grid-template-columns: 2fr 1fr 1fr; }
.jh-footer--launch .jh-brand { min-height: 0; }
.jh-footer--launch .jh-footer-about p { margin-top: var(--space-20); }
@container jh (max-width: 900px) {
  .jh-footer--launch .jh-footer-top { grid-template-columns: 1fr 1fr; }
}

/* ---------- Home: the two route animations ---------- */
/* An illustration-fill card holding a scene drawn on a 480 × 300 grid, framed to its pieces. The markup is the
   final frame, which is also the reduced-motion still. */
.jh-story { margin: 0; padding: var(--space-24); border-radius: var(--radius-input); background: var(--ill-fill); }
.jh-story svg { display: block; width: 100%; height: auto; overflow: visible; }
@container jh (max-width: 520px) { .jh-story { padding: var(--space-16); } }

.ill-paper { fill: var(--ill-paper); }
.ill-line { fill: none; stroke: var(--ill-quiet); stroke-width: var(--illustration-stroke); }
.ill-paper.ill-line { fill: var(--ill-paper); }
.ill-ink-fill { fill: var(--ill-ink); }
.ill-ink-line { fill: none; stroke: var(--ill-ink); stroke-width: var(--illustration-stroke); stroke-linecap: round; stroke-linejoin: round; }
.ill-paper-line { fill: none; stroke: var(--ill-paper); stroke-width: var(--illustration-stroke); stroke-linecap: round; stroke-linejoin: round; }
.ill-quiet-fill { fill: var(--ill-quiet); }
.ill-fill-fill { fill: var(--ill-fill); }
.ill-green-fill { fill: var(--ill-green); }
.ill-accent-fill { fill: var(--ill-accent); }

/* Pieces that leave the scene (mismatched swatches, the second lettering,
   the to-do pile, the row highlight) are not in the final frame. */
.jh-story .st-out, .jh-story .st-highlight { opacity: 0; }
.jh-story .st { transform-box: fill-box; transform-origin: center; }
.jh-story .st-grow { transform-origin: left center; }

/* Motion: each piece has its own start (--x, --y, --r, --s), delay (--d)
   and duration (--t). Armed, the scene waits on its first frame; playing,
   it runs once and rests on the final frame. */
@media (prefers-reduced-motion: no-preference) {
  .jh-story.is-armed .st {
    animation-duration: var(--t, var(--duration-illustration-step));
    animation-delay: var(--d, 0ms);
    animation-timing-function: var(--ease-out);
    animation-fill-mode: both;
    animation-play-state: paused;
  }
  .jh-story.is-playing .st { animation-play-state: running; }
  .jh-story.is-armed .st-move { animation-name: jh-st-move; animation-timing-function: var(--ease-in-out); }
  .jh-story.is-armed .st-in { animation-name: jh-st-in; }
  .jh-story.is-armed .st-out { animation-name: jh-st-out; animation-timing-function: var(--ease-in-out); }
  .jh-story.is-armed .st-grow { animation-name: jh-st-grow; }
  .jh-story.is-armed .st-pop { animation-name: jh-st-pop; animation-timing-function: var(--ease-soft); }
  .jh-story.is-armed .st-highlight { animation-name: jh-st-highlight; animation-timing-function: var(--ease-in-out); }
  .jh-story.is-armed .st-cursor { animation-name: jh-st-cursor; animation-timing-function: var(--ease-in-out); transform-origin: 0 0; }
}
@keyframes jh-st-move {
  from { transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg)) scale(var(--s, 1)); }
  to { transform: none; }
}
@keyframes jh-st-in {
  from { opacity: 0; transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--s, 1)); }
  to { opacity: 1; transform: none; }
}
@keyframes jh-st-out {
  from { opacity: 1; transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg)); }
  to { opacity: 0; transform: translate(var(--x, 0px), calc(var(--y, 0px) + 40px)) rotate(var(--r, 0deg)); }
}
@keyframes jh-st-grow { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }
/* Grows in and stops at full size: no overshoot (motion decision 10-22). */
@keyframes jh-st-pop {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: none; }
}
/* The highlight steps down the four rows (44 units apart), in time with
   the ticks, then fades once the last row is done. */
@keyframes jh-st-highlight {
  0% { opacity: 0; transform: translateY(0); }
  8%, 25% { opacity: 1; transform: translateY(0); }
  31%, 52% { opacity: 1; transform: translateY(44px); }
  56%, 72% { opacity: 1; transform: translateY(88px); }
  75%, 92% { opacity: 1; transform: translateY(132px); }
  100% { opacity: 0; transform: translateY(132px); }
}
/* The cursor arrives at the check control, then clicks once per row. */
@keyframes jh-st-cursor {
  0% { opacity: 0; transform: translate(-150px, 70px); }
  8% { opacity: 1; }
  30% { transform: translate(0, 0) scale(1); }
  33% { transform: scale(.82); }
  37%, 51% { transform: scale(1); }
  54% { transform: scale(.82); }
  57%, 70% { transform: scale(1); }
  73% { transform: scale(.82); }
  76%, 88% { transform: scale(1); }
  91% { transform: scale(.82); }
  94%, 100% { opacity: 1; transform: scale(1); }
}

/* ---------- Apply ---------- */
.jh-apply { display: grid; grid-template-columns: minmax(0, 760px) minmax(240px, 1fr); gap: var(--space-40) var(--space-72); align-items: start; }
.jh-apply-aside { position: sticky; top: calc(var(--header-height) + var(--space-32)); padding: var(--card-padding); border-radius: var(--radius-card); background: var(--surface); box-shadow: inset 0 0 0 var(--stroke-hairline) var(--hairline); }
.jh-apply-aside .jh-h4 { margin-bottom: var(--space-16); }
.jh-apply-aside ol { margin: 0; padding: 0; list-style: none; counter-reset: jh-next; }
.jh-apply-aside li { display: grid; grid-template-columns: var(--space-32) 1fr; padding-block: var(--space-12); border-top: var(--stroke-hairline) solid var(--line); counter-increment: jh-next; color: var(--text-muted); }
.jh-apply-aside li::before { content: counter(jh-next, decimal-leading-zero); font: var(--weight-emphasis) var(--text-label)/1.9 var(--font-numeric); letter-spacing: var(--tracking-label); color: var(--accent); font-variant-numeric: tabular-nums; }
.jh-apply .jh-form { max-width: none; }

/* The form in four steps: a progress line, one group of questions at a
   time, then Back and Continue (Apply now on the last step). */
.jh-steps-shell { margin: 0; padding: 0; border: 0; min-width: 0; }
.jh-progress { display: grid; gap: var(--space-12); margin-bottom: var(--space-32); }
.jh-progress-label { margin: 0; font: var(--weight-emphasis) var(--text-label)/1.4 var(--font-text); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.jh-progress-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-8); margin: 0; padding: 0; list-style: none; }
.jh-progress-bar li { height: 4px; border-radius: 2px; background: var(--line); transition: background-color var(--duration-section) var(--ease-standard); }
.jh-progress-bar li.is-done, .jh-progress-bar li.is-current { background: var(--action); }
.jh-step-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.jh-step-group > legend { display: block; width: 100%; margin-bottom: var(--space-24); padding: 0; }
.jh-step-group > legend h2 { margin: 0; }
.jh-step-group > legend h2:focus { outline: none; }
.jh-step-group:not([hidden]) { animation: jh-step-in var(--duration-section) var(--ease-out); }
@keyframes jh-step-in { from { opacity: 0; transform: translateY(var(--reveal-travel)); } to { opacity: 1; transform: none; } }

/* Kind of help: three large choices; a click or tap moves on. */
.jh-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-16); }
.jh-pick { position: relative; display: flex; }
.jh-pick input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.jh-pick-body {
  display: grid; align-content: start; gap: var(--space-8); width: 100%;
  padding: var(--space-24); border-radius: var(--radius-card); background: var(--surface);
  box-shadow: inset 0 0 0 var(--stroke-hairline) var(--border);
  transition: background-color var(--duration-control) var(--ease-standard), box-shadow var(--duration-control) var(--ease-standard);
}
.jh-pick-body .jh-tile { margin-bottom: var(--space-12); background: var(--raised); }
.jh-pick-name { font: var(--weight-display) var(--text-subheading)/var(--leading-snug) var(--font-display); letter-spacing: var(--tracking-heading); color: var(--text); }
.jh-pick-text { font-size: var(--text-body-sm); color: var(--text-muted); }
.jh-pick:hover .jh-pick-body { background: var(--raised); }
.jh-pick input:checked + .jh-pick-body { background: color-mix(in srgb, var(--action) 10%, var(--surface)); box-shadow: inset 0 0 0 2px var(--action); }
.jh-pick input:checked + .jh-pick-body .jh-tile { background: var(--action); color: var(--on-action); }
.jh-pick input:focus-visible + .jh-pick-body { outline: var(--stroke-focus) solid var(--focus); outline-offset: var(--focus-offset); }
.jh-step-group[aria-invalid="true"] .jh-pick-body { box-shadow: inset 0 0 0 var(--stroke-hairline) var(--error); }

.jh-step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-16); margin-top: var(--space-40); padding-top: var(--space-24); border-top: var(--stroke-hairline) solid var(--line); }
.jh-step-actions [data-back] { order: 0; }
.jh-step-actions .jh-button--primary { order: 1; }
.jh-step-note { order: 2; margin: 0 0 0 auto; font-size: var(--text-body-sm); color: var(--text-muted); }
@container jh (max-width: 900px) {
  .jh-picks { grid-template-columns: 1fr; gap: var(--space-12); }
  .jh-pick-body { grid-template-columns: var(--tile-size) 1fr; column-gap: var(--space-16); padding: var(--space-20); }
  .jh-pick-body .jh-tile { grid-row: 1 / 3; margin: 0; }
}
@container jh (max-width: 520px) {
  .jh-step-actions { flex-direction: column-reverse; align-items: stretch; }
  .jh-step-actions .jh-button { width: 100%; }
  .jh-step-note { margin: 0; text-align: center; order: -1; }
}
.jh-form-note { grid-column: 1 / -1; margin: 0; font-size: var(--text-body-sm); color: var(--text-muted); }
.jh-form-note a { color: var(--link); text-underline-offset: 3px; }
.jh-notice--error { box-shadow: inset 0 0 0 var(--stroke-hairline) var(--error); }
.jh-notice--error .jh-icon { color: var(--error); }
.jh-confirmation:focus, .jh-notice:focus { outline: none; }
.jh-button[aria-disabled="true"] { opacity: var(--opacity-disabled); cursor: progress; }
@container jh (max-width: 900px) {
  .jh-apply { grid-template-columns: 1fr; }
  .jh-apply-aside { position: static; }
}

/* ---------- Privacy and Terms ---------- */
.jh-page-head { max-width: var(--measure); margin-bottom: var(--space-40); }
.jh-page-head .jh-notice { margin-bottom: var(--space-32); }
.jh-prose { max-width: var(--measure); font-size: var(--text-body-lg); line-height: var(--leading-body); }
.jh-prose > :first-child { margin-top: 0; }
.jh-prose h2 { margin: var(--space-56) 0 var(--space-16); font: var(--weight-display) var(--text-heading-sm)/var(--leading-heading) var(--font-display); letter-spacing: var(--tracking-heading); }
.jh-prose h3 { margin: var(--space-32) 0 var(--space-12); font: var(--weight-display) var(--text-subheading)/var(--leading-snug) var(--font-display); letter-spacing: var(--tracking-heading); }
.jh-prose p, .jh-prose ul, .jh-prose ol { margin: 0 0 var(--space-16); }
.jh-prose ul, .jh-prose ol { padding-left: var(--space-24); }
.jh-prose li { margin-bottom: var(--space-8); }
.jh-prose li > ul, .jh-prose li > ol { margin: var(--space-8) 0 0; }
.jh-prose strong { font-weight: var(--weight-strong); }
.jh-prose hr { margin: var(--space-40) 0; border: 0; border-top: var(--stroke-hairline) solid var(--line); }
.jh-prose a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.jh-prose a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
.jh-prose .jh-table-wrap { margin: 0 0 var(--space-24); overflow-x: auto; }
.jh-prose table { width: 100%; border-collapse: collapse; font-size: var(--text-body); }
.jh-prose th, .jh-prose td { padding: var(--space-12) var(--space-16) var(--space-12) 0; border-bottom: var(--stroke-hairline) solid var(--line); text-align: left; vertical-align: top; }
.jh-prose th { font-weight: var(--weight-emphasis); }
/* On desktop, the list of sections stays in view beside the text. */
.jh-legal { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(200px, 260px); justify-content: space-between; gap: var(--space-72); align-items: start; }
.jh-legal > .jh-prose { grid-column: 1; grid-row: 1; }
.jh-toc { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--header-height) + var(--space-32)); padding-left: var(--space-24); border-left: var(--stroke-hairline) solid var(--line); }
.jh-toc .jh-label { margin-bottom: var(--space-12); }
.jh-toc ol { margin: 0; padding: 0; list-style: none; }
.jh-toc a { display: block; padding-block: var(--space-4); border-radius: var(--radius-structural); font-size: var(--text-body-sm); line-height: var(--leading-snug); color: var(--text-muted); text-decoration: none; }
.jh-toc a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.jh-prose h2 { scroll-margin-top: calc(var(--header-height) + var(--space-24)); }
@container jh (max-width: 900px) {
  .jh-legal { display: block; }
  .jh-toc { display: none; }
}
/* Points the draft still leaves open, marked as the draft marks them. */
.jh-gap { padding: 0 var(--space-4); border-radius: var(--radius-structural); background: var(--raised); color: var(--text); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
@container jh (max-width: 520px) {
  .jh-prose { font-size: var(--text-body); }
  .jh-prose h2 { margin-top: var(--space-40); }
}

@media (forced-colors: active) {
  .jh-gap { border: 1px solid CanvasText; }
}

/* The icon sprite: symbols only, never shown itself. */
.jh-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
