:root {
  --paper: #f5f0e6;
  --card: #fffdf8;
  --ink: #1f1c18;
  --muted: #6f675c;
  --rule: #e1d8c8;
  --accent: #b4442c;
  --serif: Calibri, Carlito, "Segoe UI", sans-serif;
  --sans: Calibri, Carlito, "Segoe UI", sans-serif;
  --mono: Calibri, Carlito, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --card: #211e1a;
    --ink: #eee7da;
    --muted: #a59c8e;
    --rule: #37322b;
    --accent: #e4805f;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}
main, .masthead, .colophon { max-width: 760px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); }

.masthead { padding-top: 56px; padding-bottom: 24px; }
.masthead h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 3rem;
  letter-spacing: -0.01em;
  margin: 0;
}
.lede { color: var(--muted); margin: 6px 0 0; max-width: 52ch; }

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 20px;
}
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1.3fr 0.8fr 0.8fr; align-items: end; }
.grid.three .actions { grid-column: 1 / -1; }
@media (max-width: 620px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); position: relative; }
input, select {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 9px 10px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.settings { margin-bottom: 14px; }
.settings summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.hint { font-size: 0.8rem; color: var(--muted); margin: -4px 0 0; }

.actions { display: flex; gap: 8px; }
button {
  font: inherit;
  font-size: 0.95rem;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
}
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.ghost:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: progress; }

.status { min-height: 1.2em; margin: 0; font-size: 0.85rem; color: var(--muted); }
.status.error { color: var(--accent); }

.suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 5;
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  max-height: 280px;
  overflow: auto;
}
.suggestions li {
  padding: 7px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.suggestions li small { color: var(--muted); }
.suggestions li.active, .suggestions li:hover { background: var(--paper); }
.suggestions li.msg { cursor: default; color: var(--muted); }

.journeys { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
.journey {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  font-variant-numeric: tabular-nums;
}
.journey[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.journey .meta { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.5;
}

.poem {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  margin: 20px 0 40px;
  padding: 44px 48px 28px;
  /* Le poème garde ses polices d'origine ; le reste du site est en Calibri. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: var(--serif);
}
@media (max-width: 620px) { .poem { padding: 28px 20px 20px; } }
.poem h2 { font-weight: 400; font-size: 1.9rem; margin: 0; line-height: 1.2; }
.poem .sub { color: var(--muted); font-style: italic; margin: 6px 0 28px; }

.stanza {
  position: relative;
  margin: 0 0 26px;
  padding-left: 18px;
  border-left: 3px solid var(--rule);
}
.stanza.interlude { border-left-style: dotted; font-style: italic; color: var(--muted); }
.stanza .badge { position: absolute; left: -48px; top: 3px; }
@media (max-width: 620px) { .stanza .badge { position: static; margin-bottom: 4px; } }

.line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 1.15rem;
  line-height: 1.65;
  opacity: 0;
  transform: translateY(4px);
  animation: appear 0.5s ease forwards;
}
.line .stamp {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.45em;
  flex-shrink: 0;
}
.line .st { font-style: italic; color: var(--accent); }
.stanza.interlude .line .st { color: inherit; }
.line .tm { font-variant-numeric: tabular-nums; }
@keyframes appear { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .line { animation: none; opacity: 1; transform: none; } }

/* Contemporary style: notes-app plainness. Sans-serif, lowercase, timestamps, no ornaments. */
.poem.contemporary { font-family: var(--sans); }
.poem.contemporary h2 { font-family: var(--sans); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; }
.poem.contemporary .sub { font-style: normal; font-size: 0.85rem; }
.poem.contemporary .stanza.plain { border-left: 0; padding-left: 0; margin-bottom: 30px; }
.poem.contemporary .line { font-size: 1.02rem; line-height: 1.6; }
.poem.contemporary .line .tm { font-family: var(--mono); font-size: 0.85em; color: var(--muted); }
.poem.contemporary .line.aside { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); }
.poem.contemporary .line.item { padding-left: 1.2em; }
.poem.contemporary .line.prose { max-width: 56ch; text-align: justify; hyphens: auto; }
.poem.contemporary .line .stamp:empty { display: none; }
.poem.contemporary .line > span:first-child { white-space: pre-wrap; }
.poem.contemporary .line .shard { font-family: var(--serif); font-style: italic; color: var(--accent); letter-spacing: 0.08em; }
.poem.contemporary .line.chant, .fitem.chant { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.12em; margin-top: 1.2em; }
.poem.contemporary .line .strike { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--muted); }
.poem.contemporary .line .marks { color: var(--muted); letter-spacing: 0.1em; }
.poem.contemporary .line.neo { font-family: var(--serif); font-style: italic; font-size: 1.15rem; letter-spacing: 0.05em; }

/* Abstract style: a field of fragments placed by time. No borders, no names. */
.poem.abstract h2 { font-style: italic; letter-spacing: 0.02em; }
.poem.abstract .sub { font-family: var(--mono); font-style: normal; font-size: 0.75rem; letter-spacing: 0.15em; }
.field { padding: 8px 0 24px; }
.fitem {
  width: max-content;
  max-width: 100%;
  font-size: 1.12rem;
  line-height: 1.7;
  white-space: pre-wrap;
  opacity: 0;
  transform: translateY(4px);
  animation: appear 0.6s ease forwards;
}
.fitem.neo { font-style: italic; letter-spacing: 0.04em; }
.fitem.erased { color: var(--muted); letter-spacing: 0.12em; }
.fitem.perm { font-size: 0.98rem; line-height: 1.45; }
.fitem.marks { color: var(--muted); letter-spacing: 0.1em; font-size: 0.95rem; }
.fitem.hue { font-variant: small-caps; letter-spacing: 0.12em; color: var(--muted); }
.fitem.num { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.swatch { display: inline-block; width: 0.55em; height: 0.55em; margin-right: 0.5em; vertical-align: 0.1em; }
@media (prefers-reduced-motion: reduce) { .fitem { animation: none; opacity: 1; transform: none; } }


.poem-tools { display: flex; gap: 8px; border-top: 1px solid var(--rule); padding-top: 18px; font-family: var(--sans); }

.colophon { color: var(--muted); font-size: 0.8rem; padding-bottom: 40px; }

/* Postcard image: a single drawn card, lying slightly askew. */
.postcard { margin: 0 0 48px; }
.postcard .card { margin: 0; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 10px 28px rgb(0 0 0 / 0.14); border-radius: 3px; overflow: hidden; line-height: 0; transform: rotate(-0.6deg); }
.postcard .card svg { width: 100%; height: auto; display: block; }
.postcard .pc-tools { display: flex; gap: 8px; margin-top: 18px; }
