/* Concept : une galerie privée. Mur blanc cassé, chaque pièce posée sur un socle tonal,
   typographie didone pour les noms, l'information toujours en retrait de l'objet. */
:root {
  --bg: #F5F3EF;          /* blanc cassé, le mur */
  --paper: #FBFAF7;       /* panneaux, fenêtres */
  --plinth: #ECE9E3;      /* socle des images */
  --ink: #121212;
  --ink-soft: #46433F;
  --mute: #8C8881;
  --hair: rgba(18, 18, 18, .10);
  --hair-strong: rgba(18, 18, 18, .22);
  --champagne: #9A8156;   /* seul accent, utilisé avec parcimonie */
  --danger: #9B3B2E;

  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', 'Times New Roman', serif;
  --sans: 'Manrope', 'SF Pro Text', -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  --t-micro: 10.5px;
  --t-small: 13px;
  --t-body: 15px;
  --t-lead: 18px;
  --t-h3: 24px;
  --t-h2: clamp(28px, 3vw, 40px);
  --t-h1: clamp(40px, 5.2vw, 76px);
  --t-hero: clamp(52px, 9vw, 140px);

  --gutter: clamp(16px, 4vw, 64px);
  --ease: cubic-bezier(.22, .61, .12, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --header-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overscroll-behavior-x: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 40; background: var(--bg);
}
body.is-locked { overflow: hidden; }
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 1.5px solid var(--champagne); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* ---------- Typo utilitaires ---------- */
.eyebrow {
  margin: 0;
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--mute);
}
.eyebrow.gold { color: var(--champagne); }
.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--t-h1);
  line-height: 1;
  letter-spacing: -.02em;
  text-wrap: balance;
  font-optical-sizing: auto;
}
.display em { font-style: italic; font-weight: 400; }
.lead { margin: 0; font-size: var(--t-lead); line-height: 1.55; color: var(--ink-soft); font-weight: 300; max-width: 52ch; }
.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--t-h2);
  letter-spacing: -.015em;
  line-height: 1.05;
}
.hide-sm { display: inline; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 30px;
  border-radius: 999px;
  font-size: var(--t-small); font-weight: 500; letter-spacing: .02em;
  border: 1px solid var(--ink);
  transition: background-color .35s var(--ease), color .35s var(--ease), transform .35s var(--ease), border-color .35s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--hair-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .arrow { display: inline-block; transition: transform .45s var(--ease); }
.btn:hover .arrow { transform: translate(3px, -3px); }

.link {
  font-size: var(--t-small); font-weight: 500; color: var(--ink-soft);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .45s var(--ease), color .3s;
  padding-bottom: 2px;
}
.link:hover { background-size: 100% 1px; color: var(--ink); }
.link.danger { color: var(--danger); }
.link[disabled] { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--hair-strong);
  font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
  transition: border-color .3s, background-color .3s, color .3s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- En-tête (verre dépoli) ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  backdrop-filter: saturate(1.6) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--hair); }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; height: var(--header-h); }
.header-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 40px); }
.header-nav a { font-size: 13px; font-weight: 500; letter-spacing: .01em; color: var(--ink-soft); position: relative; padding-block: 6px; transition: color .3s; }
.header-nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease); }
.header-nav a:hover, .header-nav a.is-current { color: var(--ink); }
.header-nav a.is-current::after { transform: scaleX(1); }
.wordmark {
  font-family: var(--display); font-weight: 500; font-size: 21px;
  letter-spacing: .42em; text-transform: uppercase;
}
.wordmark.small { font-size: 13px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .04em; color: var(--ink);
  height: 40px;
}
.plus-circle {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-size: 19px; font-weight: 300; line-height: 1;
  transition: transform .5s var(--ease-out);
}
.nav-btn:hover .plus-circle { transform: rotate(90deg); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: .001; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: .001; } to { opacity: 1; } }
.reveal { animation: rise 1s var(--ease-out) both; }
.reveal.d1 { animation-delay: .08s; }
.reveal.d2 { animation-delay: .16s; }
.reveal.d3 { animation-delay: .24s; }

/* ---------- Socles d'images ---------- */
.media {
  position: relative; overflow: hidden; background: var(--plinth);
  aspect-ratio: 4 / 5; max-width: 100%; isolation: isolate;
}
.media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; object-fit: cover;
  transition: opacity .8s var(--ease), transform 1.4s var(--ease-out);
}
.media img.is-product { object-fit: contain; padding: 11%; }
.media img.is-photo { object-fit: cover; }
.media img.is-loaded { opacity: 1; }
.media.has-alt img.alt { opacity: 0; }
.media.is-empty, .media.is-broken { display: grid; place-items: center; }
.media-initial {
  font-family: var(--display); font-style: italic; font-size: clamp(40px, 6vw, 88px);
  color: color-mix(in srgb, var(--ink) 18%, var(--plinth));
}
.media.is-broken::after {
  content: 'Image indisponible'; font-size: var(--t-micro); letter-spacing: .2em; text-transform: uppercase; color: var(--mute);
}

/* ---------- Pages simples (bouton + Vitrine) ---------- */
.page-head { padding-block: clamp(48px, 7vw, 104px) clamp(36px, 5vw, 64px); display: flex; flex-direction: column; gap: 22px; }
.page-head .display { font-size: clamp(48px, 7.6vw, 120px); line-height: .95; letter-spacing: -.03em; }
.page-sub { margin: 0; font-size: var(--t-lead); font-weight: 300; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.head-actions { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; margin-top: 10px; }
.crumbs { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--mute); letter-spacing: .02em; }
.crumbs a { transition: color .3s; }
.crumbs a:hover { color: var(--ink); }

/* ---------- Textes longs et badge ---------- */
.badge-owned {
  align-self: flex-start; font-size: var(--t-micro); letter-spacing: .24em; text-transform: uppercase; font-weight: 600;
  color: var(--champagne); border: 1px solid color-mix(in srgb, var(--champagne) 45%, transparent);
  padding: 6px 12px; border-radius: 999px;
}
.desc-body { font-size: var(--t-body); line-height: 1.8; color: var(--ink-soft); font-weight: 400; overflow-wrap: anywhere; }
.desc-body p { margin: 0 0 1em; }
.desc-body p:last-child { margin-bottom: 0; }
.desc-body.is-clamped { max-height: 13.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }

/* ---------- Vide / erreurs ---------- */
.empty { padding-block: clamp(80px, 14vw, 200px); display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
.empty .display { font-size: var(--t-hero); line-height: .92; letter-spacing: -.035em; }
.empty-hint { font-size: var(--t-small); color: var(--mute); margin: 0; }
kbd { font-family: var(--sans); font-size: 11.5px; border: 1px solid var(--hair-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink-soft); }

/* ---------- Fenêtres ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 18, 18, .3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .45s var(--ease); }
.modal-panel {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--paper); border-radius: 22px;
  box-shadow: 0 40px 120px -40px rgba(18, 18, 18, .45);
  opacity: 0; transform: translateY(24px) scale(.985);
  transition: opacity .45s var(--ease), transform .7s var(--ease-out), max-width .6s var(--ease-out);
  overscroll-behavior: contain;
}
.modal[data-size="xs"] .modal-panel { max-width: 440px; }
.modal[data-size="lg"] .modal-panel { max-width: 1120px; }
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { opacity: 1; transform: none; }
.modal-x {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--plinth); color: var(--ink-soft); transition: background-color .3s, color .3s;
}
.modal-x:hover { background: var(--ink); color: var(--bg); }
.modal-x svg { width: 12px; height: 12px; }
.modal-content { padding: clamp(32px, 5vw, 56px); }
.modal-title { margin: 14px 0 0; font-family: var(--display); font-weight: 400; font-size: clamp(32px, 4vw, 48px); line-height: 1.04; letter-spacing: -.02em; text-wrap: balance; }
.modal-title em { font-style: italic; }
.modal-title.sm { font-size: 28px; margin: 0; }

.link-form { display: flex; gap: 12px; margin-top: 36px; align-items: center; }
.link-form input {
  flex: 1; min-width: 0; height: 56px; border-radius: 999px; border: 1px solid var(--hair-strong);
  background: var(--bg); padding: 0 24px; font-size: var(--t-body); outline: none; transition: border-color .3s, background-color .3s;
}
.link-form input:focus { border-color: var(--ink); background: var(--paper); }
.link-form .btn { height: 56px; }
.add-hint { margin: 22px 0 0; font-size: var(--t-small); color: var(--mute); line-height: 1.7; }
.add-hint .link { color: var(--ink); }

.loading { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 48px 0 28px; }
.loading-host { margin: 0; font-family: var(--display); font-style: italic; font-size: 30px; }
.loader { width: 160px; height: 1px; background: var(--hair); overflow: hidden; position: relative; margin-bottom: 18px; }
.loader::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--ink); animation: slide 1.3s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.dialog { display: flex; flex-direction: column; gap: 16px; }
.dialog p { margin: 0; color: var(--ink-soft); font-size: var(--t-body); }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 24px; margin-top: 16px; }
.dialog .field input { font-size: var(--t-lead); }

/* ---------- Éditeur de fiche ---------- */
.editor-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 36px; padding-right: 40px; }
.notice { margin: 0; font-size: var(--t-small); color: var(--ink-soft); background: var(--bg); border-radius: 12px; padding: 12px 16px; line-height: 1.6; }
.notice strong { font-weight: 600; color: var(--ink); }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); }
.editor-images, .editor-fields { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.label { font-size: var(--t-micro); font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--mute); }
.hint-sm { font-size: 12px; color: var(--mute); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.img-tile { position: relative; border-radius: 10px; overflow: hidden; cursor: grab; transition: transform .3s var(--ease), opacity .3s; }
.img-tile .media { aspect-ratio: 4 / 5; }
.img-tile .media img.is-product { padding: 8%; }
.img-tile.is-dragging { opacity: .35; }
.img-tile.is-over { transform: scale(.96); }
.img-tile.is-extra { cursor: pointer; opacity: .62; }
.img-tile.is-extra:hover { opacity: 1; }
.img-btn {
  position: absolute; top: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--paper) 86%, transparent); color: var(--ink);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 14px; line-height: 1; opacity: 0; transition: opacity .25s, background-color .25s, color .25s;
}
.img-btn:hover { background: var(--ink); color: var(--bg); }
.img-btn.del { right: 6px; }
.img-btn.up { left: 6px; }
.img-btn.add { right: 6px; opacity: 1; }
.img-tile:hover .img-btn, .img-btn:focus-visible { opacity: 1; }
@media (hover: none) { .img-btn { opacity: 1; } }
.cover-tag {
  position: absolute; left: 6px; bottom: 6px; font-size: 9.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  background: var(--ink); color: var(--bg); padding: 3px 8px; border-radius: 999px;
}
.img-empty {
  grid-column: 1 / -1; border: 1px dashed var(--hair-strong); border-radius: 12px; padding: 36px 20px; text-align: center;
  color: var(--mute); font-size: var(--t-small);
}
.drop-zone.is-dropping .img-grid { outline: 1.5px dashed var(--champagne); outline-offset: 6px; border-radius: 12px; }
.img-add { display: flex; flex-direction: column; gap: 12px; }
.img-url { display: flex; gap: 10px; }
.img-url input {
  flex: 1; min-width: 0; height: 38px; border-radius: 999px; border: 1px solid var(--hair-strong); background: transparent;
  padding: 0 16px; font-size: 12.5px; outline: none;
}
.img-url input:focus { border-color: var(--ink); }
.img-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; color: var(--ink-soft); transition: background-color .3s, color .3s; }
.seg button.is-on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(18, 18, 18, .12); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input, .field select, .field textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--hair-strong); background: transparent; border-radius: 0;
  padding: 10px 0; font-size: var(--t-body); outline: none; transition: border-color .3s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23121212' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center; padding-right: 22px; }
.field textarea { resize: vertical; min-height: 44px; line-height: 1.6; }
.field.title-field input { font-family: var(--display); font-size: 26px; letter-spacing: -.01em; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 20px; }
.field-hint { font-size: 12px; color: var(--champagne); }
.editor-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; justify-content: flex-end; align-items: center; gap: 26px;
  margin: 40px calc(clamp(32px, 5vw, 56px) * -1) calc(clamp(32px, 5vw, 56px) * -1);
  padding: 18px clamp(32px, 5vw, 56px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--hair);
}

/* ---------- Notifications ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); translate: -50% 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--ink); color: var(--bg); padding: 13px 22px; border-radius: 999px; font-size: var(--t-small);
  box-shadow: 0 20px 50px -20px rgba(18, 18, 18, .5); animation: rise .6s var(--ease-out) both; text-align: center;
}
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; }

/* ---------- Pied de page ---------- */
.site-footer { margin-top: clamp(96px, 12vw, 180px); border-top: 1px solid var(--hair); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-block: 28px calc(env(safe-area-inset-bottom, 0px) + 28px); font-size: 12px; color: var(--mute); }

/* ---------- Adaptation ---------- */
@media (max-width: 980px) {
  .editor-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .hide-sm { display: none; }
  .wordmark { font-size: 17px; }
  .modal { padding: 0; place-items: end center; }
  .modal-panel { max-height: calc(100vh - env(safe-area-inset-top, 0px) - 24px); border-radius: 22px 22px 0 0; }
  .modal-content { padding: 32px max(18px, env(safe-area-inset-left, 0px)) calc(env(safe-area-inset-bottom, 0px) + 28px); }
  .editor-foot { margin: 32px -18px calc((env(safe-area-inset-bottom, 0px) + 28px) * -1); padding: 14px 18px calc(env(safe-area-inset-bottom, 0px) + 14px); }
  .link-form { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Bouton + Vitrine ---------- */
.install { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.install-drag {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: var(--paper); padding: clamp(48px, 7vw, 96px) 24px; text-align: center;
}
.bookmarklet {
  display: inline-flex; align-items: center; height: 60px; padding: 0 34px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 16px; font-weight: 500; letter-spacing: .02em;
  cursor: grab; box-shadow: 0 18px 40px -18px rgba(18, 18, 18, .55);
  transition: transform .5s var(--ease-out);
}
.bookmarklet:hover { transform: translateY(-3px); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; padding: 26px 0; border-top: 1px solid var(--hair); }
.steps li:last-child { border-bottom: 1px solid var(--hair); }
.step-n { font-family: var(--display); font-style: italic; font-size: 30px; line-height: 1; color: var(--champagne); }
.steps h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: var(--t-h3); line-height: 1.15; }
.steps p { margin: 0; color: var(--ink-soft); }
.notice a.link { color: var(--ink); background-size: 100% 1px; }
@media (max-width: 980px) { .install { grid-template-columns: minmax(0, 1fr); } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Site protégé : on passe par le navigateur */
.blocked-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.blocked .add-hint strong { color: var(--ink); font-weight: 600; }
