/* =========================================================
   Henrique Poltronieri — personal site
   Layout system: a specification document.
   Every section is a margin label + a body, separated by
   one continuous hairline that runs the height of the page.
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --fg-2: #999999;
  --fg-3: #5c5c5c;
  --rule: #242424;
  --accent: #f2c14e;

  --display: "Bricolage Grotesque", "Schibsted Grotesk", sans-serif;
  --sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(20px, 5vw, 72px);
  --page: 1440px;
  --label-col: 212px;
  --band-gap: clamp(32px, 6vw, 72px);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── Reset ─────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: var(--accent);
  color: #0a0a0a;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 12px 18px;
  background: var(--fg);
  color: var(--bg);
  font: 500 13px/1 var(--mono);
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ── Masthead ──────────────────────────────────────────── */

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), padding 0.4s var(--ease);
}

.masthead.is-stuck {
  border-bottom-color: var(--rule);
  padding-block: 14px;
}

.masthead__name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.masthead__end {
  display: flex;
  align-items: baseline;
  gap: 32px;
}

.masthead__nav {
  display: flex;
  gap: 26px;
  font: 400 13px/1 var(--mono);
  color: var(--fg-2);
}

.masthead__nav a {
  position: relative;
  padding-bottom: 3px;
  transition: color 0.25s var(--ease);
}

.masthead__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.masthead__nav a:hover,
.masthead__nav a[aria-current="true"] {
  color: var(--fg);
}

.masthead__nav a:hover::after,
.masthead__nav a[aria-current="true"]::after {
  transform: scaleX(1);
}

/* Language switch — two words and a slash, no widget. */

.lang {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font: 400 13px/1 var(--mono);
}

.lang__opt {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-3);
  font: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.25s var(--ease);
}

.lang__opt:hover {
  color: var(--fg-2);
}

.lang__opt[aria-pressed="true"] {
  color: var(--fg);
}

.lang__sep {
  color: var(--rule);
}

.masthead__toggle {
  display: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-2);
  font: 400 13px/1 var(--mono);
  cursor: pointer;
}

/* Mobile overlay menu */

.menu {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 40px;
  padding: 0 var(--gutter) 56px;
  background: var(--bg);
}

.menu[hidden] {
  display: none;
}

.menu__nav {
  font-family: var(--display);
  font-variation-settings: "opsz" 48;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: clamp(34px, 12vw, 52px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.menu__meta {
  font: 400 12px/1 var(--mono);
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Band: the page's one structural idea ──────────────── */

.band {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.band__label {
  align-self: start;
  padding-right: 24px;
  font: 400 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.band__count {
  color: var(--fg-3);
}

.band__body {
  border-left: 1px solid var(--rule);
  padding-left: var(--band-gap);
  padding-block: clamp(60px, 8vw, 104px);
  min-width: 0;
}

/* The hairline runs unbroken: vertical space lives inside the body,
   never between the bands. */
.band__label {
  margin-top: clamp(60px, 8vw, 104px);
}

/* ── Hero ──────────────────────────────────────────────── */

.band--hero .band__body,
.band--hero .band__label {
  padding-top: 0;
}

.band--hero .band__body {
  padding-block: clamp(140px, 22vh, 210px) clamp(80px, 14vw, 150px);
}

.band--hero .band__label {
  margin-top: clamp(140px, 22vh, 210px);
}

.hero__name {
  font-family: var(--display);
  font-variation-settings: "opsz" 96;
  font-size: clamp(52px, 11.5vw, 148px);
  font-weight: 500;
  line-height: 0.87;
  letter-spacing: -0.045em;
}

.hero__name span {
  display: block;
}

.hero__name span:last-child {
  color: var(--fg-2);
}

.hero__foot {
  display: grid;
  grid-template-columns: minmax(0, 46ch) minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  margin-top: clamp(40px, 7vw, 84px);
}

.hero__lede {
  max-width: 46ch;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  color: var(--fg);
}

.hero__spec {
  margin-top: 20px;
  font: 400 13px/1.6 var(--mono);
  color: var(--fg-2);
  letter-spacing: 0.02em;
}

.hero__links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  text-align: right;
  gap: 10px;
  padding-top: 4px;
  font: 400 13px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--fg-2);
}

.hero__links a {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.hero__links a:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* The one button on the page. */

.hero__cv {
  margin-top: 8px;
}

.hero__links .hero__cv a {
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--fg);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.hero__links .hero__cv a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero__cv i {
  display: inline-block;
  margin-left: 10px;
  font-style: normal;
  color: var(--fg-3);
  transition: transform 0.3s var(--ease), color 0.25s var(--ease);
}

.hero__cv a:hover i {
  color: inherit;
  transform: translateY(3px);
}

/* ── Prose ─────────────────────────────────────────────── */

.prose {
  max-width: 60ch;
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.68;
  color: var(--fg-2);
}

.prose p + p {
  margin-top: 1.4em;
}

.prose a {
  color: var(--fg);
  border-bottom: 1px solid var(--fg-3);
  padding-bottom: 1px;
  transition: border-color 0.25s var(--ease);
}

.prose a:hover {
  border-bottom-color: var(--accent);
}

/* ── Statement ─────────────────────────────────────────── */

.band--statement .band__body {
  border-left-color: var(--rule);
}

.statement {
  font-family: var(--display);
  font-variation-settings: "opsz" 48;
  max-width: 20ch;
  font-size: clamp(28px, 4.6vw, 56px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.statement em {
  font-style: normal;
  color: var(--fg-3);
}

/* ── Work ──────────────────────────────────────────────── */

.work__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 260px;
  gap: 0 24px;
  padding: 30px 0;
  border-top: 1px solid var(--rule);
}

.work li:last-child .work__item {
  border-bottom: 1px solid var(--rule);
}

.work__index {
  font: 400 12px/1.9 var(--mono);
  color: var(--fg-3);
  letter-spacing: 0.06em;
  transition: color 0.35s var(--ease);
}

.work__name {
  font-family: var(--display);
  font-variation-settings: "opsz" 36;
  display: block;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.work__arrow {
  display: inline-block;
  margin-left: 14px;
  font-size: 0.5em;
  font-style: normal;
  color: var(--fg-3);
  transform: translateY(-0.35em);
  transition: color 0.35s var(--ease), transform 0.45s var(--ease);
}

.work__note {
  display: block;
  max-width: 48ch;
  margin-top: 12px;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--fg-2);
}

.work__spec {
  align-self: start;
  padding-top: 12px;
  font: 400 12px/1.7 var(--mono);
  color: var(--fg-3);
  letter-spacing: 0.02em;
  text-align: right;
}

/* One gesture: the entry steps forward, its number lights up. */
.work__main {
  transition: transform 0.45s var(--ease);
}

.work__item:hover .work__main,
.work__item:focus-visible .work__main {
  transform: translateX(12px);
}

.work__item:hover .work__index,
.work__item:focus-visible .work__index {
  color: var(--accent);
}

.work__item:hover .work__arrow,
.work__item:focus-visible .work__arrow {
  color: var(--fg);
  transform: translate(6px, -0.35em);
}

/* ── Stack ─────────────────────────────────────────────── */

.stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 44px 32px;
}

.stack__group h3 {
  margin-bottom: 16px;
  font: 400 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.stack__group p {
  font-size: 17px;
  line-height: 1.9;
  color: var(--fg);
}

/* ── Trajectory ────────────────────────────────────────── */

.years__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}

.years__row:last-child {
  border-bottom: 1px solid var(--rule);
}

.years dt {
  font: 400 13px/1.7 var(--mono);
  color: var(--fg);
  letter-spacing: 0.04em;
}

.years dd {
  max-width: 52ch;
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg-2);
}

/* ── Repositories ──────────────────────────────────────── */

.repos a {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr) 80px;
  gap: 20px;
  align-items: baseline;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  transition: color 0.3s var(--ease);
}

.repos li:last-child a {
  border-bottom: 1px solid var(--rule);
}

.repos__name {
  font: 400 14px/1.5 var(--mono);
  color: var(--fg);
  letter-spacing: -0.01em;
}

.repos__desc {
  font-size: 15px;
  color: var(--fg-2);
  transition: color 0.3s var(--ease);
}

.repos__lang {
  font: 400 12px/1.6 var(--mono);
  color: var(--fg-3);
  text-align: right;
}

.repos a:hover .repos__name {
  color: var(--accent);
}

.repos a:hover .repos__desc {
  color: var(--fg);
}

.repos__all {
  margin-top: 26px;
  font: 400 13px/1 var(--mono);
  color: var(--fg-2);
}

.repos__all i {
  font-style: normal;
  margin-left: 6px;
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.repos__all a:hover {
  color: var(--fg);
}

.repos__all a:hover i {
  transform: translate(2px, -2px);
}

/* ── Contact ───────────────────────────────────────────── */

.band--contact .band__body {
  padding-bottom: clamp(90px, 13vw, 160px);
}

.contact__call {
  font-family: var(--display);
  font-variation-settings: "opsz" 72;
  font-size: clamp(38px, 6.6vw, 86px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.contact__links {
  margin-top: clamp(48px, 7vw, 80px);
  max-width: 620px;
}

.contact__links a {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
  transition: color 0.3s var(--ease);
}

.contact__links li:last-child a {
  border-bottom: 1px solid var(--rule);
}

.contact__kind {
  font: 400 12px/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color 0.3s var(--ease);
}

.contact__value {
  font-size: 16px;
  color: var(--fg-2);
  overflow-wrap: anywhere;
  transition: color 0.3s var(--ease);
}

.contact__links a:hover .contact__kind {
  color: var(--accent);
}

.contact__links a:hover .contact__value {
  color: var(--fg);
}

/* ── Colophon ──────────────────────────────────────────── */

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  justify-content: space-between;
  max-width: var(--page);
  margin-inline: auto;
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--rule);
  font: 400 12px/1.6 var(--mono);
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

/* =========================================================
   Case study pages
   ========================================================= */

.case__back {
  display: inline-block;
  font: 400 13px/1 var(--mono);
  color: var(--fg-2);
  transition: color 0.25s var(--ease);
}

.case__back i {
  font-style: normal;
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.3s var(--ease);
}

.case__back:hover {
  color: var(--fg);
}

.case__back:hover i {
  transform: translateX(-4px);
}

.case__title {
  font-family: var(--display);
  font-variation-settings: "opsz" 84;
  font-size: clamp(46px, 8.5vw, 104px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.case__descriptor {
  max-width: 40ch;
  margin-top: clamp(28px, 4vw, 44px);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  color: var(--fg-2);
}

.case__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 48px;
  margin-top: clamp(40px, 6vw, 64px);
  font: 400 12px/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.case__facts b {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.case__facts a {
  border-bottom: 1px solid var(--fg-3);
  padding-bottom: 1px;
}

.case__facts a:hover {
  border-bottom-color: var(--accent);
}

.case__list {
  max-width: 620px;
  font-size: 16px;
  line-height: 1.5;
}

.case__list li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 13px 0;
  border-top: 1px solid var(--rule);
}

.case__list li:last-child {
  border-bottom: 1px solid var(--rule);
}

.case__list span {
  font: 400 12px/1.7 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.case__list b {
  color: var(--fg);
  font-weight: 400;
}

/* Architecture: a plain vertical read, not a diagram of boxes */
.flow {
  max-width: 760px;
  margin-top: 8px;
  font: 400 13px/1.9 var(--mono);
  color: var(--fg-2);
}

.flow__step {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 200px;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--rule);
}

.flow__step:last-child {
  border-bottom: 1px solid var(--rule);
}

.flow__tier {
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.flow__what {
  color: var(--fg);
}

.flow__via {
  color: var(--fg-3);
  text-align: right;
}

.case__next {
  font-family: var(--display);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 500;
  letter-spacing: -0.03em;
  transition: color 0.3s var(--ease);
}

.case__next span {
  font: 400 12px/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.case__next:hover {
  color: var(--accent);
}

/* =========================================================
   Motion
   ========================================================= */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
}

.js-ready [data-reveal] {
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.no-js [data-reveal] {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1080px) {
  .hero__foot {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(40px, 7vw, 64px);
  }

  .hero__links {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-self: start;
    text-align: left;
    gap: 10px 26px;
  }

  :root {
    --label-col: 160px;
  }

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

  .work__spec {
    grid-column: 2;
    margin-top: 16px;
    text-align: left;
  }

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

@media (max-width: 860px) {
  .masthead__nav {
    display: none;
  }

  .masthead__toggle {
    display: block;
  }

  /* The vertical rule is a desktop device. On small screens the
     sections are separated by horizontal rules instead. */
  .band {
    display: block;
  }

  .band__label {
    margin-top: clamp(60px, 13vw, 88px);
    margin-bottom: 22px;
    padding-right: 0;
  }

  .band__body {
    border-left: 0;
    padding-left: 0;
    padding-block: 0 clamp(60px, 13vw, 88px);
  }

  .band + .band {
    border-top: 1px solid var(--rule);
  }

  .band--hero .band__label {
    margin-top: clamp(112px, 24vh, 150px);
  }

  .band--hero .band__body {
    padding-block: 0 clamp(56px, 12vw, 84px);
  }

  .band--statement .band__label {
    display: none;
  }

  .repos a {
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .repos__desc {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .years__row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .flow__step {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .flow__via {
    text-align: left;
  }

  .case__list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .stack {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .contact__links a {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .case__facts {
    gap: 20px 36px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* Case pages read as a document: shorter sections, tighter rhythm. */

.case .band__body {
  padding-block: clamp(48px, 5.5vw, 74px);
}

.case .band__label {
  margin-top: clamp(48px, 5.5vw, 74px);
}

.case .band--hero .band__body {
  padding-block: clamp(120px, 18vh, 168px) clamp(48px, 6vw, 78px);
}

.case .band--hero .band__label {
  margin-top: clamp(120px, 18vh, 168px);
}

.case .prose p + p {
  margin-top: 1.1em;
}

.colophon a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.colophon a:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

@media (max-width: 860px) {
  .case .band__label {
    margin-top: clamp(48px, 10vw, 72px);
  }

  .case .band__body {
    padding-block: 0 clamp(48px, 10vw, 72px);
  }

  .case .band--hero .band__label {
    margin-top: clamp(104px, 22vh, 140px);
  }

  .case .band--hero .band__body {
    padding-block: 0 clamp(48px, 10vw, 72px);
  }
}

@media (max-width: 560px) {
  .masthead__name {
    white-space: nowrap;
  }

  .masthead__end {
    gap: 18px;
  }

  /* Only the arrow fits next to the language switch; the words stay
     available to screen readers. */
  .case__back span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .case__back i {
    margin-right: 0;
  }
}
