/* Hevosen esittely */
.horse-page {
  position: relative;
  z-index: 2;
  width: 1180px;
  margin: -590px auto 54px;
  font-size: 15px;
}

.horse-page a {
  color: var(--link-amber);
  text-decoration: none;
  transition: color .2s ease;
}

.horse-page a:hover {
  color: var(--petrol);
}

/* Esikatselupalvelimen VRL-ilmoitus ei kuulu varsinaiseen sivuasetteluun. */
.horse-page > [data-preview-recorded-vrl] {
  display: none !important;
}

.horse-dossier,
.horse-sheet-section {
  margin-bottom: 30px;
  background: var(--paper);
  border: 1px solid rgba(36, 73, 75, .08);
  box-shadow: 0 14px 36px rgba(60, 59, 43, .09);
  scroll-margin-top: 24px;
}

.horse-overview {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 54px;
  padding: 38px 50px;
  background: var(--petrol);
  color: #fff;
}

.horse-overview-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: grayscale(1) contrast(1.05);
  mix-blend-mode: luminosity;
}

.horse-overview::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(25, 57, 59, .93), rgba(36, 73, 75, .83));
  pointer-events: none;
}

.horse-basics {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.horse-basics h2 {
  margin: 0 0 15px;
  color: var(--amber-light);
  font: 400 41px/1.15 var(--heading);
}

.horse-basics p {
  margin: 0 0 5px;
  color: #F4F3ED;
  font: italic 400 19px/1.3 var(--display);
}

.horse-basics .horse-breed {
  margin-bottom: 7px;
  font-size: 23px;
}

.horse-basics .horse-registry {
  margin: 17px 0 0;
  font-size: 15px;
}

.horse-basics .horse-people {
  margin-top: 17px;
}

.horse-overview a {
  color: var(--amber-light);
}

.horse-overview a:hover {
  color: #FFE0A0;
}

.horse-overview a:focus-visible,
.horse-overview button:focus-visible {
  outline: 2px solid var(--amber-light);
  outline-offset: 5px;
}

.country-flag {
  display: inline-block;
  width: 20px;
  height: 15px;
  margin-left: 7px;
  vertical-align: -2px;
  border-radius: 1px;
}

.genotype {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 4px;
  vertical-align: 1px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: 600 12px/14px Georgia, serif;
  text-align: center;
  cursor: help;
}

.genotype::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: var(--petrol);
  color: #fff;
  box-shadow: 0 4px 12px rgba(10, 26, 27, .18);
  font: 400 13px/1.4 var(--body);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.genotype:hover::after,
.genotype:focus::after {
  opacity: 1;
  visibility: visible;
}

.horse-main-photo {
  position: relative;
  overflow: hidden;
  height: 350px;
  width: max-content;
  max-width: 100%;
  justify-self: center;
  margin: 0;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(8, 24, 25, .22);
}

.horse-main-photo a {
  display: block;
  height: 350px;
}

.horse-main-photo img {
  display: block;
  width: auto;
  height: 350px;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
}

.horse-story {
  display: flow-root;
  padding: 34px 40px 38px;
}

.horse-grade {
  float: right;
  width: 110px;
  margin: 0 0 16px 26px;
}

.horse-grade img {
  display: block;
  width: 100%;
  height: auto;
}

.horse-sheet-section {
  padding: 32px 34px 34px;
}

.horse-sheet-section h2,
.horse-story h2 {
  margin: 0 0 22px;
  color: var(--petrol);
  font: 400 32px/1.2 var(--heading);
}

.horse-sheet-section p,
.horse-story p {
  margin: 0 0 15px;
  line-height: 1.7;
}

.horse-story .horse-history {
  margin: 0 0 20px 20px;
  color: #7A817D;
  font-style: italic;
}

/* Meriitit liittyvät suoraan perustietoihin ja tekstialueeseen. */
.horse-merit-strip {
  display: flex;
  justify-content: center;
  gap: 76px;
  padding: 8px 24px;
  margin: 0;
  background: var(--petrol);
  text-align: center;
}

.horse-merit-strip dt {
  color: #fff;
  font: 400 12px/1.3 var(--body);
}

.horse-merit-strip dd {
  margin: 2px 0 0;
  color: var(--amber-light);
  font: 600 15px/1.3 var(--body);
}

.horse-merit-strip small {
  display: block;
  margin-top: 2px;
  color: #fff;
  font: 400 11px/1.3 var(--body);
}

.pedigree-notes {
  display: block;
  margin: 28px 22px 0;
}

.pedigree-notes p:last-child {
  margin-bottom: 0;
}

/* Jalostus ja jälkeläiset */
.breeding-terms {
  display: grid;
  grid-template-columns: 1.15fr 1.3fr 1.25fr;
  gap: 32px;
  padding: 22px 24px;
  margin-bottom: 22px;
  background: rgba(36, 73, 75, .035);
}

.breeding-terms dl {
  margin: 0;
}

.breeding-terms dt {
  margin-bottom: 5px;
  color: var(--amber-ink);
  font-weight: 600;
}

.breeding-terms dd {
  margin: 0;
  line-height: 1.55;
}

.breeding-terms small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.breeding-fees {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-content: start;
  gap: 8px 18px;
}

.breeding-fees dt {
  margin: 0;
  line-height: 1.55;
}

.breeding-fees dd {
  color: #AF4237;
  font-weight: 600;
}

.breeding-fees small {
  font-weight: 400;
}

.inheritance-list {
  margin: 0;
  padding-left: 15px;
  list-style: "– ";
}

.inheritance-list li + li {
  margin-top: 3px;
}

.offspring-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.offspring-list li {
  display: grid;
  grid-template-columns: 120px 28px 1fr .85fr 1.4fr .75fr;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.offspring-list time {
  color: var(--muted);
}

.offspring-list b {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--petrol);
  background: #E5E7DD;
  text-align: center;
  font-size: 13px;
  line-height: 26px;
}

.offspring-list > li > a {
  color: var(--petrol);
  font: 400 22px/1.3 var(--heading);
}

.offspring-list > li > a:hover,
.offspring-list > li > a:focus-visible {
  color: var(--amber-ink);
}

.offspring-list p {
  margin: 0;
  line-height: 1.6;
}

.offspring-list small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.offspring-merits {
  color: var(--amber-ink);
}

/* Yhteinen päiväkirja- ja valmennusikkuna */
.journal-scroll {
  height: 420px;
  overflow-y: auto;
  padding: 25px 28px;
  background: rgba(36, 73, 75, .025);
  border: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--petrol) #E6E1D5;
}

.journal-scroll article + article {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.journal-entry-heading {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 12px;
}

.journal-entry-heading time {
  color: var(--muted);
  font: 400 14px/1.4 var(--body);
}

.journal-entry-heading h3 {
  margin: 0;
  color: var(--petrol);
  font: 400 18px/1.4 var(--heading);
}

.journal-entry-heading .journal-tag {
  padding: 3px 9px;
  margin: 0 0 0 auto;
  border-radius: 4px;
  background: rgba(36, 73, 75, .08);
  color: var(--petrol);
  font: 500 12px/1.5 var(--body);
}

.journal-scroll p:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .horse-page a {
    transition: none;
  }
}

/* Kuvagalleria */
/* Kuvat pysyvät samalla rivillä ja säilyttävät oman kuvasuhteensa. */
.horse-gallery {
  --gallery-height: 180px;
  --gallery-max-height: 180px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  margin: 34px 0;
}

.horse-gallery a {
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 7px 18px rgba(36, 73, 75, .14);
}

.horse-gallery > .horse-media-image {
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 7px 18px rgba(36, 73, 75, .14);
}

.horse-main-placeholder { width: 280px; height: 350px; display: grid; place-items: center; }
.pedigree-table .pedigree-name { color: var(--petrol); font-family: var(--heading); }

.horse-gallery img {
  display: block;
  width: auto;
  height: var(--gallery-height);
  max-width: none;
}

.horse-gallery a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}

/* Sukutaulu */
/* Sukutaulun vaakaviivat erottavat isän ja emän sukuhaarat. */
.pedigree-table {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto 28px;
  table-layout: fixed;
  border-collapse: collapse;
}

.pedigree-table td {
  height: 44px;
  padding: 4px 18px;
  text-align: center;
  vertical-align: middle;
}

/* The database template has no divider classes, so also select branch
   boundaries directly from the eight rows of the three-generation pedigree. */
.pedigree-table .pedigree-divider,
.pedigree-table > tbody > tr:first-child > td[rowspan="4"],
.pedigree-table > tbody > tr:nth-child(-n+5) > td[rowspan="2"],
.pedigree-table > tbody > tr:nth-child(2n):not(:last-child) > td:last-child {
  border-bottom: 1px solid rgba(36, 73, 75, .16);
}

.pedigree-table a {
  color: var(--petrol);
  font-family: var(--heading);
  font-size: 16px;
  line-height: 1.15;
  text-transform: uppercase;
}

.pedigree-table td[rowspan="2"] a {
  font-size: 18px;
}

.pedigree-table td[rowspan="4"] a {
  font-size: 20px;
}

.pedigree-table a:hover,
.pedigree-table a:focus-visible {
  color: var(--link-amber);
}

.pedigree-table .pedigree-evm {
  color: var(--petrol);
  font: 400 16px/1.15 var(--heading);
  text-transform: uppercase;
}

.pedigree-evm sup {
  margin-left: 3px;
  color: var(--amber-ink);
  font: 500 10px/1 var(--body);
  text-transform: lowercase;
}

.pedigree-table small {
  display: block;
  text-transform: none;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 11.5px;
  line-height: 1.25;
}

/* Sukutaulun meriitit näkyvät metadatan alla pienellä korostevärillä. */
.pedigree-table small.pedigree-merits {
  min-height: 1.15em;
  margin-top: 4px;
  color: var(--amber-ink);
  font: 700 10px/1.15 var(--body);
  letter-spacing: .02em;
}

.pedigree-table small.pedigree-merits-empty {
  visibility: hidden;
}

/* Arkistotyyliset välilehdet */
.horse-tabs {
  display: flex;
  gap: 5px;
}

.horse-tabs button {
  position: relative;
  margin: 0 0 -1px;
  padding: 7px 17px;
  border: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: rgba(36, 73, 75, .045);
  color: var(--petrol);
  font: 400 21px/1.3 var(--heading);
  cursor: pointer;
}

.horse-tabs button[aria-selected="true"] {
  z-index: 1;
  border-bottom-color: var(--paper);
  background: var(--paper);
}

.horse-tabs button:hover {
  color: var(--link-amber);
}

.horse-tabs button:focus-visible,
.horse-tab-panel:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.horse-tab-panel {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 0 7px 7px 7px;
  background: var(--paper);
}

.horse-tab-panel[hidden] {
  display: none;
}

/* Hoito ja varusteet säilyvät saman korkuisina sisältömäärästä riippumatta. */
.horse-care {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 402.5px;
  overflow: hidden;
  padding: 0;
  font-size: 15px;
}

.horse-care-notes,
.horse-equipment {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px 30px 26px;
}

.horse-care-notes > .horse-tabs {
  flex: 0 0 auto;
}

.horse-care-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--petrol) rgba(36, 73, 75, .08);
}

.horse-care-list {
  margin: 0;
  padding-left: 19px;
}

.horse-care-list li {
  padding-left: 3px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.horse-care-list li:last-child {
  margin-bottom: 0;
}

.horse-care-list li::marker {
  content: "◇  ";
  color: var(--amber);
  font-size: 12px;
}

.horse-equipment {
  position: relative;
  isolation: isolate;
  background: var(--petrol);
  text-align: center;
}

.horse-equipment-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: grayscale(1) contrast(1.05);
  mix-blend-mode: luminosity;
}

.horse-equipment::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(36, 73, 75, .86);
  pointer-events: none;
}

.horse-equipment h2 {
  flex: 0 0 auto;
  margin: 7px 0 20px;
  color: #fff;
  font: 400 21px/1.3 var(--heading);
}

.horse-equipment-items {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: flex-start;
  gap: 14px 18px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .55) rgba(255, 255, 255, .1);
}

.horse-equipment-items a {
  display: block;
  max-width: 100%;
}

.horse-equipment-items img {
  display: block;
  width: auto;
  height: 110px;
  max-width: 100%;
  object-fit: contain;
}

/* Palkintoruusukkeet porrastettujen ja kilpailulistauksen välissä. */
.competition-rosettes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 18px;
  margin: 22px 0;
}

.competition-rosettes > a,
.competition-rosettes > .horse-media-image {
  display: block;
  max-width: 100%;
}

.competition-rosettes img {
  display: block;
  width: auto;
  height: 110px;
  max-width: 100%;
  object-fit: contain;
}

.competition-panel {
  padding: 20px 12px;
}

.competition-group + .competition-group {
  margin-top: 26px;
}

.competition-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.competition-heading h3 {
  margin: 0;
  color: var(--petrol);
  font: 400 18px/1.4 var(--heading);
}

.competition-heading .competition-count {
  margin: 0;
  color: var(--muted);
  font: italic 400 13px/1.4 var(--body);
}

.competition-group .competition-lines {
  columns: 3;
  column-gap: 8px;
  column-fill: balance;
  margin: 0;
  font: 12px/1.75 var(--body);
  letter-spacing: -.027em;
  white-space: nowrap;
}

.competition-lines strong {
  color: #AF4237;
  font-weight: 700;
}

/* Tarinalliset kilpailut ja palkintogalleria */
.story-competition-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 24px;
}

.story-competition-table {
  width: auto;
  max-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0 3px;
  font: 13px/1.5 var(--body);
}

.story-competition-table col {
  width: auto;
}

.story-competition-table th,
.story-competition-table td {
  padding: 8px 12px;
  box-sizing: border-box;
  vertical-align: middle;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.story-competition-table th:first-child,
.story-competition-table td:first-child,
.story-competition-table td:nth-child(2),
.story-competition-table td:nth-child(3),
.story-competition-table td:last-child {
  white-space: nowrap;
}

.story-competition-table th {
  color: var(--muted);
  font: 500 10px/1.5 var(--body);
}

.story-competition-table tbody tr:nth-child(even) td {
  background: rgba(36, 73, 75, .035);
}

.story-competition-table tbody td:first-child {
  border-radius: 6px 0 0 6px;
}

.story-competition-table tbody td:last-child {
  border-radius: 0 6px 6px 0;
}

.story-competition-table img {
  display: block;
  width: 20px;
  height: 15px;
}

.story-competition-table th {
  padding-top: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(36, 73, 75, .12);
  font-size: 11px;
}

.story-competition-table .story-event {
  color: var(--petrol);
  font: italic 400 16px/1.25 var(--display);
}

.story-competition-table b {
  color: var(--petrol);
  font-weight: 600;
}

.story-competition-table strong {
  color: #AF4237;
  font-weight: 700;
}

.story-awards {
  align-self: stretch;
  padding: 24px 22px;
  border-radius: 6px;
  background: rgba(36, 73, 75, .035);
  color: var(--ink);
  text-align: center;
}

.story-awards h3 {
  margin: 0 0 20px;
  color: var(--petrol);
  font: 400 21px/1.3 var(--heading);
}

.story-awards-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 18px;
}

.story-awards-items a {
  display: block;
  max-width: 100%;
}

.story-awards-items img {
  display: block;
  width: auto;
  height: 110px;
  max-width: 100%;
  object-fit: contain;
}

.graded-summary {
  position: relative;
  isolation: isolate;
  width: 66.666%;
  overflow: hidden;
  margin: 0 auto 32px;
  padding: 18px 32px;
  border-radius: 6px;
  background: var(--petrol);
  color: #fff;
  text-align: center;
}

.graded-summary-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  filter: grayscale(1) contrast(1.05);
  mix-blend-mode: luminosity;
}

.graded-summary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(36, 73, 75, .82);
  pointer-events: none;
}

.graded-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.graded-summary h3 {
  margin: 0;
  color: #fff;
  font: 400 24px/1.2 var(--heading);
}

.graded-summary .graded-level {
  margin: 0;
  color: #fff;
  font: 700 24px/1.2 var(--heading);
}

.graded-level small {
  margin-left: 7px;
  color: var(--amber-light);
  font: 400 13px/1.4 var(--body);
}

.graded-progress-row {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  align-items: center;
  gap: 10px;
}

.graded-progress-row p {
  margin: 0;
  color: #fff;
  font: 400 13px/1.4 var(--body);
}

.graded-summary progress {
  display: block;
  width: 100%;
  height: 9px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .2);
  color: var(--amber-light);
}

.graded-summary progress::-webkit-progress-bar {
  border-radius: 8px;
  background: rgba(255, 255, 255, .2);
}

.graded-summary progress::-webkit-progress-value {
  border-radius: 8px;
  background: var(--amber-light);
}

.graded-summary progress::-moz-progress-bar {
  border-radius: 8px;
  background: var(--amber-light);
}

.graded-properties {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 12px 0 0;
  font: 12px/1.4 var(--body);
}

.graded-properties > div {
  display: flex;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.graded-properties dt {
  color: #fff;
}

.graded-properties dd {
  margin: 0;
  color: var(--amber-light);
  font-weight: 600;
}

/* Merkintöjen teksti ja kirjoittajan allekirjoitus */
.journal-scroll .journal-entry-body p {
  font-size: 14px;
  line-height: 1.55;
}

.journal-signoff {
  margin-top: 18px;
  text-align: right;
}

.journal-scroll .journal-signature {
  margin: 0 0 4px;
  color: var(--petrol);
  font: 400 29px/1 "bickham-script-pro-3", cursive;
}

.journal-scroll .journal-word-count {
  margin: 0;
  color: var(--muted);
  font: 400 11.5px/1.4 var(--body);
}

.horse-page .horse-copyrights {
  margin: 0;
  padding: 30px 24px;
  color: var(--ink);
  text-align: center;
  font: italic 400 12px/1.5 var(--body);
  overflow-wrap: anywhere;
}

.horse-page-template {
  margin-bottom: 0;
}

.horse-page-template > .horse-sheet-section:last-of-type {
  margin-bottom: 0;
}

.horse-page-template ~ .footer {
  margin-top: 0;
}

.horse-page .horse-copyrights p {
  margin: 0;
  font: inherit;
}

.horse-page .horse-copyrights p + p {
  margin-top: 4px;
}

/* Kuvien lightbox */
.photo-lightbox {
  width: max-content;
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 60px);
  padding: 18px 64px 14px;
  border: 1px solid rgba(237, 192, 102, .25);
  border-radius: 5px;
  background: #173638;
  color: #fff;
  overflow: visible;
}

.photo-lightbox::backdrop {
  background: rgba(10, 26, 27, .88);
}

.photo-lightbox figure {
  margin: 0;
}

.photo-lightbox img {
  max-width: calc(100vw - 240px);
  max-height: calc(100vh - 150px);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.photo-lightbox figcaption {
  margin-top: 12px;
  text-align: center;
  font: 400 14px/1.5 var(--body);
}

.photo-lightbox button {
  position: absolute;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: 400 26px/34px var(--body);
  cursor: pointer;
}

.photo-lightbox button:hover {
  color: var(--amber-light);
  border-color: var(--amber-light);
}

.photo-lightbox button:focus-visible {
  outline: 2px solid var(--amber-light);
  outline-offset: 4px;
}

.lightbox-close {
  top: 10px;
  right: 12px;
}

.lightbox-prev,
.lightbox-next {
  top: calc(50% - 18px);
}

.lightbox-prev {
  left: 14px;
}

.lightbox-next {
  right: 14px;
}

.lightbox-counter {
  position: absolute;
  bottom: 18px;
  left: 18px;
  margin: 0;
  color: var(--amber-light);
  font-size: 12px;
}


.exhibition-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 24px;
}

.exhibition-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 3px;
  font: 13px/1.5 var(--body);
}

.exhibition-table .exhibition-date {
  width: 94px;
}

.exhibition-table .exhibition-venue {
  width: 150px;
}

.exhibition-table .exhibition-class {
  width: 140px;
}

.exhibition-table .exhibition-judge {
  width: 140px;
}

.exhibition-table th,
.exhibition-table td {
  padding: 6px 8px;
  vertical-align: middle;
  text-align: left;
}

.exhibition-table th {
  color: var(--muted);
  font: 500 10px/1.5 var(--body);
}

.exhibition-table tbody tr:nth-child(even) td {
  background: rgba(36, 73, 75, .035);
}

.exhibition-table tbody td:first-child {
  border-radius: 6px 0 0 6px;
}

.exhibition-table tbody td:last-child {
  border-radius: 0 6px 6px 0;
}

.exhibition-table time {
  white-space: nowrap;
}

.exhibition-table b {
  color: var(--petrol);
  font-weight: 600;
}

.exhibition-awards {
  padding: 24px 22px;
  border-radius: 6px;
  background: rgba(36, 73, 75, .035);
}

.exhibition-awards h3 {
  margin: 0 0 18px;
  color: var(--petrol);
  text-align: center;
  font: 400 21px/1.3 var(--heading);
}

.exhibition-award {
  color: var(--ink);
  font: 13px/1.5 var(--body);
}

.exhibition-award + .exhibition-award {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(36, 73, 75, .11);
}

.exhibition-award .exhibition-award-line {
  margin: 0 0 5px;
  font: 15px/1.5 var(--body);
}

.exhibition-award-line b {
  color: var(--amber-ink);
  font-weight: 600;
}

.exhibition-award .exhibition-award-date {
  margin: 0 0 5px;
  font: 13px/1.5 var(--body);
}

.exhibition-award .exhibition-award-points {
  margin: 0;
  color: var(--muted);
  font: 12.5px/1.5 var(--body);
}

/* Kompaktit ominaisuuspalkit luonnekuvauksen paperitaustalla. */
.horse-traits {
  margin-top: 26px;
}

.traits-heading {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}

.traits-heading[hidden] {
  display: none;
}

.traits-heading h3 {
  margin: 0;
  color: var(--petrol);
  font: 400 18px/1.4 var(--heading);
}

.horse-traits .traits-total {
  margin: 0;
  color: var(--muted);
  font: italic 400 13px/1.4 var(--body);
  font-variant-numeric: tabular-nums;
}

.horse-traits .traits-status {
  margin: 0 0 14px;
  color: var(--muted);
  font: italic 400 12px/1.5 var(--body);
}

.traits-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 42px;
}

.traits-columns[hidden] {
  display: none;
}

.traits-column {
  display: flex;
}

.traits-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  margin: 0;
}

.trait-row,
.trait-heading {
  --trait-fill: #AEB6B0;
  --trait-track: #F0F2ED;
  display: grid;
  align-items: center;
  min-width: 0;
}

.trait-row {
  grid-template-columns: 140px minmax(50px, 1fr) 118px;
  column-gap: 12px;
}

.trait-heading {
  grid-template-columns: 1fr 118px;
  gap: 4px 12px;
  padding-bottom: 4px;
}

.trait-row dt,
.trait-heading dt {
  color: var(--ink);
  font: 400 15px/1.45 var(--body);
}

.trait-row dd,
.trait-heading dd {
  min-width: 0;
  margin: 0;
}

.trait-heading dt,
.trait-category dt {
  color: var(--petrol);
  font-weight: 600;
}

.trait-heading .trait-meter {
  grid-column: 1 / -1;
}

.trait-category {
  margin-top: auto;
  padding-top: 6px;
}

.trait-weak {
  --trait-fill: #B75A4E;
  --trait-track: #FAEFED;
}

.trait-moderate {
  --trait-fill: #CA9146;
  --trait-track: #FBF2E6;
}

.trait-good {
  --trait-fill: #A3A35B;
  --trait-track: #F5F5E9;
}

.trait-excellent {
  --trait-fill: #41674B;
  --trait-track: #EDF3EE;
}

.horse-traits progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  appearance: none;
  background: var(--trait-track);
  color: var(--trait-fill);
}

.horse-traits progress::-webkit-progress-bar {
  border-radius: 3px;
  background: var(--trait-track);
}

.horse-traits progress::-webkit-progress-value {
  border-radius: 3px;
  background: var(--trait-fill);
}

.horse-traits progress::-moz-progress-bar {
  border-radius: 3px;
  background: var(--trait-fill);
}

.trait-rating {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.trait-heading .trait-rating {
  justify-content: flex-end;
}

.trait-rating b {
  color: var(--petrol);
  font: 600 13px/1.4 var(--body);
  font-variant-numeric: tabular-nums;
}

.trait-rating small {
  color: var(--muted);
  font: 400 12px/1.4 var(--body);
}

.horse-traits .traits-source {
  margin: 9px 0 0;
  font: 400 12px/1.4 var(--body);
  text-align: right;
}

/* Uusien hevosten pääkuvat näkyvät kokonaisina samassa kiinteässä kuva-alassa. */
.horse-page-template .horse-main-photo,
.horse-page-template .horse-main-photo img { height: 350px; }
.horse-merit-strip-empty { min-height: 66px; align-items: center; }
.horse-merit-strip-empty dd { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.horse-gallery-placeholder p { margin: 0; color: var(--muted); font-style: italic; }

/* Pääkuva on pelkkä kuva. Ainoastaan © avaa lähdetiedot. Kuvasuhde säilyy. */
.horse-main-photo .horse-main-image { display: block; width: auto; height: 350px; max-width: 100%; object-fit: contain; }
.horse-main-image.horse-photo-flipped { transform: scaleX(-1); }
.photo-credit { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; max-width: calc(100% - 16px); padding: 2px; border-radius: 16px; background: rgba(24, 51, 52, .78); color: #fff; }
.photo-credit-toggle { flex: 0 0 24px; width: 24px; height: 24px; border: 0; padding: 0; border-radius: 50%; background: transparent; color: #fff; font: 400 16px/24px var(--body); cursor: pointer; }
.photo-credit-toggle:hover, .photo-credit-toggle:focus-visible { color: var(--amber-light); }
.photo-credit-content { display: grid; grid-template-columns: 0fr; min-width: 0; max-width: 0; opacity: 0; transition: grid-template-columns .3s ease, max-width .3s ease, opacity .2s ease; }
.photo-credit-inner { overflow: hidden; white-space: nowrap; font: 400 10px/1.35 var(--body); }
.photo-credit-inner > span, .horse-main-photo .photo-credit-inner a { display: block; width: max-content; padding: 0 9px 0 4px; color: #fff; }
.horse-main-photo .photo-credit-inner a { height: auto; text-decoration: none; }
.horse-main-photo .photo-credit-inner a:hover { color: var(--amber-light); }
.photo-credit.is-open .photo-credit-content { grid-template-columns: 1fr; max-width: 260px; opacity: 1; }
.pedigree-table td[rowspan="2"] .pedigree-evm { font-size: 18px; }
.pedigree-table td[rowspan="4"] .pedigree-evm { font-size: 20px; }
.graded-properties > div { white-space: normal; align-items: baseline; }
.graded-properties dd { flex-shrink: 0; }
.graded-status { margin: 8px 0 0; color: #fff; font: 12px/1.4 var(--body); text-align: center; }
.results-status, .results-note { color: var(--muted, #737e7a); font-size: 12px; line-height: 1.4; }
.results-status:empty { display: none; }
.competition-count { flex-shrink: 0; }
.competition-heading { flex-wrap: wrap; }
.competition-lines .competition-entry { display: block; break-inside: avoid; white-space: normal; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .photo-credit-content { transition: none; } }
.horse-overview .horse-deceased { margin:0 0 10px; color:#ecd6a8; font:600 13px/1.5 var(--body); letter-spacing:.07em; }
