/* Custom CSS */

/* ==========================================================================
   gitso 2026-09-06 - equal-height product tiles
   ==========================================================================

   PROBLEM
   Product images from the G.IT feed come in wildly different aspect ratios:
   square 500x500 renders, 1600x900 panoramas, tall tower-case shots. The tile
   grew to fit its image, so brand, title, rating and price ended up at a
   different vertical position in every column. On the category listing a
   single taller tile pushed its whole row out of alignment.

   SOLUTION
   The image gets a fixed-height frame and is FITTED inside it
   (object-fit: contain) rather than cropped. Nothing is cut from the frame -
   cropping would slice off ports and screen edges on monitors and laptops -
   and every frame ends up the same height.

   The description is then a flex column with fixed line heights: brand always
   one line, title always two, rating always one band, and the price is pushed
   to the bottom with margin-top: auto. Prices therefore line up across the row
   no matter how long the product name is.

   This covers both places at once, because the grid and the carousel share the
   .products.product-loop class:
     - category product listing (Bootstrap .row)
     - home page carousels (Swiper, .swiper-slide)
   -------------------------------------------------------------------------- */

/* --- 1. Equal tile height across a row ----------------------------------- */

.products.product-loop {
    align-items: stretch;
}

/* Grid: the Bootstrap column has to stretch its content to full height. */
.products.product-loop > .product {
    display: flex;
    height: auto;
}

/* Carousel: Swiper does not stretch slides by default. Without height: auto
   a slide takes the height of the tallest one and the tiles float vertically. */
.products.product-loop.swiper-wrapper {
    align-items: stretch;
}

.products.product-loop > .swiper-slide {
    height: auto;
    display: flex;
}

.products.product-loop > .swiper-slide > .product {
    display: flex;
    width: 100%;
}

.product-miniature.js-product-miniature {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.product-miniature .thumbnail-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
}

/* --- 2. Fixed-height image frame ------------------------------------------ */

.product-miniature .thumbnail-top {
    position: relative;
    flex: 0 0 auto;
}

/* The frame is a fixed-height positioning context; the image is pinned inside it.
   Absolute positioning is deliberate rather than flex centring: the theme wraps
   every product image in a <picture> element, which is display:inline and has no
   height of its own, so a percentage max-height on the <img> resolves against an
   auto-height parent and is dropped altogether - the image then renders at its
   natural size and drags the tile with it. Pinning to the frame removes that
   dependency completely.

   Selector depth intentionally matches the parent theme's own
   ".product-miniature .thumbnail-container .product-thumbnail img" (0,3,1);
   going one level deeper is what lets these rules win without !important. */
.product-miniature .thumbnail-container .thumbnail-top .product-thumbnail {
    display: block;
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

/* Gutter so a contained image never touches the tile border. */
.product-miniature .thumbnail-container .thumbnail-top .product-thumbnail picture {
    position: absolute;
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    display: block;
}

.product-miniature .thumbnail-container .thumbnail-top .product-thumbnail img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: contain;
    object-position: center;
}

/* Fallback for the templates that emit a bare <img> with no <picture> wrapper:
   the gutter has to move onto the image itself. Only matches a direct child, so
   it never competes with the rule above. */
.product-miniature .thumbnail-container .thumbnail-top .product-thumbnail > img {
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    height: auto;
}

/* Flags ("Na Zamowienie", "Nowy") sit ON TOP of the image and must not affect
   layout - otherwise a tile carrying two flags would be taller than its
   neighbours. */
.product-miniature .product-flags {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
}

/* --- 3. Description: fixed line heights, price pinned to the bottom ------- */

.product-miniature .product-description {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding-top: 12px;
}

/* Brand. The line is reserved even when there is no brand, otherwise such a
   tile would ride one line higher than its neighbours. */
.product-miniature .product-description .brand-title {
    min-height: 20px;
    margin-bottom: 2px;
    line-height: 20px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Title: exactly two lines, longer ones truncated with an ellipsis. */
.product-miniature .product-description .product-title {
    margin: 0 0 6px;
    min-height: 44px;
    max-height: 44px;
    line-height: 22px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-miniature .product-description .product-title a {
    display: block;
    overflow: hidden;
}

/* Rating: a fixed band so a product without reviews does not shorten the tile. */
.product-miniature .product-description .product-list-reviews,
.product-miniature .product-description .comments-note,
.product-miniature .product-description .star-content,
.product-miniature .product-description .product-comment-list,
.product-miniature .product-description .grade-stars {
    min-height: 22px;
    margin-bottom: 2px;
}

/* The price is pushed to the bottom. This is what visually aligns the tiles. */
.product-miniature .product-description .product-price-and-shipping {
    margin-top: auto;
    min-height: 26px;
}

/* The action row: some products render a form, out-of-stock ones a disabled
   button. Reserving the same band keeps the tile bottoms level either way. */
.product-miniature .product-description .product-add-to-cart,
.product-miniature .product-description > .add-to-cart {
    display: block;
    min-height: 44px;
    margin-bottom: 0;
}

/* --- 4. Smaller screens --------------------------------------------------- */

@media (max-width: 1199px) {
    .product-miniature .thumbnail-container .thumbnail-top .product-thumbnail { height: 210px; }
}

@media (max-width: 991px) {
    .product-miniature .thumbnail-container .thumbnail-top .product-thumbnail { height: 190px; }
}

@media (max-width: 767px) {
    .product-miniature .thumbnail-container .thumbnail-top .product-thumbnail { height: 165px; }
    .product-miniature .product-description .product-title {
        min-height: 40px;
        max-height: 40px;
        line-height: 20px;
    }
}

/* ==========================================================================
   gitso 2026-09-06 - category sidebar
   --------------------------------------------------------------------------
   The ps_categorytree template now sets a "current" class on the link of the
   category being viewed and a "show" class on its branch, so the current path
   opens by default. This rule only highlights the active link.
   ========================================================================== */

.block-categories .category-sub-menu a.current,
.block-categories .category-sub-menu a.category-sub-link.current {
    font-weight: 600;
    color: #129cb8;
}

/* ==========================================================================
   gitso 2026-10-02 - Poland-only checkout
   --------------------------------------------------------------------------
   Country select: Poland is the only enabled country and it is the shop
   default, so the field offers a single option and nothing to decide. It is
   hidden rather than dropped from the address format - removing Country:name
   from ps_address_format would stop id_country being submitted at all and
   address validation would then reject the form.

   The State field needs no rule: Poland's address format carries no State
   entry, so it is never rendered. It only appeared on the old addresses that
   were still saved against the United States.
   ========================================================================== */

.form-group:has(#field-id_country) {
    display: none;
}

/* The "only letters and the dot" hint under First name / Last name.
   It cannot be removed through a translation: FormField::addAvailableValue()
   falls back to the array key when the label is falsy, so an empty string in
   ps_translation renders the literal word "comment" instead of nothing. The
   hint therefore stays in the DOM and is hidden here.
   span. is deliberate - the field row also ends with a separate
   div.col-md-3.form-control-comment carrying the "Optional" marker, which has
   to keep working on the other fields.
   Two spellings on purpose: the :has() pair keys on the .form-group row, the
   sibling pair only on the input itself, so the rule survives a theme whose
   field markup differs from the one in this repo. The server runs a newer
   avanamclassic than we have here. */
.form-group:has(#field-firstname) span.form-control-comment,
.form-group:has(#field-lastname) span.form-control-comment,
#field-firstname ~ .form-control-comment,
#field-lastname ~ .form-control-comment {
    display: none !important;
}

/* ==========================================================================
   gitso 2026-11-13 - order confirmation page
   ==========================================================================

   PROBLEM
   The order confirmation page said one sentence and nothing else: no order
   number, no payment, no carrier, no idea what happens next. Customers wrote
   in asking whether the order went through at all.

   APPROACH
   A single centred card carrying what the customer needs right after paying.
   Every value comes from the order or from the shop configuration, see
   templates/checkout/order-confirmation.tpl.

   Colours are the theme palette variables, so changing the theme colour in
   the back office changes this card too. Fallbacks are the palette defaults
   from config/preset.json, used only if the theme stops exposing the vars.

   The layout is two grids (facts, steps) that collapse to one column below
   700px, the same breakpoint the rest of the child CSS uses.
   ========================================================================== */

.gitso-oc * { box-sizing: border-box; }

.gitso-oc {
    width: 100%;
    max-width: 980px;
    margin: 0 auto 24px;
    background: var(--color-white, #fff);
    color: var(--color-text, #333);
    border: 1px solid var(--color-border, #e5e5e5);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(var(--color-primary-rgb, 18, 156, 184), .06);
    overflow: hidden;
}

.gitso-oc-accent {
    height: 4px;
    background: var(--color-primary, #129cb8);
}

.gitso-oc-head {
    padding: 28px 36px 8px;
    text-align: center;
}

.gitso-oc-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb, 18, 156, 184), .12);
}

.gitso-oc-check svg { stroke: var(--color-primary, #129cb8); }

.gitso-oc h1 {
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    color: inherit;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.03em;
    text-transform: none;
}

.gitso-oc-lead {
    margin: 0;
    opacity: .75;
    font-size: 15px;
    line-height: 1.5;
}

/* Keeps each clause on one line on desktop so the sentence breaks where it
   reads best, not wherever the container happens to end. */
.gitso-oc-lead span { white-space: nowrap; }

.gitso-oc-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 22px;
    border-top: 1px solid var(--color-border, #e5e5e5);
    text-align: center;
}

/* One fact is hidden for virtual orders, so the columns are sized by the
   grid rather than fixed at three. */
.gitso-oc-facts:has(.gitso-oc-fact:nth-child(2):last-child) { grid-template-columns: repeat(2, 1fr); }

.gitso-oc-fact { padding: 16px 12px 6px; }
.gitso-oc-fact + .gitso-oc-fact { border-left: 1px solid var(--color-border, #e5e5e5); }

.gitso-oc-k {
    display: block;
    margin-bottom: 6px;
    color: var(--color-primary, #129cb8);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.gitso-oc-v {
    font-size: 16px;
    font-weight: 800;
    word-break: break-word;
}

.gitso-oc-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 8px 36px 0;
    padding: 18px 0 22px;
    border-top: 1px solid var(--color-border, #e5e5e5);
}

.gitso-oc-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    text-align: left;
}

.gitso-oc-n {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary, #129cb8);
    color: var(--color-white, #fff);
    font-size: 13px;
    font-weight: 800;
}

.gitso-oc-step strong {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
}

.gitso-oc-step p {
    margin: 0;
    opacity: .75;
    font-size: 13px;
    line-height: 1.4;
}

.gitso-oc a { color: var(--color-primary, #129cb8); }

@media (max-width: 700px) {
    .gitso-oc-head { padding: 22px 16px 4px; }
    .gitso-oc-lead span { display: block; white-space: normal; }

    .gitso-oc-facts { grid-template-columns: 1fr; }

    .gitso-oc-fact {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 12px 16px;
        text-align: left;
    }

    .gitso-oc-fact + .gitso-oc-fact {
        border-left: 0;
        border-top: 1px solid var(--color-border, #e5e5e5);
    }

    .gitso-oc-k { margin-bottom: 0; }

    .gitso-oc-steps {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 0 16px;
        padding: 16px 0 18px;
    }
}

/* ==========================================================================
   gitso 2026-11-14 - searchable facet filters
   ==========================================================================

   Styles for the search field that assets/js/child-custom.js puts into any
   facet with ten values or more. The field is sticky inside the scrolling
   list so it stays reachable while picking from a long list of processors.
   ========================================================================== */

ul.gitso-facet-long {
    max-height: 340px;
    overflow-y: auto;
}

.gitso-facet-search {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 4px 0 8px;
    background: var(--color-white, #fff);
    list-style: none;
}

.gitso-facet-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--color-border, #e5e5e5);
    border-radius: 4px;
    background: var(--color-white, #fff);
    color: inherit;
    font-size: 13px;
    line-height: 1.3;
}

.gitso-facet-search input:focus {
    outline: none;
    border-color: var(--color-primary, #129cb8);
}

.gitso-facet-empty {
    padding: 6px 2px;
    opacity: .7;
    font-size: 13px;
    list-style: none;
}

/* Values coming from the supplier feed can be a whole sentence: 310 of them
   hit the 255 character column limit, 2055 are longer than 60 characters.

   The theme lays a filter row out as a flex line that is allowed to wrap,
   while the text itself is set to white-space: nowrap. A label wider than the
   leftover space therefore moves to a second flex line, starting under the
   checkbox at the left edge, and then runs straight out of the sidebar
   because it is not allowed to break. That is the overflow on screen.

   These rules are deliberately written against the #search_filters container
   and plain tags rather than the theme class names, because the theme on the
   server is newer than the copy in this repo and may have renamed them. The
   !important flags are limited to the four properties that cause the
   overflow and have to beat whatever the theme sets.
   ========================================================================== */

#search_filters li,
#search_filters label,
#search_filters a {
    white-space: normal !important;
    overflow-wrap: anywhere;
    max-width: 100%;
}

#search_filters label {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    gap: 8px;
}

/* The text column shrinks, the checkbox keeps its size. min-width: 0 is what
   actually lets a flex item wrap instead of pushing the row wider. */
#search_filters label > a,
#search_filters label > .search-link {
    flex: 1 1 auto;
    min-width: 0;
}

#search_filters label > span:first-child,
#search_filters label > .custom-checkbox,
#search_filters label > .custom-radio {
    flex: 0 0 auto;
    margin-top: 2px;
}

#search_filters .magnitude {
    float: none;
    white-space: nowrap !important;
}

/* The theme on the server renders its own facet template: the labels arrive
   cut to exactly 64 characters, which the parent theme never does. That
   template may well keep the text link outside the <label>, next to it, in
   which case laying out the label alone changes nothing and the row has to be
   laid out on the <li>. These rules cover both shapes at once.

   :has keeps the price slider and the dropdown facets out of it, they have no
   checkbox and must not become flex rows. */
#search_filters li:has(input[type="checkbox"]),
#search_filters li:has(input[type="radio"]) {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    gap: 8px;
}

/* Text column shrinks, checkbox keeps its width, whichever element holds it. */
#search_filters li > a,
#search_filters li > label:has(a) {
    flex: 1 1 auto;
    min-width: 0;
}

#search_filters li > label:not(:has(a)) {
    flex: 0 0 auto;
}

/* ==========================================================================
   gitso 2026-11-14 - gross and net price on the product page
   ==========================================================================

   The shop shows gross prices, so the product page says so next to the
   figure and repeats the net value for business buyers. Markup comes from
   templates/catalog/_partials/product-prices.tpl.
   ========================================================================== */

.product-price .current-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}

.gitso-price-tax {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.gitso-price-net {
    opacity: .7;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

/* ==========================================================================
   gitso 2026-11-16: home H1 and heading case
   ========================================================================== */

/* The home page opens with the slider, so the H1 is kept for search engines
   and screen readers instead of being drawn above it. It stays in the markup
   and in the accessibility tree, it is only taken out of the layout. */
.gitso-home-h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* To show it after all, replace the rule above with this one:
.gitso-home-h1 {
    margin: 20px 0 0;
    font-size: 18px;
    font-weight: 400;
    color: #777;
}
*/

/* Headings keep the wording from the database: "Laptopy biznesowe",
   not "Laptopy Biznesowe". The theme capitalises every heading through
   --heading-text-transform, which is left alone for the other levels. */
h1,
.h1,
.page-header h1,
#js-product-list-header {
    text-transform: none !important;
}
