/* The public page at the root of the site (PLAN.md, Lot UX, rang 6), built on the taste-skill kit
   of site/kit/ (MIT, LICENSE beside it) and held to DESIGN.md: its palette, Ultra for the headings
   and the device's text face for the rest, its radii, flat grounds. Only what the kit lacks, or
   what DESIGN.md changes, is written here. */

:root {
  --p-bg: #f3f4f8;
  --p-surface: #ffffff;
  --p-ink: #1b1b2a;
  --p-muted: #565a70;
  --p-accent: #1b1b2a;
  --p-accent-ink: #ffffff;
  --p-action: #1b1b2a;
  --p-action-ink: #ffffff;
  --p-inv-bg: #1b1b2a;
  --p-inv-surface: #2d2d44;
  --p-inv-ink: #f1f2f8;
  --p-inv-muted: #b9bbcc;
  --p-inv-accent: #f1f2f8;
  --p-inv-accent-ink: #1b1b2a;
  --p-inv-action: #f1f2f8;
  --p-inv-action-ink: #1b1b2a;
  --font-display: var(--display);
  --font-text: var(--text);
  --font-mono: var(--serial);
  --display-weight: 400;
  --display-tracking: 0;
  --btn-h: 48px;
  /* Ultra is wide and heavy: a section heading stops at 40 px, the floor DESIGN.md gives it. In rem,
     like the text below: the headings keep their rank over it when the reader enlarges the text. */
  /* Each is also held to a share of the width, so that its longest word still fits a phone. */
  --t-h2: clamp(min(1.75rem, 12.5vw), min(1.25vw + 1.375rem, 12.5vw), 2.5rem);
  --ly-h1: clamp(min(2.5rem, 13vw), min(3.048vw + 1.757rem, 13vw), 4.5rem);
}

/* The reader's text size: DESIGN.md sets the app in rem, the kit in px. The sizes people read follow
   the size the reader chose (16 px by default, so nothing moves at 100 %); the headings and the hero
   keep the kit's sizes, held to the screen. */
:root {
  --t-label: 0.8125rem;
  --t-small: 0.875rem;
  --t-body: 1rem;
  --t-lead: 1.125rem;
  --t-card: 1.125rem;
  --t-h3: 1.5rem;
  --ly-lead: clamp(1.0625rem, 0.286vw + 0.993rem, 1.25rem);
}

@media (min-width: 1024px) {
  :root {
    --t-lead: 1.25rem;
    --t-card: 1.25rem;
    --t-h3: 1.75rem;
  }
}

/* DESIGN.md's hairline, solid, in place of the kit's mix of the ink: the same line the app draws. */
:root,
.ground-base,
.ground-surface {
  --line: #d4d7e2;
  --line-strong: #8589a0;
}

.ground-inverse {
  --line: #3b3b55;
  --line-strong: #8589a0;
}

/* DESIGN.md's radii: a command, and a container, the windows of the product included. */
html[data-radius] {
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 10px;
  --r-btn: 8px;
}

/* The mark of Fenio, its rosette, in the header, the footer and the headline. */
.brand-mark {
  width: 24px;
  height: 24px;
}

.ly-mark {
  background: url("../img/icon.svg") center / contain no-repeat;
  border-radius: 0;
}

.ly-mark::before,
.ly-mark::after {
  content: none;
}

/* Ultra runs wider than the kit's faces: the centred headline gets the room for two lines. */
.hero--centred .hero__c {
  max-width: 1040px;
}

.hero--centred h1 {
  max-width: 22ch;
  text-wrap: balance;
}

/* Text people read is in the ink: the grey of DESIGN.md is for what steps back. */
.hero--centred .hero__lead {
  color: var(--ink);
}

/* The name set across the close: Ultra's capitals and dots rise above the kit's tight line. */
.close__word {
  line-height: 1.15;
}

/* A button set large takes a second line rather than widen the page, as the app's do (DESIGN.md). */
.btn {
  max-width: 100%;
  height: auto;
  min-height: var(--btn-h);
  padding-block: var(--s-2);
  white-space: normal;
  text-align: center;
}

/* The words of the bar, the language link among them, take the 44 px target of every control of
   Fenio (CLAUDE.md): the kit draws them 36 px tall, and a tablet held sideways shows them to a finger. */
.nav__links .nav__link,
.nav__actions > .nav__link {
  min-height: 44px;
}

/* The word of the section a page belongs to (aria-current="true", site-src/layout.js) is marked as the
   kit marks the current page's word. */
.nav__link[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: -2px;
  height: 2px;
  background: currentColor;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .nav__link[aria-current="true"]::after {
    left: var(--s-2);
    right: var(--s-2);
  }
}

@media (max-width: 1023px) {
  .nav.is-open .nav__link[aria-current="true"]::after {
    left: 0;
    right: auto;
    width: 24px;
    bottom: 10px;
  }
}

/* From 1024 to 1279 px, the kit's centred bar splits what its four words leave between two equal
   sides, and « Se connecter » wrapped at 1024. The sides take what they hold, the words the rest. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav--centre .nav__bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}

/* WCAG 2.2, 2.4.11: Shift+Tab scrolls the element it reaches to the top edge, where the fixed bar hid a
   whole link of the help pages. The kit keeps html's scroll-padding-top at 0 so that an anchor jump
   lands on a tile (layout-v4.md): the margin goes on what takes the focus, not on html. */
:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])) {
  scroll-margin-top: calc(var(--nav) + var(--s-2));
}

/* The trial line grows with the reader's text size instead of spilling out of the kit's 32 px. */
.hero--centred .pill {
  height: auto;
  min-height: 32px;
  padding: var(--s-1) max(var(--s-3), 0.6em);
  text-align: center;
  /* A container of DESIGN.md, not a pill: its scale has none. */
  border-radius: var(--r-md);
}

@media (max-width: 639px) {
  /* On a phone the trial line runs from one edge of the column to the other. */
  .hero--centred .pill {
    justify-content: center;
    width: 100%;
  }
}

/* The hero's window holds the kitchen screen, flat on the surface: DESIGN.md draws no lit ground. */
.hero--centred .hero__window {
  background: var(--p-surface);
  border: 1px solid var(--line);
}

.hero--centred .hero__window > .board {
  bottom: 0;
  overflow: hidden;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

/* The windows of the product are frames of the kit without their padding: the product fills them. */
.app.frame,
.notes-frame.frame,
.board--gate.frame,
.export-frame.frame {
  padding: 0;
}

.app.frame::before,
.notes-frame.frame::before,
.board--gate.frame::before,
.export-frame.frame::before {
  content: none;
}

.export-frame.frame {
  display: block;
}

/* The parent's two screens of a request in one window (sections-library.md, app-frame). */
.app.frame {
  display: grid;
  /* Two phone screens side by side on the page's columns: the second starts on its split line. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gutter);
  /* .frame centres what it holds: each screen fills its pane instead, from the top. */
  place-items: stretch;
  margin-top: var(--s-7);
  background: var(--p-bg);
}

.app > .app__pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Both screens run past the window: it cuts them under a fade. */
.app > .app__pane::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 64px;
  background: linear-gradient(rgba(243, 244, 248, 0), var(--p-bg));
  pointer-events: none;
}

.app__pane > .phone {
  display: block;
  height: 100%;
}

@media (max-width: 1023px) {
  .app.frame {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app > .app__pane--list {
    max-height: 252px;
  }

  .app > .app__pane--list::after {
    display: none;
  }

  .app > .app__pane + .app__pane {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 639px) {
  .app.frame {
    grid-template-rows: minmax(0, 1fr);
  }

  .app > .app__pane--list {
    display: none;
  }

  .app > .app__pane + .app__pane {
    border-top: 0;
  }
}

/* The notes of the three children, as the parent's phone shows them when they fill its screen:
   on the page's own ground, sharing the height of their frame. */
.notes-frame {
  display: block;
  height: 36rem;
}

/* On a phone the sections stacked past one screen take two: the notes, which keep the height the
   parent's phone gives three notes that fill it (css/parent.css sizes their values on the screen's
   height), the questions, and what Fenio keeps. Each section is named by its id in French and in
   English (site-src/fr/accueil.html, site-src/en/accueil.html). */
@media (max-width: 639px) {
  #billets,
  #banknotes,
  #questions,
  #donnees,
  #data {
    --hm: 2;
  }

  .notes-frame {
    height: 40rem;
  }

  /* Its two screens hold the eight questions with the air of the desktop between them; each question
     is set at the size of its answer, in a heavier weight, so the headings above them keep their rank
     when the reader enlarges the text. */
  #questions .faq > .faq__item {
    padding-block: var(--s-5);
  }

  #questions .faq h3 {
    font-size: var(--t-body);
    font-weight: 600;
  }
}

/* The footer's columns fill their row on a tablet: the contact takes the half the links leave. The
   questions stay in two columns there, closer together, so they hold in one screen. */
@media (min-width: 640px) and (max-width: 1023px) {
  .footer .grid > .footer__col--wide {
    grid-column: auto / span 6;
  }

  /* What Fenio keeps, then its export: two screens on a tablet held upright. */
  #donnees,
  #data {
    --h: 2;
  }

  #questions .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #questions .grid > .faq {
    grid-column: auto;
  }
}

@media (min-width: 640px) and (max-width: 1279px) {
  #questions .faq > .faq__item {
    padding-block: var(--s-3);
  }
}

/* The kitchen screen before a parent pairs it, on the dark band, in the shape of a tablet. Beside
   the words it is as tall as the screen's content allows, so the band is not half empty. */
.board--gate.frame {
  display: block;
  height: min(30rem, var(--ly-fit, 30rem));
}

/* The diagram's frame, the same way. */
:is(#calendriers, #calendars) .frame {
  min-height: min(35rem, var(--ly-fit, 35rem));
}

@media (max-width: 1023px) {
  :is(#calendriers, #calendars) .frame {
    min-height: 24rem;
  }
}

@media (max-width: 639px) {
  /* On a phone the gate's text is set at the size of body text: the frame gives it its height. */
  .board--gate.frame {
    height: 24rem;
  }

  :is(#calendriers, #calendars) .frame {
    min-height: 18rem;
  }
}

/* What a frame holds, drawn by site.js in a shadow root: a picture, which takes neither the pointer
   nor the focus (site.js takes its controls out of the order of Tab). */
.frame > .host {
  display: block;
  height: 100%;
}

.frame > .host,
.app__pane > .phone,
.hero__window > .board {
  pointer-events: none;
  user-select: none;
}

/* The export beside what Fenio keeps, cut by its frame like the screens of a request. */
.export-frame {
  height: min(36rem, var(--ly-fit, 36rem));
}

@media (max-width: 639px) {
  .export-frame {
    height: 24rem;
  }
}

/* The diagram's core printed flat in the ink, at the radius of a command, with no halo: DESIGN.md
   draws no gradient and no shadow, and the page has one look of button. */
.dg {
  --dg-halo: 0;
}

.dg .dg-node.is-ink {
  background: var(--p-ink);
  box-shadow: none;
}

.dg .dg-node:is(.dg-node--core, .dg-node--core-pill) {
  border-radius: var(--r-sm);
}

.dg .dg-node:is(.dg-node--core, .dg-node--core-pill)::before,
.dg .dg-node:is(.dg-node--core, .dg-node--core-pill)::after {
  content: none;
}

/* What Fenio keeps: a label and its value, each row closed by its rule. */
.facts {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  column-gap: var(--s-5);
  margin: 0;
}

.facts dt,
.facts dd {
  margin: 0;
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
}

/* A label takes the 600 of DESIGN.md's two weights. */
.facts dt {
  font-weight: 600;
}

.facts dd {
  text-wrap: pretty;
}

/* Lines of text people read stop near 62 characters, as the kit's .measure does. */
main .stack-4 > p {
  max-width: 62ch;
}

/* On a tablet held upright the screen is tall: the rows take more air. */
@media (min-width: 640px) and (max-width: 1023px) {
  .facts dt,
  .facts dd {
    padding-block: var(--s-5);
  }
}

@media (max-width: 639px) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .facts dd {
    padding-top: var(--s-1);
  }
}

.footer__contact {
  display: grid;
  gap: var(--s-3);
  max-width: 40ch;
}

/* On a phone the contact takes the whole row, as the name above does: the address set large holds no
   break, and in half a row it would widen the whole page. (The bar's « Se connecter » is the page's
   secondary action, which the kit keeps for the menu's sheet on a phone.) */
@media (max-width: 639px) {
  .footer .grid > .footer__col--wide {
    grid-column: 1 / -1;
  }
}

/* ---------------------------------------------------------------- the help pages
   One column to read (site-src/fr/aide/…), outside the screens of the home page: the page is an
   <article> under <main>, which the kit's one-section-per-screen rule leaves alone. Its top clears
   the fixed bar. */
.doc {
  padding-block: calc(var(--nav) + var(--s-8)) var(--s-9);
}

.doc__body {
  display: grid;
  gap: var(--s-5);
  max-width: 68ch;
}

/* Capped to the screen's width, as the home page's headings are: a word of Ultra (« récompenses »)
   cannot break, and set large it would widen the page. */
.doc h1 {
  font-size: min(var(--t-h2), 9vw);
  text-wrap: balance;
}

.doc h2 {
  margin-top: var(--s-5);
  font-size: min(var(--t-h3), 7.5vw);
}

.doc :is(h1, h2) {
  overflow-wrap: break-word;
}

/* An address breaks where it must rather than widen the page. */
.doc code {
  overflow-wrap: anywhere;
}

.doc__lead {
  font-size: var(--t-lead);
  line-height: 1.5;
}

/* A link inside a sentence or a fact is underlined: its color alone would not tell it from the text. */
.doc__body :is(p, li, dd) a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.doc__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  color: var(--muted);
  font-size: var(--t-small);
}

.doc__crumbs a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The kit takes the markers off every list: the steps of a how-to keep their numbers. */
.doc__steps {
  display: grid;
  gap: var(--s-3);
  padding-left: 1.5em;
  list-style: decimal;
}

ul.doc__steps {
  list-style: disc;
}

.doc__steps > li {
  padding-left: var(--s-2);
}

/* No word alone on the last line of a step or a fact, as the kit does for every paragraph. */
.doc__steps > li,
.doc__facts dd {
  text-wrap: pretty;
}

.doc__steps > li::marker {
  font-weight: 600;
}

/* « Bon à savoir »: the one boxed part of an article. */
.doc__note {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.doc__note h2 {
  margin-top: 0;
  font-size: var(--t-card);
}

.doc__more {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-6);
  margin-top: var(--s-5);
}

/* The kit's .link is set in 500; DESIGN.md has two weights only, and a way onward takes 600. */
.doc__more .link {
  font-weight: 600;
}

/* The articles of /aide/, one row each, the whole row a 44 px target at least. */
.doc__list {
  display: grid;
  gap: var(--s-3);
  padding: 0;
  list-style: none;
}

.doc__body .doc__list a {
  text-decoration: none;
}

.doc__list a {
  display: grid;
  gap: var(--s-1);
  min-height: 44px;
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  font-weight: 600;
}

.doc__list a:hover {
  border-color: var(--line-strong);
}

.doc__list a span {
  color: var(--muted);
  font-weight: 400;
}

/* The facts of a text page (/vie-privee/, /a-propos/…): a row each, its name beside what it holds
   and where. The breakpoint is in em, so that a text set larger stacks the row sooner. */
.doc__facts {
  border-top: 1px solid var(--line);
}

.doc__facts > div {
  display: grid;
  gap: var(--s-1) var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
}

.doc__facts dt {
  font-weight: 600;
  overflow-wrap: break-word;
}

.doc__facts dd {
  margin: 0;
  overflow-wrap: break-word;
}

.doc__facts .doc__where {
  color: var(--muted);
}

@media (min-width: 40em) {
  .doc__facts > div {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  .doc__facts dd {
    grid-column: 2;
  }
}
