/* =========================================================
   DEMONSTRAÇÃO — pode remover este bloco ao integrar.
   ========================================================= */

.demo-page {
  min-width: 320px;
  margin: 0;
  background: #ffffff;
  color: #050505;
  font-family: "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* =========================================================
   COMPONENTE
   Todo o CSS abaixo está isolado pelas classes do componente.
   ========================================================= */

.agatha-projects,
.agatha-projects * {
  box-sizing: border-box;
}

.agatha-projects {
  --agatha-purple: #4a00ff;
  --agatha-black: #050505;
  --agatha-card-radius: clamp(1.1rem, 1.8vw, 1.75rem);
  --agatha-ease: cubic-bezier(0.22, 1, 0.36, 1);

  width: 100%;
  max-width: 120rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 4.4vw, 4.5rem);
  font-family: "Inter Variable", "Inter", Arial, sans-serif;
}

.agatha-projects__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 2rem);
}

.project-card {
  min-width: 0;
}

.project-card--wide {
  grid-column: span 7;
}

.project-card--narrow {
  grid-column: span 5;
}

.project-card__link {
  display: block;
  border-radius: var(--agatha-card-radius);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.project-card__link:focus-visible {
  outline: 3px solid var(--agatha-purple);
  outline-offset: 7px;
}

.project-card__surface {
  --card-background: #f0edff;
  --card-foreground: #090909;
  --card-line: rgba(74, 0, 255, 0.18);
  --interface-background: rgba(255, 255, 255, 0.54);
  --interface-shadow: rgba(0, 0, 0, 0.16);

  position: relative;
  display: grid;
  min-height: clamp(30rem, 42vw, 39rem);
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  padding: clamp(1.25rem, 2.4vw, 2.25rem);
  border-radius: var(--agatha-card-radius);
  color: var(--card-foreground);
  background: var(--card-background);
  isolation: isolate;
  contain: paint;
  transform: translateZ(0);
}

/* Temas exatos dos quatro cards */

.project-card__surface--diamond {
  --card-background: #f0edff;
  --card-foreground: #090909;
  --card-line: rgba(74, 0, 255, 0.18);
  --interface-background: rgba(255, 255, 255, 0.55);
}

.project-card__surface--galilei {
  --card-background: #090909;
  --card-foreground: #ffffff;
  --card-line: rgba(255, 255, 255, 0.19);
  --interface-background: rgba(255, 255, 255, 0.1);
  --interface-shadow: rgba(0, 0, 0, 0.35);
}

.project-card__surface--correa {
  --card-background: #e8edef;
  --card-foreground: #0b0c0d;
  --card-line: rgba(11, 12, 13, 0.16);
  --interface-background: rgba(255, 255, 255, 0.42);
}

.project-card__surface--avorya {
  --card-background: #4a00ff;
  --card-foreground: #ffffff;
  --card-line: rgba(255, 255, 255, 0.25);
  --interface-background: rgba(255, 255, 255, 0.1);
  --interface-shadow: rgba(0, 0, 0, 0.24);
}

/* Círculos editoriais do fundo */

.project-card__surface::before,
.project-card__surface::after {
  position: absolute;
  z-index: -1;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.project-card__surface::before {
  top: -30%;
  right: -16%;
  width: min(72%, 38rem);
  aspect-ratio: 1;
}

.project-card__surface::after {
  bottom: -45%;
  left: -20%;
  width: min(66%, 32rem);
  aspect-ratio: 1;
}

/* Cabeçalho */

.project-card__topline,
.project-card__bottom {
  position: relative;
  z-index: 4;
}

.project-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

/* Arte central */

.project-card__art {
  position: relative;
  z-index: 2;
  min-height: 0;
}

.project-card__letter {
  position: absolute;
  top: 50%;
  left: 2%;
  color: currentColor;
  font-size: clamp(12rem, 24vw, 24rem);
  font-weight: 790;
  letter-spacing: -0.14em;
  line-height: 0.72;
  opacity: 0.94;
  transform: translateY(-50%);
}

.project-card__surface--galilei .project-card__letter,
.project-card__surface--avorya .project-card__letter {
  opacity: 0.86;
}

/* Mockup de interface */

.project-card__interface {
  position: absolute;
  top: 50%;
  right: -5%;
  width: min(54%, 24rem);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--card-line);
  border-radius: 0.9rem;
  background: var(--interface-background);
  box-shadow: 0 1.75rem 4rem var(--interface-shadow);
  transform: translateY(-42%) rotate(-4deg);
  transition: transform 650ms var(--agatha-ease);
}

.project-card__surface--correa .project-card__interface {
  transform: translateY(-48%) rotate(3deg);
}

.project-card__browser-bar {
  display: flex;
  height: 13%;
  align-items: center;
  gap: 0.3rem;
  padding-inline: 0.8rem;
  border-bottom: 1px solid var(--card-line);
}

.project-card__browser-bar i {
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}

.project-card__interface-body {
  display: grid;
  height: 87%;
  grid-template-columns: 28% 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 0.55rem;
  padding: 0.75rem;
}

.project-card__interface-body b {
  grid-row: 1 / -1;
  border-radius: 0.4rem;
  background: currentColor;
  opacity: 0.11;
}

.project-card__interface-body span {
  border: 1px solid var(--card-line);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
}

.project-card__interface-body span:first-of-type {
  border-color: transparent;
  background: var(--agatha-purple);
  opacity: 0.9;
}

.project-card__surface--avorya
  .project-card__interface-body
  span:first-of-type {
  background: #ffffff;
}

/* Rodapé do card */

.project-card__bottom {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.project-card__bottom small {
  display: block;
  margin-bottom: 0.65rem;
  font-size: 0.68rem;
  font-weight: 590;
  letter-spacing: 0.025em;
  line-height: 1.35;
  opacity: 0.67;
}

.project-card__bottom h2 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 3.85rem);
  font-weight: 700;
  letter-spacing: -0.068em;
  line-height: 0.92;
}

.project-card__arrow {
  display: grid;
  width: 3.65rem;
  height: 3.65rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition:
    color 250ms ease,
    background-color 250ms ease,
    transform 450ms var(--agatha-ease);
}

.project-card__surface--galilei .project-card__arrow {
  background: rgba(255, 255, 255, 0.14);
}

.project-card__arrow svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Interações */

.project-card__link:hover .project-card__arrow {
  color: #ffffff;
  background: var(--agatha-purple);
  transform: rotate(45deg);
}

.project-card__link:hover .project-card__interface {
  transform: translateY(-46%) rotate(-1deg) scale(1.025);
}

.project-card__link:hover
  .project-card__surface--correa
  .project-card__interface {
  transform: translateY(-48%) rotate(1deg) scale(1.025);
}

/* =========================================================
   RESPONSIVIDADE
   ========================================================= */

@media (max-width: 1100px) {
  .project-card--wide,
  .project-card--narrow {
    grid-column: span 6;
  }

  .project-card__surface {
    min-height: clamp(27rem, 55vw, 35rem);
  }
}

@media (max-width: 760px) {
  .agatha-projects {
    padding: 1.25rem;
  }

  .agatha-projects__grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-card--wide,
  .project-card--narrow {
    grid-column: 1;
  }

  .project-card__surface {
    min-height: min(75svh, 34rem);
    padding: 1.25rem;
    border-radius: 1.1rem;
  }

  .project-card__letter {
    left: -3%;
    font-size: 14rem;
  }

  .project-card__interface {
    right: -13%;
    width: 63%;
  }

  .project-card__bottom h2 {
    font-size: clamp(2.25rem, 10vw, 3rem);
  }

  .project-card__arrow {
    width: 3.2rem;
    height: 3.2rem;
  }
}

@media (max-width: 390px) {
  .project-card__topline span:first-child {
    display: none;
  }

  .project-card__topline {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card__interface,
  .project-card__arrow {
    transition: none;
  }
}

/* =========================================================
   TRANSIÇÃO CARD → HERO
   ========================================================= */

:root {
  --project-transition-duration: 820ms;
  --project-transition-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --project-transition-background: #ffffff;
  --project-transition-origin-radius: 1.75rem;
}

.brand.brand--approved-logo {
  display: inline-block;
  width: clamp(7.8rem, 9vw, 9.25rem);
  line-height: 0;
}

.brand.brand--approved-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.brand--footer.brand--approved-logo img {
  filter: grayscale(1) brightness(0) invert(1);
}

@media (max-width: 700px) {
  .brand.brand--approved-logo {
    width: 7.5rem;
  }
}

body.project-hero-active {
  overscroll-behavior: none;
}

body.project-hero-active .project-transition-app-root {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

body.project-transition-fallback.project-hero-active
  .project-transition-app-root {
  opacity: 1;
}

.project-destination-hero,
.project-destination-hero * {
  box-sizing: border-box;
}

.project-destination-hero {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--project-transition-background);
  font-family: "Inter Variable", "Inter", Arial, sans-serif;
  pointer-events: none;
  isolation: isolate;
}

.project-destination-hero--ready {
  pointer-events: auto;
}

.project-destination-hero .project-destination-hero__surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  transform: none;
  contain: paint;
}

.project-destination-hero__description {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: min(38rem, 42vw);
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--project-transition-foreground) 28%, transparent);
  color: var(--project-transition-foreground);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 1rem));
  transition: opacity 500ms ease 120ms, transform 700ms var(--agatha-ease) 120ms;
}

.project-destination-hero--ready .project-destination-hero__description {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.project-destination-hero__description small {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  line-height: 1.3;
  opacity: 0.68;
  text-transform: uppercase;
}

.project-destination-hero__statement {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.35rem);
  font-weight: 620;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.project-destination-hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.8rem, 2vw, 1.75rem);
  margin-top: clamp(1.5rem, 3vh, 2.5rem);
}

.project-destination-hero__facts > div {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--project-transition-foreground) 20%, transparent);
}

.project-destination-hero__facts b {
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  opacity: 0.62;
  text-transform: uppercase;
}

.project-destination-hero__facts span {
  font-size: clamp(0.76rem, 1vw, 0.92rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.project-destination-hero__link {
  display: inline-flex;
  margin-top: clamp(1.5rem, 3vh, 2.25rem);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.02em;
  opacity: 0.78;
  text-decoration: none;
  pointer-events: auto;
  transition: opacity 200ms ease;
}

.project-destination-hero__link[href]:hover {
  opacity: 1;
}

.project-destination-hero__back {
  position: fixed;
  z-index: 4;
  top: max(1rem, env(safe-area-inset-top));
  left: 50%;
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 1rem 0.35rem 0.45rem;
  border: 1px solid rgba(5, 5, 5, 0.13);
  border-radius: 99px;
  color: #050505;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.16);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  opacity: 0;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transform: translate(-50%, -0.75rem);
  transition:
    opacity 280ms ease,
    transform 450ms var(--project-transition-ease),
    background-color 220ms ease;
}

.project-destination-hero--ready .project-destination-hero__back {
  opacity: 1;
  transform: translate(-50%, 0);
}

.project-destination-hero__back:hover {
  background: #ffffff;
}

.project-destination-hero__back:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 4px;
  box-shadow:
    0 0 0 2px #4a00ff,
    0 0.75rem 2.5rem rgba(0, 0, 0, 0.16);
}

.project-destination-hero__back svg {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0.58rem;
  border-radius: 50%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  background: rgba(5, 5, 5, 0.06);
}

.project-destination-hero--fallback {
  background: transparent;
}

html.project-transition-running::view-transition {
  background: var(--project-transition-background);
}

html.project-transition-running::view-transition-group(root) {
  z-index: 1;
}

html.project-transition-running::view-transition-group(agatha-project-hero) {
  z-index: 2;
  overflow: clip;
  animation-duration: var(--project-transition-duration);
  animation-timing-function: var(--project-transition-ease);
}

html.project-transition-running::view-transition-group(agatha-project-topline),
html.project-transition-running::view-transition-group(agatha-project-letter),
html.project-transition-running::view-transition-group(agatha-project-interface),
html.project-transition-running::view-transition-group(agatha-project-meta),
html.project-transition-running::view-transition-group(agatha-project-title),
html.project-transition-running::view-transition-group(agatha-project-arrow) {
  z-index: 3;
  animation-duration: var(--project-transition-duration);
  animation-timing-function: var(--project-transition-ease);
}

html.project-transition-running::view-transition-image-pair(agatha-project-hero) {
  overflow: clip;
  isolation: isolate;
}

html.project-transition-forward::view-transition-image-pair(agatha-project-hero) {
  animation: project-radius-expand var(--project-transition-duration)
    var(--project-transition-ease) both;
}

html.project-transition-reverse::view-transition-image-pair(agatha-project-hero) {
  animation: project-radius-contract var(--project-transition-duration)
    var(--project-transition-ease) both;
}

html.project-transition-running::view-transition-old(agatha-project-hero),
html.project-transition-running::view-transition-new(agatha-project-hero) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: normal;
}

html.project-transition-running::view-transition-old(agatha-project-hero) {
  animation: project-shared-old var(--project-transition-duration) linear both;
}

html.project-transition-running::view-transition-new(agatha-project-hero) {
  animation: project-shared-new var(--project-transition-duration) linear both;
}

html.project-transition-running::view-transition-old(agatha-project-topline),
html.project-transition-running::view-transition-old(agatha-project-letter),
html.project-transition-running::view-transition-old(agatha-project-interface),
html.project-transition-running::view-transition-old(agatha-project-meta),
html.project-transition-running::view-transition-old(agatha-project-title),
html.project-transition-running::view-transition-old(agatha-project-arrow) {
  mix-blend-mode: normal;
  animation: project-shared-old var(--project-transition-duration) linear both;
}

html.project-transition-running::view-transition-new(agatha-project-topline),
html.project-transition-running::view-transition-new(agatha-project-letter),
html.project-transition-running::view-transition-new(agatha-project-interface),
html.project-transition-running::view-transition-new(agatha-project-meta),
html.project-transition-running::view-transition-new(agatha-project-title),
html.project-transition-running::view-transition-new(agatha-project-arrow) {
  mix-blend-mode: normal;
  animation: project-shared-new var(--project-transition-duration) linear both;
}

html.project-transition-forward::view-transition-old(root),
html.project-transition-reverse::view-transition-old(root) {
  animation: project-page-fade-out 360ms ease-out both;
}

html.project-transition-forward::view-transition-new(root) {
  animation: none;
  opacity: 0;
}

html.project-transition-reverse::view-transition-new(root) {
  animation: project-page-fade-in 420ms 80ms ease-out both;
}

@keyframes project-radius-expand {
  from {
    clip-path: inset(0 round var(--project-transition-origin-radius));
  }

  to {
    clip-path: inset(0 round 0);
  }
}

@keyframes project-radius-contract {
  from {
    clip-path: inset(0 round 0);
  }

  to {
    clip-path: inset(0 round var(--project-transition-origin-radius));
  }
}

@keyframes project-page-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes project-page-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes project-shared-old {
  0%,
  45% {
    opacity: 1;
  }

  68%,
  100% {
    opacity: 0;
  }
}

@keyframes project-shared-new {
  0%,
  42% {
    opacity: 0;
  }

  65%,
  100% {
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .project-destination-hero .project-card__bottom {
    transition: opacity 220ms ease;
  }

  .project-destination-hero--ready .project-card__bottom {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .project-destination-hero .project-destination-hero__surface {
    height: 100%;
    min-height: 100%;
    border-radius: 0;
  }

  .project-destination-hero__back {
    top: max(0.8rem, env(safe-area-inset-top));
    min-height: 2.75rem;
    padding-right: 0.85rem;
  }

  .project-destination-hero__description {
    top: auto;
    right: 1.25rem;
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    left: 1.25rem;
    width: auto;
    max-height: calc(100dvh - 7rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    transform: translateY(1rem);
  }

  .project-destination-hero__description::-webkit-scrollbar {
    display: none;
  }

  .project-destination-hero--ready .project-destination-hero__description {
    transform: translateY(0);
  }

  .project-destination-hero__statement {
    max-width: 12ch;
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .project-destination-hero__facts {
    gap: 0.65rem;
    margin-top: 1.25rem;
  }

  .project-destination-hero__facts > div {
    padding-top: 0.55rem;
  }

  .project-destination-hero__facts b {
    font-size: 0.52rem;
  }

  .project-destination-hero__facts span {
    font-size: 0.68rem;
    overflow-wrap: anywhere;
  }

  .project-destination-hero__link {
    margin-top: 1.25rem;
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.motion-full) .project-destination-hero__back {
    transition: none;
  }
}
