/* =====================================================================
   XB Photography — page portfolio (?type=animal|landscape|car)
   ===================================================================== */

.page-portfolio .wrap { width: min(1440px, 100% - 48px); }

/* Héros : bannière de la catégorie (sujet calé à droite) */
.p-hero { position: relative; min-height: 62vh; display: flex; align-items: flex-end; overflow: hidden; padding: 140px 0 56px; }
.p-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  transform-origin: right center;
  animation: kenburns 16s ease-out forwards;
}
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
.p-hero::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(0deg, var(--bg) 2%, rgba(11, 10, 8, 0.55) 45%, rgba(11, 10, 8, 0.25) 100%); }
.p-hero .wrap { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: end; gap: 40px; flex-wrap: wrap; }
.p-hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(64px, 9vw, 128px); line-height: 0.9; margin: 14px 0 18px; min-height: 0.9em; }
.p-hero p { color: #d3ccbf; max-width: 560px; line-height: 1.7; margin: 0; font-size: 17px; }
.p-stats { display: flex; gap: 36px; }
.p-stats div { border-left: 1px solid var(--line); padding-left: 16px; }
.p-stats b { display: block; font-family: var(--serif); font-size: 46px; font-weight: 500; line-height: 1; }
.p-stats span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* Barre collante : onglets des portfolios + filtres */
.filters { position: sticky; top: var(--header-h); z-index: 40; background: rgba(11, 10, 8, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-block: 1px solid var(--line); }
.filters .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.tabs { display: flex; gap: 4px; padding-right: 24px; border-right: 1px solid var(--line); }
.tabs a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.tabs a:hover { color: var(--gold); }
.tabs a[aria-current] { color: var(--gold); border-color: var(--gold); background: rgba(217, 164, 65, 0.12); }
.chips { position: relative; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.3s, border-color 0.3s;
}
.chip:hover { border-color: rgba(217, 164, 65, 0.6); }
.chip small { font-family: var(--mono); font-size: 10px; color: var(--muted); transition: color 0.3s; }
.chip[aria-pressed="true"] { color: var(--gold-ink); border-color: transparent; }
.chip[aria-pressed="true"] small { color: rgba(29, 20, 5, 0.7); }
.chip-pill { position: absolute; z-index: 0; top: 4px; height: calc(100% - 8px); border-radius: 999px; background: var(--gold); transition: left 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), width 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.result { margin-left: auto; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

/* Mosaïque à tailles variées */
.gallery { padding: 28px 0 100px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 250px; grid-auto-flow: dense; gap: 12px; }
.tile {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-2);
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  transition: opacity 0.7s, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tile.in { opacity: 1; transform: none; }
.tile.out { opacity: 0; transform: scale(0.96); transition-duration: 0.25s; }
.tile-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tile.big { grid-column: span 2; grid-row: span 2; }
.tile.wide { grid-column: span 2; }
.tile.tall { grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity 0.6s, transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); }
.tile img.loaded { opacity: 1; transform: none; }
.tile:hover img.loaded { transform: scale(1.06); }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 45%); opacity: 0; transition: opacity 0.4s; }
.tile:hover::after,
.tile:focus-within::after { opacity: 1; }
.tile .cap { position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 16px; text-align: left; opacity: 0; transform: translateY(10px); transition: opacity 0.4s, transform 0.4s; }
.tile:hover .cap,
.tile:focus-within .cap { opacity: 1; transform: none; }
.tile-open:focus-visible { outline-offset: -3px; }
/* Cœur en haut à droite : discret, visible au survol ou s'il est déjà liké */
.tile-actions { position: absolute; z-index: 2; top: 12px; right: 12px; display: flex; gap: 6px; }
.tile-actions .share-btn,
.tile-actions .like-btn { opacity: 0; transform: translateY(-4px); transition: opacity 0.3s, transform 0.3s, border-color 0.25s, color 0.25s; }
.tile-actions .share-btn { padding: 7px 9px; }
.tile:hover .tile-actions button,
.tile:focus-within .tile-actions button,
.tile-like[aria-pressed="true"] { opacity: 1; transform: none; }

.cap b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1.1; }
.tile.big .cap b { font-size: 34px; }
.cap span { font-family: var(--mono); font-size: 11px; color: var(--gold); letter-spacing: 0.04em; }
.shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(242, 237, 227, 0.05) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.tile img.loaded + .shimmer { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { color: var(--muted); text-align: center; padding: 80px 0; grid-column: 1 / -1; }
.empty a { color: var(--gold); }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 220px; }
}
@media (max-width: 900px) {
  .p-hero img { object-position: 78% center; }
  .filters .wrap { flex-direction: column; align-items: stretch; height: auto; gap: 8px; padding: 10px 0; }
  .tabs { border-right: 0; padding-right: 0; overflow-x: auto; }
  .result { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 170px; gap: 8px; }
  .tile .cap { opacity: 1; transform: none; }
  .tile-actions { top: 8px; right: 8px; }
  .tile-actions .share-btn,
  .tile-actions .like-btn { opacity: 1; transform: none; padding: 6px 9px; }
  .tile::after { opacity: 0.7; }
  .cap b { font-size: 18px; }
  .tile.big .cap b { font-size: 24px; }
  .p-stats b { font-size: 34px; }
}
@media (max-width: 480px) {
  .grid { grid-auto-rows: 130px; }
  .cap span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { opacity: 1; transform: none; }
}

/* Histoire de la photo signalée dans la légende de la miniature */
.cap-story { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10px; font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); opacity: 0.8; }
.cap-story::before { content: "✎ "; color: var(--gold); }

/* Bascule Grille / Carte */
.view-toggle { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; flex: none; }
.view-toggle[hidden] { display: none; }
.view-toggle button { padding: 7px 14px; border: 0; border-radius: 999px; background: none; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); cursor: pointer; transition: color 0.25s, background 0.25s; }
.view-toggle button:hover { color: var(--gold); }
.view-toggle button[aria-pressed="true"] { background: rgba(217, 164, 65, 0.15); color: var(--gold); }

/* Carte des lieux */
.map-wrap { position: relative; }
.map { height: min(72vh, 680px); border-radius: 6px; border: 1px solid var(--line); background: #111; z-index: 0; }
.map-empty { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 500; margin: 0; padding: 8px 14px; border-radius: 999px; background: rgba(11, 10, 8, 0.85); color: var(--muted); font-size: 13px; }
.map-pin { display: grid; place-items: center; }
.map-pin span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--gold-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 0 0 6px rgba(217, 164, 65, 0.25), 0 6px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
}
.map-pin:hover span { transform: scale(1.12); }
.map-popup-wrap .leaflet-popup-content-wrapper,
.map-popup-wrap .leaflet-popup-tip { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.map-popup-wrap .leaflet-popup-content { margin: 14px; }
.map-popup-wrap a.leaflet-popup-close-button { color: var(--muted); }
.map-popup b { display: block; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.map-popup > span { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.map-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; max-height: 220px; overflow-y: auto; }
.map-thumbs button { padding: 0; border: 0; border-radius: 3px; overflow: hidden; cursor: zoom-in; background: #000; }
.map-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 0.3s; }
.map-thumbs button:hover img { transform: scale(1.08); }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { background: rgba(11, 10, 8, 0.7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--gold) !important; }
.leaflet-bar a { background: var(--bg-2) !important; color: var(--ink) !important; border-color: var(--line) !important; }

/* Tri des photos */
.sort-select { flex: none; }
.sort-select select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 30px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d9a441' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.sort-select select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sort-select option { background: var(--bg-2); color: var(--ink); text-transform: none; }
