/* =========================================================
   Florent Dejardin — Design System V6
   Référence unique : tokens + composants réutilisables
   ========================================================= */

:root {
  --fd-cream: #fafaf8;
  --fd-ink: #121212;
  --fd-gray: #666660;
  --fd-gray-dark: #3d3d38;
  --fd-accent: #a88663;
  --fd-accent-hover: #8e7355;
  --fd-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --fd-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --fd-space-xs: 8px;
  --fd-space-sm: 16px;
  --fd-space-md: 24px;
  --fd-space-lg: 40px;
  --fd-space-xl: 64px;
  --fd-space-2xl: 96px;
  --fd-space-3xl: 128px;

  --fd-container: 1080px;
  --fd-container-narrow: 640px;
  --fd-container-text: 720px;
  --fd-gutter: clamp(var(--fd-space-sm), 4vw, var(--fd-space-lg));

  --fd-radius: 4px;
  --fd-btn-height: 48px;
  --fd-btn-padding-x: 32px;
  --fd-transition: 0.22s ease;
}

/* —— Base pages publiques —— */
body#theHomePage,
body#theAdditionalPage,
body#theContactPage,
body#theCategoryPage,
body#theCategoriesPage,
body#theTagsPage,
body#theSearchPage {
  font-family: var(--fd-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--fd-ink);
  background: var(--fd-cream);
  -webkit-font-smoothing: antialiased;
}

body#theHomePage h1,
body#theHomePage h2,
body#theHomePage h3,
body#theAdditionalPage h1,
body#theAdditionalPage h2,
body#theAdditionalPage h3,
body#theContactPage h1,
body#theContactPage h2,
body#theContactPage h3,
body#theCategoryPage h1,
body#theCategoryPage h2,
body#theCategoryPage h3,
body#theCategoriesPage h1,
body#theCategoriesPage h2,
body#theCategoriesPage h3 {
  font-family: var(--fd-serif);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--fd-ink);
}

/* —— Spacing utilities —— */
.fd-spacing-xs { margin-bottom: var(--fd-space-xs); }
.fd-spacing-sm { margin-bottom: var(--fd-space-sm); }
.fd-spacing-md { margin-bottom: var(--fd-space-md); }
.fd-spacing-lg { margin-bottom: var(--fd-space-lg); }
.fd-spacing-xl { margin-bottom: var(--fd-space-xl); }

/* —— Container —— */
.fd-container {
  width: 100%;
  max-width: var(--fd-container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--fd-gutter);
  padding-right: var(--fd-gutter);
}

.fd-container--narrow {
  max-width: var(--fd-container-narrow);
}

.fd-container--text {
  max-width: var(--fd-container-text);
}

/* —— Section —— */
.fd-section {
  padding-top: var(--fd-space-xl);
  padding-bottom: var(--fd-space-xl);
}

.fd-section--sm {
  padding-top: var(--fd-space-lg);
  padding-bottom: var(--fd-space-lg);
}

.fd-section--dark {
  background: var(--fd-ink);
  color: var(--fd-cream);
}

.fd-section--dark .fd-title-xl,
.fd-section--dark .fd-title-lg,
.fd-section--dark .fd-title-md,
.fd-section--dark h1,
.fd-section--dark h2,
.fd-section--dark h3 {
  color: var(--fd-cream);
}

/* —— Typography —— */
.fd-title-xl {
  font-family: var(--fd-serif);
  font-size: clamp(1.85rem, 4.2vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 var(--fd-space-sm);
}

.fd-title-lg {
  font-family: var(--fd-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  margin: 0 0 var(--fd-space-sm);
}

.fd-title-md {
  font-family: var(--fd-serif);
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.25;
  margin: 0 0 var(--fd-space-sm);
}

.fd-text {
  font-family: var(--fd-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--fd-ink);
  margin: 0 0 var(--fd-space-md);
}

.fd-lead {
  font-family: var(--fd-serif);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.7;
  color: var(--fd-gray);
  margin: 0 0 var(--fd-space-md);
}

.fd-lead--emphasis {
  font-style: italic;
  font-weight: 500;
  color: var(--fd-gray-dark);
}

.fd-quote {
  font-family: var(--fd-serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.75;
  color: var(--fd-gray);
}

/* —— Actions row —— */
.fd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fd-space-sm) var(--fd-space-md);
  justify-content: center;
  align-items: center;
}

.fd-actions--start {
  justify-content: flex-start;
}

/* —— Buttons (composant unique) —— */
.fd-btn,
a.fd-btn,
button.fd-btn,
input.fd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--fd-btn-height);
  padding: 12px var(--fd-btn-padding-x);
  width: auto;
  max-width: 100%;
  border-radius: var(--fd-radius);
  border: 1px solid transparent;
  font-family: var(--fd-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background var(--fd-transition), color var(--fd-transition),
    border-color var(--fd-transition), transform var(--fd-transition);
}

.fd-btn-primary,
a.fd-btn-primary,
button.fd-btn-primary,
input.fd-btn-primary {
  background: transparent;
  color: var(--fd-ink) !important;
  border-color: var(--fd-accent);
}

.fd-btn-primary:hover,
.fd-btn-primary:focus-visible,
a.fd-btn-primary:hover,
a.fd-btn-primary:focus-visible,
button.fd-btn-primary:hover,
button.fd-btn-primary:focus-visible,
input.fd-btn-primary:hover,
input.fd-btn-primary:focus-visible {
  background: var(--fd-ink);
  color: var(--fd-cream) !important;
  border-color: var(--fd-ink);
  text-decoration: none;
  transform: translateY(-1px);
}

.fd-btn-primary:focus-visible,
a.fd-btn-primary:focus-visible,
button.fd-btn-primary:focus-visible,
input.fd-btn-primary:focus-visible {
  outline: 2px solid var(--fd-accent);
  outline-offset: 3px;
}

.fd-btn-secondary,
a.fd-btn-secondary {
  background: transparent;
  color: var(--fd-ink) !important;
  border-color: var(--fd-ink);
}

.fd-btn-secondary:hover,
.fd-btn-secondary:focus-visible,
a.fd-btn-secondary:hover,
a.fd-btn-secondary:focus-visible {
  background: var(--fd-ink);
  color: var(--fd-cream) !important;
  border-color: var(--fd-ink);
  text-decoration: none;
  transform: translateY(-1px);
}

.fd-btn-secondary:focus-visible,
a.fd-btn-secondary:focus-visible {
  outline: 2px solid var(--fd-accent);
  outline-offset: 3px;
}

.fd-section--dark .fd-btn-primary,
.fd-section--dark a.fd-btn-primary {
  background: var(--fd-cream);
  color: var(--fd-ink) !important;
  border-color: var(--fd-cream);
}

.fd-section--dark .fd-btn-primary:hover,
.fd-section--dark .fd-btn-primary:focus-visible,
.fd-section--dark a.fd-btn-primary:hover,
.fd-section--dark a.fd-btn-primary:focus-visible {
  background: transparent;
  color: var(--fd-cream) !important;
  border-color: var(--fd-cream);
}

/* —— Boutons sur fond sombre (hero, overlays) —— */
.fd-on-dark .fd-btn-primary,
.fd-on-dark a.fd-btn-primary {
  color: #ffffff !important;
  border-color: var(--fd-accent);
  background: transparent;
}

.fd-on-dark .fd-btn-primary:hover,
.fd-on-dark .fd-btn-primary:focus-visible,
.fd-on-dark a.fd-btn-primary:hover,
.fd-on-dark a.fd-btn-primary:focus-visible {
  background: var(--fd-accent);
  color: var(--fd-ink) !important;
  border-color: var(--fd-accent);
}

.fd-on-dark .fd-btn-secondary,
.fd-on-dark a.fd-btn-secondary {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.75);
  background: transparent;
}

.fd-on-dark .fd-btn-secondary:hover,
.fd-on-dark .fd-btn-secondary:focus-visible,
.fd-on-dark a.fd-btn-secondary:hover,
.fd-on-dark a.fd-btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
  border-color: var(--fd-accent);
}

/* —— Bootstrap / thème : neutraliser boutons noirs résiduels —— */
body#theHomePage #fd-v5 a.btn-primary,
body#theHomePage #fd-v5 a.btn-dark,
body#theAdditionalPage #content a.btn-dark,
body#theContactPage #content a.btn-dark,
body#theCategoryPage #content a.btn-dark,
#fd-portfolio a.btn-dark,
#fd-portfolio-masonry a.btn-dark {
  all: unset;
  box-sizing: border-box;
}

/* —— Grid / card (minimal) —— */
.fd-grid {
  display: grid;
  gap: var(--fd-space-md);
}

.fd-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fd-grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.fd-card {
  overflow: hidden;
  background: transparent;
}

.fd-card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.fd-card__body {
  padding: var(--fd-space-sm) 0 var(--fd-space-md);
}

.fd-card__body h2,
.fd-card__body h3 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  margin: 0;
}

.fd-card a {
  color: inherit;
  text-decoration: none;
}

/* —— Pages éditoriales (Additional Pages) —— */
body#theAdditionalPage #content {
  max-width: var(--fd-container-text);
  margin: 0 auto;
  padding: var(--fd-space-xl) var(--fd-gutter) var(--fd-space-2xl);
}

body#theAdditionalPage #content h1 {
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  margin-bottom: var(--fd-space-md);
  text-align: center;
}

body#theAdditionalPage #content h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  margin-top: var(--fd-space-xl);
  margin-bottom: var(--fd-space-md);
}

body#theAdditionalPage #content p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fd-gray-dark);
  margin-bottom: var(--fd-space-md);
}

body#theAdditionalPage #content p a[href*="contact"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--fd-btn-height);
  padding: 12px var(--fd-btn-padding-x);
  margin: var(--fd-space-sm) 0 var(--fd-space-lg);
  border-radius: var(--fd-radius);
  border: 1px solid var(--fd-accent);
  background: transparent;
  color: var(--fd-ink) !important;
  font-family: var(--fd-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background var(--fd-transition), color var(--fd-transition),
    border-color var(--fd-transition);
}

body#theAdditionalPage #content p a[href*="contact"]:hover,
body#theAdditionalPage #content p a[href*="contact"]:focus-visible {
  background: var(--fd-ink);
  color: var(--fd-cream) !important;
  border-color: var(--fd-ink);
  text-decoration: none;
}

body#theAdditionalPage #content p a[href*="contact"] strong {
  font-weight: 500;
  font-size: inherit;
  font-family: inherit;
}

body#theAdditionalPage #content span[style*="Arial"] {
  font-family: inherit !important;
}

/* —— Contact —— */
body#theContactPage #content {
  max-width: var(--fd-container-narrow);
  margin: 0 auto;
  padding: var(--fd-space-xl) var(--fd-gutter) var(--fd-space-2xl);
}

body#theContactPage #content form[action*="contact"] {
  max-width: 100%;
  margin: 0;
}

body#theContactPage #content form[action*="contact"] table {
  width: 100%;
}

body#theContactPage #content form input[type="text"],
body#theContactPage #content form textarea {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  padding: var(--fd-space-sm);
  border: 1px solid rgba(18, 18, 18, 0.15);
  border-radius: var(--fd-radius);
  font-family: var(--fd-sans);
  font-size: 15px;
  background: #fff;
}

body#theContactPage #content form input.submit,
body#theContactPage #content form input[type="submit"],
body#theContactPage #content form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--fd-btn-height);
  padding: 12px var(--fd-btn-padding-x);
  margin-top: var(--fd-space-md);
  border-radius: var(--fd-radius);
  border: 1px solid var(--fd-accent);
  background: transparent;
  color: var(--fd-ink) !important;
  font-family: var(--fd-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--fd-transition), color var(--fd-transition),
    border-color var(--fd-transition);
}

body#theContactPage #content form input.submit:hover,
body#theContactPage #content form input[type="submit"]:hover,
body#theContactPage #content form input.submit:focus-visible,
body#theContactPage #content form input[type="submit"]:focus-visible {
  background: var(--fd-ink);
  color: var(--fd-cream) !important;
  border-color: var(--fd-ink);
}

/* —— Portfolio catégories Piwigo —— */
body#theCategoryPage #content-description {
  max-width: var(--fd-container-text);
  margin: 0 auto;
  padding: var(--fd-space-lg) var(--fd-gutter) var(--fd-space-sm);
  text-align: center;
}

body#theCategoryPage #content-description h5,
body#theCategoryPage #content-description p {
  font-family: var(--fd-serif);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  line-height: 1.65;
  color: var(--fd-gray);
  font-weight: 400;
  margin: 0;
}

body#theCategoryPage #content.content-grid {
  padding-left: var(--fd-gutter);
  padding-right: var(--fd-gutter);
  padding-bottom: var(--fd-space-xl);
}

/* Neutraliser boutons Bootstrap hérités sur pages FD */
body#theHomePage #fd-v5 a.btn,
body#theHomePage #fd-v5 .btn,
#fd-portfolio a.btn,
#fd-portfolio .btn:not(.fd-btn) {
  all: unset;
  box-sizing: border-box;
}

/* —— Responsive —— */
@media (max-width: 768px) {
  .fd-grid--2 {
    grid-template-columns: 1fr;
  }

  .fd-actions {
    flex-direction: column;
    width: 100%;
  }

  .fd-actions .fd-btn,
  .fd-actions a.fd-btn {
    width: 100%;
    max-width: 280px;
  }

  .fd-section {
    padding-top: var(--fd-space-lg);
    padding-bottom: var(--fd-space-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fd-btn,
  a.fd-btn,
  button.fd-btn,
  input.fd-btn {
    transition: none;
  }
}
