.company-story {
  --story-line: color-mix(in srgb, var(--brand-cyan) 28%, var(--border-subtle));
  --story-active: color-mix(in srgb, var(--brand-cyan) 82%, var(--text-primary));
  position: relative;
  overflow: clip;
  border-block: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 15% 24%, rgba(41, 211, 255, .055), transparent 28%),
    radial-gradient(circle at 88% 64%, rgba(132, 104, 255, .045), transparent 30%),
    var(--page-bg);
}

html[data-theme="light"] .company-story {
  --story-line: color-mix(in srgb, var(--brand-blue) 24%, var(--border-subtle));
  --story-active: color-mix(in srgb, var(--brand-blue) 82%, var(--text-primary));
  background:
    radial-gradient(circle at 15% 24%, rgba(41, 211, 255, .08), transparent 30%),
    radial-gradient(circle at 88% 64%, rgba(83, 109, 255, .055), transparent 32%),
    var(--surface-1);
}

.company-story::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: .55;
}

.company-story-header {
  position: relative;
  z-index: 1;
  padding: clamp(7rem, 12vw, 12rem) 0 clamp(5rem, 8vw, 8rem);
  border-bottom: 1px solid var(--border-subtle);
}

.company-story-header h2 { max-width: 980px; }
.company-story-header .lead { margin-top: 2rem; }

.story-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(340px, .86fr) minmax(0, 1.14fr);
  gap: clamp(4rem, 8vw, 9rem);
  align-items: start;
}

.story-visual {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  align-self: start;
  height: calc(100vh - var(--nav-height) - 3rem);
  min-height: 610px;
  max-height: 780px;
  padding-block: 2rem;
}

.story-visual-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-elevated) 88%, transparent);
}

.story-visual-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.story-visual-heading [data-story-label] { color: var(--story-active); }
.origin-map-wrap { position: relative; min-height: 0; }
.origin-map { width: 100%; height: 100%; min-height: 390px; }
.origin-map g { transition: opacity 1s ease; }
.origin-map path, .origin-map circle { vector-effect: non-scaling-stroke; }
.map-grid { fill: none; stroke: var(--grid-line); stroke-width: 1; opacity: .8; }
.map-fragments, .map-connectors, .map-formation, .map-products, .map-team, .map-direction { fill: none; stroke: var(--story-line); stroke-width: 1.2; }
.map-fragments circle, .map-products circle, .map-team circle { fill: var(--page-bg); stroke: var(--story-active); }
.map-connectors path, .map-formation path, .map-products path, .map-team path, .map-direction path {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  transition: stroke-dashoffset 1.35s cubic-bezier(.2, .7, .2, 1), opacity .8s ease;
}
.map-fragments { opacity: .34; }
.map-connectors, .map-formation, .map-products, .map-team, .map-direction { opacity: .07; }

.origin-map-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  transform: translate(-50%, -50%);
}
.origin-map-mark img { width: 54px; height: auto; }

html[data-story-state="foundation"] .map-fragments,
html[data-story-state="build"] .map-fragments,
html[data-story-state="formation"] .map-fragments,
html[data-story-state="products"] .map-fragments,
html[data-story-state="team"] .map-fragments,
html[data-story-state="direction"] .map-fragments { opacity: 1; }

html[data-story-state="build"] .map-connectors,
html[data-story-state="formation"] .map-connectors,
html[data-story-state="products"] .map-connectors,
html[data-story-state="team"] .map-connectors,
html[data-story-state="direction"] .map-connectors,
html[data-story-state="formation"] .map-formation,
html[data-story-state="products"] .map-formation,
html[data-story-state="team"] .map-formation,
html[data-story-state="direction"] .map-formation,
html[data-story-state="products"] .map-products,
html[data-story-state="team"] .map-products,
html[data-story-state="direction"] .map-products,
html[data-story-state="team"] .map-team,
html[data-story-state="direction"] .map-team,
html[data-story-state="direction"] .map-direction { opacity: 1; }

html[data-story-state="build"] .map-connectors path,
html[data-story-state="formation"] .map-connectors path,
html[data-story-state="products"] .map-connectors path,
html[data-story-state="team"] .map-connectors path,
html[data-story-state="direction"] .map-connectors path,
html[data-story-state="formation"] .map-formation path,
html[data-story-state="products"] .map-formation path,
html[data-story-state="team"] .map-formation path,
html[data-story-state="direction"] .map-formation path,
html[data-story-state="products"] .map-products path,
html[data-story-state="team"] .map-products path,
html[data-story-state="direction"] .map-products path,
html[data-story-state="team"] .map-team path,
html[data-story-state="direction"] .map-team path,
html[data-story-state="direction"] .map-direction path { stroke-dashoffset: 0; }

.story-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.story-rail a {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--text-muted);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .35s ease;
}

.story-rail a span {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition: background .35s ease, box-shadow .35s ease;
}

.story-rail a.is-active { color: var(--story-active); }
.story-rail a.is-active span { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-cyan) 14%, transparent); }

.story-content { min-width: 0; }
.story-chapter {
  position: relative;
  display: flex;
  min-height: 72vh;
  max-width: 760px;
  flex-direction: column;
  justify-content: center;
  padding: clamp(6rem, 10vw, 9rem) 0;
  border-bottom: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--nav-height) + 2rem);
}
.story-chapter-wide { max-width: 880px; }
.story-chapter h3 { max-width: 760px; font-size: clamp(2rem, 3.4vw, 3.8rem); }
.story-chapter > .lead { margin-top: 2rem; color: var(--text-primary); }
.story-chapter > p:not(.lead), .story-chapter blockquote { max-width: 700px; margin-top: 1.35rem; }
.story-enhanced .story-chapter { opacity: .44; transform: translateY(16px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.story-enhanced .story-chapter.is-active { opacity: 1; transform: none; }
.story-mobile-marker { display: none; }

.story-fragment-list, .story-cadence {
  display: grid;
  gap: .55rem;
  max-width: 700px;
  margin-top: 2rem;
  padding: 1.4rem 0 1.4rem 1.4rem;
  border-left: 1px solid var(--story-line);
}
.story-fragment-list p, .story-cadence p { color: var(--text-primary); }

.story-chapter blockquote {
  padding: 1.4rem 0 1.4rem 1.5rem;
  border-left: 2px solid var(--brand-cyan);
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.4;
}

.story-statement {
  margin-block: 2rem .5rem !important;
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.8rem, 3vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -.03em;
}

.product-origin-system {
  position: relative;
  display: grid;
  grid-template-columns: 1fr .78fr 1fr;
  grid-template-rows: auto 92px auto;
  gap: 1rem 1.5rem;
  align-items: center;
  min-height: 390px;
  margin-top: 3rem;
  padding: 2.25rem;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-1) 70%, transparent);
}
.product-origin-system::before, .product-origin-system::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--story-line);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.product-origin-system::before { width: calc(100% - 7rem); height: 1px; }
.product-origin-system::after { width: 1px; height: calc(100% - 6rem); }
.product-origin-center {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid color-mix(in srgb, var(--brand-cyan) 55%, var(--border-subtle));
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: .8rem;
  letter-spacing: .16em;
}
.product-origin-node {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: .86rem;
  line-height: 1.35;
  transition: border-color .3s ease, color .3s ease, transform .3s ease;
}
.product-origin-node:hover, .product-origin-node:focus-visible { border-color: var(--brand-cyan); color: var(--text-primary); transform: translateY(-3px); }
.product-origin-uigw { grid-column: 2; grid-row: 1; }
.product-origin-licensing { grid-column: 3; grid-row: 2; }
.product-origin-passlyra { grid-column: 2; grid-row: 3; }
.product-origin-soc { grid-column: 1; grid-row: 2; }

.product-story-copy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 3rem;
}
.product-story-copy p { padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.product-story-copy strong { display: block; margin-bottom: .45rem; color: var(--text-primary); font-weight: 600; }

.team-constellation {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  padding: 3rem;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--surface-1) 72%, transparent);
}
.team-constellation::before, .team-constellation::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--story-line);
  transform: translate(-50%, -50%);
}
.team-constellation::before { width: calc(100% - 5rem); height: 1px; }
.team-constellation::after { width: 1px; height: calc(100% - 5rem); }
.team-center {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 94px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--brand-cyan);
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: .7rem;
  letter-spacing: .14em;
  transform: translate(-50%, -50%);
}
.team-cluster {
  position: relative;
  z-index: 2;
  min-height: 170px;
  padding: 1.35rem;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  transition: border-color .3s ease, transform .3s ease;
}
.team-cluster:hover, .team-cluster:focus-within { border-color: color-mix(in srgb, var(--brand-cyan) 65%, var(--border-subtle)); transform: translateY(-3px); }
.team-cluster summary { color: var(--text-primary); font-family: "Space Grotesk", sans-serif; font-size: .9rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.team-cluster summary::marker { color: var(--brand-cyan); }
.team-cluster ul { margin: 1rem 0 0; padding-left: 1.1rem; color: var(--text-secondary); font-size: .83rem; line-height: 1.75; }
.team-security, .team-engineering { margin-bottom: 2rem; }
.team-strategy, .team-operations { margin-top: 2rem; }

.team-message { margin-top: 4rem; padding-left: 2rem; border-left: 2px solid var(--brand-cyan); }
.team-message h4 { margin-bottom: 1.5rem; font-size: clamp(1.8rem, 3vw, 3rem); }
.team-message p + p { margin-top: 1rem; }

.direction-principle { display: grid; gap: .7rem; margin: 2rem 0; }
.direction-principle span { color: var(--text-primary); font-family: "Space Grotesk", sans-serif; font-size: clamp(1.4rem, 2.4vw, 2.4rem); line-height: 1.25; }

.story-closing {
  position: relative;
  z-index: 1;
  padding: clamp(8rem, 14vw, 14rem) 0;
  overflow: hidden;
  background: var(--surface-1);
}
.story-closing::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 75% 45%, rgba(41, 211, 255, .08), transparent 26%), radial-gradient(circle at 68% 55%, rgba(132, 104, 255, .07), transparent 34%);
}
.story-closing .container-erebrix { position: relative; }
.story-closing h2 { max-width: 1100px; font-size: clamp(2.7rem, 6vw, 6.7rem); }
.story-closing .lead { max-width: 780px; margin-top: 2rem; }
.story-closing-line { width: min(420px, 55vw); height: 1px; margin-bottom: 4rem; background: var(--erebrix-spectrum); }

@media (max-width: 1199.98px) {
  .story-layout { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.22fr); gap: 4rem; }
  .story-rail { grid-template-columns: repeat(2, 1fr); }
  .product-origin-system { padding-inline: 1.5rem; }
  .team-constellation { padding: 2rem; }
}

@media (min-width: 768px) {
  .team-cluster ul { opacity: .52; transform: translateY(5px); transition: opacity .35s ease, transform .35s ease; }
  .team-cluster:hover ul, .team-cluster:focus-within ul { opacity: 1; transform: none; }
}

@media (max-width: 1023.98px) {
  .story-layout { display: block; }
  .story-visual { position: relative; top: auto; height: auto; min-height: 0; max-height: none; padding: 3rem 0 1rem; }
  .story-visual-panel { height: auto; }
  .origin-map-wrap { height: min(58vw, 480px); }
  .origin-map { min-height: 0; }
  .story-rail { grid-template-columns: repeat(6, max-content); overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
  .story-content { position: relative; padding-left: 2.25rem; }
  .story-content::before { content: ""; position: absolute; top: 5rem; bottom: 5rem; left: 5px; width: 1px; background: linear-gradient(var(--story-line), var(--brand-cyan), var(--story-line)); }
  .story-chapter { min-height: auto; max-width: none; padding: 6rem 0; }
  .story-mobile-marker { display: block; position: absolute; top: 6.5rem; left: -2.5rem; width: 11px; height: 11px; border: 1px solid var(--story-active); border-radius: 50%; background: var(--page-bg); transition: background .4s ease, box-shadow .4s ease; }
  .story-chapter.is-active .story-mobile-marker { background: var(--brand-cyan); box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-cyan) 12%, transparent); }
}

@media (max-width: 767.98px) {
  .page-hero h1 { font-size: clamp(2.45rem, 11.5vw, 3.25rem); overflow-wrap: break-word; }
  .company-story-header { padding-block: 6.5rem 5rem; }
  .story-visual { padding-top: 2rem; }
  .story-visual-panel { padding: 1rem; }
  .story-visual-heading { font-size: .58rem; }
  .origin-map-wrap { height: 330px; }
  .story-rail { grid-template-columns: repeat(3, max-content); gap: .7rem 1.25rem; }
  .story-content { padding-left: 1.75rem; }
  .story-content::before { left: 4px; }
  .story-mobile-marker { left: -2rem; }
  .story-chapter { padding: 5rem 0; }
  .story-chapter h3 { font-size: clamp(2rem, 9vw, 3rem); }
  .product-origin-system { display: flex; min-height: 0; flex-direction: column; align-items: stretch; padding: 1.25rem; }
  .product-origin-system::before { top: 2rem; bottom: 2rem; left: 50%; width: 1px; height: auto; transform: translateX(-50%); }
  .product-origin-system::after { display: none; }
  .product-origin-center, .product-origin-node { width: 100%; min-height: 64px; }
  .product-origin-center { order: -1; }
  .product-story-copy { grid-template-columns: 1fr; gap: 1rem; }
  .team-constellation { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; }
  .team-constellation::before { top: 2rem; bottom: 2rem; left: 50%; width: 1px; height: auto; transform: translateX(-50%); }
  .team-constellation::after { display: none; }
  .team-center { position: relative; top: auto; left: auto; width: 100%; height: 54px; transform: none; }
  .team-cluster { width: 100%; min-height: 0; margin: 0; }
  .team-message { margin-top: 3rem; padding-left: 1.25rem; }
  .story-closing { padding-block: 8rem; }
  .story-closing h2 br { display: none; }
}

@media (max-width: 430px) {
  .origin-map-wrap { height: 280px; }
  .origin-map-mark, .origin-map-mark img { width: 44px; }
  .story-rail a { font-size: .62rem; }
  .story-content { padding-left: 1.5rem; }
  .story-mobile-marker { left: -1.75rem; }
  .story-fragment-list, .story-cadence { padding-left: 1rem; }
  .product-origin-system, .team-constellation { margin-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .story-visual { position: relative; top: auto; }
  .story-enhanced .story-chapter { opacity: 1; transform: none; }
  .origin-map g { opacity: 1 !important; transition: none !important; }
  .origin-map path { stroke-dashoffset: 0 !important; transition: none !important; }
  .product-origin-node:hover, .product-origin-node:focus-visible, .team-cluster:hover, .team-cluster:focus-within { transform: none; }
  .team-cluster ul { opacity: 1; transform: none; }
}
