/*
 * Portfólio — Paulo Sêmpio Neto
 * Conceito "Camadas": cada produto é mostrado como interface, API e dados.
 * As três cores de camada têm significado e se repetem no site inteiro.
 * Sem bibliotecas, sem build, sem recursos remotos além da foto do GitHub.
 */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("assets/fonts/familjen-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #eceef2;
  --paper-deep: #e1e4ea;
  --surface: #ffffff;
  --ink: #15171c;
  --ink-soft: #343843;
  --muted: #5b6170;
  --line: #d4d8df;
  --line-strong: #b9bec8;

  /* Layer colors: interface, API, data */
  --ui: #6c4dff;
  --ui-wash: #ebe6ff;
  --api: #d9930d;
  --api-wash: #fbefd6;
  --data: #0c9a84;
  --data-wash: #d7f2ec;

  --font: "Familjen Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1360px;
  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --shadow-layer: 0 40px 80px -40px rgb(21 23 28 / 45%), 0 12px 24px -16px rgb(21 23 28 / 25%);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

code {
  font-family: var(--code);
  font-size: 0.86em;
}

::selection {
  background: var(--ui);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--ui);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.25s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

/* ── Header ── */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.4s var(--ease);
}

.site-header.is-scrolled {
  background: rgb(236 238 242 / 82%);
  box-shadow: 0 1px 0 var(--line);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* The logo is the concept: three stacked layers. */
.brand-mark {
  display: grid;
  gap: 3px;
  width: 22px;
}

.brand-mark i {
  height: 5px;
  border-radius: 2px;
  transition: transform 0.4s var(--ease);
}

.brand-mark i:nth-child(1) { background: var(--ui); }
.brand-mark i:nth-child(2) { background: var(--api); transform: translateX(3px); }
.brand-mark i:nth-child(3) { background: var(--data); transform: translateX(6px); }

.brand:hover .brand-mark i:nth-child(2) { transform: translateX(-3px); }
.brand:hover .brand-mark i:nth-child(3) { transform: translateX(3px); }

#navigation {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#navigation a {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 550;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

#navigation a:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

#navigation .nav-contact {
  margin-left: 0.4rem;
  background: var(--ink);
  color: #ffffff;
}

#navigation .nav-contact:hover {
  background: var(--ui);
  color: #ffffff;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.menu-icon {
  display: grid;
  gap: 4px;
  width: 16px;
}

.menu-icon i {
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}

.menu-toggle[aria-expanded="true"] .menu-icon i:first-child { transform: translateY(3px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-icon i:last-child { transform: translateY(-3px) rotate(-45deg); }

/* ── Buttons ── */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

.button:active {
  transform: scale(0.97);
}

.button-primary {
  background: var(--ink);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--ui);
}

.button-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.button-ghost:hover {
  border-color: var(--ink);
}

/* ── Hero ── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 4rem);
  max-width: var(--max);
  min-height: 100svh;
  margin: 0 auto;
  padding: 7.5rem var(--gutter) 4rem;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  padding: 0.4rem 0.9rem 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 550;
}

.availability span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--data);
  box-shadow: 0 0 0 0 rgb(12 154 132 / 50%);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  70%,
  100% { box-shadow: 0 0 0 9px rgb(12 154 132 / 0%); }
}

.hero-title {
  font-size: clamp(2.7rem, 5vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 0.94;
}

.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.hero-title .line > span {
  display: block;
  white-space: nowrap;
}

.hero-title em {
  font-style: normal;
  color: var(--muted);
}

.hero-description {
  max-width: 34rem;
  margin-top: 1.8rem;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: start;
  gap: 2.2rem;
  margin-top: 2.8rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.hero-proof div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.15rem;
}

.hero-proof dt {
  color: var(--muted);
  font-size: 0.875rem;
}

.hero-proof dd {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stage {
  display: grid;
  gap: 1.6rem;
  justify-items: center;
}

.hero-switch {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  width: 100%;
}

.hero-caption {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.hero-caption strong {
  margin-right: 0.35rem;
  color: var(--ink);
}

.hero-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.hero-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.hero-tab i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-tab:hover {
  color: var(--ink);
}

.hero-tab[aria-pressed="true"] {
  background: var(--ink);
  color: #ffffff;
}

/* ── The layer stack ──
 * --tilt: 0 = seen from the front (just the screen), 1 = isometric.
 * --p:    0 = layers collapsed into one, 1 = fully separated.
 */

.stack {
  --tilt: 1;
  --p: 1;
  --gap: clamp(64px, 9vw, 150px);
  --rx: 0deg;
  --rz: 0deg;
  position: relative;
  width: 100%;
  perspective: 2400px;
  perspective-origin: 50% 30%;
}

.stack-hero {
  max-width: 600px;
  padding: 16% 4% 20%;
}

.stack-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  transform-style: preserve-3d;
  transform:
    rotateX(calc(var(--tilt) * 54deg + var(--rx)))
    rotateZ(calc(var(--tilt) * -32deg + var(--rz)))
    scale(calc(1 - var(--tilt) * 0.12));
  will-change: transform;
}

.layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius);
  transform: translateZ(calc((var(--i) - 1) * (var(--gap) * var(--p) + 2px)));
  box-shadow: var(--shadow-layer);
  backface-visibility: hidden;
}

.layer-ui {
  background: var(--ink);
  outline: 1px solid rgb(255 255 255 / 10%);
  outline-offset: -1px;
}

.layer-ui img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.layer-api {
  display: grid;
  align-content: center;
  padding: 9% 8%;
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(217 147 13 / 22%), transparent 55%),
    var(--ink);
  color: #f3f4f6;
}

.layer-data {
  display: grid;
  align-content: center;
  padding: 9% 8%;
  background:
    linear-gradient(rgb(12 154 132 / 8%) 1px, transparent 1px) 0 0 / 100% 22px,
    var(--data-wash);
  color: var(--ink);
}

.layer-tag {
  position: absolute;
  right: 4.5%;
  bottom: 6%;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem 0.35rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: clamp(0.62rem, 0.9vw, 0.8rem);
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgb(21 23 28 / 40%);
  opacity: var(--p);
}

.layer-tag i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.layer-tag small {
  color: var(--muted);
  font-size: inherit;
  font-weight: 500;
}

.layer-ui .layer-tag i { background: var(--ui); }
.layer-api .layer-tag i { background: var(--api); }
.layer-data .layer-tag i { background: var(--data); }

.layer-ui .layer-tag {
  top: 5.5%;
  right: auto;
  bottom: auto;
  left: 4.5%;
}

.layer-api,
.layer-data {
  padding-top: 7%;
  align-content: end;
}

.routes {
  display: grid;
  gap: clamp(0.35rem, 0.8vw, 0.7rem);
  margin-top: 6%;
}

.routes li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  font-size: clamp(0.62rem, 1.05vw, 0.95rem);
}

.routes code {
  overflow: hidden;
  color: #f3f4f6;
  font-size: 1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m {
  flex: none;
  min-width: 4.4em;
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-family: var(--code);
  font-size: 0.78em;
  font-weight: 700;
  text-align: center;
}

.m-get { background: rgb(12 154 132 / 22%); color: #6ee7c8; }
.m-post { background: rgb(217 147 13 / 22%); color: #fbc96b; }
.m-put { background: rgb(108 77 255 / 28%); color: #c4b5fd; }
.m-delete { background: rgb(229 72 77 / 22%); color: #ff9da0; }

.tables {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.3rem, 0.7vw, 0.55rem);
  margin-top: 6%;
}

.tables li {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.7em;
  border: 1px solid rgb(12 154 132 / 35%);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--code);
  font-size: clamp(0.58rem, 0.95vw, 0.85rem);
  font-weight: 600;
}

.tables li::before {
  content: "";
  width: 0.75em;
  height: 0.75em;
  border-radius: 2px;
  background:
    linear-gradient(var(--data) 0 0) 0 0 / 100% 2px no-repeat,
    linear-gradient(rgb(12 154 132 / 40%) 0 0) 0 50% / 100% 1px no-repeat,
    linear-gradient(rgb(12 154 132 / 40%) 0 0) 0 100% / 100% 1px no-repeat;
}

/* Swapping projects in the hero: layers collapse, content changes, layers open. */
.stack.is-swapping .stack-scene {
  opacity: 0.25;
  transform:
    rotateX(calc(var(--tilt) * 54deg + var(--rx)))
    rotateZ(calc(var(--tilt) * -32deg + var(--rz)))
    scale(0.82);
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease-in-out);
}

.stack-legend {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 550;
}

.stack-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.45rem;
  border-radius: 50%;
}

.legend-ui::before { background: var(--ui); }
.legend-api::before { background: var(--api); }
.legend-data::before { background: var(--data); }

/* ── Section intros ── */

.section-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-intro h2 {
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  letter-spacing: -0.05em;
}

.section-intro h2 span,
.about h2 span {
  color: var(--muted);
}

.section-intro p {
  max-width: 30rem;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

/* ── Projects ── */

.projects {
  padding: clamp(5rem, 10vw, 9rem) 0 2rem;
}

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 5.5rem);
  max-width: var(--max);
  margin: clamp(5rem, 10vw, 9rem) auto 0;
  padding: 0 var(--gutter);
}

.chapter:nth-of-type(even) {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.chapter:nth-of-type(even) .chapter-media {
  order: 2;
}

.chapter-media {
  position: sticky;
  top: 10vh;
  align-self: start;
  padding: 4% 4% 0;
}

.stack-scroll .stack-scene {
  margin-bottom: calc(var(--tilt) * 14%);
}

.stack-legend {
  position: relative;
  z-index: 1;
}

.stack-scroll {
  --tilt: 0;
  --p: 0;
}

.chapter-copy {
  padding-top: 4rem;
}

.chapter-kind {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-weight: 550;
}

.chapter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.chapter-title {
  margin-top: 0.8rem;
  font-size: clamp(3rem, 7vw, 6.4rem);
  letter-spacing: -0.055em;
}

.chapter-problem {
  margin-top: 1.4rem;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.chapter-summary {
  margin-top: 1rem;
  color: var(--ink-soft);
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.4rem;
  margin-top: 1.8rem;
}

.link-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0 0.6rem 0 1.3rem;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.25s var(--ease);
}

.link-primary:hover {
  background: var(--ui);
}

.link-host {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  color: rgb(255 255 255 / 80%);
  font-family: var(--code);
  font-size: 0.75rem;
  font-weight: 500;
}

.link-secondary {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
}

.link-secondary:hover {
  text-decoration-color: var(--ink);
}

.link-note {
  color: var(--muted);
  font-size: 0.925rem;
}

.arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

a:hover > .arrow {
  transform: translate(2px, -2px);
}

.chapter-label {
  margin: 2.6rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.built {
  display: grid;
  border-top: 1px solid var(--line);
}

.built li {
  position: relative;
  padding: 0.85rem 0 0.85rem 1.6rem;
  border-bottom: 1px solid var(--line);
}

.built li::before {
  content: "";
  position: absolute;
  top: 1.45rem;
  left: 0.2rem;
  width: 0.55rem;
  height: 2px;
  background: var(--accent);
}

.decisions {
  display: grid;
  gap: 0.75rem;
}

.decisions div {
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.decisions dt {
  font-weight: 650;
}

.decisions dd {
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.975rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin-top: 2.2rem;
}

.metrics div {
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}

.metrics dt {
  font-weight: 600;
}

.metric-value {
  display: block;
  margin-bottom: 0.3rem;
  font-size: clamp(2.2rem, 3.4vw, 3.2rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metrics dd {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags li {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 550;
}

.gallery {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.8fr);
  align-items: end;
  gap: 0.9rem;
  margin-top: 2.6rem;
}

.gallery img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 24px 48px -28px rgb(21 23 28 / 45%);
}

.gallery-mobile {
  border-radius: 18px;
}

/* ── Capabilities ── */

.capabilities {
  margin-top: clamp(6rem, 12vw, 10rem);
  padding: clamp(5rem, 9vw, 8rem) 0;
  background: var(--ink);
  color: #f3f4f6;
}

.capabilities .section-intro h2 span {
  color: #8c92a1;
}

.capabilities .section-intro p {
  color: #b9bec8;
}

.layers-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  max-width: var(--max);
  margin: clamp(3rem, 6vw, 5rem) auto 0;
  padding: 0 var(--gutter);
}

.cap {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1.6rem;
  border-top: 3px solid var(--cap);
  border-radius: 4px 4px var(--radius) var(--radius);
  background: #1e2128;
}

.cap-ui { --cap: var(--ui); }
.cap-api { --cap: var(--api); }
.cap-data { --cap: var(--data); }
.cap-quality { --cap: #f3f4f6; }

.cap h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.cap h3 i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cap);
}

.cap p {
  color: #b9bec8;
  font-size: 0.975rem;
}

.cap .tags li {
  border-color: #343843;
  background: transparent;
  color: #e5e7eb;
}

/* ── About ── */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) var(--gutter);
}

.about-head {
  display: grid;
  align-content: start;
  gap: 2rem;
}

.about-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line);
}

.about h2 {
  font-size: clamp(2.6rem, 5.4vw, 5.2rem);
  letter-spacing: -0.05em;
}

.about-copy {
  display: grid;
  gap: 1.1rem;
  align-content: start;
  color: var(--ink-soft);
}

.about-lead {
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 550;
  line-height: 1.35;
}

.principles {
  display: grid;
  gap: 0;
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.principles div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.principles dt {
  color: var(--ink);
  font-weight: 650;
}

.education {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin-top: 0.6rem;
}

.education strong {
  color: var(--ink);
}

/* ── Contact ── */

.contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) var(--gutter) clamp(5rem, 9vw, 8rem);
  border-top: 1px solid var(--line);
}

.contact-title {
  font-size: clamp(3rem, 8.4vw, 8.4rem);
  letter-spacing: -0.06em;
  line-height: 0.92;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  margin-top: clamp(2rem, 4vw, 3.5rem);
}

.contact-email {
  position: relative;
  display: inline-flex;
  gap: 0.6rem;
  font-size: clamp(1.4rem, 3.2vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-email::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -0.15em;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ui), var(--api), var(--data));
  transform: scaleX(0.25);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

.contact-email:hover::after,
.contact-email:focus-visible::after {
  transform: scaleX(1);
}

.contact-social {
  display: flex;
  gap: 1.4rem;
  font-weight: 600;
}

/* ── Footer ── */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 2rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem var(--gutter) 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Entrance (one orchestrated moment on load) ── */

.js .hero-title .line > span {
  transform: translateY(105%);
  animation: rise 1s var(--ease) forwards;
}

.js .hero-title .line:nth-child(2) > span { animation-delay: 0.08s; }
.js .hero-title .line:nth-child(3) > span { animation-delay: 0.16s; }

.js .hero-description,
.js .hero-actions,
.js .hero-proof,
.js .availability,
.js .hero-switch {
  opacity: 0;
  animation: fade 0.9s var(--ease) 0.45s forwards;
}

.js .stack-hero {
  animation: assemble 1.6s var(--ease) 0.25s both;
}

@keyframes rise {
  to { transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* The hero stack starts as a flat screen and opens into its layers. */
@property --tilt {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

@keyframes assemble {
  0% { --tilt: 0; --p: 0; opacity: 0; }
  20% { opacity: 1; }
  45% { --tilt: 1; --p: 0; }
  100% { --tilt: 1; --p: 1; }
}

/* ── Responsive ── */

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    padding-top: 7rem;
  }

  .stack-hero {
    max-width: 620px;
  }

  .layers-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .chapter,
  .chapter:nth-of-type(even) {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter:nth-of-type(even) .chapter-media {
    order: 0;
  }

  .chapter-media {
    position: relative;
    top: 0;
    padding: 4% 4% 8%;
  }

  .chapter-copy {
    padding-top: 0;
  }

  .section-intro,
  .about {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body {
    font-size: 1rem;
  }

  .js .menu-toggle {
    display: inline-flex;
  }

  .js #navigation {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: var(--gutter);
    left: var(--gutter);
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-layer);
  }

  .js #navigation.is-open {
    display: flex;
  }

  .js #navigation a {
    padding: 0.85rem 1rem;
  }

  .js #navigation .nav-contact {
    margin: 0.3rem 0 0;
    text-align: center;
  }

  .hero-proof {
    gap: 1.4rem;
  }

  .stack {
    --gap: 46px;
  }

  .layer-tag small {
    display: none;
  }

  .routes li:nth-child(n + 4),
  .tables li:nth-child(n + 5) {
    display: none;
  }

  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .layers-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .principles div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .contact-row {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 420px) {
  .hero-proof {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
  }

  .hero-proof dt {
    font-size: 0.75rem;
  }

  .hero-tab {
    padding: 0 0.75rem;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .stack-scroll {
    --tilt: 1;
    --p: 1;
  }
}

/* ── Ao vivo ── */

.live-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  background: var(--ink);
  transform: scale(var(--live-scale, 0.4));
  transform-origin: 0 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s var(--ease);
}

.layer-ui[data-live-state="ready"] .live-frame {
  opacity: 1;
}

.layer-ui img {
  position: absolute;
  inset: 0;
}

.layer-ui[data-live-state="ready"] img {
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}

.layer-ui .live-frame {
  z-index: 1;
}

.layer-ui .layer-tag {
  z-index: 2;
}

.live-badge {
  position: absolute;
  top: 5.5%;
  right: 4.5%;
  left: auto;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgb(21 23 28 / 78%);
  color: #ffffff;
  font-size: clamp(0.6rem, 0.85vw, 0.75rem);
  font-weight: 650;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff5c61;
  animation: live-dot 1.6s ease-in-out infinite;
}

.layer-ui[data-live-state="ready"] .live-badge {
  opacity: 1;
  transform: none;
}

@keyframes live-dot {
  50% { opacity: 0.35; }
}

/* Small phones: keep each title line on one line without overflowing. */
@media (max-width: 420px) {
  .hero-title {
    font-size: clamp(2.1rem, 10.4vw, 2.7rem);
  }

  .hero-proof {
    align-items: end;
  }

  .hero-proof dd {
    font-size: 1.7rem;
  }
}

.contact,
.site-footer {
  border-top: 0;
  background-image: linear-gradient(var(--line), var(--line));
  background-size: calc(100% - 2 * var(--gutter)) 1px;
  background-position: top center;
  background-repeat: no-repeat;
}
