/* Erf Studio Kit. Copyright (c) 2026 Erfan Talebi. All rights reserved.
 *
 * Kit index grid: the instrument design system on the light ground.
 * Chrome is monochrome; the only glow is data (the live LEDs, the count).
 * Tokens mirror the kit-engine chassis so /kit and the tools feel like one
 * manufactured object. No em dashes anywhere.
 */

:root {
    --kg-bg: #ececea;
    --kg-panel: #f7f7f5;
    --kg-well: #dededb;
    --kg-ink: #141412;
    --kg-soft: #55554f;
    --kg-gray: #8a8a84;
    --kg-line: rgba(20, 20, 18, 0.14);
    --kg-line2: rgba(20, 20, 18, 0.3);
    --kg-phos: #38ff70;
    --kg-phos-deep: #0f8a38; /* status text on light ground: darker for contrast */
    --kg-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    --kg-display: 'Kanit', system-ui, sans-serif;
}

/* dark mode: opt-in, remembered. The phosphor gets brighter room to glow. */
html[data-kit-theme="dark"] {
    --kg-bg: #000;
    --kg-panel: #17171a;
    --kg-well: #202024;
    --kg-ink: #ededea;
    --kg-soft: #9d9d96;
    --kg-gray: #6c6c66;
    --kg-line: rgba(237, 237, 234, 0.13);
    --kg-line2: rgba(237, 237, 234, 0.26);
    --kg-phos-deep: #38ff70; /* on dark, the bright phosphor reads best */
}
html[data-kit-theme="dark"] { background: #000; }
html[data-kit-theme="dark"] .kg-hero .fp-ground { fill: #131316; }

/* theme toggle button (grid + virtual pages) */
.kg-theme {
    font-family: var(--kg-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
    background: transparent; border: 1px solid var(--kg-line2); color: var(--kg-soft);
    padding: 6px 11px; cursor: pointer; line-height: 1; transition: color .15s, border-color .15s;
}
.kg-theme:hover { color: var(--kg-ink); border-color: var(--kg-ink); }
/* the black logo marks invert to white on dark */
html[data-kit-theme="dark"] .kg-logo,
html[data-kit-theme="dark"] .kg-tag-logo { filter: invert(1); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.kit-grid-page {
    margin: 0;
    background: var(--kg-bg);
    color: var(--kg-ink);
    font-family: var(--kg-mono);
    font-size: 12px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.kg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.kg-skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--kg-ink); color: var(--kg-panel);
    padding: 8px 14px; z-index: 10; font-family: var(--kg-mono); font-size: 11px;
}
.kg-skip:focus { left: 0; }

/* ---------- top bar ---------- */

.kg-top {
    display: flex; align-items: center; gap: 14px;
    padding: 28px 4vw;
    border-bottom: 1px solid var(--kg-line);
}
.kg-brand { display: flex; align-items: center; gap: 10px; }
.kg-logo { width: 60px; height: auto; display: block; }
.kg-sep { color: var(--kg-gray); }
.kg-tag {
    font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--kg-soft); text-decoration: none;
}
a.kg-tag:hover, a.kg-tag:focus-visible { color: var(--kg-ink); }
.kg-tag-here { color: var(--kg-ink); font-weight: 700; }
.kg-tele {
    margin-left: auto;
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--kg-gray);
    display: flex; gap: 8px; align-items: center;
    font-variant-numeric: tabular-nums;
}
.kg-count b { color: var(--kg-phos-deep); font-weight: 700; }
@media (max-width: 560px) { .kg-tele span:not(.kg-count) { display: none; } }

/* ---------- page head ---------- */

.kg-wrap { max-width: 1380px; width: 100%; margin: 0 auto; padding: 30px 24px 70px; flex: 1; }

.kg-title {
    font-family: var(--kg-display);
    font-weight: 600;
    font-size: clamp(34px, 5vw, 52px);
    line-height: 1.05;
    margin: 0 0 6px;
    letter-spacing: 0.01em;
}
.kg-title-logo { line-height: 0; margin: 0 0 18px; }
.kg-hero-logo { display: block; width: min(320px, 74vw); height: auto; }

/* Suppress the theme's site-wide boot preloader on the Kit grid pages.
   It is a full-screen fixed overlay that runs for 1800ms (erf-theme
   functions.php, wp_footer), while the hero's intro finishes at ~1260ms, so
   the whole animation used to play unseen behind it. Kit TOOL pages already
   hide it via body.kit-page in kit-front.css; the grid pages (index,
   changelog, manifesto) load kit-grid.css instead and had no such rule. */
body.kit-grid-page [id^="erf-pl-"] { display: none !important; }

/* ---------- animated hero faceplate (the ERF-KIT badge, live) ---------- */
.kg-hero { display: block; width: min(600px, 92vw); margin: 0 0 22px; -webkit-user-select: none; user-select: none; }

/* the hero and the pitch share the first screen: plate left, spec text right,
   bottom-aligned to the plate's rail. On a narrow screen it wraps back to the
   stacked layout it always had. Category pages have no hero and never get this. */
.kg-heroline { display: flex; align-items: flex-end; gap: 56px; flex-wrap: wrap; margin: 0 0 34px; }
.kg-heroline .kg-title-logo { margin: 0; flex: 0 1 600px; }
.kg-heroline .kg-hero { margin: 0; }
/* the right column is the whole pitch: what it is, why trust it, find your tool.
   The search bottom-aligns with the plate's serial rail. */
.kg-heroline .kg-heropitch { flex: 1 1 340px; display: flex; flex-direction: column;
    justify-content: flex-end; margin: 0; }
.kg-heropitch .kg-intro { margin: 0 0 20px; }
.kg-heropitch .kg-search { margin: 0; max-width: 420px; }
.kg-hero svg text { -webkit-user-select: none; user-select: none; }
.kg-hero svg { display: block; width: 100%; height: auto; overflow: visible; }
.kg-hero .fp-ground { fill: var(--kg-panel); }
.kg-hero .stroke { fill: none; stroke: var(--kg-ink); }
.kg-hero .ink { fill: var(--kg-ink); }
.kg-hero .dim { fill: var(--kg-gray); }
.kg-hero .dim-stroke { fill: none; stroke: var(--kg-gray); }

.kg-hero .frame { stroke-dasharray: 5400; stroke-dashoffset: 5400; animation: kgh-draw 520ms linear forwards; }
@keyframes kgh-draw { to { stroke-dashoffset: 0; } }

.kg-hero .screw { opacity: 0; transform: rotate(-90deg); transform-box: fill-box; transform-origin: center; }
.kg-hero .s1 { animation: kgh-seat 120ms steps(2) 420ms forwards; }
.kg-hero .s2 { animation: kgh-seat 120ms steps(2) 470ms forwards; }
.kg-hero .s3 { animation: kgh-seat 120ms steps(2) 520ms forwards; }
.kg-hero .s4 { animation: kgh-seat 120ms steps(2) 570ms forwards; }
@keyframes kgh-seat { to { opacity: 1; transform: rotate(0deg); } }

.kg-hero .ltr { opacity: 0; }
.kg-hero .ltr .glyph { fill: var(--kg-ink); }
.kg-hero .k { transform: translateX(-1900px); animation: kgh-slideK 150ms linear 660ms forwards, kgh-flash 66ms steps(1) 810ms 1; }
.kg-hero .i { transform: translateY(-1400px); animation: kgh-slideI 150ms linear 720ms forwards, kgh-flash 66ms steps(1) 870ms 1; }
.kg-hero .t { transform: translateX(1900px);  animation: kgh-slideT 150ms linear 780ms forwards, kgh-flash 66ms steps(1) 930ms 1; }
@keyframes kgh-slideK { from { opacity:1; transform: translateX(-1900px);} to { opacity:1; transform: translateX(0);} }
@keyframes kgh-slideI { from { opacity:1; transform: translateY(-1400px);} to { opacity:1; transform: translateY(0);} }
@keyframes kgh-slideT { from { opacity:1; transform: translateX(1900px);} to { opacity:1; transform: translateX(0);} }
@keyframes kgh-flash { 0% { fill: var(--kg-panel);} 100% { fill: var(--kg-ink);} }

.kg-hero .controls { opacity: 0; animation: kgh-appear 1ms steps(1) 980ms forwards; }
@keyframes kgh-appear { to { opacity: 1; } }
/* interactive parts: the intro seats them once (forwards); the script then
   takes them over (animation cleared) and drives them by inline transform,
   so hover/click stay smooth and never fight a looping keyframe. */
.kg-hero .dial-ind { transform: rotate(-160deg); transform-box: fill-box; transform-origin: 0px 0px; animation: kgh-dialpow 260ms steps(3) 1000ms forwards; transition: transform 130ms cubic-bezier(.2,.7,.2,1); }
@keyframes kgh-dialpow { to { transform: rotate(0deg); } }
.kg-hero .toggle-dot { transform: translateY(76px); animation: kgh-dotup 120ms linear 1080ms forwards; transition: transform 160ms cubic-bezier(.2,.7,.2,1); }
@keyframes kgh-dotup { to { transform: translateY(0); } }
.kg-hero .cross { transform: scale(0); transform-box: fill-box; transform-origin: center; animation: kgh-crosspop 90ms steps(2) 1140ms forwards; transition: transform 160ms cubic-bezier(.2,.7,.2,1); }
@keyframes kgh-crosspop { to { transform: scale(1); } }

.kg-hero .divider { transform: scaleX(0); transform-box: fill-box; transform-origin: left center; animation: kgh-drawline 220ms linear 1320ms forwards; }
@keyframes kgh-drawline { to { transform: scaleX(1); } }
.kg-hero .labels { opacity: 0; animation: kgh-appear 100ms linear 1360ms forwards; }

/* only the three controls invite interaction; nothing else responds to hover */
.kg-hero .dialgrp { cursor: grab; }
.kg-hero .dialgrp:active { cursor: grabbing; }
.kg-hero .togglegrp, .kg-hero .plusgrp { cursor: pointer; }
.kg-hero .scan, .kg-hero .plate { display: none; }

@media (prefers-reduced-motion: reduce) {
  .kg-hero * { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  .kg-hero .dial-ind, .kg-hero .toggle-dot, .kg-hero .cross { transition: none; }
}

.kg-intro { color: var(--kg-soft); max-width: 72ch; margin: 0 0 22px; }
/* the manifesto is the receipt for the promise the intro just made, so the link
   to it lives right there, not only in the footer plate nobody scrolls to */
.kg-creed { display: inline-block; width: fit-content; margin: 8px 0 0;
    font-family: var(--kg-mono, ui-monospace, monospace); font-size: 12px;
    letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
    color: var(--kg-soft); text-decoration: none; border-bottom: 1px solid var(--kg-line2);
    transition: color .15s, border-color .15s; }
/* its own line, flush with everything else: as inline content it wrapped and
   carried an indent, and the page reads as one left rule or not at all */
.kg-intro .kg-creed { display: block; }
.kg-creed:hover { color: var(--kg-ink); border-color: var(--kg-ink); }

/* ---------- filter ---------- */

.kg-search {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--kg-line2);
    background: var(--kg-panel);
    padding: 9px 12px;
    max-width: 420px;
    margin-bottom: 30px;
}
.kg-prompt { color: var(--kg-gray); }
#kg-filter {
    flex: 1; border: 0; outline: none; background: transparent;
    font: inherit; color: var(--kg-ink); letter-spacing: 0.04em;
}
#kg-filter::placeholder { color: var(--kg-gray); }
.kg-search:focus-within { border-color: var(--kg-ink); }
#kg-clear {
    border: 0; background: none; color: var(--kg-soft); font: inherit;
    font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1;
}
#kg-clear:hover { color: var(--kg-ink); }

/* ---------- sections ---------- */

.kg-section { margin-bottom: 34px; }
.kg-section-head {
    display: flex; align-items: baseline; gap: 10px;
    border-bottom: 1px solid var(--kg-line2);
    padding-bottom: 7px; margin-bottom: 0;
}
.kg-section-num { font-size: 10px; letter-spacing: 0.16em; color: var(--kg-gray); }
.kg-section-name {
    font-family: var(--kg-mono); font-weight: 700; font-size: 12px;
    letter-spacing: 0.22em; text-transform: uppercase;
    margin: 0; color: var(--kg-ink);
}
.kg-section-count {
    margin-left: auto; font-size: 10px; letter-spacing: 0.14em;
    color: var(--kg-gray); font-variant-numeric: tabular-nums;
}

/* hairline-tiled cells: 1px ground-colour gaps read as recessed grooves, and
 * unfilled tracks at the end of a row vanish into the page ground */
.kg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1px;
    background: var(--kg-bg);
    border: 1px solid var(--kg-line);
    border-top: none;
}
.kg-cell {
    display: flex; align-items: center; gap: 10px;
    background: var(--kg-panel);
    color: var(--kg-ink);
    text-decoration: none;
    padding: 13px 14px;
    min-height: 46px;
}
.kg-cell[hidden] { display: none; }
.kg-num { font-size: 10px; letter-spacing: 0.1em; color: var(--kg-gray); font-variant-numeric: tabular-nums; }
.kg-name { font-size: 12px; letter-spacing: 0.02em; flex: 1; min-width: 0; }
.kg-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--kg-gray);
}
.kg-led {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--kg-phos);
    box-shadow: 0 0 5px var(--kg-phos); /* data glows; chrome never does */
}
.kg-led-off { background: transparent; border: 1px solid var(--kg-line2); box-shadow: none; }

.kg-cell:hover, .kg-cell:focus-visible {
    background: var(--kg-ink);
    color: var(--kg-panel);
    outline: none;
}
.kg-cell:hover .kg-num, .kg-cell:focus-visible .kg-num,
.kg-cell:hover .kg-status, .kg-cell:focus-visible .kg-status { color: var(--kg-panel); }

.kg-soon { color: var(--kg-gray); }
.kg-soon .kg-name { color: inherit; }
.kg-soon:hover, .kg-soon:focus-visible { background: var(--kg-well); color: var(--kg-soft); }
.kg-soon:hover .kg-num, .kg-soon:hover .kg-status,
.kg-soon:focus-visible .kg-num, .kg-soon:focus-visible .kg-status { color: var(--kg-soft); }

.kg-empty { color: var(--kg-soft); padding: 26px 2px; }
.kg-all { margin-top: 8px; }
.kg-all a { color: var(--kg-soft); text-decoration: none; letter-spacing: 0.06em; }
.kg-all a:hover { color: var(--kg-ink); }

/* ---------- serial plate footer ---------- */

.kg-plate {
    border-top: 1px solid var(--kg-line2);
    background: var(--kg-well);
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 8px 24px;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--kg-gray);
}
.kg-plate-id { color: var(--kg-soft); font-weight: 500; }
.kg-plate-spec { text-transform: lowercase; letter-spacing: 0.08em; }
/* Wraps. This row carries the support links, the version and the copyright, and
   it outgrew a phone screen the day Patreon joined it: at a 390px viewport it
   measured 411px and pushed the whole index 37px sideways. The outer plate
   already wraps; this inner row did not. */
.kg-plate-right { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; min-width: 0; }
/* the shop, in the header, because a shop nobody can find is not a shop */
.kg-shoplink { color: var(--kg-ink); text-decoration: none; border: 1px solid var(--kg-line2);
    padding: 6px 11px; line-height: 1; letter-spacing: 0.1em; text-transform: uppercase;
    transition: background .15s, color .15s; }
.kg-shoplink:hover { background: var(--kg-ink); color: var(--kg-bg); border-color: var(--kg-ink); }
.kg-coffee { color: var(--kg-soft); text-decoration: none; border-bottom: 1px solid var(--kg-line2); }
.kg-coffee:hover { color: var(--kg-ink); border-color: var(--kg-ink); }
/* Sign in, in the header, because an account nobody can find is not an account.
   Boxed like the shop link so the optional door is at least visible. */
.kg-tele .kit-account { color: var(--kg-ink); text-decoration: none; border: 1px solid var(--kg-line2);
    padding: 6px 11px; line-height: 1; letter-spacing: 0.1em; text-transform: uppercase;
    transition: background .15s, color .15s; }
.kg-tele .kit-account:hover { background: var(--kg-ink); color: var(--kg-bg); border-color: var(--kg-ink); }
@media (max-width: 680px) { .kg-plate-spec { display: none; } }

/* ---------- the Kit list (index, changelog, shop only) ---------- */
.kg-list { border: 1px solid var(--kg-line2); padding: 26px 24px; margin: 46px 0 0; }
.kg-list-h { font-family: var(--kg-display); font-weight: 600; font-size: 20px; margin: 0 0 8px; letter-spacing: .01em; }
.kg-list-p { font-size: 12px; line-height: 1.9; color: var(--kg-soft); max-width: 68ch; margin: 0 0 16px; }
.kg-list-f { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.kg-list-e { font-family: var(--kg-mono); font-size: 12px; color: var(--kg-ink); background: var(--kg-bg);
    border: 1px solid var(--kg-line2); padding: 12px 13px; min-width: 260px; flex: 1 1 260px; outline: none; }
.kg-list-e:focus { border-color: var(--kg-ink); }
.kg-list-b { font-family: var(--kg-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    padding: 12px 20px; border: 1px solid var(--kg-ink); background: transparent; color: var(--kg-ink); cursor: pointer;
    transition: background .15s, color .15s; }
.kg-list-b:hover:not(:disabled) { background: var(--kg-ink); color: var(--kg-bg); }
.kg-list-b:disabled { color: var(--kg-gray); border-color: var(--kg-line2); cursor: default; }
.kg-list-m { font-size: 11px; line-height: 1.8; color: var(--kg-soft); margin: 12px 0 0; min-height: 18px; }
/* the honeypot: never shown, never announced, only bots fill it */
.kg-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) { .kg-list-e, .kg-list-b { width: 100%; } }

/* ---------- release ledger (/kit/changelog) ---------- */

.kg-log { border-top: 1px solid var(--kg-line); margin-top: 8px; }
.kg-log-entry {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 20px;
    padding: 22px 0;
    border-bottom: 1px solid var(--kg-line);
}
.kg-log-meta { display: flex; flex-direction: column; gap: 4px; padding-top: 1px; }
.kg-log-ver {
    font-family: var(--kg-mono); font-size: 13px; font-weight: 700;
    color: var(--kg-ink); letter-spacing: 0.02em;
}
.kg-log-date {
    font-family: var(--kg-mono); font-size: 11px;
    color: var(--kg-gray); letter-spacing: 0.06em;
}
.kg-log-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.kg-log-notes li { display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: baseline; }
.kg-log-tag {
    font-family: var(--kg-mono); font-size: 10px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--kg-soft);
    border: 1px solid var(--kg-line2); border-radius: 3px;
    padding: 2px 0; text-align: center; align-self: start;
}
/* one lit tag: new releases glow like a live status LED, everything else is chrome */
.kg-log-tag-new { color: var(--kg-phos-deep); border-color: var(--kg-phos-deep); }
.kg-log-text { color: var(--kg-ink); font-size: 15px; line-height: 1.5; }
.kg-log-colophon {
    color: var(--kg-soft); font-size: 13px; line-height: 1.6;
    max-width: 60ch; margin: 26px 0 18px;
}
.kg-log-colophon a { color: var(--kg-ink); text-decoration: none; border-bottom: 1px solid var(--kg-line2); }
.kg-log-colophon a:hover { border-color: var(--kg-ink); }

@media (max-width: 560px) {
    .kg-wrap { padding: 24px 16px 50px; }
    .kg-plate { padding-left: 16px; padding-right: 16px; }
    .kg-grid { grid-template-columns: 1fr 1fr; }
    .kg-log-entry { grid-template-columns: 1fr; gap: 12px; }
    .kg-log-meta { flex-direction: row; gap: 10px; align-items: baseline; }
    .kg-log-notes li { grid-template-columns: 1fr; gap: 5px; }
    .kg-log-tag { justify-self: start; padding: 2px 8px; }
}
@media (max-width: 400px) {
    .kg-grid { grid-template-columns: 1fr; }
}

