/* /category - the categories landing page (Views/Hubs/CategoryLanding.cshtml).
   SITC colour coding, as the new dashboard and its market block: white cards with a 1px #E2E2DD border and a 14px
   radius on a warm #F4F4F2 stage, text #1E1E1C / #5F5F5A, the orange #E8681C as the highlight (the headline bar, focus,
   hover edges) and #C24E0D for links and the one action, stock in green #15803D. Product photos do the talking;
   rows scroll sideways and snap. Weights 300 / 600 / 700 (Tenon's loaded cuts); never orange text on peach.
   Everything is scoped under .cat. */

.cat {
    --cat-ink: #1e1e1c;
    --cat-soft: #5f5f5a;
    --cat-stage: #f4f4f2;
    --cat-line: #e2e2dd;
    --cat-orange: #e8681c;
    --cat-accent: #c24e0d;
    --cat-green: #15803d;
    --cat-radius: 14px;
    color: var(--cat-ink);
    padding: 8px 0 64px;
}

/* ---------- headline: the dashboard's orange bar ---------- */
.cat-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
    padding: 32px 0 24px;
}
.cat-hero-text { border-left: 4px solid var(--cat-orange); padding-left: 16px; }
.cat-hero h1 {
    margin: 0;
    font-size: clamp(28px, 3.4vw, 40px);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.cat-hero-soft { color: var(--cat-soft); font-weight: 600; }
.cat-hero-figure {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    font-size: 15px;
    font-weight: 300;
    color: var(--cat-soft);
}
.cat-hero-figure::before,
.cat-card-count::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--cat-green);
}

/* ---------- the top categories: text tabs that jump to their sections (no pictures - those are in the cards) ---------- */
.cat-shelf {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
}
.cat-shelf-item {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--cat-line);
    border-radius: 999px;
    background: #fff;
    color: var(--cat-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .2s ease, color .2s ease;
}
.cat-shelf-item:hover { border-color: var(--cat-orange); color: var(--cat-accent); text-decoration: none; }

/* ---------- one section per top category, on the warm stage ---------- */
.cat-group {
    margin-top: 20px;
    padding: 24px 24px 4px;
    border-radius: var(--cat-radius);
    background: var(--cat-stage);
    scroll-margin-top: 140px;
}
.cat-group-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.cat-group-head h2 {
    margin: 0;
    font-size: clamp(20px, 2vw, 26px);
    line-height: 1.2;
    font-weight: 700;
}
/* The section's stock figure: small, in the SITC orange, beside the name - not a second headline. */
.cat-group-count { margin-left: 10px; color: var(--cat-orange); font-size: 14px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.cat-row-nav { display: flex; align-items: center; gap: 8px; flex: none; }
.cat-arrow {
    width: 34px;
    height: 34px;
    border: 1px solid var(--cat-line);
    border-radius: 50%;
    background: #fff;
    color: var(--cat-ink);
    font-size: 22px;
    line-height: 1;
    padding: 0 0 3px;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.cat-arrow:hover { border-color: var(--cat-orange); color: var(--cat-accent); }

.cat-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 2px;
    padding: 4px 2px 24px;
    margin: 0 -2px;
    scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }

.cat-card {
    position: relative;
    /* Five to a row (four gaps of 16px); fewer on narrower screens, below. */
    flex: 0 0 calc((100% - 4 * 16px) / 5);
    min-width: 0;
    height: 380px;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 0;
    border: 1px solid var(--cat-line);
    border-radius: var(--cat-radius);
    background: #fff;
    color: var(--cat-ink);
    text-decoration: none;
    scroll-snap-align: start;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, transform .25s ease;
}
.cat-card:hover {
    border-color: var(--cat-orange);
    box-shadow: 0 6px 20px rgb(30 30 28 / 8%);
    transform: translateY(-2px);
    color: var(--cat-ink);
    text-decoration: none;
}
.cat-card:focus-visible { outline: 3px solid rgb(232 104 28 / 45%); outline-offset: 2px; }
.cat-card-eyebrow {
    font-size: 12px;
    font-weight: 600;
    color: var(--cat-accent);
}
.cat-card-title {
    margin-top: 4px;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 700;
}
.cat-card-count {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cat-green);
}
.cat-card-count::before { width: 7px; height: 7px; }
/* Nothing in stock right now: grey, not the green of stock. */
.cat-card-count.is-none { color: var(--cat-soft); font-weight: 300; }
.cat-card-count.is-none::before { background: #c9c9c2; }
/* A card with its own sub-category links: the whole card is a link (cat-card-link, full size, behind), the small
   links sit above it. */
.cat-card-has-link:focus-within { border-color: var(--cat-orange); }
.cat-card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.cat-card-link:focus-visible { outline: 3px solid rgb(232 104 28 / 45%); outline-offset: 2px; }
.cat-card-kids {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 10px;
}
.cat-card-kids a {
    max-width: 100%;
    padding: 2px 8px;
    border: 1px solid var(--cat-line);
    border-radius: 999px;
    background: #fff;
    color: var(--cat-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}
.cat-card-kids a:hover { border-color: var(--cat-orange); color: var(--cat-accent); text-decoration: none; }
.cat-card-kids .cat-card-more {
    padding: 2px 2px;
    border: 1px solid transparent;
    background: none;
    color: var(--cat-accent);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    cursor: pointer;
}
.cat-card-kids .cat-card-more:hover { text-decoration: underline; }
/* A parent category's card is not a link (only its sub-category links are): no lift, no pointer. */
.cat-card:not(.cat-card-has-link):hover { transform: none; box-shadow: none; border-color: var(--cat-line); }
.cat-card:not(.cat-card-has-link):hover .cat-card-pic img { transform: none; }
/* The picture fills whatever height the text above leaves (less on a card with sub-category links): placed inside its
   area, so a tall photo shrinks to fit rather than running off the bottom of the card. */
.cat-card-pic {
    position: relative;
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 90px;
    padding: 16px 0 20px;
}
.cat-card-pic img {
    position: absolute;
    top: 14px;
    bottom: 18px;
    left: 0;
    right: 0;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100% - 32px);
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: transform .35s ease;
}
.cat-card:hover .cat-card-pic img { transform: scale(1.04); }


/* No picture yet: a soft initials tile, never an empty box. */
.cat-initials {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 18px;
    background: var(--cat-stage);
    color: var(--cat-soft);
    font-size: 28px;
    font-weight: 700;
}

/* ---------- every category, A to Z ---------- */
.cat-all {
    margin-top: 28px;
    padding: 24px;
    border: 1px solid var(--cat-line);
    border-radius: var(--cat-radius);
    background: #fff;
    scroll-margin-top: 140px;
}
.cat-letters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; }
.cat-letter {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--cat-line);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cat-ink);
    text-decoration: none;
}
.cat-letter:hover { border-color: var(--cat-orange); color: var(--cat-accent); text-decoration: none; }
.cat-letter.is-empty { color: #c9c9c2; border-color: #efefeb; }
.cat-index { columns: 4 220px; column-gap: 36px; }
.cat-index-block { break-inside: avoid; margin-bottom: 20px; scroll-margin-top: 140px; }
.cat-index-block h3 {
    margin: 0 0 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--cat-orange);
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--cat-ink);
}
.cat-index-block ul { list-style: none; margin: 0; padding: 0; }
.cat-index-block li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; border-bottom: 1px solid #f1f1ee; }
.cat-index-block li a { color: var(--cat-ink); font-weight: 300; text-decoration: none; }
.cat-index-block li a:hover { color: var(--cat-accent); text-decoration: none; }
.cat-index-block li span { color: var(--cat-green); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 1199px) { .cat-card { flex-basis: calc((100% - 3 * 16px) / 4); } }
@media (max-width: 900px) { .cat-card { flex-basis: calc((100% - 2 * 16px) / 3); } }
@media (max-width: 640px) {
    .cat-hero { padding-top: 16px; }
    .cat-group { padding: 18px 14px 2px; }
    .cat-card { flex-basis: 78%; height: 310px; }
    .cat-row-nav .cat-arrow { display: none; }
    .cat-all { padding: 18px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .cat-card, .cat-card-pic img, .cat-shelf-item, .cat-shelf-pic { transition: none; }
    .cat-card:hover, .cat-card:hover .cat-card-pic img { transform: none; }
}
