/*
 * Homepage layout redesign: lightweight Hero capabilities + simultaneous flagship grid.
 * This file intentionally loads last so the retired diagram/tab presentation cannot leak through.
 */

.hero-capability-stage {
  --pipe-line: color-mix(in srgb, var(--v2-black) 42%, transparent);
  --pipe-muted: color-mix(in srgb, var(--v2-black) 18%, transparent);
  --stage-height: clamp(340px, 27vw, 370px);
  --node-fill: #999991;
  width: min(100%, 580px);
  height: var(--stage-height);
  min-height: 340px;
  align-self: center;
  justify-self: end;
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  isolation: isolate;
  animation: hero-stage-arrive 620ms cubic-bezier(.22, .8, .28, 1) 80ms backwards;
}
.hero-capability-stage::before,
.hero-capability-stage::after {
  content: "";
  position: absolute;
  width: 22%;
  height: 24px;
  border-color: var(--pipe-muted);
  border-style: solid;
  pointer-events: none;
}
.hero-capability-stage::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.hero-capability-stage::after { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

.hero-capability-list {
  position: absolute;
  inset: 0;
}

.hero-capability-line {
  display: block;
  position: absolute;
  z-index: 0;
  top: 16%;
  left: 2%;
  width: 94%;
  height: 1px;
  background: var(--pipe-line);
  pointer-events: none;
  transform-origin: left center;
  animation: hero-pipe-reveal 720ms cubic-bezier(.22, .8, .28, 1) 180ms backwards;
  transition: background-color 180ms ease, opacity 180ms ease;
}

.hero-capability-line::before,
.hero-capability-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 9px;
  height: 9px;
}

.hero-capability-line::before {
  left: -1px;
  background: var(--v2-orange);
  animation: hero-node-pop 420ms cubic-bezier(.22, .8, .28, 1) 140ms backwards;
}

.hero-capability-line::after {
  right: -4px;
  border: 1px solid var(--node-fill);
  background: var(--node-fill);
  animation: hero-node-pop 420ms cubic-bezier(.22, .8, .28, 1) 660ms backwards;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.hero-capability-list::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 16%;
  left: 41%;
  width: 9%;
  height: 36%;
  border-right: 1px solid var(--pipe-line);
  border-bottom: 1px solid var(--pipe-line);
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  animation: hero-branch-reveal 620ms cubic-bezier(.22, .8, .28, 1) 360ms forwards;
  transition: border-color 180ms ease, opacity 180ms ease;
}

.hero-capability-list::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 16%;
  left: 50%;
  width: 9%;
  height: 63%;
  border-left: 1px solid var(--pipe-line);
  border-bottom: 1px solid var(--pipe-line);
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  animation: hero-branch-reveal 700ms cubic-bezier(.22, .8, .28, 1) 430ms forwards;
  transition: border-color 180ms ease, opacity 180ms ease;
}

.hero-capability {
  position: absolute;
  z-index: 1;
  min-height: 0;
  padding: 14px 8px 10px 16px;
  border: 0;
  border-top: 1px solid var(--pipe-muted);
  background: transparent;
  box-shadow: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease, transform 180ms ease;
  animation: hero-station-arrive 620ms cubic-bezier(.22, .8, .28, 1) backwards;
}

.hero-capability:nth-child(1) { top: 24%; right: 2%; width: 35%; animation-delay: 300ms; }
.hero-capability:nth-child(2) { top: calc(52% - 24px); left: 7%; width: 34%; padding-left: 0; padding-right: 18px; animation-delay: 440ms; }
.hero-capability:nth-child(3) { top: calc(79% - 24px); right: 0; width: 41%; padding-left: 20px; animation-delay: 580ms; }

.hero-capability::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: calc(var(--stage-height) * -.08 - 1px);
  left: 18px;
  width: 1px;
  height: calc(var(--stage-height) * .08);
  background: var(--pipe-line);
  pointer-events: none;
  transition: background-color 180ms ease, opacity 180ms ease;
}

.hero-capability::after {
  content: "";
  position: absolute;
  top: calc(var(--stage-height) * -.08 - 4px);
  left: 14.5px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--node-fill);
  background: var(--node-fill);
  pointer-events: none;
  animation: hero-node-pop 360ms cubic-bezier(.22, .8, .28, 1) backwards;
  transition: border-color 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.hero-capability:nth-child(1)::after { animation-delay: 610ms; }
.hero-capability:nth-child(2)::after { animation-delay: 760ms; }
.hero-capability:nth-child(3)::after { animation-delay: 900ms; }

.hero-capability:nth-child(2)::before {
  top: 23px;
  left: auto;
  right: 0;
  width: 12px;
  height: 1px;
}

.hero-capability:nth-child(2)::after {
  top: 20px;
  left: auto;
  right: -4px;
}

.hero-capability:nth-child(3)::before { top: 23px; left: 0; width: 12px; height: 1px; }
.hero-capability:nth-child(3)::after { top: 20px; left: -4px; }

.hero-capability-index {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--v2-gray);
  font: 700 .55rem/1 var(--v2-mono);
  letter-spacing: .1em;
}

.hero-capability-index i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--v2-black) 42%, transparent);
}

.hero-capability > div {
  min-width: 0;
  margin-top: 9px;
}

.hero-capability h2 {
  margin: 0;
  font-size: clamp(.98rem, 1.15vw, 1.18rem);
  line-height: 1.25;
  letter-spacing: -.025em;
}

.hero-capability p {
  max-width: 28em;
  margin: 6px 0 0;
  color: var(--v2-gray);
  font-size: clamp(.72rem, .78vw, .82rem);
  line-height: 1.48;
}

.hero-capability:hover,
.hero-capability:focus-visible {
  border-color: var(--v2-orange);
  --node-fill: var(--v2-orange);
  box-shadow: none;
  outline: 0;
  transform: none;
}

.hero-capability:hover::after,
.hero-capability:focus-visible::after {
  border-color: var(--v2-orange);
  background: var(--v2-orange);
}

.hero-capability:hover::before,
.hero-capability:focus-visible::before {
  background: var(--v2-orange);
}

.hero-capability-stage:has(.hero-capability:hover, .hero-capability:focus-visible) .hero-capability-line {
  background: var(--v2-orange);
}

.hero-capability-list:has(.hero-capability:nth-child(2):hover, .hero-capability:nth-child(2):focus-visible)::before,
.hero-capability-list:has(.hero-capability:nth-child(3):hover, .hero-capability:nth-child(3):focus-visible)::after {
  border-color: var(--v2-orange);
}

.hero-capability-list:has(.hero-capability:hover, .hero-capability:focus-visible) .hero-capability:not(:hover):not(:focus-visible) {
  opacity: .58;
}

@keyframes hero-stage-arrive {
  from { opacity: 0; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes hero-pipe-reveal {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes hero-branch-reveal {
  from { opacity: 0; clip-path: inset(0 0 100% 0); }
  to { opacity: 1; clip-path: inset(0); }
}

@keyframes hero-node-pop {
  from { opacity: 0; transform: scale(.35); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes hero-station-arrive {
  from { opacity: 0; translate: 0 9px; }
  to { opacity: 1; translate: 0 0; }
}

.work-section .section-heading { margin-bottom: clamp(36px, 4vw, 54px); }

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.5vw, 22px);
  align-items: stretch;
}

.portfolio-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #55554f;
  background: #1d1d1a;
  color: #f4f3ed;
  transition: border-color 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.portfolio-card:hover,
.portfolio-card:focus-within {
  border-color: var(--v2-orange);
  background: #23231f;
  transform: translateY(-4px);
}

.portfolio-card[data-highlight="true"] {
  border-color: var(--v2-orange);
  box-shadow: 0 0 0 1px var(--v2-orange);
}

.portfolio-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: block;
  padding: clamp(8px, 1vw, 14px);
  border-bottom: 1px solid #55554f;
  background: #282824;
  overflow: hidden;
}

.portfolio-cover::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 4px;
  background: var(--v2-orange);
  opacity: .72;
  transition: width 160ms ease;
}

.portfolio-card:hover .portfolio-cover::after,
.portfolio-card:focus-within .portfolio-cover::after { width: 44px; }

.portfolio-cover img {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid #4b4b46;
  background: #11110f;
  object-fit: contain;
  object-position: center;
  transition: filter 160ms ease;
}

.portfolio-card:hover .portfolio-cover img,
.portfolio-card:focus-within .portfolio-cover img { filter: brightness(1.04); }

.portfolio-card-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 2.3vw, 32px);
}

.portfolio-category {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: #aaa9a3;
  font: 700 .64rem/1.3 var(--v2-mono);
  letter-spacing: .09em;
}

.portfolio-category span {
  color: var(--v2-orange);
  font: inherit;
}

.portfolio-card h3 {
  margin: 0;
  font-size: clamp(1.3rem, 1.55vw, 1.72rem);
  line-height: 1.2;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.portfolio-card h3 a { color: inherit; }

.portfolio-summary {
  margin: 16px 0 28px;
  color: #c5c4be;
  font-size: clamp(.84rem, .9vw, .94rem);
  line-height: 1.7;
}

.portfolio-cta {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  border-bottom: 1px solid #6d6d66;
  color: #f4f3ed;
  font-size: .82rem;
  font-weight: 700;
}

.portfolio-cta span {
  color: var(--v2-orange);
  transition: transform 160ms ease;
}

.portfolio-cta:hover span,
.portfolio-cta:focus-visible span { transform: translateX(4px); }

.portfolio-cover:focus-visible,
.portfolio-card h3 a:focus-visible,
.portfolio-cta:focus-visible {
  outline: 3px solid var(--v2-orange);
  outline-offset: 3px;
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability-stage.hero-capability-stage {
  --pipe-line: color-mix(in srgb, var(--dark-primary-text) 38%, transparent);
  --pipe-muted: color-mix(in srgb, var(--dark-primary-text) 16%, transparent);
  --node-fill: #83837d;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability {
  border-color: var(--pipe-muted);
  background: transparent;
  box-shadow: none;
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability:hover,
html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability:focus-visible {
  border-color: var(--v2-orange);
  box-shadow: none;
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability::after,
html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability-line::after {
  border-color: var(--node-fill);
  background: var(--node-fill);
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability-index i {
  background: color-mix(in srgb, var(--dark-primary-text) 44%, transparent);
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability h2 {
  color: var(--dark-primary-text);
}

html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability p,
html[data-public-theme="dark"] :where(.homepage-presentation-v2-root[data-public-theme-enabled], body[data-public-theme-enabled]) .hero-capability-index {
  color: var(--dark-secondary-text);
}

@media (min-width: 1101px) {
  .hero {
    min-height: clamp(700px, 76svh, 780px);
    padding-top: calc(var(--v2-header) + clamp(24px, 3vh, 40px));
    padding-bottom: clamp(36px, 4vh, 52px);
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
    gap: clamp(54px, 5.2vw, 82px);
  }
}

@media (max-width: 1100px) {
  .hero-capability-stage { width: 100%; max-width: 720px; }
  .portfolio-card-copy { padding: 22px; }
}

@media (max-width: 860px) {
  .portfolio-grid { grid-template-columns: 1fr; }
  .portfolio-card { display: grid; grid-template-columns: minmax(260px, .88fr) minmax(0, 1.12fr); }
  .portfolio-cover { height: 100%; min-height: 300px; border-right: 1px solid #55554f; border-bottom: 0; }
}

@media (max-width: 600px) {
  .hero {
    min-height: 0;
    padding-bottom: 36px;
  }

  .hero-capability-stage {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 16px 4px 10px;
  }

  .hero-capability-list {
    position: relative;
    inset: auto;
    display: grid;
    gap: 9px;
    padding-left: 24px;
  }

  .hero-capability-list::before {
    top: 0;
    bottom: 40px;
    left: 4px;
    width: 20px;
    height: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid var(--pipe-line);
  }

  .hero-capability-list::after { display: none; }

  .hero-capability-list:has(.hero-capability:hover, .hero-capability:focus-visible)::before {
    border-color: var(--v2-orange);
  }

  .hero-capability-line {
    top: 16px;
    left: 8px;
    width: 34px;
  }

  .hero-capability {
    position: relative;
    inset: auto;
    width: auto;
    min-height: 0;
    padding: 11px 12px;
  }

  .hero-capability:nth-child(1),
  .hero-capability:nth-child(2),
  .hero-capability:nth-child(3) {
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    padding: 10px 10px 9px 14px;
  }

  .hero-capability:nth-child(2) { margin-left: 20px; }
  .hero-capability:nth-child(3) { margin-right: 16px; }

  .hero-capability::before,
  .hero-capability:nth-child(2)::before,
  .hero-capability:nth-child(3)::before {
    top: 50%;
    left: -21px;
    right: auto;
    width: 20px;
    height: 1px;
  }

  .hero-capability:nth-child(2)::before { left: -41px; width: 40px; }

  .hero-capability::after,
  .hero-capability:nth-child(2)::after,
  .hero-capability:nth-child(3)::after {
    top: calc(50% - 4px);
    left: -5px;
    right: auto;
    width: 7px;
    height: 7px;
  }

  .hero-capability > div { margin-top: 7px; }
  .hero-capability-index { gap: 7px; font-size: .55rem; }
  .hero-capability-index i { width: 6px; height: 6px; }
  .hero-capability h2 { font-size: 1rem; }
  .hero-capability p { margin-top: 5px; font-size: .76rem; line-height: 1.48; }

  .portfolio-grid { gap: 18px; }

  .portfolio-card {
    display: flex;
    grid-template-columns: none;
  }

  .portfolio-cover {
    width: 100%;
    min-height: 0;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #55554f;
  }

  .portfolio-card-copy { padding: 22px 20px 24px; }
  .portfolio-category { margin-bottom: 16px; }
  .portfolio-card h3 { font-size: clamp(1.35rem, 6.2vw, 1.65rem); }
  .portfolio-summary { margin: 14px 0 22px; font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-capability-stage,
  .hero-capability-line,
  .hero-capability-line::before,
  .hero-capability-line::after,
  .hero-capability-list::before,
  .hero-capability-list::after,
  .hero-capability,
  .hero-capability::after {
    animation: none;
    transition: none;
    opacity: 1;
    translate: none;
    transform: none;
  }

  .hero-capability-list::before,
  .hero-capability-list::after { clip-path: none; }

  .portfolio-card,
  .portfolio-cover::after,
  .portfolio-cover img,
  .portfolio-cta span {
    transition: none;
  }

  .portfolio-card:hover,
  .portfolio-card:focus-within { transform: none; }
}
