/* Inspiration mode — board library (inspiration.html) and the masonry board
   view (board.html). The board library reuses the gallery card skin
   (article[data-id], .card-preview, .card-menu-btn from gallery.css); this file
   adds the cover-image treatment and the masonry image wall. Palette/fonts come
   from base.css variables. */

/* App background (cream + blueprint grid), same as the gallery. The board page
   only loads this stylesheet, so it would otherwise fall back to a blank white
   body; mirror the shared look here. */
body {
  background-color: var(--cream);
  background-image:
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px, 110px 110px, 110px 110px;
}

/* ─── Board cards: cover image inside the shared .card-preview ─── */
.card-preview img.board-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.board-cover-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(120, 80, 30, 0.35);
}

.board-count {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warm-gray);
}

/* ─── Masonry image wall (board.html #image-grid) ─── */
#image-grid {
  column-width: 240px;
  column-gap: 16px;
}

.image-tile {
  position: relative;
  break-inside: avoid;
  margin: 0 0 16px;
  background: var(--cream-surf);
  border: 1px solid var(--border-warm);
  box-shadow: 0 1px 2px rgba(28, 26, 23, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.image-tile:hover {
  border-color: rgba(43, 106, 100, 0.28);
  box-shadow: 0 8px 20px rgba(28, 26, 23, 0.1);
}
.image-tile img {
  width: 100%;
  display: block;
  cursor: zoom-in;   /* click to enlarge; drag still reorders */
}

.image-tile.dragging { opacity: 0.4; }
.image-tile.drop-before { box-shadow: -3px 0 0 0 var(--emerald), 0 8px 20px rgba(28, 26, 23, 0.1); }
.image-tile.drop-after  { box-shadow:  3px 0 0 0 var(--emerald), 0 8px 20px rgba(28, 26, 23, 0.1); }

.image-caption {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  color: var(--charcoal);
  padding: 7px 9px;
  min-height: 30px;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
}
.image-caption:empty::before {
  content: 'Ajouter une légende…';
  color: rgba(120, 80, 30, 0.4);
}
.image-caption-input {
  width: 100%;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--charcoal);
  background: var(--cream);
  border: 1px solid var(--emerald);
  border-radius: 0;
  padding: 6px 8px;
  outline: none;
}

.image-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  background: rgba(28, 26, 23, 0.55);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.image-tile:hover .image-delete { opacity: 1; }
.image-delete:hover { background: #b3261e; }

/* ─── File drag-and-drop highlight on the board canvas ─── */
#board-main.drop-active {
  outline: 2px dashed var(--emerald);
  outline-offset: -12px;
  background: rgba(43, 106, 100, 0.04) !important;
}

/* ─── "Add image" chooser popup (file vs URL) ─── */
.add-chooser {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(28, 26, 23, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.add-chooser-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--cream-surf);
  border: 1px solid var(--border-warm);
  box-shadow: 0 24px 60px rgba(28, 26, 23, 0.25);
  padding: 22px 22px 24px;
}
.add-chooser-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  font-size: 22px;
  line-height: 1;
  color: var(--warm-gray);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.add-chooser-close:hover { color: var(--charcoal); }
.add-chooser-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 16px;
}
.add-chooser-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.add-chooser-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 14px;
  text-align: left;
  color: var(--charcoal);
  background: var(--cream);
  border: 1px solid var(--border-warm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.add-chooser-opt:hover {
  border-color: rgba(43, 106, 100, 0.4);
  background: rgba(43, 106, 100, 0.06);
  transform: translateY(-1px);
}
.add-chooser-opt svg { color: var(--emerald); }
.add-chooser-opt-title {
  font-family: var(--mono);
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.add-chooser-opt-sub {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--warm-gray);
  line-height: 1.3;
}
@media (max-width: 420px) {
  .add-chooser-options { grid-template-columns: 1fr; }
}

/* ─── Lightbox (click an image to enlarge) ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 18, 15, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
  touch-action: none;
}
.lightbox-figure {
  margin: 0;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  background: var(--cream-surf);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  /* imageZoom.js: click / wheel to zoom, drag to pan once zoomed. */
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.lightbox-img.is-zoomed { cursor: grab; }
.lightbox-img.is-panning { cursor: grabbing; }
/* The zoomed image spills over the caption; hide it rather than overlap. */
.lightbox.is-zoomed .lightbox-caption { visibility: hidden; }
.lightbox-caption {
  font-family: var(--mono);
  font-size: var(--fs-md);
  letter-spacing: 0.02em;
  color: var(--cream);
  text-align: center;
  max-width: 80vw;
}
.lightbox-close {
  position: absolute;
  z-index: 1; /* above the zoomed image */
  top: 14px;
  right: 18px;
  width: 40px;
  height: 40px;
  font-size: 28px;
  line-height: 1;
  color: var(--cream);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}
.lightbox-close:hover { opacity: 1; }
/* Cream on a zoomed (light) image would vanish: back it like the nav arrows. */
.lightbox.is-zoomed .lightbox-close { background: rgba(0, 0, 0, 0.45); }
.lightbox-nav {
  position: absolute;
  z-index: 1; /* above the zoomed image */
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  font-size: 38px;
  line-height: 1;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.25);
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.lightbox-nav:hover { opacity: 1; background: rgba(0, 0, 0, 0.45); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

/* ─── Empty / loading states ─── */
.board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 80px;
  color: var(--warm-gray);
  text-align: center;
}
.board-empty p {
  font-family: var(--mono);
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
}
.board-empty-btn {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--charcoal);
  border: none;
  border-radius: 0;
  padding: 9px 20px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.board-empty-btn:hover { background: var(--emerald); transform: translateY(-1px); }
