/* Scroll story — pinned 3D chapters on desktop, stacked reading layout otherwise.
   Theater rules live under html.is-depth, set only at >=768px without reduced motion. */

.depth-page {
  background: var(--c1);
  color: var(--c8);
}

.depth-page .site-footer {
  position: relative;
  z-index: 3;
}

.depth-stage {
  position: relative;
  background: var(--c1);
}

.depth-chapter {
  position: relative;
  color: var(--c8);
  padding: 4.5rem 0 4rem;
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0, 210, 252, 0.14), transparent 46%),
    linear-gradient(180deg, rgba(0, 17, 41, 0.15), rgba(0, 17, 41, 0.92));
}

.depth-chapter[data-depth="paths"] {
  background:
    linear-gradient(90deg, rgba(253, 215, 70, 0.08), transparent 42%),
    linear-gradient(270deg, rgba(0, 210, 252, 0.1), transparent 40%),
    #001129;
}

.depth-chapter[data-depth="flagship"] {
  background:
    radial-gradient(ellipse at 70% 45%, rgba(0, 210, 252, 0.16), transparent 42%),
    radial-gradient(ellipse at 30% 80%, rgba(253, 215, 70, 0.08), transparent 40%),
    #001129;
}

.depth-chapter[data-depth="work"] {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 210, 252, 0.1), transparent 50%),
    #021426;
}

.depth-chapter[data-depth="hire"] {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(253, 215, 70, 0.14), transparent 46%),
    #001129;
}

.chapter-inner {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.depth-kicker {
  font-family: var(--font-mono);
  color: var(--c3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0 0 0.55rem;
}

.depth-chapter h1,
.depth-chapter h2 {
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 0.7rem;
}

.depth-chapter h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.depth-chapter h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
}

.depth-chapter h1 .accent {
  position: relative;
  display: inline-block;
}

.depth-chapter h1 .accent::after {
  content: "";
  display: block;
  height: 8px;
  margin-top: 0.12rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12'%3E%3Cpath d='M2 8 Q50 0 100 7 T198 5' fill='none' stroke='%23FDD746' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.depth-lead,
.depth-head p,
.depth-aside {
  color: var(--text-muted);
  margin: 0;
}

.depth-lead {
  font-size: 1.05rem;
  max-width: 38rem;
}

.depth-head {
  margin-bottom: 1.1rem;
  max-width: 40rem;
}

.depth-head p {
  margin-top: 0.35rem;
}

.depth-aside {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.depth-aside a {
  color: var(--c3);
  border-bottom: 1px solid rgba(0, 210, 252, 0.35);
}

.depth-aside a:hover {
  color: var(--c2);
  border-bottom-color: var(--c2);
}

.depth-aside-center {
  text-align: center;
}

.intro-layout,
.flagship-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
}

.intro-portrait {
  justify-self: end;
}

.depth-page .intro-portrait .portrait-ring {
  width: min(280px, 42vw);
}

.depth-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 1.1rem;
}

.depth-tags span,
.work-tile em {
  font-style: normal;
}

.depth-tags span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--c3);
  background: rgba(0, 210, 252, 0.14);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
}

.depth-paths {
  align-items: stretch;
}

.depth-chapter .path-card > p {
  font-size: 0.92rem;
}

.flagship-stage {
  position: relative;
  min-height: 280px;
  perspective: 1100px;
  transform-style: preserve-3d;
}

.flagship-card,
.flagship-back {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  color: var(--c8);
  text-decoration: none;
}

.flagship-card {
  position: relative;
  transform-style: preserve-3d;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 30px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 210, 252, 0.12);
  background: #071525;
  max-width: 460px;
  margin-left: auto;
}

.flagship-card img {
  width: 100%;
  height: min(320px, 42vh);
  object-fit: cover;
  object-position: top center;
}

.flagship-card-caption {
  position: absolute;
  left: 0.8rem;
  bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(0, 17, 41, 0.82);
  color: var(--c2);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
}

.flagship-back {
  position: absolute;
  z-index: 0;
  width: min(230px, 46%);
  left: 0;
  top: 8%;
  padding: 0.9rem 1rem;
  background: linear-gradient(160deg, rgba(8, 28, 52, 0.95), rgba(0, 17, 41, 0.92));
  border: 1px solid rgba(253, 215, 70, 0.35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  transform: translateZ(-90px);
  backface-visibility: hidden;
}

html.is-depth .flagship-back {
  /* Hide ExRx without clipping the front card (no overflow:hidden on stage). */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.flagship-back-kicker,
.flagship-back strong,
.flagship-back span {
  display: block;
}

.flagship-back-kicker {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c2);
  margin-bottom: 0.3rem;
}

.flagship-back strong {
  font-size: 0.98rem;
  margin-bottom: 0.3rem;
}

.flagship-back span:last-child {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.flagship-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  backface-visibility: hidden;
}

html.is-depth .flagship-card {
  z-index: 2;
}

.work-fan {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  transform-style: preserve-3d;
}

.work-tile {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 16px;
  background: rgba(6, 20, 40, 0.82);
  border: 1px solid rgba(0, 210, 252, 0.18);
  color: var(--c8);
  min-height: 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.work-tile:nth-child(3n + 1) { transform: translateZ(30px); }
.work-tile:nth-child(3n + 2) { transform: translateZ(110px); }
.work-tile:nth-child(3n) { transform: translateZ(0px); }

.work-tile img {
  width: 74px;
  height: 56px;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  background: #0a1a2e;
}

.work-tile strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.25;
}

.work-tile em {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.work-tile:hover {
  border-color: var(--c2);
}

.hire-quotes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}

.hire-quote {
  margin: 0;
  padding: 1rem 1.1rem 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(253, 215, 70, 0.28);
}

.hire-quote:nth-child(2) {
  border-color: rgba(0, 210, 252, 0.28);
  transform: translateZ(36px);
}

.hire-quote blockquote {
  margin: 0 0 0.7rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.hire-quote figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.hire-quote a {
  color: var(--c3);
}

.hire-actions {
  justify-content: flex-start;
}

.depth-floor,
.depth-rail,
.depth-hint,
.depth-progress {
  display: none;
}

/* Theater: desktop, motion OK. Class is toggled from scroll.js / the head script. */
html.is-depth {
  scroll-behavior: auto;
}

html.is-depth .depth-stage {
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
  z-index: 2;
}

html.is-depth .depth-camera {
  position: relative;
  height: 100%;
  perspective: 1400px;
  perspective-origin: 50% 42%;
  transform-style: preserve-3d;
}

html.is-depth .depth-floor {
  display: block;
  position: absolute;
  left: -35%;
  right: -35%;
  bottom: -6%;
  height: 46%;
  background-image:
    linear-gradient(rgba(0, 210, 252, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(253, 215, 70, 0.4) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotateX(63deg);
  transform-origin: center top;
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
}

html.is-depth .depth-chapter {
  position: absolute;
  inset: 0;
  padding: 0;
  display: flex;
  align-items: center;
  background: transparent;
  transform-style: preserve-3d;
  visibility: hidden;
}

html.is-depth .depth-chapter::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 24%, rgba(0, 210, 252, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(0, 17, 41, 0.05) 40%, rgba(0, 17, 41, 0.15) 100%);
}

html.is-depth .depth-chapter[data-depth="intro"] {
  visibility: visible;
}

html.is-depth .depth-chapter[data-depth="intro"]::before {
  /* Dim waves so headline/body stay readable; portrait side keeps a bit more swirl */
  background:
    url("../assets/img/waves-background.svg") 70% bottom / cover no-repeat,
    radial-gradient(ellipse at 78% 28%, rgba(0, 210, 252, 0.12), transparent 48%),
    radial-gradient(ellipse at 22% 85%, rgba(253, 215, 70, 0.05), transparent 42%);
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.3) 26%, rgba(0, 0, 0, 0.7) 52%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.3) 26%, rgba(0, 0, 0, 0.7) 52%, #000 100%);
  z-index: 0;
}

/* Stronger navy scrim behind left intro copy */
html.is-depth .depth-chapter[data-depth="intro"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    105deg,
    rgba(0, 17, 41, 0.88) 0%,
    rgba(0, 17, 41, 0.62) 34%,
    rgba(0, 17, 41, 0.22) 56%,
    transparent 74%
  );
}

html.is-depth .depth-chapter[data-depth="paths"]::before {
  background:
    linear-gradient(100deg, rgba(253, 215, 70, 0.1), transparent 36%),
    linear-gradient(260deg, rgba(0, 210, 252, 0.12), transparent 34%);
}

html.is-depth .depth-chapter[data-depth="flagship"]::before {
  background: radial-gradient(ellipse at 68% 48%, rgba(0, 210, 252, 0.18), transparent 46%);
}

html.is-depth .depth-chapter[data-depth="work"]::before {
  background: radial-gradient(ellipse at 50% 18%, rgba(0, 210, 252, 0.12), transparent 50%);
}

html.is-depth .depth-chapter[data-depth="hire"]::before {
  background: radial-gradient(ellipse at 50% 88%, rgba(253, 215, 70, 0.16), transparent 48%);
}

html.is-depth .chapter-inner {
  width: min(1040px, calc(100% - 8.5rem));
  transform-style: preserve-3d;
}

html.is-depth .intro-copy {
  transform: translateZ(50px);
}

html.is-depth .intro-portrait {
  transform: translateZ(140px) rotateY(-20deg);
  transform-style: preserve-3d;
}

html.is-depth .depth-paths {
  grid-template-columns: 1.2fr 0.88fr;
  transform-style: preserve-3d;
}

html.is-depth .depth-chapter .path-card {
  padding: 1rem 1.05rem 1.05rem;
  border-radius: 22px;
  transform-style: preserve-3d;
}

html.is-depth .depth-chapter .path-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

html.is-depth .depth-chapter .path-card > p {
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 0.55rem;
}

html.is-depth .depth-chapter .path-bullets {
  margin-bottom: 0.75rem;
}

html.is-depth .depth-chapter .path-bullets li {
  font-size: 0.78rem;
  margin-bottom: 0.22rem;
  line-height: 1.35;
}

html.is-depth .depth-chapter .path-label {
  font-size: 0.68rem;
  margin-bottom: 0.35rem;
}

html.is-depth .path-plane[data-plane="build"] {
  transform: translateZ(80px) rotateY(14deg);
}

html.is-depth .path-plane[data-plane="advise"] {
  transform: translateZ(-20px) rotateY(-16deg);
}

html.is-depth .depth-head {
  margin-bottom: 0.75rem;
}

html.is-depth .depth-chapter h1 {
  font-size: clamp(1.9rem, 3.6vw, 3.15rem);
}

html.is-depth .depth-chapter h2 {
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
}

html.is-depth .depth-lead,
html.is-depth .depth-head p {
  font-size: 0.95rem;
}

html.is-depth .flagship-card img {
  height: min(280px, 36vh);
}

html.is-depth .work-fan {
  gap: 0.65rem;
}

html.is-depth .hire-quotes {
  transform-style: preserve-3d;
}

html.is-depth .depth-rail {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  position: absolute;
  z-index: 5;
  right: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
}

html.is-depth .depth-rail button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0.15rem 0;
  color: rgba(253, 215, 70, 0.62);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html.is-depth .depth-rail button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid currentColor;
  flex: 0 0 auto;
}

html.is-depth .depth-rail button[aria-current="true"] {
  color: var(--c3);
}

html.is-depth .depth-rail button[aria-current="true"]::before {
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(0, 210, 252, 0.15);
}

html.is-depth .depth-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

html.is-depth .depth-hint::after {
  content: "";
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, var(--c2), transparent);
  animation: depth-drop 1.4s ease-in-out infinite;
}

html.is-depth .depth-progress {
  display: block;
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
}

html.is-depth .depth-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--c2), var(--c3));
}

@keyframes depth-drop {
  0% { transform: scaleY(0.35); transform-origin: top; opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(0.35); transform-origin: bottom; opacity: 0.25; }
}

@media (max-width: 1100px) {
  html.is-depth .depth-rail button {
    font-size: 0;
  }
  html.is-depth .chapter-inner {
    width: min(1040px, calc(100% - 4.5rem));
  }
}

@media (max-height: 760px) {
  html.is-depth .depth-page .intro-portrait .portrait-ring,
  html.is-depth .intro-portrait .portrait-ring {
    width: min(190px, 28vh);
  }
  html.is-depth .depth-chapter .path-card > p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  html.is-depth .flagship-card img {
    height: min(210px, 30vh);
  }
  html.is-depth .work-tile em {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 900px) {
  /* Keep intro two-column through tablet; stack only below 768 */
  .flagship-layout,
  .hire-quotes,
  .work-fan {
    grid-template-columns: 1fr 1fr;
  }
  .flagship-layout {
    grid-template-columns: 1fr;
  }
  .flagship-card {
    margin-left: 0;
  }
}

@media (max-width: 767px), (prefers-reduced-motion: reduce) {
  .depth-stage,
  html.is-depth .depth-stage {
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
  }
  .depth-camera,
  html.is-depth .depth-camera {
    perspective: none;
    height: auto;
    transform: none !important;
  }
  .depth-chapter,
  html.is-depth .depth-chapter,
  html.is-depth .depth-chapter[data-depth="intro"] {
    position: relative !important;
    inset: auto !important;
    visibility: visible !important;
    display: block !important;
    padding: 4.5rem 0 4rem;
    opacity: 1 !important;
    transform: none !important;
    overflow: visible;
  }
  html.is-depth .depth-chapter::before,
  html.is-depth .depth-chapter[data-depth="intro"]::after {
    display: none;
  }
  .intro-copy,
  .intro-portrait,
  .path-plane,
  .work-tile,
  .hire-quote,
  .flagship-back,
  .flagship-card,
  .chapter-inner,
  .work-fan,
  .hire-quotes,
  html.is-depth .intro-copy,
  html.is-depth .intro-portrait,
  html.is-depth .path-plane,
  html.is-depth .work-tile,
  html.is-depth .hire-quote,
  html.is-depth .flagship-back,
  html.is-depth .flagship-card,
  html.is-depth .chapter-inner,
  html.is-depth .work-fan,
  html.is-depth .hire-quotes {
    transform: none !important;
  }
  .depth-floor,
  .depth-rail,
  .depth-hint,
  .depth-progress,
  html.is-depth .depth-floor,
  html.is-depth .depth-rail,
  html.is-depth .depth-hint,
  html.is-depth .depth-progress {
    display: none !important;
  }
  .depth-paths,
  html.is-depth .depth-paths {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .intro-layout,
  .flagship-layout,
  .hire-quotes,
  .work-fan,
  .depth-paths {
    grid-template-columns: 1fr;
  }
  /* Portrait first + centered above kicker; desktop/tablet unchanged */
  .intro-portrait {
    order: -1;
    justify-self: center;
  }
  .depth-page .intro-portrait .portrait-ring {
    width: min(220px, 70vw);
  }
  .flagship-back {
    position: relative;
    width: auto;
    top: auto;
    left: auto;
    margin-bottom: 0.75rem;
  }
  .hire-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.is-depth .depth-hint::after {
    animation: none;
  }
  .work-fan {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .work-fan {
    grid-template-columns: 1fr;
  }
}
