/**
 * Skyy V1 — cardless public profile layout layer.
 * One invisible structural stack over the site background; no card surface.
 */

body[data-profile-layout="v1"][data-view="app"] {
  --v1-stack-width: min(480px, calc(100vw - 40px));
  --v1-stack-gap: 16px;
  --v1-identity-gap: 10px;
  --v1-module-gap: 12px;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body[data-profile-layout="v1"][data-view="app"] #app-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  align-items: stretch;
  justify-content: stretch;
}

/* ── Hide legacy card chrome + slide UI ── */
body[data-profile-layout="v1"] .profile-owner-controls,
body[data-profile-layout="v1"] .card-nav,
body[data-profile-layout="v1"] .stats-card,
body[data-profile-layout="v1"] .profile-card__background,
body[data-profile-layout="v1"] .card-border-glow,
body[data-profile-layout="v1"] .profile-links-add-btn,
body[data-profile-layout="v1"] .profile-identities-add-btn,
body[data-profile-layout="v1"] .profile-links-layout-btn,
body[data-profile-layout="v1"] .showcase-layout-btn,
body[data-profile-layout="v1"] .showcase-edit-btn,
body[data-profile-layout="v1"] .showcase-swipe-hint,
body[data-profile-layout="v1"] .profile-assembly {
  display: none !important;
}

/* ── Page canvas — one fixed screen, no document scroll ── */
body[data-profile-layout="v1"] .profile-card-stack {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    max(56px, calc(env(safe-area-inset-top) + 40px))
    20px
    max(40px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  pointer-events: none;
  overflow: hidden;
}

body[data-profile-layout="v1"] .showcase-stage {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

body[data-profile-layout="v1"] .profile-card-stack > * {
  pointer-events: auto;
}

/* ── Core stack ── */
body[data-profile-layout="v1"] .v1-transition-viewport {
  pointer-events: auto;
}

body[data-profile-layout="v1"] .v1-profile-panel,
body[data-profile-layout="v1"] .v1-profile-composition,
body[data-profile-layout="v1"] .v1-profile-stack {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}

body[data-profile-layout="v1"] .v1-profile-composition {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--v1-stack-gap);
  width: 100%;
  max-height: 100%;
  overflow: visible;
}

body[data-profile-layout="v1"] .v1-showcase-composition {
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: visible;
}

body[data-profile-layout="v1"] .v1-identity,
body[data-profile-layout="v1"] .v1-links,
body[data-profile-layout="v1"] .v1-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: static;
  transform: none;
}

/* Optional modules with no visible content leave the layout entirely */
body[data-profile-layout="v1"] .v1-profile-composition > [data-v1-empty="true"],
body[data-profile-layout="v1"] .v1-identity > [data-v1-empty="true"] {
  display: none !important;
}

/* ── Identity header ── */
body[data-profile-layout="v1"] .v1-identity {
  gap: var(--v1-identity-gap);
  text-align: center;
}

body[data-profile-layout="v1"] .v1-avatar-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

body[data-profile-layout="v1"] .v1-avatar-wrap .avatar-wrapper {
  margin: 0;
}

body[data-profile-layout="v1"] .v1-avatar-wrap .avatar-frame {
  --avatar-size: 112px;
  position: relative;
  margin: 0 auto;
}

body[data-profile-layout="v1"] .v1-name-row {
  width: 100%;
}

body[data-profile-layout="v1"] .v1-name-row .username {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.15;
  max-width: 100%;
  word-break: break-word;
  text-shadow:
    0 1px 10px rgba(0, 0, 0, 0.55),
    0 2px 24px rgba(0, 0, 0, 0.35);
}

body[data-profile-layout="v1"] .v1-badges {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
}

body[data-profile-layout="v1"] .v1-badges .profile-identities {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  overflow: visible;
}

body[data-profile-layout="v1"] .profile-identities-row {
  overflow: visible;
}

body[data-profile-layout="v1"] .v1-identity .bio {
  margin: 0;
  max-width: 36ch;
  font-size: 15px;
  line-height: 1.55;
  opacity: 0.92;
  color: var(--profile-site-text-color, #ffffff);
  text-shadow:
    0 1px 8px rgba(0, 0, 0, 0.5),
    0 2px 18px rgba(0, 0, 0, 0.32);
}

body[data-profile-layout="v1"] .v1-identity .bio:empty,
body[data-profile-layout="v1"] .v1-identity .bio[hidden] {
  display: none;
}

body[data-profile-layout="v1"] .v1-links .custom-link-pill__title-label {
  color: var(--profile-link-text-color, #ffffff);
}

/* Badge label text — no shadow (overflow clip was causing square artifacts) */
body[data-profile-layout="v1"] .identity-pill__label {
  text-shadow: none;
}

/* Level hidden on V1 public profile — backend/components preserved */
body[data-profile-layout="v1"] #profile-level-overlay,
body[data-profile-layout="v1"] .v1-level {
  display: none !important;
}

/* ── Links ── */
body[data-profile-layout="v1"] .v1-links {
  gap: var(--v1-module-gap);
  margin: 0;
  padding: 0;
}

body[data-profile-layout="v1"] .v1-links .profile-links-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--v1-module-gap);
  margin: 0;
  padding-inline: 14px;
  box-sizing: border-box;
  overflow: visible;
}

body[data-profile-layout="v1"] .v1-links .profile-custom-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--v1-module-gap);
}

body[data-profile-layout="v1"] .v1-links .profile-custom-links .profile-link-btn:first-child,
body[data-profile-layout="v1"] .v1-links .profile-custom-links .profile-link-card:first-child .profile-link-btn {
  min-height: 56px;
  font-size: 1.05em;
}

body[data-profile-layout="v1"] .v1-links .profile-custom-links .profile-link-btn,
body[data-profile-layout="v1"] .v1-links .profile-custom-links .profile-link-card .profile-link-btn {
  min-height: 52px;
  width: 100%;
}

/* ── Socials (inside identity cluster) ── */
body[data-profile-layout="v1"] .v1-identity .v1-socials {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 8px;
  margin: 0;
  padding: 0;
}

body[data-profile-layout="v1"] .v1-identity .v1-socials .profile-social-column {
  position: static;
  top: auto;
  right: auto;
  left: auto;
  transform: none;
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0;
}

/* ── Showcase — dedicated state module ── */
body[data-profile-layout="v1"] .v1-showcase-panel .showcase-identity-header {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  margin: 0 auto 8px;
  transition: none;
}

body[data-profile-layout="v1"] .v1-showcase {
  gap: 10px;
  margin-top: 4px;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-card {
  position: static;
  inset: auto;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible;
  transform: none !important;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-card > .card-border-glow {
  display: none !important;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-card__inner {
  gap: 10px;
  width: 100%;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-card__intro {
  padding: 0;
  text-align: center;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-card__title {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

body[data-profile-layout="v1"] .v1-showcase .showcase-carousel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__viewport {
  width: 100%;
  aspect-ratio: var(--showcase-aspect-ratio, 1 / 1);
  height: auto;
  max-height: none;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
  background: #0a0a0c;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__viewport[data-display-ratio="9:16"] {
  width: min(100%, calc(min(520px, 58vh) * 9 / 16));
  max-height: min(520px, 58vh);
  margin-inline: auto;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__media,
body[data-profile-layout="v1"] .v1-showcase .showcase-media-card--carousel,
body[data-profile-layout="v1"] .v1-showcase .showcase-audio-card--carousel {
  background: #0a0a0c;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__media img,
body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__media video,
body[data-profile-layout="v1"] .v1-showcase .showcase-media-card__image--cover,
body[data-profile-layout="v1"] .v1-showcase .showcase-media-card__video--cover,
body[data-profile-layout="v1"] .v1-showcase .showcase-media-card__video {
  object-fit: cover;
  object-position: center;
}

body[data-profile-layout="v1"] .v1-showcase .showcase-empty-state,
body[data-profile-layout="v1"] .v1-showcase .showcase-owner-empty {
  text-align: center;
  padding: 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Neutralize legacy card-stage slide mechanics */
body[data-profile-layout="v1"] .card-stage-viewport,
body[data-profile-layout="v1"] .card-stage-track {
  overflow: visible;
  height: auto !important;
  transform: none !important;
  transition: none !important;
}

body[data-profile-layout="v1"] .profile-card,
body[data-profile-layout="v1"] .card-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ── Profile entrance ── */
body[data-profile-layout="v1"] .v1-profile-stack {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 600ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-profile-layout="v1"] .v1-profile-stack.is-revealed {
  opacity: 1;
  transform: none;
}

body[data-profile-layout="v1"][data-entrance="blur"] .v1-profile-stack {
  filter: blur(12px);
  transform: none;
}

body[data-profile-layout="v1"][data-entrance="blur"] .v1-profile-stack.is-revealed {
  filter: blur(0);
}

body[data-profile-layout="v1"][data-entrance="instant"] .v1-profile-stack {
  opacity: 1;
  transform: none;
  transition: none;
}

body[data-profile-layout="v1"][data-entrance="digital"] .v1-profile-stack {
  opacity: 0;
  transform: scale(1.02);
  filter: saturate(0.4) contrast(1.1);
  clip-path: inset(0 0 100% 0);
  transition:
    opacity 700ms ease,
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 700ms ease,
    clip-path 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-profile-layout="v1"][data-entrance="digital"] .v1-profile-stack.is-revealed {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: inset(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  body[data-profile-layout="v1"] .v1-profile-stack {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  body[data-profile-layout="v1"][data-view="app"] {
    --v1-stack-width: min(480px, calc(100vw - 32px));
  }

  body[data-profile-layout="v1"] .profile-card-stack {
    padding:
      max(52px, calc(env(safe-area-inset-top) + 36px))
      16px
      max(32px, env(safe-area-inset-bottom));
  }

  body[data-profile-layout="v1"] .v1-avatar-wrap .avatar-frame {
    --avatar-size: 96px;
  }

  body[data-profile-layout="v1"] .v1-name-row .username {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  body[data-profile-layout="v1"] .v1-showcase .showcase-carousel__viewport[data-display-ratio="9:16"] {
    width: min(100%, calc(min(420px, 52vh) * 9 / 16));
    max-height: min(420px, 52vh);
  }

  body[data-profile-layout="v1"] .v1-showcase-panel {
    margin-top: -16px;
  }
}
