:root {
  --parchment:    #f4ead5;
  --parchment-dk: #e0cfa0;
  --ink:          #1c1209;
  --sepia:        #6b4c2a;
  --sepia-lt:     #a07848;
  --rust:         #8b3a1e;
  --gold:         #c9993a;
  --gold-lt:      #e8c870;
  --man-bg:       #daeaf5;
  --man-border:   #3a6e9b;
  --woman-bg:     #f5daea;
  --woman-border: #9b3a6e;
  --speculative:  #e8f0d5;
  --spec-border:  #6e8b3a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--parchment);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  line-height: 1.72;
  letter-spacing: 0.01em;
  padding-bottom: 5rem;
}

/* ─── HEADER ─── */
.page-header {
  background: var(--ink);
  padding: 3rem 3.3rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  flex-wrap: wrap;
  gap: 1.4rem 2rem;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.page-header {
  background: var(--ink);
  padding: 2rem 2.4rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-left h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  color: var(--parchment);
  letter-spacing: 0.08em;
  font-weight: 600;
  line-height: 1.08;
}

.header-left p {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--gold-lt);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.back-link {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sepia-lt);
  text-decoration: none;
  border: 1.5px solid rgba(160,120,72,0.35);
  padding: 0.65rem 1rem;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  align-self: center;
}

.back-link:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ─── LÉGENDE ─── */
.legend {
  display: flex;
  gap: 1.1rem 2.4rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1.25rem 2rem;
  background: rgba(28,18,9,0.05);
  border-bottom: 1px solid var(--parchment-dk);
  font-family: 'Cinzel', serif;
  font-size: 1.32rem;
  letter-spacing: 0.06em;
  line-height: 1.5;
  color: var(--sepia);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ls {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  border: 2px solid;
  flex-shrink: 0;
}

.ls--man {
  background: var(--man-bg);
  border-color: var(--man-border);
}

.ls--woman {
  background: var(--woman-bg);
  border-color: var(--woman-border);
}

.ls--spec {
  background: var(--speculative);
  border-color: var(--spec-border);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(110,139,58,0.15) 3px,
    rgba(110,139,58,0.15) 4px
  );
}

.ls--emigrant {
  background: rgba(201,153,58,0.15);
  border-color: var(--gold);
}

/* ─── WRAPPER ─── */
.tree {
  max-width: 1820px;
  margin: 0 auto;
  padding: 2.4rem 2.2rem 0;
}

/* ─── LABEL GÉNÉRATION ─── */
.gen-label {
  font-family: 'Cinzel', serif;
  font-size: 1.95rem;
  letter-spacing: 0.28em;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 3.2rem 0 1.5rem;
}

.gen-label::before,
.gen-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.gen-label span {
  font-size: 1.8rem;
  color: var(--sepia-lt);
  font-family: 'IM Fell English', serif;
  font-style: italic;
  letter-spacing: 0.10em;
  white-space: nowrap;
  line-height: 1.4;
}

/* ─── COUPLES ─── */
.couple {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1.35rem;
  flex-wrap: nowrap;
}

/* ─── CARTES PERSONNES ─── */
.person {
  width: 430px !important;
  min-height: 380px !important;
  padding: 1.55rem 1.65rem 1.5rem;
  border: 2px solid;
  border-radius: 4px;
  position: relative;
  font-size: 1.46rem;
  transition: box-shadow 0.2s, transform 0.2s;
  box-shadow:
    0 2px 0 rgba(255,255,255,0.18) inset,
    0 10px 26px rgba(28,18,9,0.08);
}

.person:hover {
  transform: translateY(-3px);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.22) inset,
    0 14px 30px rgba(28,18,9,0.14);
}

.person--man {
  background: var(--man-bg);
  border-color: var(--man-border);
}

.person--woman {
  background: var(--woman-bg);
  border-color: var(--woman-border);
}

.person--spec {
  background: var(--speculative);
  border-color: var(--spec-border);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(110,139,58,0.08) 5px,
    rgba(110,139,58,0.08) 6px
  );
}

.person--emigrant {
  background: rgba(201,153,58,0.1);
  border-color: var(--gold);
}

.person--unknown {
  background: rgba(200,190,170,0.35);
  border-color: rgba(107,76,42,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.person--unknown .unknown-q {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 3.6rem;
  color: rgba(107,76,42,0.35);
}

.p-sex {
  font-size: 1.22rem;
  opacity: 0.7;
  margin-bottom: 0.45rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.person--man .p-sex {
  color: var(--man-border);
}

.person--woman .p-sex {
  color: var(--woman-border);
}

.person--spec .p-sex {
  color: var(--spec-border);
}

.person--emigrant .p-sex {
  color: var(--gold);
}

.p-name {
  font-family: 'Cinzel', serif;
  font-size: 1.62rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.28;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.p-dates {
  font-size: 1.7rem;
  color: var(--sepia);
  line-height: 1.5;
}

.p-dates em {
  font-style: normal;
  color: var(--rust);
  font-weight: 600;
}

.p-note {
  font-size: 1.9rem;
  font-style: italic;
  color: var(--sepia-lt);
  line-height: 1.5;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(107,76,42,0.18);
}

.p-src {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.98rem;
  color: var(--rust);
  opacity: 0.75;
  letter-spacing: 0.04em;
}

.badge-emigration {
  display: inline-block;
  margin-top: 0.7rem;
  background: var(--gold);
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 2px;
}

.badge-speculative {
  display: inline-block;
  margin-top: 0.6rem;
  background: var(--spec-border);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  padding: 0.24rem 0.68rem;
  text-transform: uppercase;
  opacity: 0.85;
  border-radius: 2px;
}

/* ─── MARIAGE ─── */
.marriage {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 0;
  align-self: center;
  gap: 0.65rem;
}

.m-ring {
  font-size: 3.4rem;
  color: var(--gold);
  opacity: 0.9;
  line-height: 1;
}

.m-date {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  color: var(--sepia);
  text-align: center;
  line-height: 1.58;
}

/* ─── CONNECTEURS ─── */
.v-line {
  width: 2px;
  background: linear-gradient(to bottom, var(--rust), var(--gold));
  margin: 0 auto;
  opacity: 0.45;
}

.v-line--short {
  height: 2.4rem;
}

.v-line--med {
  height: 3.2rem;
}

.h-bar {
  height: 2px;
  background: linear-gradient(to right, transparent, var(--rust) 20%, var(--rust) 80%, transparent);
  max-width: 1260px;
  margin: 0 auto 1.5rem;
  opacity: 0.3;
}

/* ─── ENFANTS ─── */
.children {
  display: flex;
  justify-content: center;
  gap: 1.55rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.child-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.child-stem {
  width: 1px;
  height: 1.35rem;
  background: var(--rust);
  opacity: 0.35;
}

.children .person {
  width: 320px !important;
  min-height: 240px !important;
  padding: 1.15rem 1.15rem 1.1rem;
  font-size: 1.16rem;
}

.children .person .p-sex {
  font-size: 1rem;
  margin-bottom: 0.38rem;
}

.children .person .p-name {
  font-size: 1.24rem;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.children .person .p-dates {
  font-size: 1.7rem;
  line-height: 1.5;
}

.children .person .p-note {
  font-size: 1.9rem;
  line-height: 1.5;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
}

/* ─── BOÎTES D’INFO ─── */
.info-box {
  max-width: 1280px;
  margin: 1.9rem auto 0;
  padding: 1.45rem 1.8rem;
  font-size: 1.65rem;
  color: var(--sepia);
  line-height: 1.92;
  font-style: italic;
  border-left: 4px solid;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 3px 14px rgba(28,18,9,0.05);
}

.info-box--gold {
  background: rgba(201,153,58,0.07);
  border-color: var(--gold);
}

.info-box--rust {
  background: rgba(139,58,30,0.06);
  border-color: var(--rust);
}

.info-box--green {
  background: rgba(110,139,58,0.07);
  border-color: var(--spec-border);
}

.info-box strong {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

.info-box em.hl {
  font-style: normal;
  color: var(--rust);
  font-weight: 600;
}

/* ─── SOURCES ─── */
.sources {
  max-width: 1280px;
  margin: 4rem auto 0;
  padding: 1.9rem 1.8rem 0;
  border-top: 1px solid var(--parchment-dk);
}

.sources h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.46rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sepia-lt);
  margin-bottom: 1.25rem;
}

.sources ol {
  list-style: none;
  counter-reset: src;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sources li {
  counter-increment: src;
  position: relative;
  padding-left: 3.5rem;
  font-size: 1.22rem;
  color: var(--sepia);
  line-height: 1.88;
}

.sources li::before {
  content: "[" counter(src) "]";
  position: absolute;
  left: 0;
  top: 0.16rem;
  font-family: 'Cinzel', serif;
  font-size: 1.02rem;
  color: var(--rust);
}

.sources a {
  color: var(--rust);
  text-decoration: underline;
  text-decoration-color: rgba(139,58,30,0.4);
  text-underline-offset: 0.12em;
}

.sources a:hover {
  color: var(--gold);
}

/* ─── TABLETTE ─── */
@media (max-width: 1280px) {
  body {
    font-size: 28px;
  }

  .tree {
    max-width: 100%;
    padding: 2rem 1.25rem 0;
  }

  .couple {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .person {
    width: 420px !important;
    min-height: 340px !important;
  }

  .p-note {
    font-size: 1.65rem;
  }

  .marriage {
    width: 145px;
  }

  .m-ring {
    font-size: 3rem;
  }

  .children .person {
    width: 280px !important;
    min-height: 220px !important;
  }

  .children .person .p-note {
    font-size: 1.65rem;
  }

  .header-left h1 {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
  }

  .header-left p {
    font-size: 1.65rem;
  }

  .info-box,
  .sources {
    max-width: 100%;
  }
}

/* ─── MOBILE ─── */
@media (max-width: 780px) {
  body {
    font-size: 26px;
    line-height: 1.68;
  }

  .page-header {
    padding: 1.4rem 1rem 1.25rem;
    gap: 0.9rem;
  }

  .header-left h1 {
    font-size: 2.2rem;
    letter-spacing: 0.05em;
    line-height: 1.12;
  }

  .header-left p {
    font-size: 1.35rem;
    line-height: 1.4;
  }

  .back-link {
    font-size: 1rem;
    padding: 0.65rem 0.95rem;
  }

  .legend {
    padding: 1rem;
    font-size: 1.1rem;
    gap: 0.8rem 1rem;
    letter-spacing: 0.03em;
    line-height: 1.45;
  }

  .ls {
    width: 18px;
    height: 18px;
  }

  .tree {
    padding: 1.25rem 0.9rem 0;
  }

  .gen-label {
    font-size: 1.3rem;
    letter-spacing: 0.12em;
    margin: 2rem 0 1rem;
    flex-wrap: wrap;
    line-height: 1.45;
  }

  .gen-label span {
    font-size: 1.15rem;
    white-space: normal;
    letter-spacing: 0.04em;
  }

  .couple {
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
  }

  .person,
  .children .person {
    width: 100% !important;
    max-width: 580px;
    min-height: auto !important;
    padding: 1.05rem 1rem 1rem;
    box-shadow:
      0 2px 0 rgba(255,255,255,0.15) inset,
      0 8px 18px rgba(28,18,9,0.06);
  }

  .p-sex {
    font-size: 1.12rem;
    line-height: 1.25;
  }

  .p-name {
    font-size: 1.45rem;
    line-height: 1.28;
  }

  .p-dates {
    font-size: 1.35rem;
    line-height: 1.48;
  }

  .p-note {
    font-size: 1.5rem;
    line-height: 1.5;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
  }

  .children .person .p-sex {
    font-size: 1.05rem;
  }

  .children .person .p-name {
    font-size: 1.3rem;
  }

  .children .person .p-dates {
    font-size: 1.25rem;
    line-height: 1.45;
  }

  .children .person .p-note {
    font-size: 1.35rem;
    line-height: 1.48;
  }

  .p-src {
    font-size: 0.9rem;
    top: 8px;
    right: 9px;
  }

  .badge-emigration,
  .badge-speculative {
    font-size: 0.95rem;
  }

  .marriage {
    width: auto;
    padding: 0.3rem 0 0.45rem;
    gap: 0.35rem;
  }

  .m-ring {
    font-size: 2.6rem;
  }

  .m-date {
    font-size: 1rem;
    line-height: 1.4;
  }

  .v-line--short {
    height: 1.6rem;
  }

  .v-line--med {
    height: 2rem;
  }

  .children {
    gap: 1rem;
  }

  .child-stem {
    height: 1rem;
  }

  .info-box {
    padding: 1.05rem 1rem;
    font-size: 1.3rem;
    line-height: 1.72;
  }

  .sources {
    padding: 1.4rem 1rem 0;
  }

  .sources h2 {
    font-size: 1.2rem;
    letter-spacing: 0.12em;
  }

  .sources li {
    font-size: 1.12rem;
    line-height: 1.7;
    padding-left: 2.5rem;
  }

  .sources li::before {
    font-size: 0.9rem;
  }
}
