/* Mise en page FastLearner — uniquement des tokens Handwritten, aucun dégradé ni ombre hors shadow-paper. */
html { -webkit-text-size-adjust: 100%; --radius-box: 22px 7px 18px 9px; /* variante du rayon irrégulier pour les grands cadres */ }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--ballpoint); }
.hw-page { max-width: 48rem; margin: 0 auto; padding: 0 max(var(--space-4), env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(72px, env(safe-area-inset-left)); box-sizing: border-box; }
.hw-nav { position: relative; max-width: 48rem; margin: 0 auto; box-sizing: border-box; padding: max(var(--space-4), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) var(--space-4) max(72px, env(safe-area-inset-left)); display: flex; align-items: center; gap: var(--space-4); min-height: 56px; }
.hw-menu { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.hw-menu form { margin: 0; }
.hw-nav a { color: var(--graphite); text-decoration: none; }
.hw-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--ballpoint); text-decoration-thickness: var(--stroke-marker); text-underline-offset: 4px; }
.hw-burger { display: none; width: 44px; height: 44px; padding: 0; background: transparent; color: var(--graphite); border: 0; cursor: pointer; touch-action: manipulation; }
.hw-burger svg { width: 44px; height: 44px; }
.hw-burger .hw-arrow { stroke-width: 3.5; }
.hw-burger[aria-expanded="true"] { background: var(--highlighter); border-radius: var(--radius-sketch); }
.hw-burger:focus-visible { outline: var(--stroke-pen) dashed var(--ballpoint); outline-offset: 2px; }
.hw-toggle-text { display: none; }
.hw-brand { font-family: var(--font-marker); font-size: 34px; line-height: 1; font-weight: 700; margin-right: auto; }
.hw-toggle { touch-action: manipulation; min-height: 44px; min-width: 44px; font-family: var(--font-pen); background: transparent; color: var(--graphite); border: var(--stroke-pen) solid var(--graphite); border-radius: var(--radius-sketch); font-size: 18px; padding: var(--space-1) var(--space-3); cursor: pointer; }
h1, h2, h3, p, ul, ol, blockquote, figure { margin: 0; }
.hw-h1 { margin-bottom: var(--space-7); }
.hw-gap { margin-bottom: var(--space-7); }
.hw-muted { color: var(--graphite-light); }

/* Texte du digest (markdown rendu côté serveur) */
.prose-hw p { margin: 0 0 var(--space-7); }
.prose-hw h2, .prose-hw h1 { font: 700 34px/56px var(--font-marker); }
.prose-hw h3 { font: 700 26px/28px var(--font-marker); margin-bottom: var(--space-2); }
.prose-hw ul, .prose-hw ol { padding-left: 28px; margin: 0 0 var(--space-7); }
.prose-hw ul { list-style: disc; }
.prose-hw ol { list-style: decimal; }
.prose-hw li { line-height: 28px; }
.prose-hw blockquote { border-left: var(--stroke-marker) solid var(--ballpoint); padding-left: var(--space-4); margin: 0 0 var(--space-7); font-family: var(--font-pencil); font-weight: 300; }
.prose-hw strong { font-weight: 700; }
.prose-hw code { font-family: var(--font-pencil); }
.hw-callout { margin: 0 0 var(--space-7); }
.hw-callout p { display: inline; margin: 0; }
.hw-callout .hw-hl { font-size: 20px; }

/* Objets */
.hw-card { background: var(--page-raised); border: var(--stroke-pen) solid var(--graphite); border-radius: var(--radius-box); padding: var(--space-4); margin-bottom: var(--space-7); }
.hw-stickies { display: grid; grid-template-columns: 1fr; gap: 36px; padding: var(--space-4) var(--space-2) var(--space-7); }
@media (min-width: 480px) { .hw-stickies { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1025px) { .hw-stickies { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hw-sticky-link { display: block; color: inherit; text-decoration: none; }
.hw-sticky-link:hover .hw-sticky { transform: rotate(0deg); }
.hw-figure { background: var(--page-raised); border: var(--stroke-pen) solid var(--graphite); border-radius: var(--radius-box); padding: var(--space-3); margin: 0 0 var(--space-7); }
.hw-figure svg, .hw-figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.hw-figure figcaption { margin-top: var(--space-2); font-size: 15px; line-height: 20px; color: var(--graphite-light); }
.hw-figure .hw-note { margin-top: var(--space-2); }
details.hw-src { margin: calc(-1 * var(--space-4)) 0 var(--space-7); }
details.hw-src summary { cursor: pointer; color: var(--ballpoint); font-size: 15px; line-height: 20px; }
details.hw-src blockquote { margin: var(--space-2) 0 0; padding-left: var(--space-3); border-left: var(--stroke-pencil) solid var(--graphite-light); font-family: var(--font-pencil); font-weight: 300; font-size: 16px; line-height: 24px; }
details.hw-src .small { color: var(--graphite-light); }
.hw-figure details.hw-src, .hw-card details.hw-src { margin: var(--space-2) 0 0; }

/* Formulaires */
.hw-input { display: block; width: 100%; box-sizing: border-box; font-family: var(--font-pen); font-size: 18px; line-height: 24px; padding: var(--space-2) var(--space-3); background: var(--page-raised); color: var(--graphite); border: var(--stroke-pen) solid var(--graphite); border-radius: var(--radius-box); }
.hw-input:focus-visible { outline: var(--stroke-pen) dashed var(--ballpoint); outline-offset: 3px; }
textarea.hw-input { min-height: 112px; }
.hw-label { display: block; font-family: var(--font-pen); margin-bottom: var(--space-1); }
.hw-field { margin-bottom: var(--space-4); }
.hw-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-7); }
a.hw-btn { display: inline-block; text-decoration: none; color: var(--graphite); }

/* QCM */
.hw-choice { min-height: 48px; box-sizing: border-box; border-radius: var(--radius-box); display: block; width: 100%; text-align: left; margin-bottom: var(--space-3); background: var(--page-raised); line-height: 24px; }
.hw-choice:hover, .hw-choice:active { border-radius: 9px 7px 20px 22px; }
.hw-choice-correct { background: var(--highlighter-green); }
.hw-choice-wrong { border-color: var(--red-pen); color: var(--red-pen); text-decoration: line-through; text-decoration-thickness: var(--stroke-pen); }
.hw-choice-mark { display: inline-block; width: 28px; font-weight: 700; }
.hw-prompt { font-family: var(--font-marker); font-size: 28px; line-height: 34px; font-weight: 700; margin-bottom: var(--space-4); }
.hw-score { font-family: var(--font-marker); font-size: 56px; line-height: 56px; font-weight: 700; }

/* Admin */
.hw-item { border-bottom: var(--stroke-pencil) solid var(--graphite-light); padding: var(--space-3) 0; }
.hw-status { display: inline-block; font-size: 15px; line-height: 20px; padding: 0 var(--space-2); border: var(--stroke-pencil) solid var(--graphite); border-radius: var(--radius-sketch); }
.hw-status-review { background: var(--highlighter); }
.hw-status-published { background: var(--highlighter-green); }
.hw-status-rejected { color: var(--red-pen); border-color: var(--red-pen); }
.hw-log { font-family: var(--font-pencil); font-size: 16px; line-height: 24px; max-height: 280px; overflow: auto; }
.hw-error { color: var(--red-pen); }
.hw-flash { margin-bottom: var(--space-7); }
.hw-offline { display: none; }
.hw-filters { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.hw-filters a { display: inline-flex; align-items: center; min-height: 44px; }
.hw-mt { margin-top: 28px; }
.hw-mt-s { margin-top: 12px; }
.hw-mb0 { margin-bottom: 0; }
.hw-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hw-btn, .hw-input, .hw-toggle, select, textarea, input, button { touch-action: manipulation; }
input, select, textarea, button { font-size: max(16px, 1em); }
img, svg, video { max-width: 100%; height: auto; }
.hw-btn { min-height: 44px; box-sizing: border-box; }
.hw-figure figcaption, details.hw-src blockquote, .hw-page a, .hw-card, .prose-hw, .hw-item, .hw-sticky h3, .hw-prompt { overflow-wrap: anywhere; }
.hw-log { overflow-x: auto; }
.hw-figure > svg { width: 100%; }
.hw-note svg { width: 90px; height: 40px; }
.hw-figure, .hw-page { min-width: 0; }
.hw-figure img { box-sizing: border-box; max-width: 100%; }
.hw-item a { display: inline-block; }
@media (max-width: 767px) {
  .hw-nav { flex-wrap: wrap; padding-left: max(var(--space-4), env(safe-area-inset-left)); }
  .hw-burger { display: inline-flex; align-items: center; justify-content: center; }
  .hw-brand { margin-right: auto; }
  .hw-menu { display: none; position: absolute; z-index: 20; top: 100%; left: var(--space-4); right: var(--space-4); flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0; padding: var(--space-2) var(--space-4); background: var(--page-raised); border: var(--stroke-pen) solid var(--graphite); border-radius: var(--radius-box); box-shadow: var(--shadow-paper); }
  .hw-menu.is-open { display: flex; }
  .hw-menu > a, .hw-menu > button, .hw-menu > form > button { display: flex; align-items: center; justify-content: flex-start; min-height: 48px; width: 100%; box-sizing: border-box; border-bottom: var(--stroke-pencil) solid var(--graphite-light); }
  .hw-menu > :last-child { border-bottom: 0; }
  .hw-menu > button.hw-toggle, .hw-menu .hw-menu-btn { border-width: 0 0 var(--stroke-pencil) 0; border-radius: 0; background: transparent; text-align: left; color: var(--graphite); padding-left: 0; }
  .hw-menu .hw-menu-btn { border-bottom: var(--stroke-pencil) solid var(--graphite-light); padding-left: 0; }
  .hw-toggle-text { display: inline; margin-left: var(--space-2); }
}

@media (max-width: 639px) {
  .hw-ruled { background-position: 8px 0, 0 0; }
  .hw-page { padding-left: max(var(--space-4), env(safe-area-inset-left)); padding-right: max(var(--space-4), env(safe-area-inset-right)); }
  .hw-nav { padding-left: max(var(--space-4), env(safe-area-inset-left)); }
  .title-page { font-size: 44px; }
  .hw-sticky { max-width: none; min-height: 0; }
  .hw-actions { flex-direction: column; align-items: stretch; }
  .hw-actions .hw-btn, .hw-card button.hw-btn, .hw-card .hw-btn, form > button.hw-btn { display: block; width: 100%; text-align: center; min-height: 48px; }
  .hw-actions form, form.hw-actions { width: 100%; }
  .hw-card { padding: var(--space-3); }
  .hw-check { padding-left: 0; }
  .hw-score { font-size: 44px; }
  details.hw-src summary { min-height: 44px; display: flex; align-items: center; }
}
