/**
 * Tulos: the results' own template, a results board (pohja.php, GP elements
 * "Tulos: otsake / runko / loppu").
 *
 * Structure:
 *   .tulos-otsake.color-section.wrapper-alternate-color (GP element, dark scoreboard)
 *     .tulos-otsake-rivi.text-image.text-image--wide.text-image--reverse
 *       > .text-image-media > figure > img  +  .text-image-content > p.tulos-yla (a + time),
 *         h1.tulos-otsikko, p.tulos-ingressi, p.tulos-napit
 *       (.tulos-otsake-rivi--teksti without a featured image)
 *     nav.tulos-vuodet > ol > li > a[aria-current]
 *   section.ennatys-osio.wrapper-extra-color#vuoden-ennatykset   (ennatys.php, ennatys.css)
 *   .tulos-taulu-osio.color-section#tulokset
 *     nav.anchor-nav.tulos-kasvirivi                               (base anchor-nav.css/.js)
 *     .tulos-sisus > details.tulos-merkinnat | .tulos-johdanto
 *                  + .tulos-taulu > section.tulos-kortti#tulos-<name>
 *                      (.tulos-kortti__ryhma > p.tulos-kortti__ryhma-nimi + p   on a group's first card,
 *                       h2 > span.tulos-kortti__lisa, h3, ol, p, table)
 *   section.tulos-galleria.wrapper-extra-color#kuvat > .tulos-sisus > h2 + .gallery
 *
 * The board: 1 / 2 from 768px / 3 from 990px columns (--tulos-sarakkeet).
 * The cards run row by row, left to right, in the content's order (the
 * competition list), so the plant row's highlight only moves forward.
 * tulos.js packs them (each card into the currently shortest column,
 * .is-masonry); without JS they are a plain grid with uneven rows. A
 * group's name is a label on its first card, not a heading across the
 * columns, so the board stays dense.
 */

/* ==== Header: dark scoreboard ==== */

.gb-container.tulos-otsake.color-section {
    padding: clamp(16px, 4vw, 48px) 0 0;
}

.tulos-otsake-rivi {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tulos-otsake-rivi .text-image-media {
    padding: 0 var(--mobile-side-padding);
}

.tulos-otsake-rivi .text-image-media figure {
    position: relative;
    height: clamp(260px, 80vw, 400px);
    margin: 0;
    overflow: hidden;
    border-radius: 18px;
}

.tulos-otsake-rivi .text-image-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tulos-otsake-rivi--teksti,
.tulos-sisus {
    max-width: calc(var(--container-width) + 2 * var(--mobile-side-padding));
    margin: 0 auto;
    padding: 0 var(--mobile-side-padding);
}

.tulos-otsake-rivi--teksti .text-image-content {
    width: auto;
    max-width: 52rem;
    padding: 0;
}

.tulos-otsake .text-image-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.tulos-otsake .text-image-content > * {
    margin: 0;
}

.tulos-yla a {
    color: inherit;
    text-decoration: none;
}

.tulos-yla a:hover {
    text-decoration: underline;
}

.tulos-otsikko {
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    line-height: 0.95;
    overflow-wrap: break-word;
}

.tulos-ingressi {
    max-width: 46ch;
    font-size: 1.1em;
}

.tulos-napit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    margin-top: 6px !important;
}

@media only screen and (min-width: 768px) {
    .tulos-otsake-rivi.text-image {
        flex-direction: row-reverse;
        gap: 0;
    }

    .tulos-otsake-rivi .text-image-media {
        padding: 0;
    }

    .tulos-otsake-rivi .text-image-media figure {
        height: 100%;
        min-height: 420px;
        border-radius: 28px 0 0 28px;
    }
}

/* The year row: tabs along the bottom of the scoreboard; scrolls sideways
   when it does not fit (tulos.js centres the current year). */
.tulos-vuodet {
    margin-top: clamp(32px, 5vw, 56px);
    padding: 0 0 20px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tulos-vuodet ol {
    display: flex;
    gap: 6px;
    max-width: calc(var(--container-width) + 2 * var(--mobile-side-padding));
    margin: 0 auto;
    padding: 0 var(--mobile-side-padding);
    list-style: none;
}

.tulos-vuodet li {
    flex: 0 0 auto;
    margin: 0;
}

.tulos-vuodet a {
    display: block;
    padding: 7px 14px;
    border-radius: 999px;
    background-color: color-mix(in srgb, currentColor 10%, transparent);
    color: var(--font-clr);
    font-family: var(--title-font);
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color var(--transition-speed) var(--transition-timing-function);
}

.tulos-vuodet a:hover {
    background-color: color-mix(in srgb, currentColor 22%, transparent);
}

.tulos-vuodet a[aria-current] {
    background-color: var(--accent-clr);
    color: var(--btn-font-clr);
}


/* ==== Board ==== */

/* The plant row sits on the section's top edge and sticks below the header. */
.gb-container.tulos-taulu-osio.color-section {
    padding-top: 0;
}

.tulos-kasvirivi .anchor-nav-inner {
    max-width: calc(var(--container-width) + 2 * var(--mobile-side-padding));
    margin: 0 auto;
    padding: 0 var(--mobile-side-padding);
}

/* No highlight on the current plant (Arto 31.10.2026: it distracted); the
   row still scrolls along to it (anchor-nav.js), and aria-current stays for
   screen readers. Hover and focus look as in the base. */
.anchor-nav.tulos-kasvirivi .gb-button.anchor-nav-link.is-active:not(:hover):not(:focus-visible) {
    background-color: transparent;
    color: var(--font-clr);
}

.tulos-taulu-osio .tulos-sisus {
    padding-top: 32px;
}

/* Legend: open on wide screens, a tap away on phones (tulos.js). */
.tulos-merkinnat {
    margin: 0 0 28px;
    padding: 0 22px;
    border: 1px solid var(--border-clr);
    border-radius: 18px;
}

.tulos-merkinnat summary {
    padding: 16px 0;
    color: var(--heading-clr);
    font-family: var(--title-font);
    font-size: var(--h4-size);
    cursor: pointer;
}

.tulos-merkinnat__sisus {
    padding: 0 0 16px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.tulos-merkinnat__sisus > * {
    margin: 0 0 8px;
    break-inside: avoid;
}

.tulos-johdanto {
    margin: 0 0 24px;
    font-size: 0.95rem;
}

.tulos-johdanto > * {
    margin: 0 0 8px;
}

@media only screen and (min-width: 768px) {
    .tulos-merkinnat__sisus {
        columns: 2;
        column-gap: 40px;
    }
}

@media only screen and (min-width: 990px) {
    .tulos-merkinnat__sisus {
        columns: 3;
    }
}

.tulos-taulu {
    --tulos-sarakkeet: 1;
    --tulos-vali: 20px;
    display: grid;
    grid-template-columns: repeat(var(--tulos-sarakkeet), minmax(0, 1fr));
    align-items: start;
    gap: var(--tulos-vali);
}

@media only screen and (min-width: 768px) {
    .tulos-taulu {
        --tulos-sarakkeet: 2;
    }
}

@media only screen and (min-width: 990px) {
    .tulos-taulu {
        --tulos-sarakkeet: 3;
    }
}

/* Packed by tulos.js: positions and the board's height are set there. */
.tulos-taulu.is-masonry {
    display: block;
    position: relative;
}

.tulos-taulu.is-masonry > * {
    position: absolute;
}

/* Card */
.tulos-kortti {
    margin: 0;
    padding: 20px 22px 10px;
    border-radius: 18px;
    background-color: var(--neutral-clr);
    font-size: 0.95rem;
    line-height: 1.45;
    overflow-wrap: break-word;
}

.tulos-kortti h2 {
    margin: 0 0 12px;
    font-size: 1.35rem;
    line-height: 1.15;
}

.tulos-kortti__lisa {
    display: block;
    margin-top: 4px;
    color: var(--font-clr);
    font-family: var(--main-font);
    font-size: 0.8rem;
    font-style: italic;
    line-height: 1.35;
}

/* Class (h3): a small green label in the case it was written ("paino (SE
   26,48 kg …)": capitals would turn the units into KG); the record in
   brackets (em) in the text colour. */
.tulos-kortti h3 {
    margin: 16px 0 6px;
    color: var(--stem-clr);
    font-family: var(--main-font);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.35;
}

.tulos-kortti h3 em {
    color: var(--font-clr);
    font-weight: 400;
}

.tulos-kortti h2 + h3 {
    margin-top: 0;
}

.tulos-kortti p,
.tulos-kortti ol,
.tulos-kortti ul {
    margin: 0 0 10px;
}

.tulos-kortti ol,
.tulos-kortti ul {
    padding-left: 1.7em;
}

.tulos-kortti li {
    margin: 0 0 5px;
    padding-left: 2px;
}

/* Places: the first three numbers in pumpkin, the winner's row bold. */
.tulos-kortti ol > li::marker {
    color: var(--placeholder-clr);
    font-weight: 700;
}

.tulos-kortti ol > li:nth-child(-n + 3)::marker {
    color: var(--accent-clr);
}

.tulos-kortti ol > li:first-child {
    font-weight: 700;
}

.tulos-kortti .wp-block-table {
    margin: 0 0 10px;
    overflow-x: auto;
}

.tulos-kortti table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.tulos-kortti td,
.tulos-kortti th {
    padding: 4px 6px 4px 0;
    border: 0;
    border-bottom: 1px solid var(--border-clr);
    vertical-align: top;
}

/* Group label on top of the group's first card ("Kurpitsat"), with the
   group's own line under it in small print. */
.tulos-kortti__ryhma {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-clr);
}

.tulos-kortti .tulos-kortti__ryhma-nimi {
    margin: 0;
    color: var(--sub-heading-clr);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tulos-kortti .tulos-kortti__ryhma > :not(.tulos-kortti__ryhma-nimi) {
    margin: 4px 0 0;
    font-size: 0.8rem;
    font-style: italic;
}


/* ==== Gallery ==== */

.tulos-galleria h2 {
    margin-bottom: 24px;
}
