/* ============================================
   TopProdukti - wspólne style
   Używany przez: index.html, category.html, article.html
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:wght@500;600;700&display=swap');

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === Zmienne globalne === */
:root {
    --bg: #fafaf7;
    --bg-soft: #f3f1ec;
    --surface: #ffffff;
    --border: #e8e5dd;
    --border-soft: #f0ede5;

    --text: #1a1a1a;
    --text-soft: #4a4a4a;
    --text-muted: #8a8780;

    --accent: #d97757;
    --accent-hover: #c25c3d;
    --accent-soft: #fbeee6;

    --secondary: #2d6a4f;

    --success: #16a34a;
    --warning: #ea580c;
    --danger: #dc2626;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);

    --radius: 12px;
    --radius-sm: 8px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Lora', Georgia, serif;

    --container: 1240px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === Header === */
.header {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    gap: 32px;
}

.logo {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-mark {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font);
    font-size: 18px;
    font-weight: 700;
}

.logo-text strong { color: var(--accent); }

.search { flex: 1; max-width: 480px; position: relative; }

.search input {
    width: 100%;
    padding: 11px 16px 11px 44px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search::before {
    content: '';
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8780' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}

.header-actions { display: flex; gap: 12px; align-items: center; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* === Nawigacja === */
.nav {
    border-top: 1px solid var(--border-soft);
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-list {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    list-style: none;
    white-space: nowrap;
}

.nav-list a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-soft);
    font-weight: 500;
    transition: all 0.15s;
}

.nav-list a:hover { background: var(--bg-soft); color: var(--text); }
.nav-list a.active { color: var(--accent); }

/* === Komponenty wspólne === */
.tag {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.tag-secondary { background: #e6f0eb; color: var(--secondary); }
.tag-soft { background: var(--bg-soft); color: var(--text-soft); }

.meta {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
    flex-wrap: wrap;
}

.meta span { display: inline-flex; align-items: center; gap: 6px; }

/* === Breadcrumbs === */
.breadcrumbs {
    padding: 20px 0 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: '/';
    margin-left: 6px;
    color: var(--border);
}

.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs li:last-child { color: var(--text); }

/* === Hero === */
.hero { padding: 48px 0 32px; }

.hero-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    min-height: 460px;
}

.hero-main {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.hero-main-img {
    height: 320px;
    position: relative;
    overflow: hidden;
}

.hero-main-img::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px;
    opacity: 0.4;
}

.hero-content {
    padding: 24px 28px 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hero-main h1 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin: 12px 0;
}

.hero-main p {
    color: var(--text-soft);
    font-size: 15px;
    margin-bottom: 16px;
}

.hero-content .meta { margin-top: auto; }

.hero-side { display: grid; grid-template-rows: 1fr 1fr; gap: 24px; }

.hero-side-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    display: grid;
    grid-template-columns: 160px 1fr;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hero-side-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.hero-side-img { height: 100%; min-height: 180px; }

.hero-side-content {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-side-content h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin: 6px 0 8px;
}

.hero-side-content p {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.45;
}

/* === Sekcje === */
.section { padding: 56px 0 16px; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--text);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-link {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

.section-link:hover { text-decoration: underline; }

/* === Karty artykułów === */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s, box-shadow 0.25s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-img {
    aspect-ratio: 16 / 10;
    position: relative;
    overflow: hidden;
}

.card-img::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    opacity: 0.45;
    transition: transform 0.3s;
}

.card:hover .card-img::after { transform: scale(1.08); }

.card-body {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-body h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin: 8px 0 10px;
    transition: color 0.15s;
}

.card:hover h3 { color: var(--accent); }

.card-body p {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}

/* === Tła kategorii (gradienty) === */
.bg-kuchnia    { background: linear-gradient(135deg, #ffd6a5 0%, #ff9f6a 100%); }
.bg-elektronika{ background: linear-gradient(135deg, #c8b6ff 0%, #8b5cf6 100%); }
.bg-sport      { background: linear-gradient(135deg, #a7f3d0 0%, #34d399 100%); }
.bg-dom        { background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%); }
.bg-uroda      { background: linear-gradient(135deg, #fbcfe8 0%, #ec4899 100%); }
.bg-moto       { background: linear-gradient(135deg, #bae6fd 0%, #0ea5e9 100%); }
.bg-dzieci     { background: linear-gradient(135deg, #fecaca 0%, #f87171 100%); }
.bg-narzedzia  { background: linear-gradient(135deg, #d6d3d1 0%, #78716c 100%); }

/* === Kategorie (boksy) === */
.categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.category-card {
    padding: 24px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.category-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-icon { font-size: 36px; margin-bottom: 8px; display: block; }
.category-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.category-count { color: var(--text-muted); font-size: 12px; }

/* === Newsletter === */
.newsletter {
    background: var(--text);
    color: white;
    padding: 56px 0;
    margin: 64px 0 0;
    border-radius: var(--radius);
}

.newsletter-inner {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 0 24px;
}

.newsletter h2 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.newsletter p {
    color: rgba(255,255,255,0.7);
    margin-bottom: 24px;
    font-size: 15px;
}

.newsletter-form {
    display: flex;
    gap: 8px;
    max-width: 460px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    padding: 13px 18px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-family: inherit;
    font-size: 14px;
}

.newsletter-form input::placeholder { color: rgba(255,255,255,0.5); }
.newsletter-form input:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,0.15); }

/* === Footer === */
.footer {
    background: var(--bg-soft);
    margin-top: 64px;
    padding: 56px 0 24px;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer ul { list-style: none; }
.footer li { margin-bottom: 8px; }
.footer a { color: var(--text-soft); font-size: 14px; }
.footer a:hover { color: var(--accent); }

.footer-about p {
    color: var(--text-soft);
    font-size: 14px;
    margin-top: 12px;
    max-width: 360px;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   WIDOK KATEGORII - category.html
   ============================================ */

.category-hero {
    padding: 48px 0 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.category-hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 32px;
    align-items: center;
}

.category-hero h1 {
    font-family: var(--font-serif);
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.category-hero-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
}

.category-hero p {
    color: var(--text-soft);
    font-size: 16px;
    max-width: 680px;
    margin-bottom: 16px;
}

.category-stats {
    display: flex;
    gap: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.category-stats strong {
    display: block;
    font-size: 24px;
    color: var(--text);
    font-family: var(--font-serif);
    margin-bottom: 2px;
}

/* Subkategorie - chips */
.subcategories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 24px 0;
}

.subcategory-chip {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-soft);
    transition: all 0.15s;
    cursor: pointer;
    font-weight: 500;
}

.subcategory-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.subcategory-chip.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

/* Toolbar kategorii */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-info { color: var(--text-muted); font-size: 14px; }
.toolbar-info strong { color: var(--text); font-weight: 600; }

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sort-select {
    padding: 8px 32px 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8780' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

/* Layout kategorii: artykuły + sidebar */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 48px;
    padding: 32px 0 0;
}

/* Karta artykułu (rozszerzona, dla listingu) */
.card-list {
    grid-template-columns: 1fr;
    display: grid;
    gap: 24px;
}

.card-large {
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s, box-shadow 0.25s;
    cursor: pointer;
}

.card-large:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card-large .card-img { aspect-ratio: auto; height: 100%; min-height: 200px; }
.card-large .card-img::after { font-size: 80px; }

.card-large .card-body { padding: 24px 28px; }

.card-large .card-body h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    margin: 10px 0 12px;
    line-height: 1.25;
}

.card-large .card-body p {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-soft);
    margin-bottom: 16px;
}

/* Paginacja */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 40px 0 0;
    align-items: center;
}

.pagination a, .pagination span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    transition: all 0.15s;
}

.pagination a:hover { background: var(--bg-soft); color: var(--text); }

.pagination .current {
    background: var(--text);
    color: white;
}

.pagination .dots { color: var(--text-muted); cursor: default; }

/* === Sidebar === */
.sidebar { position: sticky; top: 140px; align-self: start; }

.sidebar-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.sidebar-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--text);
}

.sidebar-list { list-style: none; }

.sidebar-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: start;
}

.sidebar-list li:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-list li:first-child { padding-top: 0; }

.sidebar-list .num {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.sidebar-list a {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.sidebar-list a:hover { color: var(--accent); }

.sidebar-list .small {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Sidebar newsletter mini */
.sidebar-newsletter {
    background: var(--text);
    color: white;
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
}

.sidebar-newsletter h4 {
    font-family: var(--font-serif);
    font-size: 18px;
    margin-bottom: 8px;
}

.sidebar-newsletter p {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 16px;
}

.sidebar-newsletter input {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 8px;
}

.sidebar-newsletter input::placeholder { color: rgba(255,255,255,0.5); }
.sidebar-newsletter input:focus { outline: 2px solid var(--accent); }

.sidebar-newsletter button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-newsletter button:hover { background: var(--accent-hover); }

/* ============================================
   POJEDYNCZY ARTYKUŁ - article.html
   ============================================ */

.article-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 24px 0 48px;
}

.article-header-inner { max-width: 820px; margin: 0 auto; padding: 0 24px; }

.article-title {
    font-family: var(--font-serif);
    font-size: 44px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -1px;
    margin: 16px 0 20px;
}

.article-lead {
    font-size: 19px;
    color: var(--text-soft);
    line-height: 1.55;
    margin-bottom: 24px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.author-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d97757, #c25c3d);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.author-info { display: flex; flex-direction: column; line-height: 1.3; }
.author-info .name { font-weight: 600; font-size: 14px; }
.author-info .role { color: var(--text-muted); font-size: 12px; }

.article-meta .meta { margin-left: auto; }

/* Hero artykułu */
.article-hero-img {
    max-width: 1100px;
    margin: 0 auto 40px;
    height: 480px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.article-hero-img::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 200px;
    opacity: 0.35;
}

/* Wariant z prawdziwym obrazkiem - kontener dostosowuje się do proporcji,
   żeby nie przycinać zdjęcia. Przesłania sztywną wysokość z .article-hero-img. */
.article-hero-img.has-image {
    background: var(--bg-soft);
    height: auto;
    aspect-ratio: auto;
}
.article-hero-img.has-image::after { content: none; }
.article-hero-img.has-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: unset;
}

/* Karty / hero z prawdziwym obrazkiem - dopasowanie proporcji do generowanych
   obrazów 16:9 żeby nic nie przycinać. Override starych aspect-ratio i wysokości. */
.card-img.has-image,
.hero-main-img.has-image,
.hero-side-img.has-image {
    background: var(--bg-soft);
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    width: 100%;
}

.card-img.has-image::after,
.hero-main-img.has-image::after,
.hero-side-img.has-image::after { content: none !important; }

.card-img.has-image img,
.hero-main-img.has-image img,
.hero-side-img.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Card-large (poziomy layout w kategorii) - gdy ma obraz, przełącz na wertykalny
   żeby obraz nie był sztucznie rozciągany ani przycinany do wysokości treści. */
.card-large.with-image {
    grid-template-columns: 1fr;
}
.card-large.with-image .card-img {
    height: auto;
    min-height: 0;
}

/* Hero-side-card analogicznie - gdy ma obraz, vertical stack zamiast 160px+treść.
   Obraz na pełną szerokość karty z aspect 16:9. */
.hero-side-card.with-image {
    grid-template-columns: 1fr;
}
.hero-side-card.with-image .hero-side-img {
    min-height: 0;
    height: auto;
}

/* Emoji fallback dla hero-side bez obrazka (oryginalnie nie był renderowany,
   po refactorze do tp_card_image_html jest data-emoji - pokażmy go). */
.hero-side-img:not(.has-image) {
    position: relative;
}
.hero-side-img:not(.has-image)::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    opacity: 0.45;
}

/* Layout artykułu */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 56px;
    align-items: start;
}

/* Treść artykułu */
.article-body {
    font-size: 17px;
    line-height: 1.75;
    color: var(--text);
    max-width: 720px;
}

.article-body > * + * { margin-top: 24px; }

.article-body h2 {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.5px;
    margin-top: 48px;
    padding-top: 8px;
    scroll-margin-top: 120px;
}

.article-body h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 32px;
    scroll-margin-top: 120px;
}

.article-body p { color: var(--text); }
.article-body p strong { font-weight: 600; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--accent-hover); }

.article-body ul, .article-body ol {
    padding-left: 24px;
}

.article-body li { margin-bottom: 8px; }

.article-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 0 12px 24px;
    margin: 32px 0;
    font-family: var(--font-serif);
    font-size: 22px;
    line-height: 1.4;
    font-style: italic;
    color: var(--text-soft);
}

.article-body blockquote cite {
    display: block;
    margin-top: 12px;
    font-family: var(--font);
    font-size: 14px;
    font-style: normal;
    color: var(--text-muted);
}

/* Info box / TL;DR */
.tldr {
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
    padding: 20px 24px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 32px 0;
}

.tldr-title {
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    margin-bottom: 8px;
}

.tldr p { font-size: 15.5px; margin: 0 !important; line-height: 1.6; }

/* Karta produktu - ranking */
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 32px 0;
    display: grid;
    grid-template-columns: 200px 1fr;
    transition: box-shadow 0.2s;
}

.product-card:hover { box-shadow: var(--shadow); }

.product-card-img {
    position: relative;
    min-height: 240px;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    overflow: hidden;
}

.product-card-img::after {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 90px;
    opacity: 0.45;
}

.product-rank {
    position: absolute;
    top: 12px; left: 12px;
    background: var(--text);
    color: white;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 700;
    z-index: 2;
}

.product-rank.gold { background: #d4a017; }
.product-rank.silver { background: #94a3b8; }
.product-rank.bronze { background: #b45309; }

.product-body { padding: 22px 26px; }

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}

.product-body h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    margin: 0 !important;
    line-height: 1.25;
}

.product-rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d4a017;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.product-rating .score { color: var(--text); }

.product-tagline {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px !important;
}

.product-card .product-desc {
    font-size: 14.5px !important;
    color: var(--text-soft);
    line-height: 1.55;
    margin: 0 !important;
}

.proscons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.proscons h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 700;
}

.proscons .pros h4 { color: var(--success); }
.proscons .cons h4 { color: var(--danger); }

.proscons ul { list-style: none; padding: 0; }
.proscons li {
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 4px;
    padding-left: 18px;
    position: relative;
}

.proscons .pros li::before {
    content: '+';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.proscons .cons li::before {
    content: '−';
    position: absolute;
    left: 0;
    color: var(--danger);
    font-weight: 700;
}

.product-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    gap: 12px;
    flex-wrap: wrap;
}

.product-cta .btn {
    white-space: nowrap;
    color: white !important;   /* zabezpieczenie - <a> dziedziczy color, ale chcemy white */
}

.product-price {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
}

.product-price .old {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 16px;
    margin-right: 8px;
    font-weight: 400;
}

/* Tabela porównawcza */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.compare-table th, .compare-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.compare-table th {
    background: var(--bg-soft);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-soft);
}

.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child { font-weight: 600; }

.compare-table .check { color: var(--success); font-weight: 700; }
.compare-table .cross { color: var(--text-muted); }

/* Sticky TOC */
.toc-sticky { position: sticky; top: 140px; }

.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.toc-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 700;
}

.toc ol { list-style: none; padding: 0; counter-reset: toc; }

.toc li {
    counter-increment: toc;
    padding: 8px 0;
    border-left: 2px solid var(--border-soft);
    padding-left: 16px;
    transition: all 0.15s;
}

.toc li::before {
    content: counter(toc, decimal-leading-zero);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}

.toc a {
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.4;
}

.toc li:hover { border-left-color: var(--accent); }
.toc li:hover a { color: var(--text); }

.toc li.active {
    border-left-color: var(--accent);
}

.toc li.active a { color: var(--accent); font-weight: 600; }

/* Share bar */
.share-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.share-bar span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-right: 8px;
}

.share-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 16px;
}

.share-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

/* Author box */
.author-box {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 28px;
    margin: 40px 0;
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 20px;
    align-items: start;
}

.author-box .author-avatar {
    width: 80px; height: 80px;
    font-size: 28px;
}

.author-box h4 {
    font-family: var(--font-serif);
    font-size: 18px;
    margin-bottom: 4px;
}

.author-box .role {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.author-box p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-soft);
}

/* Powiązane artykuły */
.related-section {
    background: var(--bg-soft);
    padding: 56px 0;
    margin-top: 64px;
    border-top: 1px solid var(--border);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .article-layout { grid-template-columns: 1fr; }
    .toc-sticky { position: static; }
    .toc { display: none; }
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

@media (max-width: 960px) {
    .hero-grid, .grid, .grid-3, .grid-2, .categories, .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-side { grid-template-rows: auto; }
    .hero-main h1 { font-size: 26px; }
    .section-title { font-size: 24px; }
    .header-top { gap: 12px; flex-wrap: wrap; }
    .search { order: 3; max-width: 100%; flex-basis: 100%; }
    .category-hero h1 { font-size: 32px; }
    .category-hero-inner { grid-template-columns: 1fr; }
    .article-title { font-size: 32px; }
    .article-hero-img { height: 320px; }
    .article-hero-img::after { font-size: 140px; }
    .product-card { grid-template-columns: 140px 1fr; }
    .product-card-img::after { font-size: 60px; }
    .card-large { grid-template-columns: 200px 1fr; }
    .card-large .card-body { padding: 18px 22px; }
    .card-large .card-body h3 { font-size: 18px; }
}

@media (max-width: 600px) {
    .hero-grid, .grid, .grid-3, .grid-2, .categories, .footer-grid {
        grid-template-columns: 1fr;
    }
    .hero-side-card { grid-template-columns: 1fr; }
    .hero-side-img { height: 160px; }
    .newsletter-form { flex-direction: column; }
    .container { padding: 0 16px; }
    .section { padding: 40px 0 8px; }
    .article-title { font-size: 26px; }
    .article-body { font-size: 16px; }
    .article-body h2 { font-size: 24px; }
    .article-body h3 { font-size: 19px; }
    .product-card { grid-template-columns: 1fr; }
    .product-card-img { min-height: 180px; }
    .proscons { grid-template-columns: 1fr; }
    .product-cta { flex-direction: column; align-items: stretch; }
    .card-large { grid-template-columns: 1fr; }
    .card-large .card-img { min-height: 200px; aspect-ratio: 16 / 10; }
    .author-box { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .compare-table { font-size: 12px; }
    .compare-table th, .compare-table td { padding: 10px 8px; }
}
