*, *:before, *:after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f6efe4;
    background-image: url("data:image/svg+xml,%3Csvg width='44' height='12' viewBox='0 0 44 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 12v-2L0 0v10l4 2h16zm18 0l4-2V0L22 10v2h16zM20 0v8L4 0h16zm18 0L22 8V0h16z' fill='%23e1d2bb' fill-opacity='0.2' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-attachment: fixed;
    font-size: 16px;
    font-family: Verdana;
    line-height: 1.8;
    color: #796e63;
}

a:link, a:visited, a:active { 
    text-decoration: none; 
    color: #B5947D;
}

a:hover { 
    text-decoration: none; 
    color: #a78065;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Playfair", serif;
}

.text-center {
    text-align: center;
}

header {
    position: relative;
    text-align: center;
    color: #4b3b2a;
}

.topbar {
    background-color: #e1d2bb;
    min-height: 2.5rem;
}

.secondbar {
    background-color: #f0e4d4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.6rem 0 2rem 0;
}

.header {
    width: 100%;
    max-width: 56.25rem;
    margin-inline: auto;
    display: flex;
    justify-content: flex-end;
    padding-right: 5rem;
}

.header h1 {
    font-family: "Playfair", serif;
    text-transform: uppercase;
    font-weight: 300;
    font-size: clamp(1.2rem, 3vw, 2rem);
    z-index: 2;
    margin: 0;
}

.hero-image {
    position: relative;
    z-index: 1;
    max-width: 56.25rem;
    margin: -10vh auto 0 auto;
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.linkbar {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 56.25rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 3rem;
    font-size: 0.95rem;
    z-index: 2;
    font-family: "Playfair", serif;
}

.linkbar a {
    color: #6b563a;
    text-decoration: none;
    transition: color 0.2s;
    margin-inline: 1rem;
}

.linkbar a:hover {
    color: #3e2c18;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #4b3b2a;
    line-height: 1;
}

main {
    margin: 0 auto 0.625rem auto;
    background: #f0e4d4;
    max-width: 56.25rem;
    padding: 2rem;
    font-size: 0.8rem;
    border-bottom: 3px solid #e3d8c7;
}

footer {
    max-width: 56.25rem;
    margin-inline: auto;
    margin-block: 0.8rem;
    font-size: 0.7rem;
    text-align: center;
}

.horse-info-box {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 1.3fr minmax(110px, 1fr) 1.3fr;
    border-radius: 0.375rem;
    padding-block: 1rem;
    gap: 0.3rem 0.8rem;
    max-width: 100%;
    box-sizing: border-box;
}

.info-row {
    display: contents;
}

.label {
    background: #6b563a;
    color: #fff;
    font-family: "Playfair", serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.25rem 0.4rem;
    border-radius: 0.375rem;
    text-align: right;
}

.value {
    background: #f9f3ea;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    color: #3e2c18;
    line-height: 1.3;
}

.age {
    color: #8a7555;
    font-size: 0.8rem;
    font-style: italic;
}

.horse-photo-gallery {
    margin-block: 1.2rem;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.horse-photo-gallery img {
    max-height: 180px;
    border-radius: 0.375rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    object-fit: cover;
}

.sivukuva {
	margin-left:20px;
	margin-bottom:10px;
	float:right;
	display: block;
    border-radius: 0.375rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sivukuva2 {
	margin-right:20px;
	margin-bottom:10px;
	float:left;
	display: block;
    border-radius: 0.375rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.lista {
	display:block;
}

.lista:before {
	content: '\2665';
	padding:0px 7px;
	color:rgba(0, 0, 0, 0.3);
    font-size:12px;
}

.table-container {
    margin-block: 1.2rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Playfair", serif;
    font-size: 0.95rem;
    color: #3e2c18;
}

.table td {
    padding: 0.6rem 0.8rem;
    background-color: #f8f2e7;
    border-radius: 0.375rem;
    border: 1px solid #e7d9c4;
    line-height: 1.5;
}

.table.pedigree td {
    width: 33.33%;
}

.table.pedigree td span {
    font-size: 0.8rem;
    color: #6b563a;
}

.table.pedigree .father, .table.pedigree .mother {
    font-weight: 600;
}

.table tr:first-child td:first-child {
    border-top-left-radius: 10px;
}

.table tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

.extratext {
    font-weight: 600;
    font-family: "Playfair", serif;
    font-style: italic;
    font-size: 1.1rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    overflow: hidden;
}

.modal-content {
    background-color: #f9f3ea;
    margin: 5% auto;
    padding: 1.5rem 2rem;
    border: 1px solid #e2d5c3;
    border-radius: 0.375rem;
    width: 80%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    color: #3e2c18;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    scrollbar-width: thin;
    scrollbar-color: #b79d7e #f9f3ea;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f9f3ea;
    border-radius: 0.375rem;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: #b79d7e;
    border-radius: 0.375rem;
}

.close {
    color: #6b563a;
    float: right;
    font-size: 1.6rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #3e2c18;
}

.open-modal {
    background-color: #e9d9c0;
    color: #4b3b2a;
    border: none;
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    border-radius: 0.375rem;
    font-family: "Playfair", serif;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.open-modal:hover {
    background-color: #e1d2bb;
}

.open-modal:hover {
    background-color: #e1d2bb;
}

.horse-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 1.5rem;
    align-items: flex-start;
}

.horse-grid::after {
    content: "";
    flex: auto;
}

.horse-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-items: flex-start;
    text-align: left;
    width: 350px;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.horse-item-image img {
    width: 90px !important;
    height: 120px !important;
    object-fit: cover;
    border-radius: 0.375rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    background-color: #f8f2e7;
    flex-shrink: 0;
}

.horse-data {
    flex: 1;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #4b3b2a;
    text-align: left !important;
}

.horse-data h3 {
    margin: 0 0 0.4rem 0;
    font-family: "Playfair", serif;
    font-weight: 600;
    color: #3e2c18;
    font-size: 1.3rem;
}

.horse-data a {
    color: #3e2c18;
    text-decoration: none;
}
.horse-data a:hover {
    text-decoration: underline;
}

.horse-data p {
    margin: 0.2rem 0;
}

.horse-data em {
    display: block;
    margin-top: 0.4rem;
    font-style: italic;
    font-size: 0.7rem;
    color: #805e3f;
}

.offspring-list {
    max-width: 800px;
    padding: 1.5rem 2rem;
}

.foal-item {
    display: flex;
    gap: 0.7rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(183, 157, 126, 0.2);
}

.foal-item:last-child {
    border-bottom: none !important;
}

.foal-number {
    align-self: center;
    font-size: 1.6rem;
    color: #6b563a;
    width: 2rem;
    flex-shrink: 0;
    text-align: right;
    font-family: "Playfair", serif;
}

.foal-content {
    flex: 1;
    align-self: center;
    padding-left: 5rem;
    line-height: 1.1;
    font-weight: 300;;
}

.foal-name {
    font-weight: 600;
    color: #3e2c18;
    margin-bottom: 0.1rem;
    font-family: "Playfair", serif;
    font-size: 1rem;
}

.foal-name a:link, .foal-name a:visited {
    color: #B5947D;
}

.foal-name a:hover, .foal-name a:active {
    text-decoration: underline;
}

.foal-details {
    color: #4b3b2a;
    font-size: 1rem;
}

.foal-death {
    font-size: 0.7rem;
    color: #8a6f65;
    margin-top: 0.25rem;
}

.foal-awards {
    color: #3e2c18;
    font-family: "Playfair", serif;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

summary {
    display: block;
    background-color: #e9d9c0;
    color: #4b3b2a;
    border: none;
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    border-radius: 0.375rem;
    font-family: "Playfair", serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

summary::-webkit-details-marker {
    display: none;
}

@keyframes open {
    0% { opacity: 0 }
    100% { opacity: 1 }
}

@media (max-width: 815px) {
    .horse-grid {
        justify-content: center;
    }
        
    .horse-grid::after {
        content: "";
        flex: inherit;
    }
}

@media (max-width: 700px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 100%;
        border-collapse: collapse;
        white-space: nowrap;
    }

    .horse-info-box {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 780px) {
    .linkbar {
        height: auto;
        background: #f0e4d4;
        flex-wrap: wrap;
        position: relative;
        padding: 10px 20px;
    }

    .menu-toggle {
        display: block;
    }

    .linkbar nav {
        overflow: hidden;
        flex-direction: column;
        width: 100%;
        max-height: 0;
        opacity: 0;
        transition: max-height 0.4s ease, opacity 0.4s ease;
    }

    .linkbar nav.show {
        display: flex;
        align-items: center;
        max-height: 1000px;
        opacity: 1;
    }

    .linkbar a {
        display: block;
        padding: 0.5rem 0;
    }
}

@media (max-width: 680px) {
    .header h1 {
        font-family: "Playfair", serif;
        text-transform: uppercase;
        font-weight: 300;
        font-size: 1.45rem;
        z-index: 2;
    }
}

@media (min-width: 626px) {
    .hero-image {
        margin-top: -7.5rem;
    }

    .header {
        padding-right: 0rem;
    }
}

@media (max-width: 626px) {
    header {
        text-align: right;
        padding-right: 0;
        margin-right: 0;
        right: 0;
    }

    .secondbar { 
        top: 0;
        right: 0;
    }

    .header {
        padding-right: 0rem;
        margin-right: 0rem;
    }
}

@media (max-width: 600px) {
    .horse-grid {
        max-width: 100%;
        gap: 1.5rem 0;
    }

    .foal-item {
        flex-direction: column;
        gap: 0.3rem;
    }

    .foal-number {
        text-align: left;
        width: auto;
    }

    .foal-content {
        padding-left: 1rem;
    }
}
