:root {
  --gm-primary: #2f6f4f;
  --gm-primary-dark: #235339;
  --gm-accent: #e0a341;
  --gm-ink: #22302a;
  --gm-muted: #5f6b64;
  --gm-border: #dfe6e0;
  --gm-bg: #f7f9f7;
  --bs-primary: var(--gm-primary);
  --bs-primary-rgb: 47, 111, 79;
}

body {
  background: var(--gm-bg);
  color: var(--gm-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: var(--gm-primary-dark);
}

.btn-primary {
  --bs-btn-bg: var(--gm-primary);
  --bs-btn-border-color: var(--gm-primary);
  --bs-btn-hover-bg: var(--gm-primary-dark);
  --bs-btn-hover-border-color: var(--gm-primary-dark);
  --bs-btn-active-bg: var(--gm-primary-dark);
  --bs-btn-active-border-color: var(--gm-primary-dark);
}

.btn-outline-primary {
  --bs-btn-color: var(--gm-primary);
  --bs-btn-border-color: var(--gm-primary);
  --bs-btn-hover-bg: var(--gm-primary);
  --bs-btn-hover-border-color: var(--gm-primary);
}

.btn.active {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15);
}

/* Vidéo de fond (accueil) */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
}

.bg-video-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(247, 249, 247, .88), rgba(247, 249, 247, .72));
  z-index: -1;
}

@media (prefers-reduced-motion: reduce) {
  .bg-video {
    display: none;
  }

  .bg-video-overlay {
    background: var(--gm-bg);
  }
}

/* Header */
.masthead {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1.5rem 1rem 1rem;
  flex-wrap: wrap;
}

.masthead img {
  height: 64px;
  width: auto;
}

.masthead h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--gm-primary-dark);
  margin: 0;
}

.masthead a {
  display: inline-flex;
  text-decoration: none;
}

.tagline {
  text-align: center;
  color: var(--gm-muted);
  margin-top: -.5rem;
  margin-bottom: 1rem;
  padding: 0 1.25rem;
}

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--gm-bg);
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--gm-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.toolbar-logo {
  display: inline-flex;
  flex: 0 0 auto;
}

.toolbar-logo img {
  height: 34px;
  width: auto;
}

.toolbar-tabs {
  border-bottom: 2px solid var(--gm-border);
  flex: 0 0 auto;
  gap: .25rem;
  flex-wrap: nowrap;
  align-items: flex-end;
}

.toolbar-tabs .nav-link {
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--gm-muted);
  font-weight: 600;
  padding: .45rem .9rem;
  white-space: nowrap;
  background: transparent;
  margin-bottom: -2px;
}

.toolbar-tabs .nav-link:hover {
  color: var(--gm-primary-dark);
  background: rgba(47, 111, 79, .06);
}

.toolbar-tabs .nav-link.active {
  color: var(--gm-primary-dark);
  background: #fff;
  border-color: var(--gm-border);
  border-bottom: 2px solid #fff;
}

.toolbar .search-wrap {
  flex: 1 1 200px;
  max-width: 280px;
  margin-left: auto;
}

.toolbar-icons {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 0 0 auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid var(--gm-border);
  background: #fff;
  color: var(--gm-primary-dark);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.icon-btn:hover {
  background: var(--gm-primary);
  border-color: var(--gm-primary);
  color: #fff;
}

@media (max-width: 700px) {
  .toolbar .search-wrap {
    order: 10;
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }

  .toolbar-icons {
    margin-left: auto;
  }
}

/* Cards */
.card {
  border: 1px solid var(--gm-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  margin: 10px 0;
}

.card-title {
  color: var(--gm-primary-dark);
  font-weight: 600;
}

/* Footer */
.footer {
  clear: both;
  padding: 1.5rem 1rem;
  color: var(--gm-muted);
  text-align: center;
}

.footer a {
  color: var(--gm-muted);
  text-decoration: underline;
}

.footer .footer-sep {
  margin: 0 .5rem;
}

/* Legal pages */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.legal-page h5 {
  color: var(--gm-primary-dark);
  margin-top: 1.5rem;
}

/* Onboarding steps */
.steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  padding: 3rem 1rem;
}

.step {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--gm-primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.step-label {
  color: var(--gm-muted);
  font-size: .95rem;
}

@media (max-width: 700px) {
  .steps {
    justify-content: flex-start;
    padding: 2rem 1.25rem;
    gap: 1.75rem;
  }

  .step {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}

/* caption / labels reused from bootstrap */
caption {
  font-size: 1.4em;
}

label {
  margin-bottom: 10px;
}

.input-group {
  margin-bottom: 10px;
}

.input-group-text {
  width: 150px;
}

/* arbre généalogique */
.tree {
  white-space: nowrap;
  clear: both;
  border-top: 2px dashed #a1c6f7;
}

.tree.scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 8px;
  transition: box-shadow .2s;
}

.tree.scroll.tree--match {
  box-shadow: 0 0 0 3px var(--gm-accent);
  border-radius: 8px;
}

.legende {
  white-space: nowrap;
  clear: both;
  border-top: 0px;
}

.tree ul {
  padding-top: 20px;
  display: flex;
  position: relative;
  transition: all 0.5s;
}

.legende ul {
  margin-top: -10px;
  margin-left: -20px;
  padding-top: 0px;
}

.tree li {
  float: left;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 5px 5px 5px;
  transition: all 0.5s;
}

.tree li::before, .tree li::after {
  content: '';
  position: absolute; top: 0; right: 50%;
  border-top: 1px solid #ccc;
  width: 50%; height: 20px;
}
.tree li::after {
  right: auto; left: 50%;
  border-left: 1px solid #ccc;
}

.tree li:only-child::after, .tree li:only-child::before {
  display: none;
}

.tree li:only-child { padding-top: 0; }

.tree li:first-child::before, .tree li:last-child::after {
  border: 0 none;
}
.tree li:last-child::before {
  border-right: 1px solid #ccc;
  border-radius: 0 5px 0 0;
}
.tree li:first-child::after {
  border-radius: 5px 0 0 0;
}

.tree ul ul::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  border-left: 1px solid #ccc;
  width: 0; height: 20px;
}

.tree li a {
  border: 2px solid #ccc;
  padding: 6px 12px;
  text-decoration: none;
  color: #444;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  border-radius: 6px;
  transition: all 0.25s;
  text-align: center;
}

.tree li a .animal-name {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: inherit;
  opacity: .75;
  white-space: nowrap;
  margin-top: 1px;
}

.male {
  border-color: cornflowerblue !important;
}

.femelle {
  border-color: #e8829f !important;
}

.present {
  background-color: #d5f5db;
}

.mort {
  background-color: #d7d7d7;
}

.boucherie {
  background-color: #f3b3ae;
}

.tree li a:hover, .tree li a:hover + ul li a {
  background: #a1c6f7; color: #000; border: 2px solid #94a0b4;
}
.tree li a:hover + ul li::after,
.tree li a:hover + ul li::before,
.tree li a:hover + ul::before,
.tree li a:hover + ul ul::before {
  border-color: #94a0b4;
}

.tree li a.search-hit {
  outline: 3px solid var(--gm-accent);
  outline-offset: 1px;
}

/* misc */
@media (max-width: 1200px) {
  .container {
    margin-left: 0;
    margin-right: 0;
    max-width: 100% !important;
  }
}

.btn {
  margin-bottom: 2px;
}

.btn-sm {
  padding: 0 3px;
}

.pere {
  width: 40px;
}
