/* ==========================================================================
   Work with me: page layer on top of css/galaxy-system.css
   Linked after galaxy-system.css. Uses its tokens, type primitives,
   section heads, situations rows, work-tile trails, node, engage and CTA band.
   Order: page title accent, audience tabs, panels (situations, steps,
   examples, note, sector notes, panel CTA), motion, responsive,
   reduced motion, forced colours, print.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Page header: shared .page-hero lives in galaxy-system.css (section 8b)
   -------------------------------------------------------------------------- */
.page-title-hl {
  color: var(--hot);
  font-style: italic;
  font-weight: 300;
  text-shadow: 0 0 34px rgba(255, 42, 70, .38);
}

/* --------------------------------------------------------------------------
   2. Audience tabs (the only selector on the page)
   -------------------------------------------------------------------------- */
.audience {
  position: relative;
  padding-top: clamp(32px, 4vw, 56px);
  background: var(--ink);
}
.audience-head { margin-bottom: var(--s5); }

.tablist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--col-gap);
}

.tab {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "num  glyph"
    "name name"
    "sub  sub";
  align-content: start;
  row-gap: var(--s3);
  padding: clamp(20px, 2.2vw, 32px);
  text-align: left;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 0;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
/* laser bar along the bottom edge of the selected tab */
.tab::after {
  content: '';
  position: absolute;
  left: -1px; right: -1px; bottom: -1px;
  height: 2px;
  background: var(--hot);
  box-shadow: 0 0 12px var(--hot);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease-out);
}
.tab .lock { inset: -1px; }
.tab .lock i { width: 18px; height: 18px; opacity: 0; transform: translate(var(--dx), var(--dy)); }

.tab-num {
  grid-area: num;
  font: 400 .875rem/1 var(--f-mono);
  letter-spacing: .04em;
  color: var(--mute);
  transition: color var(--dur-2), text-shadow var(--dur-2);
}
.tab-glyph { grid-area: glyph; width: 34px; height: 29px; }
.tab-name {
  grid-area: name;
  margin-top: var(--s2);
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -.015em;
  color: var(--bone-dim);
  transition: color var(--dur-2);
}
.tab-for {
  display: block;
  margin-bottom: 6px;
  font: 400 var(--t-label)/1.4 var(--f-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute);
}
.tab-sub {
  grid-area: sub;
  max-width: 38ch;
  font-size: var(--t-small);
  line-height: 1.55;
  color: var(--bone-dim);
}

@media (hover: hover) {
  .tab:hover { border-color: var(--ink-4); background: #151513; }
  .tab:hover .tab-name { color: var(--bone); }
  .tab:hover .glyph circle { fill: var(--hot); }
}
/* touch: a press shows on the card itself */
.tab:active { background: #151513; }

.tab[aria-selected="true"] {
  background:
    radial-gradient(ellipse 80% 90% at 0% 100%, rgba(200, 16, 46, .16), transparent 70%),
    var(--ink-2);
  border-color: var(--ink-4);
}
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab[aria-selected="true"] .lock i { opacity: 1; transform: none; }
.tab[aria-selected="true"] .tab-num { color: var(--hot); text-shadow: 0 0 12px var(--hot); }
.tab[aria-selected="true"] .tab-name { color: var(--bone); }
.tab[aria-selected="true"] .tab-for { color: var(--hot); }
.tab[aria-selected="true"] .glyph circle { fill: var(--hot); }
.tab[aria-selected="true"] .glyph polygon { stroke-dashoffset: 0; fill: rgba(200, 16, 46, .2); }
.tab:focus-visible { outline-offset: 4px; }

/* without JS the tabs cannot switch: hide them and show every panel */
html:not(.js) .tablist { display: none; }
html:not(.js) .audience-head { display: none; }
html:not(.js) [role="tabpanel"][hidden] { display: block; }

/* --------------------------------------------------------------------------
   3. Panels
   -------------------------------------------------------------------------- */
.tab-panel:focus-visible { outline: 2px solid var(--hot); outline-offset: -2px; }

.panel-context {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bone-dim);
  align-self: end;
}

/* situations sit close under the tabs */
.tab-panel > .situations { padding-top: var(--s9); }

/* ---- steps on a laser line ---- */
.approach { background: var(--ink-2); }
.approach .sec-head::before { background: var(--ink-4); }

.steps {
  position: relative;
  --rail: 16px;
}
/* laser segments run node to node, so the line stops at the last step */
.step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: calc(var(--rail) / 2 - .75px);
  top: 12px; bottom: -12px;
  width: 1.5px;
  background: var(--hot);
  box-shadow: 0 0 6px var(--hot), 0 0 14px rgba(200, 16, 46, .7);
  transform-origin: top;
  transition: transform .7s var(--ease-in-out);
  transition-delay: calc(300ms + var(--i, 0) * 260ms);
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 4fr) minmax(0, 7fr);
  column-gap: clamp(24px, 4vw, 72px);
  row-gap: var(--s5);
  padding-bottom: var(--s8);
}
.step:last-child { padding-bottom: 0; }
.step .node { grid-column: 1; margin-top: 4px; }

.step-head { grid-column: 2; }
.step-phase { color: var(--hot); letter-spacing: .14em; }
.step-title {
  margin-top: var(--s3);
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.5rem, 2.3vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--bone);
  text-wrap: balance;
}
.step-time {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--ink-4);
  color: var(--bone);
  letter-spacing: .08em;
}
.step-time-k { color: var(--mute); }

.step-body { grid-column: 3; }
.step-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: var(--s6);
}
.step-option-label {
  padding-bottom: var(--s3);
  color: var(--bone-dim);
}

.step-list { border-bottom: 1px solid var(--ink-3); }
.step-list li {
  position: relative;
  padding: 14px 0 14px 28px;
  border-top: 1px solid var(--ink-3);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--bone-dim);
}
.step-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: calc(14px + .78em);
  width: 14px; height: 1px;
  background: var(--hot);
  box-shadow: 0 0 6px var(--hot);
}

/* ---- examples bento ---- */
.ex-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--col-gap);
}
.ex-tile { display: flex; flex-direction: column; gap: var(--s5); }
.ex-tile--lead { grid-column: 1 / span 7; grid-row: span 2; justify-content: space-between; }
.ex-tile--side { grid-column: 8 / span 5; }
.ex-tile--wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  align-items: baseline;
}
.ex-tile--wide .ex-index { grid-column: 1 / span 1; }
.ex-tile--wide .ex-text { grid-column: 2 / span 9; }

.ex-index { color: var(--mute); transition: color var(--dur-2); }
.ex-tile:focus-within .ex-index { color: var(--hot); }
@media (hover: hover) {
  .ex-tile:hover .ex-index { color: var(--hot); }
}

.ex-text {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--bone-dim);
  max-width: var(--measure);
}
.ex-tile--lead .ex-text,
.ex-tile--wide .ex-text {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: clamp(1.2rem, 1.75vw, 1.6rem);
  line-height: 1.42;
  color: var(--bone);
  max-width: 40ch;
}
.ex-tile--wide .ex-text { max-width: 56ch; }
.ex-text strong { font-weight: 500; color: var(--bone); }
.ex-tile--lead .ex-text strong,
.ex-tile--wide .ex-text strong { font-weight: 400; color: #fffaf3; }
.ex-text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--hot);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-1) linear, color var(--dur-1) linear;
}
@media (hover: hover) {
  .ex-text a:hover { color: #fffaf3; text-decoration-color: var(--bone); }
}

/* ---- executives: lock-on note ---- */
.note-panel {
  position: relative;
  margin-top: var(--s8);
  padding: clamp(28px, 4vw, 56px);
  row-gap: var(--s5);
  align-items: start;
  background:
    radial-gradient(ellipse 60% 100% at 100% 0%, rgba(200, 16, 46, .12), transparent 70%),
    var(--ink-2);
  border: 1px solid var(--ink-3);
}
.note-panel .lock { inset: -1px; }
@media (hover: hover) {
  .note-panel:hover .lock i { transform: translate(var(--hx), var(--hy)); }
}
.note-head { grid-column: 1 / span 5; }
.note-kicker { display: flex; align-items: center; gap: 12px; color: var(--bone-dim); }
.note-kicker::before { content: ''; width: 28px; height: 1px; background: var(--hot); box-shadow: 0 0 6px var(--hot); }
.note-title {
  margin-top: var(--s4);
  font-family: var(--f-display);
  font-weight: 300;
  font-size: var(--t-h2-small);
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--bone);
  max-width: 16ch;
  text-wrap: balance;
}
.note-body {
  grid-column: 7 / span 6;
  font-size: var(--t-lede);
  line-height: 1.65;
  color: var(--bone-dim);
  max-width: 50ch;
}

/* ---- not-for-profits: sector notes ---- */
.diff { background: var(--ink-2); }
.diff .sec-head::before { background: var(--ink-4); }
.diff-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: var(--s7);
  align-items: start;
}
.diff-lead {
  position: relative;
  grid-column: 1 / span 5;
  padding: clamp(28px, 3.4vw, 48px);
  background:
    radial-gradient(ellipse 80% 80% at 0% 100%, rgba(200, 16, 46, .16), transparent 70%),
    var(--ink);
  border: 1px solid var(--ink-3);
}
.diff-lead .lock { inset: -1px; }
@media (hover: hover) {
  .diff-lead:hover .lock i { transform: translate(var(--hx), var(--hy)); }
}
.diff-glyph { margin-bottom: var(--s6); }
.diff-glyph circle { fill: var(--hot); }
.diff-glyph polygon { stroke-dashoffset: 0; fill: rgba(200, 16, 46, .2); }
.diff-lead .diff-title { font-size: clamp(1.75rem, 2.8vw, 2.5rem); }

.diff-list { grid-column: 7 / span 6; border-bottom: 1px solid var(--ink-4); }
.diff-item {
  display: grid;
  grid-template-columns: 4.5ch minmax(0, 1fr);
  column-gap: var(--s5);
  row-gap: var(--s3);
  padding-block: clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--ink-4);
}
.diff-num { grid-row: 1 / span 2; font: 400 .875rem/1.9 var(--f-mono); color: var(--hot); }
.diff-title {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: var(--t-h3);
  line-height: 1.25;
  color: var(--bone);
}
.diff-body {
  margin-top: var(--s3);
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--bone-dim);
  max-width: 52ch;
}
.diff-item .diff-body { margin-top: 0; }

/* ---- per-panel CTA strip ---- */
.panel-cta { background: var(--ink); padding-top: 0; }
/* the panel CTA closes whichever section precedes it */
.tab-panel > section:nth-last-child(2) { padding-bottom: var(--s8); }
.diff + .panel-cta { padding-top: var(--s8); }
.panel-cta-inner {
  position: relative;
  padding-top: var(--s6);
  row-gap: var(--s5);
  align-items: center;
}
.panel-cta-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--ink-3);
}
.panel-cta-inner::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: clamp(80px, 12vw, 180px);
  height: 1px;
  background: var(--hot);
  box-shadow: 0 0 10px var(--hot);
  transform-origin: right;
  transition: transform 1.1s .2s var(--ease-out);
}
.panel-cta-note {
  grid-column: 1 / span 7;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--bone);
  max-width: 34ch;
  text-wrap: balance;
}
.panel-cta-actions {
  grid-column: 8 / span 5;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
}
.panel-cta-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .95rem;
  cursor: pointer;
}

/* shared engagements section follows the panels */
.engage { background: var(--ink); border-top: 1px solid var(--ink-3); }

/* --------------------------------------------------------------------------
   4. Motion (default styles above are final; this only hides or animates)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .tab .lock i { transition: transform .6s var(--ease-out), opacity .4s var(--ease-out); }

  /* steps: line draws down, nodes light in sequence */
  .js .steps[data-reveal] { transform: none; }
  .js .steps[data-reveal]:not(.is-in) .step::before { transform: scaleY(0); }
  .js .steps[data-reveal]:not(.is-in) .node { opacity: .25; transform: scale(.5); }
  .js .steps .step > :not(.node) {
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
    transition-delay: calc(500ms + var(--i, 0) * 260ms);
  }
  .js .steps[data-reveal]:not(.is-in) .step > :not(.node) {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  .js .steps .node { transition-delay: calc(400ms + var(--i, 0) * 260ms); }

  .js .panel-cta-inner[data-reveal]:not(.is-in)::after { transform: scaleX(0); }
}

@media (prefers-reduced-motion: no-preference) {
  html.js:not(.reveal-armed) .steps[data-reveal]:not(.is-in) .step::before,
  html.js:not(.reveal-armed) .panel-cta-inner[data-reveal]:not(.is-in)::after { animation: failsafe-scale-y 0s 3.5s forwards; }
  html.js:not(.reveal-armed) .steps[data-reveal]:not(.is-in) .node,
  html.js:not(.reveal-armed) .steps[data-reveal]:not(.is-in) .step > :not(.node) { animation: failsafe-reveal 0s 3.5s forwards; }
}
@keyframes failsafe-scale-y { to { transform: none; } }

html.motion-paused .steps .step::before,
html.motion-paused .panel-cta-inner::after { transform: none !important; }
html.motion-paused .steps .node,
html.motion-paused .steps .step > :not(.node) { opacity: 1 !important; transform: none !important; }
html.motion-paused .ex-tile:focus-within .trail-run { opacity: .7; }
@media (hover: hover) {
  html.motion-paused .ex-tile:hover .trail-run { opacity: .7; }
}

/* --------------------------------------------------------------------------
   5. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .step { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .step-head, .step-body { grid-column: 2; }
  .step-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s6); align-items: end; }
  .step-phase { grid-column: 1 / -1; }
  .step-title { grid-column: 1; }
  .step-time { grid-column: 2; border-top: 0; padding-top: 0; margin-top: 0; }
  .note-head { grid-column: 1 / -1; }
  .note-body { grid-column: 1 / span 10; }
  .diff-lead { grid-column: 1 / span 6; }
  .diff-list { grid-column: 7 / span 6; }
  .panel-cta-note { grid-column: 1 / -1; }
  .panel-cta-actions { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 959px) {
  .tablist { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tab {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "num name glyph"
      "num sub  glyph";
    column-gap: var(--s5);
    row-gap: 6px;
    align-items: start;
  }
  .tab-num { padding-top: 6px; }
  .tab-name { margin-top: 0; font-size: clamp(1.5rem, 4.6vw, 2rem); }
  .tab-for { display: inline; margin: 0; font: inherit; letter-spacing: inherit; text-transform: none; color: inherit; }
  .tab[aria-selected="true"] .tab-for { color: inherit; }
  .tab-glyph { align-self: center; }

  .ex-grid { grid-template-columns: minmax(0, 1fr); }
  .ex-tile--lead, .ex-tile--side, .ex-tile--wide { grid-column: 1 / -1; grid-row: auto; }
  .ex-tile--wide { display: flex; }

  .note-body { grid-column: 1 / -1; }
  .diff-grid { grid-template-columns: minmax(0, 1fr); }
  .diff-lead, .diff-list { grid-column: 1 / -1; }
}

@media (max-width: 719px) {
  .step { column-gap: 20px; }
  .step-head { display: block; }
  .step-time { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--ink-4); }
  .step-options { grid-template-columns: minmax(0, 1fr); }
  .tab-sub { font-size: .9375rem; }
}

@media (max-width: 520px) {
  .tab { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "num name" "sub sub"; padding: 18px; }
  .tab-glyph { display: none; }
  .panel-cta-actions .btn { width: 100%; }
  .diff-item { grid-template-columns: minmax(0, 1fr); }
  .diff-num { grid-row: auto; }
}

/* --------------------------------------------------------------------------
   6. Reduced motion: final states (galaxy-system zeroes durations)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ex-tile:focus-within .trail-run { opacity: .7; }
  @media (hover: hover) {
    .ex-tile:hover .trail-run { opacity: .7; }
  }
}

/* --------------------------------------------------------------------------
   7. Forced colours
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
  .tab, .ex-tile, .note-panel, .diff-lead { border-color: CanvasText; }
  .tab[aria-selected="true"] { outline: 3px solid Highlight; outline-offset: -3px; }
  .step::before, .panel-cta-inner::before { background: CanvasText; forced-color-adjust: none; }
}

/* --------------------------------------------------------------------------
   8. Print: every panel, no tabs
   -------------------------------------------------------------------------- */
@media print {
  .page-hero-meta, .tablist, .audience-head { display: none !important; }
  [role="tabpanel"][hidden] { display: block !important; }
  .steps .step::before { transform: none !important; }
  .steps .step > *, .steps .node { opacity: 1 !important; transform: none !important; }
}
