/* Blackhole Cyberstrategy — shared interface patterns, linked on every page
   after the page's own styles. Pages keep their inline styles; these rules
   only add behavior on top, and everything degrades to the plain page. */

/* ---- Focus is never faded ---- */
/* A revealed unit (reveal.js, stage.js) that holds keyboard focus shows at
   once, without waiting for its fade-in or stagger (WCAG 2.4.7). */
html.js-reveal .rv:focus-within,
html.stage .rv:focus-within {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* ---- Closure: card rows become rails where the next card peeks in ---- */
@media (max-width: 920px) {
  [data-rail] {
    --rail-gap: 1rem;
    display: grid !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-auto-flow: column;
    /* Each card's width leaves 32% of the next card in view. */
    grid-auto-columns: calc((100% - var(--rail-gap)) / 1.32);
    gap: var(--rail-gap) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-bottom: 0.75rem;
  }
  [data-rail] > * { grid-row: auto !important; scroll-snap-align: start; }
  /* The level comparison is one framed table on wide screens; on a rail each
     level carries its own frame. */
  [data-rail="split"] { border: 0 !important; border-radius: 0 !important; }
  [data-rail="split"] > * {
    border: 1px solid color-mix(in oklch, oklch(0.3032 0.0583 245.79) 72%, transparent) !important;
    border-radius: 12px;
    overflow: hidden;
  }
}

/* ---- Figure-ground: what you point at stays lit, its siblings recede ---- */
@media (hover: hover) {
  [data-dim] > *,
  html.js-reveal [data-dim] > .rv,
  html.stage [data-dim] > .rv {
    transition:
      opacity 700ms ease var(--rv-delay, 0ms),
      transform 700ms ease var(--rv-delay, 0ms),
      filter 250ms ease;
  }
  /* Kept light on purpose: at brightness(0.9) the smallest text in a dimmed
     card still measures 4.7:1 or better (WCAG 1.4.3). Darker dimming fails.
     Off while the page scrolls (html.is-scrolling, set by smooth.js), so
     cards passing under a still pointer do not start filter transitions. */
  html:not(.is-scrolling) [data-dim]:has(> :hover, > :focus-within) > :not(:hover, :focus-within) {
    filter: brightness(0.9) saturate(0.7);
  }
}
/* The open mobile menu is the figure; the page behind it is ground. */
:has(> header) > :is(main, footer) { transition: filter 250ms ease; }
:has(> header details[open]) > :is(main, footer) { filter: brightness(0.4); }

/* ---- Connected steps ---- */
/* Home "Approach": the desktop row already has its line; narrow screens get
   a vertical line through the numbered nodes. */
@media (max-width: 920px) {
  ol.scp5 { grid-template-columns: minmax(0, 1fr) !important; row-gap: 0 !important; }
  ol.scp5 > li { padding: 0 0 2.2rem 4.6rem !important; }
  ol.scp5 > li > span:first-child { position: absolute !important; left: 0; top: 0; margin: 0 !important; }
  ol.scp5 > li:has(+ li)::after {
    content: "";
    position: absolute;
    left: 24px;
    top: 49px;
    bottom: 0;
    width: 1px;
    background: oklch(0.3032 0.0583 245.79);
  }
}
/* Timeline rows (Clarity Sprint "How it runs"). */
[data-step] { position: relative; padding-left: 1.9rem !important; }
[data-step]::before {
  content: "";
  position: absolute;
  left: 0;
  /* level with the "DAYS" label, which sits on the heading's baseline */
  top: calc(1.6rem + 0.85rem);
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border: 1px solid oklch(0.7461 0.1412 227.67);
  border-radius: 50%;
  background: oklch(0.1277 0.0108 259.64);
}
[data-step]:has(+ [data-step])::after {
  content: "";
  position: absolute;
  left: 4px;
  top: calc(1.6rem + 0.85rem + 9px);
  height: calc(100% - 8px);
  width: 1px;
  background: color-mix(in oklch, oklch(0.7461 0.1412 227.67) 45%, transparent);
}
@media (max-width: 920px) {
  /* Stacked rows: the label is the first line of the row. */
  [data-step]::before { top: calc(1.6rem + 0.3rem); }
  [data-step]:has(+ [data-step])::after { top: calc(1.6rem + 0.3rem + 9px); }
}
/* Numbered lists ("What happens"): a line runs from each number to the next. */
[data-steps] > li { position: relative; }
[data-steps] > li:has(+ li)::after {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.55rem;
  bottom: -0.75rem;
  width: 1px;
  background: color-mix(in oklch, oklch(0.7461 0.1412 227.67) 40%, transparent);
}

/* ---- Quiet calls to action (bottom strips) ---- */
.ui-quiet:hover,
.ui-quiet:focus-visible {
  border-color: oklch(0.8272 0.1032 222.15) !important;
  color: oklch(0.8272 0.1032 222.15) !important;
  background: color-mix(in oklch, oklch(0.7461 0.1412 227.67) 10%, transparent) !important;
}

/* ---- Site header and footer (scripts/build-chrome.mjs writes the markup) ---- */
/* The link for the page you are on stays at full strength. */
header a[aria-current="page"] { color: oklch(0.9834 0.0042 236.5) !important; }
@media (max-width: 920px) {
  .site-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 600px) {
  .site-footer-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
