:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #151515;
  --muted: #706f69;
  --line: #ddd7c9;
  --surface: #fffdf8;
  --accent: #b91c1c;
  --accent-ink: #ffffff;
  --focus: #0f766e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--ink);
  color: white;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border-radius: 6px;
  padding: 0 16px;
  border: 1px solid var(--line);
  text-decoration: none;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

a {
  color: inherit;
}

.user-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.logout-link {
  min-height: auto;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(14px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, white);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: center;
}

.brand strong {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  letter-spacing: 0;
  text-transform: uppercase;

}

.brand span {
  color: var(--muted);
  font-size: 0.86rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 1.2vw, 14px);
  padding: clamp(4px, 1.2vw, 14px);
}

@media (min-width: 900px) and (orientation: landscape) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, calc(100vw / 9)));
    justify-content: center;
  }
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  width: 100%;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: #e8e1d3;
  color: white;
  cursor: zoom-in;
}

.tile.is-new {
  outline: 4px solid var(--accent);
  outline-offset: -4px;
}

.tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tile-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.68));
  font-size: clamp(0.78rem, 2.2vw, 1rem);
  overflow-wrap: anywhere;
}

.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.delete-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: 0;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.6);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.delete-button svg {
  display: block;
  width: 16px;
  height: 16px;
}

.delete-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent);
  outline-offset: 2px;
}

.gone-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  min-height: 0;
  border: 0;
  max-width: calc(100% - 16px);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgb(0 0 0 / 0.78);
  color: white;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  font-weight: 800;
  text-transform: uppercase;
}

.gone-badge.is-clickable {
  cursor: pointer;
}

.gone-badge.is-clickable:disabled {
  cursor: wait;
}

.wall-heart {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: #dc2626;
  font-size: 1.25rem;
  line-height: 1;
  text-shadow: 0 2px 8px rgb(0 0 0 / 0.35);
}

.heart-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgb(255 255 255 / 0.92);
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.18);
}

.heart-button:disabled {
  cursor: default;
  opacity: 1;
}

.heart-icon {
  color: #dc2626;
  font-size: 1rem;
}

.heart-count {
  min-width: 1ch;
  font-size: 0.82rem;
}

.lightbox-heart {
  position: static;
  justify-self: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 42px);
  background: rgb(0 0 0 / 0.9);
  touch-action: pan-y;
}

.lightbox-figure {
  display: grid;
  gap: 12px;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  justify-items: center;
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

.lightbox figcaption {
  max-width: min(720px, 100%);
  color: white;
  text-align: center;
  overflow-wrap: anywhere;
}

.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 21;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: 999px;
  background: rgb(0 0 0 / 0.45);
  color: white;
  font-size: 1.9rem;
  line-height: 1;
}

.empty,
.admin-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 18px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel h1,
.panel h2,
.panel p {
  margin: 0;
}

.panel p {
  color: var(--muted);
  line-height: 1.5;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
}

.check-field {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.check-field.compact {
  min-height: 32px;
}

input:focus-visible,
button:focus-visible,
.tile:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent);
  outline-offset: 2px;
}

.preview {
  display: none;
  width: min(100%, 360px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.status {
  min-height: 22px;
  color: var(--muted);
}

.status.error {
  color: var(--accent);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .gallery {
    gap: 3px;
    padding: 3px;
  }

  .tile.is-new {
    outline-width: 3px;
  }

  .tile-title {
    padding: 24px 7px 7px;
  }
}

/* Styles pour la modal de confirmation */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.6);
}

.confirm-modal-panel {
  position: relative;
  z-index: 41;
  width: min(520px, 92%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.4);
}

.confirm-modal-panel h2 {
  margin: 0 0 8px 0;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.confirm-actions .secondary {
  background: var(--accent);
  color: var(--accent-ink);
}