/* Base: fonts, reset, typography, focus, utilities. Values come from tokens.css. */

/* --- Fonts (self-hosted, Latin subset) ------------------------------------ */

@font-face {
  font-family: "Inter Tight";
  src: url("../assets/fonts/inter-tight-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Fallbacks resized to the web fonts' metrics (measured in Chromium) so the
   swap doesn't shift the layout. */
@font-face {
  font-family: "Inter Tight Fallback";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 95.67%;
  ascent-override: 101.39%;
  descent-override: 25.09%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Instrument Serif Fallback";
  src: local("Times New Roman"), local("Liberation Serif"), local("Times");
  size-adjust: 83.28%;
  ascent-override: 118.87%;
  descent-override: 37.22%;
  line-gap-override: 0%;
}

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

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

html {
  background: var(--color-bg); /* on <html> so there is never a white flash */
  color: var(--color-text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Repeated on <body>, a little more specific than a bare "body" rule: a page
   that wraps this one (e.g. a preview host) may style <body> itself, which
   would override what <html> passes down and turn the site white. */
html body {
  background: var(--color-bg);
  color: var(--color-text);
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol {
  margin: 0;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--color-selection);
  color: var(--color-text);
}

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--step-6); }
h2 { font-size: var(--step-5); }
h3 { font-size: var(--step-3); }

p {
  text-wrap: pretty;
}

/* Editorial accent: italic serif words inside big headings, e.g.
   <h2>Mes <em class="serif">travaux</em></h2> */
.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.muted {
  color: var(--color-text-muted);
}

/* --- Focus ---------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

/* --- Layout --------------------------------------------------------------- */

main > section {
  min-height: 100vh;
  padding-inline: var(--gutter);
}

/* Sections receive focus from the skip link, "Passer l'intro" and the CTA so
   keyboard users continue from there; the whole section needs no outline. */
main > section:focus {
  outline: none;
}

.skip-link {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-s);
  background: var(--color-text);
  color: var(--color-bg);
  font-weight: 600;
  transform: translateY(-200%);
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  padding: var(--space-5) var(--gutter);
}

.site-header__name {
  font-weight: 600;
  text-decoration: none;
}

/* --- Utilities ------------------------------------------------------------ */

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

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

/* TEMPORARY (foundation Task 5): project titles from content.js; removed by work-slider. */
/* Native-scroll fallback for scroll.pause() (ScrollSmoother pauses itself). */
.scroll-locked,
.scroll-locked body {
  overflow: hidden;
}
