/* Dictator – a page from a French exercise book (cahier Seyès), in Dictator's violet. */

:root {
  --paper: #f7f8ff;
  --rule-fine: #dfe3fb;     /* the three thin lines inside each Seyès square */
  --rule: #b9c2f0;          /* the heavier line every 8 mm */
  --margin: #e0455a;        /* the red margin line */
  --ink: #1d1a46;           /* fountain-pen blue-black */
  --ink-soft: #4b4878;
  --violet: #6d32e8;        /* Dictator */
  --violet-deep: #4c1fb0;
  --right: #138a4b;
  --wrong: #d1293e;
  --grid: 32px;             /* one Seyès square */
  --margin-x: clamp(20px, 9vw, 128px);
  --hand: "Playwrite FR Trad", "Snell Roundhand", cursive;
  --sans: "Figtree", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

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

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

body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  background-color: var(--paper);
  /* Seyès ruling: fine lines every 8 px, a stronger line and a vertical every 32 px, the red margin. */
  background-image:
    linear-gradient(90deg, transparent calc(var(--margin-x) - 1px), var(--margin) calc(var(--margin-x) - 1px), var(--margin) calc(var(--margin-x) + 1px), transparent calc(var(--margin-x) + 1px)),
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-fine) 1px, transparent 1px),
    linear-gradient(var(--rule-fine) 1px, transparent 1px);
  background-size: 100% 100%, 100% var(--grid), var(--grid) var(--grid), 100% calc(var(--grid) / 4);
  background-position: 0 0, 0 -1px, var(--margin-x) 0, 0 -1px;
  background-attachment: local;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet-deep); text-underline-offset: 3px; }
a:hover { color: var(--violet); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Content sits to the right of the margin line, like writing in a cahier. */
.top, .page, .foot { padding-left: calc(var(--margin-x) + clamp(16px, 3vw, 40px)); padding-right: clamp(16px, 5vw, 64px); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: calc(var(--grid) * 2.5);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.125rem; }
.brand img { border-radius: 8px; }
.top nav { display: flex; gap: clamp(12px, 3vw, 28px); }
.top nav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--violet); }

.page { max-width: 1280px; }

h1, h2, h3 { margin: 0; color: var(--ink); }
h1 {
  font-weight: 800;
  font-size: clamp(2.4rem, 5.4vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 13ch;
}
h2 { font-weight: 750; font-size: clamp(1.6rem, 2.6vw, 2.125rem); line-height: 1.15; letter-spacing: -0.015em; }
h3 { font-weight: 700; font-size: 1.1875rem; line-height: 1.3; }
p { margin: 0; }

/* ── hero ─────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  padding: calc(var(--grid) * 1.5) 0 calc(var(--grid) * 3);
}
.lead { margin-top: 24px; font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 32px; }
.store {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px;
  border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600;
}
.text-link { font-weight: 600; }

/* The dictation sheet: a stapled page on the cahier, the one place with depth. */
.dictee {
  position: relative;
  padding: 28px clamp(20px, 3vw, 32px) 24px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px 6px 20px 6px;
  box-shadow: 0 1px 0 var(--rule), 0 24px 48px -28px rgba(45, 26, 140, 0.45);
  transform: rotate(-0.6deg);
}
@media (prefers-reduced-motion: no-preference) {
  .dictee { animation: settle 700ms cubic-bezier(.2, .8, .2, 1) 150ms both; }
  @keyframes settle { from { opacity: 0; transform: translateY(18px) rotate(1.4deg); } }
}
.dictee-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.dictee-head h2 { font-family: var(--hand); font-weight: 400; font-size: 1.75rem; letter-spacing: 0; color: var(--violet-deep); }
.counter { color: var(--ink-soft); font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dictee-hint { margin-top: 10px; color: var(--ink-soft); font-size: .9875rem; }
.dictee-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

button { font: inherit; cursor: pointer; }
.play {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--violet); color: #fff; font-weight: 650;
}
.play svg { width: 20px; height: 20px; fill: currentColor; }
.play:hover { background: var(--violet-deep); }
.play[aria-pressed="true"] { background: var(--violet-deep); }
.ghost {
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: transparent; color: var(--ink); font-weight: 550;
}
.ghost:hover { border-color: var(--violet); color: var(--violet-deep); }

/* Handwriting on ruled lines. The textarea is transparent over a mirror that colours each letter. */
.writing {
  --line: 44px;
  position: relative;
  margin-top: 20px;
  min-height: calc(var(--line) * 2 + 6px);
  border-left: 2px solid var(--margin);
  background-image: linear-gradient(transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px));
  background-size: 100% var(--line);
}
.mirror, .writing textarea {
  margin: 0; padding: 4px 0 0 14px; width: 100%;
  font: 400 1.375rem/var(--line) var(--hand);
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal;
}
.mirror { position: absolute; inset: 0; color: var(--ink); pointer-events: none; }
.writing textarea {
  position: relative; display: block; min-height: calc(var(--line) * 2 + 6px);
  border: 0; resize: none; background: transparent; color: transparent; caret-color: var(--violet);
  outline: none;
}
.writing:focus-within { box-shadow: -2px 0 0 0 var(--margin), 0 0 0 3px rgba(109, 50, 232, .18); border-radius: 0 6px 6px 0; }
.mirror .ok { color: var(--right); }
.mirror .ko { color: var(--wrong); text-decoration: underline wavy var(--wrong); text-decoration-thickness: 1px; text-underline-offset: 5px; }
.mirror .placeholder { color: #9aa0c8; }

.feedback { min-height: 1.6em; margin-top: 12px; font-weight: 600; color: var(--ink-soft); }
.feedback.ok { color: var(--right); }
.feedback.ko { color: var(--wrong); }
.answer { margin-top: 6px; font-family: var(--hand); font-size: 1.125rem; color: var(--violet-deep); }

/* ── sections ─────────────────────────────────────── */
.block { padding: calc(var(--grid) * 2) 0; }
.block > h2 { max-width: 24ch; }
.note { margin-top: 12px; color: var(--ink-soft); max-width: 60ch; }

.steps { list-style: none; counter-reset: step; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); }
.steps li { counter-increment: step; position: relative; padding-top: 52px; }
.steps li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0;
  font: 400 2rem/1 var(--hand); color: var(--margin);
}
.steps p { margin-top: 8px; color: var(--ink-soft); }

kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .35em; margin: 0 1px;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 6px;
  background: #fff; font: 600 .875em/1.5 var(--sans); text-align: center; color: var(--ink);
}

.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.split > div > p { margin-top: 14px; color: var(--ink-soft); max-width: 40ch; }
.checks { margin: 0; display: grid; gap: 0; }
.checks > div { padding: 16px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 16px; }
.checks > div:last-child { border-bottom: 1px solid var(--rule); }
.checks dt { font-weight: 700; }
.checks dd { margin: 0; color: var(--ink-soft); }
.sample { display: inline-block; margin-right: 8px; font-family: var(--hand); font-size: 1.0625rem; color: var(--right); }
.sample s { color: var(--wrong); text-decoration-thickness: 2px; margin-right: 6px; }

.sites { margin-top: 28px; width: 100%; max-width: 980px; border-collapse: collapse; background: rgba(255,255,255,.72); }
.sites th, .sites td { text-align: left; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.sites thead th { font-size: .9375rem; color: var(--ink-soft); font-weight: 600; }
.sites tbody th { font-weight: 700; white-space: nowrap; padding-left: 0; }
.sites td { color: var(--ink-soft); }

.privacy-note p { margin-top: 12px; max-width: 58ch; font-size: 1.1875rem; color: var(--ink-soft); }

.faq { margin-top: 24px; max-width: 760px; }
.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { padding: 16px 32px 16px 0; font-weight: 650; cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font: 400 1.5rem/1 var(--sans); color: var(--violet); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 0 18px; color: var(--ink-soft); max-width: 62ch; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding-top: calc(var(--grid) * 1.5); padding-bottom: calc(var(--grid) * 1.5);
  color: var(--ink-soft); font-size: .9375rem;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }

/* ── document pages (privacy, support) ───────────── */
.doc { max-width: 760px; padding: calc(var(--grid) * 1.5) 0 calc(var(--grid) * 3); }
.doc h1 { font-size: clamp(2.2rem, 4.4vw, 3.25rem); max-width: none; }
.doc .updated { margin-top: 10px; color: var(--ink-soft); }
.doc h2 { margin-top: 40px; font-size: 1.375rem; }
.doc p, .doc li { color: var(--ink-soft); }
.doc p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 1.2em; margin: 12px 0 0; }
.doc li + li { margin-top: 6px; }
.doc .lang { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--rule); }
.contact { margin-top: 24px; font-size: 1.25rem; font-weight: 650; }

/* ── small screens ───────────────────────────────── */
@media (max-width: 900px) {
  .hero, .split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .dictee { transform: none; }
}
@media (max-width: 640px) {
  :root { --margin-x: 18px; }
  .top nav a:not(:last-child) { display: none; }
  .checks > div { grid-template-columns: 1fr; gap: 4px; }
  .sites thead { display: none; }
  .sites tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .sites th, .sites td { display: block; padding: 2px 0; border: 0; }
}
.app-icon { border-radius: 15px; box-shadow: 0 10px 24px -14px rgba(76,31,176,.7); }
