/* Fonts, reset, typography and page layout. Mobile first. */

/* ---------- Fonts: self-hosted Latin subsets of the CV's fonts (SIL OFL 1.1) ----------
   "TP Text" is Lato: its licence reserves the name "Lato" for unmodified files. */

@font-face {
  font-family: "TP Text";
  src: url("../fonts/lato-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TP Text";
  src: url("../fonts/lato-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("../fonts/space-mono-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("../fonts/space-mono-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* System fallbacks scaled to the web fonts' text width, so the swap does not move the layout.
   size-adjust = width of the site's text in the web font / in the fallback. */

@font-face {
  font-family: "TP Text Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 400;
  size-adjust: 98.2%;
}

@font-face {
  font-family: "TP Text Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 700;
  size-adjust: 93.5%;
}

@font-face {
  font-family: "Poppins Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 500;
  size-adjust: 110.2%;
}

@font-face {
  font-family: "Poppins Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 600;
  size-adjust: 104%;
}

@font-face {
  font-family: "Space Mono Fallback";
  src: local("Courier New"), local("CourierNewPSMT");
  size-adjust: 102%;
}

/* ---------- Reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-height) + var(--space-sm));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  /* Cross-fade between the pages of the site (French, English, legal notice) where the browser supports it */
  @view-transition {
    navigation: auto;
  }
}

/* The CV's blue band: a strip on top on small screens, down the left edge on wide ones */
body {
  min-height: 100vh;
  margin: 0;
  border-top: var(--band-width) solid var(--color-accent);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-base);
}

@media (min-width: 48em) {
  body {
    border-top: 0;
    border-left: var(--band-width) solid var(--color-accent);
  }
}

/* Soft washes of the CV's blue and plum behind the page; they stay put while it scrolls */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 42rem at 100% 0%, var(--glow-blue), transparent 65%),
    radial-gradient(52rem 40rem at 0% 45%, var(--glow-plum), transparent 65%),
    radial-gradient(56rem 40rem at 90% 100%, var(--glow-blue), transparent 65%);
  pointer-events: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--leading-tight);
  overflow-wrap: break-word;
}

p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

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

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

a {
  color: var(--color-accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

strong {
  font-weight: 700;
}

/* ---------- Helpers ---------- */

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 30; /* above the sticky top bar */
  padding: var(--space-xs) var(--space-md);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Controls that only make sense with scripting stay out of the way without it */
@media not (scripting: enabled) {
  .needs-js {
    display: none !important;
  }
}

/* ---------- Top bar: sticky, compact, with a reading-progress line ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  border-bottom: var(--border-width) solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  font-size: var(--text-sm);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  height: 100%;
}

.topbar__brand {
  display: none;
  padding-block: var(--space-xs); /* same target height as the links beside it */
  color: var(--color-highlight);
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 48em) {
  .topbar__brand {
    display: block;
  }
}

/* Section links scroll sideways when the bar is too narrow for them; they fade out at the right edge
   so a cut-off link reads as "there is more", not as a glitch */
.topbar__nav {
  flex: 1;
  min-width: 0;
  /* Room around the links for their focus ring, which a scrolling strip cuts at its edges;
     the negative margin keeps the strip where it was */
  margin: -0.375rem;
  padding: 0.375rem;
  /* Without the script: a link reached with the keyboard still scrolls clear of the fade on the right */
  scroll-padding-inline: 0.5rem 2.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 1.5rem), transparent);
}

.topbar__nav .nav-list {
  width: max-content;
  padding-right: 1.5rem;
}

.topbar__progress {
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 3px;
  background: var(--color-highlight);
  transform-origin: 0 50%;
  scale: 0 1;
}

@supports (animation-timeline: scroll()) {
  .topbar__progress {
    animation: topbar-progress linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes topbar-progress {
  to {
    scale: 1 1;
  }
}

/* ---------- Hero: identity and links ---------- */

.site-header {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-xl);
  background: linear-gradient(
    120deg,
    var(--color-surface) 0%,
    color-mix(in srgb, var(--color-surface) 90%, var(--color-accent)) 60%,
    color-mix(in srgb, var(--color-surface) 92%, var(--color-highlight)) 100%
  );
}

/* Dotted orbits in the right corner, echoing the orrery and the CV's leaders.
   Pages with the portrait centre them on it instead (see .identity below). */
.site-header:has(.identity__photo)::after {
  display: none;
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: min(44rem, 80%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 400'%3E%3Cg fill='none' stroke='%239a9de0' stroke-width='2.2' stroke-linecap='round' stroke-dasharray='0.1 9'%3E%3Ccircle cx='360' cy='150' r='90'/%3E%3Ccircle cx='360' cy='150' r='160'/%3E%3Ccircle cx='360' cy='150' r='230'/%3E%3Ccircle cx='360' cy='150' r='300'/%3E%3C/g%3E%3C/svg%3E")
    right top / cover no-repeat;
  opacity: 0.6;
  pointer-events: none;
}

.site-header > .container {
  position: relative;
  z-index: 1;
}

.identity {
  --orbits: 44rem; /* width of the dotted orbits drawn around the portrait */
  position: relative;
  isolation: isolate;
  display: grid;
  gap: var(--space-md) var(--space-lg);
}

.identity__photo {
  order: -1;
  width: var(--photo-size);
  height: var(--photo-size);
  border-radius: 50%;
}

/* Dotted orbits with the portrait at their centre: the portrait is the first item of the grid on
   small screens (top left) and the last one from 40em (top right), so the centre is half a portrait in. */
.identity:has(.identity__photo)::before {
  content: "";
  position: absolute;
  top: calc((var(--photo-size) - var(--orbits)) / 2);
  left: calc((var(--photo-size) - var(--orbits)) / 2);
  z-index: -1;
  width: var(--orbits);
  height: var(--orbits);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 440 440'%3E%3Cg fill='none' stroke='%239a9de0' stroke-width='2.2' stroke-linecap='round' stroke-dasharray='0.1 9'%3E%3Ccircle cx='220' cy='220' r='62'/%3E%3Ccircle cx='220' cy='220' r='98'/%3E%3Ccircle cx='220' cy='220' r='134'/%3E%3Ccircle cx='220' cy='220' r='170'/%3E%3Ccircle cx='220' cy='220' r='206'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.65;
  pointer-events: none;
}

@media (min-width: 40em) {
  .identity {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .identity__photo {
    order: 0;
  }

  .identity:has(.identity__photo)::before {
    right: calc((var(--photo-size) - var(--orbits)) / 2);
    left: auto;
  }
}

.identity__name {
  font-size: var(--text-2xl);
  color: var(--color-highlight);
}

.identity__title {
  margin-top: var(--space-2xs);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: var(--leading-tight);
  color: var(--color-accent);
}

.identity__stack {
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
}

.identity__availability {
  margin-top: var(--space-md);
  max-width: var(--measure);
}

.identity__availability strong {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-highlight);
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--space-xl);
}

/* Plum bar + blue capitals, as on the CV */
.section__title {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-sm);
  border-left: 0.3rem solid var(--color-highlight);
  font-size: var(--text-xl);
  text-transform: uppercase;
  color: var(--color-accent);
}

.section__subtitle {
  margin-bottom: var(--space-md);
  font-size: var(--text-md);
}

.section__subtitle:not(:first-of-type) {
  margin-top: var(--space-xl);
}

.prose {
  max-width: var(--measure);
}

/* On the home page the profile runs the full width, like the cards under it */
.prose--wide {
  max-width: none;
}

/* Running text: paragraphs and bullet lists keep some air */
.prose p + p,
.prose ul + p {
  margin-top: var(--space-sm);
}

.prose p + ul {
  margin-top: var(--space-xs);
}

/* A first subtitle that follows an introduction is set apart like the next ones */
.prose > p + .section__subtitle {
  margin-top: var(--space-xl);
}

/* A page shorter than the screen (page not found): its footer still sits at the bottom */
.page-short {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-short main {
  flex: 1;
}

.prose ul {
  display: grid;
  gap: var(--space-xs);
  padding-left: 1.2em;
  list-style: disc;
}

/* ---------- Page footer ---------- */

.site-footer {
  padding-block: var(--space-xl);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.site-footer__name {
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-highlight);
}
