/* Fonts loaded via /fonts/fonts.css */

:root {
  --primary: #B8450D;
  --secondary: #C8A832;
  --bg-warm: #FFFCF7;
  --bg-parchment: #F5EEE3;
  --bg-saffron-pale: #FFF7E8;
  --bg-red-pale: #FFF0ED;
  --text-main: #3B2F2F;
  --text-muted: #8C7B6B;
  --footer-bg: #2A1F1A;
  --footer-text: #A89080;
  --transition: all 0.3s ease-in-out;
  --shadow: 0 4px 12px rgba(60, 30, 10, 0.08);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-warm);
  color: var(--text-main);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  text-transform: lowercase;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

/* Article content — scoped color/spacing, never set color on scoped h/p */
#article-content h2,
#article-content h3,
#article-content h4 {
  margin-bottom: 1rem;
}

#article-content p {
  margin-bottom: 1.25rem;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }

p {
  margin-bottom: 1.5rem;
}

a {
  text-decoration: none;
  transition: var(--transition);
}

/* Article body links inherit readable color via #article-content */
#article-content a {
  color: var(--primary);
}

#article-content a:hover {
  color: var(--secondary);
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 252, 247, 0.97);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #E8DDD0;
  padding: 1rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  gap: 5px;
}

.logo .epice { color: var(--text-main); }
.logo .amp { color: var(--secondary); }
.logo .safran { color: var(--primary); }

nav ul {
  display: flex;
  list-style: none;
  gap: 28px;
}

nav ul li a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  padding-bottom: 4px;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--primary);
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  transition: width 0.3s ease;
}

nav ul li a:hover::after,
nav ul li a.active::after {
  width: 100%;
}

/* Hero Section */
.hero {
  padding: 8rem 5% 4rem;
  text-align: center;
  background-size: cover;
  background-position: center;
  position: relative;
}

.hero h1 {
  color: var(--primary);
  max-width: 800px;
  margin: 0 auto 1rem;
}

.hero p {
  color: var(--text-main);
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Content Sections */
section {
  padding: 4rem 5%;
}

section:nth-of-type(even) {
  background-color: var(--bg-parchment);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--bg-warm);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-bottom: 0 solid var(--secondary);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(60, 30, 10, 0.12);
  border-bottom-width: 3px;
}

.card-image {
  aspect-ratio: 4/3;
  width: 100%;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-saffron-pale);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Callout Boxes */
.box {
  padding: 1.5rem;
  margin: 2rem 0;
  border-left: 4px solid;
}

.box-conseil {
  background-color: var(--bg-saffron-pale);
  border-left-color: var(--secondary);
}

.box-alert {
  background-color: var(--bg-red-pale);
  border-left-color: var(--primary);
}

.box-definition {
  background-color: var(--bg-parchment);
  border-left-color: var(--text-muted);
}

.box-knowledge {
  background-color: var(--bg-warm);
  border-left-color: var(--secondary);
  font-style: italic;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border: 1px solid var(--secondary);
}

th {
  background-color: var(--primary);
  color: #FFFFFF;
  padding: 12px;
  text-align: left;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--secondary);
}

tr:nth-child(even) {
  background-color: var(--bg-parchment);
}

tr:nth-child(odd) {
  background-color: var(--bg-warm);
}

/* Footer */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 4rem 5% 2rem;
  text-align: center;
}

footer .logo {
  justify-content: center;
  margin-bottom: 2rem;
}

footer .logo .epice { color: #FFFFFF; }

footer nav {
  margin-bottom: 2rem;
}

footer nav ul {
  justify-content: center;
}

footer nav ul li a {
  color: var(--footer-text);
}

footer nav ul li a:hover {
  color: var(--secondary);
}

.footer-legal {
  font-size: 12px;
  opacity: 0.6;
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInScroll 0.7s forwards ease-out;
}

@keyframes fadeInScroll {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Menu */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  
  nav {
    display: none; /* Mobile implementation would require JS for the full-screen overlay toggle */
  }
  
  h1 { font-size: 2.25rem; }
}

/* Helper Classes */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.italic { font-style: italic; }

/* ============================================================
   HARDEN — Phase 2
   ============================================================ */

/* Max-width body container */
body > nav,
body > main,
body > footer {
  max-width: 96rem;
  margin-left: auto;
  margin-right: auto;
}

/* Text overflow protection */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

p, li, td, th {
  overflow-wrap: break-word;
}

/* Tables responsive */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  margin: 2rem 0;
}

/* Forms & inputs contrast fix */
input,
select,
textarea,
button[type="submit"] {
  color: var(--text-main);
  background-color: #FFFFFF;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================================
   MINI-TOOLS CONTRAST — sections sombres (#2A1F1A / #3B2F2F)
   Force couleur claire sur inputs/selects dans des sections dark
   ============================================================ */

/* Section avec bg-[#2A1F1A] ou fond footer-bg */
section[class*="bg-[#2A1F1A]"] input,
section[class*="bg-[#2A1F1A]"] select,
section[class*="bg-[#2A1F1A]"] textarea {
  color: #FFF7E8 !important;
  background-color: #3B2F2F !important;
  border-color: #5A4B41 !important;
}

/* Section avec classe darkbrown / dark / bg-dark */
section.bg-darkbrown input,
section.bg-darkbrown select,
section.bg-dark input,
section.bg-dark select,
.bg-darkbrown input,
.bg-darkbrown select,
.bg-dark input,
.bg-dark select,
.bg-deepBrown input,
.bg-deepBrown select {
  color: #FFF7E8 !important;
  background-color: #3B2F2F !important;
}

/* Range input toujours visible */
input[type="range"] {
  background-color: transparent !important;
  accent-color: var(--primary);
}

/* Select option couleur sur fond sombre */
select option {
  background-color: #2A1F1A;
  color: #FFF7E8;
}

/* Image fallbacks */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

img[src=""],
img:not([src]) {
  visibility: hidden;
}

/* Safe area for notched devices */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ============================================================
   POLISH — Phase 2
   ============================================================ */

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-parchment);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Custom easing for transitions */
:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
}

/* Card hover polish */
.card {
  transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo), border-bottom-width 0.2s ease;
}

/* Tinted neutral backgrounds */
.bg-neutral-tinted {
  background-color: var(--bg-parchment);
}

/* Section spacing — 8px grid */
section {
  padding: 4rem 5%;
}

/* Hero overlay — no brightness-50 degradation */
.hero-dark-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.15) 50%, rgba(255,252,247,0.85) 100%);
  pointer-events: none;
}

/* Hero max-width to prevent stretching of 1360px native images */
.hero-img-wrap {
  max-width: 1360px;
  margin: 0 auto;
}

/* Smooth link transitions */
a {
  transition: color 0.25s var(--ease-out-expo);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  nav,
  footer,
  .skip-nav,
  button,
  #navMobileMenu {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #555;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: #000;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.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;
}

.skip-nav:focus,
.focus\:not-sr-only:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  clip: auto;
  white-space: normal;
  background-color: var(--primary);
  color: #fff;
  border-radius: 4px;
  z-index: 9999;
  font-weight: 600;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.5rem; }
}

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  section { padding: 2.5rem 1.25rem; }
  table { min-width: 320px; }
}
