/* CSS Document */
/* =========================================================
   LITTER PEDIGREE
   Compact four-generation pedigree tree
   ========================================================= */

.pedigree {
  width: 100%;
  max-width: 850px;
  margin: 40px auto;
  font-family: Georgia, serif;
}

.pedigree h2.pedigree-title {
  font-size: 22px !important;
  line-height: 1.2 !important;
  font-weight: normal !important;
  margin: 0 0 25px !important;
  text-align: center;
  color: #6b4b2a;
}
.pedigree-line {
  margin-bottom: 45px;
}

.pedigree-line-title {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: 1px;
  text-align: center;
  color: #6b4b2a;
}

/* Four generations */
.pedigree-grid {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.25fr)
    minmax(180px, 1.25fr)
    minmax(180px, 1.25fr)
    minmax(180px, 1.25fr);

  grid-template-rows: repeat(8, minmax(70px, auto));

  gap: 6px;
  align-items: stretch;
}

/* Dog card */
.pedigree-card {
  position: relative;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  min-width: 0;
  min-height: 70px;

  padding: 10px;

  box-sizing: border-box;

  background: #faf9f6;
  border: 1px solid #d8cfc2;
  border-radius: 3px;

  text-align: center;
  line-height: 1.2;

  overflow: visible;
}

/* Connection toward the next generation */
.pedigree-card:not(.last)::after {
  content: "";

  position: absolute;
  top: 50%;
  right: -7px;

  width: 7px;
  height: 1px;

  background: #b9aa98;
}

/* Generation 1 */
.gen-1 {
  grid-column: 1;
  grid-row: 1 / span 8;
}

/* Generation 2 */
.gen-2a {
  grid-column: 2;
  grid-row: 1 / span 4;
}

.gen-2b {
  grid-column: 2;
  grid-row: 5 / span 4;
}

/* Generation 3 */
.gen-3a {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.gen-3b {
  grid-column: 3;
  grid-row: 3 / span 2;
}

.gen-3c {
  grid-column: 3;
  grid-row: 5 / span 2;
}

.gen-3d {
  grid-column: 3;
  grid-row: 7 / span 2;
}

/* Generation 4 */
.gen-4a {
  grid-column: 4;
  grid-row: 1;
}

.gen-4b {
  grid-column: 4;
  grid-row: 2;
}

.gen-4c {
  grid-column: 4;
  grid-row: 3;
}

.gen-4d {
  grid-column: 4;
  grid-row: 4;
}

.gen-4e {
  grid-column: 4;
  grid-row: 5;
}

.gen-4f {
  grid-column: 4;
  grid-row: 6;
}

.gen-4g {
  grid-column: 4;
  grid-row: 7;
}

.gen-4h {
  grid-column: 4;
  grid-row: 8;
}

/* Generation label */
.pedigree-generation {
  position: absolute;

  top: 5px;
  left: 7px;

  font-size: 9px;
  color: #9b8d7d;

  text-transform: uppercase;
}

/* Dog photo */
.pedigree-photo {
  width: 150px;
  max-width: 100%;

  margin: 0 auto 8px;
}

.pedigree-photo img {
  display: block;

  width: 150px;
  max-width: 100%;
  height: auto;

  max-height: 200px;

  object-fit: contain;

  margin: 0 auto;
}

/* Dog name */
.pedigree-name {
  width: 100%;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 5px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.pedigree-title-text {
  width: 100%;
  margin-top: 3px;
  font-size: 10px;
  font-weight: normal;
  line-height: 1.2;
  color: #665b50;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
/* Mobile */
@media (max-width: 900px) {

  .pedigree {
    width: 100%;
    max-width: 100%;
    margin: 25px auto;
    overflow-x: visible;
  }

  .pedigree-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  .pedigree-card {
    min-width: 0;
    min-height: 50px;
    padding: 4px;
  }

  .pedigree-photo {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 4px;
  }

  .pedigree-photo img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    margin: 0 auto;
  }

  .pedigree-name {
    width: 100%;
    font-size: 8px;
    line-height: 1.1;
    margin-top: 2px;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .pedigree-title-text {
    width: 100%;
    margin-top: 2px;
    font-size: 7px;
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .pedigree-generation {
    top: 3px;
    left: 4px;
    font-size: 6px;
  }
}