/* Hanken Grotesk: a neo-grotesque close to the reference's Helvetica feel that holds tight tracking at huge sizes. */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* IBM Plex Mono: clear @ and . glyphs for the email and the code captions. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0B0B0C;
  --panel: #141415;
  --text: #F2F1EE;
  --text-2: #A3A3A3;
  --text-3: #8A8A8A;
  --hairline: #2A2A2A;
  --frame: #3A3A3A;
  --accent: #2B59FF;
  --accent-hover: #1F47E0;
  --link: #7D96FF;

  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --header-h: 56px;
  --pad-x: clamp(16px, 3vw, 40px);
  --gutter: clamp(16px, 2.5vw, 32px);
  --section-y: clamp(64px, 10vw, 144px);
  --cols: 1;

  /* Width of "João" in em at this tracking, measured with the real font. */
  --name-em: 2.1;
}

@media (min-width: 600px) { :root { --cols: 6; } }
@media (min-width: 768px) { :root { --header-h: 64px; } }
@media (min-width: 1024px) { :root { --cols: 12; } }

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-weight: 400;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
main:focus:not(:focus-visible) { outline: none; }

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

.i18n-pending [data-i18n] { visibility: hidden; }

.skip {
  position: absolute;
  left: 12px;
  top: -200px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}
.skip:focus { top: 12px; }
.skip:focus-visible { outline-color: var(--text); }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
}

.label {
  font-size: 0.8125rem;
  line-height: 1.3;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 2px;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #FFFFFF; border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--text-3); }
.btn-ghost:hover { border-color: var(--text); }
.btn[hidden] { display: none; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  padding: 0 var(--pad-x);
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
  min-width: 44px;
}

.site-nav { display: flex; align-items: center; }

.menu-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-3);
  border-radius: 2px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}
html:not(.js) .menu-toggle { display: none; }

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.nav-list a:hover { text-decoration: underline; }

@media (max-width: 767px) {
  .js .nav-list { display: none; }
  .site-header.is-open .nav-list {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 8px var(--pad-x) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
  }
  .site-header.is-open .nav-list a {
    min-height: 52px;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--hairline);
  }
  html:not(.js) .site-header { height: auto; flex-wrap: wrap; padding-block: 6px; }
  html:not(.js) .site-header { position: static; }
  html:not(.js) .nav-list { display: flex; flex-wrap: wrap; gap: 0 16px; }
}

@media (min-width: 768px) {
  .menu-toggle { display: none; }
  .nav-list { display: flex; gap: 4px; margin-right: 16px; }
  .nav-list a { padding: 0 12px; font-size: 0.9375rem; }
}

.lang-switch { display: flex; gap: 4px; }
.lang-switch button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-3);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* Hero */
.hero {
  padding: clamp(16px, 3vw, 40px) var(--pad-x) 0;
  container-type: inline-size;
}

.hero-name {
  position: relative;
  z-index: 0;
  font-size: 30vw;
  font-size: min(calc(100cqi / var(--name-em)), 75vh);
  line-height: 0.8;
  letter-spacing: -0.045em;
  font-weight: 380;
  white-space: nowrap;
  padding-bottom: 0.04em;
}
.hero-letters { display: block; will-change: transform; }
/* Each letter rises inside its own mask; padding keeps accents and side bearings unclipped. */
.hero-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.12em 0.06em 0.08em;
  margin: -0.12em -0.06em -0.08em;
}
.hero-letter { display: inline-block; }

.hero-body {
  position: relative;
  z-index: 1;
  background: var(--bg);
  padding-bottom: var(--section-y);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px var(--gutter);
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.hero-meta li {
  font-size: 0.75rem;
  line-height: 1.3;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
@media (min-width: 768px) { .hero-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.hero-grid { row-gap: 48px; padding-top: clamp(32px, 5vw, 64px); }
.hero-copy { grid-column: 1 / -1; display: grid; gap: 28px; justify-items: start; align-content: start; }
.hero-intro { font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.45; max-width: 34ch; }
.spec { grid-column: 1 / -1; display: grid; gap: 12px; align-content: start; }

@media (min-width: 600px) {
  .hero-copy { grid-column: 1 / 4; }
  .spec { grid-column: 4 / 7; }
}
@media (min-width: 1024px) {
  .hero-copy { grid-column: 1 / 6; }
  .spec { grid-column: 8 / 13; }
}

.spec-code {
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.spec-code .v { color: var(--text); }
.spec figcaption { font-size: 0.875rem; color: var(--text-3); }

/* Sections */
.section {
  position: relative;
  z-index: 1;
  background: var(--bg);
  padding: var(--section-y) var(--pad-x);
}
[id] { scroll-margin-top: var(--header-h); }

.section-head { display: grid; justify-items: start; margin-bottom: clamp(32px, 5vw, 64px); }
.section-rule {
  justify-self: stretch;
  height: 1px;
  background: var(--hairline);
  transform-origin: left center;
}
.anchor {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-3);
  text-decoration: none;
}
.anchor:hover { color: var(--text); text-decoration: underline; }

.section-title {
  font-size: clamp(2.25rem, 6.4vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 400;
}
.section-title-small {
  font-size: 0.8125rem;
  line-height: 1.3;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.section-intro { margin-top: 20px; font-size: 1.125rem; color: var(--text-2); max-width: 40ch; }

/* Work */
.work-stage { display: grid; gap: clamp(72px, 10vw, 120px); }
.project { display: grid; gap: 28px; align-items: center; }
.project .media { order: -1; }
.project-text { display: grid; justify-items: start; gap: 10px; max-width: 46ch; }
.project-index { font-family: var(--mono); font-size: 0.8125rem; color: var(--text-3); }
.project-title { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -0.03em; font-weight: 400; margin-top: 2px; }
.project-sub { color: var(--text-2); }
.project-desc { margin-top: 6px; }
.project-stack { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-family: var(--mono); font-size: 0.875rem; margin-top: 6px; }
.project-link { margin-top: 14px; }

.media {
  position: relative;
  width: 100%;
  padding: 6%;
  background: var(--panel);
  border: 1px solid var(--hairline);
  transform-origin: center center;
}
.media-desktop { display: block; width: 78%; }
.media-desktop img { width: 100%; border: 1px solid var(--hairline); }
.media-phone {
  position: absolute;
  right: 6%;
  bottom: 6%;
  width: 20%;
}
.media-phone img { width: 100%; border: 1px solid var(--frame); border-radius: 14px; }

@media (min-width: 1024px) {
  .project { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gutter); }
  .project .media { order: 0; }
}

/* Pinned layout, only while motion.js holds the pin on wide screens. */
.work.is-pinned { padding-top: 0; padding-bottom: 0; }
.work.is-pinned .work-pin {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--header-h) + 24px);
  padding-bottom: 32px;
}
.work.is-pinned .section-head { margin-bottom: 24px; }
.work.is-pinned .work-stage { flex: 1; min-height: 0; display: grid; gap: 0; }
.work.is-pinned .project { grid-area: 1 / 1; align-items: center; }
.work.is-pinned .project:not(.is-active) { pointer-events: none; }
.work.is-pinned .media { width: min(100%, calc((100vh - 300px) * 1.45)); justify-self: end; }

/* About */
.about-text {
  grid-column: 1 / -1;
  font-size: clamp(1.5rem, 3.3vw, 3.25rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
}
.stack { grid-column: 1 / -1; margin-top: clamp(48px, 7vw, 96px); display: grid; gap: 16px; }
.stack-list { display: flex; flex-wrap: wrap; gap: 12px 0; font-family: var(--mono); font-size: 1rem; }
.stack-list li { padding: 0 20px; border-left: 1px solid var(--hairline); }
.stack-list li:first-child { padding-left: 0; border-left: 0; }
@media (min-width: 1024px) {
  .about-text { grid-column: 1 / 10; }
  .stack { grid-column: 1 / 10; }
}

/* Services: equal rows, because the three services carry equal weight. */
.service-list { border-bottom: 1px solid var(--hairline); }
.service { row-gap: 14px; padding: 32px 0; border-top: 1px solid var(--hairline); align-items: start; }
.service-title { grid-column: 1 / -1; font-size: clamp(1.75rem, 3vw, 2.75rem); line-height: 1.05; letter-spacing: -0.025em; font-weight: 400; }
.service-text { grid-column: 1 / -1; color: var(--text-2); max-width: 46ch; }
.service-cta { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 600px) {
  .service-text { grid-column: 1 / 5; }
  .service-cta { grid-column: 5 / 7; justify-self: end; }
}
@media (min-width: 1024px) {
  .service { padding: 40px 0; }
  .service-title { grid-column: 1 / 5; }
  .service-text { grid-column: 5 / 10; padding-top: 6px; }
  .service-cta { grid-column: 10 / 13; }
}

/* FAQ */
.faq-head { grid-column: 1 / -1; }
.faq-list { grid-column: 1 / -1; border-bottom: 1px solid var(--hairline); }
@media (min-width: 1024px) {
  .faq-head { grid-column: 1 / 5; align-self: start; position: sticky; top: calc(var(--header-h) + 24px); }
  .faq-list { grid-column: 5 / 13; }
}
.faq .section-title { font-size: clamp(2.25rem, 4.6vw, 4rem); }

.faq details { border-top: 1px solid var(--hairline); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 44px;
  padding: 22px 0;
  font-size: clamp(1.125rem, 1.6vw, 1.4rem);
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover > span:first-child { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.faq-icon { position: relative; flex: 0 0 18px; width: 18px; height: 18px; }
.faq-icon::before, .faq-icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 18px;
  height: 2px;
  background: var(--text);
}
.faq-icon::after { transform: rotate(90deg); }
.faq details[open] .faq-icon::after { transform: rotate(0deg); }
.faq details p { padding: 0 0 26px; max-width: 62ch; color: var(--text-2); }

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--bg);
  padding: var(--section-y) var(--pad-x) 40px;
  overflow-x: clip;
}
.contact-lead { font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 400; line-height: 1.3; }
.email-line { container-type: inline-size; margin-bottom: clamp(32px, 5vw, 56px); }
.email {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 7.4vw;
  font-size: calc(100cqi / 11.15);
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-decoration: none;
  will-change: transform;
}
.email:hover { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; }

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.copy-status { font-size: 0.9375rem; color: var(--text-2); }
.footer-link { display: inline-flex; align-items: center; min-height: 44px; }
.footer-note { margin-left: auto; font-size: 0.875rem; color: var(--text-3); }

/* 404 */
.notfound { min-height: 100vh; min-height: 100dvh; }
.notfound-pt { color: var(--text-2); margin-top: 8px; }
.notfound-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* No-flash start state for the load choreography; boot.js drops js-anim if GSAP never runs. */
.js-anim .hero-letter { transform: translateY(110%); }
.js-anim .hero-meta, .js-anim .hero-intro, .js-anim .hero-cta { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .btn, .lang-switch button, .menu-toggle, .email { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease; }
  .faq-icon::after { transition: transform 0.25s ease; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
