:root {
    --lp-beige: #EAC787;
    --lp-orange: #F0821A;
    --lp-dark: #000;
}

.lp-product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.lp-product-card-link {
    display: block;
    /* Cap card width and centre it so tall/square packshots (e.g. 600x600)
       don't blow up to the full panel width; wide bar packshots still fit. */
    max-width: 320px;
    margin: 0 auto;
    text-decoration: none;
    color: inherit;
}

.lp-product-card-image {
    display: block;
    width: 100%;
    height: auto;
}

/* Category grid: square tiles, three per row, each a background image with the
   group name overlaid in white. */
.lp-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 0;
    margin: 0 0 2rem;
}

.lp-category-card {
    margin: 0;
}

.lp-category-card-link {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
}

.lp-category-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.lp-category-card-link:hover .lp-category-card-image {
    transform: scale(1.05);
}

.lp-category-card-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    padding-bottom: 2.5rem;
    color: #fff;
    font-weight: 800;
    font-size: 2.4rem;
    line-height: 1.1;
    text-transform: uppercase;
}

.lp-product-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lp-product-card-arrow {
    font-size: 1.15em;
    line-height: 1;
}

.lp-category-page {
    /* Width of the centred content band; each column holds about half. */
    --lp-content: 1180px;
}

/* Category hero: mirrors the Leader Hero block (mysteerio-leader-hero). Black
   band; copy on the left aligned to the centered content edge; full-height
   image on the right, curved on its left and bleeding to the page edge. */
.lp-cat-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    min-height: clamp(340px, 34vw, 480px);
    background: #000;
    color: #fff;
}

/* Left: copy padded so its left edge lines up with the centered content
   column while the band itself spans the full viewport. */
.lp-cat-hero-text {
    flex: 1 1 460px;
    align-self: center;
    padding: 3.5rem 2rem;
    padding-left: max(2rem, calc((100vw - var(--lp-content)) / 2));
}

.lp-cat-hero-title {
    margin: 0 0 1.5rem;
    color: #fff;
    font-weight: 800;
    line-height: 1.05;
    text-transform: uppercase;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
}

.lp-cat-hero-intro {
    max-width: 46ch;
    font-size: 1rem;
    line-height: 1.7;
    color: #e9e9e9;
}

.lp-cat-hero-intro :where(p):first-child {
    margin-top: 0;
}

.lp-cat-hero-intro :where(p):last-child {
    margin-bottom: 0;
}

/* Right: image fills the band top-to-bottom and bleeds to the page edge. */
.lp-cat-hero-media {
    position: relative;
    flex: 1 1 460px;
    align-self: stretch;
    min-height: inherit;
    overflow: hidden;
}

.lp-cat-hero-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lp-product-columns {
    display: flex;
    align-items: stretch; /* both columns reach the height of the taller one */
}

.lp-column {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* The last panel grows to fill any extra height the other column adds, so its
   colour reaches the bottom instead of leaving a white gap. */
.lp-column > .lp-section:last-child {
    flex: 1 1 auto;
}

/* Single panel: no column to tile against, so span the full width. */
.lp-product-columns--single .lp-column {
    flex-basis: 100%;
}

.lp-section {
    padding: 3.5rem 2.5rem;
}

/* Content band pulled toward the page centre: right-aligned in the left
   column, left-aligned in the right column, so each side's title + packshots
   sit toward the central seam rather than the middle of their half. The card
   stays centred within this band (see .lp-product-card-link). */
.lp-section-inner {
    max-width: calc(var(--lp-content) / 2);
    text-align: center;
}

.lp-column--left .lp-section-inner {
    margin-left: auto;
    margin-right: 0;
}

.lp-column--right .lp-section-inner {
    margin-left: 0;
    margin-right: auto;
}

.lp-product-columns--single .lp-section-inner {
    max-width: var(--lp-content);
    margin-left: auto;
    margin-right: auto;
}

.lp-section-title {
    margin: 0 0 2.5rem;
    color: inherit;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.lp-section--beige {
    background: var(--lp-beige);
    color: var(--lp-dark);
}

.lp-section--dark {
    background: var(--lp-dark);
    color: #fff;
}

.lp-section--orange {
    background: var(--lp-orange);
    color: #fff;
}

/* Centre each product card's packshot + CTA within its grid cell. */
.lp-product-card-link {
    text-align: center;
}

/* Full-width product page: colour panels bleed to the viewport edges while
   their content stays inside a centred band, matching the category page. The
   split between the two hero columns sits at the viewport centre, so the band
   edge is half the leftover space on either side. */
.lp-product-page {
    --lp-content: 1180px;
    --lp-edge: max(2rem, calc((100vw - var(--lp-content)) / 2));
}

/* Product hero: dark info panel + orange image panel. minmax(0, 1fr) keeps the
   split exactly at the centre — a plain 1fr floors at the column's min-content
   (e.g. the packshot image), which would push the split off-centre and let the
   content sprawl to the page edges. */
.lp-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Left padding lines the copy up with the centred band; the panel itself
   keeps bleeding black to the page edge. */
.lp-hero-info {
    background: var(--lp-dark);
    color: #fff;
    padding: 3rem;
    padding-left: var(--lp-edge);
}

.lp-hero-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.lp-product-title {
    margin: 0;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.1;
    font-size: clamp(2rem, 4.5vw, 60px);
    overflow-wrap: break-word;
}

.lp-made-in-finland {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.lp-made-in-finland svg {
    width: 125px;
    height: auto;
}

.lp-packshot {
    position: relative;
    display: inline-block;
    margin: 1.5rem 0;
}

.lp-packshot img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Product feature badges (Suosikkituote, Uutuus, ...): editor-uploaded logos
   stacked over the packshot's top-right corner, each wrapped in a white
   circle so arbitrary logo shapes read consistently. */
.lp-feature-badges {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lp-feature-badges li {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
}

.lp-feature-badge {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.lp-product-description {
    margin-bottom: 2rem;
}

.lp-resellers {
    margin: 0 0 2rem;
}

/* Flex layout pushes the caret next to the label; a non-list-item display
   also drops the native disclosure marker on its own (belt-and-braces rules
   below cover Safari/Firefox too). */
.lp-resellers-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.lp-resellers-summary::-webkit-details-marker {
    display: none;
}

.lp-resellers-summary::marker {
    content: "";
}

.lp-resellers-summary::after {
    content: "\2304";
    font-weight: 400;
    line-height: 1;
}

.lp-resellers[open] .lp-resellers-summary::after {
    content: "\2303";
}

.lp-resellers .lp-reseller-logos {
    margin-top: 1rem;
}

.lp-reseller-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lp-reseller-logos li {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
}

.lp-reseller-logos img {
    width: auto;
    height: auto;
}

/* Right column: photo grows to fill, label strip sits beneath it, and the
   whole column matches the height of the info panel via the hero grid. */
.lp-hero-media {
    display: flex;
    flex-direction: column;
}

.lp-hero-image {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--lp-dark);
}

.lp-hero-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dietary label badges on a dark strip under the hero image */
.lp-label-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 1.5rem;
    background: var(--lp-dark);
}

.lp-label-icon {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

/* Ingredients and nutrition panels */
.lp-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
    align-items: start; /* collapsed panels size to their summary bar */
    margin-bottom: 2.5rem;
}

/* Each panel is a native <details>; its body stays collapsed until the summary
   bar is clicked. Panels start closed (no "open" attribute in the markup). */
.lp-panel {
    margin: 0;
}

/* Flex layout pushes the caret to the right edge; a non-list-item display
   also drops the native disclosure marker on its own. */
.lp-panel-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.5rem;
    color: #fff;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 5px 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

/* Belt-and-braces marker removal for Safari (webkit) and Firefox (::marker). */
.lp-panel-summary::-webkit-details-marker {
    display: none;
}

.lp-panel-summary::marker {
    content: "";
}

.lp-panel-summary::after {
    content: "\2304";
    font-weight: 400;
    line-height: 1;
    flex: none;
}

.lp-panel[open] .lp-panel-summary::after {
    content: "\2303";
}

.lp-panel-ingredients .lp-panel-summary,
.lp-panel-ingredients .lp-panel-body {
    background: var(--lp-dark);
}

.lp-panel-nutrition .lp-panel-summary,
.lp-panel-nutrition .lp-panel-body {
    background: var(--lp-dark);
}

.lp-panel-body {
    padding: 2rem;
    color: #fff;
}

/* Keep each panel's heading and content inside the centred band while its
   colour keeps bleeding to the page edge: the left (orange) panel indents from
   the band's left edge, the right (dark) panel from its right edge. The summary
   shares the body's horizontal padding so the title lines up with the box
   beneath it (the coloured bar still fills the panel — padding is internal). */
.lp-panel-ingredients .lp-panel-summary,
.lp-panel-ingredients .lp-panel-body {
    padding-left: var(--lp-edge);
    padding-right: 2rem;
}

.lp-panel-nutrition .lp-panel-summary,
.lp-panel-nutrition .lp-panel-body {
    padding-left: 2rem;
    padding-right: var(--lp-edge);
}

.lp-panel-box {
    border: 1px solid #fff;
    padding: 1.5rem;
}

/* Desktop: give both open boxes a shared minimum height so the orange and
   dark panels line up side by side. Dropped on mobile where they stack. */
@media (min-width: 768px) {
    .lp-panel-box {
        min-height: 500px;
    }
}

.lp-panel-box p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.lp-panel-box p:last-child {
    margin-bottom: 0;
}

/* Nutrition table: name | per 100 g | per serving */
.lp-nutrition-table {
    width: 100%;
    border-collapse: collapse;
    color: #fff;
    font-size: 0.9rem;
}

.lp-nutrition-table th,
.lp-nutrition-table td {
    padding: 0.35rem 0.5rem;
    border: 0;
    text-align: left;
}

.lp-nutrition-table td,
.lp-nutrition-table thead th:not(:first-child) {
    text-align: right;
}

.lp-nutrition-table thead th {
    font-weight: 700;
}

.lp-nutrition-table tbody th {
    font-weight: 400;
}

/* Mobile: single column */
@media (max-width: 767px) {
    .lp-hero,
    .lp-details {
        grid-template-columns: 1fr;
    }

    .lp-hero-info {
        padding: 2rem 1.5rem;
    }

    /* Two category tiles per row on phones. */
    .lp-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .lp-category-card-title {
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* Tablet: two category tiles per row. */
@media (max-width: 991px) and (min-width: 768px) {
    .lp-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet/mobile: stack the two columns and centre each panel's content. */
@media (max-width: 991px) {
    /* Hero stacks: copy over image, with a gentler curve (mirrors the Leader
       Hero block's stacked layout). */
    .lp-cat-hero {
        min-height: 0;
    }

    .lp-cat-hero-text {
        flex-basis: 100%;
        align-self: auto;
        padding: 2.5rem 1.25rem;
    }

    .lp-cat-hero-media {
        flex-basis: 100%;
        min-height: 280px;
    }

    .lp-product-columns {
        flex-direction: column;
    }

    .lp-column {
        flex-basis: auto;
    }

    .lp-section {
        padding: 2.5rem 1.5rem;
    }

    .lp-section-inner,
    .lp-column--left .lp-section-inner,
    .lp-column--right .lp-section-inner {
        max-width: var(--lp-content);
        margin-left: auto;
        margin-right: auto;
    }

    .lp-section-title {
        margin-bottom: 1.5rem;
    }
}

/* "Kaikki tuotteet" listing: every product grouped under its main-category
   heading, with a filter bar. Lives on a plain Page (via
   [leader_kaikki_tuotteet]); the two bands (white filter bar, black listing)
   break out to the full viewport width while their content stays in a centred
   column, so it doesn't depend on the Page template's own width. */
.lp-all-products {
    --lp-content: 1180px;
    /* Full-bleed: escape the constrained page content column. */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Centred content column shared by the filter bar and the listing. */
.lp-all-inner {
    max-width: var(--lp-content);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Filter bar: white band, buttons laid out across the content width. */
.lp-all-filters {
    background: #fff;
}

.lp-all-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.lp-all-filter {
    flex: 0 0 auto;
    padding: 0.6rem 1.25rem;
    background: transparent;
    color: #000;
    border: 1px solid #000;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.2;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.lp-all-filter:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Selected filter: solid black to read as "on". */
.lp-all-filter.is-active {
    background: #000;
    color: #fff;
}

/* Listing: full-width black band, white text. */
.lp-all-listing {
    background: var(--lp-dark);
    color: #fff;
}

.lp-all-listing .lp-all-inner {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.lp-all-section {
    margin: 0 0 3.5rem;
}

.lp-all-section:last-child {
    margin-bottom: 0;
}

/* Centred heading, no divider lines. */
.lp-all-title {
    margin: 0 0 2rem;
    text-align: center;
    color: inherit;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.lp-all-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* The shared card caps itself at 320px and self-centres; in this grid we let
   each card fill its cell instead. */
.lp-all-grid .lp-product-card-link {
    max-width: none;
}

@media (max-width: 767px) {
    .lp-all-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Higher specificity than the bare class so the theme's forced
       ".single-content ul" left padding can't push the grid in on mobile. */
    .lp-all-products .lp-all-grid {
        padding-left: 0;
        gap: 2rem 1rem;
    }
}
