/* ==========================================================================
   Stasacucine — materials.css
   Sekcja „Materiały i technologie”: zakładki, kafelki, porównywarka, szczegóły.
   Markup generuje js/materials.js.
   ========================================================================== */

@layer components {

    .showcase {
        overflow: hidden;
        border: 1px solid var(--line-strong);
        border-radius: var(--r-xl);
        background: var(--surface);
        box-shadow: var(--shadow-2);
    }

    .showcase-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--bg-deep); }
    .showcase-tab {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.7rem;
        min-height: 3.75rem;
        padding: 0.75rem 1rem;
        color: var(--text-2);
        font-size: var(--fs-sm);
        font-weight: 600;
        letter-spacing: 0.04em;
        transition: color var(--dur), background-color var(--dur);
    }
    .showcase-tab::after {
        content: "";
        position: absolute;
        inset: auto 20% 0;
        height: 2px;
        border-radius: 2px;
        background: var(--accent);
        transform: scaleX(0);
        transition: transform var(--dur) var(--ease);
    }
    .showcase-tab:hover { color: var(--text); background: rgb(255 255 255 / 0.03); }
    .showcase-tab[aria-selected="true"] { color: var(--accent-hi); background: var(--surface); }
    .showcase-tab[aria-selected="true"]::after { transform: scaleX(1); }
    @media (max-width: 519.98px) { .showcase-tab { flex-direction: column; gap: 0.3rem; font-size: var(--fs-xs); } }

    .showcase-panel { padding: clamp(1rem, 3vw, 2rem); }
    .showcase-panel[hidden] { display: none; }

    .compare-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem 1rem;
        margin-bottom: 1.5rem;
        padding: 0.75rem 1rem;
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        background: var(--surface-2);
        font-size: var(--fs-sm);
        color: var(--text-2);
    }
    .compare-bar .hint { flex: 1 1 16rem; display: flex; gap: 0.6rem; align-items: center; }
    .compare-bar .hint i { color: var(--accent); }
    .compare-bar .btn { min-height: 2.6rem; padding: 0.5rem 1.2rem; }
    .compare-count { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 0.4rem; border-radius: var(--r-pill); background: rgb(0 0 0 / 0.25); font-size: 0.75rem; }

    /* --- Kafelki --- */
    .tile-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); }
    .tile-grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr)); }
    @media (max-width: 419.98px) { .tile-grid:not(.tile-grid--wide) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; } }

    .tile {
        position: relative;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        background: var(--surface-2);
        transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur) var(--ease);
    }
    .tile:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-1); }
    .tile.is-selected { border-color: var(--accent); box-shadow: var(--glow); }
    .tile-open { display: flex; flex: 1; flex-direction: column; width: 100%; text-align: left; color: inherit; }
    .tile-open:focus-visible { outline-offset: -3px; }
    .tile-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-3); }
    .tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
    .tile:hover .tile-media img { transform: scale(1.05); }
    .tile-badge {
        position: absolute;
        left: 0.6rem;
        bottom: 0.6rem;
        padding: 0.25rem 0.65rem;
        border-radius: var(--r-pill);
        background: rgb(10 10 11 / 0.82);
        backdrop-filter: blur(6px);
        color: var(--accent-hi);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
    .tile-brand { position: absolute; left: 0.6rem; top: 0.6rem; padding: 0.25rem 0.65rem; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; }
    .tile-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.95rem 1rem 1.1rem; }
    .tile-name { font-size: var(--fs-sm); font-weight: 600; }
    .tile-cat { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.55; }
    .tile-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
    .tile-tags span { padding: 0.2rem 0.6rem; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 0.72rem; color: var(--text-2); }

    .compare-toggle {
        position: absolute;
        top: 0.6rem;
        right: 0.6rem;
        z-index: 2;
        display: grid;
        place-items: center;
        width: 2.25rem;
        height: 2.25rem;
        border: 1px solid var(--line-strong);
        border-radius: 50%;
        background: rgb(10 10 11 / 0.75);
        backdrop-filter: blur(6px);
        font-size: 0.8rem;
        transition: background-color var(--dur), color var(--dur), scale var(--dur) var(--ease);
    }
    .compare-toggle:hover { scale: 1.1; background: var(--accent-soft); }
    .compare-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

    /* Kafelek „zapytaj o coś wyjątkowego” */
    .tile--custom {
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        padding: 1.5rem 1.25rem;
        border-style: dashed;
        border-color: var(--accent-line);
        background: var(--accent-soft);
        text-align: center;
    }
    .tile--custom:hover { transform: none; box-shadow: none; }
    .tile--custom .custom-icon { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 1.25rem; }
    .tile--custom h4 { font-size: var(--fs-sm); }
    .tile--custom p { font-size: var(--fs-xs); color: var(--text-2); }
    .tile--custom .btn { min-height: 2.5rem; padding: 0.5rem 1.1rem; font-size: var(--fs-xs); white-space: normal; }

    /* --- Dialogi: szczegóły i porównanie --- */
    .detail { --modal-w: 46rem; }
    .detail-header { position: relative; aspect-ratio: 16 / 7; min-height: 11rem; overflow: hidden; background: var(--surface-3); }
    .detail-header img { width: 100%; height: 100%; object-fit: cover; }
    .detail-header::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, var(--surface)); }
    .detail-title { position: absolute; inset: auto 1.75rem 1.1rem; z-index: 1; }
    .detail-title h2 { font-size: var(--fs-h2); line-height: 1.1; }
    .detail-title span { display: inline-block; margin-top: 0.4rem; padding: 0.2rem 0.75rem; border-radius: var(--r-pill); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-hi); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
    .detail-body { display: grid; gap: 1.6rem; padding: 0.5rem clamp(1.25rem, 3vw, 1.75rem) clamp(1.5rem, 3vw, 2rem); }
    .detail-description { color: var(--text-2); line-height: 1.8; }
    .specs-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
    .spec-item { padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
    .spec-item h5 { margin-bottom: 0.4rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
    .spec-item p { font-size: var(--fs-sm); font-weight: 600; }
    .pros-cons { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    @media (max-width: 639.98px) { .pros-cons { grid-template-columns: 1fr; } }
    .pros-cons > div { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
    .pros-cons h5 { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.7rem; font-size: var(--fs-sm); }
    .pros h5 i { color: var(--ok); }
    .cons h5 i { color: var(--err); }
    .pros-cons ul { display: grid; gap: 0.5rem; padding-left: 1.05rem; font-size: var(--fs-sm); color: var(--text-2); }
    .pros-cons li::marker { color: var(--accent); }

    .rating-stars { display: inline-flex; gap: 0.15rem; color: var(--accent); font-size: 0.85rem; }
    .rating-stars .empty { color: var(--surface-3); }

    .comparison { --modal-w: 72rem; }
    .comparison-head { display: flex; align-items: center; gap: 0.75rem; padding: 1.25rem 4.5rem 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
    .comparison-head h2 { display: flex; align-items: center; gap: 0.75rem; font-size: var(--fs-h3); }
    .comparison-head i { color: var(--accent); }
    .comparison-table-wrapper { overflow-x: auto; padding: 1.25rem; }
    .comparison-table { width: 100%; min-width: 40rem; font-size: var(--fs-sm); }
    .comparison-table th, .comparison-table td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
    .comparison-table thead th { border-bottom-color: var(--line-strong); }
    .comparison-table tbody th, .comparison-table td:first-child { position: sticky; left: 0; background: var(--surface); font-weight: 600; color: var(--text-2); white-space: nowrap; }
    .comparison-material-header { display: grid; gap: 0.35rem; min-width: 8rem; }
    .comparison-material-header img { width: 100%; max-width: 8rem; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); }
    .comparison-material-header h4 { font-size: var(--fs-sm); }
    .comparison-material-header span { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
    .spec-badge { display: inline-block; padding: 0.2rem 0.7rem; border-radius: var(--r-pill); background: var(--surface-3); font-size: 0.75rem; font-weight: 600; }
    .spec-badge.excellent { background: var(--accent-soft); color: var(--accent-hi); border: 1px solid var(--accent-line); }
    .spec-badge.good { background: rgb(255 255 255 / 0.08); }
}
