/* =====================================================================
   Cyrille Pelletier Lemay — Portfolio
   style.css
   ===================================================================== */

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
  --bg:           #F9F6F1;
  --bg-alt:       #F0EAE0;
  --text:         #2B2825;
  --text-muted:   #8A847C;
  --accent:       #B8956A;
  --accent-dark:  #9A7A58;
  --border:       #DDD5C9;
  --white:        #FFFFFF;
  --nav-h:        68px;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  font-size: 16px;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Scroll-reveal utility ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Section common ─────────────────────────────────────────────────── */
section {
  padding: 100px 0;
}

.section-container {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 48px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: var(--text);
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══════════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════════ */
#site-nav {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 900;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 clamp(24px, 5vw, 64px);
  background: rgba(249, 246, 241, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

#site-nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text);
  flex: 1;
  transition: opacity 0.2s;
}

.nav-brand:hover { opacity: 0.55; }

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-links a {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--text);
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 767px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    inset-block-start: var(--nav-h);
    inset-inline: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    padding: 12px 0 20px;
    border-bottom: 1px solid var(--border);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s 0.3s;
  }

  .nav-links.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s 0s;
  }

  .nav-links a {
    display: block;
    padding: 13px clamp(24px, 5vw, 64px);
    font-size: 0.75rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════ */
#hero {
  padding: 0;
  position: relative;
  height: 100svh;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* Placeholder gradient visible when hero.jpg not yet loaded */
.hero-visual {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #E8DDD1 0%, #C9B9A8 60%, #B8A090 100%);
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.hero-visual img.loaded { opacity: 1; }

/* Bottom-to-top gradient overlay for legibility */
.hero-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(43, 40, 37, 0.65) 0%,
    rgba(43, 40, 37, 0.15) 45%,
    transparent 70%
  );
}

.hero-text {
  position: relative;
  z-index: 1;
  padding: 0 clamp(28px, 6vw, 88px) clamp(64px, 10vh, 110px);
  color: var(--white);
}

.hero-overline {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 14px;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 8.5vw, 7rem);
  font-weight: 300;
  line-height: 1.0;
  margin-bottom: 36px;
}

.hero-text h1 em { font-style: italic; }

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  padding-bottom: 4px;
  transition: gap 0.3s var(--ease), border-color 0.2s;
}

.cta-link:hover {
  gap: 18px;
  border-color: rgba(255, 255, 255, 0.9);
}

/* Animated scroll indicator */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  right: clamp(28px, 5vw, 64px);
  z-index: 1;
}

.scroll-hint__line {
  display: block;
  width: 1px;
  height: 44px;
  background: rgba(255, 255, 255, 0.45);
  transform-origin: top;
  animation: scrollPulse 2s var(--ease) infinite;
}

@keyframes scrollPulse {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
  49%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   GALERIE
   ═══════════════════════════════════════════════════════════════════ */
#oeuvres {
  background: var(--bg);
}

/* Filter buttons */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 44px;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 22px;
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--white);
}

/* Masonry (CSS columns) */
.masonry {
  columns: 3;
  column-gap: 18px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 18px;
  cursor: pointer;
  position: relative;
  border-radius: 3px;
  overflow: hidden;
}

.masonry-item figure {
  margin: 0;
  position: relative;
  overflow: hidden;
}

/* Placeholder gradient shown until image loads */
.masonry-item img {
  width: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.65s var(--ease);
}

.masonry-item:hover img,
.masonry-item:focus-within img {
  transform: scale(1.04);
}

/* Hover caption overlay */
.masonry-item figcaption {
  position: absolute;
  inset: 0;
  background: rgba(43, 40, 37, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  color: var(--white);
  opacity: 0;
  transition: opacity 0.3s;
}

.masonry-item:hover figcaption,
.masonry-item:focus-within figcaption {
  opacity: 1;
}

.caption-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.2;
  display: block;
}

.caption-dim {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 5px;
  display: block;
}

/* Hidden items (filter) */
.masonry-item.hidden { display: none; }

/* Focus ring for keyboard nav */
.masonry-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .masonry { columns: 2; column-gap: 14px; }
  .masonry-item { margin-bottom: 14px; }
}

@media (max-width: 560px) {
  .masonry { columns: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   À PROPOS
   ═══════════════════════════════════════════════════════════════════ */
#apropos {
  background: var(--bg-alt);
}

.about-layout {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(36px, 6vw, 88px);
  align-items: start;
}

.about-photo {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  border-radius: 3px;
  overflow: hidden;
  /* Placeholder gradient until portrait.jpg loads */
  background: linear-gradient(160deg, #DDD5C9 0%, #C4B4A4 100%);
}

.about-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.section-head--left {
  margin-bottom: 28px;
}

.about-statement {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 24px;
}

.about-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 16px;
}

/* CV block inside À Propos */
.about-cv {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.cv-heading {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.cv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cv-list li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: baseline;
}

.cv-year {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.cv-detail {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 300;
  line-height: 1.5;
}

@media (max-width: 767px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .about-photo {
    position: static;
    max-width: 300px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   LIVRE
   ═══════════════════════════════════════════════════════════════════ */
#livre {
  background: var(--bg-alt);
}

.book-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(36px, 6vw, 88px);
  align-items: start;
}

.book-cover {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(160deg, #DDD5C9 0%, #C4B4A4 100%);
  box-shadow: 0 18px 50px rgba(43,40,37,0.14);
}

.book-cover img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.book-overline {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.book-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 28px;
}

.book-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 16px;
}

.book-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 28px 0 32px;
  align-items: baseline;
}

.book-dl dt {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.book-dl dd {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 300;
}

.book-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  transition: gap 0.3s var(--ease), border-color 0.2s, color 0.2s;
}

.book-cta:hover {
  gap: 18px;
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 767px) {
  .book-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .book-cover {
    position: static;
    max-width: 380px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   CONTACT
   ═══════════════════════════════════════════════════════════════════ */
#contact {
  background: var(--bg);
}

.contact-layout {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(36px, 6vw, 88px);
  align-items: start;
}

.contact-lead {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 36px;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-list li {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-list span {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-list a {
  font-size: 0.88rem;
  color: var(--text);
  transition: color 0.2s;
}

.contact-list a:hover { color: var(--accent); }

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--border);
}

.btn-send {
  align-self: flex-start;
  background: var(--text);
  color: var(--white);
  border: none;
  border-radius: 100px;
  padding: 13px 38px;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
}

.btn-send:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-send:active {
  transform: translateY(0);
}

.form-feedback {
  font-size: 0.8rem;
  color: var(--accent-dark);
  min-height: 1.3em;
}

.form-feedback.is-error {
  color: #B84040;
}

@media (max-width: 767px) {
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════ */
#site-footer {
  background: var(--text);
  color: var(--bg);
  padding: 30px 0;
}

.footer-copy {
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-align: center;
  opacity: 0.45;
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL ŒUVRE
   ═══════════════════════════════════════════════════════════════════ */

/* Overlay backdrop */
.art-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 40, 37, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s, visibility 0s 0.35s;
}

.art-modal__overlay.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.35s, visibility 0s 0s;
}

/* Modal container */
.art-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  visibility: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0s 0.35s;
  pointer-events: none;
}

.art-modal.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0s 0s;
}

/* Modal card */
.art-modal__body {
  display: grid;
  grid-template-columns: 1fr 340px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
  max-width: 1060px;
  max-height: calc(100svh - 64px);
  overflow-y: auto;
}

/* Left: images */
.art-modal__visuals {
  padding: 36px 0 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.art-modal__main-img {
  width: 100%;
  border-radius: 3px;
  object-fit: contain;
  max-height: 62vh;
  /* Gradient shows before image loads */
  background: linear-gradient(145deg, var(--bg-alt), var(--border));
}

.art-modal__ctx-img {
  width: 55%;
  border-radius: 3px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: linear-gradient(145deg, var(--border), var(--bg-alt));
  /* Hidden by default via JS; shown when srcContext exists */
  display: none;
}

.art-modal__ctx-img.is-visible { display: block; }

/* Right: details */
.art-modal__details {
  padding: 40px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Close button */
.art-modal__close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1002;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.art-modal__close:hover {
  background: var(--bg-alt);
  transform: scale(1.06);
}

.art-modal__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.2;
  margin-bottom: 32px;
  color: var(--text);
}

.art-modal__dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 20px;
  align-items: baseline;
}

.art-modal__dl dt {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.art-modal__dl dd {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 300;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-badge--available {
  background: #EDF5EE;
  color: #3A7C3E;
}

.status-badge--sold {
  background: #F5EDEC;
  color: #A84040;
}

@media (max-width: 767px) {
  .art-modal__body {
    grid-template-columns: 1fr;
    max-height: calc(100svh - 32px);
  }
  .art-modal__visuals {
    padding: 24px 24px 0;
  }
  .art-modal__details {
    padding: 24px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .art-modal__main-img {
    max-height: 50vh;
  }
}
