/* Libert — página institucional.
   A geometria da marca guia a página: as duas lâminas do símbolo se deslocam
   na diagonal, e o carrossel empilha os projetos no mesmo sentido. */

:root {
  --canvas: #f3f3f0;
  --paper: #ffffff;
  --ink: #161616;
  --ink-soft: #55554f;
  --line: rgba(22, 22, 22, 0.14);
  --vermilion: #fd5313;
  --amber: #fd8318;

  --font: "Gabarito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4.5vw, 64px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-deck: cubic-bezier(0.22, 0.8, 0.24, 1);
  --interval: 6s;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Palco ------------------------------------------------------------------ */

.stage {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(28px, 4.5vh, 88px) var(--gutter) clamp(16px, 3vh, 48px);
  display: grid;
  align-content: center;
  gap: clamp(28px, 5vh, 64px);
}

.brand {
  width: min(74vw, 360px);
  font-size: 0;
}

.logo {
  width: 100%;
  height: auto;
  overflow: visible;
}

.logo-slab-1 {
  fill: var(--vermilion);
}

.logo-slab-2 {
  fill: var(--amber);
}

.logo-word {
  fill: var(--ink);
}

@media (min-width: 960px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center;
    column-gap: clamp(48px, 7vw, 120px);
  }

  .brand {
    width: min(100%, 540px);
  }
}

/* Projetos --------------------------------------------------------------- */

.projects {
  --step-x: 14px;
  --step-y: 18px;
  --side-scale: 1;
  --card-w: 460px;
  --card-h: 384px;
  --radius: 20px;

  width: 100%;
  max-width: calc(var(--card-w) + var(--step-x) * 2);
  justify-self: center;
}

@media (min-width: 560px) {
  .projects {
    --step-x: 52px;
    --step-y: 68px;
    --side-scale: 0.94;
    --card-h: 424px;
    --radius: 24px;
  }
}

.projects-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.projects-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

.controls {
  display: flex;
  gap: 8px;
}

.control {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.control:hover {
  background: var(--paper);
  border-color: rgba(22, 22, 22, 0.3);
}

.control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control svg .fill {
  fill: currentColor;
  stroke: none;
}

[data-autoplay="on"] .icon-play,
[data-autoplay="off"] .icon-pause {
  display: none;
}

/* Sem JavaScript os controles não funcionam: só aparecem depois de ligados. */
[data-carousel]:not([data-ready]) .controls,
[data-carousel]:not([data-ready]) .progress {
  visibility: hidden;
}

/* Baralho: cartas empilhadas na diagonal da marca. */
.deck {
  position: relative;
  height: calc(var(--card-h) + var(--step-y) * 2 + 12px);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.card {
  --x: 0px;
  --y: 0px;
  --s: 1;
  --card-bg: var(--paper);
  --card-ink: var(--ink);
  --card-soft: var(--ink-soft);
  --card-accent: var(--ink);
  --art-bg: var(--canvas);

  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% - var(--step-x) * 2);
  height: var(--card-h);
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--card-ink);
  box-shadow: 0 1px 2px rgba(22, 22, 22, 0.08), 0 28px 48px -28px rgba(22, 22, 22, 0.45);
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) scale(var(--s));
  transition: transform 0.7s var(--ease-deck);
}

.card[data-pos="active"] {
  z-index: 3;
}

.card[data-pos="next"] {
  --x: var(--step-x);
  --y: var(--step-y);
  --s: var(--side-scale);
  z-index: 2;
  cursor: pointer;
}

.card[data-pos="prev"] {
  --x: calc(var(--step-x) * -1);
  --y: calc(var(--step-y) * -1);
  --s: var(--side-scale);
  z-index: 1;
  cursor: pointer;
}

/* Com mais de três projetos, os demais esperam escondidos atrás do baralho. */
.card[data-pos="hidden"] {
  --s: 0.9;
  z-index: 0;
  visibility: hidden;
}

.card:has(.card-link:focus-visible) {
  outline: 3px solid var(--vermilion);
  outline-offset: 4px;
}

.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  -webkit-user-drag: none;
}

.card-link:focus-visible {
  outline: none;
}

.card-art {
  position: relative;
  flex: 0 0 57%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--art-bg);
}

.card-art img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  -webkit-user-drag: none;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px 22px;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.card-text {
  max-width: 34ch;
  color: var(--card-soft);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  color: var(--card-accent);
  font-weight: 700;
}

.card-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 560px) {
  .card-title {
    font-size: 1.75rem;
  }
}

/* Cada projeto fala nas próprias cores. */
.card--soneca {
  --card-bg: #ffffff;
  --card-ink: #1e293b;
  --card-soft: #475569;
  --card-accent: #2563eb;
  --art-bg: #f0f7ff;
}

.card--soneca .card-art img {
  mix-blend-mode: multiply;
}

.card--rox {
  --card-bg: #141417;
  --card-ink: #f4f4f5;
  --card-soft: #a1a1aa;
  --card-accent: #8fa8ff;
  --art-bg: #0c0c0e;
}

.card--rox .card-art img {
  width: 96%;
  height: 96%;
  mix-blend-mode: screen;
}

.card--mandaboa {
  --card-bg: #0c2b21;
  --card-ink: #f6f8f1;
  --card-soft: #a9bdb3;
  --card-accent: #ffe14a;
  --art-bg: #f6f8f1;
}

/* Aqui a arte é a imagem de marca inteira, de borda a borda: o fundo dela é a
   mesma cor do painel, então sobra encaixa sem emenda em telas mais estreitas. */
.card--mandaboa .card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Progresso da troca automática; cada trecho também leva ao projeto. */
.progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.segment {
  position: relative;
  width: 44px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.segment::before,
.segment-fill {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}

.segment::before {
  background: rgba(22, 22, 22, 0.14);
}

.segment-fill {
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
}

.segment[aria-current="true"] .segment-fill {
  transform: scaleX(1);
}

[data-autoplay="on"] .segment[aria-current="true"] .segment-fill {
  background: var(--vermilion);
  animation: segment-fill var(--interval) linear both;
}

[data-autoplay="on"][data-hold] .segment[aria-current="true"] .segment-fill {
  animation-play-state: paused;
}

@keyframes segment-fill {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

/* Rodapé ----------------------------------------------------------------- */

.legal {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px var(--gutter) max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 24px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* Página de erro ----------------------------------------------------------- */

.stage--error {
  justify-items: start;
}

.brand--link {
  display: block;
  width: min(48vw, 200px);
}

.error-title {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.error-text {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 28px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

@media (min-width: 960px) {
  .stage--error {
    grid-template-columns: none;
  }
}

/* Movimento -------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  /* A marca se monta: as lâminas deslizam uma pela outra na diagonal. */
  .logo-slab-1 {
    animation: slab-1 1.1s var(--ease-out) backwards;
  }

  .logo-slab-2 {
    animation: slab-2 1.1s 70ms var(--ease-out) backwards;
  }

  .logo-word {
    animation: word-in 0.9s 280ms var(--ease-out) backwards;
  }

  /* Em seguida o baralho se abre no mesmo sentido. */
  .deck .card {
    animation: deck-in 0.9s 420ms var(--ease-deck) backwards;
  }

  .projects-bar,
  .progress {
    animation: fade-in 0.6s 620ms ease backwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition-duration: 1ms;
  }
}

@keyframes slab-1 {
  from {
    opacity: 0;
    transform: translate(-96px, 64px);
  }
}

@keyframes slab-2 {
  from {
    opacity: 0;
    transform: translate(96px, -64px);
  }
}

@keyframes word-in {
  from {
    opacity: 0;
    transform: translateX(-48px);
  }
}

@keyframes deck-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
}

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