/* Phase 8j — How We Work page: replace webp diagrams with HTML content,
   suppress icons, restyle quality strip and decision flow cards,
   section background alternation. */

/* ── 1. Section background alternation ── */
.how-work-root-section {
  background: var(--telstar-surface-high, #ffffff);
}

.how-work-interviews-section {
  background: var(--telstar-surface-low, #F4F6F8);
}

.how-work-foundation-section {
  background: var(--telstar-surface-high, #ffffff);
}

.how-work-software-section {
  background: var(--telstar-surface-low, #F4F6F8);
}

.how-work-next-section {
  background: var(--telstar-surface-high, #ffffff);
}

/* ── 2. Suppress icons throughout ── */
.how-work-section .telstar-icon-badge {
  display: none !important;
}

/* ── 3. Symptoms vs causes grid ── */
.how-work-symptoms-grid {
  margin: clamp(1.5rem, 2.5vw, 2.2rem) 0;
  background: var(--telstar-primary, #0B2545);
  border-radius: 0.5rem;
  padding: clamp(1.4rem, 2.5vw, 2rem);
}

.how-work-symptoms-grid__header {
  display: grid;
  grid-template-columns: 1fr 2rem 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.how-work-symptoms-grid__col-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.how-work-symptoms-grid__col-label--symptom {
  color: rgba(255, 255, 255, 0.45);
}

.how-work-symptoms-grid__col-label--cause {
  color: var(--telstar-teal, #2CA6A4);
}

.how-work-symptoms-grid__row {
  display: grid;
  grid-template-columns: 1fr 2rem 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.how-work-symptoms-chip {
  padding: 0.7rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.how-work-symptoms-chip--symptom {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
}

.how-work-symptoms-chip--cause {
  background: rgba(44, 166, 164, 0.10);
  border: 1px solid rgba(44, 166, 164, 0.25);
  border-left: 3px solid var(--telstar-teal, #2CA6A4);
  color: rgba(255, 255, 255, 0.88);
}

.how-work-symptoms-grid__arrow {
  color: var(--telstar-teal, #2CA6A4);
  font-size: 1.1rem;
  text-align: center;
  opacity: 0.6;
}

.how-work-symptoms-grid__note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
  line-height: 1.55;
}

/* ── 4. Working style strip — restyle to card language ── */
.how-work-working-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: clamp(0.75rem, 1.5vw, 1rem) !important;
  margin-top: clamp(1.5rem, 2.5vw, 2rem) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.how-work-working-strip > div {
  background: #fff !important;
  border: 1px solid rgba(11, 37, 69, 0.10) !important;
  border-left: 4px solid var(--telstar-teal, #2CA6A4) !important;
  border-radius: 0.5rem !important;
  padding: 1rem 1.1rem !important;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.07) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.3rem !important;
}

.how-work-working-strip strong {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: var(--telstar-primary, #0B2545) !important;
  display: block !important;
}

.how-work-working-strip span {
  font-size: 0.87rem !important;
  color: var(--telstar-text-muted, #5C6B73) !important;
  line-height: 1.45 !important;
  display: block !important;
}

/* ── 5. Decision flow steps — match card style ── */
.how-work-decision-flow {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin-bottom: clamp(1.2rem, 2vw, 1.6rem) !important;
}

.how-work-decision-step {
  background: var(--telstar-primary, #0B2545) !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.85rem 1.5rem !important;
  box-shadow: none !important;
  position: relative !important;
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 50%, calc(100% - 24px) 100%, 0 100%, 24px 50%) !important;
  margin-left: -12px !important;
  z-index: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-height: 3.5rem !important;
}

.how-work-decision-step:first-child {
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 50%, calc(100% - 24px) 100%, 0 100%) !important;
  margin-left: 0 !important;
  padding-left: 1rem !important;
  z-index: 5 !important;
}

.how-work-decision-step:nth-child(2) { z-index: 4 !important; }
.how-work-decision-step:nth-child(3) { z-index: 3 !important; }
.how-work-decision-step:nth-child(4) { z-index: 2 !important; }

.how-work-decision-step:last-child {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 24px 50%) !important;
  z-index: 1 !important;
}

.how-work-decision-step:not(:last-child)::after {
  display: none !important;
}

.how-work-decision-step span {
  display: block !important;
  font-size: 1.6rem !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  color: var(--telstar-teal, #2CA6A4) !important;
  margin: 0 0 0.3rem !important;
  line-height: 1 !important;
}

.how-work-decision-step h3 {
  display: block !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin: 0 0 0.2rem !important;
}

.how-work-decision-step p {
  display: block !important;
  font-size: 0.78rem !important;
  color: rgba(255,255,255,0.65) !important;
  margin: 0 !important;
  line-height: 1.35 !important;
}

/* ── 6. Cause chain card — tighten ── */
.how-work-cause-card {
  border-left: 4px solid var(--telstar-teal, #2CA6A4) !important;
}

/* ── 7. Software section right panel — prevent overflow ── */
.how-work-software-section .how-work-software__panel {
  overflow: hidden !important;
  max-width: 100% !important;
}

@media (max-width: 860px) {
  .how-work-working-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .how-work-decision-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .how-work-symptoms-grid__header,
  .how-work-symptoms-grid__row {
    grid-template-columns: 1fr 1.5rem 1fr;
  }
}

@media (max-width: 560px) {
  .how-work-working-strip,
  .how-work-decision-flow {
    grid-template-columns: 1fr !important;
  }

  .how-work-symptoms-grid__header {
    display: none;
  }

  .how-work-symptoms-grid__row {
    grid-template-columns: 1fr 1.5rem 1fr;
  }
}

/* Fix symptoms grid overflow — constrain width and prevent page blow-out */
.how-work-symptoms-grid {
  max-width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.how-work-symptoms-grid__header,
.how-work-symptoms-grid__row {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.how-work-symptoms-chip {
  min-width: 0 !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

/* Also fix any other overflow issues on the page */
.how-work-section {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* Fix software grid column overflow — remove fixed min-width */
.how-work-software-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr) !important;
}

/* Belt and braces — prevent any section causing horizontal scroll */
.how-work-section,
.how-work-software-section {
  overflow-x: hidden !important;
}

/* Fix lens card grid when icon is hidden */
.how-work-lens-card {
  grid-template-columns: 1fr !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.how-work-lens-card > .telstar-icon-badge {
  display: none !important;
}

/* Fix root grid overflow */
.how-work-root-grid {
  max-width: 100% !important;
  overflow: hidden !important;
}

/* Prevent any child from overflowing */
.how-work-root-section * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Fix symptoms grid header 3-column layout on narrow screens */
@media (max-width: 700px) {
  .how-work-symptoms-grid__header,
  .how-work-symptoms-grid__row {
    grid-template-columns: 1fr 1.2rem 1fr !important;
    font-size: 0.82rem !important;
  }

  .how-work-symptoms-chip {
    padding: 0.5rem 0.65rem !important;
    font-size: 0.82rem !important;
  }
}

/* Fix software points articles when icon is hidden */
.how-work-software-points article {
  grid-template-columns: 1fr !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.how-work-software-points article > .telstar-icon-badge {
  display: none !important;
}

.how-work-software-points article > div {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Catch-all for any remaining grid overflow on this page */
.how-work-software-section * {
  box-sizing: border-box !important;
}

.how-work-software-copy {
  min-width: 0 !important;
  overflow: hidden !important;
}

/* ── Hero — match What We Do page height and dark background ── */
.how-work-section--first {
  background: var(--telstar-primary, #0B2545) !important;
  padding-top: clamp(2.4rem, 4vw, 3.6rem) !important;
  padding-bottom: clamp(2.4rem, 4vw, 3.6rem) !important;
}

/* ── Hero right panel — remove icon, reduce padding ── */
.how-work-section--first .telstar-icon-badge {
  display: none !important;
}

.how-work-hero-proof,
.how-work-section--first aside,
.how-work-section--first [class*="proof"] {
  padding: clamp(1.2rem, 2vw, 1.6rem) !important;
  gap: 0.6rem !important;
}

.how-work-section--first [class*="proof"] h2,
.how-work-section--first aside h2 {
  font-size: clamp(1.1rem, 1.4vw, 1.25rem) !important;
  margin-bottom: 0.2rem !important;
}

/* Explicitly reset root section background to white */
.how-work-root-section {
  background: var(--telstar-surface-high, #ffffff) !important;
}

.how-work-root-section > .shell h2,
.how-work-root-section > .shell > * > p:not(.how-work-symptoms-grid p) {
  color: var(--telstar-primary, #0B2545) !important;
}

/* Paragraphs inside the navy symptoms grid must stay white */
.how-work-symptoms-grid p,
.how-work-symptoms-grid .how-work-symptoms-grid__intro {
  color: rgba(255, 255, 255, 0.72) !important;
}

/* Fix symptoms grid header column wrapping */
.how-work-symptoms-grid__header {
  grid-template-columns: 1fr 2.5rem 1fr !important;
}

.how-work-symptoms-grid__col-label {
  white-space: nowrap !important;
  overflow: visible !important;
}

/* ── Hero — match What We Do height precisely ── */
.how-work-hero {
  padding-top: clamp(2.4rem, 4vw, 3.6rem) !important;
  padding-bottom: clamp(2.4rem, 4vw, 3.6rem) !important;
}

/* ── Root cause panel — remove icon, reduce padding ── */
.root-cause-panel__topline .telstar-icon-badge {
  display: none !important;
}

.root-cause-panel--compact {
  padding: clamp(1.2rem, 2vw, 1.6rem) !important;
  gap: 0.75rem !important;
}

.root-cause-panel--compact h3 {
  font-size: clamp(1.1rem, 1.4vw, 1.25rem) !important;
  margin-bottom: 0.3rem !important;
}

.root-cause-mini-flow {
  gap: 0.4rem !important;
}

.root-cause-mini-flow__item {
  padding: 0.45rem 0.75rem !important;
}

/* ── Match How We Work hero height precisely to What We Do ── */
.how-work-hero.hero--inner {
  min-height: 0 !important;
}

.how-work-hero .hero__inner {
  padding-top: clamp(3rem, 5vw, 4.5rem) !important;
  padding-bottom: clamp(3rem, 5vw, 4.5rem) !important;
  align-items: center !important;
}

/* Reduce root cause panel to match What We Do right panel proportions */
.root-cause-panel--compact {
  padding: 1.1rem 1.25rem !important;
}

.root-cause-mini-flow__item strong {
  font-size: 0.92rem !important;
}

.root-cause-mini-flow__causes {
  gap: 0.35rem !important;
  padding: 0.5rem 0.65rem !important;
}

.root-cause-panel__bottom-line {
  font-size: 0.82rem !important;
  margin-top: 0.5rem !important;
  padding-top: 0.5rem !important;
}

/* Fine-tune hero vertical balance to match What We Do */
.how-work-hero .hero__inner {
  padding-top: clamp(2.8rem, 4.5vw, 4rem) !important;
  padding-bottom: clamp(2.8rem, 4.5vw, 4rem) !important;
}

/* ── Root cause section — background and spacing ── */
.how-work-root-section {
  background: var(--telstar-surface-low, #F4F6F8) !important;
}

/* ── Symptoms grid — tighten bottom padding ── */
.how-work-symptoms-grid {
  padding-bottom: clamp(1rem, 1.8vw, 1.4rem) !important;
  margin-bottom: 0 !important;
}

/* ── Cause chain card — remove forced full height ── */
.how-work-cause-card--compact {
  min-height: 0 !important;
  align-self: start !important;
}

/* ── Lens cards — add consistent left border treatment ── */
.how-work-lens-card {
  border-left: 4px solid var(--telstar-teal, #2CA6A4) !important;
  border-top: 1px solid rgba(11, 37, 69, 0.10) !important;
  border-right: 1px solid rgba(11, 37, 69, 0.10) !important;
  border-bottom: 1px solid rgba(11, 37, 69, 0.10) !important;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.07) !important;
}

/* Lens card span label — keep teal, tighten */
.how-work-lens-card span {
  font-size: 0.68rem !important;
  letter-spacing: 0.14em !important;
  margin-bottom: 0.2rem !important;
}

/* Lens card heading */
.how-work-lens-card h3 {
  font-size: clamp(0.98rem, 1.1vw, 1.08rem) !important;
  margin-bottom: 0.3rem !important;
}

/* Lens card body */
.how-work-lens-card p {
  font-size: 0.88rem !important;
  color: var(--telstar-text-muted, #5C6B73) !important;
}

/* ── Symptoms grid intro text ── */
.how-work-symptoms-grid__intro {
  font-size: 0.92rem !important;
  color: rgba(255, 255, 255, 0.65) !important;
  line-height: 1.6 !important;
  margin: 0 0 1rem !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ── Fix "Possible structural cause" header alignment ──
   Column header should align to the left edge of the cause chips,
   not to the arrow. Use same 3-column grid but shift label right
   to sit over the third column. */
.how-work-symptoms-grid__header {
  grid-template-columns: 1fr 2.5rem 1fr !important;
}

.how-work-symptoms-grid__col-label--cause {
  /* Already in third column — ensure it aligns left within that column */
  text-align: left !important;
  padding-left: 0 !important;
}

/* ── Cause chain card — full height matching lens cards ── */
.how-work-root-grid {
  align-items: stretch !important;
}

.how-work-cause-card--compact {
  min-height: 0 !important;
  height: 100% !important;
  align-self: stretch !important;
  display: flex !important;
  flex-direction: column !important;
}

.how-work-cause-card--compact .how-work-cause-card__closing {
  margin-top: auto !important;
  padding-top: 1rem !important;
}

/* Fix intro text colour — was inheriting dark on dark */
.how-work-symptoms-grid__intro {
  color: rgba(255, 255, 255, 0.72) !important;
}

/* Remove excess top padding in the grid before the intro text */
.how-work-symptoms-grid {
  padding-top: clamp(1.4rem, 2.2vw, 1.8rem) !important;
}

/* Tighten gap between intro text and column headers */
.how-work-symptoms-grid__intro {
  margin-bottom: 0.85rem !important;
  padding-bottom: 0.85rem !important;
}

/* ── Symptoms grid — rounded corners, tighter bottom padding ── */
.how-work-symptoms-grid {
  border-radius: var(--telstar-radius-md, 18px) !important;
  padding-bottom: clamp(1rem, 1.6vw, 1.3rem) !important;
}

/* ── Column header alignment fix ──
   The cause label is in the third grid column.
   Needs negative left margin to align with chip left edge
   since the arrow column sits between them. */
.how-work-symptoms-grid__col-label--cause {
  grid-column: 3 !important;
  margin-left: 0.75rem !important;
}

/* ── Gap between symptoms grid and cause chain cards below ── */
.how-work-symptoms-grid {
  margin-bottom: clamp(1.2rem, 2vw, 1.6rem) !important;
}

/* ── Software section — real app screenshot ── */
.how-work-app-screenshot {
  display: flex !important;
  align-items: flex-start !important;
  align-self: start !important;
}

.how-work-app-screenshot img {
  width: 100% !important;
  height: auto !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 4px 24px rgba(11,37,69,0.12) !important;
  border: 1px solid rgba(11,37,69,0.08) !important;
}

/* ── Software points — full-width three-column card row ── */
.how-work-software-section .how-work-software-points {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1.5rem !important;
  margin-top: 2rem !important;
  padding: 0 !important;
  background: transparent !important;
}

.how-work-software-section .how-work-software-points article {
  display: block !important;
  background: #ffffff !important;
  border: 1px solid rgba(11,37,69,0.10) !important;
  border-left: 4px solid var(--telstar-teal, #2CA6A4) !important;
  border-radius: 0.5rem !important;
  box-shadow: 0 1px 3px rgba(11,37,69,0.07) !important;
  padding: 1.25rem 1.5rem !important;
}

.how-work-software-section .how-work-software-points article h3 {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  color: var(--telstar-primary, #0B2545) !important;
  margin: 0 0 0.5rem !important;
}

.how-work-software-section .how-work-software-points article p {
  margin: 0 !important;
  font-size: 0.95rem !important;
  color: var(--telstar-text-muted, #5C6B73) !important;
  line-height: 1.55 !important;
}

/* ── Lightbox trigger ── */
.telstar-lightbox-trigger {
  display: block !important;
  position: relative !important;
  cursor: zoom-in !important;
}

.telstar-lightbox-hint {
  position: absolute !important;
  bottom: 0.75rem !important;
  right: 0.75rem !important;
  background: rgba(11,37,69,0.75) !important;
  color: #ffffff !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  padding: 0.3rem 0.65rem !important;
  border-radius: 999px !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transition: opacity 0.2s ease !important;
}

.telstar-lightbox-trigger:hover .telstar-lightbox-hint {
  opacity: 1 !important;
}

/* ── Lightbox overlay ── */
.telstar-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,37,69,0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.telstar-lightbox-overlay.is-open {
  display: flex;
}

.telstar-lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}

/* ── Evidence to sequence — arrow emphasis and strip label ── */
.how-work-decision-step {
  position: relative !important;
}

.how-work-decision-step:not(:last-child)::after {
  content: "→" !important;
  position: absolute !important;
  right: -0.85rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: var(--telstar-teal, #2CA6A4) !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  z-index: 1 !important;
}

.how-work-working-strip-label {
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  color: var(--telstar-teal, #2CA6A4) !important;
  margin: 0 0 0.75rem !important;
  padding-top: 1.25rem !important;
  display: block !important;
}

.how-work-working-strip {
  background: var(--telstar-surface-low, #F4F6F8) !important;
  padding: 0 0 2rem !important;
  margin-top: 0 !important;
}

.how-work-working-strip-label {
  background: var(--telstar-surface-low, #F4F6F8) !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}
