/* ============================================================
   Histoire de Saint-Marcel — Haute-Saône (70500)
   ============================================================ */

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

:root {
  --navy:   #1e2d40;
  --stone:  #7a6248;
  --gold:   #b5954a;
  --cream:  #f8f4ed;
  --white:  #ffffff;
  --text:   #2a2a2a;
  --muted:  #666;
  --border: #ddd4c4;
  --nav-w:  260px;
}

/* ---------- Base ---------- */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
}

a { color: var(--stone); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; }

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

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; top: -40px; left: 1rem;
  background: var(--navy); color: #fff; padding: .4rem .8rem;
  border-radius: 0 0 4px 4px; z-index: 9999;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1.5rem;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.site-logo img {
  height: 56px;
  width: auto;
}

.site-logo .brand {
  display: flex;
  flex-direction: column;
}

.site-logo .brand-name {
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: .04em;
  color: #fff;
  line-height: 1.2;
}

.site-logo .brand-sub {
  font-size: .72rem;
  color: #adc4d8;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- Hamburger button (mobile) ---------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   LAYOUT: sidebar + content
   ============================================================ */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  padding: 0 1rem 3rem;
  gap: 2rem;
}

/* ============================================================
   SIDEBAR / NAV
   ============================================================ */
.site-nav {
  flex: 0 0 var(--nav-w);
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 1.25rem 0 2rem;
}

.site-nav ul { list-style: none; }

.site-nav > ul > li { border-bottom: 1px solid var(--border); }

.site-nav a {
  display: block;
  padding: .55rem 1rem;
  font-size: .88rem;
  color: var(--text);
  transition: background .15s, color .15s;
  line-height: 1.35;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--navy);
  color: #fff;
  text-decoration: none;
}

.site-nav a.active {
  font-weight: bold;
  border-left: 3px solid var(--gold);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.site-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 0;
}

/* ---------- Page title ---------- */
.page-title {
  font-size: 1.9rem;
  color: var(--navy);
  border-bottom: 3px solid var(--gold);
  padding-bottom: .5rem;
  margin-bottom: 1.75rem;
  line-height: 1.25;
}

/* ---------- Paragraphs & headings inside content ---------- */
.content p {
  margin-bottom: 1.1rem;
  text-align: justify;
  hyphens: auto;
}

.content h2 {
  font-size: 1.3rem;
  color: var(--navy);
  margin: 2rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: 1.1rem;
  color: var(--stone);
  margin: 1.5rem 0 .5rem;
}

.content ul, .content ol {
  margin: .75rem 0 1rem 1.5rem;
}

.content li { margin-bottom: .3rem; }

/* ---------- Images in content ---------- */
.img-block {
  margin: 1.75rem 0;
  text-align: center;
}

.img-block img {
  margin: 0 auto;
  max-width: 100%;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.img-block figcaption {
  margin-top: .5rem;
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Gallery grid ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  transition: opacity .2s;
}

.gallery img:hover { opacity: .9; }

.gallery figcaption {
  font-size: .78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .35rem;
  text-align: center;
}

/* ---------- Inscription blocks ---------- */
.inscription {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  padding: .75rem 1rem;
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  font-size: .88rem;
  color: #3a3a3a;
  line-height: 1.6;
}

/* ---------- Table (population stats) ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: .88rem;
}

.data-table th {
  background: var(--navy);
  color: #fff;
  padding: .5rem .75rem;
  text-align: left;
}

.data-table td {
  padding: .4rem .75rem;
  border-bottom: 1px solid var(--border);
}

.data-table tr:nth-child(even) td { background: rgba(0,0,0,.03); }

/* ---------- Intro / quote block ---------- */
.intro-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ---------- Home hero ---------- */
.hero {
  position: relative;
  margin-bottom: 2rem;
  border-radius: 4px;
  overflow: hidden;
}

.hero img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

.hero-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(30,45,64,.65);
  color: #fff;
  padding: .5rem 1rem;
  font-size: .82rem;
  font-style: italic;
}

/* ---------- Before / After comparison ---------- */
.before-after-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 600px) {
  .before-after-grid { grid-template-columns: 1fr; }
}

/* ---------- Contact form ---------- */
.contact-form label {
  display: block;
  font-size: .9rem;
  margin-bottom: .3rem;
  font-weight: bold;
  color: var(--navy);
}

.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  margin-bottom: 1rem;
}

.contact-form textarea { min-height: 160px; resize: vertical; }

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  padding: .6rem 1.4rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: .95rem;
  font-family: inherit;
  transition: background .2s;
}

.btn:hover { background: var(--stone); color: #fff; text-decoration: none; }

/* ---------- Patronyms list ---------- */
.patronymes {
  columns: 3;
  column-gap: 1.5rem;
  list-style: none;
  font-size: .88rem;
  line-height: 1.8;
  margin: 1rem 0;
}

@media (max-width: 700px) {
  .patronymes { columns: 2; }
}

@media (max-width: 450px) {
  .patronymes { columns: 1; }
}

/* ---------- Visitor contribution ---------- */
.contribution {
  border-top: 2px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 2rem;
}

.contribution-header {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--navy);
  color: #b0c4d4;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-top: 3rem;
  font-size: .85rem;
  line-height: 1.8;
}

.site-footer a { color: #c8d8e4; }
.site-footer a:hover { color: #fff; }

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root { --nav-w: 220px; }
}

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

  .site-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 200;
    background: var(--cream);
    box-shadow: 4px 0 20px rgba(0,0,0,.25);
    padding: 5rem 0 2rem;
    overflow-y: auto;
  }

  .site-nav.open { display: block; }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }

  .nav-overlay.open { display: block; }

  .page-wrap { flex-direction: column; padding: 0 .75rem 2rem; }

  .site-content { padding: 1.25rem 0; }

  .page-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
