/**
 * @file
 * Persona slider ("Be your own tax expert").
 *
 * Brand tokens: navy #1C3557, green #3CB944, font Manrope.
 * Layout: centred header, a stage with a central portrait, floating glass-ish
 * cards anchored to the portrait edges, and a row of tab pills below. Cards are
 * never hidden on mobile — they scale toward their anchor corner so they stay
 * attached down to 375px.
 */

@font-face {
  font-family: 'Manrope';
  src: url('../../fonts/Manrope-VariableFont_wght.woff2?v=2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

.persona-slider {
  --persona-navy: #1c3557;
  --persona-green: #3cb944;
  --persona-ink: #16213a;
  --persona-muted: #5b6573;
  --persona-line: #eef1f5;
  --persona-card-scale: 1;
  /* Content-height wrapper. Was min-height:100vh/100svh — on tall windows that
     stretched the section past its ~830px content and left a big white gap
     under the pills; section rhythm now comes from padding alone. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  /* Extra bottom padding (+48px) offsets et-depth's -3rem sheet breach so the
     category pills float in clean whitespace above the dark 'Latest Articles'
     sheet instead of colliding with it. Net pill->sheet gap === section rhythm. */
  padding: var(--et-section-pad-y, 5rem) 1rem calc(var(--et-section-pad-y, 5rem) + 3rem);
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--persona-navy);
}

.persona-slider__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Header ---------- */
.persona-slider__header {
  width: 100%;
  max-width: 680px;
  margin: 0 auto var(--et-title-gap, 3rem); /* unified title -> content gap */
  text-align: center;
}

/* Unified H2 token — identical to every other section title.
   The universal descendant rule enforces Manrope/size on nested markup from
   content.field_heading, but must NOT stomp the dual-heading accent span —
   .et-highlight-text is excluded so its green (design-tokens) wins. */
.persona-slider__heading,
.persona-slider__heading *:not(.et-highlight-text) {
  margin: 0;
  font-family: 'Manrope', sans-serif; /* beats the base theme's h1-h6 Roboto rule */
  font-size: var(--et-h2-size);
  font-weight: var(--et-h2-weight, 800);
  line-height: var(--et-h2-lh, 1.15);
  letter-spacing: var(--et-h2-track, -0.02em);
  color: var(--et-heading-color, #0a0a0a);
}

.persona-slider__subtitle,
.persona-slider__subtitle p {
  margin: 1rem 0 0;
  font-size: var(--et-lead-size, 1.125rem);
  line-height: var(--et-body-lh, 1.6);
  color: var(--persona-muted);
}

/* ---------- Wide Viewport → sliding track → Fixed Inner Stage ---------- */
/* Outer stage is now just a full-width, transparent centring wrapper. Its height
   flows UP from the fixed inner stage — no aspect-ratio, no absolute children. */
.persona-slider__stage {
  width: 100%;
}

/* THE WIDE VIEWPORT — the clipping mask. Capped at 1200px, i.e. WIDER than the
   863px image, so it still hides the adjacent slides while leaving ~168px of
   invisible space each side for the floating cards to overhang without hitting
   the clip wall. This is the permanent fix for the chop-vs-spill conflict. */
.persona-slider__viewport {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}

/* The track: one row of viewport-wide slides, moved with translateX. Height is
   content-derived (from the fixed inner stage), so no explicit height. */
.persona-slider__track {
  display: flex;
  width: 100%;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Each slide fills the wide viewport and centres the fixed inner stage. 2rem of
   block padding gives vertical breathing room; NO horizontal gutter — the wide
   viewport (not slide padding) now supplies the safe overhang space. */
.persona-slider__slide {
  flex: 0 0 100%;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0 2rem; /* 8px top / 32px bottom — 4px grid (a 0.05rem typo was rendering ~1px) */
}

/* ---------- The Fixed Inner Stage (per-slide anchor) ---------- */
/* Aspect-locked to the brand comp (863x482). This is the SINGLE anchor point:
   both the image and the cards are positioned against this box, so the cards'
   negative offsets (e.g. left: -3%) land exactly on the image edge with no
   awkward gap — and, sitting inside the wide viewport, are never clipped. */
.persona-slider__slide .persona-tab {
  position: relative;
  width: 100%;
  max-width: 863px;
  margin: 0 auto;
}

.persona-tab__stage {
  position: relative;
  width: 100%;
  max-width: 863px;
  aspect-ratio: 863 / 482;
  margin: 0 auto;
}

.persona-tab__portrait {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef2f7, #dbe3ee);
  box-shadow: 0 24px 48px -24px rgba(16, 33, 58, 0.35);
}

.persona-tab__portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.persona-tab__portrait--placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 120% at 70% 30%, rgba(60, 185, 68, 0.10), transparent 60%),
    radial-gradient(120% 120% at 20% 80%, rgba(28, 53, 87, 0.12), transparent 60%);
}

/* ---------- Whole-visual click layer ----------
   A transparent anchor covering the stage; sits on top of the portrait AND
   the floating cards so a click anywhere navigates to the persona page. The
   cards are decorative (pointer-events:none below), so they never swallow it.
   Keyboard-focusable as one link. */
.persona-tab__link {
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: 20px;
  cursor: pointer;
}
.persona-tab__link:focus-visible {
  outline: 2px solid var(--et-green, #3CB944);
  outline-offset: 3px;
}
.persona-tab__stage { cursor: pointer; }

/* ---------- Floating cards overlay ---------- */
.persona-tab__cards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floating-card {
  position: absolute;
  /* Decorative mockups: don't capture clicks — they pass through to the
     whole-visual link above. (Was pointer-events:auto.) */
  pointer-events: none;
  width: clamp(152px, 22vw, 232px); /* 4px grid endpoints */
  padding: 0.75rem 1rem;            /* 12px 16px — 4px grid (was 0.85/0.95) */
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(16, 33, 58, 0.06);
  border-radius: 16px;              /* locked radius token (was 15px) */
  box-shadow:
    0 22px 45px -16px rgba(16, 33, 58, 0.30),
    0 4px 12px rgba(16, 33, 58, 0.07);
  font-size: clamp(0.66rem, 1.4vw, 0.8rem);
  line-height: 1.35;
  color: var(--persona-navy);
  transform: scale(var(--persona-card-scale));
}

/* Anchor points — cards overlap the portrait edges. transform-origin matches
   each anchor so the mobile scale keeps the card glued to its corner. */
.floating-card--at-top-left     { top: 7%;  left: -3%;  transform-origin: top left; }
.floating-card--at-top-right    { top: 7%;  right: -3%; transform-origin: top right; }
.floating-card--at-middle-left  { top: 40%; left: -5%;  transform-origin: left center; }
.floating-card--at-middle-right { top: 36%; right: -5%; transform-origin: right center; }
.floating-card--at-bottom-left  { bottom: 7%; left: -3%; transform-origin: bottom left; }
.floating-card--at-bottom-right { bottom: 8%; right: -3%; transform-origin: bottom right; }

/* ---------- Card head (data_list + action) ---------- */
.floating-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem; /* Better breathing room between title and data */
}

.floating-card__head:last-child {
  margin-bottom: 0;
}

.floating-card__title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05em;
  letter-spacing: -0.015em; /* Tighter tracking for display weight */
  color: var(--persona-ink);
}

.floating-card__icon {
  /* Cosmetic declutter: all archetype icons hidden across every breakpoint. */
  display: none !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2rem;  /* 32px — 4px grid (was 2.1rem) */
  height: 2rem;
  border-radius: 50%;
  background: #eef3ff;
  overflow: hidden;
}

.floating-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Key/value list ---------- */
.floating-card__list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* 8px — 4px grid (was 0.35rem) */
}

.floating-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.15rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--persona-line);
}

.floating-card__row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.floating-card__key {
  color: var(--persona-muted);
  font-weight: 600; /* Improved contrast */
  font-size: 0.9em;
  white-space: nowrap;
}

.floating-card__val {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums; /* Crisp financial numbers */
  letter-spacing: -0.02em;
  text-align: right;
  color: var(--persona-ink);
}

.floating-card__msg,
.floating-card__msg p {
  margin: 0.5rem 0 0;
  color: var(--persona-muted);
}

/* ---------- Notification archetype ---------- */
.floating-card--notification {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;                       /* 8px — 4px grid (was 0.6rem) */
  width: clamp(196px, 28vw, 280px);  /* 4px grid endpoints */
}

.floating-card--notification .floating-card__icon {
  background: #2f6bff;
}

.floating-card__notif-label {
  margin: 0 0 0.25rem; /* 4px — 4px grid (was 0.15rem) */
  font-size: 0.85em;
  font-weight: 600;
  color: var(--persona-muted);
}

.floating-card__notif-title,
.floating-card__notif-title p {
  margin: 0;
  font-weight: 700;
  font-size: 1.05em;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--persona-ink);
}

.floating-card__time {
  flex: 0 0 auto;
  font-size: 0.85em;
  color: #9aa3b2;
  white-space: nowrap;
}

/* ---------- Action archetype CTA ---------- */
.floating-card__cta {
  margin-top: 0.75rem; /* 12px — 4px grid (was 0.7rem) */
}

.floating-card__cta a {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem; /* 8px 12px — 4px grid (was 0.55/0.8) */
  border-radius: 12px;     /* locked small radius token (was 10px) */
  /* Navy fill, NOT brand green: white on #3CB944 is only ~2.2:1 (fails AA).
     Navy #1C3557 gives ~11.6:1 — same rule as the Save/Pay/File CTA. Green
     stays an accent/focus colour only. */
  background: var(--persona-navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.95em;
  letter-spacing: 0.02em; /* bold button tracking law */
  text-align: center;
  text-decoration: none;
  transition: background 0.2s ease;
}

.floating-card__cta a:hover {
  background: #142844; /* darkened navy — same hover ramp as .spf-button */
}

.floating-card__cta a:focus-visible {
  outline: 2px solid var(--persona-green);
  outline-offset: 2px;
}

/* ---------- Tab pills ---------- */
.persona-slider__tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem; /* 8px — 4px grid (was 0.6rem) */
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.persona-slider__tab {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: clamp(0.8125rem, 1.6vw, 0.9375rem); /* 13 -> 15px UI label */
  font-weight: 600;
  padding: 0.5rem 1.25rem; /* 8px 20px — 4px grid (was 0.6/1.3) */
  border: 1px solid #d8dde5;
  border-radius: 9999px; /* pill token */
  background: #fff;
  color: var(--persona-navy);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.persona-slider__tab:hover {
  border-color: var(--persona-navy);
}

.persona-slider__tab.is-active {
  /* Brand navy, not the off-palette #16181d near-black — the active pill now
     matches the mobile active dot and every other navy-filled control.
     White label on #1C3557 ≈ 11.6:1. */
  background: var(--persona-navy);
  border-color: var(--persona-navy);
  color: #fff;
}

.persona-slider__tab:focus-visible {
  outline: 2px solid var(--persona-green);
  outline-offset: 2px;
}

/* ---------- Tablet ---------- */
@media (max-width: 991px) {
  .persona-slider { --persona-card-scale: 0.85; }
  .floating-card { width: clamp(140px, 30vw, 208px); } /* 4px grid endpoints */
  .floating-card--notification { width: clamp(180px, 36vw, 248px); } /* 4px grid endpoints */
}

/* ---------- Mobile (<=768px): tucked-in cards + a dot rail ----------
   Two goals: (1) de-clutter the floating cards so they read as accents, not a
   collision, and (2) replace the horizontally-scrolling pill rail with a compact,
   centred dot rail so nothing overflows the viewport. */
@media (max-width: 768px) {
  /* Header -> image gap follows the unified mobile title gap token (24px). */
  .persona-slider__header { margin-bottom: var(--et-title-gap, 1.5rem); }

  /* Bump the scale up so the card text is actually legible on mobile. */
  .persona-slider { --persona-card-scale: 0.8; }

  /* Give the cards a wider, tighter-padded box so the key/value pairs stop
     wrapping into a messy stack and read cleanly at the larger scale. */
  .floating-card {
    width: 220px;
    padding: 0.75rem;
  }

  .floating-card__list { gap: 0.25rem; } /* 4px — grid snap (was 0.2rem) */

  .floating-card__row {
    font-size: 0.9em;
    padding-bottom: 0.25rem;
  }

  /* Pull every card back INSIDE the stage with a small positive inset. Paired
     with the base corner-matched transform-origin (top-left card scales toward
     its top-left corner, etc.), each card shrinks toward its anchored corner and
     can never spill off-screen. Values mirror the base rules' property sets. */
  .floating-card--at-top-left     { top: 2%;    left: 2%; }
  .floating-card--at-top-right    { top: 2%;    right: 2%; }
  .floating-card--at-middle-left  { top: 34%;   left: 2%; }
  .floating-card--at-middle-right { top: 30%;   right: 2%; }
  .floating-card--at-bottom-left  { bottom: 2%; left: 2%; }
  .floating-card--at-bottom-right { bottom: 2%; right: 2%; }

  /* Tabs: drop all horizontal-scroll machinery; wrap and centre instead. */
  .persona-slider__tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem; /* 12px */
    overflow-x: visible;
    scroll-snap-type: none;
    margin-inline: 0;
    padding-inline: 0;
    padding-bottom: 0;
  }

  /* Each pill collapses into a 12px dot. font-size:0 + color:transparent hides
     the label VISUALLY while it stays in the DOM for screen readers, and the
     button keeps its full hit area + focus-visible ring. */
  .persona-slider__tab {
    width: 12px;
    height: 12px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    font-size: 0;
    line-height: 0;
    color: transparent;
    overflow: hidden;
    white-space: normal;
    /* Resting-dot contrast fix: the old #e0e5ec was ~1.2:1 on the white section
       (below WCAG 1.4.11's 3:1 for UI components — flagged open item in
       summary/section2.md). #8a93a0 measures ~3.1:1 (the summary's suggested
       #97a0ab only reaches ~2.7:1, so it was darkened one step further). */
    background: #8a93a0;
    transition: width 0.25s ease, background 0.2s ease;
  }

  .persona-slider__tab:not(.is-active):hover {
    background: #6d7684; /* ~4.6:1 — hover darkens, keeping the ramp direction */
  }

  /* Active dot: brand navy AND stretched into a 24px pill, so the current-slide
     cue never relies on colour alone (WCAG 1.4.1). */
  .persona-slider__tab.is-active {
    width: 24px;
    background: var(--persona-navy);
    border-color: var(--persona-navy);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .persona-slider__track { transition: none; }
  .floating-card__cta a { transition: none; }
  .persona-slider__tab { transition: none; }
}

/* ---------- ClearTax-style 3-column layout with sticky side banners ----------
   The slider lives in a fluid centre column (capped at 1200px). When the CMS
   supplies a promo banner, two ~248px columns flank it and STICK as the user
   scrolls the section, then release at its foot. Applied only via the
   `--banners` modifier (set in the Twig when a banner exists), so slider-only
   pages keep their original plain centred layout — no 496px of gutter stolen
   for nothing.

   Wrapper math (24px gaps):  1200 centre + 2×248 banners + 2×24 gaps = 1744px.
   Activates at 1280px (standard laptops, 1366–1440 included). Below that the
   banners are hidden and the centre reclaims full width. The header is 76px and
   scrolls away, so sticky `top:120px` clears it with margin. */

/* Default / mobile-first: plain centred container === the pre-banner layout. */
.persona-slider__layout {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Banners stay hidden until the grid layout activates (and on banner-less pages). */
.et-side-banner {
  display: none;
}

/* Banner image + link chrome. Unconditional: banners only render when the grid
   is active, so these need no media-query guard. */
.et-side-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 16px;      /* --et-radius-lg */
  box-shadow: var(--et-shadow-rest, 0 2px 8px rgba(28, 53, 87, 0.06));
}
.et-side-banner__link {
  display: block;           /* anchor IS the 248px slot */
  border-radius: 16px;
  transition: opacity 0.2s ease;
}
.et-side-banner__link:hover { opacity: 0.9; }
.et-side-banner__link:focus-visible {
  outline: 2px solid #3CB944;  /* project a11y rule: every interactive element */
  outline-offset: 2px;
  opacity: 0.9;
}

/* 3-COLUMN STICKY GRID — laptops and up, only when a banner is present. */
@media (min-width: 1280px) {
  .persona-slider__layout--banners {
    max-width: 1744px;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 248px;
    column-gap: 1.5rem;       /* 24px */
    align-items: start;       /* don't stretch cells — required for sticky to move */
  }

  /* Centre column: the slider. Pinned to column 2 so it stays centred even when
     only one banner is set; fills the track (the 1200 cap is the track width). */
  .persona-slider__layout--banners .persona-slider__inner {
    grid-column: 2;
    max-width: none;
  }

  /* Side columns become sticky. align-self:start keeps each banner its own
     (image) height so it has room to travel within the taller slider row. */
  .persona-slider__layout--banners .et-side-banner {
    display: block;
    position: sticky;
    top: 120px;               /* clears the 76px header + gap */
    align-self: start;
    width: 248px;
  }
  .persona-slider__layout--banners .et-side-banner--left  { grid-column: 1; }
  .persona-slider__layout--banners .et-side-banner--right { grid-column: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .et-side-banner__link { transition: none; }
}
