/* ==========================================================================
   Amicale des Propriétaires Terriens de Nersac (Loi 1901)
   Official Master Stylesheet - Clean, High-Performance, Mobile-Responsive
   ========================================================================== */

:root {
  --color-topbar: #E64A19;
  --color-navy: #0A4260;
  --color-navy-hover: #073046;
  --color-blue: #0082AD;
  --color-blue-hover: #00688B;
  --color-magenta: #C2185B;
  --color-magenta-hover: #9C1045;
  --color-green: #2E7D32;
  --color-green-hover: #1B5E20;
  --color-alert: #D32F2F;
  --color-alert-hover: #B71C1C;
  --color-heading: #0F172A;
  --color-body: #475569;
  --color-bg-light: #F8FAFC;
  --color-card: #FFFFFF;
  --color-border: #E2E8F0;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  color: var(--color-body);
  background-color: #FAFAFA;
  line-height: 1.65;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: 1.875rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.35rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

a {
  color: var(--color-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Top Bar */
.top-bar {
  background-color: var(--color-topbar);
  color: #FFFFFF;
  font-size: 0.875rem;
  padding: 8px 0;
  font-weight: 500;
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-bar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.top-bar-links a {
  color: #FFFFFF;
  margin-left: 16px;
  text-decoration: underline;
}

.top-bar-links a:hover {
  color: #FFE0B2;
}

/* Header & Nav */
.site-header {
  background-color: var(--color-navy);
  color: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 80px;
}

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

.brand-crest {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #0082AD, #2E7D32);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.75rem;
  color: #CBD5E1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.main-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 4px;
  align-items: center;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: block;
  padding: 12px 14px;
  color: #E2E8F0;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
}

.nav-link:hover, .nav-link:focus {
  color: #FFFFFF;
  background-color: var(--color-navy-hover);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  min-width: 240px;
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  display: none;
  list-style: none;
  z-index: 1001;
}

.nav-dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--color-heading);
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-dropdown a:hover {
  background-color: #F1F5F9;
  color: var(--color-navy);
}

.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  display: block;
}

.nav-cta-btn {
  background-color: var(--color-magenta);
  color: #FFFFFF !important;
  border-radius: 6px;
  padding: 10px 18px !important;
  font-weight: 700;
}

.nav-cta-btn:hover {
  background-color: var(--color-magenta-hover) !important;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(rgba(10, 66, 96, 0.88), rgba(7, 48, 70, 0.92)), url('https://images.pexels.com/photos/1172064/pexels-photo-1172064.jpeg?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat;
  color: #FFFFFF;
  padding: 60px 0 70px 0;
  position: relative;
}

.hero-banner.page-hero {
  padding: 48px 0;
}

.hero-content {
  max-width: 900px;
}

.hero-tag {
  display: inline-block;
  background-color: rgba(230, 74, 25, 0.95);
  color: #FFFFFF;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.hero-title {
  color: #FFFFFF;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-summary {
  font-size: 1.2rem;
  color: #F1F5F9;
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 820px;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  min-height: 44px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--color-alert);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--color-alert-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--color-navy);
}

.btn-secondary:hover {
  background-color: #E2E8F0;
  color: var(--color-navy-hover);
}

.btn-green {
  background-color: var(--color-green);
  color: #FFFFFF;
}

.btn-green:hover {
  background-color: var(--color-green-hover);
  color: #FFFFFF;
}

/* Standalone 'Notre Mission' Highlight Box */
.notre-mission-card {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-left: 6px solid var(--color-green);
  border-radius: 8px;
  padding: 28px 32px;
  margin: 36px 0;
  box-shadow: var(--shadow-sm);
}

.notre-mission-card h3 {
  margin-top: 0;
  color: var(--color-green-hover);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
}

.notre-mission-text {
  font-size: 1.1rem;
  line-height: 1.75;
  color: #1E3A1E;
  margin-bottom: 0;
  font-weight: 500;
}

/* Notice banners */
.reinvestment-banner {
  background-color: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1E40AF;
  font-weight: 600;
}

/* Page Layout */
.page-wrapper {
  flex: 1;
  padding: 40px 0 60px 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  margin-top: 24px;
}

.full-content {
  max-width: 960px;
  margin: 0 auto;
}

.cards-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 30px 0;
}

.cards-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 30px 0;
}

.cards-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 30px 0;
}

.card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.card h3 {
  margin-top: 0;
}

/* Image & Figcaption styling strictly compliant with protocol */
figure.action-figure {
  margin: 24px 0 20px 0;
  width: 100%;
}

img.action-img {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  margin: 20px 0 8px 0;
  object-fit: cover;
  display: block;
}

.figure-caption {
  font-size: 0.875rem;
  color: #64748B;
  font-style: italic;
  margin-bottom: 20px;
  display: block;
  line-height: 1.4;
}

/* Sidebar widget */
.sidebar-widget {
  background-color: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h4 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--color-navy);
  margin-bottom: 14px;
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 8px;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  margin-bottom: 10px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-heading);
  font-weight: 500;
  font-size: 0.95rem;
}

.sidebar-links a:hover {
  color: var(--color-blue);
  padding-left: 4px;
}

/* Forms & AJAX */
.form-card {
  background-color: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin: 24px 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-heading);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background-color: #FFFFFF;
  color: var(--color-heading);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(0, 130, 173, 0.2);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  margin-top: 12px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-navy);
}

/* Modal Popup */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: #FFFFFF;
  border-radius: 16px;
  padding: 36px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-icon {
  width: 64px;
  height: 64px;
  background-color: #DCFCE7;
  color: var(--color-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 18px auto;
}

.modal-content h3 {
  margin-top: 0;
  font-size: 1.6rem;
  color: var(--color-heading);
}

.modal-content p {
  color: var(--color-body);
  font-size: 1rem;
  margin-bottom: 24px;
}

/* Footer strictly compliant with legal requirements */
.site-footer {
  background-color: #062333;
  color: #94A3B8;
  padding-top: 50px;
  border-top: 4px solid var(--color-topbar);
  margin-top: auto;
}

.footer-main {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: 1.1rem;
  margin-bottom: 16px;
  font-family: var(--font-heading);
}

.footer-col p {
  font-size: 0.925rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.footer-nav {
  list-style: none;
}

.footer-nav li {
  margin-bottom: 8px;
}

.footer-nav a {
  color: #CBD5E1;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: #38BDF8;
}

.footer-legal-bar {
  background-color: #03141E;
  padding: 24px 0;
  font-size: 0.85rem;
  color: #94A3B8;
  line-height: 1.6;
}

.footer-disclosure-block {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--color-topbar);
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: 0 6px 6px 0;
  color: #E2E8F0;
  font-size: 0.875rem;
}

.footer-copyright-line {
  color: #64748B;
  font-size: 0.825rem;
  text-align: center;
  padding-top: 8px;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .cards-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .cards-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-main {
    grid-template-columns: 1fr 1fr;
  }
  .hero-title {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-navy);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
  }
  .main-nav.open {
    display: block;
  }
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .nav-dropdown {
    position: static;
    display: none;
    box-shadow: none;
    background: #073046;
    border: none;
    padding: 4px 12px;
  }
  .nav-dropdown a {
    color: #E2E8F0;
  }
  .nav-item.open-mobile .nav-dropdown {
    display: block;
  }
  .cards-grid-3, .cards-grid-2, .cards-grid-4 {
    grid-template-columns: 1fr;
  }
  .footer-main {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 1.85rem;
  }
  img.action-img {
    height: 240px;
  }
  .top-bar-inner {
    flex-direction: column;
    text-align: center;
  }
}
