/* ============================================================
   Shared styles for the 5 sector pages
   (Residential, Domiciliary, Supported Living, Outreach, Day)
   ============================================================ */

/* ── Hero ────────────────────────────────────────────────── */
.sec-hero {
    position: relative;
    min-height: var(--page-hero-height);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding-left: 250px;
    overflow: hidden;
    background-color: #0a1d3d;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
.sec-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(10,29,61,0.86) 0%, rgba(10,29,61,0.78) 50%, rgba(10,29,61,0.86) 100%);
  z-index: 1;
}
.sec-hero-content {
  position: relative;
  z-index: 2;
  padding: var(--space-12) var(--space-6);
  color: #fff;
}
.sec-hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: #EF9F27;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 12px;
}
.sec-hero h1 {
  font-size: 46px;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 12px;
  color: #fff;
}
.sec-hero h1 .accent { color: #EF9F27; }
.sec-hero p {
  font-size: 14px;
  line-height: 1.6;
  color: #B5D4F4;
  max-width: 560px;
}

/* ── Section shell ───────────────────────────────────────── */
.sec-section { padding: 64px 24px; }
.sec-section.bg-grey { background: #F4F3F7; }
.sec-section.bg-navy { background: #0a1d3d; text-align: center; }
.sec-header { text-align: center; margin-bottom: 32px; max-width: 720px; margin-left: auto; margin-right: auto; }
.sec-eyebrow-pill {
  display: inline-block;
  padding: 6px 18px;
  background: rgba(83, 74, 183, 0.12);
  border-radius: 999px;
  margin-bottom: 14px;
}
.sec-eyebrow-pill span,
.sec-eyebrow-plain {
  font-size: 11px; font-weight: 600;
  color: #3C3489;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sec-eyebrow-plain { display: inline-block; margin-bottom: 14px; color: #185FA5; }
.sec-h2 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 2.8vw, 30px);
  font-weight: 700;
  color: #0a1d3d;
  line-height: 1.2;
  margin: 0 0 12px;
}
.sec-lede { font-size: 14px; color: #5F5E5A; line-height: 1.6; max-width: 780px; margin: 0 auto; }
.sec-sublede {
  font-style: italic;
  font-size: 13px;
  color: #5F5E5A;
  line-height: 1.6;
  text-align: center;
  margin: -16px auto 24px;
  max-width: 580px;
}

/* ── Pressures grid (5 cards, last is full width) ───────── */
.sec-pressures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
}
.sec-pressure {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  border-left: 3px solid var(--p-color, #DC2626);
  border-top: 0.5px solid rgba(0,0,0,0.05);
  border-right: 0.5px solid rgba(0,0,0,0.05);
  border-bottom: 0.5px solid rgba(0,0,0,0.05);
  display: flex; gap: 12px; align-items: flex-start;
}
.sec-pressure.span-2 { grid-column: span 2; }
.sec-pressure-icon {
  width: 38px; height: 38px;
  background: var(--p-icon-bg, rgba(220,38,38,0.1));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--p-color, #DC2626);
  font-size: 16px;
}
.sec-pressure-body { flex: 1; min-width: 0; }
.sec-pressure-eyebrow {
  font-size: 11px; font-weight: 600;
  color: var(--p-color, #DC2626);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sec-pressure-title { font-size: 15px; font-weight: 600; color: #0a1d3d; margin-bottom: 8px; }
.sec-pressure-desc { font-size: 12px; color: #5F5E5A; line-height: 1.6; margin: 0; }

/* ── Answers list (5 rows, 3-column desktop) ─────────────── */
.sec-answers { display: flex; flex-direction: column; gap: 14px; max-width: 1100px; margin: 0 auto; }
.sec-answer {
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  border: 0.5px solid rgba(83, 74, 183, 0.12);
}
.sec-answer-row {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.sec-answer-head { display: flex; align-items: center; gap: 12px; }
.sec-answer-num {
  width: 36px; height: 36px;
  background: var(--a-bg, rgba(220,38,38,0.1));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--a-color, #DC2626);
  font-size: 14px; font-weight: 700;
}
.sec-answer-name { font-size: 14px; font-weight: 600; color: #0a1d3d; }
.sec-answer-solution-title { font-size: 13px; font-weight: 600; color: #534AB7; margin-bottom: 4px; }
.sec-answer-solution-body  { font-size: 12px; color: #5F5E5A; line-height: 1.55; margin: 0; }
.sec-answer-changes-label  { font-size: 11px; font-weight: 600; color: #444441; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.sec-answer-changes-body   { font-size: 12px; color: #5F5E5A; line-height: 1.55; margin: 0; }

/* ── Day inside Brolly (4 vignettes) ─────────────────────── */
.sec-day {
  background: #F4F3F7;
  border-radius: 16px;
  padding: 28px;
  max-width: 1100px;
  margin: 0 auto;
}
.sec-day-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sec-day-time {
  font-size: 11px; font-weight: 700;
  color: #185FA5;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 8px;
}
.sec-day-body { font-size: 12px; color: #444441; line-height: 1.6; margin: 0; }

/* ── Stats grid (4 cards) ────────────────────────────────── */
.sec-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
}
.sec-stat {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
}
.sec-stat-number { font-size: 30px; font-weight: 700; color: #EF9F27; line-height: 1.1; margin-bottom: 6px; }
.sec-stat-label  { font-size: 12px; font-weight: 600; color: #0a1d3d; margin-bottom: 6px; }
.sec-stat-desc   { font-size: 11px; color: #5F5E5A; line-height: 1.5; margin: 0; }

/* ── Bottom CTA ──────────────────────────────────────────── */
.sec-section.bg-navy h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; color: #fff; line-height: 1.3; margin: 0 0 12px; }
.sec-section.bg-navy p  { font-size: 14px; color: #B5D4F4; line-height: 1.6; max-width: 520px; margin: 0 auto 24px; }
.sec-cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sec-cta-primary {
  display: inline-block;
  background: #EF9F27; color: #0a1d3d;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
}
.sec-cta-primary:hover { opacity: 0.92; transform: translateY(-2px); color: #0a1d3d; }
.sec-cta-secondary {
  display: inline-block;
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.sec-cta-secondary:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.8); color: #fff; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sec-pressures { grid-template-columns: 1fr; }
  .sec-pressure.span-2 { grid-column: auto; }
  .sec-answer-row { grid-template-columns: 1fr; gap: 12px; }
  .sec-day-grid  { grid-template-columns: repeat(2, 1fr); }
  .sec-stats     { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .sec-day-grid  { grid-template-columns: 1fr; }
  .sec-stats     { grid-template-columns: 1fr; }
}

/* ============================================================
   SCROLL-TRIGGERED ANIMATIONS
   `.is-in-view` is added to the parent section/element by sector.js
   when it scrolls into the viewport (IntersectionObserver).
   ============================================================ */

/* ── Section 1 — pressure tiles row-by-row staged reveal ──
   IMPORTANT: tiles default to fully visible. JS adds `.tiles-staged` to the
   .sec-pressures element to ARM the hidden state, then progressively adds
   `.stage-1`, `.stage-2`, `.stage-3` as the user scrolls deeper into the
   section. If JS fails for any reason, tiles render normally.
     stage-1  = row 1 tiles 1+2
     stage-2  = row 2 tiles 3+4
     stage-3  = row 3 tile 5 (full-width)                                    */
.sec-pressures.tiles-staged .sec-pressure {
  opacity: 0;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
/* Initial transforms — left col from left, right col from right, span-2 from below */
.sec-pressures.tiles-staged > .sec-pressure:nth-child(1),
.sec-pressures.tiles-staged > .sec-pressure:nth-child(3) {
  transform: translateX(-40px) scale(0.96);
}
.sec-pressures.tiles-staged > .sec-pressure:nth-child(2),
.sec-pressures.tiles-staged > .sec-pressure:nth-child(4) {
  transform: translateX(40px) scale(0.96);
}
.sec-pressures.tiles-staged > .sec-pressure:nth-child(5) {
  transform: translateY(40px) scale(0.96);
}

/* Stage 1: row 1 reveals (tiles 1+2), with a small intra-row stagger */
.sec-pressures.tiles-staged.stage-1 > .sec-pressure:nth-child(1),
.sec-pressures.tiles-staged.stage-1 > .sec-pressure:nth-child(2) {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}
.sec-pressures.tiles-staged.stage-1 > .sec-pressure:nth-child(2) { transition-delay: 0.12s; }

/* Stage 2: row 2 reveals (tiles 3+4) */
.sec-pressures.tiles-staged.stage-2 > .sec-pressure:nth-child(3),
.sec-pressures.tiles-staged.stage-2 > .sec-pressure:nth-child(4) {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}
.sec-pressures.tiles-staged.stage-2 > .sec-pressure:nth-child(4) { transition-delay: 0.12s; }

/* Stage 3: row 3 reveals (the full-width CQC tile) */
.sec-pressures.tiles-staged.stage-3 > .sec-pressure:nth-child(5) {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* "Sounds familiar?" takeaway box fades up after the tiles complete */
.sec-section > .sw-bottom-line {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.sec-section > .sw-bottom-line.is-in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Section 2 — answer rows: per-row coordinated reveal ──
   Each .sec-answer row is observed individually so each triggers as it
   scrolls into view. Within a row: number pops in, name slides in from
   left, then the solution and changes columns fade up in sequence.       */
.sec-answer.row-staged .sec-answer-num {
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.sec-answer.row-staged .sec-answer-name {
  opacity: 0; transform: translateX(-20px);
  transition: opacity 0.5s ease-out 0.10s, transform 0.5s ease-out 0.10s;
}
.sec-answer.row-staged .sec-answer-row > div:nth-child(2) {
  opacity: 0; transform: translateY(15px);
  transition: opacity 0.5s ease-out 0.25s, transform 0.5s ease-out 0.25s;
}
.sec-answer.row-staged .sec-answer-row > div:nth-child(3) {
  opacity: 0; transform: translateY(15px);
  transition: opacity 0.5s ease-out 0.40s, transform 0.5s ease-out 0.40s;
}
.sec-answer.row-staged.is-in-view .sec-answer-num { opacity: 1; transform: scale(1); }
.sec-answer.row-staged.is-in-view .sec-answer-name { opacity: 1; transform: translateX(0); }
.sec-answer.row-staged.is-in-view .sec-answer-row > div:nth-child(2),
.sec-answer.row-staged.is-in-view .sec-answer-row > div:nth-child(3) {
  opacity: 1; transform: translateY(0);
}

/* ── Section 3 — day timeline with sun/moon traversal ──
   Pseudo-elements draw a horizontal gradient track at the bottom of
   .sec-day plus a glowing dot that traverses the track from left to right
   over 4s, morphing from a warm sun to a cool moon as it crosses. The
   four time-blocks fade up in turn as the dot passes them.               */
.sec-day.day-staged {
  position: relative;
  padding-bottom: 56px;
}
.sec-day.day-staged::after {
  /* the gradient track */
  content: '';
  position: absolute;
  bottom: 24px;
  left: 28px; right: 28px;
  height: 3px;
  background: linear-gradient(90deg, #FCD224 0%, #F5A23A 28%, #C58CDB 55%, #4A90E2 80%, #1E3A5F 100%);
  border-radius: 999px;
  pointer-events: none;
}
.sec-day.day-staged::before {
  /* the sun/moon traveller — sits ON the track at left:0 */
  content: '';
  position: absolute;
  bottom: 18px;
  left: 28px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFE066 0%, #F5A23A 80%);
  box-shadow: 0 0 16px rgba(252,210,36,0.7);
  z-index: 2;
  pointer-events: none;
}
.sec-day.day-staged.is-in-view::before {
  animation: dayTraverse 4s ease-in-out forwards;
}
@keyframes dayTraverse {
  0%   { left: 28px;
         background: radial-gradient(circle, #FFE066 0%, #F5A23A 80%);
         box-shadow: 0 0 16px rgba(252,210,36,0.7); }
  50%  { background: radial-gradient(circle, #FFD7A3 0%, #C58CDB 80%);
         box-shadow: 0 0 16px rgba(197,140,219,0.6); }
  100% { left: calc(100% - 28px - 18px);
         background: radial-gradient(circle, #C5DAFF 0%, #4A90E2 80%);
         box-shadow: 0 0 16px rgba(74,144,226,0.6); }
}
/* the four time-blocks fade up as the dot reaches each column */
.sec-day.day-staged .sec-day-grid > div {
  opacity: 0; transform: translateY(15px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.sec-day.day-staged.is-in-view .sec-day-grid > div { opacity: 1; transform: translateY(0); }
.sec-day.day-staged.is-in-view .sec-day-grid > div:nth-child(1) { transition-delay: 0.0s; }
.sec-day.day-staged.is-in-view .sec-day-grid > div:nth-child(2) { transition-delay: 1.0s; }
.sec-day.day-staged.is-in-view .sec-day-grid > div:nth-child(3) { transition-delay: 2.0s; }
.sec-day.day-staged.is-in-view .sec-day-grid > div:nth-child(4) { transition-delay: 3.0s; }

/* ── Section 4 — stat tiles fade up in sequence ──────────
   Numbers with `[data-target]` are also count-up-animated by brolly.js
   independently — so the number ticks up while the tile fades in.        */
.sec-stats.tiles-staged .sec-stat {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.sec-stats.tiles-staged.is-in-view .sec-stat { opacity: 1; transform: translateY(0); }
.sec-stats.tiles-staged.is-in-view .sec-stat:nth-child(1) { transition-delay: 0.0s; }
.sec-stats.tiles-staged.is-in-view .sec-stat:nth-child(2) { transition-delay: 0.1s; }
.sec-stats.tiles-staged.is-in-view .sec-stat:nth-child(3) { transition-delay: 0.2s; }
.sec-stats.tiles-staged.is-in-view .sec-stat:nth-child(4) { transition-delay: 0.3s; }

/* ── Section 5 — slow continuous glow on primary CTA ─────── */
@keyframes ctaSlowGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(239,159,39,0.35), 0 0 36px rgba(239,159,39,0.15); }
  50%      { box-shadow: 0 0 28px rgba(239,159,39,0.65), 0 0 60px rgba(239,159,39,0.30); }
}
.cta-slow-glow {
  animation: ctaSlowGlow 3.5s ease-in-out infinite;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .sec-pressures.tiles-staged .sec-pressure,
  .sec-section > .sw-bottom-line,
  .sec-answer.row-staged .sec-answer-num,
  .sec-answer.row-staged .sec-answer-name,
  .sec-answer.row-staged .sec-answer-row > div:nth-child(2),
  .sec-answer.row-staged .sec-answer-row > div:nth-child(3),
  .sec-day.day-staged .sec-day-grid > div,
  .sec-stats.tiles-staged .sec-stat {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .sec-day.day-staged.is-in-view::before { animation: none; }
  .cta-slow-glow { animation: none; }
}
