/* Página Dev. Classes com prefixo "d-" para não colidir com o cartão de links; cores em tokens.css. */
/* ---- Palco e grade ---------------------------------------------------------- */
/* Página própria, sem rolagem no desktop: os três cards numa fileira (crescem um
   pouco em telas grandes). Contêiner: o carrossel e os títulos medem por ele (cqi). */
.d-stage {
  width: min(100%, var(--stage-max));
  display: flex;
  flex-direction: column;
  gap: 18px;
  container-type: inline-size;
}
.d-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 900px) {
  .d-stage {
    width: min(100%, 560px);
  }
  .d-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* A pilha ocupa a linha inteira em cima. */
  .d-grid > :first-child {
    grid-column: 1 / -1;
  }
  .d-grid > :first-child .d-card {
    aspect-ratio: auto;
    min-height: 280px;
  }
}
.d-host,
.d-tilt-host {
  display: flex;
  min-width: 0;
}
.d-tilt-host {
  flex: 1;
}

.d-card {
  flex: 1;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow);
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: box-shadow 360ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .d-host:hover .d-card {
    box-shadow: var(--shadow-lift);
  }
}

/* Card de tópico: título, a animação no meio, uma seta no canto. */
.d-topic {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.d-topic:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.d-topic:active {
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(0.985);
}
.d-topic-title,
.d-pile-title {
  font-family: var(--display);
  /* 22px até a fileira de 920px; acompanha os cards maiores em telas grandes. */
  font-size: clamp(22px, 2.4cqi, 26px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.d-topic-out {
  position: absolute;
  top: 27px;
  right: 24px;
  display: inline-grid;
  color: var(--text-2);
  transition:
    transform 380ms var(--ease-page),
    color 260ms var(--ease-out);
}
.d-topic-out svg {
  width: 16px;
  height: 16px;
}
.d-teaser {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}
@media (hover: hover) and (pointer: fine) {
  .d-topic:hover .d-topic-out {
    transform: translate(2px, -2px);
    color: var(--accent);
  }
}
.d-topic:focus-visible .d-topic-out {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* Teaser da trajetória: pontos numa linha; olhando, a linha enche e os pontos acendem. */
.d-t-flow {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.d-t-flow::before,
.d-t-flow::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 1px;
}
.d-t-flow::before {
  background: var(--rule);
}
.d-t-flow::after {
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 640ms var(--ease-page);
}
.d-t-dot {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  background: var(--card);
  /* Ao apagar, de baixo pra cima; ao acender (estados acordados abaixo), de cima pra baixo. */
  transition:
    border-color 200ms var(--ease-out) calc((var(--n) - 1 - var(--i)) * 130ms),
    background-color 200ms var(--ease-out) calc((var(--n) - 1 - var(--i)) * 130ms);
}
.d-t-dot::after {
  content: '';
  position: absolute;
  left: 24px;
  top: 3px;
  width: calc(40px + var(--i) * 12px);
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
}

/* Teaser da arquitetura: camadas uma dentro da outra; acendem de dentro para fora. */
.d-t-layers {
  position: relative;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
}
.d-t-layer {
  position: absolute;
  inset: calc(var(--i) * 16px);
  border-radius: calc(14px - var(--i) * 2px);
  border: 2px solid var(--rule);
  transition:
    border-color 220ms var(--ease-out) calc((3 - var(--i)) * 110ms),
    background-color 220ms var(--ease-out) calc((3 - var(--i)) * 110ms),
    transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1) calc((3 - var(--i)) * 110ms);
}
.d-t-layer--core {
  background: var(--surface-2);
}

/* Estados acordados (hover com mouse, foco por teclado). */
@media (hover: hover) and (pointer: fine) {
  .d-topic:hover .d-t-dot {
    border-color: var(--accent);
    background: var(--accent);
    transition-delay: calc(var(--i) * 130ms);
  }
  .d-topic:hover .d-t-flow::after {
    transform: scaleY(1);
  }
  .d-topic:hover .d-t-layer {
    border-color: var(--accent);
    transform: scale(1.04);
  }
  .d-topic:hover .d-t-layer--core {
    background: var(--accent);
  }
}
.d-topic:is(:focus-visible, [data-wake]) .d-t-dot {
  border-color: var(--accent);
  background: var(--accent);
  transition-delay: calc(var(--i) * 130ms);
}
.d-topic:is(:focus-visible, [data-wake]) .d-t-flow::after {
  transform: scaleY(1);
}
.d-topic:is(:focus-visible, [data-wake]) .d-t-layer {
  border-color: var(--accent);
  transform: scale(1.04);
}
.d-topic:is(:focus-visible, [data-wake]) .d-t-layer--core {
  background: var(--accent);
}
.d-topic[data-wake] .d-topic-out {
  transform: translate(2px, -2px);
  color: var(--accent);
}
/* No toque, a mesma animação do hover, só que mais rápida (termina antes do painel abrir). */
.d-topic[data-wake] .d-t-dot {
  transition-duration: 140ms;
  transition-delay: calc(var(--i) * 50ms);
}
.d-topic[data-wake] .d-t-flow::after {
  transition-duration: 280ms;
}
.d-topic[data-wake] .d-t-layer {
  transition-duration: 150ms, 150ms, 260ms;
  transition-delay: calc((3 - var(--i)) * 45ms);
}

/* Botão "Ver" (só no celular, onde não tem hover): mostra que o card abre. */
.d-see {
  display: none;
  align-self: center;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.d-see svg {
  width: 15px;
  height: 15px;
  transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.d-topic:active .d-see,
.d-topic[data-wake] .d-see {
  transform: scale(0.94);
}
.d-topic[data-wake] .d-see svg {
  transform: rotate(45deg);
}
@media (hover: none), (max-width: 760px) {
  .d-see {
    display: inline-flex;
  }
}

/* ---- Pilha de stacks (ToolStack) -------------------------------------------- */
.d-stacks {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 26px;
  overflow: hidden;
}
.d-pile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}
.d-pile {
  --size: 44px;
  position: relative;
  height: calc((var(--rows) - 1) * var(--step) + var(--size) + 8px);
  margin-top: auto;
  padding: 0;
  list-style: none;
  display: block;
}
.d-pile:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 6px;
  border-radius: 6px;
}
.d-piece {
  position: absolute;
  z-index: var(--z, auto);
  left: calc(var(--x) - var(--size) / 2 + var(--dx));
  bottom: var(--y);
  width: var(--size);
  height: var(--size);
  transform: rotate(var(--r));
  transition: transform 340ms cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
/* Com toque, a rolagem vertical passa pela pilha; a peça só é pega segurando (dev.js). */
@media (any-pointer: coarse) {
  .d-piece {
    touch-action: pan-y;
  }
}
/* Peça tirada da pilha: posicionada pela física (transform inline). */
.d-piece[data-free] {
  transition: none;
  z-index: 150;
}
.d-piece[data-dragging] {
  cursor: grabbing;
  z-index: 300;
}
.d-piece[data-dragging] .d-tile {
  transform: scale(1.12);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.2),
    0 24px 44px rgba(0, 0, 0, 0.24);
}
.d-tile {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 23.4%;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1),
    0 6px 14px rgba(0, 0, 0, 0.12);
  transition:
    transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 220ms var(--ease-out);
}
.d-tile img {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-drag: none;
  pointer-events: none;
}
.d-name {
  /* Âncora do nome sobre a peça (0,5 = centro); no carrossel as pontas puxam para dentro. */
  --ax: 0.5;
  position: absolute;
  left: calc(var(--ax) * 100%);
  bottom: calc(100% + 8px);
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--text);
  color: var(--card);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(calc(var(--ax) * -100%), 6px) rotate(calc(var(--r) * -1)) scale(0.9);
  transition:
    opacity 150ms,
    transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.d-piece[data-active] {
  transform: translateY(-8px) rotate(0deg) scale(1.08);
  z-index: 100;
}
.d-piece[data-active] .d-name {
  opacity: 1;
  transform: translate(calc(var(--ax) * -100%), 0) rotate(0deg);
}
@media (hover: hover) and (pointer: fine) {
  .d-piece:not([data-free]):hover {
    transform: translateY(-8px) rotate(0deg) scale(1.08);
    z-index: 100;
  }
  .d-piece:hover .d-name {
    opacity: 1;
    transform: translate(calc(var(--ax) * -100%), 0) rotate(0deg);
  }
}
/* Queda inicial, uma vez, quando a pilha aparece na tela. */
.d-pile[data-animate]:not([data-in-view]) .d-piece {
  opacity: 0;
}
.d-pile[data-animate][data-in-view] .d-piece {
  animation: d-drop 720ms backwards;
  animation-delay: calc(var(--i) * var(--stagger, 55ms));
}
@keyframes d-drop {
  0% {
    transform: translateY(-460px) rotate(calc(var(--r) * -2));
    animation-timing-function: cubic-bezier(0.55, 0, 0.85, 0.35);
  }
  62% {
    transform: translateY(0) rotate(calc(var(--r) * 0.6));
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
  }
  80% {
    transform: translateY(-12px) rotate(calc(var(--r) * 1.15));
    animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4);
  }
  100% {
    transform: rotate(var(--r));
  }
}
/* "Arrumar": pílula preta, aparece quando algo saiu do lugar. */
.d-fix {
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  animation: d-fix-in 260ms var(--ease-out) both;
  position: relative;
}
/* Área de toque de 44px sem aumentar a pílula. */
.d-fix::after {
  content: '';
  position: absolute;
  inset: calc((var(--tap) - 32px) / -2) -4px;
}
.d-fix svg {
  width: 14px;
  height: 14px;
}
.d-fix:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@keyframes d-fix-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
}
/* Rachaduras onde as batidas fortes caíram; na terceira o card cai. */
.d-cracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 400;
  overflow: visible;
}
.d-crack-light,
.d-crack-dark {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.d-crack-light {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3;
  transform: translate(1px, 1px);
}
.d-crack-dark {
  stroke: rgba(30, 30, 34, 0.55);
  stroke-width: 1.2;
  animation: d-crack-in 220ms ease-out both;
}
@keyframes d-crack-in {
  from {
    stroke-dasharray: 0 400;
  }
  to {
    stroke-dasharray: 400 0;
  }
}
.d-broken {
  flex: 1;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1.5px dashed var(--text-3);
  border-radius: 5px;
  animation: d-fix-in 300ms var(--ease-out) both;
}
.d-broken p {
  font-size: 14px;
  color: var(--text-2);
}

/* ---- Painel (o card crescido) ----------------------------------------------- */
.d-dialog {
  width: min(640px, 100% - 32px);
  /* Tira o max-width do navegador (100% - 6px - 2em), que estreitava o painel no celular. */
  max-width: none;
  max-height: min(84svh, 760px);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.d-dialog[open] {
  display: flex;
}
.d-dialog[data-tall] {
  height: min(84svh, 760px);
}
.d-dialog::backdrop {
  background: var(--backdrop-dim);
}
.d-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
/* Nada dentro do painel pode alargá-lo (a barra de abas rola sozinha no celular). */
.d-panel-body,
.d-section,
.d-ai,
.d-segments {
  min-width: 0;
  max-width: 100%;
}
.d-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 18px 10px 28px;
}
.d-panel-title {
  font-family: var(--display);
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.d-close {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 150ms,
    transform 300ms var(--ease-page);
}
.d-close svg {
  width: 18px;
  height: 18px;
}
.d-close:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .d-close:hover {
    background: var(--surface-press);
    transform: rotate(90deg);
  }
}
.d-panel-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 4px 28px 28px;
  scrollbar-width: none;
  /* As abas da Engenharia se ajustam à largura do painel, não à da tela. */
  container-type: inline-size;
}
.d-panel-body::-webkit-scrollbar {
  display: none;
}
.d-panel-body[data-open] > * {
  animation: d-in 520ms var(--ease-page) both;
}
.d-panel-body[data-open] > :nth-child(2) {
  animation-delay: 90ms;
}
.d-panel-body[data-open] > :nth-child(3) {
  animation-delay: 180ms;
}
@keyframes d-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.d-lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-body);
  max-width: 52ch;
}
.d-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.d-section + .d-section {
  padding-top: 22px;
}
.d-section-title {
  font-family: var(--display);
  font-size: clamp(22px, 4vw, 26px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* Caminho: o azul corre até a etapa escolhida. */
.d-flow {
  --fill: 0px;
  position: relative;
  isolation: isolate;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.d-flow::before,
.d-flow::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 6px;
  top: 11px;
  width: 2px;
  border-radius: 1px;
}
.d-flow::before {
  height: calc(var(--track, 100%) - 11px);
  background: var(--rule);
}
.d-flow::after {
  height: var(--fill);
  background: var(--accent);
  transition: height 680ms cubic-bezier(0.45, 0, 0.2, 1);
}
.d-node {
  position: relative;
  padding: 0 0 12px 30px;
}
.d-node-button {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 8px;
  min-height: 22px;
  /* Área de toque mais alta sem mudar o espaçamento (margem negativa compensa). */
  padding: 8px 0;
  margin: -8px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: color 460ms ease;
}
.d-node-meta {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-2);
}
.d-node-dot {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--rule);
  transition:
    border-color 460ms ease,
    background-color 460ms ease,
    transform 620ms cubic-bezier(0.34, 1.3, 0.64, 1);
}
.d-node[data-on] .d-node-button {
  color: var(--text);
}
.d-node[data-on] .d-node-dot {
  border-color: var(--accent);
}
.d-node[data-current] .d-node-dot {
  background: var(--accent);
  transform: scale(1.25);
}
.d-node[data-current] .d-node-meta {
  color: var(--text-body);
}
.d-node-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .d-node-button:hover {
    color: var(--text);
  }
}
.d-node-note {
  display: grid;
  grid-template-rows: 0fr;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  opacity: 0;
  overflow: hidden;
  transition:
    grid-template-rows 720ms cubic-bezier(0.45, 0, 0.2, 1),
    opacity 560ms ease,
    padding 720ms cubic-bezier(0.45, 0, 0.2, 1);
}
.d-node-note > * {
  min-height: 0;
}
/* Trajetória: contexto da empresa e tópicos. */
.d-node-about {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.d-node-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 6px;
}
.d-node-points li {
  position: relative;
  padding-left: 14px;
  color: var(--text-body);
  max-width: 56ch;
}
.d-node-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
/* Painel da trajetória, maior: ocupa o espaço do painel. */
.d-dialog--traj .d-lead {
  font-size: 17px;
}
.d-dialog--traj .d-node {
  padding: 0 0 18px 34px;
}
.d-dialog--traj .d-node-button {
  font-size: 21px;
  column-gap: 10px;
  min-height: calc(28px + 16px);
}
.d-dialog--traj .d-node-meta {
  font-size: 14px;
}
.d-dialog--traj .d-node-dot {
  top: 7px;
}
.d-dialog--traj .d-node-about {
  font-size: 15px;
  margin: 2px 0 10px;
}
.d-dialog--traj .d-node-points {
  gap: 9px;
}
.d-dialog--traj .d-node-points li {
  font-size: 16.5px;
  line-height: 1.5;
  padding-left: 18px;
}
.d-dialog--traj .d-node-points li::before {
  width: 6px;
  height: 6px;
  top: 0.62em;
}
.d-dialog--traj .d-flow::before,
.d-dialog--traj .d-flow::after {
  top: 14px;
}
.d-node[data-current] .d-node-note {
  grid-template-rows: 1fr;
  opacity: 1;
  padding-top: 4px;
}
/* Medindo a altura fixa do painel: sem animação. */
.d-flow[data-measure] .d-node-note,
.d-flow[data-measure]::after {
  transition: none !important;
}

/* Lista com etiqueta (decisões, formação). */
.d-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.d-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.d-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  line-height: 1.4;
  color: inherit;
  text-decoration: none;
  transition: transform 300ms var(--ease-page);
}
a.d-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.d-where {
  flex: none;
  font-size: 12px;
  color: var(--text-2);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  transition:
    background-color 240ms,
    color 240ms;
}
@media (hover: hover) and (pointer: fine) {
  .d-item:hover {
    transform: translateX(4px);
  }
  .d-item:hover .d-where {
    background: var(--accent);
    color: var(--on-accent);
  }
}

/* IA: controle segmentado; a pílula desliza, o texto entra deslizando. */
.d-ai {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.d-segments {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.d-segment-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--n));
  border-radius: 9px;
  background: var(--accent);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateX(calc(var(--at) * 100%));
  transition: transform 420ms cubic-bezier(0.34, 1.3, 0.64, 1);
}
.d-segment {
  position: relative;
  z-index: 1;
  min-height: 38px;
  padding: 0 2px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 240ms var(--ease-out);
}
.d-segment[aria-selected='true'] {
  color: var(--on-accent);
}
/* Toque: abas e links de certificado com a altura mínima de toque. */
@media (pointer: coarse) {
  .d-segment,
  a.d-item {
    min-height: var(--tap);
  }
}
.d-segment:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-radius: 9px;
}
@media (hover: hover) and (pointer: fine) {
  .d-segment:not([aria-selected='true']):hover {
    color: var(--text);
  }
}
.d-ai-panel {
  min-height: 0;
}
.d-ai-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: d-in 420ms var(--ease-page) both;
}
.d-ai-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.d-ai-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-body);
  max-width: 52ch;
}
.d-skill-chips {
  list-style: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  /* Um respiro a mais entre a descrição e os chips (somado ao gap de 6px). */
  margin-top: 9px;
}
.d-skill-chips li {
  display: flex;
  animation: d-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(160ms + var(--i) * 90ms);
}
.d-skill-chip {
  display: inline-flex;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--btn);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12.5px;
  transition:
    background-color 150ms,
    transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.d-skill-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .d-skill-chip:hover {
    background: var(--accent);
    transform: translateY(-2px) rotate(-2deg);
  }
}
@keyframes d-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* Card crescendo até o painel (view transition "d-story"). A navbar escurece junto com a página. */
:root[data-vt='story'] .nav {
  view-transition-name: none;
}
:root[data-vt='story']::view-transition-old(root) {
  animation: 220ms ease-out both vt-fade-out;
}
:root[data-vt='story']::view-transition-new(root) {
  animation: 220ms ease-out both d-vt-fade-in;
}
::view-transition-group(d-story) {
  animation-duration: 420ms;
  animation-timing-function: var(--ease-page);
  border-radius: 5px;
  background: var(--card);
  overflow: clip;
}
::view-transition-image-pair(d-story) {
  isolation: auto;
}
::view-transition-old(d-story),
::view-transition-new(d-story) {
  height: auto;
  object-fit: none;
  object-position: top left;
  mix-blend-mode: normal;
}
::view-transition-old(d-story) {
  animation: 160ms ease-out both vt-fade-out;
}
::view-transition-new(d-story) {
  animation: 260ms ease-out 120ms both d-vt-fade-in;
}
@keyframes d-vt-fade-in {
  from {
    opacity: 0;
  }
}

/* ---- Celulares -------------------------------------------------------------- */
/* Os cards no celular ficam no carrossel (mais abaixo, até 760px); aqui só o painel. */
@media (max-width: 560px) {
  .d-dialog {
    width: calc(100% - 16px);
    max-height: calc(100svh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .d-dialog[data-tall] {
    height: calc(100svh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .d-panel-head {
    padding: 18px 12px 8px 20px;
  }
  .d-panel-body {
    padding: 4px 20px 24px;
  }
  /* Nada abaixo de 14px no celular. */
  .d-name,
  .d-where,
  .d-skill-chip,
  .d-segment,
  .d-fix {
    font-size: 14px;
  }
  .d-item {
    flex-direction: column;
    gap: 6px;
  }
}

/* Muitas abas para a largura do painel ("Arquitetura" pede ~76px por aba): a barra
   rola para o lado, com abas de largura fixa. Vale no celular e no zoom de 200%. */
@container (max-width: 540px) {
  .d-segments {
    grid-template-columns: repeat(var(--n), 88px);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
  }
  .d-segments::-webkit-scrollbar {
    display: none;
  }
  .d-segment-pill {
    width: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .d-card,
  .d-topic:active {
    transform: none;
  }
  .d-t-dot,
  .d-t-layer,
  .d-topic-out {
    transition:
      background-color 150ms,
      color 150ms,
      border-color 150ms;
  }
  .d-t-flow::after {
    transition: none;
  }
  .d-topic:is(:hover, :focus-visible, [data-wake]) .d-t-dot {
    transition-delay: 0s;
  }
  .d-topic:hover .d-t-layer {
    transform: none;
  }
  .d-panel-body[data-open] > *,
  .d-ai-content,
  .d-skill-chips li,
  .d-pile[data-animate][data-in-view] .d-piece {
    animation: none;
  }
  .d-pile[data-animate]:not([data-in-view]) .d-piece {
    opacity: 1;
  }
  .d-piece,
  .d-tile,
  .d-name {
    transition: opacity 150ms;
  }
  .d-segment-pill,
  .d-node-note,
  .d-flow::after {
    transition: none;
  }
  .d-fix,
  .d-broken,
  .d-crack-dark {
    animation: none;
  }
  .d-piece {
    cursor: default;
    touch-action: auto;
  }
  .d-see,
  .d-see svg,
  .d-close,
  .d-node-dot,
  .d-item,
  .d-skill-chip {
    transition:
      color 150ms,
      background-color 150ms,
      border-color 150ms;
  }
  .d-close:hover,
  .d-item:hover,
  .d-skill-chip:hover {
    transform: none;
  }
}

/* Painel aberto no toque: a página de trás não rola junto (iOS). */
@media (hover: none) {
  html:has(.d-dialog[open]) {
    overflow: hidden;
  }
}

/* ---- Celular: carrossel de cards empilhados ----------------------------------
   O card do centro fica grande; os vizinhos ficam atrás, menores e mais escuros,
   aparecendo um pouco de cada lado. Arrastar para o lado troca: o do centro encolhe
   e vai para trás, o de trás cresce e vem para frente. Posições vindas do dev.js
   (--x, --s, --b, z-index). Tocar no do centro abre o painel; num de trás, traz para o centro. */
.d-grid.is-carousel {
  /* Limitado também pela altura: celular deitado não pode estourar a tela. */
  --cs: clamp(220px, min(100cqi - 48px, 100svh - 220px), 360px);
  display: block;
  position: relative;
  height: var(--cs);
  touch-action: pan-y;
  user-select: none;
}
.d-grid.is-carousel > .d-host {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--cs);
  height: var(--cs);
  margin-left: calc(var(--cs) / -2);
  transform: translateX(calc(var(--x, 0) * 1%)) scale(var(--s, 1));
  transition: transform 560ms cubic-bezier(0.34, 1.2, 0.5, 1);
  /* Card baixo (celular deitado, 320px): menos respiro para tudo caber. */
  container: d-card / size;
}
/* Os de trás escurecem com uma camada preta (preto a 28% = brightness .72): só a
   opacidade anima, sem repintar o card a cada quadro. */
.d-grid.is-carousel > .d-host::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: #000000;
  opacity: calc(1 - var(--b, 1));
  pointer-events: none;
  transition: opacity 360ms var(--ease-out);
}
/* Arrastando: todos seguem o dedo na hora; ao soltar, a mola leva cada um ao lugar. */
.d-grid.is-carousel[data-dragging] > .d-host,
.d-grid.is-carousel[data-dragging] > .d-host::after {
  transition: none;
}
.d-grid.is-carousel {
  -webkit-touch-callout: none;
}
/* O painel é filho do card no DOM: não herda o bloqueio de seleção e de toque longo. */
.d-grid.is-carousel .d-dialog {
  user-select: text;
  -webkit-touch-callout: default;
}
.d-grid.is-carousel > .d-host:not([data-center]) {
  cursor: pointer;
}
.d-grid.is-carousel > .d-host:not([data-center]) .d-card {
  pointer-events: none;
}
.d-grid.is-carousel .d-card {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.d-grid.is-carousel .d-tilt-host {
  height: 100%;
}
.d-grid.is-carousel .d-topic {
  min-height: 0;
  padding: 26px;
}
.d-grid.is-carousel .d-topic-out {
  top: 27px;
  right: 24px;
}
@container d-card (max-height: 250px) {
  .d-grid.is-carousel .d-topic,
  .d-grid.is-carousel .d-stacks {
    padding: 20px;
  }
  .d-grid.is-carousel .d-stacks {
    gap: 8px;
  }
  .d-grid.is-carousel .d-topic-out {
    top: 21px;
    right: 18px;
  }
}
/* Pontos embaixo: indicam o card atual; tocar leva até o card. */
.d-dots {
  display: none;
  justify-content: center;
  /* A área de toque passa 8px acima e abaixo do ponto: a margem negativa mantém o layout. */
  margin-block: -2px -8px;
}
.d-grid.is-carousel + .d-dots {
  display: flex;
}
/* O ponto visível é pequeno; a área de toque tem o mínimo de 44px. */
.d-dot {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.d-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: var(--text-3);
  transition:
    width 380ms cubic-bezier(0.32, 0.72, 0, 1),
    background-color 260ms ease,
    box-shadow 160ms;
}
.d-dot[aria-current='true']::before {
  width: 20px;
  background: var(--accent);
}
/* Sem quadrado de foco no toque; no teclado, um anel em volta do próprio ponto. */
.d-dot:focus {
  outline: none;
}
.d-dot:focus-visible::before {
  box-shadow:
    0 0 0 2px var(--page),
    0 0 0 4px var(--focus);
}
@media (prefers-reduced-motion: reduce) {
  .d-grid.is-carousel > .d-host {
    transition: none;
  }
  .d-grid.is-carousel > .d-host::after {
    transition: opacity 150ms;
  }
  .d-dot::before {
    transition: none;
  }
}

/* Celular: na caixa de Stacks os ícones ficam parados (a caixa arrasta de lado para trocar de card). */
.d-grid.is-carousel .d-piece {
  touch-action: pan-y;
  cursor: inherit;
  transition: none;
}
/* Card estreito: o nome das peças das pontas abre para dentro, sem cortar na borda. */
.d-grid.is-carousel .d-name {
  --ax: calc(0.5 + var(--edge, 0) * 0.3);
}
/* Tocar num ícone só mostra o nome, sem o ícone pular. */
.d-grid.is-carousel .d-piece[data-active] {
  transform: rotate(var(--r));
}
.d-grid.is-carousel .d-broken {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}

/* Pontinhos: segurando e arrastando, a área cresce numa cápsula (como no iPhone). */
.d-dots {
  width: max-content;
  margin-inline: auto;
  padding: 2px 6px;
  border-radius: 999px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  isolation: isolate;
  transition: transform 360ms cubic-bezier(0.32, 0.72, 0, 1);
}
/* A cápsula fica na altura dos pontos, não da área de toque. */
.d-dots::before {
  content: '';
  position: absolute;
  inset: 8px 0;
  z-index: -1;
  border-radius: 999px;
  transition: background-color 260ms ease;
}
.d-dots[data-scrub]::before {
  background: var(--surface-2);
}
.d-dots[data-scrub] {
  transform: scale(1.08);
}
.d-dot {
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .d-dots,
  .d-dots::before {
    transition: none;
  }
}
