/* ===================================================================
   PriceLantern Layouts
   Section patterns, grid helpers, and page-level layout primitives.
   =================================================================== */

/* ======================== BASE RESET ======================== */
*, *::before, *::after { box-sizing: border-box; }

body, html {
  height: 100%;
  margin: 0;
  font-family: var(--pl-font);
  background: var(--pl-dark);
  color: var(--pl-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ======================== CONTAINER ======================== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

/* ======================== SECTIONS ======================== */
.pl-section {
  padding: var(--space-24) 0;
}
.pl-section--dark {
  background: var(--pl-dark);
}
.pl-section--mid {
  background: var(--pl-mid);
}
.pl-section--teal {
  background: var(--pl-teal);
}
.pl-section--gradient {
  background: linear-gradient(170deg, var(--pl-teal) 0%, var(--pl-dark) 100%);
}
.pl-section--light {
  background: var(--pl-ghost-light);
}
.pl-section--cream {
  background: linear-gradient(180deg, var(--pl-surface-cream) 0%, var(--pl-surface-light) 100%);
}
.pl-section--compact {
  padding: var(--space-16) 0;
}
.pl-section--flush {
  padding: 0;
}

/* ======================== SECTION HEADERS ======================== */
.pl-section__header {
  text-align: center;
  margin-bottom: var(--space-12);
}
.pl-section__title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: var(--pl-text-h2);
  line-height: var(--pl-leading-tight);
  margin: 0;
}
.pl-section__title--white { color: var(--pl-white); }
.pl-section__title--dark  { color: var(--pl-dark); }

.pl-section__desc {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-regular);
  font-size: var(--pl-text-body);
  line-height: 1.6;
  max-width: 480px;
  margin: var(--space-2) auto 0;
}
.pl-section__desc--muted { color: var(--pl-carbon); }
.pl-section__desc--light { color: var(--pl-text-muted-dark); }

/* ======================== GRIDS ======================== */
.pl-grid {
  display: grid;
  gap: var(--space-4);
}
.pl-grid--2 { grid-template-columns: repeat(2, 1fr); }
.pl-grid--3 { grid-template-columns: repeat(3, 1fr); }
.pl-grid--4 { grid-template-columns: repeat(4, 1fr); }

.pl-grid--footer {
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--space-12);
}

/* ======================== STEPS LAYOUT ======================== */
.pl-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.pl-steps__item {
  flex: 1;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.pl-steps__divider {
  width: 1px;
  align-self: stretch;
  background: rgba(47, 73, 88, 0.15);
  flex-shrink: 0;
  margin: var(--space-6) 0;
}
.pl-steps__num {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: 2rem;
  line-height: 1;
  margin-bottom: var(--space-3);
}
.pl-steps__num--orange { color: var(--pl-orange); }
.pl-steps__num--blue   { color: var(--pl-blue); }
.pl-steps__num--green  { color: var(--pl-green); }
.pl-steps__title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: var(--pl-text-h4);
  color: var(--pl-dark);
  margin-bottom: var(--space-2);
}
.pl-steps__desc {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-regular);
  font-size: var(--pl-text-sm);
  color: var(--pl-carbon);
  line-height: var(--pl-leading-normal);
  margin: 0;
}

/* ======================== TWO-COL LAYOUT ======================== */
.pl-two-col {
  display: grid;
  gap: clamp(32px, 5vw, 56px);
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .pl-two-col { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(28px, 4vw, 48px); }
}

/* ======================== CENTER LAYOUT ======================== */
.pl-center {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pl-center--col {
  flex-direction: column;
}
.pl-center--full {
  min-height: 100vh;
}

/* ======================== AUTH PAGE LAYOUT ======================== */
.pl-auth-bg {
  background: radial-gradient(ellipse 80% 60% at 50% 20%, #f7f9fb 60%, #e9eef3 100%);
  min-height: 100vh;
  padding: var(--space-12) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-auth-card {
  max-width: 420px;
  width: 100%;
  background: var(--pl-white);
  border-radius: 2rem;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem 2rem;
}
.pl-auth-card__title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: 2rem;
  color: var(--pl-text-dark);
  margin-bottom: var(--space-1);
}
.pl-auth-card__subtitle {
  font-size: 1.1rem;
  color: var(--pl-text-muted);
}

/* ======================== DASHBOARD LAYOUT ======================== */
.pl-dashboard-bg {
  background: linear-gradient(180deg, var(--pl-surface-cream) 0%, var(--pl-surface-light) 100%);
  border-radius: 2rem 2rem 1rem 1rem;
  box-shadow: var(--shadow-md);
  margin: 2.5rem auto 3rem;
  max-width: 1100px;
  padding: 2.5rem 0;
  min-height: 60vh;
}

/* ======================== PROFILE LAYOUT ======================== */
.pl-profile-bg {
  background: radial-gradient(ellipse 120% 120% at 50% 40%, #183153 60%, #0d1a2f 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ======================== LEGAL PAGES ======================== */
.pl-legal {
  padding: var(--space-8) 0 var(--space-24);
}
.pl-legal h1 {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: var(--pl-text-h1);
  color: var(--pl-white);
  margin-bottom: var(--space-4);
}
.pl-legal h3 {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: var(--pl-text-h3);
  color: var(--pl-white);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}
.pl-legal p,
.pl-legal li {
  font-family: var(--pl-font);
  font-size: var(--pl-text-body);
  color: rgba(255, 255, 255, 0.6);
  line-height: var(--pl-leading-relaxed);
}
.pl-legal ul {
  padding-left: var(--space-5);
}
.pl-legal a {
  color: var(--pl-orange);
  text-decoration: underline;
}
.pl-legal a:hover {
  color: var(--pl-orange-hover);
}

/* ============================================================
   FAQ PAGE
   Dark gradient backdrop matching the home hero, animated chips,
   <details>-driven accordion with a custom chevron + smooth open.
   ============================================================ */
.pl-faq {
  position: relative;
  padding: calc(var(--pl-main-offset) + var(--space-8)) 0 var(--space-24);
  background: #0e2636;
  overflow: hidden;
  min-height: 100vh;
}
.pl-faq__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, rgba(26, 65, 88, 0.9) 0%, transparent 72%),
    radial-gradient(ellipse 45% 35% at 82% 12%, rgba(236, 100, 29, 0.10) 0%, transparent 64%),
    radial-gradient(ellipse 38% 30% at 18% 30%, rgba(111, 173, 219, 0.10) 0%, transparent 68%),
    linear-gradient(180deg, #0e2636 0%, #14334a 55%, #0d2130 100%);
}
.pl-faq__grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.15;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}
.pl-faq__inner {
  position: relative;
  z-index: 2;
  max-width: 880px;
}

/* ── Header ── */
.pl-faq__header {
  text-align: center;
  margin-bottom: var(--space-16);
  animation: plFaqFadeUp 0.6s var(--ease-default) both;
}
.pl-faq__eyebrow {
  display: inline-block;
  font-size: var(--pl-text-xs);
  font-weight: var(--pl-font-weight-semi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pl-orange);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--pl-orange-light);
  border: 1px solid rgba(236, 100, 29, 0.25);
  margin-bottom: var(--space-5);
}
.pl-faq__title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: var(--pl-text-display);
  line-height: var(--pl-leading-tight);
  color: var(--pl-white);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}
.pl-faq__title-accent {
  color: var(--pl-orange);
  background: linear-gradient(135deg, var(--pl-orange) 0%, #ff8c4a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pl-faq__subtitle {
  font-size: var(--pl-text-body);
  color: rgba(255, 255, 255, 0.65);
  line-height: var(--pl-leading-relaxed);
  max-width: 560px;
  margin: 0 auto var(--space-8);
}

/* ── Search ── */
.pl-faq__search {
  position: relative;
  max-width: 480px;
  margin: 0 auto var(--space-6);
}
.pl-faq__search-icon {
  position: absolute;
  left: var(--space-5);
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.pl-faq__search-input {
  width: 100%;
  padding: var(--space-4) var(--space-5) var(--space-4) calc(var(--space-5) + 24px);
  font-family: var(--pl-font);
  font-size: var(--pl-text-body);
  color: var(--pl-white);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-pill);
  transition: border-color var(--duration-normal) var(--ease-default),
              background var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
  outline: none;
}
.pl-faq__search-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.pl-faq__search-input:focus {
  border-color: rgba(236, 100, 29, 0.6);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(236, 100, 29, 0.12);
}

/* ── Category chips ── */
.pl-faq__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.pl-faq__chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--pl-text-sm);
  font-weight: var(--pl-font-weight-medium);
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-default);
}
.pl-faq__chip:hover {
  color: var(--pl-white);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--pl-border-light);
  transform: translateY(-1px);
}
.pl-faq__chip--active {
  color: var(--pl-white);
  background: var(--pl-orange-light);
  border-color: rgba(236, 100, 29, 0.5);
  box-shadow: 0 4px 16px rgba(236, 100, 29, 0.2);
}

/* ── Group (category section, now a collapsible <details>) ── */
.pl-faq__group {
  margin-bottom: var(--space-5);
  animation: plFaqFadeUp 0.6s var(--ease-default) both;
  animation-delay: 0.1s;
  scroll-margin-top: calc(var(--pl-main-offset) + var(--space-4));
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s var(--ease-default), background 0.2s var(--ease-default);
}
.pl-faq__group[open] {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(236, 100, 29, 0.28);
  margin-bottom: var(--space-8);
}
/* Strong orange hover cue so the header reads as clickable / expandable. */
.pl-faq__group:hover {
  border-color: rgba(236, 100, 29, 0.55);
  box-shadow: 0 0 0 1px rgba(236, 100, 29, 0.18), 0 6px 20px rgba(236, 100, 29, 0.10);
}

/* Hide the default browser disclosure triangle on the group summary */
.pl-faq__group > summary::-webkit-details-marker { display: none; }
.pl-faq__group > summary { list-style: none; }

.pl-faq__group-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  margin-bottom: 0;
  border-bottom: 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s var(--ease-default);
}
.pl-faq__group-head:hover {
  background: linear-gradient(
    90deg,
    rgba(236, 100, 29, 0.14) 0%,
    rgba(236, 100, 29, 0.06) 100%
  );
}
.pl-faq__group-head:hover .pl-faq__group-title {
  color: var(--pl-orange);
}
.pl-faq__group[open] > .pl-faq__group-head {
  border-bottom: 1px solid var(--pl-border-subtle);
}
.pl-faq__group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--pl-orange-light);
  color: var(--pl-orange);
  border: 1px solid rgba(236, 100, 29, 0.25);
}
.pl-faq__group-title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: var(--pl-text-h3);
  color: var(--pl-white);
  margin: 0;
  letter-spacing: -0.01em;
  flex: 1;
}
/* Chevron that rotates when the group is open */
.pl-faq__group-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--pl-text-muted);
  border-bottom: 2px solid var(--pl-text-muted);
  transform: rotate(45deg);
  transition: transform 0.25s var(--ease-default), border-color 0.2s var(--ease-default);
  margin-right: 6px;
  flex-shrink: 0;
}
.pl-faq__group[open] > .pl-faq__group-head .pl-faq__group-chevron {
  transform: rotate(-135deg);
  border-color: var(--pl-orange);
}
.pl-faq__group-head:hover .pl-faq__group-chevron {
  border-color: var(--pl-white);
}
/* Body wrapper — holds the per-question accordion items when the group is open */
.pl-faq__group-body {
  padding: var(--space-5);
}
.pl-faq__group-body > .pl-faq__item:last-child {
  margin-bottom: 0;
}

/* ── Accordion item ── */
.pl-faq__item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pl-border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  overflow: hidden;
  transition: border-color var(--duration-normal) var(--ease-default),
              background var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
}
.pl-faq__item:hover {
  border-color: var(--pl-border-light);
  background: rgba(255, 255, 255, 0.05);
}
.pl-faq__item[open] {
  border-color: rgba(236, 100, 29, 0.35);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.pl-faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-semi);
  font-size: 1.02rem;
  color: var(--pl-white);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: color var(--duration-fast) var(--ease-default);
}
.pl-faq__question::-webkit-details-marker { display: none; }
.pl-faq__question:hover { color: var(--pl-orange); }

.pl-faq__chevron {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  position: relative;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pl-border-subtle);
  transition: all var(--duration-normal) var(--ease-default);
}
.pl-faq__chevron::before,
.pl-faq__chevron::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform var(--duration-normal) var(--ease-default);
  color: var(--pl-white);
}
.pl-faq__chevron::before { transform: translate(-50%, -50%); }
.pl-faq__chevron::after  { transform: translate(-50%, -50%) rotate(90deg); }
.pl-faq__item[open] .pl-faq__chevron {
  background: var(--pl-orange);
  border-color: var(--pl-orange);
}
.pl-faq__item[open] .pl-faq__chevron::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.pl-faq__answer {
  padding: 0 var(--space-6) var(--space-5);
  animation: plFaqAnswerFade 0.35s var(--ease-default);
}
.pl-faq__answer p {
  font-family: var(--pl-font);
  font-size: var(--pl-text-body);
  color: rgba(255, 255, 255, 0.72);
  line-height: var(--pl-leading-relaxed);
  margin-bottom: var(--space-3);
}
.pl-faq__answer p:last-child { margin-bottom: 0; }
.pl-faq__answer a {
  color: var(--pl-orange);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pl-faq__answer a:hover { color: var(--pl-orange-hover); }
.pl-faq__answer code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pl-border-subtle);
  border-radius: 4px;
  color: var(--pl-ghost);
}

/* ── Empty state (search has no hits) ── */
.pl-faq__empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: rgba(255, 255, 255, 0.6);
}
.pl-faq__empty p:first-child {
  font-size: var(--pl-text-h4);
  font-weight: var(--pl-font-weight-semi);
  color: var(--pl-white);
  margin-bottom: var(--space-2);
}
.pl-faq__empty a {
  color: var(--pl-orange);
  text-decoration: underline;
}

/* ── Bottom CTA card ── */
.pl-faq__cta {
  margin-top: var(--space-12);
  padding: 2px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(236, 100, 29, 0.4) 0%, rgba(111, 173, 219, 0.25) 100%);
}
.pl-faq__cta-inner {
  background: #102230;
  border-radius: calc(var(--radius-lg) - 2px);
  padding: var(--space-10) var(--space-6);
  text-align: center;
}
.pl-faq__cta-title {
  font-family: var(--pl-font);
  font-weight: var(--pl-font-weight-bold);
  font-size: var(--pl-text-h3);
  color: var(--pl-white);
  margin-bottom: var(--space-2);
}
.pl-faq__cta-sub {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--space-6);
}

/* ── Animations ── */
@keyframes plFaqFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes plFaqAnswerFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .pl-faq { padding-top: calc(var(--pl-main-offset) + var(--space-4)); }
  .pl-faq__question { padding: var(--space-4) var(--space-5); font-size: 0.96rem; }
  .pl-faq__answer   { padding: 0 var(--space-5) var(--space-4); }
  .pl-faq__cta-inner { padding: var(--space-8) var(--space-5); }
  .pl-faq__chip { font-size: var(--pl-text-xs); }
}

/* ======================== SCROLL REVEALS ======================== */
.pl-reveal {
  opacity: 0;
  transition: opacity 0.7s ease;
}
.pl-reveal.is-visible {
  opacity: 1;
}
.pl-reveal.is-visible .pl-steps__item,
.pl-reveal.is-visible .pl-feature,
.pl-reveal.is-visible .pl-testimonial {
  animation: plFadeIn 0.5s ease both;
}

@keyframes plFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 991px) {
  .pl-steps {
    flex-direction: column;
    max-width: 400px;
    margin: 0 auto;
  }
  .pl-steps__divider {
    width: 60px;
    height: 1px;
    margin: 0 auto;
  }
  .pl-steps__item { padding: var(--space-6); }
  .pl-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .container { padding: 0 var(--space-4); }
  .pl-grid--3 { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .pl-grid--footer { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .pl-dashboard-bg {
    margin: 1rem auto 2rem;
    border-radius: 1.5rem 1.5rem 0.75rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .pl-grid--2 { grid-template-columns: 1fr; }
  .pl-grid--footer { grid-template-columns: 1fr; gap: var(--space-6); }
}

/* ======================== REDUCED MOTION ======================== */
@media (prefers-reduced-motion: reduce) {
  .pl-reveal {
    opacity: 1;
    transition: none;
  }
  .pl-reveal.is-visible .pl-steps__item,
  .pl-reveal.is-visible .pl-feature,
  .pl-reveal.is-visible .pl-testimonial {
    animation: none;
  }
}
