/* ==========================================================================
   Michel Charvet, Artiste Peintre — Site statique
   "La galerie intime d'un peintre irreverencieux"
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #1a1a1a;
  --bg-card:     #242424;
  --bg-hover:    #2a2a2a;
  --text:        #e8e0d4;
  --text-muted:  #9a9084;
  --accent:      #c45a3c;
  --accent-hover:#d4785e;
  --border:      #333333;
  --black-95:    rgba(0,0,0,.95);

  --font-title:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max-w:       1200px;
  --gap:         2rem;
}

html.light-preload body,
body.light-mode {
  --bg:          #f5f0eb;
  --bg-card:     #fff;
  --bg-hover:    #ece6df;
  --text:        #2a2a2a;
  --text-muted:  #6b6157;
  --accent:      #b04a2e;
  --accent-hover:#c45a3c;
  --border:      #d4cdc4;
  --black-95:    rgba(0,0,0,.85);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }

/* --- Typography --- */
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }

.tagline {
  font-family: var(--font-title);
  font-style: italic;
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

blockquote {
  font-family: var(--font-title);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding: .75rem 0 .75rem 1.5rem;
  margin: 2rem 0;
}

/* --- Header / Navigation --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26,26,26,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.site-logo {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: .02em;
  white-space: nowrap;
}
.site-logo span { color: var(--accent); }

.site-nav { display: flex; gap: 0; }
.site-nav a {
  color: var(--text-muted);
  font-size: .875rem;
  padding: .5rem 1rem;
  transition: color .2s;
  letter-spacing: .02em;
}
.site-nav a:hover,
.site-nav a.active { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: color .2s, border-color .2s;
  margin-left: .5rem;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Light mode header background */
html.light-preload .site-header,
body.light-mode .site-header { background: rgba(245,240,235,.92); }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
}
.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform .3s, opacity .3s;
}
.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- Hero (Accueil) --- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 6rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  filter: brightness(.55);
  z-index: 0;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
  width: 100%;
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,.6);
  margin-bottom: .5rem;
}
.hero .tagline {
  color: rgba(255,255,255,.8);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  text-shadow: 0 1px 10px rgba(0,0,0,.5);
}

/* --- Section spacing --- */
.section {
  padding: 5rem 0;
}
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}
.section-title h2 { margin-bottom: .5rem; }
.section-title p { color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.section--alt { background: var(--bg-card); }

/* --- Collections Grid (Accueil) --- */
.collections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.collection-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
}
.collection-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease, filter .5s ease;
}
.collection-card:hover img {
  transform: scale(1.05);
  filter: brightness(.7);
}
.collection-card .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}
.collection-card .overlay h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: .25rem;
}
.collection-card .overlay p {
  color: rgba(255,255,255,.7);
  font-size: .875rem;
}

/* --- Section parallaxe (citation) --- */
.section--parallax {
  position: relative;
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  padding: 3rem 0;
}
.section--parallax-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
}
.section--parallax .container {
  position: relative;
  z-index: 1;
}
@media (max-width: 768px) {
  .section--parallax { background-attachment: scroll; }
}

/* --- Citation flottante --- */
.citation-block {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 0;
}
.citation-block blockquote {
  border-left: none;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  padding: 0;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.citation-block cite {
  display: block;
  margin-top: 1rem;
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  font-style: normal;
}

/* --- Bio courte (Accueil) --- */
.bio-preview {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 3rem;
  align-items: center;
}
.bio-preview img {
  border-radius: 4px;
  width: 100%;
}
.bio-preview .bio-text p {
  margin-bottom: 1rem;
}
.bio-preview .bio-text .read-more {
  display: inline-block;
  margin-top: .5rem;
  font-size: .9rem;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

/* --- Gallery Masonry Grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.gallery-item {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
}
.gallery-item img {
  width: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  transition: transform .4s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .75rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  color: #fff;
  font-family: var(--font-title);
  font-size: .95rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
}
.gallery-item:hover .caption { opacity: 1; transform: translateY(0); }

/* --- Chapter pages (Bible) --- */
.chapter {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 6rem;
}
.chapter-image {
  margin: 2rem 0;
  text-align: center;
}
.chapter-image img {
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.chapter-text {
  font-size: 1.05rem;
  line-height: 1.85;
}
.chapter-text p { margin-bottom: 1.25rem; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.chapter-nav a {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .9rem;
  transition: color .2s;
}
.chapter-nav a:hover { color: var(--accent); }

/* --- Bible chapters grid --- */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.chapter-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  transition: transform .3s, box-shadow .3s;
}
.chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,.4);
}
.chapter-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}
.chapter-card h4 {
  padding: .75rem 1rem;
  font-size: .95rem;
  font-family: var(--font-title);
  color: var(--text);
}

/* --- Gallery hub (4 collections) --- */
.gallery-hub {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.gallery-hub--three {
  grid-template-columns: repeat(3, 1fr);
}
.gallery-hub--three .gallery-hub-card {
  aspect-ratio: 3/4;
}
.gallery-hub-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/10;
}
.gallery-hub-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}
.gallery-hub-card:hover img { transform: scale(1.05); }
.gallery-hub-card .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}
.gallery-hub-card .overlay h3 {
  color: #fff;
  font-size: 1.35rem;
}
.gallery-hub-card .overlay p {
  color: rgba(255,255,255,.65);
  font-size: .85rem;
  margin-top: .25rem;
}

/* --- Press page --- */
.press-intro {
  max-width: 800px;
  margin: 0 auto 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1.6;
}
.press-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.press-card {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
  transition: transform .3s;
}
.press-card:hover { transform: translateY(-2px); }
.press-card .press-thumb {
  flex-shrink: 0;
  width: 200px;
  cursor: pointer;
}
.press-card .press-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.press-card .press-info {
  padding: 1rem 1.25rem 1rem 0;
  flex: 1;
}
.press-card .press-info h3 {
  font-size: 1.05rem;
  margin-bottom: .25rem;
}
.press-card .press-date {
  color: var(--text-muted);
  font-size: .8rem;
  margin-bottom: .5rem;
}
.press-card .press-excerpt {
  color: var(--text-muted);
  font-size: .85rem;
  line-height: 1.5;
}
.pdf-link {
  display: inline-block;
  margin-top: .75rem;
  font-size: .85rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: .25rem .75rem;
  transition: background .2s, color .2s;
}
.pdf-link:hover {
  background: var(--accent);
  color: #fff;
}
/* PDF viewer modale */
.pdf-viewer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--black-95);
  justify-content: center;
  align-items: center;
  padding: .75rem;
}
.pdf-viewer.active { display: flex; }
.pdf-viewer iframe {
  width: 100%;
  max-width: 1200px;
  height: 95vh;
  border: none;
  border-radius: 6px;
  background: #fff;
}
.pdf-viewer-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 201;
}
.pdf-viewer-close:hover { color: var(--accent); }
.pdf-viewer-download {
  position: absolute;
  bottom: 1rem;
  right: 1.5rem;
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  z-index: 201;
}
.pdf-viewer-download:hover { color: #fff; }

.press-back {
  color: var(--text-muted);
  font-size: .9rem;
}
@media (max-width: 600px) {
  .press-card { flex-direction: column; }
  .press-card .press-thumb { width: 100%; height: 180px; }
  .press-card .press-info { padding: 1rem 1.25rem; }
}

/* --- Artist page --- */
.artist-hero {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  align-items: start;
  padding-top: 6rem;
}
.artist-hero img {
  border-radius: 6px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.artist-bio h1 { margin-bottom: 1rem; }
.artist-bio p { margin-bottom: 1rem; }

.timeline {
  margin-top: 3rem;
  border-left: 2px solid var(--border);
  padding-left: 2rem;
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.55rem;
  top: .35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-item .year {
  color: var(--accent);
  font-weight: 700;
  font-size: .9rem;
}
.timeline-item p {
  color: var(--text-muted);
  font-size: .95rem;
  margin-top: .15rem;
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--black-95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
  cursor: pointer;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 2px;
  cursor: default;
}
.lightbox-caption {
  color: var(--text);
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-top: 1rem;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color .2s;
}
.lightbox-close:hover { color: #fff; }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2.5rem;
  cursor: pointer;
  padding: 1rem;
  transition: color .2s;
}
.lightbox-prev:hover,
.lightbox-next:hover { color: #fff; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* --- Page header (sub-pages) --- */
.page-header {
  padding: 7rem 0 3rem;
  text-align: center;
}
.page-header h1 {
  margin-bottom: .5rem;
}
.page-header .subtitle {
  color: var(--text-muted);
  font-family: var(--font-title);
  font-style: italic;
  font-size: 1.1rem;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: .75rem;
}

/* --- Utilities --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 968px) {
  .collections { grid-template-columns: 1fr; gap: 1.25rem; }
  .collection-card { aspect-ratio: 16/9; }
  .bio-preview { grid-template-columns: 1fr; }
  .bio-preview img { max-width: 250px; }
  .artist-hero { grid-template-columns: 1fr; }
  .artist-hero img { max-width: 300px; }
  .gallery-hub { grid-template-columns: 1fr; }
  .chapters-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 768px) {
  :root { --gap: 1.25rem; }

  .site-nav {
    display: none;
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    background: rgba(26,26,26,.98);
    flex-direction: column;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
  }
  .site-nav.open { display: flex; }
  .site-nav a {
    padding: .75rem var(--gap);
    font-size: 1rem;
  }
  .menu-toggle { display: block; }

  .hero { min-height: 500px; padding-bottom: 4rem; }
  .hero h1 { font-size: 2rem; }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
  .gallery-item .caption { opacity: 1; transform: none; font-size: .8rem; }

  .lightbox-prev,
  .lightbox-next { font-size: 1.5rem; }

  .chapter-nav { flex-direction: column; gap: 1rem; text-align: center; }
}

@media (max-width: 480px) {
  .collections { gap: 1rem; }
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .chapters-grid { grid-template-columns: 1fr 1fr; }
  .press-card .press-thumb { width: 140px; }
}
