/* Lab catalog and section hubs */
.lc-page.lh {
    --accent: #31e274;
    --lh-text: #f5f7f6;
    --lh-muted: #aebfb5;
    --lh-green: #89f7a9;
    --lh-line: #253b31;
    --lh-mono: "JetBrains Mono", ui-monospace, monospace;
    --lh-gutter: clamp(14px, 2vw, 22px);
    container-type: inline-size;
    padding: clamp(16px, 2vw, 28px) clamp(16px, 2.5vw, 36px) 64px;
    color: var(--lh-text);
    overflow-wrap: anywhere;
}

.lh *, .lh *::before, .lh *::after { box-sizing: border-box; }

.lh-panel {
    border: 1px solid var(--lh-line);
    border-radius: 14px;
    padding: var(--lh-gutter);
    background:
        linear-gradient(110deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 54%),
        linear-gradient(180deg, #0d1b15, #07110d);
    box-shadow: 0 12px 32px #0004, inset 0 1px #ffffff08;
}

.lh-masthead {
    isolation: isolate;
    position: relative;
}

.lh-masthead::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: .7;
    content: "";
    background:
        radial-gradient(ellipse at 90% 12%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%),
        repeating-linear-gradient(90deg, #b2f8ca10 0 1px, transparent 1px 24px),
        repeating-linear-gradient(0deg, #b2f8ca10 0 1px, transparent 1px 24px);
    mask-image: linear-gradient(90deg, transparent 22%, #000);
}

.lh .lc-eyebrow {
    color: color-mix(in srgb, var(--accent) 70%, #f5f7f6);
    font: 700 .72rem/1.45 var(--lh-mono);
    letter-spacing: .07em;
}

/* Override the compact tool-page heading scale inside the catalog. */
html body.lab-shell-page .lab-canvas .lc-page.lh h1 {
    margin: 8px 0 10px !important;
    color: var(--lh-text) !important;
    font-size: clamp(1.9rem, 4.3cqi, 3.35rem) !important;
    font-weight: 800 !important;
    line-height: 1.06 !important;
    letter-spacing: -.045em !important;
}

html body.lab-shell-page .lab-canvas .lh h1 span { color: var(--lh-green) !important; }

body.lab-shell-page .lh p { color: var(--lh-muted) !important; }

.lh .lc-lede {
    max-width: 74ch;
    font-size: .98rem;
    line-height: 1.65;
}

.lh-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.lh-chip, .lh-search kbd {
    display: inline-flex;
    align-items: baseline;
    gap: .45em;
    padding: 4px 8px;
    border: 1px solid var(--lh-line);
    border-radius: 6px;
    background: #071410;
    color: #c8d7ce;
    font: 600 .72rem/1.3 var(--lh-mono);
    white-space: nowrap;
}

.lh-chip b, .lh-matching { color: var(--lh-green); }

.lh-search {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    margin-top: 12px;
    padding: 0 14px;
    border: 1px solid #355448;
    border-radius: 11px;
    background: #081610;
    color: var(--lh-green);
    box-shadow: 0 5px 20px #0004;
}

.lh-search:focus-within {
    border-color: var(--lh-green);
    box-shadow: 0 0 0 2px #31e27440;
}

.lh-search svg, .lh-search kbd { flex: none; }

.lh-search input {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--lh-text);
    background: transparent !important;
    box-shadow: none !important;
    color-scheme: dark;
    font: inherit;
}

.lh-search input::placeholder { color: var(--lh-muted); opacity: 1; }

.lh-start, .lh-section { margin-top: 24px; }

html body.lab-shell-page .lab-canvas .lh :is(.lh-start, .lh-more) h2 {
    margin: 0 0 10px;
    font-size: 1.05rem !important;
    font-weight: 800;
}

.lh-start-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.lh-feature {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 134px;
    overflow: hidden;
    padding: 15px;
    border: 1px solid color-mix(in srgb, var(--accent) 27%, #14251d);
    border-radius: 13px;
    color: var(--lh-text);
    background: linear-gradient(152deg, #10241b, #08130f 70%);
    text-decoration: none;
    transition: border-color .18s, transform .18s, box-shadow .18s;
}

.lh-feature[data-tool="iban-validator"] { --accent: #79d9ff; }
.lh-feature[data-tool="us-accounts"] { --accent: #89f7a9; }
.lh-feature[data-tool="statement-validator"] { --accent: #f2cc5d; }

.lh-feature::before {
    position: absolute;
    z-index: -1;
    inset: -22px;
    content: "";
    opacity: .55;
    background:
        radial-gradient(ellipse at 82% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 59%),
        repeating-linear-gradient(90deg, #b2f8ca12 0 1px, transparent 1px 18px),
        repeating-linear-gradient(0deg, #b2f8ca12 0 1px, transparent 1px 18px);
    mask-image: linear-gradient(140deg, transparent 18%, #000 75%);
    animation: lh-drift 16s ease-in-out infinite alternate;
    animation-delay: calc(-2s * var(--i));
}

@keyframes lh-drift {
    from { transform: translate(-8px, 4px); }
    to { transform: translate(10px, -10px); }
}

.lh-feature-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 5px;
}

.lh .lc-tile { transition: box-shadow .18s; }

.lh-feature .lc-tile {
    width: 44px;
    height: 44px;
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 17%, transparent);
}

.lh-feature strong { font-size: 1rem; font-weight: 800; line-height: 1.3; }
.lh-feature-copy { color: var(--lh-muted); font-size: .82rem; line-height: 1.45; }

.lh-arrow, .lh .lc-open {
    color: var(--accent);
    transition: transform .18s;
}

.lh-arrow { font-size: 1.15rem; }

.lh-section { scroll-margin-top: calc(var(--ls-nav-h) + var(--ls-bar-h) + 12px); }

.lh-section-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.lh-section .lh-section-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.lh .lh-panel-icon {
    width: 44px;
    height: 44px;
    box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 12%, transparent);
}

.lh-section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

html body.lab-shell-page .lab-canvas .lh .lh-section-title h2 {
    margin: 0;
    font-size: 1.16rem !important;
    font-weight: 800;
    line-height: 1.25 !important;
}

.lh-section-title h2 a { color: inherit; text-decoration: none; }
.lh-section-title h2 a:hover { text-decoration: underline; }

.lh-section-copy > p:not(.lc-lede) {
    margin: 4px 0 0;
    font-size: .87rem;
    line-height: 1.45;
}

.lh .lh-section-link {
    justify-self: start;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--lh-line));
    border-radius: 8px;
    color: var(--accent);
    background: #081610;
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}

.lh-section-link:hover { border-color: var(--accent); }

.lh .lc-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

/* At wide sizes and with a filtered catalog, collapse unoccupied tracks. */
.lh.is-filtering .lc-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

@container (min-width: 980px) {
    .lh .lc-grid:has(> .lc-card:last-child:nth-child(-n+3)) {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    }
}

@container (min-width: 1220px) {
    .lh .lc-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}

.lh .lc-card {
    isolation: isolate;
    gap: 8px;
    min-width: 0;
    min-height: 150px;
    padding: 16px;
    background: linear-gradient(155deg, #12241c, #0a1712 62%);
    box-shadow: inset 0 1px #ffffff07;
    transition: border-color .18s, transform .18s, box-shadow .18s;
}

.lh .lc-card-top { align-items: center; justify-content: space-between; gap: 8px; }
.lh .lc-card .lc-tile { width: 40px; height: 40px; }
.lh .lc-card .lc-tile svg { width: 20px; height: 20px; }

.lh-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.lh .lc-badge { font: 700 .69rem/1.45 var(--lh-mono); }
.lh .lc-badge.free, .lh .lc-badge.freemium { color: var(--lh-green); border-color: #89f7a959; }
.lh .lc-badge.pro { color: #f2cc5d; }

html body.lab-shell-page .lab-canvas .lh .lc-card :is(h2, h3) {
    margin: 0;
    font-size: 1rem !important;
    font-weight: 800;
    line-height: 1.3 !important;
}

.lh .lc-card p { font-size: .86rem; }

.lh-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.lh .lc-meta { gap: 7px; padding-top: 3px; }
.lh .lh-format { border-color: #355044; background: #081610; }
.lh .lc-open { white-space: nowrap; }

.lh .lc-card:hover, .lh .lc-card:focus-visible,
.lh-feature:hover, .lh-feature:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 65%, transparent);
    transform: translateY(-3px);
    box-shadow: 0 14px 28px -17px color-mix(in srgb, var(--accent) 72%, transparent);
}

.lh .lc-card:hover .lc-tile, .lh .lc-card:focus-visible .lc-tile,
.lh-feature:hover .lc-tile, .lh-feature:focus-visible .lc-tile {
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.lh .lc-card:hover .lc-open, .lh-feature:hover .lh-arrow { transform: translateX(3px); }

.lh a:focus-visible, .lh .lc-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .lh .lc-card::before {
        position: absolute;
        z-index: -1;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
        content: "";
        background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%),
            color-mix(in srgb, var(--accent) 15%, transparent), transparent);
        opacity: 0;
        transition: opacity .18s;
    }

    .lh .lc-card:hover::before { opacity: 1; }
}

.lh-enter .lc-card, .lh-enter .lh-feature {
    animation: lh-appear .3s ease-out backwards;
    animation-delay: calc(30ms * var(--i));
}

@keyframes lh-appear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lh .lc-faq, .lh .no-results {
    margin-top: 24px;
    padding: var(--lh-gutter);
    border-radius: 13px;
}

.lh .no-results { border: 1px dashed #355448; background: #081610; color: var(--lh-muted); }
.lh .no-results a { color: var(--lh-green); }

.lh-more { margin-top: 24px; }

.lh .lc-chip {
    border-color: color-mix(in srgb, var(--accent) 33%, var(--lh-line));
    background: color-mix(in srgb, var(--accent) 9%, #0a1712);
    color: color-mix(in srgb, var(--accent) 42%, #f5f7f6);
    font-weight: 700;
}

.lh .lc-chip:hover { border-color: var(--accent); }
.lh .lc-chip i { flex: none; box-shadow: 0 0 9px var(--accent); }

@container (width < 980px) {
    .lh-start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (width < 620px) {
    .lh-search { gap: 9px; padding-inline: 11px; }
    .lh-search input::placeholder { font-size: .84rem; }

    .lh-start-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }

    .lh-feature {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 12px;
        min-height: 0;
        padding: 12px;
    }

    .lh-feature-top { display: contents; }
    .lh-feature .lc-tile { grid-area: 1 / 1 / span 2; }
    .lh-feature strong { grid-area: 1 / 2; }
    .lh-feature-copy { grid-area: 2 / 2; }
    .lh-arrow { grid-area: 1 / 3 / span 2; }

    .lh-section .lh-section-top { grid-template-columns: auto minmax(0, 1fr); }
    .lh-section-link { grid-column: 2; }
}

@container (max-width: 510px) {
    .lh .lc-grid, .lh.is-filtering .lc-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .lh-enter .lc-card, .lh-enter .lh-feature, .lh-feature::before { animation: none; }

    .lh .lc-card, .lh .lc-tile, .lh .lc-open, .lh-feature, .lh-arrow { transition: none; }

    .lh .lc-card:hover, .lh .lc-card:focus-visible, .lh .lc-card:hover .lc-open,
    .lh-feature:hover, .lh-feature:focus-visible, .lh-feature:hover .lh-arrow { transform: none; }
}
