/* Yukali — the whole look of the site, following charte_yukali.md ("La Revue calme").
   Change the look here, starting with the variables below: no Markdown file needs to change. */

/* Cormorant Garamond, headings only (SIL Open Font License, see fonts/OFL.txt). Latin subset, French included. */
@font-face {
  font-family: "Cormorant Garamond";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600.woff2") format("woff2");
}

/* ---------------------------------------------------------------------------------------------------------------
   Variables: colours (charte § 2.2), fonts (§ 2.3), widths and spacing (§ 3)
   --------------------------------------------------------------------------------------------------------------- */
:root {
  --color-paper: #F7F5F0;       /* page background; text on green (contrast 9.0 on green-deep) */
  --color-ink: #232826;         /* body text (13.7 on paper) */
  --color-green-deep: #294A42;  /* header band, headings, links, picture tint (9.0 on paper) */
  --color-green-moss: #5E746B;  /* metadata, rules (4.6 on paper: never text smaller than 0.875rem) */
  --color-stone: #D8D3C8;       /* thin rules inside lists, never text */
  --color-green-pale: #E7ECE8;  /* footer band (green-deep on it: 8.2) */

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

  --site-width: 75rem;          /* 1200px */
  --content-width: 65ch;        /* about 70 characters per line (charte: 60 to 75) */
  --gutter: clamp(1.5rem, 4vw, 3.5rem);  /* 24px on a phone to 56px on a large screen */

  /* Green veil on the pictures (see "Pictures" below). Original colours: tint 0 and saturation 1. */
  --picture-saturation: 0.8;    /* 0 = grey, 1 = the picture's own colours */
  --picture-tint: 0.2;          /* 0 = no green veil, 1 = fully green */
}

/* ---------------------------------------------------------------------------------------------------------------
   Page
   --------------------------------------------------------------------------------------------------------------- */
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* The centred column shared by the header band, the page and the footer band, with the gutter on each side */
.container {
  width: min(100% - 2 * var(--gutter), var(--site-width));
  margin-inline: auto;
}

main { padding: 4rem 0 2rem; }

/* "Measured asymmetry" (charte § 3.1): on large screens, the text starts one twelfth to the right */
@media (min-width: 64rem) {
  main { padding-left: calc(var(--site-width) / 12); box-sizing: border-box; }
}

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

/* ---------------------------------------------------------------------------------------------------------------
   Text
   --------------------------------------------------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  color: var(--color-green-deep);
  margin: 0 0 1rem;
}
h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); font-weight: 500; line-height: 1.08; margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.75rem, 3vw, 2.8rem); margin-top: 3rem; }
h3 { font-size: 1.65rem; margin-top: 2rem; }

p { margin: 0 0 1.25rem; }

a {
  color: var(--color-green-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-thickness 150ms;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 3px solid var(--color-green-deep); outline-offset: 3px; }

/* Metadata line above a title: section, term or date. The short green rule before it echoes the header band. */
.meta { margin: 0 0 0.75rem; font-size: 0.875rem; line-height: 1.4; color: var(--color-green-moss); }
.page-head .meta::before {
  content: "";
  display: inline-block;
  width: 2rem;
  margin-right: 0.75rem;
  border-top: 2px solid var(--color-green-deep);
  vertical-align: middle;
}

/* Quotation: light indent and a green rule (charte § 5.4) */
blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--color-green-deep);
}

code { font-family: var(--font-mono); font-size: 0.9em; }

/* The "new" mark written in the Markdown as <span class="new">new</span> */
.new {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  background: var(--color-green-deep);
  color: var(--color-paper);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: 0.1em;
}

/* ---------------------------------------------------------------------------------------------------------------
   Pictures: the same green veil on all of them, whatever their colours, so that they read as one family
   (charte § 6). The picture's colours are toned down (saturate), then a green-deep layer lends it its hue
   ("color" blending), more or less strongly (opacity). Both settings are variables at the top of this file.
   --------------------------------------------------------------------------------------------------------------- */
.picture {
  position: relative;
  display: block;
  margin: 0;
  overflow: hidden;
}
.picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;          /* fill the frame, cropping the edges if needed */
  object-position: center 30%;
  filter: saturate(var(--picture-saturation));
}
.picture::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-green-deep);
  mix-blend-mode: color;
  opacity: var(--picture-tint);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------------------------------------------
   Header band (green) and footer band (pale green)
   --------------------------------------------------------------------------------------------------------------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.9rem;
  line-height: 1;
  text-decoration: none;
}

.site-header { background: var(--color-green-deep); color: var(--color-paper); }
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 2rem;
  padding: 1.5rem 0;
}
.site-header a { color: var(--color-paper); }
.site-header a:focus-visible { outline-color: var(--color-paper); }
.site-header ul { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin: 0; padding: 0; list-style: none; }
.site-header nav a {
  display: inline-block;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.site-header nav a:hover { text-decoration: underline 1px; text-underline-offset: 0.45em; }
/* Active section: underlined, so the sign does not rely on colour alone (charte § 4) */
.site-header nav a[aria-current="page"] { text-decoration: underline 2px; text-underline-offset: 0.45em; }

.site-footer { margin-top: 4rem; background: var(--color-green-pale); font-size: 0.875rem; }
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 2.5rem 0 3rem;
}
.site-footer .wordmark { font-size: 1.4rem; margin-right: auto; color: var(--color-green-deep); }

/* Link to jump over the menu, visible only when reached with the keyboard */
.skip-link { position: absolute; left: -100vw; }
.skip-link:focus { left: 1rem; top: 1rem; padding: 0.5rem 1rem; background: var(--color-paper); }

/* ---------------------------------------------------------------------------------------------------------------
   Pages
   --------------------------------------------------------------------------------------------------------------- */
.page, .home-text { max-width: var(--content-width); }

/* A page's picture: below the title on a phone (cropped to a band), beside the text on a large screen (whole) */
.page-picture { height: 16rem; margin: 0 0 2rem; }
@media (min-width: 64rem) {
  .page.has-picture {
    display: grid;
    grid-template-columns: minmax(0, var(--content-width)) minmax(12rem, 20rem);
    column-gap: 4rem;
    max-width: none;
  }
  .page.has-picture .page-head, .page.has-picture .page-body { grid-column: 1; }
  .page.has-picture .page-picture { grid-column: 2; grid-row: 1 / span 2; align-self: start; height: auto; margin: 0.5rem 0 0; }
}

/* Lists written in the Markdown (downloads of a lecture, sections on the homepage): lists with green rules */
.page-body ul, .home ul { margin: 2rem 0; padding: 0; list-style: none; border-bottom: 1px solid var(--color-green-moss); }
.page-body li, .home li { padding: 0.75rem 0; border-top: 1px solid var(--color-green-moss); }

/* PDF links say so (charte § 5.1); inline-block keeps the underline off the label */
.page a[href$=".pdf"]::after {
  content: "PDF";
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-green-moss);
}

/* Homepage: text on the left, the garden on the right; on a phone, the garden on top */
.home { display: grid; gap: 2rem; }
.home h1 { font-size: clamp(2.6rem, 6vw, 5.5rem); }
.home-text > p:first-of-type { font-size: 1.1875rem; line-height: 1.6; }
.home li { padding: 1.25rem 0; }
.home li a {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.home li a:hover { text-decoration: underline 1px; }
.home-picture { order: -1; aspect-ratio: 3 / 2; }
@media (min-width: 64rem) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); gap: 4rem; align-items: start; }
  .home-picture { order: 0; aspect-ratio: 3 / 4; margin-top: 1rem; }
}

/* Section pages: entries separated by rules, the picture beside the text (on a phone, above it) */
.entries { max-width: 52rem; margin: 3rem 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--color-green-moss); }
.entries li {
  display: grid;
  gap: 1rem 2rem;
  padding: 2rem 0 1.25rem;
  border-top: 1px solid var(--color-green-moss);
}
.entries .picture { aspect-ratio: 3 / 2; }
@media (min-width: 40rem) {
  .entries li { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
}
.entries h2 { margin: 0 0 0.5rem; font-size: 1.75rem; }
.entries h2 a { text-decoration: none; }
.entries h2 a:hover { text-decoration: underline 1px; }

/* ---------------------------------------------------------------------------------------------------------------
   Reduced motion, when the visitor asks for it (charte § 7)
   --------------------------------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
