/* ── Home type and text colour (hero, carousel and the sections after it) ──
   Inter (interface) and IBM Plex Mono (data and labels), as in the brand manual. Inter is the variable font with the
   optical-size axis: display sizes get the tighter display cut automatically. Weights 400/500/600/700 only.
   Text roles, from the official palette; every role passes WCAG AA on #050505:
   --tx-1 #F6F6F3 headings and primary text (18.8:1) · --tx-2 #DCDDD8 leads and body (14.9:1)
   --tx-3 secondary body (8.4:1) · --tx-4 meta, mono labels (6.1:1) · lime #C5FB05 accent only (16.7:1).
   Graphite #70716D is for lines and decoration, never for text. */
:root {
  --tx-1: #f6f6f3;
  --tx-2: #dcddd8;
  --tx-3: #a8a9a4;
  --tx-4: #8c8d88;
  --tx-accent: #c5fb05;
  --tx-red: #ff8aa1;
  --tx-amber: #fcd394;
}
.cosmo-opening,
.ai-hero,
.cosmo-home-sections {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
.cosmo-opening h1,
.cosmo-home-sections h2,
.ai-hero .slide-copy h2 {
  font-feature-settings: 'kern', 'calt';
}
.cosmo-home-sections :is(dd, .hpv-alerts, .hp-pilot span, .hp-tabs span),
.cosmo-opening .opening-phases span,
.ai-hero .hero-count {
  font-variant-numeric: tabular-nums;
}
.cosmo-home-sections p,
.cosmo-home-sections li,
.cosmo-opening .opening-lede {
  text-wrap: pretty;
}
/* Side menu of the hero: the bundle uses a synthetic 850 weight. */
.cosmo-drawer a {
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* Home opening (slide 00). It sits over the carousel slides and under its rail, cards and side menu
   (z-index 7–10 in the bundle CSS), with the same geometry as .ai-hero. home-opening.js syncs the height. */
.cosmo-opening {
  --op-left: 108px;
  --op-h: max(100svh, 760px);
  --lime: #c5fb05;
  --ink: #050505;
  --paper: #f6f6f3;
  --mist: #dcddd8;
  --graphite: #70716d;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.6, 0, 0.9, 0.35);
  /* In the page flow until bound to the carousel, so without JS the content after it stays reachable. */
  position: relative;
  z-index: 5;
  margin-left: var(--op-left);
  height: var(--op-h);
  overflow: hidden;
  color: var(--paper);
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(ellipse 46% 58% at 69% 40%, rgba(197, 251, 5, 0.075), transparent 62%),
    radial-gradient(ellipse 70% 70% at 18% 44%, #0b0c0b, transparent 70%),
    linear-gradient(180deg, #050505 0%, #070807 100%);
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.cosmo-opening::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(5, 5, 5, 0.92), transparent 26%);
}
.cosmo-opening.is-bound {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}
/* Exit: the copy leaves first so it never crosses the next slide's headline, then the scene. */
.cosmo-opening.is-leaving {
  opacity: 0;
  transition: opacity 0.45s var(--ease-in) 0.15s;
}
.cosmo-opening.is-leaving .opening-copy,
.cosmo-opening.is-leaving .opening-caption,
.cosmo-opening.is-leaving .opening-marks {
  opacity: 0;
  transition: opacity 0.2s var(--ease-in);
}
.cosmo-opening.is-hidden {
  visibility: hidden;
}
.cosmo-opening.is-entering {
  animation: opening-in 0.7s var(--ease-out) both;
}

/* Stage: the 3D scene. Desktop keeps it beside the copy so no line crosses the text. */
.opening-stage {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 34%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%);
  mask-image: linear-gradient(90deg, transparent, #000 16%);
}
.opening-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.9s var(--ease-out);
}
.cosmo-opening[data-scene='ready'] .opening-canvas {
  opacity: 1;
}
.opening-marks {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  bottom: 0;
  left: 34%;
  pointer-events: none;
}

/* Brand orbit shown without JS or WebGL; it hands over to the 3D core. */
.opening-emblem {
  position: absolute;
  top: 40%;
  left: 55%;
  width: min(34vw, 420px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: opacity 0.8s var(--ease-out);
}
.opening-emblem i,
.opening-emblem b {
  position: absolute;
  border-radius: 50%;
}
.opening-emblem i {
  inset: 0;
  border: 1px solid rgba(220, 221, 216, 0.2);
}
.opening-emblem i:nth-child(2) {
  inset: 17%;
  border-color: rgba(197, 251, 5, 0.55);
  border-right-color: transparent;
  transform: rotate(-30deg);
}
.opening-emblem i:nth-child(3) {
  inset: 34%;
  border: 2px solid var(--lime);
}
.opening-emblem b {
  inset: 45%;
  background: var(--lime);
  box-shadow: 0 0 40px rgba(197, 251, 5, 0.45);
}
.cosmo-opening[data-scene='ready'] .opening-emblem {
  opacity: 0;
}

/* Copy */
.opening-copy {
  position: absolute;
  z-index: 3;
  top: 46%;
  left: clamp(38px, 5.8vw, 100px);
  width: min(600px, 44vw);
  transform: translateY(-50%);
}
.opening-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--lime);
  font: 500 11px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.opening-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow:
    0 0 0 4px var(--ink),
    0 0 0 5px rgba(197, 251, 5, 0.6);
}
.cosmo-opening h1 {
  margin: 0 0 24px;
  color: var(--paper);
  font-size: clamp(40px, 3.85vw, 62px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.026em;
  text-wrap: balance;
}
.cosmo-opening h1 em {
  color: var(--lime);
  font-style: normal;
}
.opening-lede {
  max-width: 500px;
  margin: 0 0 32px;
  color: var(--mist);
  font-size: clamp(15px, 1.2vw, 17.5px);
  line-height: 1.6;
}
.opening-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 42px;
}
.opening-actions a {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 7px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 0.25s,
    border-color 0.25s,
    color 0.25s,
    transform 0.25s var(--ease-out);
}
.opening-cta {
  background: var(--lime);
  color: var(--ink);
}
.opening-cta svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s var(--ease-out);
}
.opening-cta:hover {
  background: #d4ff3a;
}
.opening-cta:hover svg {
  transform: translate(2px, -2px);
}
.opening-link {
  border: 1px solid rgba(246, 246, 243, 0.22);
  color: var(--paper);
}
.opening-link:hover {
  border-color: rgba(197, 251, 5, 0.6);
  color: var(--lime);
}
.opening-actions a:active {
  transform: translateY(1px);
}
.cosmo-opening :focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

/* Phases: the legend of the scene, in sync with it. */
.opening-phases {
  display: grid;
  max-width: 480px;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.opening-phases button {
  position: relative;
  display: grid;
  width: 100%;
  gap: 5px;
  border: 0;
  border-top: 1px solid rgba(246, 246, 243, 0.14);
  padding: 14px 0 0;
  background: none;
  color: var(--paper);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.opening-phases span {
  color: var(--tx-4);
  font: 500 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.16em;
  transition: color 0.3s;
}
.opening-phases strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.opening-phases small {
  color: var(--tx-3);
  font-size: 12px;
  line-height: 1.45;
}
.opening-phases i {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--lime);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.opening-phases button[aria-pressed='true'] span,
.opening-phases button:hover span {
  color: var(--lime);
}

.opening-caption {
  position: absolute;
  z-index: 3;
  top: 32px;
  right: 30px;
  padding: 8px 12px;
  border: 1px solid #ffffff30;
  border-radius: 4px;
  background: #06110db8;
  color: var(--tx-1);
  font: 500 10px/1.5 'IBM Plex Mono', monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Operation feeds (anchored to the 3D panels) and the systems that receive the result. */
.opening-feed {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
}
.opening-feed-label {
  position: absolute;
  bottom: 100%;
  left: 0;
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
  white-space: nowrap;
  font: 500 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s;
}
.opening-feed-label b {
  font-weight: 500;
}
.opening-feed-label em {
  color: var(--tx-3);
  font-style: normal;
}
.opening-feed-go {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border-radius: 4px;
  padding: 6px 9px;
  background: var(--lime);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s,
    transform 0.25s var(--ease-out);
}
.opening-feed:hover .opening-feed-label,
.opening-feed:focus-visible .opening-feed-label,
.opening-feed.is-linked .opening-feed-label {
  color: var(--lime);
}
.opening-feed:hover .opening-feed-go,
.opening-feed:focus-visible .opening-feed-go,
.opening-feed.is-linked .opening-feed-go {
  opacity: 1;
  transform: none;
}
.opening-feed img {
  display: none;
}
/* A system node: the anchor is the top centre of its tile. */
.opening-output {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 104px;
  text-align: center;
  white-space: nowrap;
  will-change: transform;
}
.opening-output svg {
  box-sizing: content-box;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(246, 246, 243, 0.16);
  border-radius: 8px;
  padding: 9px;
  background: rgba(10, 12, 10, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  fill: none;
  stroke: var(--mist);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    stroke 0.4s,
    border-color 0.4s,
    box-shadow 0.4s;
}
.opening-output span {
  display: grid;
  gap: 4px;
}
.opening-output small {
  color: var(--tx-4);
  font: 500 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 0.4s;
}
.opening-output strong {
  color: var(--tx-3);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.4s;
}
.opening-marks.is-compact .opening-output strong {
  display: none;
}
.opening-output.is-on svg {
  border-color: rgba(197, 251, 5, 0.65);
  box-shadow: 0 0 22px rgba(197, 251, 5, 0.18);
  stroke: var(--lime);
}
.opening-output.is-on small {
  color: var(--lime);
}
.opening-output.is-on strong {
  color: var(--paper);
}

/* Static composition without WebGL: the same feeds as photographs. */
.cosmo-opening[data-scene='fallback'] .opening-marks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  align-content: center;
  justify-content: end;
  gap: 34px 16px;
  padding: 0 6% 200px 0;
}
.cosmo-opening[data-scene='fallback'] .opening-feed {
  position: relative;
  transform: none !important;
  width: auto !important;
  height: auto !important;
}
.cosmo-opening[data-scene='fallback'] .opening-feed img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(246, 246, 243, 0.16);
  border-radius: 6px;
  object-fit: cover;
  filter: saturate(0.7) brightness(0.8);
}
.cosmo-opening[data-scene='fallback'] .opening-output,
.cosmo-opening[data-scene='fallback'] .opening-emblem {
  display: none;
}

/* Carousel while the opening covers it: no active card, its own counter. */
.ai-hero[data-hold] .hero-cards button.is-active {
  border-color: #ffffff26;
  box-shadow: none;
  transform: scale(0.95);
}
.ai-hero[data-hold] .hero-cards button.is-active i {
  animation: none;
}
.ai-hero[data-hold] .hero-count {
  font-size: 0;
}
.ai-hero[data-hold] .hero-count::before {
  content: attr(data-opening-label);
  font-size: 11px;
}
.ai-hero[data-hold] .hero-cards button[data-linked] {
  border-color: rgba(197, 251, 5, 0.7);
  opacity: 1;
  transform: scale(1);
}

/* Other routes of the single-page app reuse this index.html: keep only the heading, visually hidden. */
.route-app .cosmo-opening {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  visibility: hidden;
}
.route-app .cosmo-opening h1 {
  visibility: visible;
}

/* Entrance of the static copy, played on first paint. */
.cosmo-opening[data-intro] .opening-copy > *,
.cosmo-opening.is-entering .opening-copy > * {
  animation: opening-rise 0.9s var(--ease-out) both;
}
.cosmo-opening .opening-copy > :nth-child(2) {
  animation-delay: 0.08s;
}
.cosmo-opening .opening-copy > :nth-child(3) {
  animation-delay: 0.18s;
}
.cosmo-opening .opening-copy > :nth-child(4) {
  animation-delay: 0.28s;
}
.cosmo-opening .opening-copy > :nth-child(5) {
  animation-delay: 0.4s;
}
@keyframes opening-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
@keyframes opening-in {
  from {
    opacity: 0;
  }
}

@media (max-width: 1100px) and (min-width: 901px) {
  .opening-copy {
    left: 36px;
    width: 46vw;
  }
  .cosmo-opening h1 {
    font-size: 40px;
  }
  .opening-phases small {
    display: none;
  }
  .opening-stage,
  .opening-marks {
    left: 38%;
  }
}

/* Short desktop windows: the copy must clear the rail (arrows ~170–214px from the bottom). */
@media (min-width: 901px) and (max-height: 820px) {
  .opening-copy {
    top: 43%;
  }
  .cosmo-opening h1 {
    font-size: clamp(38px, 3.4vw, 52px);
    margin-bottom: 18px;
  }
  .opening-lede {
    margin-bottom: 24px;
  }
  .opening-actions {
    margin-bottom: 28px;
  }
  .opening-phases small {
    display: none;
  }
}

@media (max-width: 900px) {
  .cosmo-opening {
    --op-left: 74px;
    --op-h: max(100svh, 840px);
    /* Copy right above the carousel rail (its arrows end 172px from the bottom); the scene takes the rest. */
    display: flex;
    flex-direction: column;
    padding-bottom: 190px;
    background:
      radial-gradient(ellipse 80% 34% at 50% 18%, rgba(197, 251, 5, 0.08), transparent 70%),
      linear-gradient(180deg, #050505 0%, #070807 100%);
  }
  .opening-stage {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 220px;
    -webkit-mask-image: linear-gradient(0deg, transparent, #000 14%);
    mask-image: linear-gradient(0deg, transparent, #000 14%);
  }
  .opening-marks {
    left: 0;
    bottom: auto;
    height: var(--stage-px, 40%);
  }
  .opening-emblem {
    top: 50%;
    left: 50%;
    width: min(58vw, 260px);
  }
  .opening-copy {
    position: relative;
    top: auto;
    left: auto;
    display: flex;
    flex-direction: column;
    width: auto;
    padding: 0 28px;
    transform: none;
  }
  .opening-eyebrow {
    margin-bottom: 14px;
    font-size: 10px;
  }
  .cosmo-opening h1 {
    max-width: 560px;
    margin-bottom: 14px;
    font-size: clamp(30px, 5.4vw, 42px);
    line-height: 1.06;
  }
  .opening-lede {
    max-width: 500px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.55;
  }
  .opening-actions {
    margin-bottom: 0;
  }
  .opening-actions a {
    min-height: 48px;
    padding: 0 20px;
    font-size: 13px;
  }
  /* The legend becomes a ticker at the foot of the scene. */
  .opening-phases {
    order: -1;
    max-width: none;
    gap: 12px;
    margin: -40px 0 22px;
  }
  .opening-phases button {
    padding-top: 10px;
  }
  .opening-phases strong {
    font-size: 12px;
  }
  .opening-phases small,
  .opening-output {
    display: none;
  }
  .opening-caption {
    top: 16px;
    right: 16px;
    padding: 6px 8px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  .opening-feed-label {
    font-size: 9.5px;
    margin-bottom: 5px;
  }
  .opening-feed-label em,
  .opening-feed-go {
    display: none;
  }
  .cosmo-opening[data-scene='fallback'] .opening-marks {
    grid-template-columns: repeat(2, minmax(0, 150px));
    gap: 26px 12px;
    padding: 30px 20px 60px;
  }
}

@media (max-width: 560px) {
  .cosmo-opening {
    --op-left: 58px;
    --op-h: max(100svh, 820px);
  }
  .opening-stage {
    margin-top: 30px;
  }
  .opening-copy {
    padding: 0 18px 0 20px;
  }
  .cosmo-opening h1 {
    font-size: clamp(28px, 7.9vw, 32px);
  }
  .opening-lede {
    font-size: 14.5px;
  }
  .opening-actions {
    gap: 10px;
  }
  .opening-actions a {
    flex: 1 1 auto;
    padding: 0 16px;
  }
  .opening-phases {
    gap: 10px;
  }
  .opening-phases span {
    font-size: 10px;
  }
}

/* Small phones: the sector cards right below already lead to the solutions. */
@media (max-width: 379px) {
  .opening-link {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cosmo-opening *,
  .cosmo-opening {
    animation: none !important;
    transition: none !important;
  }
}
