/* =====================================================
   VERKTYGSGUIDEN – server-rendered catalog pages
   /kategori/…, /tillverkare/…, /produkt/…, /kategorier,
   /tillverkare, /sok and the 404 page.

   These pages are plain HTML with no JavaScript. Colours
   come from the same brand palette as the interactive
   guide: #510012 (maroon), #ffcc00 (accent).
   ===================================================== */

/* ── Base for pages that do not load catalog.css ───── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-size: 14px; }

/* Cookie banner and header buttons — same rules as catalog.css, which these pages skip. */
.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    background: #1b1b1b;
    color: #fff;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .28);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.cookie-consent[hidden] { display: none; }
.cookie-consent-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.cookie-consent-text { margin: 0; font-size: 14px; line-height: 1.45; flex: 1 1 320px; }
.cookie-consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn { border: 0; border-radius: 6px; padding: 9px 18px; font-size: 14px; font-weight: 700; cursor: pointer; }
.cookie-btn-accept { background: #510012; color: #fff; }
.cookie-btn-accept:hover { background: #6a0018; }
.cookie-btn-decline { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .5); }
.cookie-btn-decline:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 600px) {
    .cookie-consent-inner { padding: 12px; gap: 12px; }
    .cookie-consent-actions { width: 100%; }
    .cookie-btn { flex: 1; }
}

.header-box {
    display: inline-flex;
    align-items: center;
    background: #510012;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .02em;
    padding: 10px 16px;
    border-radius: 6px;
    white-space: nowrap;
}
.header-box:hover { background: #6a0018; }
@media (max-width: 720px) {
    .header-box { font-size: 11px; padding: 8px 10px; }
}

:focus-visible { outline: 3px solid #ffcc00; outline-offset: 2px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.catalog-page {
    --cp-maroon: #510012;
    --cp-maroon-hover: #6a0018;
    --cp-accent: #ffcc00;
    --cp-bg: #f2f3f5;
    --cp-surface: #fff;
    --cp-border: #e2e4e8;
    --cp-text: #1a1a1a;
    --cp-muted: #6b6f76;

    min-height: 100vh;
    background: var(--cp-bg);
    color: var(--cp-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Header ─────────────────────────────────────────── */
.catalog-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    min-height: 72px;
    background: var(--cp-surface);
    border-bottom: 1px solid var(--cp-border);
    flex-wrap: wrap;
}
.catalog-header-logo img { height: 48px; width: auto; display: block; }
.catalog-header-nav { display: flex; gap: 18px; }
.catalog-header-nav a {
    color: var(--cp-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}
.catalog-header-nav a:hover { border-bottom-color: var(--cp-accent); }
.catalog-header-links { margin-left: auto; display: flex; gap: 8px; }

/* ── Shell: sidebar + main ──────────────────────────── */
.catalog-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    align-items: start;
}

.catalog-side-nav {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    padding: 14px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}
.catalog-side-nav-title {
    margin: 0 0 10px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--cp-muted);
}
.catalog-side-nav-list { list-style: none; margin: 0; padding: 0; }
.catalog-side-nav-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--cp-text);
    font-size: 14px;
}
.catalog-side-nav-link:hover { background: #f0f4f8; }
.catalog-side-nav-link.is-active { background: #050505; color: #fff; }
.catalog-side-nav-count {
    background: #e8e8e8;
    color: #555; /* 6:1 on #e8e8e8 (WCAG AA) */
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
    flex-shrink: 0;
}
.catalog-side-nav-link.is-active .catalog-side-nav-count { background: #333; color: #eee; }
.catalog-side-nav-all {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cp-maroon);
    text-decoration: none;
}

/* ── Main column ────────────────────────────────────── */
.catalog-main { min-width: 0; }

.catalog-breadcrumbs { margin: 0 0 16px; font-size: 13px; color: var(--cp-muted); }
.catalog-breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}
.catalog-breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: #aaa; }
.catalog-breadcrumbs a { color: var(--cp-maroon); text-decoration: none; }
.catalog-breadcrumbs a:hover { text-decoration: underline; }

.catalog-intro {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
}
.catalog-intro h1 {
    margin: 0 0 10px;
    font-size: clamp(24px, 3vw, 34px);
    color: var(--cp-maroon);
    line-height: 1.2;
}
.catalog-intro-lead { margin: 0; font-size: 16px; line-height: 1.6; color: #333; max-width: 70ch; }
.catalog-intro-cta { margin: 14px 0 0; font-size: 15px; font-weight: 700; }
.catalog-intro-cta a { color: var(--cp-maroon); }
.catalog-intro-brand { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.catalog-brand-logo {
    width: 160px;
    height: 80px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 8px;
    flex-shrink: 0;
}

.catalog-section { margin-bottom: 32px; }
.catalog-section > h2 {
    font-size: 20px;
    margin: 0 0 14px;
    color: var(--cp-text);
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.catalog-section-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--cp-maroon);
    text-decoration: none;
}
.catalog-section-link:hover { text-decoration: underline; }
.catalog-empty { color: var(--cp-muted); font-size: 15px; }

/* ── Chips (brand/category link lists) ──────────────── */
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 14px;
    color: var(--cp-text);
    text-decoration: none;
}
.chip:hover { border-color: var(--cp-maroon); color: var(--cp-maroon); }
.chip-count { color: var(--cp-muted); font-size: 12px; }

/* ── Link grid (category hub) ───────────────────────── */
.link-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.link-grid a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--cp-text);
}
.link-grid a:hover { border-color: var(--cp-maroon); }
.link-grid-name { font-weight: 700; font-size: 15px; }
.link-grid-count { font-size: 12px; color: var(--cp-muted); }

/* ── Brand grid ─────────────────────────────────────── */
.brand-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.brand-grid a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    color: var(--cp-text);
    text-align: center;
}
.brand-grid a:hover { border-color: var(--cp-maroon); }
.brand-grid img { width: 120px; height: 60px; object-fit: contain; }
.brand-grid-name { font-weight: 700; font-size: 15px; }
.brand-grid-count { font-size: 12px; color: var(--cp-muted); }

/* ── Product cards ──────────────────────────────────── */
.product-link-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    columns: 2 260px;
    column-gap: 24px;
}
.product-link-list li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--cp-border); }
.product-link-list a { color: var(--cp-maroon); font-weight: 600; text-decoration: none; }
.product-link-list a:hover, .product-link-list a:focus-visible { text-decoration: underline; }
.product-link-list-meta { color: var(--cp-muted); font-size: 13px; margin-left: 6px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.product-card {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    overflow: hidden;
}
.product-card:hover { border-color: var(--cp-maroon); }
.product-card-link { display: block; text-decoration: none; color: inherit; height: 100%; }
.product-card-media {
    /* Fixed box + object-fit keeps CLS at zero: the space is reserved before the image
       loads, and products with an unusual aspect ratio are contained rather than cropped. */
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border-bottom: 1px solid var(--cp-border);
    padding: 10px;
}
.product-card-media img { max-width: 100%; height: 100%; width: auto; object-fit: contain; }
.product-card-noimage { color: var(--cp-muted); font-size: 13px; font-weight: 700; }
.product-card-body { padding: 12px 14px 14px; position: relative; }
.product-card-brand {
    display: block;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cp-muted);
}
.product-card-name { margin: 3px 0 5px; font-size: 15px; line-height: 1.35; }
.product-card-category { font-size: 12px; color: var(--cp-muted); }
.product-card-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    background: var(--cp-accent);
    color: #111;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
}

/* ── Product detail ─────────────────────────────────── */
.product-detail {
    display: grid;
    grid-template-columns: minmax(280px, 560px) minmax(0, 1fr);
    gap: 28px;
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 28px;
}
.product-detail-media {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 16px;
    min-height: 320px;
}
/* Fixed 4:3 box: photos have no stored dimensions, so reserve the space up front (CLS). */
.product-detail-media img { width: 100%; max-width: 560px; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }
.product-detail-noimage { color: var(--cp-muted); }
.product-detail-info h1 {
    margin: 6px 0 12px;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.2;
    color: var(--cp-maroon);
}
.product-detail-brandline {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cp-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.product-detail-brandline a { color: var(--cp-maroon); text-decoration: none; font-weight: 700; }
.product-detail-badge {
    background: var(--cp-accent);
    color: #111;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: .04em;
}
.product-detail-description { font-size: 16px; line-height: 1.6; color: #333; max-width: 65ch; }
.product-detail-facts {
    margin: 20px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.product-detail-facts div {
    background: #fafafa;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 10px 12px;
}
.product-detail-facts dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cp-muted);
    margin-bottom: 3px;
}
.product-detail-facts dd { margin: 0; font-size: 15px; font-weight: 700; }
.product-detail-facts dd a { color: var(--cp-maroon); text-decoration: none; }
.product-detail-actions { margin: 20px 0 0; }
.product-detail-cta {
    display: inline-flex;
    background: var(--cp-maroon);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    padding: 11px 20px;
    border-radius: 6px;
}
.product-detail-cta:hover { background: var(--cp-maroon-hover); }
.product-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.product-detail-cta-secondary {
    background: var(--cp-surface);
    color: var(--cp-maroon);
    border: 2px solid var(--cp-maroon);
}
.product-detail-cta-secondary:hover { background: #f7eef0; color: var(--cp-maroon); }

/* "Jämför i katalogen" on category/manufacturer pages. */
.catalog-cta {
    display: inline-flex;
    background: var(--cp-maroon);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 6px;
}
.catalog-cta:hover { background: var(--cp-maroon-hover); color: #fff; }
.catalog-intro-cta a.catalog-cta,
.catalog-intro-cta a.catalog-cta:hover { color: #fff; text-decoration: none; }

/* ── Specification table ────────────────────────────── */
.spec-table-wrap {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border);
    border-radius: 10px;
    overflow-x: auto;
}
.spec-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.spec-table th,
.spec-table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid #eee; }
.spec-table th { font-weight: 700; color: #333; width: 45%; }
.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table tr:nth-child(even) { background: #fafafa; }

/* ── Search form ────────────────────────────────────── */
.search-form { display: flex; gap: 8px; margin-top: 14px; max-width: 520px; }
.search-form input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid var(--cp-border);
    border-radius: 6px;
    font-size: 15px;
}
.search-form button {
    background: var(--cp-maroon);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 11px 22px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
}
.search-form button:hover { background: var(--cp-maroon-hover); }

/* ── Footer ─────────────────────────────────────────── */
.catalog-footer {
    background: #1b1b1b;
    color: #d8d8d8;
    margin-top: 40px;
    padding: 36px 24px 20px;
}
.catalog-footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
}
.catalog-footer-col h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--cp-accent);
    margin: 0 0 12px;
}
.catalog-footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 20px;
}
.catalog-footer-about ul { columns: 1; margin-top: 12px; }
.catalog-footer-col li { margin-bottom: 2px; break-inside: avoid; }
.catalog-footer-col a { color: #d8d8d8; text-decoration: none; font-size: 13px; display: inline-block; padding: 4px 0; min-height: 24px; }
.catalog-footer-col a:hover { color: #fff; text-decoration: underline; }
.catalog-footer-about p { font-size: 13px; line-height: 1.6; color: #b5b5b5; margin: 0; }
.catalog-footer-legal {
    max-width: 1440px;
    margin: 28px auto 0;
    padding-top: 16px;
    border-top: 1px solid #333;
    font-size: 12px;
    color: #8a8a8a;
}

/* ── Server-rendered start-page block (homepage) ────── */
.start-static { padding: 24px; max-width: 1100px; }
.start-static-title { font-size: clamp(22px, 3vw, 30px); color: #510012; margin: 0 0 10px; }
.start-static-lead { font-size: 16px; line-height: 1.6; max-width: 70ch; margin: 0 0 24px; }
.start-static h2 { font-size: 18px; margin: 24px 0 12px; }
.start-static-more { margin: 12px 0 0; font-weight: 700; }
.start-static-more a { color: #510012; text-decoration: none; }

/* Static category links in the interactive sidebar, before catalog.js replaces them. */
.category-item-static { text-decoration: none; color: inherit; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1000px) {
    .catalog-shell { grid-template-columns: 1fr; }
    .catalog-side-nav { position: static; max-height: none; }
    /* Single column: the page content comes first, the long category menu after it. */
    .catalog-main { order: 1; }
    .catalog-side-nav { order: 2; }
    .product-detail { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .catalog-header { gap: 12px; padding: 10px 14px; }
    .catalog-header-links { width: 100%; margin-left: 0; }
    .catalog-shell { padding: 14px; gap: 16px; }
    .catalog-intro { padding: 18px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .product-card-media { height: 140px; }
    .spec-table th { width: 50%; }
    .catalog-footer-col ul { columns: 1; }
}
