/* Etapa 2: the original h1, portal effects, icons and scene remain unchanged.
 * Reserve only the extra height needed by MANAGER. Compensate the original
 * identity translation so the kicker and h1 retain their original position.
 */
.identity {
  --sg-manager-size: clamp(1.875rem, calc(1.25rem + 1.15vw), 2.625rem);
  --sg-manager-room: calc(var(--sg-manager-size) * 1.1 - 0.6rem);
  margin-top: calc(var(--sg-manager-room) * 0.48);
}

.identity-manager {
  height: var(--sg-manager-room);
}

.identity-manager > span {
  top: 0.3rem;
  padding-left: 0.44em;
  font-size: var(--sg-manager-size);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.44em;
  color: #ead3a7;
  text-shadow: 0 0 3px rgba(234, 211, 167, 0.12);
}

body.world-visible .identity {
  margin-top: calc(var(--sg-manager-room) * 0.5);
}

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .identity-manager > span {
    background-image: linear-gradient(105deg, #d8ba80 0%, #ead3a7 24%, #fff0d5 48%, #e9d9ba 60%, #d9cddf 72%, #dfbf83 100%);
    background-size: 180% 100%;
    background-position: 0% 50%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }

  /* One quiet reflection on entry, painted exclusively inside the glyphs. */
  body.world-visible .identity-manager > span {
    animation: sg-manager-reflection 800ms ease-out 1 both;
  }
}

@keyframes sg-manager-reflection {
  from { background-position: 100% 50%; }
  to { background-position: 0% 50%; }
}

@media (max-width: 600px) {
  .identity { --sg-manager-size: clamp(1.375rem, 5.8vw, 1.625rem); }
  .identity-manager > span { top: 0.125rem; }
}

@media (max-height: 640px) and (orientation: landscape) {
  .identity { margin-top: calc(var(--sg-manager-room) * 0.52); }
}

@media (max-height: 600px) and (orientation: landscape) {
  .identity { --sg-manager-size: clamp(1.375rem, 3vw, 1.875rem); }
  .identity-manager > span { top: 0.12rem; }
}

@media (prefers-reduced-motion: reduce) {
  .identity-manager > span { animation: none !important; }
}

body.world-reduced .identity-manager > span,
body.reduced-experience .identity-manager > span {
  animation: none !important;
}

@media (forced-colors: active) {
  .identity-manager > span {
    background: none !important;
    color: CanvasText !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
    animation: none !important;
  }
}

/* Stage 3: isolated readability and compact-screen corrections.
 * Appended to the existing stylesheet to avoid an additional blocking request.
 * Original H1, MANAGER, portal effects and scene rules above are unchanged. */
body.world-visible .identity-kicker {
  color: #fff2d7;
  text-shadow: 0 1px 2px rgba(2, 8, 12, .95);
}
body.world-visible .slogan {
  color: #fff6e7;
  text-shadow: 0 1px 2px rgba(2, 8, 12, .9);
}
.portal-nav .portal-label {
  text-shadow: 0 1px 2px rgba(2, 8, 12, .9);
}
.portal-nav .portal-link:focus-visible {
  outline: 2px solid #ffe4b3;
  outline-offset: 3px;
}
.talent-portal-legal a { color: #e6e5d7; font-size: .6875rem; min-height: 44px; }
.talent-portal-signature > span:last-child { color: #bac9b7; }

@media (max-width: 600px) {
  /* Fixed line box keeps the approved H1 and menu coordinates unchanged. */
  body.world-visible .identity-kicker { font-size: .6rem; line-height: 9px; letter-spacing: .18em; }
  .talent-portal-legal { column-gap: .9rem; }
}
@media (max-width: 600px) and (max-height: 650px) and (orientation: portrait) {
  .talent-book-float { top: max(.35rem, env(safe-area-inset-top)); }
  .world-coordinate { top: max(3.3rem, calc(env(safe-area-inset-top) + 3.1rem)); }
}
@media (max-height: 600px) and (orientation: landscape) {
  .talent-book-float { top: max(.6rem, env(safe-area-inset-top)); }
  .world-coordinate { right: max(13.4rem, calc(env(safe-area-inset-right) + 12.5rem)); }
}
@media (max-width: 600px) and (max-height: 600px) and (orientation: landscape) {
  .world-coordinate { right: max(9.5rem, calc(env(safe-area-inset-right) + 9rem)); }
}
@media (forced-colors: active) {
  body.world-visible .identity-kicker,
  body.world-visible .slogan,
  .talent-portal-legal a,
  .talent-portal-signature > span:last-child { color: CanvasText; text-shadow: none; }
  .portal-nav .portal-link:focus-visible { outline-color: Highlight; }
}

/* At very short, narrow landscape sizes the approved title is taller than
 * the available space. Scroll only the existing identity, keeping world,
 * header, footer and all seven original destinations intact. */
@media (max-width: 600px) and (max-height: 400px) and (orientation: landscape) {
  body.world-visible .identity {
    top: max(4.5rem, calc(env(safe-area-inset-top) + 4rem));
    max-height: calc(100svh - 10.5rem);
    margin-top: 0;
    padding-bottom: .75rem;
    transform: translateX(-50%);
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: auto;
    scrollbar-width: thin;
    scroll-padding-block: .5rem;
  }
  .portal-nav { height: auto; }
  .portal-list { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Let the existing portal heading wrap instead of introducing horizontal
 * scrolling on the smallest supported viewport. Main identity is unaffected. */
@media (max-width: 370px) {
  .portal-dialog .talent-portal-heading h2 { white-space: normal; }
}

/* Separate the existing credits label from the signature in compact landscape. */
@media (min-width: 601px) and (max-width: 740px) and (max-height: 600px) and (orientation: landscape) {
  .experience-footer .credits-trigger { right: 7rem; }
}
