/* =====================================================================
   KidZaps 2026 — "Paper & Crayon Studio" design layer
   ---------------------------------------------------------------------
   • Loaded AFTER main.css / responsive.css, so it only ENHANCES.
   • Every new component is namespaced `kz26-` → zero collision with
     existing selectors. A handful of existing classes (.worksheet-card,
     .category-card, .grade-pill, .faq-item, .breadcrumb) receive
     purely cosmetic refinements that keep their layout intact.
   • Re-uses existing design tokens (--brand-*, --amber-*, --surface,
     --heading, --font-heading …) so light + dark themes both work.
   • Motion is disabled for users with prefers-reduced-motion.
   ===================================================================== */

:root {
    --kz26-paper: #FFFDF7;
    --kz26-paper-edge: #EFE9DA;
    --kz26-ink: var(--brand-700, #274187);
    --kz26-crayon-1: #F25F5C;
    /* tomato crayon */
    --kz26-crayon-2: #FFB627;
    /* sunflower */
    --kz26-crayon-3: #2EC4B6;
    /* sea-glass */
    --kz26-crayon-4: #6A4C93;
    /* grape */
    --kz26-crayon-5: #3E5CB4;
    /* ink blue */
    --kz26-radius: 18px;
    --kz26-shadow-paper: 0 1px 0 rgba(28, 25, 18, .04), 0 10px 30px -12px rgba(28, 25, 18, .18);
    --kz26-shadow-lift: 0 2px 0 rgba(28, 25, 18, .04), 0 22px 40px -16px rgba(28, 25, 18, .28);
    --kz26-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

:root[data-theme="dark"] {
    --kz26-paper: #1C222C;
    --kz26-paper-edge: #2A3240;
    --kz26-ink: #93ABF2;
    --kz26-shadow-paper: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
    --kz26-shadow-lift: 0 2px 0 rgba(0, 0, 0, .3), 0 24px 44px -16px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --kz26-paper: #1C222C;
        --kz26-paper-edge: #2A3240;
        --kz26-ink: #93ABF2;
        --kz26-shadow-paper: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
        --kz26-shadow-lift: 0 2px 0 rgba(0, 0, 0, .3), 0 24px 44px -16px rgba(0, 0, 0, .7);
    }
}

/* ---------- Shared primitives ---------- */

.kz26-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--kz26-ink);
    background: rgba(var(--brand-rgb), .08);
    border: 1px solid rgba(var(--brand-rgb), .16);
    padding: .35rem .8rem;
    border-radius: 999px;
}

.kz26-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kz26-crayon-3);
    box-shadow: 0 0 0 3px rgba(46, 196, 182, .25);
}

/* Hand-drawn crayon underline under a highlighted word */
.kz26-crayon {
    position: relative;
    white-space: nowrap;
    z-index: 0;
}

.kz26-crayon::after {
    content: "";
    position: absolute;
    left: -2%;
    right: -2%;
    bottom: .02em;
    height: .38em;
    z-index: -1;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 24' preserveAspectRatio='none'><path d='M2 16 C 60 6, 120 20, 180 10 S 270 8, 298 14' fill='none' stroke='%23FFB627' stroke-width='12' stroke-linecap='round' opacity='.85'/></svg>") no-repeat center / 100% 100%;
}

.kz26-section {
    padding: clamp(2.5rem, 5vw, 4.5rem) 0;
    position: relative;
}

.kz26-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.kz26-section-head h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    line-height: 1.15;
    color: var(--heading);
    margin: .5rem 0 0;
    letter-spacing: -.01em;
}

.kz26-section-head p {
    margin: .4rem 0 0;
    color: var(--text-muted);
    max-width: 62ch;
}

.kz26-link-arrow {
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}

.kz26-link-arrow:hover {
    color: var(--link-hover);
}

.kz26-link-arrow::after {
    content: "→";
    transition: transform var(--transition-fast);
}

.kz26-link-arrow:hover::after {
    transform: translateX(3px);
}

.kz26-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.kz26-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--brand-rgb), .45);
    background: rgba(var(--brand-rgb), .06);
    color: var(--link);
}

.kz26-chip.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.kz26-paper-card {
    background: var(--kz26-paper);
    border: 1px solid var(--kz26-paper-edge);
    border-radius: var(--kz26-radius);
    box-shadow: var(--kz26-shadow-paper);
}

/* ---------- Visual refinement of EXISTING cards (cosmetic only) ---------- */

.worksheet-card {
    border-radius: var(--kz26-radius);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.worksheet-card:hover {
    transform: translateY(-4px) rotate(-.25deg);
    box-shadow: var(--kz26-shadow-lift);
}

.worksheet-card:focus-visible,
.category-card:focus-visible,
.kz26-chip:focus-visible,
.kz26-persona:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 3px;
}

.worksheet-card .worksheet-info h4 {
    font-family: var(--font-heading);
    letter-spacing: -.005em;
}

.category-card {
    border-radius: var(--kz26-radius);
}

.grade-pill {
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.grade-pill:hover {
    transform: translateY(-1px);
}

/* =====================================================================
   HOME — split hero with paper stack
   ===================================================================== */

.kz26-hero {
    position: relative;
    z-index: 2;
    /* dropdown paints above the next section */
    /* 2026-11 — was `overflow: hidden`, which clipped the live search
       suggestions. Horizontal overflow (rotated paper stack) is still clipped
       where `overflow: clip` is supported; vertical stays visible. */
    overflow: visible;
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(var(--amber-rgb), .18), transparent 60%),
        radial-gradient(900px 380px at -10% 110%, rgba(46, 196, 182, .14), transparent 60%),
        var(--hero-bg);
    padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
    border-bottom: 1px solid var(--border);
}

.kz26-hero::before {
    /* notebook rules + margin line — the "top of a fresh worksheet" */
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0 56px, var(--hero-margin) 56px 57.5px, transparent 57.5px),
        repeating-linear-gradient(180deg, transparent 0 31px, var(--hero-rule) 31px 32px),
        var(--kz26-grain);
    pointer-events: none;
    opacity: .9;
}

.kz26-hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}

.kz26-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.1rem, 4.6vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--hero-heading);
    margin: 1rem 0 1rem;
}

.kz26-hero-lead {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.65;
    color: var(--hero-text);
    max-width: 58ch;
    margin: 0 0 1.5rem;
}

/* 2026-11 fix — the sticky grade bar (.grade-bar, z-index 999, rendered
   AFTER the hero) painted on top of the live-search dropdown. While the
   dropdown is open (class toggled by app.js, plus a :has() fallback) the
   hero is lifted above the grade bar but stays below the sticky header
   (z-index 1000), and the grade bar is temporarily lowered. */
.kz-suggest-open .kz26-hero,
.kz26-hero:has(.kz26-hero-suggest:not([hidden])) {
    z-index: 999;
}

.kz-suggest-open .grade-bar,
body:has(.kz26-hero-suggest:not([hidden])) .grade-bar {
    z-index: 1;
}

@supports (overflow: clip) {
    .kz26-hero {
        overflow-x: clip;
        overflow-y: visible;
    }
}

/* Loading state while suggestions are being fetched */
.kz26-hero-search .suggest-loading {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1rem;
    color: var(--text-muted);
    font-size: .88rem;
}

.kz26-hero-search .suggest-loading::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    border-top-color: var(--color-primary);
    animation: kz26Spin .7s linear infinite;
}

@keyframes kz26Spin {
    to {
        transform: rotate(360deg);
    }
}

.search-suggestions mark {
    background: rgba(var(--amber-rgb), .3);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

/* Search (kept as a real GET form → /search, same as before).
   2026-11 — now also hosts the live AJAX suggestions that used to live in
   the header search. ONE visual box only: the outer form draws the border,
   the inner <input> is completely reset (fixes the "box inside a box"). */
.kz26-hero-search {
    position: relative;
    /* anchor for the suggestions dropdown */
    z-index: 30;
    /* dropdown floats above chips/stats/paper stack */
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    max-width: 640px;
    margin: 0;
    background: var(--surface);
    border: 2px solid var(--border-strong);
    border-radius: 16px;
    padding: .4rem .4rem .4rem 1rem;
    box-shadow: var(--kz26-shadow-paper);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    /* When app.js scrolls the box to the top on phones, keep it clear of
       the sticky header. */
    scroll-margin-top: calc(var(--header-height, 70px) + 12px);
}

.kz26-hero-search:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--ring), var(--kz26-shadow-paper);
}

.kz26-hero-search>svg {
    flex-shrink: 0;
    color: var(--text-subtle);
    pointer-events: none;
}

/* Full reset of the inner field — nothing here may draw a second box. */
.kz26-hero-search input[type="search"],
.kz26-hero-search input[type="search"]:hover,
.kz26-hero-search input[type="search"]:focus,
.kz26-hero-search input[type="search"]:focus-visible {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: .75rem .25rem;
    border: 0 !important;
    border-radius: 0;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}

.kz26-hero-search input[type="search"]::placeholder {
    color: var(--text-subtle);
    opacity: 1;
}

/* Hide the browser's own clear (×) and decoration so they can't render a frame. */
.kz26-hero-search input[type="search"]::-webkit-search-decoration,
.kz26-hero-search input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

.kz26-hero-search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    cursor: pointer;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A887F' stroke-width='2.5' stroke-linecap='round'><path d='M18 6 6 18M6 6l12 12'/></svg>") center / 16px no-repeat;
}

.kz26-hero-search button[type="submit"] {
    position: static;
    /* neutralise any legacy absolute rule */
    transform: none;
    flex-shrink: 0;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    padding: .8rem 1.4rem;
    border-radius: 12px;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.kz26-hero-search button[type="submit"]:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.kz26-hero-search button[type="submit"]:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* Live suggestions dropdown — reuses the shared .search-suggestions /
   .suggest-* styles from layouts/main.php, sized for the hero. */
.kz26-hero-search .kz26-hero-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: min(60vh, 460px);
    max-height: min(60dvh, 460px);
    /* dvh shrinks with the mobile keyboard */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    box-shadow: var(--kz26-shadow-lift);
}

.kz26-hero-search .kz26-hero-suggest .suggest-item {
    min-height: 44px;
    /* comfortable touch target */
}

.kz26-hero-search .kz26-hero-suggest .suggest-title {
    overflow-wrap: anywhere;
}

/* Tablet & phone — compact, readable, thumb-friendly dropdown */
@media (max-width: 768px) {
    .kz26-hero-search .kz26-hero-suggest {
        top: calc(100% + 6px);
        max-height: min(55vh, 400px);
        max-height: min(50dvh, 400px);
        border-radius: 14px;
    }

    .kz26-hero-search .kz26-hero-suggest .suggest-group {
        padding: .55rem .9rem .2rem;
        font-size: .68rem;
    }

    .kz26-hero-search .kz26-hero-suggest .suggest-item {
        padding: .6rem .9rem;
        gap: .6rem;
    }

    .kz26-hero-search .kz26-hero-suggest .suggest-title {
        font-size: .92rem;
        line-height: 1.3;
    }

    .kz26-hero-search .kz26-hero-suggest .suggest-meta {
        font-size: .72rem;
    }

    .kz26-hero-search .kz26-hero-suggest .suggest-more {
        position: sticky;
        /* "See all results" always reachable */
        bottom: 0;
        background: var(--surface);
        margin-top: 0;
    }
}

.kz26-quick {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-top: 1rem;
    font-size: .88rem;
    color: var(--text-muted);
}

/* Honest live stats */
.kz26-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin-top: 1.75rem;
    padding: 0;
    list-style: none;
}

.kz26-stats li {
    display: flex;
    flex-direction: column;
}

.kz26-stats strong {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    line-height: 1;
    color: var(--heading);
}

.kz26-stats span {
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

/* Paper stack — three real worksheet previews fanned out */
.kz26-stack {
    position: relative;
    height: clamp(300px, 34vw, 430px);
    max-width: 440px;
    margin-inline: auto;
    width: 100%;
}

.kz26-stack-sheet {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 72%;
    aspect-ratio: 210 / 297;
    height: auto;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--kz26-paper-edge);
    box-shadow: var(--kz26-shadow-lift);
    overflow: hidden;
    text-decoration: none;
    transition: transform var(--transition-slow);
    display: block;
}

.kz26-stack-sheet img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.kz26-stack-sheet:nth-child(1) {
    transform: translate(-22%, 4%) rotate(-8deg);
    z-index: 1;
}

.kz26-stack-sheet:nth-child(2) {
    transform: translate(20%, 2%) rotate(7deg);
    z-index: 2;
}

.kz26-stack-sheet:nth-child(3) {
    transform: translate(0, -2%) rotate(-1deg);
    z-index: 3;
}

.kz26-stack:hover .kz26-stack-sheet:nth-child(1) {
    transform: translate(-30%, 5%) rotate(-11deg);
}

.kz26-stack:hover .kz26-stack-sheet:nth-child(2) {
    transform: translate(28%, 3%) rotate(10deg);
}

.kz26-stack-sheet--blank {
    display: flex;
    flex-direction: column;
    gap: 9%;
    padding: 12% 10%;
    background:
        repeating-linear-gradient(180deg, transparent 0 22px, rgba(var(--brand-rgb), .08) 22px 23px),
        #fff;
}

.kz26-stack-label {
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    z-index: 5;
    background: var(--kz26-crayon-2);
    color: #3b2a00;
    font-weight: 700;
    font-size: .8rem;
    padding: .45rem .9rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35);
    white-space: nowrap;
}

/* Sticky-note doodle */
.kz26-sticky {
    position: absolute;
    top: 6%;
    right: 2%;
    z-index: 6;
    width: 112px;
    padding: .7rem .7rem .8rem;
    background: #FFF3A6;
    color: #3d3500;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
    transform: rotate(5deg);
    box-shadow: 0 10px 18px -10px rgba(0, 0, 0, .4);
    border-radius: 2px 2px 14px 2px;
}

/* =====================================================================
   HOME — "Who are you?" persona switch
   ===================================================================== */

.kz26-personas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.kz26-persona {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.4rem 1.4rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    background: var(--kz26-paper);
    border: 1px solid var(--kz26-paper-edge);
    border-radius: var(--kz26-radius);
    box-shadow: var(--kz26-shadow-paper);
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.kz26-persona::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--p-color, var(--kz26-crayon-5));
}

.kz26-persona:hover {
    transform: translateY(-4px);
    box-shadow: var(--kz26-shadow-lift);
}

.kz26-persona-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.4rem;
    background: color-mix(in srgb, var(--p-color, #3E5CB4) 14%, transparent);
}

.kz26-persona h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: .3rem 0 0;
    color: var(--heading);
}

.kz26-persona p {
    margin: 0;
    color: var(--text-muted);
    font-size: .93rem;
    line-height: 1.55;
}

.kz26-persona ul {
    list-style: none;
    margin: .4rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.kz26-persona li {
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: var(--surface-sunken);
    color: var(--text-muted);
}

.kz26-persona-cta {
    margin-top: auto;
    padding-top: .6rem;
    font-weight: 600;
    color: var(--link);
}

/* =====================================================================
   HOME — grade sticky notes
   ===================================================================== */

.kz26-grades {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .9rem;
}

.kz26-grade-note {
    --tilt: -1.5deg;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    padding: 1rem .9rem .85rem;
    text-decoration: none;
    color: #2c2400;
    background: var(--note, #FFF3A6);
    border-radius: 3px 3px 18px 3px;
    box-shadow: 0 12px 20px -14px rgba(0, 0, 0, .45);
    transform: rotate(var(--tilt));
    transition: transform var(--transition-bounce), box-shadow var(--transition-normal);
}

.kz26-grade-note::before {
    /* tape strip */
    content: "";
    position: absolute;
    top: -9px;
    left: 50%;
    width: 46px;
    height: 16px;
    transform: translateX(-50%) rotate(-3deg);
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(0, 0, 0, .05);
}

.kz26-grade-note:nth-child(even) {
    --tilt: 1.5deg;
}

.kz26-grade-note:nth-child(7n+1) {
    --note: #FFF3A6;
}

.kz26-grade-note:nth-child(7n+2) {
    --note: #FFD6C9;
}

.kz26-grade-note:nth-child(7n+3) {
    --note: #CFF3EC;
}

.kz26-grade-note:nth-child(7n+4) {
    --note: #DCE4F6;
}

.kz26-grade-note:nth-child(7n+5) {
    --note: #E8DDF7;
}

.kz26-grade-note:nth-child(7n+6) {
    --note: #FCE1EE;
}

.kz26-grade-note:nth-child(7n+7) {
    --note: #E3F4D2;
}

.kz26-grade-note:hover {
    transform: rotate(0deg) translateY(-6px) scale(1.03);
    box-shadow: 0 20px 28px -16px rgba(0, 0, 0, .5);
}

.kz26-grade-note strong {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    line-height: 1;
}

.kz26-grade-note span {
    font-size: .78rem;
    font-weight: 600;
    opacity: .78;
}

/* =====================================================================
   HOME — trust strip
   ===================================================================== */

.kz26-trust {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.kz26-trust-item {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    padding: 1.2rem;
}

.kz26-trust-item .kz26-trust-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background: rgba(var(--brand-rgb), .08);
}

.kz26-trust-item h3 {
    font-size: 1rem;
    margin: 0 0 .2rem;
    color: var(--heading);
}

.kz26-trust-item p {
    margin: 0;
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =====================================================================
   CATEGORY — coloured hero
   ===================================================================== */

.kz26-cat-hero {
    --c: var(--cat-color, #3E5CB4);
    position: relative;
    overflow: hidden;
    margin: 1rem 0 1.75rem;
    padding: clamp(1.5rem, 3.5vw, 2.5rem);
    border-radius: 24px;
    background:
        radial-gradient(600px 260px at 100% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%),
        linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, var(--surface)) 0%, var(--surface) 70%);
    border: 1px solid color-mix(in srgb, var(--c) 22%, var(--border));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
}

.kz26-cat-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--kz26-grain);
    pointer-events: none;
}

.kz26-cat-hero>* {
    position: relative;
    z-index: 1;
}

.kz26-cat-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3.6vw, 2.75rem);
    line-height: 1.08;
    letter-spacing: -.015em;
    margin: .6rem 0 .6rem;
    color: var(--heading);
}

.kz26-cat-hero p {
    margin: 0;
    color: var(--text-muted);
    max-width: 68ch;
    line-height: 1.65;
}

.kz26-cat-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.kz26-cat-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.kz26-cat-hero-art {
    width: clamp(110px, 14vw, 170px);
    aspect-ratio: 1;
    border-radius: 22px;
    overflow: hidden;
    transform: rotate(4deg);
    box-shadow: var(--kz26-shadow-lift);
    background: color-mix(in srgb, var(--c) 18%, var(--surface));
    display: grid;
    place-items: center;
    color: var(--c);
}

.kz26-cat-hero-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kz26-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin: 0 0 1.25rem;
}

.kz26-filter-row>.kz26-filter-label {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-subtle);
    margin-right: .25rem;
}

/* "Most printed" horizontal strip */
.kz26-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: .25rem .1rem 1rem;
    scrollbar-width: thin;
}

.kz26-strip>* {
    scroll-snap-align: start;
}

.kz26-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #3b2a00;
    background: var(--kz26-crayon-2);
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .4);
}

/* 2026-11 fix — strip cards are ALWAYS vertical (thumb on top), on every
   screen size. The global phone rule (responsive.css ≤480px) turns
   .worksheet-card into a ROW with a 120px thumb; inside this horizontal
   strip that produced tall half-width cards on first paint. Also opt the
   strip out of content-visibility so cards never "pop" into shape later. */
.kz26-strip>.worksheet-card {
    display: flex;
    flex-direction: column !important;
    min-width: 0;
    content-visibility: visible;
    contain-intrinsic-size: none;
}

.kz26-strip>.worksheet-card .worksheet-thumb-wrapper {
    width: 100% !important;
    flex-shrink: 0;
    aspect-ratio: 4 / 5;
    max-height: 300px;
}

.kz26-strip>.worksheet-card .worksheet-thumb-wrapper>img,
.kz26-strip>.worksheet-card .worksheet-thumb {
    width: 100%;
    height: 100% !important;
    aspect-ratio: auto;
    object-fit: cover;
}

.kz26-strip>.worksheet-card .worksheet-info {
    flex: 0 0 auto;
}

/* Related categories */
.kz26-related-cats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .85rem;
}

.kz26-related-cat {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    text-decoration: none;
    color: var(--text);
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.kz26-related-cat:hover {
    transform: translateY(-2px);
    border-color: var(--rc, var(--color-primary));
}

.kz26-related-cat i {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--rc, var(--color-primary));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rc, #3E5CB4) 18%, transparent);
}

.kz26-related-cat b {
    font-weight: 600;
    font-size: .95rem;
    display: block;
}

.kz26-related-cat small {
    color: var(--text-muted);
    font-size: .78rem;
}

/* =====================================================================
   FAQ (shared by category + worksheet; mirrors the home FAQ look)
   ===================================================================== */

.kz26-faq {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.kz26-faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

.kz26-faq details[open] {
    box-shadow: var(--shadow-md);
}

.kz26-faq summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem 1.3rem;
    font-weight: 600;
    color: var(--heading);
}

.kz26-faq summary::-webkit-details-marker {
    display: none;
}

.kz26-faq summary::after {
    content: "+";
    font-size: 1.4rem;
    line-height: 1;
    color: var(--color-accent-dark);
    transition: transform var(--transition-fast);
}

.kz26-faq details[open] summary::after {
    transform: rotate(45deg);
}

.kz26-faq .kz26-faq-a {
    padding: 0 1.3rem 1.1rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* =====================================================================
   WORKSHEET — title block, at-a-glance, takeaways, prev/next
   ===================================================================== */

.kz26-ws-head {
    margin: .5rem 0 1rem;
}

.kz26-ws-head h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.1;
    letter-spacing: -.015em;
    color: var(--heading);
    margin: .6rem 0 .5rem;
}

.kz26-ws-head p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 70ch;
}

.kz26-ws-updated {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .6rem;
}

.kz26-glance {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 1rem 0 1.25rem;
    overflow: hidden;
}

.kz26-glance>div {
    padding: .9rem 1rem;
    border-right: 1px dashed var(--kz26-paper-edge);
}

.kz26-glance>div:last-child {
    border-right: 0;
}

.kz26-glance dt {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin: 0 0 .25rem;
}

.kz26-glance dd {
    margin: 0;
    font-weight: 600;
    color: var(--heading);
    font-size: .95rem;
    word-break: break-word;
}

/* Sticky action bar — wraps the EXISTING .kz-action-buttons (same IDs) */
.kz26-action-dock {
    position: sticky;
    top: calc(var(--header-height, 70px) + 8px);
    z-index: 40;
    padding: .65rem;
    margin: 0 0 1rem;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border: 1px solid var(--border);
    box-shadow: var(--kz26-shadow-paper);
}

.kz26-takeaways {
    margin: 1.5rem 0;
    padding: 1.25rem 1.4rem;
    border-left: 5px solid var(--kz26-crayon-3);
}

.kz26-takeaways h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: 0 0 .65rem;
    color: var(--heading);
}

.kz26-takeaways ul {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text);
    line-height: 1.7;
}

.kz26-author-box {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem 1.4rem;
    margin: 2rem 0 0;
}

.kz26-author-box img,
.kz26-author-box .kz26-author-fallback {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-sunken);
    display: grid;
    place-items: center;
    color: var(--text-subtle);
}

.kz26-author-box h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--heading);
}

.kz26-author-box h3 a {
    color: inherit;
    text-decoration: none;
}

.kz26-author-box h3 a:hover {
    color: var(--link);
}

.kz26-author-box small {
    color: var(--text-muted);
    display: block;
    margin: .15rem 0 .5rem;
}

.kz26-author-box p {
    margin: 0;
    color: var(--text-muted);
    font-size: .92rem;
    line-height: 1.6;
}

.kz26-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0 0;
}

.kz26-prevnext a {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 1rem 1.2rem;
    text-decoration: none;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--heading);
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.kz26-prevnext a:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.kz26-prevnext a.is-next {
    text-align: right;
    grid-column: 2;
}

.kz26-prevnext small {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.kz26-prevnext b {
    font-weight: 600;
    line-height: 1.35;
}

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 1024px) {
    .kz26-grades {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .kz26-trust {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .kz26-hero-grid {
        grid-template-columns: 1fr;
    }

    .kz26-stack {
        height: 300px;
        max-width: 320px;
    }

    .kz26-personas {
        grid-template-columns: 1fr;
    }

    .kz26-cat-hero {
        grid-template-columns: 1fr;
    }

    .kz26-cat-hero-art {
        display: none;
    }

    .kz26-glance {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kz26-glance>div:nth-child(2) {
        border-right: 0;
    }

    .kz26-glance>div:nth-child(-n+2) {
        border-bottom: 1px dashed var(--kz26-paper-edge);
    }
}

@media (max-width: 560px) {
    .kz26-hero::before {
        background: var(--kz26-grain);
    }

    .kz26-grades {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kz26-trust {
        grid-template-columns: 1fr;
    }

    /* 2026-11 — tighter hero on phones */
    .kz26-hero {
        padding: 1.5rem 0 2rem;
    }

    .kz26-hero h1 {
        font-size: clamp(1.75rem, 8vw, 2.2rem);
        margin: .75rem 0;
    }

    .kz26-hero-lead {
        font-size: .97rem;
        margin-bottom: 1.1rem;
    }

    .kz26-eyebrow {
        font-size: .68rem;
        letter-spacing: .05em;
        padding: .35rem .7rem;
        line-height: 1.35;
    }

    /* Popular chips: label on its own line, chips in an even 2-column grid */
    .kz26-quick {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
    }

    .kz26-quick>span {
        grid-column: 1 / -1;
        font-weight: 600;
        font-size: .8rem;
    }

    .kz26-quick .kz26-chip {
        justify-content: center;
        text-align: center;
        padding: .55rem .6rem;
        font-size: .82rem;
        min-height: 40px;
        white-space: normal;
        line-height: 1.2;
    }

    /* Stats: neat 2×2 cards instead of one cramped line */
    .kz26-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .6rem;
        margin-top: 1.25rem;
    }

    .kz26-stats li {
        padding: .75rem .85rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--kz26-shadow-paper);
    }

    .kz26-stats strong {
        font-size: 1.35rem;
    }

    .kz26-stats span {
        font-size: .75rem;
    }

    .kz26-hero-search {
        flex-wrap: wrap;
        max-width: none;
        padding: .5rem;
    }

    .kz26-hero-search svg {
        display: none;
    }

    .kz26-hero-search input[type="search"],
    .kz26-hero-search input[type="search"]:focus {
        padding: .6rem .5rem;
        font-size: 16px;
        /* ≥16px stops iOS zooming on focus */
        flex-basis: 100%;
    }

    .kz26-hero-search button[type="submit"] {
        width: 100%;
    }

    .kz26-stats {
        gap: 1.1rem;
    }

    .kz26-prevnext {
        grid-template-columns: 1fr;
    }

    .kz26-prevnext a.is-next {
        grid-column: auto;
    }

    .kz26-action-dock {
        position: static;
    }
}

@media (prefers-reduced-motion: reduce) {

    .kz26-stack-sheet,
    .kz26-grade-note,
    .kz26-persona,
    .worksheet-card,
    .kz26-chip,
    .kz26-related-cat,
    .kz26-prevnext a {
        transition: none !important;
    }

    .worksheet-card:hover,
    .kz26-grade-note:hover,
    .kz26-persona:hover {
        transform: none !important;
    }
}

@media print {

    .kz26-hero,
    .kz26-action-dock,
    .kz26-prevnext,
    .kz26-author-box,
    .kz26-faq,
    .kz26-strip,
    .kz26-related-cats,
    .kz26-takeaways,
    .kz26-glance,
    .kz26-ws-head {
        display: none !important;
    }
}