/* ==========================================================================
   Affiche Couture · espace client
   Mêmes couleurs, polices et grain de papier que la page de vente.
   ========================================================================== */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('../assets/fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../assets/fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #F2ECE0;
  --paper-2: #E8DFCF;
  --sheet: #FBF8F1;
  --ink: #16161A;
  --ink-2: #55524A;
  --line: rgba(22, 22, 26, .18);
  --rouge: #E2412B;
  --bleu: #2A4FC9;
  --rose: #FF4F9B;
  --jaune: #FFC83D;
  --navy: #1C2A4F;
  --olive: #6F7A30;
  --orange: #C9561E;
  --f-sans: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --f-serif: 'Instrument Serif', 'Times New Roman', serif;
  --f-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --gut: 1.25rem;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --bar-h: 3.75rem;
}
@media (min-width: 760px) { :root { --gut: 2.5rem; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  background: url('../assets/img/grain.png') 0 0 / 160px 160px;
  opacity: .5;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol, ul, figure, fieldset { margin: 0; padding: 0; border: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--jaune); color: var(--ink); }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: -.015em; font-stretch: 100%; }

.wrap { width: min(100% - var(--gut) * 2, 1240px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; z-index: 2000; background: var(--ink); color: var(--paper); padding: .75rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- Barre du haut ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--bar-h);
  padding: 0 var(--gut);
  background: rgba(242, 236, 224, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--ink);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; text-decoration: none; font-weight: 800; font-stretch: 85%; font-size: 1.125rem; letter-spacing: -.02em; white-space: nowrap; }
.brand__mark { width: 1.3rem; height: 1.3rem; color: var(--rouge); }
.brand em { font-size: 1.12em; }
.bar__tag { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: .35rem .7rem; border: 1.5px solid var(--ink); border-radius: 999px; white-space: nowrap; }

.bar__out { min-height: 2.75rem; padding: 0 .25rem; font-weight: 600; font-size: .875rem; text-decoration: underline; text-underline-offset: .28em; text-decoration-thickness: 1.5px; white-space: nowrap; }
.bar__out:disabled { opacity: .5; }
@media (max-width: 520px) { .is-logged .bar__tag { display: none; } }

/* ---------- Connexion ---------- */
.auth { display: grid; align-items: start; min-height: calc(100vh - var(--bar-h)); min-height: calc(100svh - var(--bar-h)); padding: 3rem var(--gut) 4rem; }
.auth__card { width: min(100%, 30rem); margin-inline: auto; }
.auth .title { font-size: clamp(2.6rem, 11vw, 4.5rem); }
.auth__lead { margin: 1.25rem 0 1.5rem; color: var(--ink-2); }
.auth__form .f { margin-bottom: 1rem; }
.auth .auth__form .f .f__label { color: var(--ink); }
.auth .btn { width: 100%; }
.auth__msg { min-height: 1.5em; margin-top: .9rem; font-size: .9375rem; font-weight: 600; color: var(--rouge); }
.auth__sent { margin-top: 1.5rem; padding: 1.25rem 1.25rem 1rem; border: 1.5px solid var(--ink); border-radius: 16px; background: var(--sheet); }
.auth__sent-title { font-family: var(--f-serif); font-style: italic; font-size: 2rem; line-height: 1.05; margin-bottom: .6rem; }
.auth__sent strong { overflow-wrap: anywhere; }
.auth__small { margin-top: .75rem; font-size: .875rem; color: var(--ink-2); }
.auth .textbtn { margin-top: .5rem; }
.btn.is-busy { opacity: .6; pointer-events: none; }
.btn:disabled { cursor: default; }
@media (min-width: 760px) { .auth { align-items: center; padding-block: 4rem 8rem; } }

.state { padding: 5rem var(--gut); text-align: center; font-family: var(--f-mono); font-size: .875rem; color: var(--ink-2); }
.state.is-error { color: var(--rouge); }

/* ---------- Boutons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3.5rem;
  padding: .75rem 1.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.0625rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--rouge); border-radius: inherit; transform: translateY(101%); transition: transform .45s var(--ease); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--ghost { border: 1.5px solid var(--ink); }
.btn--ghost::before { background: var(--jaune); }
.btn:active { transform: scale(.97); }
.btn.is-done { background: var(--olive); }
@media (hover: hover) { .btn:hover::before { transform: translateY(0); } .btn.is-done:hover::before { transform: translateY(101%); } }
.textbtn { min-height: 2.75rem; padding: 0 .25rem; font-weight: 600; font-size: .9375rem; text-decoration: underline; text-underline-offset: .28em; text-decoration-thickness: 1.5px; }

/* ---------- Liste ---------- */
.list { padding: 2rem 0 5rem; }
.kicker { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .75rem; }
.title { font-size: clamp(2.4rem, 10vw, 5rem); font-weight: 800; font-stretch: 75%; line-height: .95; letter-spacing: -.035em; }
.title em { font-size: 1.06em; color: var(--rouge); }
.title:focus { outline: none; }

.packs { display: flex; gap: .5rem; margin-top: 1.75rem; }
.pack { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .15rem; min-height: 3.75rem; padding: .6rem 1rem; white-space: nowrap; border: 1.5px solid var(--ink); border-radius: 14px; text-align: left; font-weight: 800; font-stretch: 80%; font-size: 1.25rem; letter-spacing: -.02em; line-height: 1.1; transition: background .25s, color .25s; -webkit-tap-highlight-color: transparent; }
.pack small { font-family: var(--f-mono); font-size: .72rem; font-weight: 400; letter-spacing: 0; opacity: .7; }
.pack.is-active { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .pack:not(.is-active):hover { background: var(--jaune); } }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.pick { position: relative; display: block; min-width: 0; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--sheet); }
.pick__label { position: absolute; left: .9rem; top: .45rem; font-family: var(--f-mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); pointer-events: none; }
.pick select { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-height: 3.5rem; padding: 1.35rem 2.2rem .4rem .9rem; border: 0; border-radius: 13px; background: transparent; font-weight: 600; font-size: 1rem; text-overflow: ellipsis; cursor: pointer; }
.pick::after { content: ''; position: absolute; right: 1rem; top: 50%; width: .5rem; height: .5rem; margin-top: -.35rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); pointer-events: none; }
.pick.is-set { background: var(--jaune); }
.stylepick { grid-column: 1 / -1; display: flex; gap: .45rem; overflow-x: auto; margin-inline: calc(var(--gut) * -1); padding: .15rem var(--gut); scrollbar-width: none; }
.stylepick::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 2.6rem; padding: .4rem 1rem; border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 600; font-size: .9375rem; white-space: nowrap; transition: background .2s, color .2s; -webkit-tap-highlight-color: transparent; }
.chip.is-active { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .chip:not(.is-active):hover { background: var(--jaune); } }

.list__meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2.75rem; margin: 1.25rem 0 .75rem; border-bottom: 1.5px solid var(--ink); }
.count { font-family: var(--f-mono); font-size: .78rem; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; padding-top: .75rem; }
.card { display: block; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.card__sheet { position: relative; aspect-ratio: 4 / 5; background: var(--paper-2); border-radius: 2px; box-shadow: 0 1px 1px rgba(22, 22, 26, .18), 0 12px 24px -12px rgba(22, 22, 26, .4); transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.card__sheet img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.card__sheet.is-missing::before { content: 'Aperçu à venir'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-mono); font-size: .72rem; color: var(--ink-2); }
.card__sheet.is-missing img { visibility: hidden; }
.card__style { position: absolute; left: .5rem; top: .5rem; padding: .2rem .55rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: .72rem; font-weight: 700; }
.card__qr { position: absolute; right: .5rem; top: .5rem; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 6px; background: var(--jaune); }
.card__qr svg { width: 1rem; height: 1rem; }
.card__title { margin-top: .7rem; font-weight: 800; font-stretch: 78%; font-size: 1.25rem; line-height: 1.05; letter-spacing: -.02em; overflow-wrap: anywhere; }
.card__meta { margin-top: .3rem; font-size: .8125rem; line-height: 1.35; color: var(--ink-2); }
@media (hover: hover) {
  .card:hover .card__sheet { transform: translateY(-6px) rotate(-1.5deg); box-shadow: 0 1px 1px rgba(22, 22, 26, .18), 0 26px 34px -16px rgba(22, 22, 26, .5); }
  .card:nth-child(even):hover .card__sheet { transform: translateY(-6px) rotate(1.5deg); }
}
.card:active .card__sheet { transform: scale(.98); }

.empty { padding: 3rem 0; text-align: center; color: var(--ink-2); }
.empty__title { font-family: var(--f-serif); font-style: italic; font-size: 2rem; line-height: 1.1; color: var(--ink); margin-bottom: .5rem; }
.empty .btn { margin-top: 1.5rem; }

@media (min-width: 760px) {
  .list { padding: 3.5rem 0 7rem; }
  .packs { max-width: 34rem; }
  .filters { grid-template-columns: minmax(0, 15rem) minmax(0, 15rem) 1fr; align-items: center; gap: .75rem; }
  .stylepick { grid-column: auto; margin-inline: 0; padding-inline: 0; justify-content: flex-end; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem 1.75rem; }
  .card__title { font-size: 1.5rem; }
  .card__meta { font-size: .875rem; }
}
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Un prompt ---------- */
.detail { padding: 1rem 0 2rem; }
.back { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; font-weight: 600; font-size: .9375rem; text-decoration: none; }
.back span { font-size: 1.4rem; line-height: 1; transform: translateY(-.08em); }
@media (hover: hover) { .back:hover { text-decoration: underline; text-underline-offset: .28em; } }
.detail__grid { display: grid; gap: 1.25rem; margin-top: .5rem; }
.detail__preview { display: grid; grid-template-columns: 7.25rem 1fr; gap: 1rem; align-items: end; }
.sheet { aspect-ratio: 4 / 5; background: var(--paper-2); border-radius: 2px; box-shadow: 0 1px 1px rgba(22, 22, 26, .2), 0 16px 28px -14px rgba(22, 22, 26, .5); transform: rotate(-2deg); }
.sheet img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.detail__preview figcaption { font-family: var(--f-mono); font-size: .7rem; line-height: 1.5; color: var(--ink-2); }
.detail__meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { padding: .2rem .65rem; border: 1.5px solid var(--ink); border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tag--style { background: var(--ink); color: var(--paper); }
.detail__title { margin-top: .8rem; font-size: clamp(2.2rem, 10vw, 4.25rem); font-weight: 800; font-stretch: 75%; line-height: .93; letter-spacing: -.035em; overflow-wrap: anywhere; }
.detail__title:focus { outline: none; }
.detail__lead { margin-top: .9rem; color: var(--ink-2); }

.qr { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; margin-top: 1.1rem; padding: .9rem 1rem; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--jaune); font-size: .9375rem; line-height: 1.4; }
.qr svg { width: 1.7rem; height: 1.7rem; margin-top: .1rem; }

.form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.f { display: grid; gap: .35rem; }
.f__top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.f__label { font-family: var(--f-mono); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.f:nth-child(5n+1) .f__label { color: var(--rouge); }
.f:nth-child(5n+2) .f__label { color: var(--bleu); }
.f:nth-child(5n+3) .f__label { color: #C0257A; }
.f:nth-child(5n+4) .f__label { color: var(--olive); }
.f:nth-child(5n+5) .f__label { color: var(--orange); }
.f__help { font-size: .8125rem; color: var(--ink-2); }
.f__lines { display: grid; gap: .4rem; }
.f input, .f textarea { display: block; width: 100%; min-height: 3.25rem; padding: .8rem .95rem; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--sheet); font-size: 1.0625rem; font-weight: 600; line-height: 1.35; transition: box-shadow .2s, background .2s; }
.f textarea { resize: vertical; min-height: 4.6rem; }
.f input:focus, .f textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--jaune), 0 0 0 4.5px var(--ink); background: #fff; }
.f input.is-empty, .f textarea.is-empty { border-style: dashed; }
.f__line { position: relative; }
.f__line span { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); pointer-events: none; }
.f__line input { padding-right: 4.6rem; text-transform: none; }

.full { margin-top: 1.4rem; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--ink); color: #EDE8DD; overflow: hidden; }
.full summary { display: flex; align-items: center; justify-content: space-between; min-height: 3rem; padding: 0 1rem; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.full summary::-webkit-details-marker { display: none; }
.full summary::after { content: ''; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .3s var(--ease); }
.full[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.full__text { margin: 0; padding: .25rem 1rem 1.1rem; max-height: 22rem; overflow: auto; font-family: var(--f-mono); font-size: .8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: rgba(237, 232, 221, .62); }
.full__text mark { background: none; color: #fff; font-weight: 700; box-shadow: inset 0 -.5em 0 rgba(255, 200, 61, .28); }
.full__text mark.is-empty { color: #FF86B9; font-weight: 400; box-shadow: none; }

/* Sur mobile, le bouton reste collé en bas de l'écran : on peut copier à tout moment */
.actions { position: sticky; bottom: 0; z-index: 400; display: flex; align-items: center; gap: .75rem; margin: 1.25rem calc(var(--gut) * -1) 0; padding: .7rem var(--gut) calc(.7rem + env(safe-area-inset-bottom, 0px)); background: rgba(242, 236, 224, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1.5px solid var(--ink); }
.actions .btn { flex: 1; }
.hint { margin-top: .9rem; font-size: .875rem; color: var(--ink-2); }

.next { display: grid; gap: .7rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1.5px solid var(--ink); font-size: .9375rem; }
.next li { display: grid; grid-template-columns: 2rem 1fr; gap: .4rem; align-items: baseline; }
.next span { font-family: var(--f-serif); font-style: italic; font-size: 1.7rem; line-height: 1; color: var(--rouge); }

@media (min-width: 900px) {
  .detail { padding: 2rem 0 6rem; }
  .detail__grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 4.5rem; align-items: start; margin-top: 1.5rem; }
  .detail__preview { position: sticky; top: calc(var(--bar-h) + 2rem); display: block; }
  .sheet { max-width: 30rem; margin-inline: auto; }
  .detail__preview figcaption { margin-top: 1.5rem; text-align: center; font-size: .75rem; }
  .form { gap: 1.25rem; }
  .f__lines { grid-template-columns: 1fr 1fr; }
  .actions { position: static; margin: 1.75rem 0 0; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .actions .btn { flex: none; min-width: 16rem; min-height: 4rem; font-size: 1.1875rem; }
}

/* ---------- Message court en bas d'écran ---------- */
.toast { position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); z-index: 950; max-width: calc(100% - 2rem); padding: .7rem 1.1rem; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: .9375rem; font-weight: 600; text-align: center; box-shadow: 0 16px 30px -12px rgba(22, 22, 26, .6); opacity: 0; transform: translate(-50%, 1rem); transition: opacity .3s, transform .4s var(--ease); pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 2rem; } }

/* Entrée des cartes : posées une à une sur la table */
@keyframes drop { from { opacity: 0; transform: translateY(18px) rotate(var(--tilt, -2deg)) scale(1.04); } to { opacity: 1; transform: none; } }
.card.is-in { animation: drop .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.detail.is-in .detail__main > *, .detail.is-in .detail__preview { animation: drop .5s var(--ease) both; --tilt: 0deg; }
.detail.is-in .detail__main > :nth-child(2) { animation-delay: 40ms; }
.detail.is-in .detail__main > :nth-child(n+3) { animation-delay: 90ms; }
.detail.is-in .actions { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}
