/* Public discovery pages share one palette for reading and actions. */
.main_window {
    --action: var(--blue-dark);
    --text: #193d59;
    --quiet: #465f73;
    --edge: #cedeea;
    --mist: #edf5fc;
    --paper-tone: #fcfbf8;
    background: var(--paper-tone);
    color: var(--text);
}
.main_window :is(a, button, summary, input, select):focus-visible {
    outline: 3px solid #006bb1;
    outline-offset: 3px;
}
.main_window [id] { scroll-margin-top: 92px; }
.section, .catalog-shell, .page-hero, .detective-hero {
    padding-inline: max(clamp(20px, 5vw, 72px), calc((100% - 1320px) / 2));
}
.section { padding-block: clamp(36px, 5vw, 68px); }
.section.muted { background: var(--sage-wash); }
.section.muted:has(.landing-grid) { background: var(--amber-wash); }
.section-header { max-width: 760px; margin-bottom: clamp(20px, 3vw, 34px); }
.section-header h2, .detective-frame-header h2, .quick-tip h2 {
    letter-spacing: -.042em;
    text-wrap: balance;
}
.section-header p:not(.eyebrow), .page-hero p:not(.eyebrow) { color: var(--quiet); line-height: 1.55; }
.main_window .eyebrow { color: #456780; font-size: .75rem; letter-spacing: .10em; }
.hero:not(.hero--christmas) {
    background: linear-gradient(125deg,#133651,#155c90);
    min-height: auto;
}
.hero:not(.hero--christmas) .eyebrow, .quick-tip .eyebrow { color: #d7eaff; }
.hero:not(.hero--christmas) .button.primary, .quick-tip .button.primary {
    background: #e1f1ff; border-color: #e1f1ff; color: var(--text);
}
.section .feature-grid article, .section .guidance-grid article, .section .landing-card {
    border: 1px solid var(--edge);
    border-radius: 17px;
    background: #fff;
    padding: clamp(18px, 2.4vw, 32px);
}
.feature-grid article p, .landing-card p, .guidance-grid p { color: var(--quiet); }
.landing-card { display: flex; flex-direction: column; min-height: 0; gap: .45rem; }
.landing-card span { align-self: start; color: var(--action); text-underline-offset: .24em; text-decoration: underline; margin-top: auto; padding-top: 14px; }
.landing-card:hover, .landing-card:focus-visible { border-color: #6593b2; }
.product-grid { gap: clamp(14px, 1.6vw, 25px); }
.product-card {
    border: 1px solid var(--edge);
    border-radius: 18px;
    box-shadow: 0 4px 14px #143e600d;
    min-width: 0;
}
.product-card:focus-within { border-color: #6593b2; }
.product-image {
    height: auto; aspect-ratio: 4 / 3;
    border-bottom: 1px solid var(--edge);
}
.product-image img { padding: clamp(10px, 1.2vw, 18px); }
.product-body { padding: clamp(15px, 1.65vw, 23px); }
.product-card h3 { letter-spacing: -.024em; line-height: 1.3; overflow-wrap: anywhere; }
.product-badges { min-height: 0; }
.product-badges span { background: #f7ebd8; color: #75491c; }
.product-tags { margin-top: 4px; }
.product-tags span { color: var(--sage-ink); background: var(--sage-wash); font-weight: 600; }
.product-meta { gap: 5px 12px; flex-wrap: wrap; }
.product-meta strong { color: var(--text); font-size: 1.05rem; }
.product-meta span { color: var(--quiet); overflow-wrap: anywhere; }
.product-card-feedback button { color: var(--quiet); border-color: var(--edge); min-height: 38px; }
.product-card-feedback .feedback-count, .product-card-feedback button.is-active {
    background: var(--mist); border-color: #b6d2e6; color: var(--action);
}
.product-link, .catalog-actions button { background: var(--action); border-color: var(--action); border-radius: 10px; }
.product-link:hover, .catalog-actions button:hover { background: #064575; }
.empty-state { grid-column: 1 / -1; }
.page-hero {
    position: relative; isolation: isolate;
    overflow: hidden;
    border-bottom: 1px solid var(--edge);
    padding-block: clamp(38px, 5vw, 68px);
    background-color: var(--mist);
}
.page-hero.compact { padding-bottom: clamp(32px, 4vw, 56px); }
.page-hero h1 {
    max-width: 20ch; color: var(--text);
    font-size: clamp(2.35rem, 4.7vw, 4.5rem); letter-spacing: -.055em;
    text-wrap: balance; line-height: 1.04; margin-bottom: 14px;
}
.page-hero p:not(.eyebrow) { max-width: 64ch; }
.ideas-intro { background: var(--amber-wash); border-color: #e9dac3; }
.ideas-intro .eyebrow { color: var(--amber-ink); }
.ranking-intro { background: var(--plum-wash); border-color: #dfd1df; }
.ranking-intro .eyebrow { color: var(--plum-ink); }
@media (min-width: 900px) {
    .catalog-intro, .ideas-intro, .ranking-intro { padding-right: max(34%, calc((100% - 440px) / 2)); }
    .catalog-intro::after, .ideas-intro::after, .ranking-intro::after {
        content: ""; pointer-events: none; position: absolute; z-index: -1;
        right: max(5%, calc((100% - 1230px) / 2)); top: 50%;
        width: clamp(186px, 21vw, 295px); height: 78%; max-height: 215px;
        transform: translateY(-50%);
    }
    .catalog-intro::after {
        background: url('/img/simba-wspolpraca.webp') center / contain no-repeat,
                    radial-gradient(ellipse at center, #d6e6d6 0 60%, transparent 61%);
    }
    .ideas-intro::after {
        background: url('/img_d/robotki_reczne.png') left 4% bottom 10% / 52% auto no-repeat,
                    url('/img_d/mol_ksiazkowy.png') right 4% top 6% / 52% auto no-repeat,
                    radial-gradient(ellipse at center, #f8e6bf 0 60%, transparent 61%);
    }
    .ranking-intro::after {
        height: 140px;
        background: linear-gradient(#ac6d47,#995b39) left bottom / 30% 63% no-repeat,
                    linear-gradient(#e4b46a,#cea057) center bottom / 30% 90% no-repeat,
                    linear-gradient(#bd8e76,#ad7d65) right bottom / 30% 40% no-repeat;
        border-bottom: 2px solid #936955;
    }
}
.inspiration-nav { gap: 8px; }
.inspiration-nav a, .tag-row span {
    display: inline-flex; align-items: center; padding: 8px 14px;
    font-size: .93rem; border: 1px solid var(--edge); border-radius: 24px;
    color: var(--text); background: #fff; text-decoration: none;
}
.inspiration-nav a:hover, .inspiration-nav a:focus-visible { background: var(--action); color: #fff; }
.quick-tip { background: #193d59; border-radius: 20px; }

.catalog-shell { background: var(--paper-tone); padding-block: 26px 56px; }
.catalog-filters {
    grid-template-columns: minmax(190px, 2fr) repeat(2, minmax(88px, .7fr)) minmax(160px, 1.15fr);
    gap: 15px; background: white; border: 1px solid var(--edge); border-radius: 18px;
    padding: clamp(16px, 2.3vw, 28px); margin-bottom: 28px;
}
.catalog-filters label:first-child { grid-column: auto; }
.catalog-filters label { color: var(--text); min-width: 0; }
.catalog-filters :is(input, select) { border-color: #afc7d9; font-size: 1rem; font-weight: 500; }
.catalog-extra { grid-column: 1 / -1; border-top: 1px solid var(--edge); }
.catalog-extra summary { cursor: pointer; padding: 14px 0 0; font-weight: 700; }
.catalog-extra-fields { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.catalog-actions { grid-column: 1 / -1; }
.catalog-actions a { color: var(--quiet); }
.ranking-list { padding: 0; list-style: none; }
.ranking-list > li { position: relative; min-width: 0; }
.rank-place {
    position: absolute; z-index: 1; left: 12px; top: 12px;
    display: grid; place-items: center; width: 40px; height: 40px;
    color: #fff; background: var(--plum-ink); border: 2px solid white; border-radius: 50%;
    font: 700 1.2rem/1 Georgia,serif; box-shadow: 0 2px 6px #14385526; pointer-events: none;
}
.ranking-list li:first-child .rank-place { background: #78521d; }
.ranking-list li:nth-child(2) .rank-place { background: #52616a; }
.ranking-list li:nth-child(3) .rank-place { background: #80513d; }
.ranking-list li .product-card:not(:has(.product-image)) { padding-top: 42px; }

.detective-hero { min-height: auto; background: var(--sage-wash); color: var(--text); border-bottom: 1px solid var(--edge); }
.detective-hero h1 { letter-spacing: -.05em; }
.detective-hero h1 em { display: block; font: italic 1.08em/1.05 Georgia,serif; color: var(--sage-ink); }
.detective-hero p:not(.eyebrow) { color: var(--quiet); max-width: 54ch; }
.detective-hero-img { margin: 0 auto; max-width: 360px; filter: drop-shadow(0 8px 8px #2c49331f); }
.detective-hero .button.primary, .detective-board .button.primary { background: var(--action); border-color: var(--action); }
.detective-board { background: var(--paper-tone); scroll-margin-top: 86px; }
.detective-frame { border: 1px solid var(--edge); border-radius: 20px; box-shadow: 0 8px 32px #173e600d; }
.detective-frame::before { content: none; }
.detective-quiz-intro {
    display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: clamp(20px, 3vw, 42px); align-items: center;
    max-width: 980px; margin: 0 auto; padding: clamp(18px, 2.4vw, 30px);
    border-radius: 16px; background: linear-gradient(115deg, #f8f5e9, var(--sage-wash) 76%);
}
.detective-quiz-heading h2 {
    margin: 0; color: var(--text); font: 700 clamp(1.55rem, 3vw, 2.4rem)/1.08 "Montserrat", sans-serif;
    letter-spacing: -.045em; text-wrap: balance;
}
.detective-quiz-heading em { font: italic 1.08em/1 Georgia, serif; color: var(--sage-ink); }
.detective-quiz-heading p { max-width: 37ch; margin: 8px 0 0; color: var(--quiet); line-height: 1.45; }
.detective-frame.has-results .detective-quiz-intro { display: none; }
.detective-host {
    display: grid; grid-template-columns: clamp(84px, 9vw, 124px) minmax(0, 1fr);
    align-items: center; gap: 12px;
}
.detective-host-portrait { display: block; width: 100%; height: auto; border-radius: 0 0 38% 38%; }
.detective-host-speech {
    position: relative; padding: 14px 18px; border-radius: 16px; background: white;
    box-shadow: 0 3px 12px #2948330c;
}
.detective-host-speech::before {
    content: ""; position: absolute; top: 50%; left: -9px; transform: translateY(-50%);
    border-block: 7px solid transparent; border-right: 10px solid white;
}
.detective-host-speech strong { font-size: .88rem; color: var(--sage-ink); }
.detective-host-speech p { margin: 3px 0 0; color: var(--text); font-size: 1rem; font-weight: 500; line-height: 1.42; }
.detective-progress {
    display: flex; align-items: center; gap: 14px; max-width: 980px;
    margin: 16px auto;
}
.detective-progress span { flex: none; margin: 0; color: var(--sage-ink); font-size: .875rem; }
.detective-progress div { flex: 1; height: 5px; background: var(--sage-wash); }
.detective-progress i { background: var(--sage-ink); }
.detective-option { border: 2px solid var(--edge); border-radius: 16px; background: #fff; color: var(--text); box-shadow: none; }
.detective-option .option-image { background: #f3f5ef; }
.detective-option:hover, .detective-option:focus-visible, .detective-option.is-picked { border-color: var(--action); box-shadow: 0 5px 14px #164b7720; }
.detective-result-card { border-radius: 15px; border-color: var(--edge); }
.detective-result-score { color: var(--action); }
.detective-summary { padding: clamp(16px, 3vw, 34px); }
.detective-summary .button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 10px 18px; text-align: center;
    font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.25;
}
.detective-summary .detective-restart-button {
    display: flex; width: fit-content; max-width: 100%; margin: 0 auto 12px;
}
.detective-summary #detective-summary-copy { margin-bottom: 14px; text-align: center; text-wrap: balance; }
.detective-result-actions {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
    max-width: 34rem; margin: 24px auto 0;
}
.detective-result-actions .button.secondary { background: white; color: var(--action); }
.detective-result-actions .button.secondary:hover { background: var(--mist); }
@media (max-width: 800px) {
    .detective-quiz-intro { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; }
    .detective-quiz-heading p { max-width: none; }
    .detective-host { grid-template-columns: clamp(58px, 13vw, 84px) minmax(0, 1fr); }
    .detective-host-speech { padding: 10px 12px; }
}
@media (max-width: 600px) {
    .detective-result-actions { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 1fr; max-width: 20rem; gap: 10px; }
    .detective-result-actions .button { padding-inline: 12px; }
}
@media (max-width: 899px) {
    .catalog-filters, .catalog-extra-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .detective-question { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
    .detective-question .versus { display: none; }
    .detective-question .detective-option { min-height: 0; gap: 10px; padding: 10px 10px 16px; }
    .detective-question .option-image { height: auto; aspect-ratio: 1; }
    .detective-option strong { font-size: clamp(1rem, 3.2vw, 1.5rem); overflow-wrap: anywhere; }
    .detective-stage { min-height: 0; }
    .detective-hero-img { max-width: 235px; }
}
@media (max-width: 600px) {
    .product-grid { grid-template-columns: minmax(0,1fr); }
    .product-image { max-height: 248px; }
    .catalog-filters > label:first-child, .catalog-filters > label:has(select[name="sort"]) { grid-column: 1 / -1; }
    .catalog-filters select { padding-right: 28px; background-position: right 13px center, right 7px center, right 28px center; }
    .catalog-actions { flex-direction: row; flex-wrap: wrap; }
    .catalog-actions button { flex: 1; }
    .detective-hero { padding-block: 35px 22px; gap: 18px; }
    .detective-hero-img { max-width: 180px; }
    .detective-frame { padding: 16px; }
    .detective-question .option-image img { padding: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .main_window :is(.button, .landing-card, .detective-option) { transition: none; transform: none; }
}
