/* Ben O'Bro — portfolio */
:root {
  --bg: #0b0b0b;
  --bg-2: #151515;
  --line: #262626;
  --text: #cfcfcf;
  --muted: #8a8a8a;
  --white: #fff;
  --accent: #ff7700;
  --gap: 6px;
  --row-base: 260px;     /* surchargé par config.php (row_height) */
  --row: var(--row-base); /* hauteur cible des rangées de la grille */
  --max: 1600px;
  --font: "Elms Sans", system-ui, sans-serif;
  --display: "Bebas Neue", Impact, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 300 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: var(--gap); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color .25s; }
a:hover { color: var(--white); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: .02em; line-height: 1.1; color: var(--white); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgb(11 11 11 / .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 1rem; padding: .7rem 1rem;
}
.logo {
  font-family: var(--display); font-size: 2rem; line-height: 1; color: var(--white);
  letter-spacing: .04em; justify-self: start; white-space: nowrap;
}
.logo:hover { color: var(--accent); }
.main-nav { display: flex; gap: 1.6rem; }
.main-nav a, .page-nav > a, .sub-nav a {
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 500;
}
.main-nav a { color: var(--accent); font-size: .9rem; position: relative; padding: .2rem 0; }
.main-nav a:hover, .main-nav a.is-active { color: var(--white); }
.main-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform .3s;
}
.main-nav a.is-active::after, .main-nav a:hover::after { transform: scaleX(1); }
.page-nav { justify-self: end; display: flex; align-items: center; gap: 1.2rem; }
.page-nav > a { color: var(--muted); white-space: nowrap; }
.page-nav > a:hover, .page-nav > a.is-active { color: var(--white); }

.sub-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; padding: 0 1rem .7rem;
}
.sub-nav a {
  color: var(--muted); padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 99px;
  white-space: nowrap; font-size: .72rem;
}
.sub-nav a:hover { color: var(--white); border-color: var(--muted); }
.sub-nav a.is-active { color: var(--bg); background: var(--accent); border-color: var(--accent); }

.lang-switch {
  display: flex; align-items: center; gap: .15rem; padding-left: .9rem; border-left: 1px solid var(--line);
  font-size: .72rem; font-weight: 500; letter-spacing: .1em;
}
.lang-switch > * { padding: .2rem .4rem; border-radius: 4px; }
.lang-switch a { color: var(--muted); }
.lang-switch a:hover { color: var(--white); }
.lang-switch .is-active { color: var(--accent); }

.social { list-style: none; display: flex; gap: .4rem; margin: 0; padding: 0; }
.social a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); }
.social a:hover { color: var(--white); background: var(--bg-2); }

/* ---------- Grille justifiée (sans JS) ---------- */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.grid::after { content: ""; flex-grow: 1e6; }   /* dernière rangée non étirée */
.tile {
  position: relative; overflow: hidden; background: var(--bg-2);
  flex: calc(var(--r) * 1000) 1 calc(var(--r) * var(--row));
  aspect-ratio: var(--r);
  max-width: 100%;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), opacity .4s; }
.tile:hover img { transform: scale(1.04); }
.tile-title {
  position: absolute; inset: auto 0 0 0; padding: 1.6rem .8rem .55rem;
  background: linear-gradient(transparent, rgb(0 0 0 / .75));
  color: var(--white); font-size: .82rem; font-weight: 400;
  opacity: 0; transform: translateY(6px); transition: .3s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile:hover .tile-title, .tile:focus-visible .tile-title { opacity: 1; transform: none; }
.empty { color: var(--muted); text-align: center; padding: 4rem 0; }
.more { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin: 2.5rem 0 1rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.2rem; border: 1px solid var(--accent); border-radius: 99px;
  color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 500;
  transition: .25s;
}
.btn:hover { background: var(--accent); color: var(--bg); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--white); border-color: var(--white); }
.btn-big { font-size: .9rem; padding: .8rem 1.6rem; }

/* ---------- Pages texte ---------- */
.prose { max-width: 680px; }
.prose h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); margin: 0 0 1rem; }
.prose h1 small { display: block; font-size: .55em; color: var(--muted); }
.prose h1 em { font-style: normal; color: var(--accent); }
.prose .lead { font-size: 1.15rem; color: var(--white); }
.narrow { margin: 4rem auto; }

.about {
  display: grid; grid-template-columns: 260px minmax(0, 680px) 1fr; gap: 3rem;
  padding: 3rem 1rem; align-items: start;
}
.portrait { margin: 0; position: sticky; top: 7rem; }
.portrait img { border-radius: 50%; filter: grayscale(.2); }
.links h2 { font-size: 1.5rem; margin: 0 0 .6rem; }
.links ul { list-style: none; padding: 0; margin: 0 0 2rem; font-size: .9rem; }
.links li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.links a { color: var(--text); }
.links a:hover { color: var(--accent); }

/* ---------- Mods ---------- */
.intro { margin: 2.5rem auto 3rem; text-align: center; max-width: 760px; }
.intro b { color: var(--white); font-weight: 500; }
.mod { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.mod-head h2 { color: var(--accent); font-size: 2rem; margin: 0 0 .3rem; }
.mod-head p { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }
.mod .grid { --row: calc(var(--row-base) * .6); }

/* ---------- 404 ---------- */
.page-404 main { display: flex; flex-direction: column; }
.page-404 .site-footer { margin-top: 0; }
.notfound {
  flex: 1;
  position: relative; display: grid; place-items: center; text-align: center;
  min-height: 70dvh; margin: calc(var(--gap) * -1); overflow: hidden;
}
.notfound::before {
  content: ""; position: absolute; inset: 0; background: var(--bg-2) var(--bg, none) center / cover;
  filter: grayscale(1) brightness(.3); transform: scale(1.05);
}
.notfound > div { position: relative; padding: 2rem 1rem; }
.notfound .code { font-family: var(--display); font-size: clamp(7rem, 25vw, 14rem); line-height: .85; margin: 0; color: var(--accent); }
.notfound h1 { font-size: 2.6rem; margin: .5rem 0; }
.notfound p:last-child { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  max-width: var(--max); width: 100%; margin: 2rem auto 0; padding: 1.5rem 1rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem;
}
.site-footer p { margin: 0; }

/* ---------- Lightbox (PhotoSwipe) ---------- */
.pswp { --pswp-bg: #050505; }
.pswp__custom-caption {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: min(90vw, 720px); padding: .6rem 1.1rem; border-radius: 10px;
  background: rgb(0 0 0 / .6); backdrop-filter: blur(8px); color: var(--text);
  font-size: .9rem; text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1rem;
}
.pswp__custom-caption:empty { display: none; }
.pswp__custom-caption strong { color: var(--white); font-weight: 500; }
.pswp__custom-caption span { color: var(--muted); }
.pswp__button--download-button { display: grid; place-items: center; color: var(--pswp-icon-color, #fff); }
.pswp__button--download-button svg { width: 22px; height: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .about { grid-template-columns: 200px 1fr; }
  .links { grid-column: 2; }
}
@media (max-width: 860px) {
  :root { --row: calc(var(--row-base) * .68); }
  .bar { grid-template-columns: 1fr auto; row-gap: .5rem; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 1.2rem; }
  .page-nav { gap: .8rem; }
  .page-nav .social { display: none; }
  .about { grid-template-columns: 1fr; gap: 2rem; padding: 2rem .5rem; }
  .portrait { position: static; max-width: 180px; }
  .links { grid-column: auto; }
  .mod { grid-template-columns: 1fr; }
}
/* Téléphone : une photo par ligne, pleine largeur, ratio d'origine */
@media (max-width: 600px) {
  .tile { flex: 1 1 100%; }
  .grid::after { display: none; }
}
@media (max-width: 480px) {
  :root { --gap: 4px; }
  .logo { font-size: 1.6rem; }
  .page-nav { gap: .6rem; }
  .page-nav > a { letter-spacing: .08em; font-size: .7rem; }
  .lang-switch { padding-left: .5rem; }
  .main-nav a { font-size: .78rem; letter-spacing: .1em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
