/* The FAQ page (plan.md, FAQ): calm and searchable. Tokens only (design\system.css); the components from
   design\components.css (the FAQ items, the page close). */

/* ---------- hero: the photo framed at the page's width, a paper card rising over its foot, centered (no other header
   opens so). The frame's height follows the photo's drawn height, so the owner's face and her phone stay clear of the
   card at every width; full-bleed on the phone. ---------- */
.faqp-hero { position: relative; padding-top: var(--space-4); padding-bottom: var(--space-5); }
.faqp-hero__media {
  position: relative; width: min(var(--max-w), 100% - 2 * var(--gutter)); height: clamp(340px, 34vw, 460px); margin-inline: auto;
  overflow: hidden; border-radius: var(--radius-l); background: var(--c-paper-alt);
}
.faqp-hero__photo { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); max-width: none; object-fit: cover; object-position: 50% 36%; }
.faqp-hero__in { position: relative; z-index: 2; margin-top: -48px; }
.faqp-hero__card {
  position: relative; display: grid; justify-items: center; gap: var(--space-3); width: min(880px, 100%); margin-inline: auto;
  padding: var(--space-5) var(--space-5) var(--space-4); border: 1px solid var(--c-line); border-radius: var(--radius-m);
  background: var(--c-paper); box-shadow: var(--shadow-l); text-align: center;
}
.faqp-hero__title { max-width: 18ch; font-size: var(--fs-h1); }
.faqp-hero__line { max-width: 36rem; color: var(--c-ink-soft); }

/* the search: the questions filter as you type (faq.js) */
.faqp-search {
  display: flex; align-items: center; width: min(640px, 100%); margin-top: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--c-brand) 35%, transparent); border-radius: var(--radius-m);
  background: var(--c-paper); box-shadow: var(--shadow-s); transition: border-color var(--dur-fast) var(--ease-out);
}
.faqp-search:focus-within { border-color: var(--c-brand); outline: 3px solid var(--c-leaf); outline-offset: 2px; }
.faqp-search__icon { flex: none; width: 22px; height: 22px; margin-left: var(--space-3); color: var(--c-brand); }
.faq__search {
  flex: 1; min-width: 0; min-height: 58px; padding: 0 var(--space-2); border: 0; background: transparent; color: var(--c-ink);
  font: 600 var(--fs-ui) var(--font-ui); outline: none; -webkit-appearance: none; appearance: none;
}
.faq__search:focus-visible { outline: none; }
.faq__search::placeholder { color: var(--c-ink-soft); font-weight: 500; opacity: 1; }
.faqp-search__go {
  flex: none; min-height: 46px; margin: 5px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-s);
  background: var(--c-ink); color: var(--c-on-ink); font: 800 var(--fs-ui) var(--font-ui); cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.faqp-search__go:hover { background: var(--c-brand); }

/* the topics, squared chips like the picker's */
.faqp-hero__topics { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1); }
.faqp-chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--c-line);
  border-radius: var(--radius-s); background: var(--c-paper); color: var(--c-ink); font-family: var(--font-display);
  font-size: var(--fs-ui); font-weight: 600; text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.faqp-chip:hover { border-color: var(--c-brand); background: var(--c-brand-light); }

/* ---------- faq: every question by topic; the rail marks the topic in view ---------- */
.faqp { padding-top: var(--space-5); }
.faqp__grid { display: grid; grid-template-columns: 240px minmax(0, 820px); justify-content: center; gap: var(--space-6); align-items: start; }
.faqp__rail { position: sticky; top: calc(76px + var(--space-5)); }
.faqp__rail ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--c-line); }
.faqp__rail a {
  display: block; margin-left: -1px; padding: var(--space-1) 0 var(--space-1) var(--space-3); border-left: 2px solid transparent;
  color: var(--c-ink-soft); font-size: var(--fs-small); font-weight: 700; text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.faqp__rail a:hover { color: var(--c-ink); }
.faqp__rail a[aria-current="true"] { border-left-color: var(--c-leaf); color: var(--c-ink); }
.faqp__rail a[data-empty] { opacity: 0.4; }
.faqp-topic { scroll-margin-top: calc(76px + var(--space-4)); }
.faqp-topic[hidden] { display: none; }
.faqp-topic + .faqp-topic { margin-top: var(--space-5); }
.faqp-topic__title { margin-bottom: var(--space-3); font-size: var(--fs-h3); }
.faqp .faq__item { scroll-margin-top: calc(76px + var(--space-4)); }
.faqp__none {
  margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--c-line); border-radius: var(--radius-m);
  background: var(--c-paper-alt); color: var(--c-ink-soft); text-align: center; scroll-margin-top: calc(76px + var(--space-4));
}
.faqp__none[hidden] { display: none; }
.faqp__none a { font-weight: 800; }

/* ---------- close: the band over a fence crew setting posts, its words on the left over the fence, the team's
   reply arriving in glass above them; the installer on the right stays clear ---------- */
.faqp-close .pclose__photo { object-position: 58% 50%; }
.faqp-close .pclose__media::after {
  background: linear-gradient(90deg, var(--c-shade) 0%, color-mix(in srgb, var(--c-shade) 88%, transparent) 38%, color-mix(in srgb, var(--c-shade) 46%, transparent) 52%, transparent 66%);
}
.faqp-close__chatbox { position: absolute; z-index: 2; top: 96px; left: max(var(--gutter), (100% - var(--max-w)) / 2); width: min(340px, 100% - 2 * var(--gutter)); }
.faqp-close .stop--chat { top: 0; right: -52px; }
/* a chat window: its head at the top, the messages from the foot up; over the shade, the glass is a little denser */
.faqp-chat {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--c-paper) 94%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--c-paper) 60%, transparent); box-shadow: var(--shadow-l);
  font: 500 14px/1.4 var(--font-ui); color: var(--c-ink);
}
.faqp-chat__head { margin-bottom: auto; padding: 2px 2px 8px; border-bottom: 1px solid var(--c-line); font: 700 13px/1.2 var(--font-ui); color: var(--c-ink-soft); }
.faqp-chat__msg { margin: 0; opacity: calc(var(--kit-in, 1) * (1 - var(--kit-out, 0))); transform: translateY(calc((1 - var(--kit-in, 1)) * 10px)); }
.faqp-chat__msg--first { opacity: var(--kit-in, 1); }
.faqp-chat__msg--you { align-self: flex-end; max-width: 88%; padding: 8px 12px; border-radius: 12px 12px 4px 12px; background: var(--c-brand); color: var(--c-on-brand); }
.faqp-chat__msg--team { align-self: flex-start; max-width: 92%; padding: 8px 12px 9px; border-radius: 12px 12px 12px 4px; background: var(--c-paper); border: 1px solid var(--c-line); }
.faqp-chat__msg--team p { margin: 0; font-weight: 600; }
.faqp-chat__by { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--c-accent-text); font: 700 13px/1.2 var(--font-ui); }
.faqp-chat__by svg { flex: none; width: 15px; height: 15px; fill: currentColor; }
.faqp-chat__typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 11px 12px; border-radius: 12px; background: var(--c-paper); }
.faqp-chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ink-soft); animation: faqp-dot 1.2s ease-in-out infinite; }
.faqp-chat__typing i:nth-child(2) { animation-delay: 0.2s; }
.faqp-chat__typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes faqp-dot { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .faqp-chat__typing i { animation: none; } }
/* the second way, Contact, as a line button on the navy; the main button's note under both */
.faqp-close .button--line { color: var(--c-on-ink); border-color: color-mix(in srgb, var(--c-on-ink) 45%, transparent); }
.faqp-close .button--line:hover { background: color-mix(in srgb, var(--c-on-ink) 12%, transparent); border-color: var(--c-on-ink); }
.faqp-close .cta-row__note { flex-basis: 100%; }
@media (min-width: 761px) {
  .faqp-close .pclose__in { justify-items: start; padding-top: 360px; padding-right: 50%; text-align: left; }
  .faqp-close .pclose__title { max-width: 15ch; font-size: var(--fs-h2); }
  .faqp-close .pclose__cta { justify-content: flex-start; }
}

/* ---------- the phone and the tablet ---------- */
@media (max-width: 1000px) {
  .faqp__grid { grid-template-columns: minmax(0, 820px); }
  .faqp__rail { display: none; }
}
@media (max-width: 760px) {
  .faqp-hero { padding-top: 0; }
  .faqp-hero__media { width: 100%; height: 380px; border-radius: 0; }
  .faqp-hero__photo { object-position: 78% 36%; }
  .faqp-hero__card { justify-items: start; padding: var(--space-4) var(--space-3) var(--space-3); text-align: left; }
  .faqp-hero__topics { justify-content: flex-start; }
  /* the close: the photo taller (3:4), the reply over its foot on the left, the installer clear on the right */
  .faqp-close .pclose__media { aspect-ratio: 3 / 4; }
  .faqp-close .pclose__photo { object-position: 66% 50%; }
  .faqp-close__chatbox { top: auto; bottom: var(--space-2); left: var(--space-2); width: min(240px, 100% - 2 * var(--space-2)); }
  .faqp-close .stop--chat { top: -52px; right: 0; }
  /* held at its full height from the start, so its top (and the stop icon above it) never moves as the reply lands */
  .faqp-chat { min-height: 246px; }
}
@media (max-width: 480px) {
  .faqp-search__go { display: none; }
}
