/* ============================================================
   Chancel — v1.6
   Liquid Glass team directory for The Grove Bible Chapel
   (internal selector prefix stays .cts- for deployment safety)
   Inherits all v3.6 cross-device fixes from Church Home Showcase

   v1.6 — Esselith Core token layer (#20, step 7 — LAST migration)
     • --cts-orange / --cts-teal alias the suite --es-brand-*
       tokens; --cts-cream → --es-surface, --cts-ink → --es-ink
       (UNIFIED to the suite ink #071120), --cts-serif/--cts-sans →
       --es-font-*. The pre-Core Grove hexes/stacks are the
       fallbacks, so a Core-less install renders identically.
       church-team-showcase.php prints a :root inline block (after
       this file) that sets --cts-orange/--cts-teal from the SHARED
       pulpit_suite_brand_* options, so a saved brand applies with
       or without Core. Chancel had no color UI of its own —
       nothing to retire or migrate (the Atrium case).
     • Render-blocking @import → wp_enqueue_style('cts-fonts') in
       PHP, aligned to Core's EXACT URL + null version so the two
       dedupe to one request when both load (the Threshold pattern);
       .cts-modal-bio weight 300→400 (Core's URL omits Montserrat
       300, and 300 was the only non-subset weight).
     • Dark-section glow audit: the two .cts-section brand radials
       (desktop + tablet) lighten-before-alpha (--cts-glow-base) so
       the wash survives a dark church brand; every other hardcoded
       brand rgba literal (card hover shadow, cell tint, cursor
       sheen, modal tint/scrollbar/social chips, email hover) became
       brand-var color-mix (raw — they don't vanish), so all accents
       follow the brand. Phone breakpoint 560→600, modal-stack 760→782.
     • Theme-defense: .cts-card-link bg/color/border pinned
       !important (rest+hover+focus); .cts-modal-close :focus pinned
       (it is auto-focused on modal open).
   ============================================================ */

/* Fonts are loaded via wp_enqueue_style('cts-fonts', …) in
   church-team-showcase.php (the old render-blocking @import was removed).
   Keeping the load — not just a var() alias — because a font name in a
   fallback chain can't LOAD the file. Chancel's used weights (Montserrat
   400/700; Playfair roman 400 + italic 400) are a pure SUBSET of Core's
   string, so cts-fonts and esselith-fonts are byte-identical and dedupe. */

:root {
  /* ── Brand colors (Esselith Core token layer, #20, step 7) ──
     Alias the suite --es-brand-* tokens with Chancel's pre-Core Grove hexes as
     the fallback, so with Core deactivated Chancel renders exactly as before
     (Core is an enhancer, never a dependency). church-team-showcase.php ALSO
     prints a :root inline block via wp_add_inline_style AFTER this file that
     sets --cts-orange / --cts-teal from the SHARED pulpit_suite_brand_* options,
     so a church's saved brand applies with OR without Core — that inline block,
     printed last, wins the cascade. Chancel never had its own color UI, so there
     was nothing to retire or migrate. (Mirrors Atrium / Nave / Credo / PL.) */
  --cts-orange: var(--es-brand-primary,   #ED8B00);
  --cts-teal:   var(--es-brand-secondary, #004F71);

  /* ── Dark-section glow bases (checklist item (d)) ──
     The brand lightened toward white BEFORE a glow's own transparency is
     applied. A faint brand wash at low alpha over the dark .cts-section fill is
     visible for a bright brand (Grove orange/teal) but composites to the dark
     fill's luminance — and vanishes — for a dark brand (burgundy/navy/forest).
     Lightening first keeps every brand's section wash visible. Used ONLY for the
     two pure-brand .cts-section radials over the dark fill — NOT the card photo
     tint (multiply), the cursor sheen (neutral cream core), borders, or shadows.
     (Mirrors Atrium's --chs-glow-base / Credo's --cs-glow-base.) */
  --cts-glow-base:           color-mix(in srgb, var(--cts-orange) 65%, white);
  --cts-glow-base-secondary: color-mix(in srgb, var(--cts-teal)   65%, white);

  --cts-sage:   #C3C6A8;                                 /* decorative — no Core equivalent, kept raw */
  --cts-cream:  var(--es-surface, #F7F3EC);
  --cts-ink:    var(--es-ink, #071120);                  /* unified to suite ink #071120 */
  --cts-serif:  var(--es-font-display, 'Playfair Display', Georgia, serif);
  --cts-sans:   var(--es-font-body, 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* ─────────────────────────────────────
   SECTION WRAPPER
───────────────────────────────────── */

.cts-section {
  position: relative;
  padding: var(--es-space-band, clamp(3.5rem, 7vw, 6rem)) 24px; /* 1.23.0: the suite band rhythm (was 64/80) */
  background-color: var(--es-deep-b, #04293A);   /* suite deep-teal base (was ink var(--cts-ink)) — unified dark tone */
  font-family: var(--cts-sans);
  color: var(--es-text-on-dark, #E8ECF5);
  overflow: hidden;
  /* Lighten-before-alpha (--cts-glow-base): pure-brand washes over the deep-teal,
     so they'd vanish for a dark church brand if applied raw. (#20 item (d).)
     The deep-teal gradient is the bottom layer; the two brand glows sit on top. */
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 0%,   color-mix(in srgb, var(--cts-glow-base)           10%, transparent), transparent 60%),
    radial-gradient(ellipse 80% 60% at 85% 100%, color-mix(in srgb, var(--cts-glow-base-secondary) 22%, transparent), transparent 60%),
    linear-gradient(165deg, var(--es-deep-a, #064058), var(--es-deep-b, #04293A));
  isolation: isolate;
}

/* ── Light tone variant — [church_team_featured tone="light"] ────────────────
   Opt-in. Flips the FEATURED band to light for a homepage teaser; the full
   Team page stays dark. Kills the dark radials and overrides the hardcoded
   cream text/borders to ink. Default (no class) unchanged → zero regression. */
.cts-section--light {
  /* Raised cream band (--cts-cream → --es-surface), NOT the page colour: a
     light teaser must read as its own band. Painting it --es-page-bg made it
     blend into the (now cream) page with no visible edge. */
  background: var(--cts-cream, #F7F3EC);
  background-image: none;
  color: var(--cts-ink);
}
.cts-section--light .cts-section-title,
.cts-section--light .cts-page-title      { color: var(--cts-ink); }
.cts-section--light .cts-section-tagline { color: rgba(7, 17, 32, 0.55); }
.cts-section--light .cts-page-subtitle   { color: rgba(7, 17, 32, 0.65); }
.cts-section--light .cts-section-header,
.cts-section--light .cts-page-header     { border-bottom-color: rgba(7, 17, 32, 0.12); }
/* Eyebrow → teal on light (honors "orange = action only" — the eyebrow is structure). */
.cts-section--light .cts-section-eyebrow,
.cts-section--light .cts-page-eyebrow    { color: var(--cts-teal); }

.cts-page-header {
  max-width: 1280px;
  margin: 0 auto 4rem;
  /* Stacked: subtitle sits UNDER the title (like mobile always did). The old
     side-by-side row put the lede in a 320px right rail — fine at the tiny old
     sub size, but at --es-lead (21px) it wrapped to 4–6 lines and towered over
     the title. A lede reads best under its heading at a full measure. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(232,236,245,0.10);
}

.cts-page-eyebrow {
  margin: 0 0 0.85rem;
  color: #fff;
  font-size: var(--es-eyebrow, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cts-page-title {
  font-family: var(--cts-serif);
  font-size: var(--es-h1-hero, clamp(2.5rem, 2.11rem + 1.66vw, 3.875rem));
  font-weight: 400;
  color: var(--es-text-on-dark, #E8ECF5);
  margin: 0;
  line-height: 0.95;
}
.cts-page-title em { font-style: italic; color: var(--cts-orange); }

.cts-page-subtitle {
  max-width: 60ch;
  font-size: var(--es-lead, 1.3125rem);
  color: rgba(232,236,245,0.65);
  margin: 0;
  text-align: left;
}

/* ─────────────────────────────────────
   TEAM SECTIONS
───────────────────────────────────── */

.cts-team-section {
  max-width: 1280px;
  margin: 0 auto 4.5rem;
}

.cts-section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(232,236,245,0.06);
}

.cts-section-eyebrow {
  margin: 0 0 0.45rem;
  font-size: var(--es-eyebrow, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
}

.cts-section-title {
  font-family: var(--cts-serif);
  font-weight: 400;
  font-size: var(--es-h2, clamp(1.625rem, 1.42rem + 0.88vw, 2.375rem));
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--es-text-on-dark, #E8ECF5);
}

.cts-section-tagline {
  font-family: var(--cts-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(232,236,245,0.45);
}

/* ─────────────────────────────────────
   GRID
───────────────────────────────────── */

.cts-team-grid {
  display: grid;
  gap: 18px;
}

.cts-tier-1 { grid-template-columns: repeat(3, 1fr); }
.cts-tier-2 { grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cts-tier-3 { grid-template-columns: repeat(5, 1fr); gap: 12px; }

/* ─────────────────────────────────────
   CARD BASE — liquid glass
───────────────────────────────────── */

.cts-card {
  --fx: 50%;
  --fy: 25%;
  --mx: -200%;
  --my: -200%;
  /* --photo set inline */

  position: relative;
  border-radius: var(--es-radius-card, 16px);
  overflow: hidden;
  isolation: isolate;
  background: #000;

  /* Mobile rendering hardening — same as Ministries v3.2+ */
  -webkit-tap-highlight-color: transparent;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  transform: translateZ(0);
  will-change: transform;

  box-shadow:
    inset 0 1px 0 0  rgba(255,255,255,0.18),
    inset 0 0 0 1px  rgba(255,255,255,0.05),
    0 6px 18px       rgba(0,0,0,0.40);

  transition:
    transform 0.5s cubic-bezier(0.2,0.8,0.2,1),
    box-shadow 0.5s ease;
}

.cts-card:hover {
  transform: translateY(-5px);
  box-shadow:
    inset 0 1px 0 0  rgba(255,255,255,0.30),
    inset 0 0 0 1px  rgba(255,255,255,0.16),
    0 22px 44px      color-mix(in srgb, var(--cts-teal) 40%, transparent);
}

/* Aspect ratios per tier */
.cts-tier-1 .cts-card { aspect-ratio: 4 / 5; }
.cts-tier-2 .cts-card { aspect-ratio: 3 / 4; }
.cts-tier-3 .cts-card { aspect-ratio: 3 / 4; }

/* Card link button — covers entire card, kills tap highlight.
   Hardened against theme global button rules: LIVE Astra's
   button:hover/:focus (0,1,1) recolors bg + color + border to its amber
   accent (#c97700) and beats a single-class .cts-card-link (0,1,0) — which
   would flash amber across the WHOLE card. Pin all THREE transparent/inherit
   props !important across rest + hover + focus (Astra's rules are
   non-!important, so this wins). The :focus-visible orange outline stays. */
.cts-card-link {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent !important;
  border: 0 !important;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit !important;
  border-radius: var(--es-radius-card, 16px);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.cts-card-link:hover,
.cts-card-link:focus {
  background: transparent !important;
  color: inherit !important;
  border: 0 !important;
}
.cts-card-link:focus-visible {
  /* 1.23.0: the suite focus ring (teal over a white halo), was orange */
  outline: 2px solid var(--es-brand-secondary, #004F71);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px #fff;
}

/* Photo */
.cts-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--photo);
  background-size: cover;
  background-position: var(--fx) var(--fy);
  filter: saturate(1.05) brightness(0.95);
  transition:
    transform 0.85s cubic-bezier(0.2,0.8,0.2,1),
    filter 0.5s ease;
}
.cts-card:hover .cts-bg {
  transform: scale(1.06);
  filter: saturate(1.15) brightness(1.05);
}

/* Placeholder when no Featured Image (Core 0.33.0 — board option 2,
   "monogram"): the brand's deep teal with a soft corner light, and the
   person's initials in a fine ring where a face would be, so the card reads
   as a profile, not a missing photo. Replaces the big faded first letter. */
.cts-placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18%;
  container-type: inline-size;
  background:
    radial-gradient(120% 90% at 12% 0%, color-mix(in srgb, color-mix(in srgb, var(--cts-teal) 45%, #fff) 28%, transparent) 0%, transparent 60%),
    linear-gradient(150deg,
      color-mix(in srgb, var(--cts-teal) 88%, #fff) 0%,
      color-mix(in srgb, var(--cts-teal) 80%, #000) 45%,
      color-mix(in srgb, var(--cts-teal) 52%, #000) 100%);
}
.cts-monogram {
  width: 44%;
  max-width: 120px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(232, 236, 245, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cts-serif);
  font-weight: 400;
  font-size: clamp(1.25rem, 14cqi, 2.4rem);
  letter-spacing: 0.02em;
  color: var(--es-text-on-dark, #E8ECF5);
}
.cts-monogram:empty { display: none; }

/* Tint */
.cts-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cts-teal) 5%, transparent) 0%, color-mix(in srgb, var(--cts-teal) 20%, transparent) 100%);
  mix-blend-mode: multiply;
  opacity: 0.7;
  transition: opacity 0.5s ease;
}
.cts-card:hover .cts-tint { opacity: 0.4; }

/* Scrim — bottom gradient for legibility */
.cts-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(0,0,0,0) 30%,
    rgba(0,0,0,0.35) 60%,
    rgba(0,0,0,0.85) 100%);
}

/* Cursor sheen */
.cts-sheen {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    320px circle at var(--mx) var(--my),
    rgba(232,236,245,0.20)                                0%,
    color-mix(in srgb, var(--cts-orange) 10%, transparent) 35%,
    transparent                                          60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  mix-blend-mode: screen;
}
.cts-card:hover .cts-sheen { opacity: 1; }

/* Glass refractive edge */
.cts-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--es-radius-card, 16px);
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.10) 0%,
    rgba(255,255,255,0)   30%,
    rgba(255,255,255,0)   70%,
    rgba(255,255,255,0.04) 100%);
}

/* ─────────────────────────────────────
   CARD CONTENT
───────────────────────────────────── */

.cts-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 1.25rem 1.35rem 1.35rem;
  color: var(--es-text-on-dark, #E8ECF5);
  text-shadow: 0 1px 12px rgba(0,0,0,0.6);
  pointer-events: none; /* clicks fall through to .cts-card-link */
}

.cts-name {
  font-family: var(--cts-serif);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--es-text-on-dark, #E8ECF5);
  text-shadow: 0 2px 18px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.45);
}

.cts-tier-1 .cts-name { font-size: clamp(1.6rem, 2.2vw, 2.1rem); }
.cts-tier-2 .cts-name { font-size: clamp(1.05rem, 1.4vw, 1.3rem); }
.cts-tier-3 .cts-name { font-size: clamp(1rem, 1.3vw, 1.2rem); }

.cts-title {
  font-family: var(--cts-serif);
  font-style: italic;
  color: rgba(255,255,255,0.78);
  margin: 0.4rem 0 0;
  line-height: 1.3;
  letter-spacing: 0.005em;
  font-weight: 400;
}

.cts-tier-1 .cts-title { font-size: 0.95rem; }
.cts-tier-2 .cts-title { font-size: 0.82rem; }
.cts-tier-3 .cts-title { font-size: 0.8rem; }

.cts-sep {
  display: inline-block;
  margin: 0 0.45em;
  opacity: 0.55;
  font-style: normal;
}

.cts-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--es-text-min, 0.75rem);
  font-weight: 700;
  letter-spacing: var(--es-eyebrow-tracking, 0.14em);
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  margin-top: 0.85rem;
  transition: gap 0.3s ease, color 0.2s ease;
}
.cts-card:hover .cts-cue { gap: 0.95rem; color: var(--es-text-on-dark, #E8ECF5); }
.cts-card:active .cts-cue { color: var(--es-text-on-dark, #E8ECF5); }
.cts-cue svg { width: 12px; height: 12px; transition: transform 0.3s ease; }
.cts-card:hover .cts-cue svg { transform: translateX(2px); }
.cts-card:active .cts-cue svg { transform: translateX(2px); }

/* ─────────────────────────────────────
   ENTRANCE ANIMATION
───────────────────────────────────── */

/* Pre-animation hide is applied by JS (.cts-anim) right before observing —
   if JS never runs, errors out, or the observer never fires, cards simply
   stay visible. Content is never stranded invisible. */
.cts-card.cts-anim {
  opacity: 0;
  transform: translateY(20px);
}
.cts-card.cts-in-view {
  animation: cts-rise 0.7s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
@keyframes cts-rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cts-card { opacity: 1; transform: none; animation: none; }
  .cts-card:hover { transform: none; }
  .cts-card:hover .cts-bg { transform: none; }
}

/* ─────────────────────────────────────
   MODAL
───────────────────────────────────── */

.cts-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 32, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  /* Closed = truly hidden, not just transparent: its Close button and Email
     link were still reachable by Tab while the dialog was invisible. The
     visibility flip waits for the fade-out (Core 0.31.2). */
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.cts-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0s;
}

.cts-modal-card {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  background: #0F1A24;
  border-radius: var(--es-radius-feature, 24px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.10),
    inset 0 0 0 1px rgba(255,255,255,0.06),
    0 30px 80px rgba(0,0,0,0.7);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.45s cubic-bezier(0.2,0.8,0.2,1);
  font-family: var(--cts-sans);
}
.cts-modal-backdrop.is-open .cts-modal-card {
  transform: translateY(0) scale(1);
}

.cts-modal-photo {
  position: relative;
  background-size: cover;
  background-position: center 25%;
  background-color: #0a0a0a;
  min-height: 460px;
}
.cts-modal-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.4) 100%),
              linear-gradient(135deg, color-mix(in srgb, var(--cts-teal) 15%, transparent) 0%, transparent 50%);
}
/* No featured image → the JS toggles this class instead of writing an inline
   gradient (which was out of CSS-aliasing reach), so the modal placeholder
   tracks the brand + unified ink under any re-brand. (#20 item (a); Roger-decided.) */
.cts-modal-photo--noimg {
  background-image: linear-gradient(135deg, var(--cts-teal) 0%, var(--cts-ink) 100%);
}

.cts-modal-body {
  padding: 2.5rem 2.5rem 2rem;
  overflow-y: auto;
  max-height: 90vh;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cts-orange) 40%, transparent) transparent;
  color: var(--es-text-on-dark, #E8ECF5);
}
.cts-modal-body::-webkit-scrollbar { width: 6px; }
.cts-modal-body::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--cts-orange) 35%, transparent); border-radius: 3px; }

.cts-modal-tier {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--es-text-on-dark, #E8ECF5);
  margin: 0 0 0.6rem;
}

.cts-modal-name {
  font-family: var(--cts-serif);
  font-weight: 400;
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  color: var(--es-text-on-dark, #E8ECF5);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}

.cts-modal-title {
  font-family: var(--cts-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--es-text-on-dark, #E8ECF5);
  margin: 0 0 1.5rem;
}

.cts-modal-bio {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(232,236,245,0.85);
  margin: 0 0 1.75rem;
  font-weight: 400; /* was 300 — Core's font URL omits Montserrat 300 (#20 item (b)) */
}
.cts-modal-bio:empty { display: none; }

.cts-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.cts-modal-email {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.35rem;
  background: var(--cts-orange);
  color: var(--cts-ink) !important;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
.cts-modal-email:hover {
  background: var(--es-brand-primary-dark, #BE6F00); /* canon hover = darker orange */
  transform: translateY(-1px);
}
.cts-modal-email svg { width: 14px; height: 14px; }

.cts-modal-socials {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.cts-social-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(232,236,245,0.06);
  color: rgba(232,236,245,0.75) !important;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.cts-social-btn:hover {
  background: rgba(232, 236, 245, 0.14);
  color: var(--es-text-on-dark, #E8ECF5) !important;
  transform: translateY(-2px);
}
.cts-social-btn svg { width: 16px; height: 16px; }

/* Hardened against theme/global button & svg overrides (e.g. Astra
   button{color:!important} + svg{fill}). Specificity raised to
   .cts-modal-card .cts-modal-close and visibility-critical props forced. */
.cts-modal-card .cts-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: rgba(7, 17, 32, 0.7) !important;
  color: var(--es-text-on-dark, #E8ECF5) !important;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 20 !important;
  box-shadow: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.cts-modal-card .cts-modal-close:hover {
  background: var(--cts-orange) !important;
  color: var(--cts-ink) !important;
  transform: rotate(90deg);
}
/* The JS auto-focuses the ✕ ~100ms after the modal opens, so the :focus state
   is what shows on open — LIVE Astra's button:focus (0,1,1) would paint it amber
   (#c97700) and beats a single-class .cts-modal-close (0,2,0 still loses on the
   focus pseudo without this). Pin bg/color/border !important, mirroring hover, so
   the auto-focused ✕ never takes the theme accent. (Threshold v1.0.4 lesson.) */
.cts-modal-card .cts-modal-close:focus,
.cts-modal-card .cts-modal-close:focus-visible {
  background: var(--cts-orange) !important;
  color: var(--cts-ink) !important;
  border: 0 !important;
}
.cts-modal-card .cts-modal-close svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  fill: none !important;
  stroke: currentColor !important;
}
.cts-modal-card .cts-modal-close svg path {
  fill: none !important;
  stroke: currentColor !important;
}

@media (max-width: 782px) {
  .cts-modal-backdrop { padding: 1rem; }
  .cts-modal-card {
    grid-template-columns: 1fr;
    grid-template-rows: 280px 1fr;
    max-height: 92vh;
  }
  .cts-modal-photo { min-height: 280px; }
  .cts-modal-body { padding: 1.75rem 1.5rem; }
  .cts-modal-actions { flex-direction: column; align-items: flex-start; }
  .cts-modal-socials { margin-left: 0; }
}

/* ─────────────────────────────────────
   RESPONSIVE — same approach as Ministries v3.6
───────────────────────────────────── */

@media (max-width: 1023px) {
  /* Deep-teal band below 1023 — but NOT the light-tone featured band. Because
     `.cts-section--light` is a single class (same 0,1,0 specificity as
     `.cts-section`) and this rule is later in the source, an unscoped
     `.cts-section` here would override the light tone on mobile only (desktop
     stays light because the media query doesn't apply) — the exact "mobile dark,
     desktop light" bug. :not(.cts-section--light) leaves the light band alone. */
  .cts-section:not(.cts-section--light) {
    background: var(--es-deep-b, #04293A);
    background-image:
      radial-gradient(ellipse 90% 60% at 15% 0%,   color-mix(in srgb, var(--cts-glow-base)           16%, transparent), transparent 60%),
      radial-gradient(ellipse 90% 60% at 85% 100%, color-mix(in srgb, var(--cts-glow-base-secondary) 32%, transparent), transparent 60%);
  }
  .cts-tier-1 { grid-template-columns: repeat(2, 1fr); }
  .cts-tier-2 { grid-template-columns: repeat(3, 1fr); }
  .cts-tier-3 { grid-template-columns: repeat(4, 1fr); }
  .cts-page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .cts-page-subtitle { text-align: left; max-width: 60ch; }
}

@media (max-width: 600px) {
  .cts-section { padding: var(--es-space-band, 3.5rem) 16px; }

  /* Unified portrait aspect on mobile so all cards feel like a coherent set */
  .cts-tier-1 .cts-card,
  .cts-tier-2 .cts-card,
  .cts-tier-3 .cts-card { aspect-ratio: 4 / 5; }

  /* Tier 1 stays single column (hero feel for pastors/elders) */
  .cts-tier-1 { grid-template-columns: 1fr; }

  /* Tier 2 and 3 pair 2-up */
  .cts-tier-2,
  .cts-tier-3 { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .cts-content { padding: 1rem 1.1rem 1.1rem; }
  .cts-tier-1 .cts-content { padding: 1.5rem 1.5rem 1.65rem; }
  .cts-section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* Orphan-card handling — when a category only has 1 staff member,
   give the card a sensible centered presentation instead of leaving
   it stranded in column 1 of an empty multi-column grid.
   Set on the .cts-team-grid via JS. */
.cts-team-grid.cts-only-one {
  grid-template-columns: 1fr;
  justify-content: center;
}
.cts-team-grid.cts-only-one .cts-card {
  width: 100%;
  max-width: 360px;
  justify-self: center;
}
.cts-tier-1.cts-only-one .cts-card { max-width: 480px; }
@media (max-width: 600px) {
  .cts-team-grid.cts-only-one .cts-card { max-width: 100%; }
}

/* ─────────────────────────────────────
   BALANCED SMALL-COUNT LAYOUTS (desktop)
   Counts that don't fill the tier's columns no longer strand
   orphans in an empty row — pairs/quartets center, and odd
   counts center their final row. CSS-only via :has() quantity
   queries (no JS needed; mobile stacking rules unaffected).
───────────────────────────────────── */
@media (min-width: 1024px) {
  /* Exactly 2 in any tier → one centered pair */
  .cts-tier-1:has(> .cts-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 460px)); justify-content: center; }
  .cts-tier-2:has(> .cts-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 380px)); justify-content: center; }
  .cts-tier-3:has(> .cts-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 320px)); justify-content: center; }

  /* Tier 1: exactly 4 → balanced 2×2 instead of 3 + orphan */
  .cts-tier-1:has(> .cts-card:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 460px)); justify-content: center; }

  /* Tier 1: exactly 5 → full row of 3, then a centered pair */
  .cts-tier-1:has(> .cts-card:nth-child(5):last-child) { grid-template-columns: repeat(6, 1fr); }
  .cts-tier-1:has(> .cts-card:nth-child(5):last-child) > .cts-card { grid-column: span 2; }
  .cts-tier-1:has(> .cts-card:nth-child(5):last-child) > .cts-card:nth-child(4) { grid-column: 2 / span 2; }

  /* Tier 2: exactly 3 → centered trio */
  .cts-tier-2:has(> .cts-card:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 320px)); justify-content: center; }

  /* Tier 2: exactly 5 → full row of 4 + centered single;
     exactly 6 → full row of 4 + centered pair */
  .cts-tier-2:has(> .cts-card:nth-child(5):last-child),
  .cts-tier-2:has(> .cts-card:nth-child(6):last-child) { grid-template-columns: repeat(8, 1fr); }
  .cts-tier-2:has(> .cts-card:nth-child(5):last-child) > .cts-card,
  .cts-tier-2:has(> .cts-card:nth-child(6):last-child) > .cts-card { grid-column: span 2; }
  .cts-tier-2:has(> .cts-card:nth-child(5):last-child) > .cts-card:nth-child(5) { grid-column: 4 / span 2; }
  .cts-tier-2:has(> .cts-card:nth-child(6):last-child) > .cts-card:nth-child(5) { grid-column: 3 / span 2; }

  /* Tier 3: exactly 3 / exactly 4 → centered trio / quartet */
  .cts-tier-3:has(> .cts-card:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 300px)); justify-content: center; }
  .cts-tier-3:has(> .cts-card:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 280px)); justify-content: center; }
}

/* Touch devices — disable hover-only effects (same as Ministries v3.1+)
   but KEEP :active press-state feedback so taps register visually */
@media (hover: none) {
  .cts-card:hover { transform: none; }
  .cts-card:hover .cts-bg { transform: none; filter: saturate(1.05) brightness(0.95); }
  .cts-card:hover .cts-tint { opacity: 0.7; }
  .cts-card:hover .cts-sheen { opacity: 0; }
  .cts-card:hover .cts-cue { gap: 0.5rem; color: rgba(255,255,255,0.65); }
  .cts-card:hover .cts-cue svg { transform: none; }

  /* But press-state stays — gives tap feedback */
  .cts-card:active .cts-cue { color: var(--es-text-on-dark, #E8ECF5); }
  .cts-card:active .cts-cue svg { transform: translateX(2px); }
}


/* ════════════════════════════════════════════════════════════════════════
   FULL-BLEED THEME COMPATIBILITY (v1.4)
   ════════════════════════════════════════════════════════════════════════
   .cts-section is a dark immersive band meant to reach the viewport edges;
   inner blocks (.cts-page-header, the category grids) already cap at 1280px +
   margin:auto, so content stays centered. These rules run under
   body.cts-fullbleed (added by cts_body_class on any page containing
   [church_team_showcase]) so the section bleeds full width with no sidebar
   regardless of the page's Astra Content Layout — no per-page setup. Scoped to
   the body class; harmless when a selector is absent. */
body.cts-fullbleed #secondary,
body.cts-fullbleed .widget-area,
body.cts-fullbleed .ast-sidebar,
body.cts-fullbleed #left-sidebar,
body.cts-fullbleed #right-sidebar,
body.cts-fullbleed .sidebar {
  display: none !important;
}
body.cts-fullbleed .ast-container,
body.cts-fullbleed .ast-container-fluid,
body.cts-fullbleed #primary,
body.cts-fullbleed .content-area,
body.cts-fullbleed .site-content,
body.cts-fullbleed .entry-content,
body.cts-fullbleed .wp-block-post-content {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
body.cts-fullbleed .ast-separate-container .ast-article-single,
body.cts-fullbleed .ast-separate-container .ast-article-post,
body.cts-fullbleed .ast-article-single {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
}
/* Even without the body class, stretch the dark section to the full viewport
   inside a constrained/boxed container. Inner content keeps its 1280px cap. */
html body .entry-content .cts-section,
html body .post-content .cts-section,
html body article .cts-section,
.entry-content > .cts-section,
.post-content > .cts-section,
html body .entry-content .cts-opener,
html body .post-content .cts-opener,
html body article .cts-opener {
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  width: 100vw !important;
  max-width: 100vw !important;
}

/* ============================================================
   FEATURED LEADERS ([church_team_featured] / [chancel_featured])
   A few portrait cards + a "meet the whole team" pill. Reuses the full
   showcase's card/grid/modal styles; adds only the CTA + its spacing.
   ============================================================ */
.cts-featured-more {
  text-align: center;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}
/* Teal-OUTLINE pill (the solid orange pill is reserved for the "Plan a Visit"
   CTAs). Padding trimmed ~2px to offset the new 2px border so the pill stays the
   same size. Fills teal on hover with a white label. */
.cts-featured-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.55rem;
  background: transparent;
  color: var(--cts-teal) !important;
  border: 2px solid var(--cts-teal);
  border-radius: 999px;
  font-family: var(--cts-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none !important;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.cts-featured-cta:hover,
.cts-featured-cta:focus {
  background: var(--cts-teal);
  color: #ffffff !important;
  border-color: var(--cts-teal);
  transform: translateY(-1px);
}
/* On the DARK band (the shortcode's default tone) the brand teal on deep-teal
   would nearly vanish — lift the outline + label to a lighter tint of the same
   teal so it stays legible; hover fills with that tint and drops to ink text. */
.cts-section:not(.cts-section--light) .cts-featured-cta {
  color: color-mix(in srgb, var(--cts-teal) 42%, white) !important;
  border-color: color-mix(in srgb, var(--cts-teal) 42%, white);
}
.cts-section:not(.cts-section--light) .cts-featured-cta:hover,
.cts-section:not(.cts-section--light) .cts-featured-cta:focus {
  background: #ffffff;
  color: var(--cts-ink) !important;
  border-color: #ffffff;
}
.cts-featured-cta svg { width: 15px; height: 15px; }
@media (prefers-reduced-motion: reduce) {
  .cts-featured-cta { transition: none; }
}

/* ── Featured teaser — a tidy centered column (compact cards) ─────────────────
   The [church_team_featured] teaser sits in a narrow centered column so it
   reads as a curated few, not the full-bleed directory. (Previously a per-page
   CSS override; baked in here so it's permanent — delete it from the page.)
   The full team page (.cts-section WITHOUT .cts-featured) is unaffected. */
.cts-featured .cts-section-header,
.cts-featured .cts-team-grid,
.cts-featured .cts-featured-more {
  /* Curated-teaser width. Was 820 (cards ~194px at tier-2 4-across); widened to
     1100 so the homepage faces read warmer (~264px) per the imagery-leads
     principle, while staying clearly narrower than the ~1280 full-width bands so
     it's still a tidy centered teaser, not the full-bleed directory. Header/grid/
     CTA share the value so their left edges stay aligned. */
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 1023px) {
  .cts-featured .cts-team-grid.cts-tier-2 { grid-template-columns: repeat(2, 1fr) !important; }
}
