:root {
  color-scheme: light;
  /* Paleta oficial do portfólio */
  --color-background: #cabbaf;
  --color-text-primary: #302c29;
  --color-text-secondary: #554a42;
  --color-bronze: #92745b;
  --color-champagne: #e8d9c7;
  --color-ivory: #f5efe8;
  --color-petroleum: #344e49;
  --color-sage: #81988d;
  --color-shadow: #59483b;

  background-color: var(--color-background);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
}

.portfolio-stage {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(100%, 1920px);
  height: min(100%, 1080px);
  container-type: size;
  overflow: hidden;
  isolation: isolate;
}

/* Camada fixa e decorativa: não interfere nos cliques do conteúdo. */
.site-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--color-background);
}

.site-background__portrait {
  position: absolute;
  z-index: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: auto;
  height: 100%;
}

.site-background__typography {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: block;
  width: 40%;
  max-width: 1080px;
  height: auto;
  object-fit: contain;
  object-position: top right;
}

/* Todo conteúdo futuro fica acima da foto, inclusive ao rolar a página. */
.site-content {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
}

.bubble-scene {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 56%;
  width: min(60cqw, 94cqh, 1100px);
  aspect-ratio: 10 / 9;
  transform: translate(-50%, -50%);
}

.logo-carousel {
  position: absolute;
  z-index: 0;
  left: 20%;
  right: 0;
  bottom: calc(8% + 20px);
  height: clamp(2.5rem, 7cqh, 5rem);
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(to right, transparent, #000 150px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 150px);
}

.logo-carousel__track {
  display: flex;
  width: max-content;
  height: 100%;
  animation: logos-scroll var(--duration, 30s) linear infinite;
}

.logo-carousel__group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 30px;
  padding-right: 30px;
  height: 100%;
}

.logo-carousel__group img {
  display: block;
  flex: none;
  height: 100%;
  width: auto;
  object-fit: contain;
  opacity: .33;
}

@keyframes logos-scroll {
  to { transform: translateX(calc(-1 * var(--loop-width))); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-carousel__track { animation: none; }
}

/* Cada disco desfoca o cenário e as bolhas desenhadas antes dele. */
.bubble {
  --glass-blur: 5px;
  --glass-edge: 1px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--diameter);
  height: var(--diameter);
  border: 0;
  border-radius: 50%;
  padding: 0;
  background:
    radial-gradient(ellipse at 50% 105%, color-mix(in srgb, var(--color-ivory) 40.6%, transparent), transparent 65%),
    radial-gradient(ellipse at 47% -14%, color-mix(in srgb, var(--color-champagne) 25.9%, transparent), transparent 58%),
    linear-gradient(165deg, color-mix(in srgb, var(--color-shadow) 8.82%, transparent), color-mix(in srgb, var(--color-champagne) 12.25%, transparent));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(.85);
  backdrop-filter: blur(var(--glass-blur)) saturate(.85);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--color-shadow) 16.8%, transparent),
    0 8px 19px -4px color-mix(in srgb, var(--color-shadow) 26%, transparent),
    inset 0 6px 14px -7px color-mix(in srgb, var(--color-shadow) 26.6%, transparent);
}

/* Um único contorno, com reflexos graduais no topo e na base. */
.bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: var(--glass-edge);
  background: conic-gradient(
    from -18deg,
    var(--color-ivory),
    var(--color-champagne) 46deg,
    color-mix(in srgb, var(--color-shadow) 33.6%, transparent) 105deg,
    var(--color-champagne) 166deg,
    var(--color-ivory) 199deg,
    color-mix(in srgb, var(--color-shadow) 31.5%, transparent) 273deg,
    var(--color-champagne) 330deg,
    var(--color-ivory)
  );
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.bubble--satellite {
  pointer-events: none;
  box-shadow:
    0 0 0 .5px color-mix(in srgb, var(--color-shadow) 16.8%, transparent),
    0 3px 8px color-mix(in srgb, var(--color-shadow) 21%, transparent);
}

.bubble-topic {
  --glass-blur: clamp(9px, 1.15vw, 16px);
  --glass-edge: 1.5px;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bubble-topic[aria-pressed="true"] {
  --glass-blur: clamp(12px, 1.45vw, 22px);
}

.bubble-topic::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: radial-gradient(ellipse at 51% 27%, var(--color-ivory), var(--color-champagne) 56%, transparent 83%);
  opacity: 0;
  transition: opacity 360ms ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .bubble-topic[aria-pressed="true"]:hover::after {
    opacity: .22;
  }
}

.bubble-topic__label {
  position: relative;
  z-index: 1;
  font-family: "Poppins", sans-serif;
  font-weight: 200;
  font-size: var(--label-size, 16px);
  line-height: 1.23;
  letter-spacing: .025em;
  color: color-mix(in srgb, var(--color-text-secondary) 80%, transparent);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.bubble-topic:focus-visible {
  outline: 2px solid var(--color-bronze);
  outline-offset: 4px;
}

.bubble-topic__click-hint {
  position: absolute;
  z-index: 2;
  top: 62%;
  left: 50%;
  width: 27%;
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.language-switcher {
  position: absolute;
  z-index: 5;
  right: max(1.5cqw, env(safe-area-inset-right));
  bottom: max(2cqh, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: .3rem;
}

.contact-link {
  margin-right: calc(48px - .3rem);
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 14pt;
  line-height: 1.3;
  color: #554a42;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

.contact-link:focus-visible {
  outline: 2px solid var(--color-bronze);
  outline-offset: 4px;
}

.language-switcher__button {
  display: grid;
  place-items: center;
  width: clamp(2.5rem, 3.5vw, 3.25rem);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.language-switcher__button img {
  display: block;
  width: 65%;
  height: 65%;
  object-fit: contain;
  opacity: .65;
  transition: opacity 200ms ease, filter 200ms ease;
}

.language-switcher__button[aria-pressed="true"] img,
.language-switcher__button:hover img {
  opacity: 1;
  filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--color-shadow) 35%, transparent));
}

.language-switcher__button:focus-visible {
  outline: 2px solid var(--color-bronze);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bubble-topic::after {
    transition: none;
  }
}

@media (max-width: 767px) {
  .logo-carousel {
    left: 15%;
    right: 0;
    bottom: 10%;
    height: clamp(2rem, 5vh, 3rem);
  }
  .language-switcher {
    right: max(2vw, env(safe-area-inset-right));
    bottom: max(1.5cqh, env(safe-area-inset-bottom));
    gap: 0;
  }

  .language-switcher__button {
    width: clamp(2.75rem, 12vw, 3.25rem);
  }

  .contact-link {
    margin-right: 36px;
    transform: translateX(12px);
    font-size: 12pt;
  }

  .bubble-scene {
    left: 52%;
    top: 56%;
    width: min(102cqw, 78cqh);
  }

  .site-background__portrait {
    height: 70%;
  }

  .site-background__typography {
    width: 70%;
    max-height: 35%;
  }
}

.bubble-halo {
  position: absolute;
  border-radius: 50%;
  padding: clamp(3px, 1cqh, 10px);
  background: linear-gradient(135deg, #3198ad 20%, #3fc38e 53%, #e4e72b 92%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  filter: blur(8px);
  pointer-events: none;
  z-index: 3;
}

.portfolio-stage[data-view] .bubble-topic {
  pointer-events: none;
}

.portfolio-stage[data-view] .bubble-topic::after {
  opacity: 0;
}

.portfolio-stage:is([data-view="arrived"], [data-view="section"], [data-view="leaving"]) :is(.site-background, .bubble-scene, .logo-carousel) {
  visibility: hidden;
}

.portfolio-stage:is([data-view="arrived"], [data-view="section"], [data-view="leaving"]) .logo-carousel__track {
  animation-play-state: paused;
}

.section-scene {
  --section-diameter: min(92cqh, 66cqw);
  --section-radius: calc(var(--section-diameter) / 2);
  --back-size: clamp(46px, 7.6cqh, 82px);
  position: absolute;
  inset: 0;
  z-index: 2;
  visibility: hidden;
}

.portfolio-stage:is([data-view="arrived"], [data-view="section"], [data-view="leaving"]) .section-scene {
  visibility: visible;
}

.section-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 35% 43% at 86% 85%, #d9c7ba, transparent 75%);
}

.portfolio-stage:is([data-view="arrived"], [data-view="section"], [data-view="leaving"]) .section-glow {
  opacity: 1;
}

.bubble-topic__return-label {
  position: absolute;
  inset: 0;
  align-content: center;
}

.section-disc {
  --diameter: var(--section-diameter);
  --glass-edge: 1.5px;
  --glass-blur: clamp(12px, 1.45vw, 22px);
  left: calc(50% - var(--section-radius));
  top: calc(50% - var(--section-radius));
  display: grid;
  place-items: center;
  z-index: 2;
  --label-size: clamp(20px, var(--section-diameter) * .065, 66px);
}

.section-title {
  margin: 0;
}

.section-back {
  --diameter: var(--back-size);
  left: max(20px, calc(50% - var(--section-radius) * .82 - var(--back-size) / 2));
  top: max(18px, calc(50% - var(--section-radius) * .84 - var(--back-size) / 2));
  display: grid;
  place-items: center;
  z-index: 3;
  cursor: pointer;
}

.section-back img {
  width: 54%;
  height: auto;
  opacity: 0;
}

.section-back:focus-visible,
.section-playback:focus-visible {
  outline: 2px solid var(--color-petroleum);
  outline-offset: 4px;
}

.section-satellite {
  left: calc(var(--x) * 1% - var(--diameter) / 2);
  top: calc(var(--y) * 1% - var(--diameter) / 2);
  --diameter: calc(var(--size) * min(1cqw, 1.75cqh));
  filter: blur(var(--softness));
  opacity: var(--visibility);
}

.section-media {
  position: absolute;
  inset: var(--glass-edge);
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  visibility: hidden;
  background-color: var(--color-petroleum);
  z-index: 2;
}

.section-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section-playback {
  position: absolute;
  inset: 22%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: white;
  font-size: clamp(24px, 5cqw, 46px);
  cursor: pointer;
}

.section-playback::after {
  content: attr(data-symbol) / "";
  opacity: 0;
  text-shadow: 0 1px 8px #000;
}

.section-playback:is(:focus-visible, [data-paused])::after {
  opacity: 1;
}

.section-dot {
  position: absolute;
  bottom: 4%;
  left: 50%;
  translate: -50% 0;
  width: clamp(9px, 1.25cqw, 20px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-champagne);
  border: 1px solid var(--color-bronze);
  pointer-events: none;
}

.section-caption {
  position: absolute;
  top: 56%;
  left: calc(50% + var(--section-radius) + 2cqw);
  right: 5cqw;
  margin: 0;
  color: var(--color-text-secondary);
  font: 300 clamp(14px, 1.48cqw, 29px) / 1.28 "Poppins", sans-serif;
  opacity: 0;
  visibility: hidden;
}

:is([data-view="section"], [data-view="leaving"]) :is(.section-media, .section-caption, .section-back img) {
  visibility: visible;
  opacity: 1;
}

[data-view="section"] :is(.section-media, .section-caption, .section-back img) {
  transition: opacity 520ms ease;
}

:is([data-view="section"], [data-view="leaving"]) .section-title {
  opacity: 0;
}

[data-view="section"] .section-title {
  transition: opacity 360ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .section-playback:hover::after { opacity: 1; }
}

@media (max-aspect-ratio: 6/5) {
  .section-scene {
    --section-diameter: min(94cqw, calc(100cqh - clamp(164px, 26cqh, 245px)));
    --back-size: clamp(44px, 10cqw, 60px);
  }

  .section-back {
    left: max(5cqw, env(safe-area-inset-left));
    top: max(3.6cqh, env(safe-area-inset-top));
  }

  .section-caption {
    top: max(4.1cqh, env(safe-area-inset-top));
    left: calc(max(5cqw, env(safe-area-inset-left)) + var(--back-size) + 14px);
    right: 5cqw;
    font-size: clamp(13px, min(4.1cqw, 2.3cqh), 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-view="section"] :is(.section-media, .section-caption, .section-back img, .section-title) {
    transition: none;
  }
}
