/* mots d'un soir — d'après le redesign sombre de Tom (Figma, 2023) */

@font-face { font-family: "Spline Sans Mono"; src: url("../assets/fonts/SplineSansMono-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Indie Flower"; src: url("../assets/fonts/IndieFlower.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Cherry Bomb One"; src: url("../assets/fonts/CherryBombOne-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Amatic SC"; src: url("../assets/fonts/AmaticSC-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Reenie Beanie"; src: url("../assets/fonts/ReenieBeanie-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../assets/fonts/Montserrat-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Amstelvar"; src: url("../assets/fonts/Amstelvar-Roman.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ground: #0a0a0a;
  --surface: #222;
  --ink: #fff;
  --ink-80: rgba(255, 255, 255, 0.8);
  --ink-60: rgba(255, 255, 255, 0.6);
  --rule: #8d8d8d;
  --action: #4f1d4a;
  --action-hover: #622459;
  --chip: rgba(255, 255, 255, 0.8);
  --dark: #0a0a0a;
  --error: #ff8a8a;
  --mono: "Spline Sans Mono", ui-monospace, Menlo, monospace;
  --gap: 24px;
  --r-outer: 12px;
  --r-inner: 5px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tabs-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  --dock-h: 74px;
  background: var(--ground);
  color: var(--ink);
  font: 500 15px/21px var(--mono);
  min-height: 100dvh;
  padding-bottom: calc(var(--tabs-h) + var(--dock-h) + 52px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--action); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

html { scrollbar-color: #3a3a3a var(--ground); }

/* En-tête */
.top { display: flex; justify-content: center; padding: calc(16px + env(safe-area-inset-top)) 0 24px; }
.logo { display: block; border-radius: 6px; }

.column { width: min(100% - 74px, 400px); margin-inline: auto; }

/* Blocs du formulaire */
form.column { display: flex; flex-direction: column; gap: var(--gap); }
.block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.block--tight { gap: 13px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend.label { padding: 0; margin-bottom: 10px; float: left; width: 100%; }
legend.label + * { clear: both; }
.label { color: var(--ink-80); }
.note { margin: 0; color: var(--ink-60); font-size: 13px; line-height: 18px; }
.note--block { margin-top: calc(var(--gap) * -0.5); }

/* Sélecteur segmenté (composant « Selector » de la maquette) */
.seg {
  display: flex; gap: 10px; height: 52px; padding: 7px;
  background: var(--surface); border-radius: var(--r-outer);
}
.seg label { flex: 1 0 0; min-width: 0; display: flex; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 10px; border-radius: var(--r-inner); color: var(--ink); white-space: nowrap;
  transition: background-color 220ms var(--ease-out), color 220ms var(--ease-out);
}
.seg input:checked + span { background: var(--ink); color: var(--dark); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Styles d'écriture : chaque segment dans sa propre écriture, défilement horizontal */
.seg--scroll { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.seg--scroll::-webkit-scrollbar { display: none; }
.seg--scroll { scroll-padding-inline: 7px; }
.seg--scroll label { flex: 0 0 auto; scroll-snap-align: start; }
.seg--scroll span { padding: 0 14px; }
.f-indie { font: 400 19px/1 "Indie Flower", cursive; }
.f-cherry { font: 400 15px/1 "Cherry Bomb One", cursive; }
.f-amatic { font: 700 21px/1 "Amatic SC", cursive; }
.f-reenie { font: 400 22px/1 "Reenie Beanie", cursive; }
.f-montserrat { font: 500 15px/1 "Montserrat", sans-serif; }

/* Pastilles de couleur */
.dot { width: 20px; height: 20px; border-radius: 50%; display: block; }
.dot--white { background: #fff; box-shadow: inset 0 0 0 2px #a9a9a9; }
.dot--pink { background: #fec8ff; }
.dot--green { background: #80d584; }
.dot--yellow { background: #ffde6a; }
.dot--blue { background: #6ab8ff; }

/* Champs soulignés */
.field { border-bottom: 1px solid var(--rule); padding: 7px; transition: border-color 200ms var(--ease-out); }
.field:focus-within { border-bottom-color: var(--ink); }
.field textarea, .field input {
  display: block; width: 100%; background: none; border: 0; padding: 0; outline: none; caret-color: var(--ink);
}
.field textarea { min-height: 87px; height: 87px; max-height: 260px; resize: none; overflow-y: auto; }
.field input { height: 21px; }
.field ::placeholder { color: var(--ink-60); opacity: 1; font: 500 15px/21px var(--mono); }
.field--text textarea { font-size: 22px; line-height: 29px; }
.field--text textarea[data-font="indie"] { font-family: "Indie Flower", cursive; }
.field--text textarea[data-font="cherry"] { font-family: "Cherry Bomb One", cursive; font-size: 19px; }
.field--text textarea[data-font="amatic"] { font-family: "Amatic SC", cursive; font-weight: 700; font-size: 26px; }
.field--text textarea[data-font="reenie"] { font-family: "Reenie Beanie", cursive; font-size: 27px; }
.field--text textarea[data-font="montserrat"] { font-family: "Montserrat", sans-serif; font-size: 18px; }
.field--text textarea[data-font="book"] { font-family: "Amstelvar", Georgia, serif; font-weight: 300; font-size: 18px; line-height: 26px; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.meta .error { font-size: 13px; line-height: 18px; }
.count { margin: 0 0 0 auto; color: var(--ink-60); font-size: 13px; font-variant-numeric: tabular-nums; }
.count.is-full { color: var(--ink); }

.hint { margin: 0; display: flex; gap: 13px; align-items: baseline; color: var(--ink-80); }
.bullet { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #d9d9d9; transform: translateY(-2px); }

/* Blocs désactivés selon le papier */
.is-off { opacity: 0.35; pointer-events: none; }

/* Action principale */
.action {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 52px; padding: 7px; border: 0; border-radius: var(--r-outer);
  background: var(--action); color: var(--ink); cursor: pointer;
  transition: background-color 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.action:active { transform: scale(0.98); }
.action[disabled] { cursor: progress; }
.action.is-busy span::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.legal { margin: 0; color: var(--ink-60); }
.chip {
  display: inline-block; margin-top: 5px; padding: 0 3px; border-radius: 6px;
  background: var(--chip); color: var(--dark); text-decoration: underline; text-underline-offset: 2px;
}
.error { margin: 0; color: var(--error); }

/* Résultats */
.frames { display: flex; flex-direction: column; gap: 10px; }
.frame { border-radius: var(--r-outer); overflow: hidden; background: #000; aspect-ratio: 3 / 4; position: relative; }
.frame img { width: 100%; height: 100%; object-fit: cover; -webkit-touch-callout: default; }
.frame.is-in { animation: develop 700ms var(--ease-out) both; }
@keyframes develop {
  from { opacity: 0; filter: blur(14px) brightness(0.4); transform: translateY(14px) scale(0.985); }
  to { opacity: 1; filter: none; transform: none; }
}

/* Emplacements publicitaires */
.slot { display: flex; justify-content: center; min-height: 50px; }
.slot--lead { margin-bottom: var(--gap); }
.slot--trail { margin-top: calc(var(--gap) * 1.5); }
.prose .slot { margin-bottom: var(--gap); }
.rail { display: none; }
@media (min-width: 1100px) {
  .rail { display: block; position: fixed; top: 120px; width: 160px; z-index: 1; }
  .rail--left { left: calc(50% - 200px - 160px - 56px); }
  .rail--right { right: calc(50% - 200px - 160px - 56px); }
}

/* Vues texte (nouveautés, infos) */
.prose h1 { font-size: 15px; font-weight: 500; color: var(--ink-80); margin: 0 0 var(--gap); }
.prose article { margin-bottom: var(--gap); }
.prose h2 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.prose p, .prose li { color: var(--ink-80); }
.prose p { margin: 0 0 10px; }
.prose ul + p, .prose ol + p { margin-top: 14px; }
.prose ul, .prose ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose li::marker { color: var(--ink-60); }
.muted { color: var(--ink-60); font-weight: 500; }
.view:target, .view { scroll-margin-top: 20px; }

/* Barre d'onglets flottante */
.tabs {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 480px); height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  display: flex; gap: 10px; padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  background: rgba(34, 34, 34, 0.7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: var(--r-outer) var(--r-outer) 0 0; z-index: 10;
}
.tabs a { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: var(--r-inner); transition: background-color 220ms var(--ease-out); }
.tabs a[aria-current="page"] { background: var(--ink); }

@media (hover: hover) {
  .seg label:hover input:not(:checked) + span { background: rgba(255, 255, 255, 0.08); }
  .action:hover:not([disabled]) { background: var(--action-hover); }
  .quiet:hover { background: #2c2c2c; color: var(--ink); }
  .chip:hover { background: var(--ink); }
  .tabs a:hover:not([aria-current]) { background: rgba(255, 255, 255, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  html { scroll-behavior: auto; }
}

@media (min-width: 700px) {
  .top { padding-top: 56px; }
}

/* Bouton Créer toujours visible, posé au-dessus de la barre d'onglets */
.dock {
  position: fixed; z-index: 9; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px);
  width: min(100% - 74px, 400px);
}
.dock::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: -37px; right: -37px; top: -28px; bottom: -8px;
  background: linear-gradient(to top, var(--ground) 62%, rgba(10, 10, 10, 0));
}

.fine {
  margin: 6px 0 0; text-align: center; color: var(--ink-60);
  font-size: 12px; line-height: 16px;
}
.fine a { color: var(--ink-80); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(255, 255, 255, 0.4); }
.fine a:hover { color: var(--ink); }

/* Feuille de résultat */
html.is-locked, html.is-locked body { overflow: hidden; }
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; padding: 0; border: 0;
  width: min(100%, 480px); max-width: none; height: min(92dvh, 900px); max-height: none;
  display: flex; flex-direction: column;
  background: #141414; color: var(--ink);
  border-radius: var(--r-outer) var(--r-outer) 0 0;
  transform: translateY(100%);
  transition: transform 420ms var(--ease-out);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
}
.sheet:not([open]) { display: none; }
.sheet.is-open { transform: translateY(0); }
.sheet.is-dragging { transition: none; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet__bar { flex: none; padding: 8px 16px 12px; touch-action: none; cursor: grab; }
.sheet__grip { display: block; width: 36px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: #3a3a3a; }
.sheet__head { display: flex; gap: 10px; }
.sheet__head .action { flex: 1; }
.action[disabled] { opacity: 0.55; }
.quiet {
  flex: none; height: 52px; padding: 0 16px; border: 0; border-radius: var(--r-outer);
  background: var(--surface); color: var(--ink-80); cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.sheet__body:focus { outline: none; }
.sheet__body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet__body > * { flex-shrink: 0; }
.frame { margin: 0; }
.frame.is-loading { animation: wait 1.4s ease-in-out infinite; }
@keyframes wait { 0%, 100% { background: #000; } 50% { background: #1b1b1b; } }

/* Simulation de pubs (?pubs=demo) : imite l'aspect d'un contenu Adsterra, étranger au site */
.demo-pub { position: relative; font: 13px/1.3 Arial, Helvetica, sans-serif; color: #111; background: #fff; border-radius: 2px; }
.demo-pub__tag { position: absolute; top: 0; right: 0; padding: 1px 5px; font-size: 10px; background: #e6e6e6; color: #555; }
.demo-pub--banner { display: flex; flex-direction: column; justify-content: center; padding: 0 12px; background: #fff7d6; max-width: 100%; }
.demo-pub--banner small { color: #777; font-size: 11px; }
.demo-pub--native { width: 100%; padding: 22px 8px 8px; }
.demo-pub__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-pub__grid a { color: #111; text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.demo-pub__grid i { display: block; aspect-ratio: 16 / 10; background: hsl(var(--h) 45% 62%); }
.demo-pub__grid span { font-weight: 700; }
.demo-pub--social {
  position: fixed; z-index: 50; right: 12px; top: 12px; width: 220px; padding: 18px 12px 10px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); border-radius: 10px;
}
.demo-pub--social small { color: #666; font-size: 11px; }
.demo-toast {
  position: fixed; z-index: 100; left: 50%; top: 16px; transform: translateX(-50%);
  width: min(100% - 32px, 420px); padding: 12px 14px; border-radius: 12px;
  background: #fff; color: #111; font-size: 13px; line-height: 18px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
