/* LudiGo website — a French school notebook page (Seyès ruling, red margin, teacher's blue ink).
   Colours mirror src/theme/tokens.ts in the app. Fonts are self-hosted (no third-party requests). */

@font-face { font-family: "Playwrite FR"; src: url("/fonts/playwrite-400.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Andika"; src: url("/fonts/andika-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("/fonts/andika-700.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --paper: #FDFDFA;
  --thin: #ECEAF7;
  --bold: #CFC9EF;
  --margin-line: #EE6B78;
  --ink: #2340A8;
  --ink-soft: #6A7CC9;
  --text: #262A3F;
  --muted: #5E6280;
  --red: #D7263D;
  --green: #1F9D57;
  --gold: #F2B705;
  --slip: #FFFFFF;
  --shadow: 27 31 58;
  --u: 8px;                 /* Seyès: 4 thin lines per 32px square */
  --sq: calc(var(--u) * 4);
  --margin-x: 112px;        /* position of the red margin line */
  --hand: "Playwrite FR", "Segoe Script", cursive;
  --print: "Andika", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: light dark;
}

/* At night the notebook becomes the class slate (ardoise). */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #253029;
    --thin: rgb(255 255 255 / .045);
    --bold: rgb(255 255 255 / .1);
    --margin-line: #E86D7A;
    --ink: #AFC0FF;
    --ink-soft: #8EA0E6;
    --text: #EEF1EA;
    --muted: #B5BDB3;
    --red: #FF8090;
    --green: #6FD69B;
    --slip: #313D35;
    --shadow: 0 0 0;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font: 19px/var(--sq) var(--print);
  line-height: 32px;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, transparent calc(var(--margin-x) - 1px), var(--margin-line) calc(var(--margin-x) - 1px), var(--margin-line) calc(var(--margin-x) + 1px), transparent calc(var(--margin-x) + 1px)),
    repeating-linear-gradient(to bottom, var(--bold) 0 1px, transparent 1px var(--sq)),
    repeating-linear-gradient(to right, var(--thin) 0 1px, transparent 1px var(--sq)),
    repeating-linear-gradient(to bottom, var(--thin) 0 1px, transparent 1px var(--u));
  background-position: 0 0, 0 31px, calc(var(--margin-x) + 1px) 0, 0 31px;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.page {
  max-width: 1120px;
  padding: var(--sq) 24px calc(var(--sq) * 3) calc(var(--margin-x) + 28px);
}

/* The teacher's writing */
.hand { font-family: var(--hand); color: var(--ink); font-weight: 400; }

.date { margin: 0 0 var(--sq); font-family: var(--hand); color: var(--ink); font-size: 20px; }

h1, h2, h3 { font-family: var(--hand); color: var(--ink); font-weight: 400; margin: 0; }

h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 64px; }
h2 { font-size: 30px; line-height: 64px; margin-top: calc(var(--sq) * 2); }
h3 { font-size: 21px; line-height: var(--sq); }

/* Red ruler underline, drawn once on load */
.underline { position: relative; display: inline-block; }
.underline svg { position: absolute; left: 0; bottom: -10px; width: 100%; height: 12px; overflow: visible; }
.underline path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
h2 .underline svg { bottom: -6px; }

p { margin: 0 0 var(--sq); max-width: 62ch; }
.lead { font-size: 21px; max-width: 34ch; }

nav.top { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: var(--sq); font-size: 17px; }
nav.top a { text-decoration: none; }
nav.top a[aria-current] { text-decoration: underline; }
nav.top .brand { font-family: var(--hand); font-size: 20px; margin-right: auto; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.hero-copy { padding-top: var(--sq); }
.hero h1 { margin-bottom: calc(var(--sq) + 16px); }
.stores { font-size: 17px; color: var(--muted); }
.stores strong { color: var(--text); }

.device { position: relative; margin: 0; }
.device img {
  display: block; width: 100%; height: auto;
  border: 9px solid #1B1F3A; border-radius: 38px;
  box-shadow: 0 18px 40px -18px rgb(var(--shadow) / .45);
  background: #fff;
}

/* "Très bien !" stamp */
.stamp {
  position: absolute; left: -64px; bottom: 56px; width: 150px; transform: rotate(-14deg);
  color: var(--red); mix-blend-mode: multiply; opacity: .9; pointer-events: none;
}
@media (prefers-color-scheme: dark) { .stamp { mix-blend-mode: normal; } }

/* A chapter, step by step — numbers sit in the margin like a teacher's "Ex. 1" */
.steps { list-style: none; padding: 0; margin: var(--sq) 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; position: relative; }
.steps li::before {
  content: counter(step);
  font-family: var(--hand); color: var(--red); font-size: 26px;
  position: absolute; top: 0; left: -40px;
}
.steps li:not(:first-child)::before { left: -28px; }
.steps h3 { margin-bottom: var(--u); }
.steps p { font-size: 17px; line-height: 28px; }
.steps img { display: block; width: 100%; max-width: 230px; height: auto; border: 6px solid #1B1F3A; border-radius: 26px; margin-bottom: var(--sq); background: #fff; }

/* Grades as gommettes */
.grades { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; padding: 0; margin: var(--sq) 0; }
.grades li {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #fff;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / .14), 0 2px 3px rgb(var(--shadow) / .25);
}
.grades li:nth-child(1) { background: #E0313F; transform: rotate(-6deg); }
.grades li:nth-child(2) { background: #F2B705; color: #3B2A00; transform: rotate(4deg); }
.grades li:nth-child(3) { background: #1F9A5B; transform: rotate(-3deg); }
.grades li:nth-child(4) { background: #2453D4; transform: rotate(7deg); }
.grades li:nth-child(5) { background: #7A3FC0; transform: rotate(-5deg); }

/* Subjects as the plastic-covered notebooks of the home screen */
.notebooks { list-style: none; padding: 0; margin: var(--sq) 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; max-width: 600px; }
.notebooks li {
  position: relative; aspect-ratio: 17 / 22; border-radius: 4px 10px 10px 4px; background: var(--c);
  box-shadow: inset 6px 0 0 rgb(0 0 0 / .14), 0 6px 14px -8px rgb(var(--shadow) / .6);
  display: flex; align-items: center; justify-content: center; padding: 10px;
  overflow: hidden;
}
.notebooks li::after { /* plastic sheen */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, rgb(255 255 255 / .32) 0 18%, transparent 34% 100%);
  pointer-events: none;
}
.notebooks span {
  background: #fff; color: #262A3F; border-radius: 6px; padding: 6px 8px; text-align: center;
  font-size: 15px; line-height: 20px; font-weight: 700; width: 100%;
  box-shadow: 0 1px 2px rgb(0 0 0 / .2);
}

/* Mot aux parents — a slip glued into the notebook */
.slip {
  position: relative; max-width: 640px; margin: calc(var(--sq) * 2) 0 var(--sq);
  background: var(--slip); padding: 40px 32px 24px; transform: rotate(-1deg);
  box-shadow: 0 10px 24px -14px rgb(var(--shadow) / .55);
}
.slip::before { /* tape */
  content: ""; position: absolute; top: -14px; left: 50%; width: 120px; height: 28px; transform: translateX(-50%) rotate(2deg);
  background: rgb(242 183 5 / .35); border: 1px solid rgb(242 183 5 / .4);
}
.slip h2 { margin-top: 0; line-height: 48px; }
.slip ul { margin: 0 0 var(--sq); padding-left: 1.1em; }
.slip li::marker { color: var(--green); content: "✓  "; }
.slip .sign { font-family: var(--hand); color: var(--ink); text-align: right; margin: 0; }

footer { margin-top: calc(var(--sq) * 2); font-size: 16px; color: var(--muted); }
footer ul { list-style: none; padding: 0; margin: 0 0 var(--u); display: flex; flex-wrap: wrap; gap: 8px 28px; }

/* Text pages (privacy, support) */
.doc h1 { font-size: 36px; line-height: 64px; max-width: none; margin-bottom: var(--sq); }
.doc h2 { font-size: 24px; line-height: 64px; margin-top: var(--sq); }
.doc .meta { color: var(--muted); font-size: 17px; }
.doc dl { margin: 0; max-width: 62ch; }
.doc dt { font-weight: 700; }
.doc dd { margin: 0 0 var(--sq); }

/* Load moment: the red underline is drawn, then the stamp lands. */
@media (prefers-reduced-motion: no-preference) {
  .draw svg { clip-path: inset(0 100% 0 0); animation: draw .7s .35s cubic-bezier(.6, 0, .3, 1) forwards; }
  .stamp { animation: stamp .32s 1.15s cubic-bezier(.2, .8, .3, 1.2) both; }
  @keyframes draw { to { clip-path: inset(0 0 0 0); } }
  @keyframes stamp { from { opacity: 0; transform: rotate(-24deg) scale(1.7); } to { opacity: .9; transform: rotate(-14deg) scale(1); } }
}

@media (max-width: 900px) {
  :root { --margin-x: 40px; }
  .page { padding-left: calc(var(--margin-x) + 20px); padding-right: 20px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .device { max-width: 280px; margin-left: 40px; }
  .stamp { left: -48px; width: 120px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps li::before, .steps li:not(:first-child)::before { left: -40px; }
  .steps img { max-width: 200px; }
}

@media (max-width: 520px) {
  body { font-size: 18px; }
  nav.top { gap: 14px; font-size: 15px; }
  nav.top .brand { font-size: 18px; }
  .grades { gap: 10px; }
  .grades li { width: 52px; height: 52px; font-size: 16px; }
  .notebooks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead { font-size: 19px; }
  h1 { line-height: 48px; }
  .slip { padding: 36px 20px 20px; }
}
