@font-face { font-family: 'Inter'; src: url('/fonts/inter-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --bg: #faf9f4;
  --paper: #ffffff;
  --ink: #1c1c1e;
  --ink2: #3a3a3c;
  --grey: #8a8a8e;
  --grey3: #c7c7cc;
  --accent: #c99700;
  --chip: #f2f2f7;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --paper: #1c1c1e;
    --ink: #f2f2f2;
    --ink2: #d1d1d6;
    --grey: #98989e;
    --grey3: #48484a;
    --accent: #ebb800;
    --chip: #2c2c2e;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 32px rgba(0,0,0,.45);
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- barres ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;
  flex: none;
}
.tb-left { color: var(--accent); font-size: 17px; }
.tb-title { color: var(--grey); font-size: 13px; font-variant-numeric: tabular-nums; }
.tb-right { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; display: flex; }

#navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px calc(env(safe-area-inset-bottom, 0px) + 14px);
  flex: none;
}
#navbar button {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 15px;
}
#btn-prev, #btn-next { font-size: 30px; line-height: 1; padding: 0 14px; }
#navbar button:disabled { color: var(--grey3); }

/* ---------- lecteur ---------- */
#viewport { flex: 1; overflow: hidden; position: relative; touch-action: pan-y; }
#track { display: flex; height: 100%; will-change: transform; }
.pane {
  flex: 0 0 100%; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 0 40px;
}
.note {
  max-width: 660px; margin: 0 auto; background: var(--paper);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 26px 24px 40px; min-height: 70%;
}
@media (max-width: 700px) {
  .pane { padding: 0; }
  .note { border-radius: 0; box-shadow: none; min-height: 100%; padding: 18px 20px 60px; }
}
.note-date { text-align: center; color: var(--grey); font-size: 12.5px; margin-bottom: 18px; }
.note h1 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 12px; }
.note .body { font-size: 17px; line-height: 1.5; color: var(--ink2); }
.note .body .blank { height: 14px; }
.note .body .li { padding-left: 18px; text-indent: -18px; }
.note .body .li .dash { margin-right: 8px; color: var(--grey); }
.annex {
  margin-top: 26px; display: inline-flex; align-items: center; gap: 12px;
  background: var(--chip); border: 0; border-radius: 12px; padding: 13px 16px;
  font-family: inherit; font-size: 15px; color: var(--ink2); cursor: pointer; text-align: left;
  max-width: 100%;
}
.annex .achev { color: var(--grey3); font-size: 18px; }
.locked-pane, .teaser-pane {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--grey); text-align: center; padding: 32px;
}
.locked-pane .lk-date { font-size: 22px; font-weight: 700; color: var(--ink); }
.locked-pane .lk-count { font-size: 15px; }
.locked-pane svg { opacity: .5; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 40;
  display: flex; flex-direction: column;
}
.ov-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 12px; flex: none;
}
.ov-title { font-size: 17px; font-weight: 700; }
.ov-close { background: none; border: 0; color: var(--accent); font-size: 15px; font-family: inherit; cursor: pointer; }
#cal-body { flex: 1; overflow-y: auto; padding: 0 16px 20px; max-width: 560px; margin: 0 auto; width: 100%; }
.cal-month { margin-top: 22px; }
.cal-month h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; text-transform: lowercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1; border: 0; border-radius: 50%; background: none;
  font-family: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cal-cell.future { color: var(--grey3); cursor: default; }
.cal-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.read::after { content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-cell.empty { visibility: hidden; }
.cal-foot { flex: none; text-align: center; color: var(--grey3); font-size: 11.5px; padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 12px); }
.cal-foot a { color: var(--grey3); }

/* ---------- gate ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet {
  background: var(--paper); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  padding: 10px 26px calc(env(safe-area-inset-bottom, 0px) + 26px);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--grey3); margin: 2px auto 6px; }
.gate-big { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.gate-sub { font-size: 15px; color: var(--ink2); line-height: 1.45; }
#gate-form { display: flex; flex-direction: column; gap: 10px; }
#gate-email {
  font-family: inherit; font-size: 17px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--grey3); background: var(--bg); color: var(--ink); outline: none;
}
#gate-email:focus { border-color: var(--accent); }
#gate-go {
  font-family: inherit; font-size: 17px; font-weight: 600; padding: 14px;
  border-radius: 12px; border: 0; background: var(--accent); color: #fff; cursor: pointer;
}
.gate-legal { font-size: 12px; color: var(--grey); text-align: center; }
.gate-later { background: none; border: 0; color: var(--grey); font-family: inherit; font-size: 14px; cursor: pointer; padding: 4px; }

/* ---------- doc ---------- */
.overlay.doc { background: var(--paper); }
.doc-body {
  flex: 1; overflow-y: auto; padding: 8px 22px 60px; max-width: 680px; margin: 0 auto; width: 100%;
  font-size: 16px; line-height: 1.55; color: var(--ink2);
}
.doc-body h1, .doc-body h2, .doc-body h3 { color: var(--ink); margin: 22px 0 10px; letter-spacing: -.3px; }
.doc-body h1 { font-size: 22px; } .doc-body h2 { font-size: 18px; } .doc-body h3 { font-size: 16px; }
.doc-body p { margin: 10px 0; }
.doc-body ul, .doc-body ol { margin: 10px 0 10px 22px; }
.doc-body li { margin: 5px 0; }
.doc-body table { border-collapse: collapse; margin: 14px 0; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.doc-body th, .doc-body td { border: 1px solid var(--grey3); padding: 7px 10px; text-align: left; }
.doc-body blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--grey); margin: 12px 0; }
.doc-body code { background: var(--chip); border-radius: 5px; padding: 1px 6px; font-size: 14px; }

.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
