/* ==================================================================
   Audience Split — kwizzbit/audience-split (whole-file segment)
   Faithful slice of /HTML/seg-2.html. Globals (reset/body/font-face/:root)
   dropped; tokens canonical (theme.json). Full-bleed via the .kwb-segment wrapper.
   ================================================================== */

.audience-split {
  background: #F0E3D9;
  padding-block: 200px;
}

.audience-split__inner {
  max-width: 1100px;
  margin-inline: auto;
  position: relative;
}

/* Centered header — eyebrow + headline stacked above the body row.
   position + z-index: always above the card-fade gradient (z-index: 10)
   which has top:-70px and can bleed upward at large font sizes. */
.audience-split__header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  position: relative;
  z-index: 20;
}

/* Desktop: more breathing space below the headline before the cards + copy */
@media (min-width: 1024px) {
  .audience-split__header {
    margin-bottom: 5.5rem;
  }
}

/* Body row — cards (left) + lead/bullets (right), vertically centred together
   so the copy sits directly alongside the floating cards */
.audience-split__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  position: relative;
}

/* ── Scroll-reveal entry — header / cards / copy lift + fade in when the
   section enters view. Gated behind .has-scroll-reveal (added by JS) so
   no-JS and reduced-motion users always see the content. ── */
.audience-split.has-scroll-reveal .audience-split__header,
.audience-split.has-scroll-reveal .audience-split__media-wrap,
.audience-split.has-scroll-reveal .audience-split__content {
  opacity: 0;
  transform: translateY(var(--wp--custom--motion--scroll-reveal-distance));
  transition:
    opacity var(--wp--custom--motion--scroll-reveal-duration) var(--wp--custom--motion--scroll-reveal-easing),
    transform var(--wp--custom--motion--scroll-reveal-duration) var(--wp--custom--motion--scroll-reveal-easing);
}
.audience-split.has-scroll-reveal.is-visible .audience-split__header     { opacity: 1; transform: none; transition-delay: 0s;    }
.audience-split.has-scroll-reveal.is-visible .audience-split__media-wrap { opacity: 1; transform: none; transition-delay: 0.08s; }
.audience-split.has-scroll-reveal.is-visible .audience-split__content    { opacity: 1; transform: none; transition-delay: 0.16s; }

/* ============================================================
   LEFT — QUIZ CARD GRID
   ============================================================ */

.audience-split__media-wrap {
  filter: drop-shadow(0px 20px 50px rgba(255, 54, 35, 0.20));
  position: relative;
}

.audience-split__media {
  display: grid;
  grid-template-columns: 320px 320px;
  grid-template-rows: auto auto;
  row-gap: 18px;
  column-gap: 18px;
  align-items: start;
  position: relative;
}

/* Sand fade — covers right-hand card column and shadow bleed only.
   Colour matches section background #F0E3D9 so the blend is seamless. */
.card-fade {
  position: absolute;
  top: -70px;
  left: calc(50% - 145px);
  width: 420px;
  height: calc(100% + 140px);
  background: linear-gradient(to right,
    transparent 0%,
    #F0E3D9 60%,
    #F0E3D9 100%
  );
  pointer-events: none;
  z-index: 10;
}

/* ── Quiz tile — fixed dimensions per spec ── */
.quiz-tile {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  width: 320px;
  height: 145px;
  background: #2a1a14;
  flex-shrink: 0;
}

/* Offset column 1 downwards by 12px — first card only, not bottom-left */
.quiz-tile:nth-child(1) { margin-top: 12px; }
.quiz-tile:nth-child(3) { margin-top: 0; margin-left: 12px; }
/* Pull bottom-right card up by 12px to match column 1 stagger, shift right 12px */
.quiz-tile:nth-child(4) { margin-top: -12px; margin-left: 12px; }

/* Real image — swap src for production photography */
.quiz-tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Gradient overlay — 130px tall, #2F110F, anchored to bottom of card */
.quiz-tile__gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 130px;
  background: linear-gradient(
    to bottom,
    rgba(47, 17, 15, 0) 0%,
    rgba(47, 17, 15, 1) 100%
  );
  z-index: 1;
}

.quiz-tile__body {
  position: relative;
  z-index: 2;
  height: 100%; /* must fill card for justify-content: flex-end to work */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* pin text and badge to bottom */
  padding: 0 14px 13px;
  gap: 8px;
}

/* Question text — Roobert Semimono Regular 20px, -2.15px tracking, 20px line-height */
.quiz-tile__question {
  font-family: var(--wp--preset--font-family--display); /* Roobert Semimono */
  font-weight: 600; /* SemiBold */
  font-size: 1.125rem; /* 18px — nudged down from 20px */
  line-height: 1.125rem; /* 18px */
  letter-spacing: -0.1075em;
  color: var(--wp--preset--color--white);
  width: 166px; /* max bound — text wraps to 3 lines if needed */
}

/* Question-type badge — pill, white bg, coral bold text */
.quiz-tile__badge {
  display: inline-flex;
  align-items: center;
  background: var(--wp--preset--color--white);
  color: #E03B2B; /* default — overridden per question type below */
  font-family: var(--wp--preset--font-family--body);
  font-weight: 700; /* Bold */
  font-size: 0.6875rem; /* 11px */
  letter-spacing: 0;
  padding: 5px 11px;
  border-radius: 0; /* square corners */
  align-self: flex-start;
  line-height: 1;
}

/* Vary the coral/red badge text across the four question types.
   Card modifiers are positional and identical on every audience page:
   --pizza = Quickfire, --hamster = Text-field, --wedding = Pick-one,
   --barbeque = Tier-list. */
.quiz-tile--pizza    .quiz-tile__badge { color: #F2662E; } /* Quickfire  — orange-coral */
.quiz-tile--hamster  .quiz-tile__badge { color: #FF3623; } /* Text-field — brand coral */
.quiz-tile--wedding  .quiz-tile__badge { color: #E03B2B; } /* Pick-one   — blood-orange */
.quiz-tile--barbeque .quiz-tile__badge { color: #C81F3C; } /* Tier-list  — crimson-red */

/* ── Placeholder photo backgrounds (remove when real images are in) ── */
.quiz-tile--pizza    { background: linear-gradient(145deg, #c85a12 0%, #e8920f 35%, #d4440a 65%, #8b2200 100%); }
.quiz-tile--hamster  { background: linear-gradient(145deg, #6ab4d4 0%, #4a9fc4 45%, #7dcae0 72%, #b8dcea 100%); }
.quiz-tile--wedding  { background: linear-gradient(145deg, #c8856a 0%, #d4a882 42%, #b06b55 70%, #7a3d2a 100%); }
.quiz-tile--barbeque { background: linear-gradient(145deg, #8b1a2a 0%, #c23048 32%, #e85070 62%, #d4405a 100%); }

/* ============================================================
   RIGHT — CONTENT BLOCK
   ============================================================ */

.audience-split__content {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 20; /* always above the card-fade gradient */
}

/* Eyebrow — Pixelar, coral
   DEVIATION: font-family falls back to monospace until Pixelar WOFF2 licensed.
   See STYLEGUIDE.md — Pixelar pending theme.json registration. */
.audience-split__eyebrow {
  font-family: 'Pixelar', monospace;
  font-weight: 400;
  font-size: 19px; /* Pixelar 19px — per STYLEGUIDE.md trust label spec */
  color: var(--wp--preset--color--coral);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  line-height: 1;
}

/* H2 — Roobert Semimono, display scale
   DEVIATION: italic on "anything" synthesised from Regular weight.
   True italic face needed when Roobert Semimono is licensed — register
   fontStyle: italic in theme.json fontFamilies[display].fontFace. */
/* Mobile-only line break hidden on desktop; revealed in the ≤640px block below */
.audience-split__title-mobile-br { display: none; }
/* Mobile-only break between "absolutely" and the cursor — pushes cursor+typeword
   to line 4, hidden on desktop so the title stays on one line there */
.as-line4-br { display: none; }

.audience-split__title {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 400;
  font-size: 5.5rem; /* 88px — matches the homepage + How-it-Works (video-feature) hero H1 */
  line-height: 0.95;
  letter-spacing: -0.10769em;
  color: var(--wp--preset--color--ink);
  margin-bottom: 0; /* last element in the centered header */
}

/* ── Typewriter cursor — exact video-feature technique ───────────
   width:0 so it takes no layout space; visibility toggled by JS.
   Reuses the existing as-cursor-blink keyframe already declared below. */
.as-cursor {
  display: inline-block;
  width: 0;
  overflow: visible;
  color: var(--wp--preset--color--coral);
  visibility: hidden;
  animation: as-cursor-blink 1.1s step-end infinite;
}

@media (prefers-reduced-motion: reduce) {
  .as-cursor { animation: none; visibility: hidden !important; }
}

/* Coral blinking full stop — matches hero-split as-cursor-blink pattern */
.audience-split__title-accent {
  color: var(--wp--preset--color--coral);
  animation: as-cursor-blink 1.1s step-end infinite;
}

@keyframes as-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Lead paragraph — narrowed to ~270px to break onto 4 neat lines */
.audience-split__lead {
  font-family: var(--wp--preset--font-family--body);
  font-weight: 500;
  font-size: var(--wp--preset--font-size--md); /* 1.0625rem / 17px */
  line-height: 1.412;
  color: var(--wp--preset--color--ink-soft);
  width: 270px;
  margin-bottom: var(--wp--preset--spacing--60); /* 32px */
}

/* Checklist */
.audience-split__checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px; /* 20px vertical spacing between items */
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 13px;
}

.checklist-item__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: block;
}

.checklist-item__label {
  font-family: var(--wp--preset--font-family--body);
  font-weight: 600; /* SemiBold */
  font-size: 1.0625rem; /* 17px — bumped from 15px */
  color: var(--wp--preset--color--ink);
  line-height: 1;
}

/* Feature badge — mirrors the homepage hero counter pill: transparent, thin
   border, square corners, ink-soft label with a coral emphasis figure.
   Keeps the layers icon. Sits at the bottom of the content column. */
.audience-split__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  align-self: flex-start;
  margin-top: 32px;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(26, 26, 26, 0.18);
  background: transparent;
  border-radius: 0;
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.8125rem; /* 13px — matches .hero__counter */
  font-weight: 500;
  color: var(--wp--preset--color--ink-soft);
  line-height: 1;
}
.audience-split__badge-icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--wp--preset--color--coral); /* icon picks up coral via currentColor */
}
.audience-split__badge-num {
  font-weight: 700;
  color: var(--wp--preset--color--coral);
}
.audience-split__badge-label {
  color: var(--wp--preset--color--ink-soft);
}

/* ============================================================
   TABLET (≤ 1023px)
   ============================================================ */

@media (max-width: 1023px) {
  .audience-split {
    padding-block: 130px;
  }

  .audience-split__inner {
    max-width: 680px;
  }

  /* Stack the body row; header stays centred on top */
  .audience-split__body {
    grid-template-columns: 1fr;
    gap: 52px;
  }

  .audience-split__title {
    font-size: 3.75rem;
    line-height: 3.5rem;
  }

  .audience-split__lead {
    width: 378px;
    max-width: 100%;
  }

  /* Scale cards to fit available width — maintain proportions */
  .audience-split__media {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .quiz-tile {
    width: 100%;
    height: auto;
    aspect-ratio: 320 / 145;
  }

  /* Gradient shifted 200px right on tablet */
  .card-fade {
    left: calc(50% + 55px);
  }

}

/* ============================================================
   MOBILE (≤ 640px)
   ============================================================ */

@media (max-width: 640px) {
  .audience-split {
    padding-block: 100px;
    overflow-x: clip;
  }

  .audience-split__inner {
    gap: 36px;
  }

  .audience-split__eyebrow {
    font-size: 18px;
  }

  /* Show the extra break so title reads: Quiz your / loved ones / on anything. */
  .audience-split__title-mobile-br { display: block; }

  .audience-split__title {
    font-size: clamp(2.25rem, 10.5vw, 3rem);
    line-height: clamp(2rem, 9.5vw, 2.75rem);
    letter-spacing: -0.10764em;
  }

  /* Show the line-4 break so cursor + typed word land on line 4.
     The as-typeword remains inline — the <br> before the cursor handles
     the line split cleanly without displacing the accent period. */
  .as-line4-br { display: block; }
  .audience-split__title .as-typeword { display: inline; }

  /* +25px gap after headline before the floating question cards */
  .audience-split__header {
    margin-bottom: calc(clamp(2.5rem, 5vw, 4rem) + 25px);
  }

  /* Centre lead + bullets as a group — switch to block so text-align:center
     targets the inline-flex checklist and badge reliably (iOS Safari flex +
     fit-content centering is unreliable; inline-flow is universally correct). */
  .audience-split__content {
    display: block;
    text-align: center;
  }

  .audience-split__lead {
    font-size: 1rem; /* 16px — matches hero lead */
    width: min(300px, 88vw);
    text-align: center;
    margin-inline: auto;
  }

  /* inline-flex: the parent's text-align:center treats this as an inline-level
     box and centres it reliably cross-browser (bypasses iOS Safari's
     flex+fit-content centering bug). text-align:left keeps icon+label left-aligned
     within each item; flex-direction:column stacks items vertically. */
  .audience-split__checklist {
    display: inline-flex;
    flex-direction: column;
    text-align: left;
    width: auto;
    margin-inline: 0;
  }

  .audience-split__media {
    row-gap: 10px;
    column-gap: 8px;
  }

  /* Flatten stagger on mobile */
  .quiz-tile:nth-child(odd)  { margin-top: 0; }
  .quiz-tile:nth-child(even) { margin-top: 0; }

  /* Pull right column up 12px to offset left column stagger */
  .quiz-tile:nth-child(2) { margin-top: -12px; }
  .quiz-tile:nth-child(4) { margin-top: -12px; }

  /* Cards scaled down but hold 320/145 ratio — overflow clips right */
  .quiz-tile {
    width: auto;
    height: 110px;
    aspect-ratio: 320 / 145;
  }

  .audience-split__media-wrap {
    overflow: visible;
  }

  .quiz-tile__question {
    font-size: 0.875rem; /* 14px */
    line-height: 0.875rem;
    letter-spacing: -0.08em;
  }

  .quiz-tile__badge {
    font-size: 0.5625rem; /* 9px */
    padding: 3.5px 8px;
  }

  .checklist-item__label {
    font-size: 0.875rem; /* 14px */
  }

  .checklist-item {
    justify-content: center;
  }

  .audience-split__checklist {
    gap: 16px;
    width: 100%;
  }

  /* Centre the feature badge with the rest of the centred content */
  .audience-split__badge {
    align-self: center;
    margin-top: 26px;
  }

}

/* ============================================================
   CARD FLOAT ANIMATIONS
   Each card has its own keyframe with subtly different
   translation arcs — gentle, offset, helium-bloom feel.
   ============================================================ */

@keyframes as-float-1 {
  0%   { transform: translate(0px, 0px) rotate(0deg); }
  25%  { transform: translate(2px, -4px) rotate(0.3deg); }
  50%  { transform: translate(-1px, -7px) rotate(-0.2deg); }
  75%  { transform: translate(-3px, -3px) rotate(0.15deg); }
  100% { transform: translate(0px, 0px) rotate(0deg); }
}

@keyframes as-float-2 {
  0%   { transform: translate(0px, 0px) rotate(0deg); }
  25%  { transform: translate(-2px, -5px) rotate(-0.25deg); }
  50%  { transform: translate(2px, -8px) rotate(0.3deg); }
  75%  { transform: translate(1px, -2px) rotate(-0.1deg); }
  100% { transform: translate(0px, 0px) rotate(0deg); }
}

@keyframes as-float-3 {
  0%   { transform: translate(0px, 0px) rotate(0deg); }
  25%  { transform: translate(3px, -3px) rotate(0.2deg); }
  50%  { transform: translate(1px, -6px) rotate(-0.3deg); }
  75%  { transform: translate(-2px, -4px) rotate(0.1deg); }
  100% { transform: translate(0px, 0px) rotate(0deg); }
}

@keyframes as-float-4 {
  0%   { transform: translate(0px, 0px) rotate(0deg); }
  25%  { transform: translate(-1px, -6px) rotate(0.15deg); }
  50%  { transform: translate(-3px, -4px) rotate(-0.25deg); }
  75%  { transform: translate(2px, -2px) rotate(0.2deg); }
  100% { transform: translate(0px, 0px) rotate(0deg); }
}

.quiz-tile:nth-child(1) {
  animation: as-float-1 6s ease-in-out infinite;
}
.quiz-tile:nth-child(2) {
  animation: as-float-2 7.5s ease-in-out infinite;
  animation-delay: -2s;
}
.quiz-tile:nth-child(3) {
  animation: as-float-3 5.5s ease-in-out infinite;
  animation-delay: -4s;
}
.quiz-tile:nth-child(4) {
  animation: as-float-4 8s ease-in-out infinite;
  animation-delay: -1.5s;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .audience-split__title-accent {
    animation: none;
    opacity: 1;
  }
  .quiz-tile {
    animation: none;
  }
}
