@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/eb-garamond-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url(/static/fonts/eb-garamond-latin-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/eb-garamond-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 600; font-display: swap; src: url(/static/fonts/eb-garamond-latin-600-italic.woff2) format('woff2'); }

:root {
  --navy: #14213d;
  --navy-2: #24365f;
  --ink: #1b1b1b;
  --muted: #5b6475;
  --rule: #d8dce4;
  --field: #b5bccb;
  --paper: #f5f6f8;
  --danger: #8b1e1e;
  --ok: #1d4a2f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'EB Garamond', Garamond, 'Times New Roman', serif;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
  font-feature-settings: 'kern', 'liga', 'onum';
}
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-2); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
main.wrap { min-height: 70vh; padding-bottom: 72px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- En-tête ---------- */
header.site { border-bottom: 3px double var(--navy); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 18px 32px; padding-top: 20px; padding-bottom: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--navy); }
.mono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--navy);
  font-weight: 600; font-size: 19px; letter-spacing: .04em; color: var(--navy);
  font-feature-settings: 'lnum';
}
.name { font-variant: small-caps; letter-spacing: .09em; font-size: 23px; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 24px; }
.nav a, .linklike {
  color: var(--navy); text-decoration: none; font-variant: small-caps;
  letter-spacing: .06em; font-size: 18px; padding: 2px 0; border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a.on { border-bottom-color: var(--navy); }
.nav .sep { width: 1px; height: 18px; background: var(--rule); }
.linklike { background: none; border: 0; border-bottom: 1px solid transparent; font-family: inherit; cursor: pointer; }
.linklike:hover { border-bottom-color: currentColor; }
.linklike.danger, .danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }

/* ---------- Typographie ---------- */
h1 { font-weight: 400; font-size: 46px; line-height: 1.08; color: var(--navy); margin: 52px 0 14px; letter-spacing: -.005em; }
h2.sec {
  font-weight: 400; font-size: 15px; letter-spacing: .2em; text-transform: uppercase; color: var(--navy);
  margin: 56px 0 24px; padding-bottom: 8px; border-bottom: 1px solid var(--navy);
}
h3 { font-weight: 600; }
.kicker { font-variant: small-caps; letter-spacing: .14em; color: var(--navy-2); margin: 64px 0 0; font-size: 18px; }
.kicker + h1 { margin-top: 6px; }
.lede { font-size: 22px; line-height: 1.45; color: #333; max-width: 640px; margin: 0 0 26px; }
.hint { color: var(--muted); font-size: 16px; margin: 6px 0 0; font-style: italic; }
.opt { text-transform: none; font-variant: normal; letter-spacing: 0; color: var(--muted); font-style: italic; font-size: 15px; }
.empty { color: var(--muted); font-style: italic; }
.muted { color: var(--muted); }
.it { font-style: italic; }
.small { font-size: 15px; color: var(--muted); }
.error { border-left: 2px solid var(--danger); padding: 4px 0 4px 16px; color: var(--danger); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; background: var(--navy); color: #fff; border: 1px solid var(--navy);
  padding: 9px 24px 10px; font-family: inherit; font-size: 18px; font-variant: small-caps; letter-spacing: .08em;
  text-decoration: none; cursor: pointer; border-radius: 0; line-height: 1.3;
}
.btn:hover { background: var(--navy-2); color: #fff; }
.btn.ghost { background: #fff; color: var(--navy); }
.btn.ghost:hover { background: var(--paper); }
.btn.block { display: block; text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* ---------- Flash ---------- */
.flash { margin: 28px 0 0; padding: 14px 20px; border: 1px solid var(--navy); background: var(--paper); }
.flash p { margin: 0; }
.flash-err { border-color: var(--danger); color: var(--danger); }
.flash .code-line { margin-top: 8px; }
.flash code { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 17px; background: #fff; padding: 2px 8px; border: 1px solid var(--rule); letter-spacing: .05em; user-select: all; }

/* ---------- Accueil ---------- */
.hero { padding-bottom: 8px; }
.stats { color: var(--muted); font-variant: small-caps; letter-spacing: .08em; margin-top: 28px; }
.more { margin-top: 32px; }

/* ---------- Grille de livres ---------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 44px 30px; }
.card a { text-decoration: none; color: inherit; display: block; }
.card a:hover .t { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--rule); background: var(--paper); }
.cover.ph {
  background: var(--navy); color: #fff; border-color: var(--navy);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 16px; position: relative;
}
.cover.ph::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.35); }
.ph-t { font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; position: relative; }
.ph-a { font-style: italic; font-size: 15px; opacity: .8; margin-top: 8px; position: relative; }
.card .theme { margin-top: 14px; }
.theme { font-variant: small-caps; letter-spacing: .1em; font-size: 15px; color: var(--navy-2); }
.theme a { text-decoration: none; }
.card .t { font-size: 19px; font-weight: 600; line-height: 1.2; color: var(--navy); margin: 2px 0 2px; }
.card .a { font-style: italic; color: var(--muted); font-size: 17px; line-height: 1.3; }

/* ---------- Bibliothèque ---------- */
.filters { display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: 16px; align-items: end; margin: 28px 0 18px; }
.filters label { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 30px; }
.chips a { font-size: 16px; text-decoration: none; border: 1px solid var(--rule); padding: 2px 12px; color: var(--navy); }
.chips a:hover { border-color: var(--navy); }
.chips a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips a.reset { border-style: dashed; font-style: italic; }
.count { color: var(--muted); font-variant: small-caps; letter-spacing: .08em; border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 30px; }

/* ---------- Fiche ---------- */
.book { display: grid; grid-template-columns: 250px 1fr; gap: 56px; margin-top: 52px; }
.book-side .cover { margin-bottom: 22px; }
.book-side p { margin: 0 0 10px; }
.book-side form { margin-top: 18px; text-align: center; }
.book-main .theme { margin: 0 0 6px; }
.book-title { margin: 0 0 6px; font-size: 48px; }
.book-author { font-style: italic; font-size: 25px; margin: 0 0 18px; }
.meta { color: var(--muted); margin: 0 0 4px; font-feature-settings: 'lnum'; }
.rating { margin: 0 0 4px; color: var(--navy); font-feature-settings: 'lnum'; }
.dots { display: inline-flex; gap: 5px; margin-right: 6px; vertical-align: 1px; }
.dots i { width: 9px; height: 9px; border: 1px solid var(--navy); border-radius: 50%; display: inline-block; }
.dots i.on { background: var(--navy); }
.byline { color: var(--muted); font-style: italic; font-size: 17px; margin: 10px 0 0; }
.prose p { margin: 0 0 1em; text-align: justify; hyphens: auto; max-width: 70ch; }
.read-if { font-style: italic; font-size: 21px; margin: 0; }
blockquote { margin: 0 0 28px; padding: 2px 0 2px 24px; border-left: 2px solid var(--navy); max-width: 68ch; }
blockquote p { margin: 0; font-style: italic; font-size: 22px; line-height: 1.45; }
blockquote cite { display: block; font-style: normal; color: var(--muted); font-size: 16px; margin-top: 6px; font-feature-settings: 'lnum'; }

/* ---------- Formulaires ---------- */
label { display: block; font-variant: small-caps; letter-spacing: .07em; color: var(--navy); font-size: 17px; margin: 18px 0 6px; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; font-family: inherit; font-size: 18px; color: var(--ink); background: #fff;
  border: 1px solid var(--field); border-radius: 0; padding: 9px 12px; line-height: 1.4;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: -1px; border-color: var(--navy); }
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type=file] { font-family: inherit; font-size: 16px; width: 100%; }
input[type=file]::file-selector-button { font-family: inherit; font-size: 16px; font-variant: small-caps; letter-spacing: .06em; background: #fff; color: var(--navy); border: 1px solid var(--navy); padding: 6px 14px; margin-right: 12px; cursor: pointer; }
fieldset { border: 0; border-top: 1px solid var(--navy); margin: 40px 0 0; padding: 4px 0 0; min-width: 0; }
legend { font-size: 15px; letter-spacing: .2em; text-transform: uppercase; color: var(--navy); padding-right: 14px; }
.book-form { max-width: 820px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.cols.three { grid-template-columns: 1fr 2fr 1fr; }
.isbn-line { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; max-width: 520px; }
.cover-line { display: grid; grid-template-columns: 120px 1fr; gap: 26px; align-items: start; margin-top: 18px; }
.cover-preview { width: 120px; aspect-ratio: 2 / 3; border: 1px solid var(--rule); background: var(--paper); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-style: italic; font-size: 15px; padding: 8px; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview:has(img:not([hidden])) { padding: 0; }
.cover-line label { margin-top: 0; }
.quote-row { display: grid; grid-template-columns: 1fr 110px; gap: 0 18px; padding: 6px 0 16px; border-bottom: 1px solid var(--rule); }
.quote-row .q-remove { grid-column: 1 / -1; justify-self: start; font-size: 16px; margin-top: 8px; color: var(--muted); }
.book-form .actions { margin-top: 40px; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; font-variant: normal; letter-spacing: 0; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.stack { margin-top: 12px; }
.narrow { max-width: 520px; }

/* ---------- Connexion ---------- */
.login { max-width: 420px; margin: 72px auto 0; text-align: center; }
.login h1 { font-size: 40px; margin: 22px 0 10px; }
.login .lede { font-size: 19px; margin: 0 auto 10px; }
.login form { text-align: left; }
.login .btn { width: 100%; margin-top: 18px; }
.big-mono { width: 72px; height: 72px; font-size: 30px; }
.login .error { text-align: left; }

/* ---------- Emplois du temps ---------- */
.panel { border: 1px solid var(--navy); padding: 0 24px; margin: 8px 0 40px; }
.panel summary { cursor: pointer; padding: 14px 0; font-variant: small-caps; letter-spacing: .08em; color: var(--navy); font-size: 19px; list-style: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::before { content: '+'; display: inline-block; width: 22px; }
.panel[open] summary::before { content: '–'; }
.panel form { padding-bottom: 22px; }
.sched-list { border-top: 1px solid var(--navy); }
.sched { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.sched h3 { margin: 0; font-size: 22px; font-weight: 600; }
.sched h3 a { text-decoration: none; }
.sched .meta { font-size: 16px; font-style: italic; }
.sched .note { margin: 8px 0 0; max-width: 62ch; white-space: pre-line; }
.sched-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }

/* ---------- Téléchargements ---------- */
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 10px; }
.dl { display: block; border: 1px solid var(--navy); padding: 26px 28px 28px; text-decoration: none; color: var(--ink); position: relative; }
.dl::after { content: 'PDF ↓'; position: absolute; top: 24px; right: 26px; font-variant: small-caps; letter-spacing: .1em; color: var(--navy); font-size: 16px; }
.dl:hover { background: var(--paper); }
.dl-k { display: block; font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--navy-2); }
.dl-t { display: block; font-size: 28px; color: var(--navy); margin: 6px 0 4px; line-height: 1.15; }
.dl-m { display: block; font-style: italic; color: var(--muted); }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 18px; }
.table th { text-align: left; font-weight: 400; font-variant: small-caps; letter-spacing: .08em; color: var(--navy); border-bottom: 1px solid var(--navy); padding: 6px 10px 6px 0; }
.table td { border-bottom: 1px solid var(--rule); padding: 10px 10px 10px 0; vertical-align: middle; }
.table .r { text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 18px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.tag { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--navy); padding: 0 6px; margin-left: 6px; color: var(--navy); vertical-align: 2px; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 14px 22px; }
.inline-form > div { flex: 1 1 260px; max-width: 360px; }
.inline-form label { margin-top: 0; }
.inline-form .check { padding-bottom: 12px; }
.rename { display: flex; gap: 12px; align-items: center; margin: 0; }
.rename input:not([type=checkbox]) { padding: 5px 10px; font-size: 17px; max-width: 300px; }

/* ---------- Messages ---------- */
.msg { margin-top: 40px; }

/* ---------- Pied de page ---------- */
footer.site { border-top: 1px solid var(--rule); color: var(--muted); font-size: 16px; padding: 26px 0 34px; }
footer.site .wrap { display: flex; align-items: center; gap: 12px; font-variant: small-caps; letter-spacing: .08em; }
.small-mono { width: 28px; height: 28px; font-size: 12px; color: var(--muted); border-color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  body { font-size: 18px; }
  .wrap { padding: 0 18px; }
  h1 { font-size: 36px; margin-top: 36px; }
  .kicker { margin-top: 40px; }
  .lede { font-size: 20px; }
  .head { padding-top: 14px; padding-bottom: 12px; }
  .nav { width: 100%; gap: 2px 18px; }
  .nav .sep { display: none; }
  .nav a, .nav .linklike { font-size: 17px; }
  .books { grid-template-columns: repeat(2, 1fr); gap: 32px 18px; }
  .book { grid-template-columns: 1fr; gap: 28px; margin-top: 32px; }
  .book-side { max-width: 240px; }
  .book-title { font-size: 36px; }
  .cols, .cols.three { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .dl-grid { grid-template-columns: 1fr; }
  .sched { flex-direction: column; gap: 12px; }
  .sched-actions { flex-direction: row; align-items: center; gap: 18px; }
  .hide-m { display: none; }
  .row-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
  .quote-row { grid-template-columns: 1fr 80px; }
  .cover-line { grid-template-columns: 90px 1fr; gap: 16px; }
  .cover-preview { width: 90px; }
  .prose p { text-align: left; }
}
