:root {
    --acid: #D4FF5C;
    --acid-dark: #bde83c;
    --ink: #0A1B2A;
    --sky: #0EA5E9;
    --sky-deep: #0284C7;
    --muted: #5A6B7A;
    --line: rgba(10, 27, 42, 0.14);
    --line-strong: rgba(10, 27, 42, 0.3);
    --ease: cubic-bezier(.16, 1, .3, 1);
    --fast: 180ms;
    --base: 260ms;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    color: var(--ink);
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--acid);
    color: var(--ink);
}

.font-display {
    font-family: 'Archivo', 'Inter', ui-sans-serif, system-ui, sans-serif;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--sky);
    outline-offset: 2px;
}

/* ---------- Section labels ---------- */
.kb-label {
    font-family: 'Archivo', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.kb-label::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    background: var(--acid);
    border: 1px solid var(--ink);
    display: inline-block;
}

/* ---------- Chips ---------- */
.kb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.42rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    background: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), color var(--fast) var(--ease);
}
a.kb-chip:hover {
    border-color: var(--ink);
    background: var(--acid);
}
.kb-chip.is-active {
    background: var(--ink);
    color: #ffffff;
    border-color: var(--ink);
}

/* ---------- Header ---------- */
.kb-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--line);
}
.kb-brand-mark {
    width: 1.55rem;
    height: 1.55rem;
    background: var(--acid);
    border: 1px solid var(--ink);
    display: inline-block;
    flex: none;
}
.kb-navlink {
    color: var(--ink);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding-bottom: 0.15rem;
    border-bottom: 2px solid transparent;
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.kb-navlink:hover {
    color: var(--sky-deep);
    border-color: var(--sky);
}

/* ---------- Inputs / buttons ---------- */
.kb-input {
    border: 1px solid var(--line-strong);
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    color: var(--ink);
    background: #ffffff;
    border-radius: 0;
    min-width: 0;
}
.kb-input:focus {
    outline: 2px solid var(--sky);
    outline-offset: 1px;
    border-color: transparent;
}
.kb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: #ffffff;
    border: 1px solid var(--ink);
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--fast) var(--ease);
}
.kb-btn:hover {
    background: #12324a;
}
.kb-btn-acid {
    background: var(--acid);
    color: var(--ink);
    border-color: var(--ink);
}
.kb-btn-acid:hover {
    background: var(--acid-dark);
    color: var(--ink);
}

/* ---------- Mosaic ---------- */
.kb-mosaic {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 158px;
    gap: 10px;
}
.kb-tile {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #eef4f8;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.kb-tile-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--base) var(--ease);
}
.kb-tile:hover .kb-tile-img {
    transform: scale(1.045);
}
.kb-tile-body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.9rem 1rem 1rem;
    background: linear-gradient(to top, rgba(10, 27, 42, 0.88), rgba(10, 27, 42, 0) 72%);
    color: #ffffff;
    transition: padding var(--base) var(--ease);
}
.kb-tile:hover .kb-tile-body {
    padding-bottom: 1.25rem;
}
.kb-tile-eyebrow {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--acid);
}
.kb-tile-title {
    font-family: 'Archivo', sans-serif;
    font-weight: 700;
    line-height: 1.15;
    margin: 0.28rem 0 0;
    color: #ffffff;
}
.kb-tile-dek {
    font-size: 0.85rem;
    line-height: 1.45;
    opacity: 0.92;
    margin: 0.35rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kb-tile-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.kb-tile-time::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    background: var(--acid);
    border-radius: 999px;
    flex: none;
}
.kb-tile-featured {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 316px;
}
.kb-tile-featured .kb-tile-title {
    font-size: clamp(1.45rem, 2.4vw, 2.05rem);
    max-width: 17ch;
}
.kb-tile-featured .kb-tile-body {
    padding: 1.4rem;
}
.kb-tile-sm {
    min-height: 158px;
}
.kb-tile-sm .kb-tile-title {
    font-size: 1.02rem;
}
.kb-tile-sm .kb-tile-dek {
    display: none;
}

/* ---------- Floating chips ---------- */
.kb-float-chips {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 10;
    background: var(--acid);
    border: 1px solid var(--ink);
    padding: 0.9rem 1.1rem;
    max-width: 15.5rem;
}
.kb-float-chips h3 {
    font-family: 'Archivo', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    margin: 0 0 0.35rem;
    letter-spacing: 0.02em;
}
.kb-float-chips a {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.18rem 0;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px dashed rgba(10, 27, 42, 0.3);
}
.kb-float-chips a:last-child {
    border-bottom: 0;
}
.kb-float-chips a:hover {
    text-decoration: underline;
}

/* ---------- Stats strip ---------- */
.kb-stats {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.kb-stat {
    border-left: 1px solid var(--line);
    padding: 1.15rem 1.35rem;
}
.kb-stat:first-child {
    border-left: 0;
}
.kb-stat b {
    font-family: 'Archivo', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    display: block;
    line-height: 1;
}
.kb-stat span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-top: 0.4rem;
}

/* ---------- Cards / rows ---------- */
.kb-card {
    border: 1px solid var(--line);
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: border-color var(--fast) var(--ease);
}
.kb-card:hover {
    border-color: var(--line-strong);
}
.kb-card-imgwrap {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eef4f8;
}
.kb-card-imgwrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--base) var(--ease);
}
.kb-card:hover .kb-card-imgwrap img {
    transform: scale(1.04);
}
.kb-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 0.95rem 0.25rem;
    text-decoration: none;
    color: inherit;
    transition: padding var(--fast) var(--ease);
}
.kb-row:first-child {
    border-top: 0;
}
.kb-row:hover {
    padding-left: 0.6rem;
}
.kb-row-thumb {
    width: 104px;
    height: 68px;
    object-fit: cover;
    flex: none;
    border: 1px solid var(--line);
    background: #eef4f8;
}

/* ---------- Prose ---------- */
.kb-prose {
    white-space: pre-line;
    line-height: 1.8;
    color: #24384a;
    max-width: 66ch;
    font-size: 1.02rem;
}

/* ---------- Footer ---------- */
.kb-footer {
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}
.kb-footer a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.kb-footer a:hover {
    color: var(--sky-deep);
    text-decoration: underline;
}

/* ---------- Motion ---------- */
.kb-mosaic-scope .kb-tile,
.kb-mosaic-scope .kb-float-chips {
    animation: kb-rise 500ms var(--ease) both;
}
.kb-mosaic-scope .kb-tile:nth-child(1) { animation-delay: 0ms; }
.kb-mosaic-scope .kb-tile:nth-child(2) { animation-delay: 60ms; }
.kb-mosaic-scope .kb-tile:nth-child(3) { animation-delay: 110ms; }
.kb-mosaic-scope .kb-tile:nth-child(4) { animation-delay: 160ms; }
.kb-mosaic-scope .kb-tile:nth-child(5) { animation-delay: 210ms; }
.kb-mosaic-scope .kb-tile:nth-child(6) { animation-delay: 260ms; }
.kb-mosaic-scope .kb-float-chips { animation-delay: 220ms; }
.kb-stats .kb-stat {
    animation: kb-rise 500ms var(--ease) both;
}
.kb-stats .kb-stat:nth-child(2) { animation-delay: 70ms; }
.kb-stats .kb-stat:nth-child(3) { animation-delay: 130ms; }
.kb-stats .kb-stat:nth-child(4) { animation-delay: 190ms; }

@keyframes kb-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}
@media (hover: none) {
    .kb-tile:hover .kb-tile-img,
    .kb-card:hover .kb-card-imgwrap img {
        transform: none;
    }
    .kb-tile:hover .kb-tile-body,
    .kb-row:hover {
        padding: inherit;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .kb-mosaic {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    .kb-tile,
    .kb-tile-sm {
        min-height: 210px;
    }
    .kb-tile-featured {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 320px;
    }
    .kb-tile-featured .kb-tile-title {
        font-size: 1.5rem;
    }
    .kb-float-chips {
        position: static;
        margin-top: 10px;
        max-width: none;
    }
    .kb-stat {
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .kb-stat:first-child {
        border-top: 0;
    }
}
