/* GeniMath — page Paramètres. Bandeau et pied de page : commun.css ; fiches : fiche-formats.css */
:root { font-family: var(--font); color: var(--ink); font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.settings-main { max-width: 1320px; margin: 0 auto; padding: 34px 28px 56px; }
.settings-head { display: flex; align-items: center; gap: 18px; }
.settings-icon { width: 52px; height: 52px; flex: none; fill: none; stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-head h1 { margin: 0; font-size: clamp(34px, 4vw, 48px); font-weight: 900; font-style: italic; letter-spacing: -.04em; line-height: 1.05; }
.settings-head p { margin: 6px 0 0; color: var(--muted); font-size: 17px; }

.settings-tabs { display: flex; gap: 6px; margin: 26px 0 0; border-bottom: 1px solid var(--line-warm); }
.settings-tabs a { position: relative; padding: 12px 4px 14px; margin-right: 22px; font-weight: 800; font-size: 16px; text-decoration: none; color: var(--muted); }
.settings-tabs a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 4px; border-radius: 4px 4px 0 0; background: var(--red); }
.settings-tabs a[aria-current] { color: var(--ink); }

.settings-section { padding-top: 26px; scroll-margin-top: 16px; }
.section-intro h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.section-intro p { margin: 6px 0 0; max-width: 70ch; color: var(--muted); line-height: 1.5; }

.formats-layout { display: grid; grid-template-columns: minmax(360px, 480px) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 22px; }
.format-picker fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.format-list { display: grid; gap: 12px; }

/* Carte d'un format (bouton radio accessible au clavier : flèches haut/bas) */
.format-option { position: relative; display: grid; grid-template-columns: 76px 1fr; gap: 16px; align-items: center; padding: 12px 16px 12px 12px; background: #fff; border: 2px solid #eadccd; border-radius: 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.format-option:hover { border-color: #e2a7a2; transform: translateY(-1px); }
.format-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.format-option:has(input:focus-visible) { outline: 3px solid #f0a400; outline-offset: 3px; }
.format-option:has(input:checked) { border-color: var(--red); background: #fff7f6; box-shadow: 0 0 0 4px rgba(211, 19, 28, .12), 0 10px 22px rgba(120, 30, 20, .1); }
.format-thumb { position: relative; display: block; width: 76px; aspect-ratio: 210 / 297; overflow: hidden; background: #fff; border: 1px solid #d9d4cf; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); pointer-events: none; }
.format-thumb .fiche, .a4-frame .fiche { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.format-text { display: grid; gap: 3px; min-width: 0; }
.format-num { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.format-text strong { font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.format-summary { font-size: 14px; color: #4b4f58; line-height: 1.35; }
.format-usage { font-size: 12.5px; font-weight: 700; color: #9a5a12; }
.format-check { position: absolute; top: 10px; right: 12px; display: none; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; }
.format-check::before { content: "✓"; }
.format-option:has(input:checked) .format-check { display: inline-flex; }

.save-status { min-height: 1.4em; margin: 14px 2px 0; font-size: 14px; font-weight: 700; color: #2f6b3a; }
.integration-note { margin-top: 10px; padding: 14px 16px; border: 1px solid #efdcbc; border-radius: 14px; background: #fff6ea; color: #5f4a2c; font-size: 14px; line-height: 1.5; }

/* Aperçu */
.preview-panel { position: sticky; top: 16px; padding: 18px 20px 20px; background: #fff; border: 1px solid var(--line-warm); border-radius: 22px; box-shadow: 0 10px 30px rgba(70, 40, 20, .08); }
.preview-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 20px; margin-bottom: 16px; }
.preview-kicker { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.preview-toolbar h3 { margin: 2px 0 0; font-size: 24px; font-weight: 900; letter-spacing: -.02em; }
.preview-summary { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.preview-options { display: grid; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 40px; height: 22px; flex: none; border-radius: 999px; background: #cfc8c1; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--red); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid #f0a400; outline-offset: 2px; }
.switch:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.switch-hint { margin: -4px 0 0 50px; font-size: 12px; color: var(--muted); }
.a4-stage { padding: 18px; border-radius: 14px; background: #ece6df; }
.a4-frame { position: relative; width: min(100%, 600px, calc((100vh - 250px) * 210 / 297)); margin: 0 auto; aspect-ratio: 210 / 297; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 14px 30px rgba(40, 20, 10, .18); }
.a4-frame.is-mono .fiche { filter: grayscale(1); }
.a4-caption { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }

/* Tablettes */
@media (max-width: 1060px) {
  .formats-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .format-picker, .preview-panel { min-width: 0; }
  .format-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .format-option { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 14px 12px; }
  .format-thumb { width: 92px; }
  .format-check { top: 8px; right: 8px; padding: 2px 8px 2px 6px; font-size: 11px; }
  .preview-panel { position: static; }
  .a4-frame { width: min(100%, 600px); }
}
/* Téléphones : bande de formats à faire défiler, aperçu juste en dessous */
@media (max-width: 640px) {
  .settings-main { padding: 22px 16px 40px; }
  .settings-icon { width: 40px; height: 40px; }
  .settings-head p { font-size: 15px; }
  .format-list { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 132px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 12px; margin: 0 -4px; }
  .format-option { scroll-snap-align: start; padding: 12px 8px 10px; gap: 8px; }
  .format-thumb { width: 84px; }
  .format-summary, .format-usage { display: none; }
  .format-text strong { font-size: 15px; }
  .format-check { font-size: 0; padding: 0; width: 22px; height: 22px; justify-content: center; }
  .format-check::before { font-size: 13px; }
  .preview-panel { padding: 14px 12px 14px; border-radius: 18px; }
  .a4-stage { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
