/* ============================================================
   Ciphers Questions — Frontend Styles
   All colors driven by CSS variables injected per-instance.
   ============================================================ */

/* ── WRAP ────────────────────────────────────────────────── */
.cq-wrap {
  position: relative;
  overflow: hidden;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Grain overlay */
.cq-wrap.cq-grain::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

.cq-wrap > * { position: relative; z-index: 1; }

/* Inner containers — no max-width or padding; Elementor controls the column */
.cq-wrap .cq-tabs,
.cq-wrap .cq-list,
.cq-wrap .cq-cta {
  max-width: 100%;
}

/* ── HEADER ──────────────────────────────────────────────── */
.cq-header {
  margin-bottom: 48px;
}

.cq-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cq-eyebrow, #133E87);
  margin-bottom: 16px;
}

.cq-eyebrow-line {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--cq-eyebrow, #133E87);
  flex-shrink: 0;
}

.cq-headline {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  color: var(--cq-headline, #1A1A2E);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}

.cq-headline em {
  font-style: italic;
  color: var(--cq-headline-em, #608BC1);
}

.cq-desc {
  font-size: 16px;
  line-height: 1.8;
  color: var(--cq-desc, #4A4A5A);
  max-width: 560px;
  margin: 0;
}

/* ── FILTER TABS ─────────────────────────────────────────── */
.cq-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.cq-tab {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 40px;
  border: 1.5px solid var(--cq-tab-border, #E2E2EA);
  background: transparent;
  color: var(--cq-tab-text, #8A8A9A);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.cq-tab:hover {
  border-color: var(--cq-tab-active-bg, #133E87);
  color: var(--cq-tab-active-bg, #133E87);
}

.cq-tab.active {
  background: var(--cq-tab-active-bg, #133E87);
  border-color: var(--cq-tab-active-bg, #133E87);
  color: var(--cq-tab-active-tx, #ffffff);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ── QUESTION LIST ───────────────────────────────────────── */
.cq-list {
  display: flex;
  flex-direction: column;
}

/* ── SINGLE ITEM ─────────────────────────────────────────── */
.cq-item {
  position: relative;
  border-top: 1px solid var(--cq-divider, #E2E2EA);
  overflow: hidden;
  transition: background 0.25s ease;
}

/* ── SCROLL-REVEAL ANIMATION ─────────────────────────────── */

/* JS primes items with this class before they enter viewport */
.cq-will-animate {
  opacity: 0;
  transform: translateY(28px);
  transition:
    background 0.25s ease,
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--cq-reveal-delay, 0ms),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--cq-reveal-delay, 0ms);
}

/* JS adds this once item scrolls into view */
.cq-will-animate.cq-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Items beyond the per-tab limit */
.cq-over-limit {
  display: none !important;
}

/* Left-edge accent bar — scaleY reveal when item is opened */
.cq-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cq-tab-active-bg, #133E87);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 0 2px 2px 0;
  opacity: 0.7;
}

.cq-item.cq-open::before {
  transform: scaleY(1);
}

.cq-item:last-child {
  border-bottom: 1px solid var(--cq-divider, #E2E2EA);
}

.cq-item.cq-open {
  background: var(--cq-item-hover, #FAF8F4);
}

/* Hidden items (filtered out by tab — set by JS after animation) */
.cq-item.cq-hidden {
  display: none;
}

/* ── QUESTION ROW ────────────────────────────────────────── */
.cq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 24px 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.cq-q:focus-visible {
  outline: 2px solid var(--cq-q-active, #133E87);
  outline-offset: 2px;
  border-radius: 4px;
}

.cq-q-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.cq-num {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
  color: var(--cq-num, #608BC1);
  opacity: 0.75;
  min-width: 24px;
  padding-top: 3px;
  flex-shrink: 0;
}

.cq-q-text {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  color: var(--cq-q-text, #1A1A2E);
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.cq-item.cq-open .cq-q-text {
  color: var(--cq-q-active, #133E87);
}

/* Toggle icon circle */
.cq-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--cq-icon-border, #E2E2EA);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--cq-q-text, #1A1A2E);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.3s ease, box-shadow 0.25s ease;
}

.cq-item.cq-open .cq-icon {
  background: var(--cq-icon-active, #133E87);
  border-color: var(--cq-icon-active, #133E87);
  color: #fff;
  transform: rotate(45deg);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

/* ── ANSWER PANEL ────────────────────────────────────────── */
.cq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.cq-item.cq-open .cq-answer {
  max-height: 800px;
}

.cq-answer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 0 0 28px 14px;
}

.cq-answer-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--cq-answer-text, #4A4A5A);
}

.cq-answer-text p {
  margin: 0 0 12px;
}

.cq-answer-text p:last-child {
  margin-bottom: 0;
}

.cq-answer-text strong {
  color: var(--cq-q-text, #1A1A2E);
  font-weight: 600;
}

.cq-answer-text a {
  color: var(--cq-q-active, #133E87);
  text-decoration: underline;
}

/* Category badge */
.cq-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  background: var(--cq-tag-bg, #e4eef7);
  border: 1px solid var(--cq-tag-border, #c8ddf0);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cq-tag-text, #133E87);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── CTA STRIP ───────────────────────────────────────────── */
.cq-cta {
  margin-top: 64px;
  background: var(--cq-cta-bg, #133E87);
  border-radius: 16px;
  padding: 40px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  overflow: hidden;
}

.cq-cta::after {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  pointer-events: none;
}

.cq-cta-text h3 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--cq-cta-heading, #ffffff);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.cq-cta-text p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--cq-cta-text, rgba(255,255,255,0.65));
  margin: 0;
}

.cq-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--cq-cta-btn-bg, #ffffff);
  color: var(--cq-cta-btn-text, #133E87);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 9px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 1;
}

.cq-cta-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.cq-empty {
  font-size: 15px;
  color: var(--cq-desc, #4A4A5A);
  padding: 32px 0;
  text-align: center;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Tabs: scroll horizontally instead of wrapping */
  .cq-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 6px;
  }
  .cq-tabs::-webkit-scrollbar { display: none; }
  .cq-tab { flex-shrink: 0; }

  /* Questions: remove left padding on mobile, accent bar handles it */
  .cq-q {
    padding: 20px 0 20px 10px;
  }

  /* Answer: single column, proper left indent, no extra padding */
  .cq-answer-inner {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 0 22px 10px;
  }

  /* Tag: don't stretch full width */
  .cq-tag {
    align-self: flex-start;
    width: fit-content;
  }

  /* Accent bar: slightly thinner on mobile */
  .cq-item::before {
    width: 2px;
  }

  /* Numbers: hide on small screens */
  .cq-num { display: none; }

  /* CTA */
  .cq-cta {
    flex-direction: column;
    text-align: center;
    padding: 32px 24px;
    gap: 24px;
  }
}

/* ── REDUCED MOTION ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cq-will-animate {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  .cq-item::before {
    transition: none !important;
  }
  .cq-item {
    transition: background 0.25s ease !important;
  }
}
