/* =========================================================
   Bazar des Beaux-Arts de Moussoulens
   Design "Carnet d'artiste" — feuille de style principale
   ========================================================= */

:root {
  --color-bg: #F3E8D6;
  --color-card: #FBF5E8;
  --color-text: #33302A;
  --color-text-muted: #5c5344;
  --color-text-light: #8a7f68;
  --color-text-italic: #948a76;
  --color-input-bg: #F3E8D6;

  --color-blue: #4F7FA3;
  --color-blue-hover: #3a6683;
  --color-orange: #C1592E;
  --color-yellow: #E8B23A;
  --color-dark: #33302A;

  --font-hand: 'Caveat', cursive;
  --font-body: 'Nunito Sans', sans-serif;

  --max-width: 1440px;
  --max-width-narrow: 900px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
}

a {
  color: var(--color-blue);
}
a:hover {
  color: var(--color-blue-hover);
}

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

h1, h2, h3 {
  font-family: var(--font-hand);
  font-weight: 700;
  margin: 0;
}

/* ---------- Page background & texture ---------- */

.page-bg {
  position: relative;
  min-height: 100vh;
  background: var(--color-bg);
  overflow: hidden;
}

.paper-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: radial-gradient(rgba(51,48,42,0.05) 1px, transparent 1px);
  background-size: 3px 3px;
}

.page-wrap {
  position: relative;
  z-index: 1;
}

/* Decorative watercolor blobs (positioned per-page via inline style + these base classes) */
.blob {
  position: absolute;
  pointer-events: none;
  border-radius: 42% 58% 63% 37% / 45% 41% 59% 55%;
  z-index: 0;
}
.blob-round { border-radius: 50%; }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 26px 6vw;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-badge {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  color: var(--color-text);
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 22px;
  color: var(--color-text);
}

.brand-place {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--color-text-light);
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 20px;
  flex: 1 1 auto;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 19px;
}

.nav-main a,
.nav-mobile a {
  color: var(--color-text);
  text-decoration: none;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 3px 2px;
}

.nav-link-text {
  position: relative;
  z-index: 1;
}

.nav-highlight {
  position: absolute;
  left: -8%;
  top: 32%;
  width: 116%;
  height: 68%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
  clip-path: inset(0 100% 0 0);
  transition: clip-path .45s cubic-bezier(.22,.9,.32,1);
}

.nav-highlight path {
  fill: var(--color-yellow);
  opacity: .6;
}

.nav-link:hover .nav-highlight,
.nav-link.is-active .nav-highlight {
  clip-path: inset(0 0 0 0);
}

.nav-link.is-active .nav-highlight {
  transition: none;
}

.nav-disabled {
  color: var(--color-text);
  opacity: .4;
}

.menu-toggle {
  display: none;
  background: var(--color-card);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(51,48,42,0.15);
  padding: 0;
}

.menu-toggle span {
  width: 20px;
  height: 2.5px;
  background: var(--color-text);
  border-radius: 2px;
}

.nav-mobile {
  display: none;
  position: absolute;
  top: 100%;
  right: 6vw;
  background: var(--color-card);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(51,48,42,0.22);
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  z-index: 80;
  min-width: 190px;
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 20px;
}

.nav-mobile a,
.nav-mobile .nav-disabled {
  padding: 6px 0;
}

.nav-mobile a.is-active {
  color: var(--color-orange);
  font-weight: 700;
}

.nav-mobile.is-open {
  display: flex;
}

.btn-adherer.is-active {
  border-bottom: 3px solid var(--color-dark);
}

@media (max-width: 900px) {
  .nav-main { display: none; }
  .menu-toggle { display: flex; }
}

@media (max-width: 520px) {
  /* Below this width, the logo wordmark + hamburger + "Adhérer" no longer
     fit on one line and .site-header wraps onto two rows. Hiding the
     wordmark keeps everything on a single row (badge is still an <a>
     with an aria-label, so the accessible name is preserved). */
  .brand-text { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: .03em;
  padding: 12px 22px;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  text-align: center;
}

.btn-hand {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: normal;
  padding: 8px 22px;
}

.btn-blue { background: var(--color-blue); color: var(--color-card); }
.btn-orange { background: var(--color-orange); color: var(--color-card); }
.btn-yellow { background: var(--color-yellow); color: var(--color-text); }
.btn-dark { background: var(--color-dark); color: var(--color-card); }

.btn-shadow { box-shadow: 2px 3px 6px rgba(51,48,42,0.2); }

.btn-hero {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 19px;
  padding: 13px 30px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 2px 4px 0 rgba(51,48,42,0.15);
  background: var(--color-blue);
  color: var(--color-card);
}

/* ---------- Sections & layout ---------- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: 6vw;
  padding-right: 6vw;
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 2vw 6vw 2vw;
  text-align: center;
}

.container-narrow h1 {
  font-size: clamp(40px, 5vw, 58px);
  margin: 0 0 16px;
}

.container-narrow p {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.65;
  color: var(--color-text-muted);
  max-width: 60ch;
  margin: 0 auto;
}

.note-italic {
  font-size: 13px;
  color: var(--color-text-italic);
  font-style: italic;
  margin-top: 10px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--color-card);
  border-radius: 3px;
  box-shadow: 0 8px 18px rgba(51,48,42,0.12);
  padding: 28px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.card h3 {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.card p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
}

.card-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-orange);
  text-decoration: none;
  margin-top: auto;
}

.tilt--2, .tilt--1, .tilt-1, .tilt-05, .tilt-neg-05, .tilt-neg-13, .tilt-neg-14 { transform: none; }

/* Bordure "papier déchiré" (cartes Ateliers) — contour irrégulier généré en JS (clip-path),
   pas d'image externe donc pas d'ombre "cuite" dans un asset : l'ombre suit le vrai contour. */
/* L'ombre est portée par un wrapper NON découpé (clip-path clippe aussi tout ce qui
   déborde de l'élément, y compris une ombre projetée par filter/box-shadow sur ce
   même élément — d'où la disparition de l'ombre une fois le clip-path appliqué). */
.card-torn-shadow {
  height: 100%;
  filter: drop-shadow(0 8px 18px rgba(51,48,42,0.12)); /* même ombre que .card */
}

.card--torn {
  border-radius: 0;
  height: 100%;
  /* clip-path posé dynamiquement par assets/js/torn-cards.js ; fallback rectangle tant que le JS n'a pas tourné */
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 34px;
}

/* ---------- Forms ---------- */

.form-card {
  background: var(--color-card);
  border-radius: 4px;
  padding: clamp(26px, 4vw, 44px);
  box-shadow: 0 8px 18px rgba(51,48,42,0.12);
  position: relative;
}

.form-tag {
  position: absolute;
  top: -14px;
  left: 36px;
  background: var(--color-yellow);
  color: var(--color-text);
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 19px;
  padding: 7px 18px;
  box-shadow: 2px 2px 6px rgba(51,48,42,0.2);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-card input,
.form-card select,
.form-card textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px;
  border: 2px solid var(--color-input-bg);
  background: var(--color-input-bg);
  border-radius: 2px;
  width: 100%;
  box-sizing: border-box;
  color: var(--color-text);
}

.form-card select {
  color: #6B6152;
}

.form-full {
  width: 100%;
  margin-top: 16px;
}

.form-card textarea {
  margin-top: 16px;
  resize: vertical;
}

.form-submit {
  margin-top: 18px;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 6vw 56px;
}

.footer-label {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--color-text-light);
  margin: 0 0 20px;
  text-transform: uppercase;
}

.footer-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 34px;
}

.footer-logos img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

/* ---------- Utility ---------- */

.text-center { text-align: center; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- Hero handwriting animation (test) ---------- */

.hero-signature {
  display: block;
  /* 7.3306 = ratio (natural SVG width / font-size) so this block scales
     exactly like the original h1's clamp(42px,4.4vw,60px) font-size */
  width: calc(7.3306 * clamp(42px, 4.4vw, 60px));
  max-width: 100%;
  margin: 0 0 14px;
}

.hero-signature__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-signature__letter {
  fill: transparent;
  stroke: var(--color-text);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation:
    hero-signature-draw 0.55s linear forwards,
    hero-signature-fill 0.25s ease forwards;
  animation-delay:
    calc(var(--i) * 45ms),
    calc(var(--i) * 45ms + 0.55s);
}

@keyframes hero-signature-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes hero-signature-fill {
  to { fill: var(--color-text); stroke: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-signature__letter {
    animation: none;
    fill: var(--color-text);
    stroke: transparent;
  }
}

/* ---------- Page title handwriting animation (test) ---------- */

.title-signature {
  display: inline-block;
  /* --ratio = natural SVG width / font-size, set inline per title so this
     block scales exactly like .container-narrow h1's clamp(40px,5vw,58px) */
  width: calc(var(--ratio) * clamp(40px, 5vw, 58px));
  max-width: 100%;
  margin: 0 0 16px;
  vertical-align: top;
}

.title-signature__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.title-signature__letter {
  fill: transparent;
  stroke: var(--color-text);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation:
    hero-signature-draw 0.5s linear forwards,
    hero-signature-fill 0.22s ease forwards;
  animation-delay:
    calc(var(--i) * 50ms),
    calc(var(--i) * 50ms + 0.5s);
}

@media (prefers-reduced-motion: reduce) {
  .title-signature__letter {
    animation: none;
    fill: var(--color-text);
    stroke: transparent;
  }
}

/* ---------- Galerie photo (grille + agrandissement) ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.gallery-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(51,48,42,0.12);
  aspect-ratio: 4 / 3;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
  transform: scale(1.05);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(20,18,14,0.88);
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 6px 10px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(255,255,255,0.2);
}

.lightbox-nav[hidden] { display: none; }

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: .03em;
}

@media (max-width: 640px) {
  .lightbox-nav { width: 42px; height: 42px; font-size: 22px; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}
