/* Renato Ferreira Costa: portfolio
   Concept: three languages, one person. The hero says hello in Portuguese,
   Spanish or English and repaints itself. Everything below stays calm so
   that one moment is the memorable one.
   Fonts are self-hosted (see /fonts). */

@font-face {
  font-family: "Young Serif";
  src: url("/fonts/young-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #14161f;
  --paper: #f6f7fb;
  --tint: #e6e9f7;
  --muted: #474c60;
  --blue: #2f4bff;
  --yellow: #ffd23f;
  --coral: #ff7a66;
  --display: "Young Serif", Georgia, "Times New Roman", serif;
  --text: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* The page's accent follows the chosen language. */
  --hero-bg: var(--blue);
  --hero-fg: #ffffff;
  color-scheme: light;
}

html[data-lang="pt"] {
  --hero-bg: var(--yellow);
  --hero-fg: var(--ink);
}

html[data-lang="es"] {
  --hero-bg: var(--coral);
  --hero-fg: var(--ink);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
fieldset {
  margin: 0;
  padding: 0;
}

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

.wrap {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* Focus rings use a fixed colour that contrasts with whatever is behind them.
   Using currentColor failed on filled buttons, where the text colour is the
   background colour, so the ring vanished. */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.hero :focus-visible,
.contact :focus-visible {
  outline-color: var(--hero-fg);
}

main:focus {
  outline: none;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

/* White ring against the dark button, dark ring outside it: visible on blue, yellow and coral. */
.skip:focus {
  top: 1rem;
  outline: 3px solid #fff;
  outline-offset: 0;
  box-shadow: 0 0 0 6px var(--ink);
}

/* Hero */

.hero {
  background: var(--hero-bg);
  color: var(--hero-fg);
  min-height: 100vh;
  min-height: 100svh;
  transition: background-color 0.45s ease, color 0.45s ease;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  min-height: inherit;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  font-size: 1rem;
  font-weight: 600;
}

.topbar ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  list-style: none;
}

.topbar a {
  display: inline-block;
  padding: 0.4rem 0;
  text-decoration: none;
}

.topbar a:hover {
  text-decoration: underline;
}

.wordmark {
  font-weight: 800;
}

.hero-body {
  margin-top: auto;
  margin-bottom: auto;
  padding-top: 3rem;
}

.hero-title {
  font-size: 1rem;
  font-weight: 400;
}

.hello {
  display: block;
  margin-bottom: 1.25rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(5.5rem, 27vw, 17rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  /* Safety net for readers who widen letter spacing: wrap instead of overflowing. */
  overflow-wrap: anywhere;
}

.intro {
  display: block;
  max-width: 32ch;
  font-size: clamp(1.4rem, 3.4vw, 2.3rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.hero-role {
  margin-top: 1.25rem;
  font-size: 1.15rem;
  font-weight: 500;
}

.langs {
  margin-top: 2.5rem;
}

.langs[hidden],
.langs-note[hidden] {
  display: none;
}

.langs-label,
.langs-note {
  font-size: 1rem;
  font-weight: 500;
}

.langs-note {
  margin-top: 2.5rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.chip {
  padding: 0.7rem 1.2rem;
  border: 2.5px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 700 1.05rem/1 var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.3s ease, color 0.3s ease;
}

.chip:hover {
  transform: translateY(-3px);
}

.chip[aria-pressed="true"] {
  background: var(--hero-fg);
  color: var(--hero-bg);
  border-color: var(--hero-fg);
}

/* Bands */

.band {
  padding: clamp(4rem, 10vw, 8rem) 0;
}

.band-tint {
  background: var(--tint);
}

h2 {
  max-width: 18ch;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.4vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 40rem;
  margin-top: 1.25rem;
  font-size: 1.3rem;
  line-height: 1.5;
}

/* What the job looks like */

.do {
  margin-top: 3rem;
}

.do-row {
  display: grid;
  gap: 0.75rem 3rem;
  padding: 1.75rem 0;
  border-top: 3px solid var(--ink);
}

.do-row:last-child {
  border-bottom: 3px solid var(--ink);
}

.do-row h3,
.swap-row h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.do-row p {
  max-width: 34rem;
}

@media (min-width: 52rem) {
  .do-row {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* Then and now switch */

.swap {
  margin-top: 2.5rem;
}

.switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border: 0;
}

.switch label {
  padding: 0.75rem 1.4rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}

.switch label:hover {
  transform: translateY(-3px);
}

#role-then:checked ~ label[for="role-then"],
#role-now:checked ~ label[for="role-now"] {
  background: var(--ink);
  color: #fff;
}

#role-then:focus-visible ~ label[for="role-then"],
#role-now:focus-visible ~ label[for="role-now"] {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.swap-rows {
  margin-top: 2rem;
}

.swap-row {
  display: grid;
  gap: 0.5rem 2rem;
  padding: 1.5rem 0;
  border-top: 3px solid var(--ink);
}

.swap-row:last-child {
  border-bottom: 3px solid var(--ink);
}

.swap-row p {
  max-width: 34rem;
  font-size: 1.3rem;
  line-height: 1.45;
}

.swap-row strong {
  font-weight: 800;
}

@media (min-width: 40rem) {
  .swap-row {
    grid-template-columns: 14rem minmax(0, 1fr);
    align-items: baseline;
  }
}

/* Only one role shows at a time. If :has() is unavailable both stay visible,
   and each line says which role it belongs to. */
@supports selector(:has(*)) {
  .swap:not(:has(#role-now:checked)) .now {
    display: none;
  }

  .swap:has(#role-now:checked) .then {
    display: none;
  }

  .swap-row p {
    animation: swapin 0.35s ease both;
  }
}

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

.aside {
  max-width: 36rem;
  margin-top: 2rem;
  font-weight: 600;
}

/* Journey */

.path {
  position: relative;
  max-width: 46rem;
  margin-top: 3.5rem;
  padding-left: 2.75rem;
  list-style: none;
}

.path::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.7rem;
  width: 3px;
  background: var(--ink);
}

.stop {
  position: relative;
  padding-bottom: 2.5rem;
}

.stop:last-child {
  padding-bottom: 0;
}

.node {
  position: absolute;
  top: 0.15rem;
  left: -2.75rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  transition: background-color 0.4s ease;
}

.js .stop:not(.is-lit) .node {
  background: var(--paper);
}

.stop-now .node {
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 8px var(--blue);
}

.when {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}

.title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.15;
}

.role {
  font-weight: 600;
}

.place {
  display: inline-block;
  padding: 0.1rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
}

.place-north {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.plain-stop,
summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
}

summary {
  position: relative;
  padding-right: 3rem;
  list-style: none;
  cursor: pointer;
}

summary::-webkit-details-marker {
  display: none;
}

/* The second content declaration gives the symbol empty alt text so screen
   readers rely on the native expanded/collapsed state instead of saying "plus". */
summary::after {
  content: "+";
  content: "+" / "";
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

details[open] > summary::after {
  content: "\2212";
  content: "\2212" / "";
  background: var(--ink);
  color: #fff;
}

summary:hover .title {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.2em;
}

details > p,
details > ul {
  max-width: 36rem;
  margin-top: 1rem;
}

details ul {
  padding-left: 1.25rem;
}

details li + li {
  margin-top: 0.4rem;
}

/* Toolbox */

.facts {
  max-width: 44rem;
  margin-top: 2.5rem;
}

.facts div {
  display: grid;
  gap: 0.2rem 2rem;
  padding: 1.1rem 0;
  border-top: 3px solid var(--ink);
}

.facts div:last-child {
  border-bottom: 3px solid var(--ink);
}

.facts dt {
  font-weight: 800;
}

@media (min-width: 40rem) {
  .facts div {
    grid-template-columns: 9rem minmax(0, 1fr);
  }
}

/* Contact: the chosen language colour bookends the page */

.contact {
  background: var(--hero-bg);
  color: var(--hero-fg);
  padding: clamp(4rem, 10vw, 8rem) 0 3rem;
  transition: background-color 0.45s ease, color 0.45s ease;
}

.contact h2 {
  max-width: none;
  overflow-wrap: anywhere;
  font-size: clamp(3.5rem, 15vw, 10rem);
  line-height: 0.95;
}

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

.btn {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  border: 3px solid currentColor;
  background: transparent;
  color: inherit;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 5px 5px 0 currentColor;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 currentColor;
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 currentColor;
}

.btn-solid {
  background: var(--hero-fg);
  border-color: var(--hero-fg);
  color: var(--hero-bg);
  box-shadow: 5px 5px 0 var(--hero-fg);
}

.btn-solid:hover {
  box-shadow: 7px 7px 0 var(--hero-fg);
}

.btn-solid:active {
  box-shadow: 2px 2px 0 var(--hero-fg);
}

.thanks {
  margin-top: 4rem;
  font-size: 1rem;
  font-weight: 600;
}

/* 404 */

.lost {
  padding: clamp(3rem, 12vw, 8rem) 0;
}

.lost h1 {
  max-width: 14ch;
  margin-bottom: 1.25rem;
  font-family: var(--display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 400;
  line-height: 1.02;
}

.lost p {
  max-width: 32rem;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

/* Motion preferences */

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

  .hero,
  .contact,
  .chip,
  .switch label,
  .btn,
  .node {
    transition: none;
  }

  .swap-row p {
    animation: none;
  }

  .chip:hover,
  .switch label:hover,
  .btn:hover,
  .btn:active {
    transform: none;
  }
}

/* People who ask for more contrast get darker secondary text and heavier outlines. */
@media (prefers-contrast: more) {
  :root {
    --muted: var(--ink);
  }

  .place,
  .chip,
  .switch label,
  .btn {
    border-width: 3px;
  }

  :focus-visible {
    outline-width: 4px;
  }
}

/* Windows high-contrast and other forced-colour modes drop backgrounds, so
   selected states are redrawn with system colours rather than fills alone. */
@media (forced-colors: active) {
  .chip[aria-pressed="true"],
  #role-then:checked ~ label[for="role-then"],
  #role-now:checked ~ label[for="role-now"],
  .btn-solid {
    forced-color-adjust: none;
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }

  details[open] > summary::after {
    forced-color-adjust: none;
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }

  .place-north {
    forced-color-adjust: none;
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }

  .node {
    forced-color-adjust: none;
    background: Canvas;
    border-color: CanvasText;
  }

  .stop-now .node,
  .js .stop.is-lit .node {
    background: Highlight;
  }

  .path::before {
    background: CanvasText;
  }

  :focus-visible {
    outline-color: Highlight;
  }

  .hero :focus-visible,
  .contact :focus-visible {
    outline-color: Highlight;
  }
}

/* Print */

@media print {
  .skip,
  .topbar,
  .langs,
  .switch,
  .actions {
    display: none;
  }

  .hero,
  .contact {
    min-height: 0;
    background: #fff;
    color: #000;
  }

  .hero-body {
    padding-top: 0;
  }

  .hello {
    font-size: 4rem;
  }

  .band,
  .band-tint {
    padding: 1.5rem 0;
    background: #fff;
  }

  .swap .then,
  .swap .now {
    display: block;
  }

  details > * {
    display: block;
  }

  .stop {
    break-inside: avoid;
  }
}
