@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Nunito:wght@300;400;600&display=swap');

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', 'Calibri', sans-serif;
    font-size: 0.9rem;
    background-color: #eef0f2;
    color: #444444;
    line-height: 25px;
}

/* Layout Container */
.site-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
    min-height: 100vh;
    max-width: 1300px;
    margin: 0 auto;
    background-color: #ffffff;
    border-left: 1px solid #f0eae1;
    border-right: 1px solid #f0eae1;
}

/* --- SIDEBAR --- */
.sidebar {
    background-color: #fdfbf7;
    border-right: 1px solid #f0eae1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    align-self: stretch;
}

.sidebar-image img {
    width: 100%;
    height: auto;
    display: block;
    /* Replicates the gentle organic bottom curve of the profile crop in kuva.jpg */
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.sidebar-content {
    padding: 5px 20px;
    width: 100%;
}

.sidebar-content h2 {
    font-family: 'Lora', serif;
    color: #4a1525;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.5px;
    justify-content: center;
}

.decorative-divider {
    color: #4a1525;
    margin: 10px 0 30px 0;
    font-size: 1.2rem;
}

.navigation ul {
    list-style: none;
}

.navigation li {
    margin-bottom: 15px;
}

.navigation a {
    text-decoration: none;
    color: #6b5b68;
    font-family: 'Nunito', 'Calibri', sans-serif;
    font-size: 1rem;
    font-style: normal;
    transition: color 0.2s;
}

.navigation a:hover, .navigation a.active {
    color: #4a1525;
    font-weight: bold;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 40px;
    font-size: 0.85rem;
    color: #8c7b89;
}

.main-content {
    background-color: #ffffff;
    padding: 40px 5% 0px 5%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-card {
    max-width: 900px;
    margin: 0 auto;
    flex: 1;
}

h1 {
    font-family: 'Lora', serif;
    font-size: 30px;
    color: #4a1525;
    margin-bottom: 30px;
    font-weight: 400;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

h1 span {
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: #aaaaaa;
    letter-spacing: 0.5px;
    line-height: 1;
	padding-left: 20px;
}

h2 {
    font-family: 'Lora', serif;
    font-size: 24px;
    color: #4a1525;
    margin: 40px 0 20px 0;
    font-weight: 400;
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

h2 span {
    font-size: 13px;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: #aaaaaa;
    letter-spacing: 0.5px;
    line-height: 1;
    padding-bottom: 2px;
}

.content-body {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
}

.text-block {
    flex: 1;
}

.text-block p {
    margin-bottom: 20px;
    text-align: justify;
    color: #444444;
}

.content-image {
    width: 320px;
    flex-shrink: 0;
}

.content-image img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

.caption {
    display: block;
    font-size: 13px;
    color: #999999;
    text-align: right;
	letter-spacing: 0.2px;
}

.caption a {
    color: inherit;
    text-decoration: none;
}

/* General body text links */
.main-content a:not(.main-footer a):not(h1 span a):not(h2 span a) {
    color: #4a1525;
    text-decoration-color: #c9a8b0;
	text-decoration: none;
}

.main-content a:not(.main-footer a):not(h1 span a):not(h2 span a):hover {
    color: #6b2040;
    text-decoration-color: #6b2040;
}

/* Links inside h1/h2 spans inherit span styling */
h1 span a,
h2 span a {
    color: #aaaaaa !important;
    font-weight: 400 !important;
    text-decoration: none !important;
}

h1 span a:hover,
h2 span a:hover {
    color: #aaaaaa !important;
}

/* Links inside h1/h2 spans inherit span styling */
.main-content h1 span a,
.main-content h2 span a {
    color: #aaaaaa;
    font-weight: 400;
}

.main-content h1 span a:hover,
.main-content h2 span a:hover {
    color: #aaaaaa;
}

/* Two Column Info Box */
.info-grid {
    background-color: #fdfbf7;
    border: 1px solid #f0eae1;
    padding: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
}

.info-grid2 {
    background-color: #fdfbf7;
    border: 1px solid #f0eae1;
    padding: 25px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    margin-top: 40px;
}

.info-column h3 {
    color: #4a1525;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.info-column ul {
    list-style: none;
}

.info-column li {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #555555;
}

.section-divider {
    border: 0;
    height: 1px;
    background: #eef0f2;
    margin: 50px 0 20px 0;
}

.main-footer {
    margin-top: auto;
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    color: #999999;
    letter-spacing: 0.2px;
    background-color: #ffffff;
    z-index: 10;
}

.main-footer a {
    color: #999999;
    text-decoration: none;
}

/* Horse Info Card */
.horse-card {
    display: flex;
    gap: 30px;
    margin-top: 10px;
    border: 1px solid #f0eae1;
    background-color: #fdfbf7;
    padding: 25px;
    align-items: flex-start;
}

.horse-card-image {
    width: 360px;
    flex-shrink: 0;
}

.horse-card-image img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: block;
    background-color: #e8e2dc;
}

.horse-card-info {
    flex: 1;
    min-width: 0;
}

.horse-name {
    font-family: 'Lora', serif;
    font-size: 1.35rem;
    color: #4a1525;
    margin: 0 0 18px 0;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.horse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.horse-table tbody tr {
    border-bottom: 1px solid #f0eae1;
}

.horse-table tbody tr:last-child {
    border-bottom: none;
}

.horse-table th {
    text-align: left;
    padding: 9px 16px 9px 0;
    color: #7a5f6e;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    width: 38%;
    vertical-align: top;
}

.horse-table td {
    padding: 9px 0;
    color: #444444;
    vertical-align: top;
}

.kuvagalleria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 25px 0;
}

.kuvagalleria a {
    position: relative;
    display: block;
}

.kuvagalleria img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 15px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* HEVOSEN SUKUTAULU */

.sukutaulu-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #f0eae1;
    background-color: #fdfbf7;
    padding: 25px;
    margin-top: 10px;
}

#sukutaulu {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    margin: 0 auto;
    background: none;
}

#sukutaulu td {
    position: relative;
    padding: 9px 16px 9px 0;
    vertical-align: middle;
    text-align: left;
    color: #444444;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    line-height: 140%;
    border: none;
    background: transparent;
}

#sukutaulu tr:nth-child(3) td {
    padding-top: 20px;
}

#sukutaulu a:hover,
.nimi2polvi:hover {
    color: #6b2040;
}

#sukutaulu small {
    display: block;
    margin-top: 3px;
    color: #aaaaaa;
    font-family: 'Nunito', sans-serif;
    font-size: 0.75rem;
    line-height: 135%;
    letter-spacing: 0.2px;
}

#sukutaulu td:last-child {
    padding-left: 28px;
}

#sukutaulu tr:nth-child(1) td:last-child::before,
#sukutaulu tr:nth-child(3) td:last-child::before {
    content: "";
    position: absolute;
    left: 8px;
    bottom: 0;
    width: 10px;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    border-bottom: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu tr:nth-child(2) td:last-child::before,
#sukutaulu tr:nth-child(4) td:last-child::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    width: 0;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu.sukutaulu-3 td {
    position: relative;
}

#sukutaulu.sukutaulu-3 td[rowspan="4"] {
    padding-left: 18px; /* 1. polvi */
}

#sukutaulu.sukutaulu-3 td[rowspan="2"] {
    padding-left: 38px; /* 2. polvi = ii, ie, ei, ee */
}

#sukutaulu.sukutaulu-3 td:not([rowspan]) {
    padding-left: 38px; /* 3. polvi */
}

#sukutaulu.sukutaulu-3 tr:nth-child(1) td:last-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(3) td:last-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(5) td:last-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(7) td:last-child::before {
    content: "";
    position: absolute;
    left: 8px;
    bottom: 0;
    width: 10px;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    border-bottom: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu.sukutaulu-3 tr:nth-child(2) td:only-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(4) td:only-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(6) td:only-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(8) td:only-child::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    width: 0;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu.sukutaulu-3 tr:nth-child(1) td:nth-child(2)::before,
#sukutaulu.sukutaulu-3 tr:nth-child(5) td:nth-child(2)::before {
    content: "";
    position: absolute;
    left: 8px;
    bottom: 0;
    width: 10px;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    border-bottom: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu.sukutaulu-3 tr:nth-child(3) td:first-child::before,
#sukutaulu.sukutaulu-3 tr:nth-child(7) td:first-child::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    width: 10px;
    height: 20px;
    border-left: 1px solid rgba(138, 110, 128, 0.22);
    box-sizing: border-box;
}

#sukutaulu.sukutaulu-3 tr:nth-child(5) td {
    padding-top: 22px;
}

.evm {
  display: inline-block;
  padding: 0px 5px 0px 6px;
  background: #f0eae1;
  color: #7a5f6e;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-left: 8px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* Kilpailutulokset */

.tulokset-wrap {
    display: flex;
    gap: 30px;
    border: 1px solid #f0eae1;
    background-color: #fdfbf7;
    padding: 25px;
    margin-top: 10px;
    align-items: flex-start;
}

.tulokset-intro {
    width: 50%;
    flex-shrink: 0;
    font-size: 0.9rem;
    color: #444444;
    line-height: 140%;
}

.tulokset-intro p {
    margin-bottom: 12px;
}

.tulokset-intro strong {
    font-weight: 600;
    color: #7a5f6e;
}

.tulokset-table {
    flex: 1;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tulokset-table thead tr {
    background-color: #f0eae1;
}

.tulokset-table thead th {
    text-align: left;
    padding: 8px 14px;
    color: #7a5f6e;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
}

.tulokset-table tbody tr {
    border-bottom: 1px solid #f0eae1;
}

.tulokset-table tbody tr:last-child {
    border-bottom: none;
}

.tulokset-table tbody td {
    padding: 9px 14px;
    color: #444444;
    vertical-align: top;
}

        .hevosruudukko-osio {
            margin-top: -20px;
        }

        .hevosruudukko-label {
            font-family: 'Nunito', sans-serif;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 1.2px;
            text-transform: uppercase;
            color: #b09aa8;
            margin: 30px 0 12px 0;
            padding-bottom: 8px;
            border-bottom: 1px solid #f0eae1;
        }

        .hevosruudukko {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
            gap: 16px;
        }

        .hevosruutu {
            background: #fdfbf7;
            border: 1px solid #f0eae1;
            border-radius: 10px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: border-color 0.2s;
            text-decoration: none;
        }

        .hevosruutu:hover {
            border-color: #c9a8b0;
        }

        .hevosruutu-kuva {
            width: 100%;
            aspect-ratio: 4 / 3;
            overflow: hidden;
            background: #e8e2dc;
        }

        .hevosruutu-kuva img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .hevosruutu-kuva-placeholder {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .hevosruutu-kuva-placeholder svg {
            opacity: 0.2;
        }

        .hevosruutu-teksti {
            padding: 12px 14px 14px;
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .hevosruutu-nimi {
            font-family: 'Lora', serif;
            font-size: 13.5px;
            color: #4a1525;
            font-weight: 600;
            line-height: 1.35;
            text-decoration: none;
            display: block;
            margin-bottom: 3px;
        }

        .hevosruutu:hover .hevosruutu-nimi {
            color: #6b2040;
        }

        .hevosruutu-meta {
            font-family: 'Nunito', sans-serif;
            font-size: 12.5px;
            color: #7a6070;
            line-height: 1.5;
        }

        .hevosruutu-tagit {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 7px;
        }

        .hevosruutu-tagi {
            font-family: 'Nunito', sans-serif;
            font-size: 9.5px;
            font-weight: 600;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            background: #f0eae1;
            color: #7a5f6e;
            padding: 2px 7px;
            border-radius: 2px;
        }


@media (max-width: 640px) {
    .tulokset-wrap {
        flex-direction: column;
    }
    .tulokset-intro {
        width: 100%;
    }
    .horse-card {
        flex-direction: column;
    }
    .horse-card-image {
        width: 100%;
    }
    .horse-card-image img {
        height: 220px;
    }
}

/* Responsive adjustment */
@media (max-width: 1024px) {
    .site-container {
        grid-template-columns: 1fr;
    }
    .content-body {
        flex-direction: column-reverse;
    }
    .content-image {
        width: 100%;
    }
}