/* ==========================================================================
   Toolkit: a filterable grid of tools. Picking one redraws its mark in the
   particle field and lists where it was used.
   ========================================================================== */

.toolkit { padding: clamp(100px, 13vw, 170px) 0 clamp(90px, 11vw, 150px); }
.toolkit-layout { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.toolkit-aside { position: sticky; top: 96px; }
.toolkit .section-head { margin-bottom: 26px; }
.toolkit .section-title { font-size: clamp(32px, 4vw, 60px); }
.toolkit-intro { margin-top: 18px; color: var(--ink-2); max-width: 400px; }

.toolkit-focus { position: relative; }
.toolkit-stage { position: relative; aspect-ratio: 1; width: min(100%, 38vh); margin: 8px 0 18px; }
.toolkit-detail { min-height: 120px; }
.td-cat { color: var(--accent); margin-bottom: 6px; }
.td-name { font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); font-size: clamp(22px, 2.1vw, 32px); line-height: 1.05; margin-bottom: 12px; }
.td-used { display: flex; flex-wrap: wrap; gap: 6px; }
.td-used li a, .td-used li span {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
    font-size: 13px; border: 1px solid var(--line); background: var(--card); transition: border-color 0.3s, color 0.3s;
}
.td-used li a::after { content: "↗"; font-size: 11px; color: var(--accent); }
.td-used li a:hover { border-color: var(--accent); }

.toolkit-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.toolkit-filters button {
    font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
    transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.toolkit-filters button:hover { color: var(--ink); }
.toolkit-filters button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tool { display: contents; }
.tool button {
    position: relative; width: 100%; aspect-ratio: 1 / 0.92; padding: 14px 10px 12px; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 8px;
    border: 1px solid var(--line); background: var(--card); backdrop-filter: blur(10px); color: var(--ink-2);
    transition: border-color 0.35s var(--ease), color 0.35s var(--ease), transform 0.45s var(--ease), background 0.35s;
}
.tool button:hover, .tool button.is-active { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
.tool button.is-active { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.tool-mark { flex: 1; display: grid; place-items: center; width: 100%; min-height: 0; }
.tool-mark svg { width: 40px; height: 40px; max-width: 70%; }
.tool-mark svg, .tool-mark svg * { fill: currentColor !important; stroke: none !important; }
.tool-mark .mono-mark { font-family: var(--display); font-weight: var(--display-weight); font-stretch: var(--display-stretch); font-size: 16px; line-height: 1; letter-spacing: -0.02em; }
.tool-name { font-size: 12.5px; color: var(--ink); text-align: center; line-height: 1.2; }
.tool-cat { position: absolute; top: 8px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tool button.is-active .tool-cat { background: var(--accent); }
.tool.is-hidden { display: none; }

@media (max-width: 900px) {
    .toolkit-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .toolkit-aside { position: static; }
    .toolkit .section-head { margin-bottom: 18px; }
    .toolkit-intro { margin-top: 12px; font-size: 15px; }
    .toolkit-focus {
        position: relative; display: grid; grid-template-columns: 34vw 1fr; gap: 14px; align-items: center;
        min-height: calc(34vw + 20px); padding: 10px 12px; margin: 0 calc(var(--gutter) * -0.5) 14px; border-radius: 18px;
    }
    /* The card's backdrop would blur the particles, so it gets a clear window over the stage. */
    .toolkit-focus::before {
        content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; border: 1px solid var(--line);
        background: color-mix(in srgb, var(--card-solid) 90%, transparent); backdrop-filter: blur(14px);
        -webkit-mask: radial-gradient(circle at calc(12px + 17vw) 50%, transparent calc(17vw - 4px), #000 17vw);
        mask: radial-gradient(circle at calc(12px + 17vw) 50%, transparent calc(17vw - 4px), #000 17vw);
    }
    .toolkit-stage { width: 100%; margin: 0; }
    .toolkit-detail { min-height: 0; }
    .td-name { font-size: 20px; margin-bottom: 8px; }
    .td-used li a, .td-used li span { font-size: 11.5px; padding: 3px 8px; }
    /* One category at a time: a segmented control over a short grid */
    .toolkit-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 12px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
    .toolkit-filters [data-filter="all"] { display: none; }
    .toolkit-filters button { border: 0; border-radius: 999px; padding: 9px 2px; font-size: 10px; letter-spacing: 0.02em; text-align: center; white-space: nowrap; }
    .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-height: calc(3 * 27vw + 16px); align-content: start; }
    .tool button { aspect-ratio: auto; height: 27vw; border-radius: 14px; padding: 10px 6px 8px; }
    .tool-mark svg { width: 30px; height: 30px; }
    .tool-name { font-size: 11.5px; }
}
