/* Loaded inside <paperbot-service-cube>. The page supplies the header and Inter. */
:host {
  display: block;
  min-width: 0;
  font-family: Inter, Arial, sans-serif;
  font-synthesis: none;
  color: #f4f7ff;
  color-scheme: dark;
  --pb-stage-bg: var(--pb-cube-surface, #050d1d);
  --pb-hint: #afc6ed;
  --pb-nav-ink: #cfddf2;
  --rail-axis: max(4.5vw, calc(env(safe-area-inset-left, 0px) + 19px));
  --rail-hit: 38px;
  --rail-dot: #818b9d;
  --rail-selected: #fff;
  --rail-ring: transparent;
  --pb-header-offset: var(--pb-header-size, 0px);
  --pin-size: var(--pin-height, calc(100svh - var(--pb-header-offset)));
  /* Large backdrop lettering overlaps behind the cube within one screen. */
  --title-font-target: min(240px, 20vw);
  --edge: min(80vw, calc((var(--pin-size) - 86px) / 1.24), 1100px);
  --cube-center-y: 50%;
  --face-inset: calc(var(--edge) * .075);
  --camera-distance: calc(var(--edge) * 3.5);
  --depth: calc(var(--edge) / 2);
  background: var(--pb-stage-bg);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #ffbd76;
  outline-offset: 5px;
}
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 4;
  padding: 9px 14px;
  color: #12298c;
  background: white;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

#explorer {
  position: relative;
  isolation: isolate;
  height: calc(var(--pin-size) + var(--scroll-range, calc(var(--pin-size) * 4)));
}
.hero-pin {
  position: sticky;
  top: var(--pb-header-offset);
  height: var(--pin-size);
  overflow: clip;
  isolation: isolate;
  background: var(--pb-stage-bg);
}
/* Fade the upper edge of the glow into the header's solid navy. */
.hero-pin::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(12px, 4vh, 40px);
  background: linear-gradient(var(--pb-stage-bg), transparent);
  pointer-events: none;
}
.hero-layout {
  position: absolute;
  top: var(--cube-center-y, 50%);
  z-index: 1;
  left: 50%;
  width: var(--edge);
  height: var(--edge);
  margin: 0;
  transform: translate(-50%, -50%);
}
.hero-layout, .hero-controls, .flip-navigation { opacity: var(--scene-opacity, 1); }
/* Full-height label layers travel with the same coordinate as the cube.
   Keep glyphs inside generous line boxes, including descenders in the service names. */
.background-words {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: var(--scene-opacity, 1);
}
.background-word {
  position: absolute;
  inset: auto 0 max(6px, env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  color: #8cafe1;
  font-size: var(--title-font-target);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -.05em;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
}
.background-word span { display: block; letter-spacing: -.05em; }
.background-word:first-child { opacity: .24; }
.stage-shell, .cube-stage, .cube-depth, .cube { position: relative; width: 100%; height: 100%; }
.cube-stage {
  perspective: var(--camera-distance);
  perspective-origin: 50% 50%;
  touch-action: pan-y;
  cursor: grab;
}
.cube-stage:active { cursor: grabbing; }
.cube-stage:focus-visible { outline-offset: 12px; }
.cube-depth, .cube { transform-style: preserve-3d; pointer-events: none; }
/* Rotate one rigid cube; move the front face back onto the scene plane at rest. */
.cube {
  transform: translateZ(calc(0px - var(--depth))) rotateX(var(--pitch, 270deg));
  will-change: transform;
}
.cube-side {
  position: absolute;
  inset: 0;
  pointer-events: none;
  backface-visibility: hidden;
  background: #000;
  transform: rotateY(var(--side-angle)) translateZ(var(--depth));
}
.side-left { --side-angle: -90deg; }
.side-right { --side-angle: 90deg; }

.service-face {
  position: absolute;
  inset: 0;
  color: white;
  background: #000;
  overflow: hidden;
  clip-path: inset(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateX(calc(0deg - var(--face-angle))) translateZ(var(--depth));
  pointer-events: auto;
}
/* The plane remains opaque and black as the whole artwork layer fades. */
.service-content, .intro-face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: clamp(4px, calc(var(--edge) * .018), 16px);
  padding: var(--face-inset) 8%;
  background: linear-gradient(155deg, #143b87 0%, #102c64 36%, #09172f 72%);
  opacity: var(--face-opacity, 1);
  will-change: opacity;
}
.face-art {
  position: relative;
  min-height: 0;
}
/* Match the visible silhouettes despite different transparent margins in the PNGs. */
.face-art img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: min(var(--art-height, 155%), calc(var(--edge) * var(--art-limit, .88)));
  max-width: none;
  transform: translate(-50%, -50%);
}
.intro-face { --art-height: 176%; --art-limit: 1.16; }
.service-face[data-face="communication"] { --art-height: 132%; --art-limit: .94; }
.service-face[data-face="identity"] { --art-height: 113%; --art-limit: .98; }
.intro-face {
  z-index: 1;
}
/* At rest the front face aligns with the scene plane. Paint it there directly
   so the browser can hit-test its links. The turn still uses the 3D stack. */
#explorer[data-phase="read"] .cube {
  transform: none !important;
  will-change: auto;
}
#explorer[data-phase="read"] :is(.cube-depth, .cube) {
  transform-style: flat;
  pointer-events: auto;
}
#explorer[data-phase="read"] .service-face:not([inert]) {
  transform: none;
  backface-visibility: visible;
}
/* The overview shares the learning plane. Only one painted layer may occupy it. */
.service-face:has(> .intro-face:not([hidden])) > .service-content { visibility: hidden; }
.service-face img { pointer-events: none; user-select: none; -webkit-user-drag: none; }
.face-copy {
  min-width: 0;
  text-align: center;
}
.category {
  margin: 0 0 9px;
  color: #f4f8ff;
  font-size: clamp(18px, calc(var(--edge) * .038), 34px);
  line-height: 1.18;
  font-weight: 650;
  letter-spacing: -.025em;
}
.service-face[data-face="identity"] .category { color: #fff; }
.category a { text-decoration: none; }
.category a:is(:hover, :focus-visible, :active) { color: #f66b24; }
.intro-face .category {
  color: #c3d8ff;
  font-size: 10px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1, h2 {
  margin: 0;
  font-size: clamp(25px, calc(var(--edge) * .058), 58px);
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -.048em;
  text-wrap: balance;
}
.intro-face h2 span { display: block; }
.service-face[data-face="identity"] h2 { font-weight: 570; }
.description {
  max-width: 760px;
  margin: clamp(8px, calc(var(--edge) * .018), 18px) auto clamp(12px, calc(var(--edge) * .024), 24px);
  color: #e0eaff;
  font-size: clamp(13px, calc(var(--edge) * .022), 21px);
  line-height: 1.6;
  font-weight: 400;
  text-wrap: pretty;
}
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid #8fabff80;
  border-radius: 30px;
  color: white;
  background: #204bff;
  font: 550 clamp(12px, calc(var(--edge) * .018), 17px)/1.4 Inter, Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.primary-action:hover { background: #1740d6; }
.primary-action[aria-disabled="true"] { cursor: default; }

/* Reuse one softly painted light. It scatters outward as it dims,
   without repainting an animated blur or adding a separate animation clock. */
.halo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: 162%;
  height: 162%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(calc(1 + var(--light-fold, 0) * .12), calc(1 + var(--light-fold, 0) * .22));
  opacity: calc(.66 - var(--light-fold, 0) * .09);
  filter: blur(clamp(18px, calc(var(--edge) * .085), 85px));
  will-change: transform, opacity;
}
.halo::before, .halo::after { content: ""; position: absolute; inset: 10%; }
.halo::before { background: radial-gradient(ellipse at 34% 50%, #356ac2 0%, #203f70 46%, transparent 76%); }
.halo::after {
  background: radial-gradient(ellipse at 65% 62%, #50a9d3 0%, #2b5a8d 46%, transparent 76%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black);
  mask-image: linear-gradient(to bottom, transparent, black);
}

/* Anchor the rail to the viewport-sized pin, independently of the cube. */
.flip-navigation {
  position: absolute;
  z-index: 2;
  left: calc(var(--rail-axis) - var(--rail-hit) / 2);
  top: var(--cube-center-y, 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transform: translateY(-50%);
}
.direction, .step-dots button {
  display: grid;
  place-items: center;
  width: var(--rail-hit);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pb-nav-ink);
}
.flip-navigation button:focus-visible { border-radius: 7px; outline-offset: -2px; }
.flip-navigation .direction { height: 30px; font-size: 0; color: var(--rail-dot); }
.flip-navigation .direction:disabled { visibility: hidden; }
.flip-navigation .direction::before {
  content: "";
  width: 10px;
  height: 10px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.flip-navigation #previous-service::before { transform: rotate(225deg); }
.flip-navigation .direction:hover { color: var(--rail-selected); }
.step-dots { display: grid; }
.step-dots button { height: 29px; }
.step-dots button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--rail-dot);
}
.step-dots button[aria-pressed="true"]::before,
#explorer[data-selected=""] .step-dots button:first-child::before {
  height: 23px;
  background: var(--rail-selected);
  box-shadow: 0 0 0 1px var(--rail-ring);
}
.hero-controls { position: absolute; inset: auto 0 14px; text-align: center; color: var(--pb-hint); }
.hero-controls p { margin: 5px 12px 0; font-size: 11px; line-height: 1.45; }
.compact-description { display: none; }

@media (max-width: 1000px) {
  :host {
    --edge: min(82vw, calc((100vw - var(--rail-axis) * 2 - var(--rail-hit) - 12px) / 1.065), 800px, calc((var(--pin-size) - 80px) / 1.24));
  }
}
@media (min-width: 850px) and (min-height: 501px) and (min-aspect-ratio: 4/3) {
  :host {
    /* Preserve the approved cube size independently of the background title. */
    --edge: min(calc((var(--pin-size) - 18px) * .80), calc(100vw - 385px), 1100px);
    --camera-distance: calc(var(--edge) * 2.25);
  }
}
@media (max-width: 600px) {
  :host {
    --rail-axis: max(clamp(17px, 4.5vw, 21px), calc(env(safe-area-inset-left, 0px) + 17px));
    --rail-hit: 32px;
    --title-font-target: min(96px, 24vw);
    --face-inset: calc(var(--edge) * .06);
    --edge: min(calc(100vw - 48px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)), calc(96vw - 32px), calc((var(--pin-size) - 26px) / 1.40), 540px);
    --camera-distance: 4000px;
  }
  .hero-layout { left: calc(50% + 13px + env(safe-area-inset-left, 0px) / 2 - env(safe-area-inset-right, 0px) / 2); }
  .background-word {
    /* Keep mobile lettering behind the lower cube. */
    bottom: calc(100% - var(--cube-center-y) - var(--edge) / 2 - clamp(16px, 6vh, 48px));
  }

  .category { margin-bottom: 6px; font-size: clamp(14px, 4.3vw, 20px); }
  .face-copy h2 { font-size: clamp(17px, 5.2vw, 24px); }
  .face-copy .description { font-size: clamp(11px, 3vw, 13px); margin: 6px auto 10px; line-height: 1.35; }
  .primary-action { min-height: 32px; padding: 6px 12px; font-size: 11px; }

}
@media (max-height: 700px) {
  .category { margin-bottom: 9px; font-size: clamp(16px, calc(var(--edge) * .047), 23px); }
  .intro-face .category { font-size: 8px; }
  h1, h2 { font-size: clamp(20px, calc(var(--edge) * .064), 32px); }
  .description { font-size: clamp(11.5px, calc(var(--edge) * .031), 14px); line-height: 1.5; margin: 10px auto 13px; }
  .primary-action { min-height: 34px; padding: 8px 17px; font-size: 11px; }
}
@media (max-height: 600px) and (min-width: 460px) and (min-aspect-ratio: 6/5) {
  :host {
    --title-font-target: min(160px, 20vw, calc(var(--pin-size) * .45));
    --edge: min(calc(62vw - 85px), calc((var(--pin-size) - 12px) * .80));
    --camera-distance: calc(var(--edge) * 2.25);
  }
  .hero-layout { left: 35%; }
  .hero-controls { inset: var(--cube-center-y) 5% auto calc(35% + var(--edge) * .64 + 12px); transform: translateY(-50%); text-align: left; }
  .hero-controls .compact-description { display: block; margin: 0; font-size: clamp(13px, 2vw, 16px); line-height: 1.5; }
  .face-copy .description { display: none; }
  .category { margin-bottom: 4px; font-size: 14px; }
  h1, h2 { font-size: clamp(16px, calc(var(--edge) * .1), 23px); line-height: 1.1; margin-bottom: 8px; }
  .primary-action { min-height: 34px; padding: 5px 10px; }
  .flip-navigation { gap: 2px; }
  .step-dots button { height: 26px; }
  .flip-navigation .direction { height: 25px; }
}

@media (max-height: 350px) and (min-width: 460px) {
  :host { --face-inset: calc(var(--edge) * .04); }
  .category { margin-bottom: 2px; font-size: 12px; }
  h2 { font-size: 15px; margin-bottom: 4px; }
  .primary-action { padding-inline: 7px; }
}

@media (max-width: 600px) and (max-height: 600px) and (orientation: portrait) {
  .primary-action { padding-inline: 10px; font-size: 10px; }
}
