/* Manrope comes from Google Fonts (see the <link> in index.html). */

/* Color: each theme is one paper, one ink and one accent. Every other shade is the
   ink mixed into the paper, so changing a theme means changing these three. */
:root {
  --bg: #eeebe3;
  --ink: #171615;
  --accent: #be1e2d;
  --muted-mix: 58%;   /* large type: 3:1 or more */
  --quiet-mix: 70%;   /* small type: 4.5:1 or more */
  color-scheme: light;
}

/* Dark: the system's choice, unless the visitor picked light; or the visitor picked dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171615;
    --ink: #eeebe3;
    --accent: #ff6b6b;
    --muted-mix: 52%;
    --quiet-mix: 68%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171615;
  --ink: #eeebe3;
  --accent: #ff6b6b;
  --muted-mix: 52%;
  --quiet-mix: 68%;
  color-scheme: dark;
}

:root {
  --muted: color-mix(in srgb, var(--ink) var(--muted-mix), var(--bg));
  --quiet: color-mix(in srgb, var(--ink) var(--quiet-mix), var(--bg));
  --line: color-mix(in srgb, var(--ink) 18%, var(--bg));
  --chip: color-mix(in srgb, var(--ink) 9%, var(--bg));
  --rule: color-mix(in srgb, var(--ink) 40%, var(--bg));   /* link underlines */
}

/* Theme switch: the script opens the new page as a circle; no default crossfade. */
html.vt-theme::view-transition-old(root),
html.vt-theme::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Language switch: the page behind the blocks swaps at once (only text changes);
   each named block fades out softly and comes back in focus; height changes glide. */
html.vt-lang::view-transition-group(*) {
  animation-duration: .5s;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}
html.vt-lang::view-transition-old(*) { animation: lang-out .2s ease-in both; }
html.vt-lang::view-transition-new(*) { animation: lang-in .45s cubic-bezier(.2, .8, .2, 1) both; }
/* Named (root) beats (*): the page behind stays still. */
html.vt-lang::view-transition-old(root),
html.vt-lang::view-transition-new(root) { animation: none; }
@keyframes lang-out { to { opacity: 0; filter: blur(4px); } }
@keyframes lang-in { from { opacity: 0; filter: blur(6px); translate: 0 4px; } }

/* Two languages in the page; show only the active one (English without script). */
html:not([data-lang="pt"]) [lang="pt"],
html[data-lang="pt"] [lang="en"] { display: none; }

* { box-sizing: border-box; }

::selection { background: var(--ink); color: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

main, footer, .controls {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

main { padding-top: clamp(40px, 12vh, 120px); }

/* Language and theme buttons, top right. Hidden without script, since they need it. */
.controls { display: none; justify-content: flex-end; gap: 8px; padding-top: 20px; }
.js .controls { display: flex; }
.controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 99px;
  background: var(--chip);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.controls button:hover { background: var(--ink); color: var(--bg); }
.controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* Big sentence: grey, with the words that matter in full ink. */
.statement {
  margin: 0;
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--muted);
}
.statement, .path p, .list p { text-wrap: pretty; }
.nowrap { white-space: nowrap; }

/* The path from 2001: smaller than the statement, same grey-and-ink voice. */
.path {
  max-width: 36em;
  margin: clamp(24px, 4vh, 40px) 0 0;
  font-size: clamp(1.0625rem, 1.7vw, 1.25rem);
  line-height: 1.55;
  color: var(--quiet);
}
.path p { margin: 0; }
.path p + p { margin-top: 1em; }
.path b { font-weight: 600; color: var(--ink); }
/* Company links: ink with a quiet underline, accent on hover. */
.path a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s;
}
.path a:hover { color: var(--accent); text-decoration-color: currentColor; }
.statement b { font-weight: 600; color: var(--ink); }
.statement a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: 5px; transition: color .15s, text-decoration-color .15s; }
.statement a:hover { color: var(--accent); text-decoration-color: currentColor; }

section {
  margin-top: clamp(80px, 14vh, 140px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-head { margin-bottom: 28px; }
.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

/* Project list: large names, small detail underneath. */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0 14px; transition: opacity .2s; }

.list a {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.list sup {
  margin-left: 4px;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--quiet);
  vertical-align: super;
  font-variant-numeric: tabular-nums;
}

.list p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--quiet);
  font-size: 0.875rem;
}
.list .tag {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--chip);
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
}

/* Thumbnail stack under a project. Phones: a row you scroll, a tap opens the image. */
.thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.thumbs a { flex: none; scroll-snap-align: start; border-radius: 6px; }
.thumbs img {
  display: block;
  width: auto;
  height: 120px;
  border-radius: 6px;
}

@media (hover: hover) and (pointer: fine) {
  /* Overlapping like a stack; it fans out when the pointer reaches it. */
  .thumbs { width: fit-content; gap: 0; overflow: visible; padding-left: 14px; }
  .thumbs a {
    margin-left: -14px;
    outline: 2px solid var(--bg);
    transition: margin .25s ease, translate .2s ease;
  }
  .thumbs img { height: 72px; }
  .thumbs:hover a + a { margin-left: 6px; }
  .thumbs a:hover { translate: 0 -4px; }

  /* The large picture. It arrives blurred and comes into focus, like Strikebar's Blur tool. */
  .peek {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: auto;
    height: auto;
    max-width: min(520px, 60vw);
    max-height: min(560px, 72vh);
    border-radius: 10px;
    opacity: 0;
    scale: .96;
    filter: blur(14px);
    pointer-events: none;
    box-shadow: 0 24px 60px rgb(0 0 0 / .3);
    transition: opacity .2s, filter .4s, scale .3s;
  }
  .peek.is-on { opacity: 1; filter: none; scale: 1; }
}

/* Pointing at one project quiets the others. */
@media (hover: hover) {
  .list:has(li:hover) li:not(:hover) { opacity: .35; }
}

footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-top: clamp(96px, 16vh, 160px);
  padding-top: 24px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--quiet);
}
footer > ul { list-style: none; margin: 0; padding: 0; }
footer a { color: var(--ink); }
footer a:hover { color: var(--accent); }
footer ul + ul { text-align: right; }

@media (prefers-reduced-motion: reduce) {
  .list li, .thumbs a, .peek { transition: none; }
  .peek { filter: none; }
}
