/* ==============================================================
   SOBRE — A casa (#casa)
   A section inteira é o componente de abas animadas:
   A casa / Onde fica / Para quem / O clima
   ============================================================== */

.about {
  color: var(--ink);
  background: var(--paper);
}

/* ==============================================================
   ANIMATED TABS — CSS puro (sem JS)
   A troca de abas funciona com inputs radio + :has().
   Estrutura: .animated-tabs > .tabs-list (input + label por aba,
   + .tabs-indicator) e .tabs-panels (um .tabs-panel por aba, na
   mesma ordem dos inputs).
   ============================================================== */

.animated-tabs {
  --tabs-gap: 8px;
  --tabs-pad: 4px;
  --tabs-count: 4;
  --tabs-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  color: var(--ink);
}

/* ---------- Lista de abas ---------- */

.tabs-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tabs-count), minmax(0, 1fr));
  gap: var(--tabs-gap);
  padding: var(--tabs-pad);
  border: 1px solid rgba(17, 20, 17, 0.08);
  border-radius: 12px;
  background: var(--cream);
}

/* Radios escondidos visualmente, mas acessíveis pelo teclado */
.tabs-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tabs-trigger {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  line-height: 20px;
  letter-spacing: var(--ls-small);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 200ms ease, opacity 200ms ease;
}

.tabs-trigger:hover {
  opacity: 0.85;
}

.tabs-input:focus-visible + .tabs-trigger {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

/* Pílula ativa que desliza entre as abas */
.tabs-indicator {
  --tab-index: 0;

  position: absolute;
  z-index: 0;
  top: var(--tabs-pad);
  bottom: var(--tabs-pad);
  left: var(--tabs-pad);
  width: calc(
    (100% - (var(--tabs-pad) * 2) - (var(--tabs-gap) * (var(--tabs-count) - 1))) / var(--tabs-count)
  );
  border-radius: 8px;
  background: var(--olive);
  box-shadow: 0 6px 16px rgba(47, 58, 38, 0.24);
  transform: translateX(calc((100% + var(--tabs-gap)) * var(--tab-index)));
  transition: transform 600ms var(--tabs-spring);
  pointer-events: none;
}

.animated-tabs:has(.tabs-input:nth-of-type(1):checked) .tabs-indicator { --tab-index: 0; }
.animated-tabs:has(.tabs-input:nth-of-type(2):checked) .tabs-indicator { --tab-index: 1; }
.animated-tabs:has(.tabs-input:nth-of-type(3):checked) .tabs-indicator { --tab-index: 2; }
.animated-tabs:has(.tabs-input:nth-of-type(4):checked) .tabs-indicator { --tab-index: 3; }

/* Texto da aba ativa em claro, sobre a pílula oliva */
.tabs-input:checked + .tabs-trigger {
  color: var(--paper);
}

/* ---------- Painel de conteúdo ---------- */

.tabs-panels {
  height: 100%;
  padding: clamp(12px, 1.6vw, 20px);
  border: 1px solid rgba(17, 20, 17, 0.08);
  border-radius: 12px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 30px 60px rgba(47, 58, 38, 0.12);
}

.tabs-panel {
  display: none;
}

.animated-tabs:has(.tabs-input:nth-of-type(1):checked) .tabs-panel:nth-child(1),
.animated-tabs:has(.tabs-input:nth-of-type(2):checked) .tabs-panel:nth-child(2),
.animated-tabs:has(.tabs-input:nth-of-type(3):checked) .tabs-panel:nth-child(3),
.animated-tabs:has(.tabs-input:nth-of-type(4):checked) .tabs-panel:nth-child(4) {
  display: block;
  animation: tab-panel-in 500ms var(--tabs-spring) both;
}

@keyframes tab-panel-in {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.95);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

/* ---------- Conteúdo interno ---------- */

.tabs-content {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 4vw, 56px);
  width: 100%;
  height: 100%;
}

.tabs-media {
  position: relative;
  /* Mesma altura em todas as abas: o painel não "pula" ao trocar */
  height: clamp(18rem, 34vw, 28rem);
  overflow: hidden;
  isolation: isolate;
  border-radius: 10px;
  background: var(--forest);
  box-shadow: 0 12px 30px rgba(47, 58, 38, 0.16);
}

/* Fundo da moldura: a própria foto, ampliada e desfocada */
.tabs-media-bg {
  position: absolute;
  inset: -24px;
  z-index: -1;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  max-width: none;
  object-fit: cover;
  filter: blur(22px) saturate(1.1) brightness(0.9);
  pointer-events: none;
}

/* A foto aparece inteira, sem cortes, independente da proporção */
.tabs-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: none;
  object-fit: contain;
  background: none;
}

/* Fotos horizontais: preenchem a moldura inteira, sem borda de fundo
   (a proporção delas é quase a da moldura, o corte é mínimo) */
.tabs-media--fill .tabs-image {
  object-fit: cover;
}

.tabs-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: clamp(0px, 2vw, 24px);
}

.tabs-text h2,
.tabs-text h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
}

.tabs-text p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
}

/* ---------- Selo "1 ano de histórias" (aba A casa) ---------- */

.about-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-content: center;
  width: 104px;
  height: 104px;
  border-radius: 999px;
  color: var(--paper);
  background: var(--olive);
  text-align: center;
  box-shadow: 0 16px 34px rgba(17, 20, 17, 0.28);
}

.about-badge strong {
  display: block;
  font-family: var(--font-rounded);
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.about-badge span {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ==============================================================
   RESPONSIVO
   ============================================================== */

@media (max-width: 900px) {
  .tabs-content {
    grid-template-columns: 1fr;
  }

  .tabs-media {
    height: clamp(16rem, 62vw, 26rem);
  }

  .tabs-text {
    padding: 4px 4px 8px;
  }
}

@media (max-width: 480px) {
  .tabs-trigger {
    padding: 8px 4px;
    font-size: var(--fs-caption);
  }

  .tabs-media {
    height: 18rem;
  }

  .about-badge {
    top: 12px;
    right: 12px;
    width: 80px;
    height: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tabs-indicator,
  .tabs-trigger {
    transition: none;
  }

  .animated-tabs .tabs-panel {
    animation: none !important;
  }
}
