/*
 * faq.css
 * Path: public/css/frontend/faqs/faq.css
 * Styles for the FAQ section (resources/views/reviews/faqs/faq.blade.php + public/js/frontend/faqs/faq.js).
 * Same design as R4PFaq.jsx, converted same to same for Blade.
 *
 * Rules this file follows:
 * 1. Every class, CSS variable and keyframe starts with r4pq- so nothing clashes with the rest of the project.
 * 2. No bare element selectors and no unscoped *. Everything hangs off the .r4pq section root.
 * 3. Variables live on the section root, not :root.
 * 4. Theme: the page sets data-theme="light" or "dark" on <html>. This file only reads it.
 *    The section has no toggle, no localStorage and no prefers-color-scheme logic of its own.
 * 5. Font: Sora is loaded once by the page. This file never imports it.
 * 6. Colours come from tokens only. Change a colour in the two token blocks, nowhere else.
 *
 * Views: phone under 640, tablet 640 to 1023, laptop and Chromebook 1024 and up.
 */

.r4pq{
  --r4pq-surface:#F3F5FB;
  --r4pq-card:#FFFFFF;
  --r4pq-border:#E3E7F5;
  --r4pq-border-hover:#B8C3F7;
  --r4pq-ink:#0B1240;
  --r4pq-muted:#5B6491;
  --r4pq-brand:#2B4DFF;
  --r4pq-on-brand:#FFFFFF;
  --r4pq-tint:rgba(43,77,255,.08);
  --r4pq-shadow:rgba(11,18,64,.25);
  --r4pq-sk-base:#E3E7F5;
  --r4pq-sk-hi:rgba(255,255,255,.8);
  --r4pq-ease:cubic-bezier(.22,1,.36,1);
  --r4pq-px:16px;
}
[data-theme="dark"] .r4pq{
  --r4pq-surface:#080E33;
  --r4pq-card:#0F1740;
  --r4pq-border:#1F2A5E;
  --r4pq-border-hover:#3B4C9E;
  --r4pq-ink:#E8ECFF;
  --r4pq-muted:#9AA6D6;
  --r4pq-brand:#7C93FF;
  --r4pq-on-brand:#0B1240;
  --r4pq-tint:rgba(124,147,255,.14);
  --r4pq-shadow:rgba(0,0,0,.55);
  --r4pq-sk-base:#1F2A5E;
  --r4pq-sk-hi:rgba(124,147,255,.18);
}

/* Root and layout (phone first) */
.r4pq{
  position:relative;
  box-sizing:border-box;
  width:100%;
  background:var(--r4pq-surface);
  color:var(--r4pq-ink);
  font-family:"Sora",ui-sans-serif,system-ui,sans-serif;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  padding:clamp(48px,9vw,96px) max(clamp(16px,4vw,32px),env(safe-area-inset-left)) clamp(48px,9vw,96px);
}
.r4pq *,.r4pq *::before,.r4pq *::after{box-sizing:border-box}
.r4pq-wrap{
  max-width:1160px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:clamp(24px,5vw,36px);
}
.r4pq-side{display:contents}
.r4pq-head{order:1;text-align:center}
.r4pq-list{order:2}
.r4pq-help{order:3}

.r4pq-title{
  margin:0;
  color:var(--r4pq-ink);
  font-size:clamp(26px,7vw,34px);
  font-weight:700;
  line-height:1.2;
  letter-spacing:-.01em;
  text-wrap:balance;
}
.r4pq-sub{
  margin:10px auto 0;
  max-width:42ch;
  color:var(--r4pq-muted);
  font-size:15px;
  line-height:1.6;
  text-wrap:pretty;
}

/* Accordion */
.r4pq-list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:10px;
  min-width:0;
}
.r4pq-item{
  position:relative;
  min-width:0;
  background:var(--r4pq-card);
  border:1px solid var(--r4pq-border);
  border-radius:16px;
}
.r4pq-item[data-open="true"]{
  border-color:var(--r4pq-brand);
  box-shadow:0 14px 34px -22px var(--r4pq-shadow);
}
.r4pq-h{margin:0;font:inherit}
.r4pq-q{
  appearance:none;
  -webkit-appearance:none;
  display:flex;
  align-items:center;
  gap:14px;
  width:100%;
  min-height:60px;
  margin:0;
  padding:14px var(--r4pq-px);
  background:transparent;
  border:0;
  border-radius:15px;
  color:var(--r4pq-ink);
  font:inherit;
  text-align:left;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.r4pq-q:active{background:var(--r4pq-tint)}
.r4pq-num{display:none}
.r4pq-qt{
  flex:1;
  min-width:0;
  font-size:15px;
  font-weight:600;
  line-height:1.4;
  overflow-wrap:anywhere;
  text-wrap:pretty;
}
.r4pq-chev{
  flex:none;
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border-radius:999px;
  border:1px solid var(--r4pq-border-hover);
  background:var(--r4pq-tint);
  color:var(--r4pq-brand);
}
.r4pq-chev svg{display:block;width:16px;height:16px}
.r4pq-item[data-open="true"] .r4pq-chev{
  background:var(--r4pq-brand);
  border-color:var(--r4pq-brand);
  color:var(--r4pq-on-brand);
  transform:rotate(180deg);
}

/* Answer panel: grid rows open the height without measuring it */
.r4pq-panel{
  display:grid;
  grid-template-rows:0fr;
  visibility:hidden;
}
.r4pq-item[data-open="true"] .r4pq-panel{
  grid-template-rows:1fr;
  visibility:visible;
}
.r4pq-panel-in{min-height:0;overflow:hidden}
.r4pq-a{padding:0 var(--r4pq-px) 18px}
.r4pq-a-p{
  margin:0 0 .75em;
  max-width:64ch;
  color:var(--r4pq-muted);
  font-size:15px;
  line-height:1.7;
  overflow-wrap:anywhere;
}
.r4pq-a-p:last-child{margin-bottom:0}

/* Help card (only when helpHref is set) */
.r4pq-help{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
  padding:18px var(--r4pq-px);
  background:var(--r4pq-card);
  border:1px solid var(--r4pq-border);
  border-radius:16px;
}
.r4pq-help-t{margin:0;color:var(--r4pq-ink);font-size:16px;font-weight:700;line-height:1.35}
.r4pq-help-p{margin:0;color:var(--r4pq-muted);font-size:14.5px;line-height:1.6}
.r4pq-help-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  align-self:stretch;
  min-height:44px;
  margin-top:12px;
  padding:0 22px;
  background:var(--r4pq-brand);
  border-radius:999px;
  color:var(--r4pq-on-brand);
  font-size:14.5px;
  font-weight:600;
  text-decoration:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.r4pq-help-btn:active{transform:scale(.98)}

/* Keyboard focus */
.r4pq-q:focus-visible,
.r4pq-help-btn:focus-visible{
  outline:2px solid var(--r4pq-brand);
  outline-offset:2px;
}

/* Hover only on devices that really hover */
@media (hover:hover) and (pointer:fine){
  .r4pq-item[data-open="false"]:hover{border-color:var(--r4pq-border-hover)}
  .r4pq-q:hover .r4pq-qt{color:var(--r4pq-brand)}
  .r4pq-item[data-open="false"]:hover .r4pq-num{color:var(--r4pq-brand)}
  .r4pq-help-btn:hover{transform:translateY(-1px);box-shadow:0 10px 20px -10px var(--r4pq-shadow)}
}

/* Tablet: one centred column, a bit more room */
@media (min-width:640px){
  .r4pq{--r4pq-px:22px}
  .r4pq-wrap{max-width:760px}
  .r4pq-list{gap:12px}
  .r4pq-q{min-height:64px;padding-top:16px;padding-bottom:16px}
  .r4pq-qt{font-size:16px}
  .r4pq-a{padding-bottom:20px}
  .r4pq-a-p{font-size:15.5px}
  .r4pq-help{flex-direction:row;align-items:center;justify-content:space-between;gap:20px}
  .r4pq-help-txt{min-width:0}
  .r4pq-help-btn{align-self:auto;margin-top:0;flex:none}
}

/* Laptop and Chromebook: two columns, heading stays in view, big numerals in a left gutter */
@media (min-width:1024px){
  .r4pq{--r4pq-px:26px;--r4pq-gut:56px;--r4pq-gap:18px}
  .r4pq-wrap{
    max-width:1160px;
    display:grid;
    grid-template-columns:minmax(260px,340px) minmax(0,1fr);
    column-gap:clamp(40px,6vw,88px);
    align-items:start;
  }
  .r4pq-side{display:block;position:sticky;top:clamp(16px,4vh,40px)}
  .r4pq-head{text-align:left}
  .r4pq-title{font-size:clamp(30px,3vw,40px)}
  .r4pq-sub{margin-left:0;font-size:16px}
  .r4pq-qt{font-size:16.5px}
  .r4pq-a-p{font-size:16px}
  .r4pq-help{
    margin-top:28px;
    flex-direction:column;
    align-items:flex-start;
    justify-content:flex-start;
    gap:4px;
    padding:20px;
  }
  .r4pq-help-btn{align-self:flex-start;margin-top:12px}

  /* Numerals: only the number is big, the text stays normal. A hairline splits the gutter from the text. */
  .r4pq--num .r4pq-item::before{
    content:"";
    position:absolute;
    top:0;
    bottom:0;
    left:var(--r4pq-gut);
    width:1px;
    background:var(--r4pq-border);
    pointer-events:none;
  }
  .r4pq--num .r4pq-item[data-open="true"]::before{background:var(--r4pq-brand)}
  .r4pq--num .r4pq-q{min-height:64px;gap:var(--r4pq-gap);padding-left:0}
  .r4pq--num .r4pq-a{padding-left:calc(var(--r4pq-gut) + var(--r4pq-gap))}
  .r4pq-num{
    display:block;
    flex:none;
    width:var(--r4pq-gut);
    text-align:center;
    color:var(--r4pq-muted);
    font-size:clamp(15px,1.3vw,18px);
    font-weight:700;
    line-height:1;
    letter-spacing:.02em;
    font-variant-numeric:tabular-nums;
  }
}
/* The number of the open row turns brand */
.r4pq-item[data-open="true"] .r4pq-num{color:var(--r4pq-brand)}

/* Short laptop screens such as Chromebooks (about 768px high) */
@media (min-width:1024px) and (max-height:820px){
  .r4pq{padding-top:clamp(40px,7vh,64px);padding-bottom:clamp(40px,7vh,64px);--r4pq-gut:52px;--r4pq-gap:16px}
  .r4pq-list{gap:10px}
  .r4pq-q{min-height:56px;padding-top:12px;padding-bottom:12px}
  .r4pq--num .r4pq-q{min-height:58px}
  .r4pq-num{font-size:16px}
  .r4pq-help{margin-top:20px}
}

/* Skeleton: same wrapper, rows, gutter and breakpoints as the real section */
.r4pq-sr{
  position:absolute;
  width:1px;
  height:1px;
  margin:-1px;
  padding:0;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
  border:0;
}
.r4pq-sk-b{position:relative;display:block;overflow:hidden;border-radius:999px}
.r4pq-sk .r4pq-sk-b{background:var(--r4pq-sk-base)}
.r4pq-sk-b::after{
  content:"";
  position:absolute;
  inset:0;
  transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,var(--r4pq-sk-hi),transparent);
}
.r4pq-sk .r4pq-q{cursor:default}
.r4pq-sk .r4pq-q:active{background:transparent}
.r4pq-sk .r4pq-chev{border-color:transparent}
.r4pq-sk-title{height:32px;width:min(300px,72%);margin:0 auto}
.r4pq-sk-title2{display:none}
.r4pq-sk-sub{height:14px;width:min(260px,80%);margin:14px auto 0}
.r4pq-sk-line{height:15px;max-width:100%}
.r4pq-sk-num{width:1.25em;height:.8em;border-radius:8px}
.r4pq-sk-al{height:12px;margin:7px 0}
.r4pq-sk-h1{height:16px;width:150px;max-width:100%}
.r4pq-sk-h2{height:13px;width:180px;max-width:100%;margin-top:10px}
.r4pq-sk .r4pq-sk-btn{height:44px;min-width:0;padding:0}
@media (min-width:640px){
  .r4pq-sk .r4pq-sk-btn{width:130px}
}
@media (min-width:1024px){
  .r4pq-sk-title{height:38px;width:78%;margin:0}
  .r4pq-sk-title2{display:block;height:38px;width:56%;margin:10px 0 0}
  .r4pq-sk-sub{height:15px;margin:18px 0 0}
}

/* One staggered reveal on first view. Content shows by default if JS or the observer is missing. */
.r4pq[data-reveal="pending"] .r4pq-rv{opacity:0}
.r4pq[data-reveal="done"] .r4pq-rv{
  animation:r4pq-rise .5s var(--r4pq-ease) both;
  animation-delay:min(calc(var(--r4pq-i,0) * 70ms),700ms);
}
@keyframes r4pq-rise{
  from{opacity:0;transform:translateY(14px)}
  to{opacity:1;transform:none}
}
@keyframes r4pq-shim{to{transform:translateX(100%)}}

/* Motion: transform and shadow only, never colours, so a theme flip lands in one frame */
@media (prefers-reduced-motion:no-preference){
  .r4pq-panel{
    transition:grid-template-rows .35s var(--r4pq-ease),visibility 0s linear .35s;
  }
  .r4pq-item[data-open="true"] .r4pq-panel{
    transition:grid-template-rows .35s var(--r4pq-ease),visibility 0s linear 0s;
  }
  .r4pq-chev{transition:transform .35s var(--r4pq-ease)}
  .r4pq-help-btn{transition:transform .25s var(--r4pq-ease),box-shadow .25s var(--r4pq-ease)}
  .r4pq-sk-b::after{animation:r4pq-shim 1.5s ease-in-out infinite}
}
@media (prefers-reduced-motion:reduce){
  .r4pq .r4pq-rv{animation:none !important;opacity:1 !important;transform:none !important}
}

/* Rich answers (only used when the page sends trusted HTML answers) */
.r4pq-a-p a{color:var(--r4pq-brand);text-decoration:underline;text-underline-offset:2px}
.r4pq-a-p a:focus-visible{outline:2px solid var(--r4pq-brand);outline-offset:2px}
.r4pq-a-p strong{color:var(--r4pq-ink)}
