/* The guides' look: the app's own "paper, ink and one red".
   Shared by accueil.html and proprietaires.html. Each slide is exactly one
   screen high and never scrolls; sizes follow the screen, from a phone to a
   television. Pictures come from captures/, retaken by `npm run guide`.
   Every text is there in French and in English; one of the two shows. */

/* ---------- Fonts: the app's two, served from here ---------- */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(fonts/archivo-latin-ext.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(fonts/archivo-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin-ext.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Theme: the app's palette ---------- */

:root {
  --paper: #f6f5f2;
  --surface: #ffffff;
  --sunken: #eeede8;
  --ink: #16171a;
  --ink-2: #44474d;
  --ink-3: #65686e;
  --line: rgba(22, 23, 26, 0.1);
  --line-strong: rgba(22, 23, 26, 0.2);
  --red: #d81f1d;
  --amber: #9a4b06;
  --amber-dot: #e08a1e;
  --amber-tint: #fcf0dd;
  --green-dot: #2e9d62;

  --font-body: "Geist", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-display:
    "Archivo", "Avenir Next Condensed", "Arial Narrow", sans-serif;

  /* Every size follows the screen. */
  --cover-size: clamp(2.6rem, 8.4vw, 9rem);
  --title-size: clamp(1.7rem, 3.5vw, 4rem);
  --body-size: clamp(0.95rem, 1.32vw, 1.6rem);
  --small-size: clamp(0.78rem, 0.95vw, 1.1rem);
  --pad-x: clamp(1.1rem, 4.2vw, 5.5rem);
  --pad-y: clamp(3.4rem, 8.5vh, 6rem);
  --gap: clamp(1rem, 3vw, 4rem);
  --pin: clamp(1.5rem, 2.1vw, 2.5rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* ---------- Two languages, one on screen ----------
   Each text comes as <span lang="fr"> and <span lang="en">. French shows
   unless aide.js has set <html data-lang="en">. */

html:not([data-lang="en"]) body [lang="en"],
html[data-lang="en"] body [lang="fr"] {
  display: none;
}

/* ---------- A slide: one screen, never more ---------- */

.slide {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--pad-y) var(--pad-x);
}

.eyebrow {
  font-size: var(--small-size);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow b {
  color: var(--red);
  font-weight: 700;
}

h1,
h2 {
  font-family: var(--font-display);
  font-stretch: 76%;
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  font-size: var(--title-size);
  margin-top: 0.35em;
}

.lead {
  margin-top: 0.9em;
  max-width: 34ch;
  color: var(--ink-2);
}

.lead.wide {
  max-width: 60ch;
}

/* ---------- A fiche: the steps beside the real screen ---------- */

.fiche {
  display: grid;
  grid-template-columns: minmax(0, 0.56fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: var(--gap);
}

.fiche-text {
  min-width: 0;
}

/* The numbers are the ones drawn on the picture. */
.steps {
  list-style: none;
  /* A fiche's second slide carries on: <ol start="3" style="--start: 3">. */
  counter-reset: step calc(var(--start, 1) - 1);
  margin-top: clamp(0.9rem, 2.6vh, 2.2rem);
  display: grid;
  gap: clamp(0.55rem, 1.7vh, 1.3rem);
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: var(--pin) minmax(0, 1fr);
  gap: 0.75em;
  align-items: start;
  color: var(--ink-2);
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: var(--pin);
  height: var(--pin);
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0.82em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  /* Level with the first line of the step. */
  margin-top: calc((1.45em - var(--pin)) / 2);
}

.steps b {
  color: var(--ink);
  font-weight: 650;
}

/* Points that are not steps: no number, since nothing on the picture
   answers to one. */
.steps.plain li::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  margin: 0.48em auto 0;
  border-radius: 2px;
}

.note {
  margin-top: clamp(0.8rem, 2.4vh, 1.8rem);
  padding: 0.7em 0.95em;
  border-radius: 12px;
  background: var(--sunken);
  color: var(--ink-2);
  font-size: var(--small-size);
  line-height: 1.5;
}

.note b {
  color: var(--ink);
}

/* The real screen, as a sheet of paper lying on the slide. */
.shot {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shot img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: clamp(8px, 1vw, 16px);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 0 rgba(22, 23, 26, 0.04),
    0 30px 60px -30px rgba(22, 23, 26, 0.38);
  cursor: zoom-in;
}

/* Three phones side by side. */
.phones {
  gap: clamp(0.5rem, 1.6vw, 1.6rem);
}

.phones img {
  max-width: calc((100% - 2 * clamp(0.5rem, 1.6vw, 1.6rem)) / 3);
  border-radius: clamp(10px, 1.4vw, 22px);
}

/* ---------- Ink slides: the cover, the chapters, the end ---------- */

.ink {
  background: var(--ink);
  color: #fff;
}

.ink .eyebrow {
  color: rgba(255, 255, 255, 0.62);
}

.ink .lead {
  color: rgba(255, 255, 255, 0.74);
}

/* The three real kicks of the login screen, behind the words. */
.kicks {
  position: absolute;
  inset: 18% 5% 0 46%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 4%;
  pointer-events: none;
}

.kicks img {
  height: 78%;
  width: auto;
  max-width: 34%;
  object-fit: contain;
  object-position: bottom;
  opacity: 0.16;
}

.kicks img:nth-child(2) {
  height: 66%;
  opacity: 0.9;
}

.cover {
  justify-content: flex-end;
}

.cover .badge {
  position: absolute;
  top: var(--pad-y);
  left: var(--pad-x);
  width: clamp(4.2rem, 9vw, 9.5rem);
  height: auto;
  border-radius: 50%;
}

.cover h1 {
  margin-top: 0.16em;
  font-size: var(--cover-size);
  line-height: 0.9;
  max-width: 9ch;
}

.cover h1 em {
  font-style: normal;
  color: var(--red);
}

.cover .lead {
  max-width: 30ch;
  font-size: clamp(1rem, 1.7vw, 2rem);
}

.how {
  position: relative;
  margin-top: clamp(1.2rem, 4vh, 3rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em 1.6em;
  font-size: var(--small-size);
  color: rgba(255, 255, 255, 0.62);
}

.how kbd {
  display: inline-grid;
  place-items: center;
  min-width: 2em;
  height: 2em;
  padding: 0 0.5em;
  margin-right: 0.45em;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  font: inherit;
  color: #fff;
}

.chapter h2 {
  font-size: var(--cover-size);
  line-height: 0.9;
  max-width: 10ch;
}

.chapter .n {
  font-family: var(--font-display);
  font-stretch: 76%;
  font-weight: 800;
  font-size: clamp(1.2rem, 2.4vw, 2.6rem);
  color: var(--red);
}

/* ---------- Text-only slides ---------- */

.points {
  list-style: none;
  margin-top: clamp(1.2rem, 4vh, 3rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: clamp(0.7rem, 1.6vw, 1.6rem);
}

.points li {
  padding: clamp(0.9rem, 1.8vw, 2rem);
  border-radius: 14px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--line),
    0 14px 32px -20px rgba(22, 23, 26, 0.28);
  color: var(--ink-2);
}

.points b {
  display: block;
  margin-bottom: 0.3em;
  font-family: var(--font-display);
  font-stretch: 76%;
  font-weight: 800;
  font-size: clamp(1.2rem, 2vw, 2.3rem);
  line-height: 1.05;
  color: var(--ink);
}

.points .tag {
  display: flex;
  width: fit-content;
  margin-bottom: 0.7em;
}

/* The app's own words for a member's state, drawn as the app draws them. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 650;
  color: var(--ink);
}

.tag::before {
  content: "";
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--green-dot);
}

.tag.soon {
  color: var(--amber);
}

.tag.soon::before {
  background: var(--amber-dot);
}

.tag.over {
  color: var(--ink-2);
}

.tag.over::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ink-3);
}

.tag.owes {
  padding: 0.15em 0.6em;
  border-radius: 8px;
  background: var(--amber-tint);
  color: var(--amber);
}

.tag.owes::before,
.tag.gone::before {
  display: none;
}

.tag.gone {
  color: var(--ink-3);
  text-decoration: line-through;
}

/* The list of fiches, filled in by aide.js. */
.toc {
  margin-top: clamp(0.9rem, 3vh, 2.4rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: clamp(0.8rem, 2vw, 2.4rem);
  align-items: start;
}

.toc h3 {
  font-size: var(--small-size);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--line-strong);
}

.toc ol {
  list-style: none;
}

.toc a {
  display: flex;
  gap: 0.7em;
  padding: 0.42em 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font-size: clamp(0.82rem, 1.1vw, 1.3rem);
  font-weight: 550;
  line-height: 1.3;
}

.toc a span {
  min-width: 1.4em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.toc a:hover {
  color: var(--red);
}

.buttons {
  position: relative;
  margin-top: clamp(1.2rem, 4vh, 2.6rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 3em;
  padding: 0 1.3em;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}

.button.quiet {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

/* ---------- What stays on screen: progress, place, arrows ---------- */

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 5;
  height: 4px;
  background: var(--red);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.5s var(--ease);
}

.deck-name {
  position: fixed;
  top: clamp(0.9rem, 2.6vh, 1.8rem);
  left: var(--pad-x);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: var(--small-size);
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  transition: opacity 0.4s;
}

.deck-name img {
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
}

/* On an ink slide the name would sit on the badge or the kicks. */
body.on-ink .deck-name {
  opacity: 0;
  pointer-events: none;
}

/* The language switch, in the top right corner of every slide. */
.lang {
  position: fixed;
  top: clamp(0.5rem, 1.7vh, 1.3rem);
  right: var(--pad-x);
  z-index: 6;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--small-size);
  font-weight: 650;
}

.lang button {
  min-width: 3.2em;
  min-height: 40px;
  padding: 0 0.9em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 3px rgba(22, 23, 26, 0.12);
}

body.on-ink .lang {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

body.on-ink .lang button {
  color: rgba(255, 255, 255, 0.72);
}

body.on-ink .lang button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.pager {
  position: fixed;
  right: var(--pad-x);
  bottom: clamp(0.8rem, 2.6vh, 1.8rem);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--small-size);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

body.on-ink .pager {
  color: rgba(255, 255, 255, 0.62);
}

.pager button,
.pager a {
  display: grid;
  place-items: center;
  width: 2.6em;
  height: 2.6em;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.pager svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager .place {
  margin: 0 0.4em;
}

/* A picture opened full screen. */
.zoom {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  padding: clamp(0.5rem, 2vw, 2rem);
  background: rgba(22, 23, 26, 0.86);
  cursor: zoom-out;
  overflow: auto;
}

.zoom.open {
  display: grid;
}

.zoom img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}

/* On a phone the picture opens at a size that can be read, and scrolls. */
@media (max-width: 899px) {
  .zoom img {
    max-width: none;
    max-height: none;
    width: 220vw;
  }

  .zoom.open {
    place-items: start;
  }
}

/* ---------- Arriving on a slide ---------- */

.r {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms + 80ms);
}

.shot.r {
  transform: translateY(14px) scale(0.975);
  transition-duration: 0.9s;
  transition-delay: 0.22s;
}

.slide.on .r {
  opacity: 1;
  transform: none;
}

/* Without the script, everything simply shows. */
.no-js .r {
  opacity: 1;
  transform: none;
}

/* ---------- Narrow screens: the steps above the picture ---------- */

@media (max-width: 899px), (orientation: portrait) {
  :root {
    --title-size: clamp(1.5rem, 6.4vw, 2.6rem);
    --body-size: clamp(0.9rem, 3.5vw, 1.2rem);
    --small-size: clamp(0.72rem, 2.9vw, 0.95rem);
    --pin: clamp(1.35rem, 5.4vw, 1.9rem);
    --pad-y: clamp(3.1rem, 8vh, 4.5rem);
  }

  .fiche {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: clamp(0.7rem, 2vh, 1.4rem);
  }

  .fiche .shot {
    flex: 1 1 0;
    height: auto;
  }

  .note {
    display: none;
  }

  .kicks {
    inset: 14% 4% 34% 4%;
    justify-content: center;
  }

  .cover h1,
  .chapter h2 {
    font-size: clamp(2.6rem, 14vw, 6rem);
  }

  /* Two even columns: the list flows from one into the other. */
  .toc {
    display: block;
    columns: 2;
    column-gap: 1.1rem;
  }

  .toc > div {
    margin-bottom: 0.7rem;
  }

  .toc h3 {
    break-after: avoid;
  }

  .toc li {
    break-inside: avoid;
  }

  .toc a {
    padding: 0.28em 0;
    font-size: clamp(0.7rem, 2.9vw, 0.95rem);
    line-height: 1.25;
  }

  .points {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
  }

  .points li {
    padding: 0.75rem 0.9rem;
  }

  .points b {
    font-size: clamp(1.05rem, 4.6vw, 1.5rem);
  }
}

/* The smallest phones: the cards of a text slide sit closer together. */
@media (max-width: 899px) and (max-height: 700px) {
  .points {
    margin-top: 0.8rem;
    gap: 0.4rem;
  }

  .points li {
    padding: 0.55rem 0.8rem;
  }

  .points .tag {
    margin-bottom: 0.35em;
  }

  .points ~ .lead {
    margin-top: 0.6em;
  }
}

/* Shorter still: the line under the cards gives way. */
@media (max-width: 899px) and (max-height: 660px) {
  .points ~ .lead {
    display: none;
  }
}

/* Short screens: a phone on its side, a small laptop. */
@media (max-height: 700px) {
  :root {
    --pad-y: clamp(2.6rem, 9vh, 3.6rem);
    --title-size: clamp(1.3rem, 3vw, 2.4rem);
    --body-size: clamp(0.82rem, 1.25vw, 1.1rem);
  }
}

@media (max-height: 500px) {
  :root {
    --pad-y: 2.4rem;
    --title-size: clamp(1.1rem, 2.6vw, 1.6rem);
    --body-size: clamp(0.72rem, 1.15vw, 0.9rem);
    --cover-size: clamp(1.8rem, 6vw, 3.2rem);
  }

  .note,
  .how,
  .deck-name,
  .chapter .n,
  .points ~ .lead {
    display: none;
  }

  .steps {
    gap: 0.3rem;
  }

  /* Small enough to stay clear of the slide's first line. */
  .lang {
    top: 3px;
  }

  .lang button {
    min-height: 28px;
  }

  .toc {
    display: block;
    columns: 4;
    column-gap: 1rem;
    margin-top: 0.5rem;
  }

  .toc > div {
    margin-bottom: 0.4rem;
  }

  .toc h3 {
    break-after: avoid;
    padding-bottom: 0.2em;
  }

  .toc a {
    padding: 0.14em 0;
    font-size: 0.66rem;
    line-height: 1.2;
  }

  .points {
    margin-top: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .points li {
    padding: 0.55rem 0.65rem;
    font-size: 0.7rem;
  }

  .points b {
    font-size: 0.95rem;
  }

  .buttons {
    margin-top: 0.6rem;
  }
}

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

  .r,
  .shot.r {
    transform: none;
    transition: opacity 0.2s;
    transition-delay: 0s;
  }

  .progress {
    transition: none;
  }
}

/* ---------- On paper: one fiche per page ---------- */

@media print {
  html {
    scroll-snap-type: none;
  }

  .slide {
    height: 100vh;
    break-after: page;
  }

  .r {
    opacity: 1;
    transform: none;
  }

  .progress,
  .pager,
  .lang,
  .zoom {
    display: none;
  }
}
