/* Hallmark · shape: app shell (sidebar, command bar, card grid, detail drawer) · genre: atmospheric · theme: custom (warm graphite, one amber signal; replaces Bloom at the owner's request) · redesign: full · scope: app · job: try
 * hero: none (an overview screen, not a landing) · nav: sidebar with sections and live counts · footer: none in the app shell · imagery: the product itself (cards, prompt text, commands) · signature: a card morphs into the detail drawer, and the command palette finds and copies anything from the keyboard
 * axes: dark/grotesk-sans/warm · posture: committed · contrast: pass · fonts: Manrope for the interface, JetBrains Mono for prompts and commands · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: E, an internal library has no single story; every screen leads with the records themselves and the palette is one keystroke away */
/* Hallmark · waive 12 · .copy__tick uses --ease-spring on a 16px icon only · the owner asked for spring motion; controls themselves settle without overshoot */
/* Hallmark · answered F24 · the sidebar casts a shadow only when it slides over the page on narrow screens; docked, it is a hairline edge */
/* Hallmark · waive 49b · .item__link, card titles are headings and wrap like headings on a 320px phone · a nowrap title would cut the record's name */
/* Hallmark · dismissed 29 · the top bar floats over content while scrolling and needs a legible ground; the blur is the paper at 72%, one surface only */
/* Motion note: cards tilt toward a mouse pointer (max 5deg) and light their edge under it, a soft light follows the pointer across the page; all at the owner's request, fine pointers only, off under reduced motion */
@import url("./tokens.css");
@import url("./base.css");

/* Cross-page transitions: the sidebar and the top bar stay, the page content slides */
@view-transition { navigation: auto; }
.side { view-transition-name: side; }
.top { view-transition-name: top; }
.page { view-transition-name: page; }
::view-transition-old(page) { animation: vt-out var(--dur-short) var(--ease-in) both; }
::view-transition-new(page) { animation: vt-in var(--dur-xl) var(--ease-soft) both; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px) scale(0.995); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
::view-transition-group(item-card), ::view-transition-group(item-title) { animation-duration: var(--dur-xl); animation-timing-function: var(--ease-soft); }
/* Морфинг без растягивания: снимки не масштабируются, рамка растёт и открывает их, как окно */
::view-transition-group(item-card) { overflow: clip; border-radius: var(--radius-band); }
::view-transition-old(item-card), ::view-transition-new(item-card) { width: 100%; height: 100%; object-fit: none; object-position: 0 0; }
::view-transition-old(item-card) { animation-duration: var(--dur-short); }
/* Панель и замок прокрутки не сдвигают страницу: место под полосу прокрутки всегда занято */
html { scrollbar-gutter: stable; }
.vt-local .side, .vt-local .top, .vt-local .page { view-transition-name: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: var(--space-lg); z-index: var(--z-toast); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill); background: var(--color-paper-4); box-shadow: var(--shadow-pop); color: var(--color-ink); font-size: var(--text-sm); opacity: 0; transform: translate(-50%, 16px) scale(0.96); pointer-events: none; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-long) var(--ease-spring); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Ground: graphite, a faint grain and a soft light that trails the pointer */
html { scroll-padding-top: calc(var(--topbar) + var(--space-md)); }
body { position: relative; isolation: isolate; font-size: var(--text-md); line-height: 1.55; }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.05; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.light { position: fixed; left: 0; top: 0; z-index: -1; width: 900px; height: 900px; border-radius: 50%; background: radial-gradient(closest-side, var(--color-glow-2), transparent); pointer-events: none; opacity: 0; will-change: transform; contain: strict; transition: opacity var(--dur-xl) var(--ease-out); }
.light.is-on { opacity: 1; }

/* Primitives */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--space-md); top: var(--space-md); z-index: var(--z-toast); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-inner); background: var(--color-paper-3); color: var(--color-ink); transform: translateY(-200%); }
.skip:focus-visible { transform: none; outline: 2px solid var(--color-focus); outline-offset: 2px; }
h1, h2, h3 { color: var(--color-ink); max-width: none; }
h3 { font-family: var(--font-body); font-weight: 600; letter-spacing: -0.01em; font-size: var(--text-title); line-height: 1.3; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code, kbd, pre { font-family: var(--font-code); }
.ic { width: 18px; height: 18px; flex: none; }
.ic--sm { width: 15px; height: 15px; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 var(--space-2xs); border-radius: var(--radius-clip); background: var(--color-paper-3); box-shadow: inset 0 -1px 0 var(--color-rule-2), inset 0 0 0 1px var(--color-rule); color: var(--color-muted); font-size: var(--text-2xs); font-weight: 500; line-height: 1; }

/* Buttons */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: 40px; padding: 0 var(--space-md); border: 0; border-radius: var(--radius-inner); background: none; color: var(--color-ink); font: 500 var(--text-sm)/1 var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer; transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: inset 0 1px 0 var(--color-hi), 0 8px 24px -10px var(--color-glow); }
.btn--primary:hover { background: var(--color-focus); box-shadow: inset 0 1px 0 var(--color-hi-2), 0 10px 30px -8px var(--color-glow); }
.btn--quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--color-rule-2); color: var(--color-ink-2); }
.btn--quiet:hover { background: var(--color-paper-3); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-rule-3); }
.btn--quiet:active { background: var(--color-paper-4); }
.btn--sm { min-height: 32px; padding: 0 var(--space-sm); font-size: var(--text-xs); }
.btn--sm::after { content: ""; position: absolute; inset: -6px -2px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-inner); background: transparent; color: var(--color-muted); cursor: pointer; transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out); }
.icon-btn:hover { background: var(--color-paper-3); color: var(--color-ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.link { color: var(--color-accent); text-decoration: underline; text-decoration-color: var(--color-accent-soft); text-underline-offset: 0.22em; transition: text-decoration-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.link:hover { text-decoration-color: var(--color-accent); }
.link:active { color: var(--color-accent-2); }
.link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-clip); }

/* Copy feedback: the label slides, a tick springs in */
.copy { overflow: hidden; }
.copy__tick { display: none; width: 14px; height: 14px; flex: none; color: var(--color-success); }
.copy__label { display: inline-block; }
.copy[data-state="done"] { color: var(--color-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-success) 50%, transparent); }
.copy[data-state="done"] .copy__tick { display: block; animation: tick var(--dur-long) var(--ease-spring) both; }
.copy[data-state="fail"] { color: var(--color-error); }
.copy[data-state] .copy__label { animation: label-in var(--dur-short) var(--ease-out) both; }
@keyframes tick { from { opacity: 0; transform: scale(0.2) rotate(-30deg); } }
@keyframes label-in { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } }

/* App shell */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100svh; }
.side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); z-index: var(--z-sticky-nav); display: flex; flex-direction: column; gap: var(--space-lg); padding: var(--space-md) var(--space-sm); border-right: var(--rule-hair) solid var(--color-rule); background: var(--color-well); overflow-y: auto; scrollbar-width: none; }
.side__brand { display: flex; align-items: center; gap: var(--space-sm); min-height: 40px; padding: 0 var(--space-sm); border-radius: var(--radius-inner); color: var(--color-ink); font-weight: 600; font-size: var(--text-base); letter-spacing: -0.02em; text-decoration: none; transition: background-color var(--dur-short) var(--ease-out); }
.side__brand:hover { background: var(--color-paper-2); }
.side__brand:active { background: var(--color-paper-3); }
.side__brand:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.side__mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-inner); background: linear-gradient(140deg, var(--color-accent), var(--color-accent-2)); color: var(--color-accent-ink); font-size: var(--text-2xs); font-weight: 600; box-shadow: inset 0 1px 0 var(--color-hi-2), 0 4px 14px -6px var(--color-glow); }
.side__nav { position: relative; display: grid; gap: var(--space-3xs); }
.side__label { padding: 0 var(--space-sm) var(--space-2xs); font-size: var(--text-2xs); color: var(--color-faint); }
.side__link { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-sm); min-height: 36px; padding: 0 var(--space-sm); border-radius: var(--radius-inner); color: var(--color-muted); font-size: var(--text-sm); font-weight: 500; text-decoration: none; transition: color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.side__link:hover { color: var(--color-ink); background: var(--color-hover); }
.side__link:active { background: var(--color-press); }
.side__link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.side__link[aria-current="page"] { color: var(--color-ink); }
.side__link[aria-current="page"] .ic { color: var(--color-accent); }
.side__nav:not(.has-ind) .side__link[aria-current="page"] { background: var(--color-paper-3); }
.side__count { margin-left: auto; font-size: var(--text-2xs); color: var(--color-faint); font-variant-numeric: tabular-nums; }
.side__ind { position: absolute; left: 0; right: 0; top: 0; z-index: 0; height: 36px; border-radius: var(--radius-inner); background: var(--color-paper-3); box-shadow: inset 0 1px 0 var(--color-rule), 0 4px 14px -8px var(--color-shade); pointer-events: none; }
.side__ind::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: var(--radius-pill); background: var(--color-accent); box-shadow: 0 0 12px var(--color-glow); }
.side__foot { margin-top: auto; display: grid; gap: var(--space-sm); }
.side__add { width: 100%; }

.main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-sm); height: var(--topbar); padding-inline: var(--gutter); border-bottom: var(--rule-hair) solid var(--color-rule); background: var(--color-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.top__menu { display: none; }
.top__search { display: flex; align-items: center; gap: var(--space-sm); flex: 0 1 560px; min-width: 0; min-height: 38px; padding: 0 var(--space-2xs) 0 var(--space-sm); border: 0; border-radius: var(--radius-inner); background: var(--color-paper-2); box-shadow: inset 0 0 0 1px var(--color-rule-2); color: var(--color-muted); font: 400 var(--text-sm)/1 var(--font-body); cursor: pointer; transition: box-shadow var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.top__search:hover { background: var(--color-paper-3); box-shadow: inset 0 0 0 1px var(--color-rule-3); }
.top__search:active { transform: scale(0.995); }
.top__search:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.top__search span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.top__keys { display: inline-flex; gap: var(--space-3xs); }
.top__right { margin-left: auto; display: flex; align-items: center; gap: var(--space-xs); }

.page { width: 100%; max-width: var(--container); margin-inline: auto; padding: var(--space-xl) var(--gutter) var(--space-3xl); }
.page__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-md) var(--space-xl); margin-bottom: var(--space-lg); }
.page__head h1 { font-size: var(--text-display); line-height: 1.05; }
.page__lead { margin-top: var(--space-xs); color: var(--color-muted); max-width: 60ch; }
.page__tools { display: flex; align-items: center; gap: var(--space-xs); }
.page__stats { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.stat { display: grid; gap: var(--space-3xs); min-width: 108px; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); color: var(--color-ink); text-decoration: none; transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.stat:hover { background: var(--color-paper-3); transform: translateY(-2px); }
.stat:active { transform: translateY(0) scale(0.98); }
.stat:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.stat__num { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: var(--text-xs); color: var(--color-muted); }

/* Shelves on the overview */
.shelf { margin-top: var(--section-gap); }
.shelf__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-sm); }
.shelf__head h2 { font-size: var(--text-section); letter-spacing: -0.02em; }
.shelf__more { white-space: nowrap; color: var(--color-muted); font-size: var(--text-sm); font-weight: 500; text-decoration: none; border-radius: var(--radius-clip); transition: color var(--dur-short) var(--ease-out); }
.shelf__more:hover { color: var(--color-accent); }
.shelf__more:active { color: var(--color-accent-2); }
.shelf__more:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* Card grid */
.grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); gap: var(--space-sm); }
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
/* Переменные наклона и света не наследуются: смена на карточке не пересчитывает стили всех её потомков */
@property --rx { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --mx { syntax: "<length>"; inherits: false; initial-value: -999px; }
@property --my { syntax: "<length>"; inherits: false; initial-value: -999px; }
.item { --lane: var(--color-accent); position: relative; display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); transition: background-color var(--dur-short) var(--ease-out), box-shadow var(--dur-long) var(--ease-out); animation: item-in var(--dur-xl) var(--ease-soft) backwards; animation-delay: calc(min(var(--i, 0), 14) * 35ms); }
.item:hover { background: color-mix(in oklab, var(--color-paper-2), var(--color-paper-3) 55%); box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--color-rule-2); }
.item:focus-within { box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--color-rule-2); }
.item::before { --mx: inherit; --my: inherit; content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1px; background: radial-gradient(420px circle at var(--mx) var(--my), var(--color-glow), transparent 45%); -webkit-mask: linear-gradient(var(--color-ink), var(--color-ink)) content-box, linear-gradient(var(--color-ink), var(--color-ink)); -webkit-mask-composite: xor; mask: linear-gradient(var(--color-ink), var(--color-ink)) content-box exclude, linear-gradient(var(--color-ink), var(--color-ink)); opacity: 0; pointer-events: none; transition: opacity var(--dur-long) var(--ease-out); }
.item::after { --mx: inherit; --my: inherit; content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; background: radial-gradient(360px circle at var(--mx) var(--my), var(--color-glow-2), transparent 60%); opacity: 0; pointer-events: none; transition: opacity var(--dur-long) var(--ease-out); }
.grid.is-lit .item::before { opacity: 1; }
.item:hover::after { opacity: 1; }
.item > * { position: relative; z-index: 1; }
@keyframes item-in { from { opacity: 0; transform: perspective(900px) translateY(14px) scale(0.97); } }
.item--prompt { --lane: var(--lane-prompt); }
.item--skill { --lane: var(--lane-skill); }
.item--project { --lane: var(--lane-project); }
.item--article { --lane: var(--lane-article); }
.item__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 var(--space-xs); border-radius: var(--radius-pill); background: color-mix(in oklab, var(--lane, var(--color-accent)) 14%, transparent); color: var(--lane, var(--color-accent)); font-size: var(--text-2xs); font-weight: 600; white-space: nowrap; }
.tag--prompt { --lane: var(--lane-prompt); } .tag--skill { --lane: var(--lane-skill); } .tag--project { --lane: var(--lane-project); } .tag--article { --lane: var(--lane-article); }
.item__meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--color-faint); }
.item__title { font-size: var(--text-title); }
.item__link { color: var(--color-ink); text-decoration: none; outline: none; }
.item__link::after { content: ""; position: absolute; inset: calc(var(--space-md) * -1); z-index: 1; border-radius: var(--radius-card); }
.item__link:focus-visible::after { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.item__sum { color: var(--color-muted); font-size: var(--text-sm); }
.item__peek { margin: var(--space-2xs) 0 0; padding: var(--space-sm); border-radius: var(--radius-inner); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-rule); font: 400 var(--text-2xs)/1.65 var(--font-code); color: var(--color-muted); white-space: pre-wrap; overflow: hidden; max-height: 6.2em; -webkit-mask-image: linear-gradient(var(--color-ink) 45%, transparent); mask-image: linear-gradient(var(--color-ink) 45%, transparent); }
.item__cmd { display: block; margin-top: var(--space-2xs); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-inner); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-rule); font-size: var(--text-xs); color: var(--color-ink-2); overflow-wrap: anywhere; }
.item__foot { margin-top: auto; padding-top: var(--space-xs); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.item__foot .btn { z-index: 3; }
.item__tags { min-width: 0; font-size: var(--text-xs); color: var(--color-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__actions { display: flex; align-items: center; gap: var(--space-xs); }
.item__actions .btn, .item__actions .link { position: relative; z-index: 3; }

/* List view of the same cards */
.grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 0; border-radius: var(--radius-band); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); padding: var(--space-2xs); }
.grid.is-list .item { display: grid; grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-md); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-inner); background: transparent; box-shadow: none; transform: none; }
.grid.is-list .item:hover { background: var(--color-paper-3); }
.grid.is-list .item + .item { box-shadow: 0 -1px 0 var(--color-rule); }
.grid.is-list .item:hover, .grid.is-list .item:hover + .item { box-shadow: none; }
.grid.is-list .item__top { grid-column: 1; grid-row: 1 / span 2; }
.grid.is-list .item__meta { display: none; }
.grid.is-list .item__title { grid-column: 2; }
.grid.is-list .item__sum { grid-column: 2; }
.grid.is-list .item__peek, .grid.is-list .item__cmd { display: none; }
.grid.is-list .item__foot { grid-column: 3 / span 2; grid-row: 1 / span 2; margin: 0; padding: 0; }
.grid.is-list .item::before, .grid.is-list .item::after { display: none; }

/* Segmented choice: a spring-driven pill under the chosen option */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: var(--space-3xs); margin: 0; padding: var(--space-3xs); border: 0; border-radius: var(--radius-inner); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-rule); min-width: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label, .seg button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 30px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-clip); background: transparent; color: var(--color-muted); font: 500 var(--text-xs)/1 var(--font-body); white-space: nowrap; cursor: pointer; transition: color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.seg label:hover, .seg button:hover { color: var(--color-ink); }
.seg label:active, .seg button:active { transform: scale(0.97); }
.seg input:checked + label, .seg button[aria-pressed="true"] { color: var(--color-ink); background: var(--color-paper-3); box-shadow: inset 0 1px 0 var(--color-rule-2); }
.seg input:focus-visible + label, .seg button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.seg input:disabled + label, .seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.seg__pill { position: absolute; left: 0; top: 0; z-index: 0; border-radius: var(--radius-clip); background: var(--color-paper-3); box-shadow: inset 0 1px 0 var(--color-rule-2), 0 4px 12px -6px var(--color-shade); transform-origin: 0 50%; pointer-events: none; }
.seg.has-pill input:checked + label, .seg.has-pill button[aria-pressed="true"] { background: transparent; box-shadow: none; }
.seg--sm label { min-height: 28px; }

/* Fields */
.field { width: 100%; min-height: 38px; padding: 0 var(--space-sm); border: var(--rule-hair) solid var(--color-faint); border-radius: var(--radius-inner); background: var(--color-well); color: var(--color-ink); font: 400 var(--text-sm)/1.4 var(--font-body); outline: 2px solid transparent; outline-offset: 1px; transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.field:hover { border-color: var(--color-ink-2); }
.field:focus-visible { outline-color: var(--color-focus); background: var(--color-paper); transition: none; }
.field:disabled { opacity: 0.5; cursor: not-allowed; }
.field[aria-invalid="true"] { border-color: var(--color-error); }
.field::placeholder { color: var(--color-faint); }
.field::-webkit-search-cancel-button { display: none; }
textarea.field { min-height: 120px; padding-block: var(--space-xs); resize: vertical; font-family: var(--font-code); font-size: var(--text-xs); line-height: 1.6; }
.filter { position: relative; width: min(100%, 300px); }
.filter .field { padding-left: var(--space-xl); }
.filter .ic { position: absolute; left: var(--space-sm); top: 50%; transform: translateY(-50%); color: var(--color-faint); pointer-events: none; }
.label { display: grid; gap: var(--space-2xs); font-size: var(--text-xs); font-weight: 500; color: var(--color-ink-2); }
.label__hint { font-weight: 400; color: var(--color-faint); }

/* Catalog */
.catalog__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-md); }
.catalog__count { font-size: var(--text-xs); color: var(--color-faint); font-variant-numeric: tabular-nums; }
.skeleton { min-height: 180px; border-radius: var(--radius-card); background: var(--color-paper-2); box-shadow: inset 0 0 0 1px var(--color-rule); animation: shimmer 1.2s var(--ease-in-out) infinite alternate; }
@keyframes shimmer { from { opacity: 0.4; } to { opacity: 0.9; } }
.page:not(.is-loading) .skeleton { display: none; }
.state { grid-column: 1 / -1; display: grid; justify-items: start; gap: var(--space-sm); padding: var(--space-2xl) var(--space-lg); border-radius: var(--radius-band); background: var(--color-paper-2); box-shadow: inset 0 0 0 1px var(--color-rule); animation: item-in var(--dur-long) var(--ease-soft) both; }
.state__title { font-size: var(--text-lg); font-weight: 600; }
.state__text { color: var(--color-muted); max-width: 60ch; }
.state--error .state__title { color: var(--color-error); }

/* Detail drawer */
.drawer { position: fixed; inset: 0; z-index: var(--z-drawer); display: flex; justify-content: flex-end; }
.drawer__scrim { position: absolute; inset: 0; background: var(--color-scrim); animation: fade-in var(--dur-long) var(--ease-out) both; }
.drawer__panel { position: relative; color: var(--color-ink); display: flex; flex-direction: column; width: var(--drawer); margin: var(--space-sm); border-radius: var(--radius-band); background: var(--color-paper-2); box-shadow: var(--shadow-pop); overflow: hidden; outline: none; }
.drawer:not(.is-morph) .drawer__panel { animation: drawer-in var(--dur-xl) var(--ease-soft) both; }
.drawer.is-closing .drawer__scrim { animation: fade-out var(--dur-short) var(--ease-in) both; }
.drawer.is-closing:not(.is-morph) .drawer__panel { animation: drawer-out var(--dur-short) var(--ease-in) both; }
@keyframes drawer-in { from { opacity: 0; transform: translateX(48px) scale(0.98); filter: blur(8px); } }
@keyframes drawer-out { to { opacity: 0; transform: translateX(32px) scale(0.99); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.drawer__head { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
.drawer__head .tag { margin-right: auto; }
.drawer__scroll { flex: 1; overflow-y: auto; padding: var(--space-lg); display: grid; align-content: start; gap: var(--space-md); }
.drawer__scroll > * { animation: item-in var(--dur-xl) var(--ease-soft) backwards; animation-delay: calc(var(--i, 0) * 50ms + 120ms); }
.drawer__title { font-size: var(--text-2xl); line-height: 1.15; letter-spacing: -0.02em; }
.drawer__sum { color: var(--color-ink-2); font-size: var(--text-base); }
.drawer__meta { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--space-sm); border-radius: var(--radius-pill); background: var(--color-paper-3); box-shadow: inset 0 0 0 1px var(--color-rule); font-size: var(--text-xs); color: var(--color-ink-2); }
.drawer__code { position: relative; margin: 0; padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-rule); font: 400 var(--text-xs)/1.75 var(--font-code); color: var(--color-ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.drawer__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.drawer__shot { aspect-ratio: 16 / 9; display: grid; place-items: center; padding: var(--space-lg); border-radius: var(--radius-card); box-shadow: inset 0 0 0 1px var(--color-rule); color: var(--color-faint); font-size: var(--text-xs); text-align: center; }
.drawer__shot > img { border-radius: inherit; }
.drawer__note { font-size: var(--text-xs); color: var(--color-faint); }

/* Command palette */
.cmdk { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; justify-items: center; align-items: start; padding: 12vh var(--space-md) var(--space-md); }
.cmdk__scrim { position: absolute; inset: 0; background: var(--color-scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in var(--dur-long) var(--ease-out) both; }
.cmdk__panel { position: relative; width: min(680px, 100%); display: flex; flex-direction: column; max-height: 72vh; border-radius: var(--radius-band); background: color-mix(in oklab, var(--color-paper-2) 92%, transparent); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); box-shadow: var(--shadow-pop); overflow: hidden; transform-origin: 50% 0; animation: pop-in var(--dur-xl) var(--ease-spring) both; }
.cmdk.is-closing .cmdk__scrim { animation: fade-out var(--dur-short) var(--ease-in) both; }
.cmdk.is-closing .cmdk__panel { animation: pop-out var(--dur-short) var(--ease-in) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-10px) scale(0.96); filter: blur(10px); } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.97); filter: blur(4px); } }
.cmdk__bar { display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-muted); }
.cmdk__input { flex: 1; min-width: 0; min-height: 56px; border: 0; background: transparent; color: var(--color-ink); font: 400 var(--text-lg)/1.2 var(--font-body); outline: none; }
.cmdk__input::placeholder { color: var(--color-faint); }
.cmdk__input::-webkit-search-cancel-button { display: none; }
.cmdk__bar:focus-within { color: var(--color-accent); }
.cmdk__tabs { margin: var(--space-sm) var(--space-md) 0; align-self: flex-start; }
.cmdk__list { position: relative; flex: 1; overflow-y: auto; padding: var(--space-xs); scroll-padding: var(--space-xs); }
.cmdk__hl { position: absolute; left: var(--space-xs); right: var(--space-xs); top: 0; z-index: 0; border-radius: var(--radius-inner); background: var(--color-paper-4); box-shadow: inset 0 1px 0 var(--color-rule-2); pointer-events: none; opacity: 0; transition: opacity var(--dur-short) var(--ease-out); }
.cmdk__hl.is-on { opacity: 1; }
.cmdk__hl::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: var(--radius-pill); background: var(--color-accent); }
.cmdk__opt { position: relative; z-index: 1; display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm); min-height: 52px; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-inner); cursor: pointer; animation: opt-in var(--dur-long) var(--ease-soft) backwards; animation-delay: calc(min(var(--i, 0), 10) * 22ms); }
@keyframes opt-in { from { opacity: 0; transform: translateX(-8px); } }
.cmdk__opt .tag { justify-self: start; }
.cmdk__title { font-weight: 600; font-size: var(--text-sm); color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__sum { font-size: var(--text-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__hint { font-size: var(--text-2xs); color: var(--color-faint); opacity: 0; transition: opacity var(--dur-short) var(--ease-out); }
.cmdk__opt[aria-selected="true"] .cmdk__hint { opacity: 1; }
.cmdk__opt mark { background: none; color: var(--color-accent); }
.cmdk__empty { padding: var(--space-xl) var(--space-md); text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
.cmdk__foot { display: flex; flex-wrap: wrap; gap: var(--space-md); padding: var(--space-xs) var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); font-size: var(--text-2xs); color: var(--color-faint); }
.cmdk__foot span { display: inline-flex; align-items: center; gap: var(--space-2xs); }

/* Add entry dialog */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-md); }
.modal__scrim { position: absolute; inset: 0; background: var(--color-scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in var(--dur-long) var(--ease-out) both; }
.modal__panel { position: relative; color: var(--color-ink); width: min(980px, 100%); max-height: calc(100svh - var(--space-xl)); display: flex; flex-direction: column; border-radius: var(--radius-band); background: var(--color-paper-2); box-shadow: var(--shadow-pop); overflow: hidden; animation: pop-in var(--dur-xl) var(--ease-spring) both; outline: none; }
.modal.is-closing .modal__scrim { animation: fade-out var(--dur-short) var(--ease-in) both; }
.modal.is-closing .modal__panel { animation: pop-out var(--dur-short) var(--ease-in) both; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
.modal__head h2 { font-size: var(--text-lg); letter-spacing: -0.01em; }
.modal__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: auto; }
.modal__form { display: grid; align-content: start; gap: var(--space-md); padding: var(--space-lg); }
.modal__preview { display: grid; align-content: start; gap: var(--space-sm); padding: var(--space-lg); border-left: var(--rule-hair) solid var(--color-rule); background: var(--color-well); }
.modal__preview pre { margin: 0; padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-paper); box-shadow: inset 0 0 0 1px var(--color-rule); font-size: var(--text-2xs); line-height: 1.7; color: var(--color-ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 46vh; overflow: auto; }
.modal__help { font-size: var(--text-xs); color: var(--color-muted); }
.modal__help code { color: var(--color-ink-2); }
.modal [data-only] { display: none; }
.modal[data-kind="prompt"] [data-only~="prompt"], .modal[data-kind="skill"] [data-only~="skill"], .modal[data-kind="project"] [data-only~="project"], .modal[data-kind="article"] [data-only~="article"] { display: grid; }

/* Article */
.progress { position: fixed; left: var(--sidebar); right: 0; top: 0; z-index: var(--z-toast); height: 2px; background: var(--color-accent); box-shadow: 0 0 12px var(--color-glow); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) { .progress { animation: progress linear both; animation-timeline: scroll(root); } }
@supports not (animation-timeline: scroll()) { .progress { display: none; } }
@keyframes progress { to { transform: scaleX(1); } }
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-xl); align-items: start; }
.reader__main { min-width: 0; }
.reader__back { display: inline-flex; align-items: center; min-height: 36px; }
.reader h1 { margin-top: var(--space-sm); font-size: var(--text-display); line-height: 1.08; max-width: 24ch; }
.article__meta { margin-top: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); min-height: 1lh; }
.reader__aside { position: sticky; top: calc(var(--topbar) + var(--space-lg)); display: grid; gap: var(--space-xs); padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); }
.reader__aside h2 { font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; }
.reader__aside a { display: block; padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-clip); color: var(--color-muted); font-size: var(--text-sm); text-decoration: none; transition: color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out); }
.reader__aside a:hover { color: var(--color-ink); background: var(--color-paper-3); }
.reader__aside a:active { background: var(--color-paper-4); }
.reader__aside a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.prose { margin-top: var(--space-xl); padding: var(--space-xl); border-radius: var(--radius-band); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); font-size: var(--text-base); line-height: 1.75; color: var(--color-ink-2); }
.prose > * { max-width: 72ch; }
.prose > * + * { margin-top: var(--space-md); }
.prose h2 { margin-top: var(--space-xl); font-family: var(--font-body); font-weight: 600; font-size: var(--text-xl); letter-spacing: -0.015em; line-height: 1.3; color: var(--color-ink); scroll-margin-top: calc(var(--topbar) + var(--space-lg)); }
.prose h3 { margin-top: var(--space-lg); }
.prose ul, .prose ol { padding-left: var(--space-lg); }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose li::marker { color: var(--color-accent); }
.prose li + li { margin-top: var(--space-2xs); }
.prose strong { color: var(--color-ink); font-weight: 600; }
.prose code { padding: var(--space-3xs) var(--space-2xs); border-radius: var(--radius-clip); background: var(--color-well); color: var(--color-ink); font-size: 0.86em; }
.prose__code { margin-block: var(--space-lg); padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-rule); overflow-x: auto; font-size: var(--text-xs); line-height: 1.7; }
.prose__code code { padding: 0; background: none; }
.prose blockquote { margin-inline: 0; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); background: var(--color-accent-soft); color: var(--color-ink); }
.skeleton-line { height: 18px; width: 80%; border-radius: var(--radius-pill); background: var(--color-paper-3); animation: shimmer 1.2s var(--ease-in-out) infinite alternate; }
.page:not(.is-loading) .skeleton-line { display: none; }

/* Project page */
.project__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-lg); align-items: start; }
.project__head { display: grid; gap: var(--space-sm); }
.project__head h1 { font-size: var(--text-display); line-height: 1.08; }
.project__head .page__lead { font-size: var(--text-base); }
.project__side { display: grid; gap: var(--space-sm); padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-2); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--color-rule); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.shot { grid-column: 1 / -1; margin: 0; aspect-ratio: 16 / 9; display: grid; place-items: center; padding: var(--space-xl); border-radius: var(--radius-band); box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--color-rule); color: var(--color-faint); font-size: var(--text-sm); text-align: center; }
.shot > img { border-radius: inherit; }
.project__more { grid-column: 1 / -1; margin-top: var(--space-xl); }
.project__more h2 { font-size: var(--text-section); margin-bottom: var(--space-sm); }

/* Scroll reveal for shelf heads, plain everywhere else */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes reveal { from { opacity: 0; transform: translateY(24px); filter: blur(4px); } }

/* Heading decode (motion.js) keeps the box steady while glyphs change */
[data-scramble] { font-variant-numeric: tabular-nums; }
.scramble__ch { color: var(--color-accent); opacity: 0.7; }

/* Reduced motion: end states at once */
@media (prefers-reduced-motion: reduce) {
  .item, .state, .drawer__panel, .drawer__scrim, .drawer__scroll > *, .cmdk__panel, .cmdk__scrim, .cmdk__opt, .modal__panel, .modal__scrim, .skeleton, .skeleton-line, .copy__tick, .copy__label { animation: none !important; }
  .light { display: none; }
  .btn, .icon-btn, .item, .side__link, .seg label, .seg button, .stat, .field, .link { transition: none; }
  .item { transform: none; }
  .stat:hover { transform: none; }
  .progress { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Tablet and phone: the sidebar slides in over the page */
@media (max-width: 64rem) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { grid-column: 1; }
  .side { width: min(300px, 86%); z-index: var(--z-modal); border-right: var(--rule-hair) solid var(--color-rule-2); box-shadow: var(--shadow-pop); transform: translateX(-104%); transition: transform var(--dur-long) var(--ease-soft); }
  .side.is-open { transform: none; }
  .side-scrim { position: fixed; inset: 0; z-index: var(--z-drawer); background: var(--color-scrim); animation: fade-in var(--dur-long) var(--ease-out) both; }
  .top__menu { display: inline-grid; }
  .progress { left: 0; }
  .reader, .project__grid { grid-template-columns: minmax(0, 1fr); }
  .reader__aside { position: static; order: -1; }
}
@media (min-width: 64.01rem) { .side-scrim { display: none; } }
@media (max-width: 40rem) {
  :root { --gutter: 16px; }
  .page { padding-top: var(--space-lg); }
  .top__keys { display: none; }
  .page__head { align-items: stretch; }
  .page__tools { flex-wrap: wrap; }
  .filter { width: 100%; }
  .stat { min-width: 0; flex: 1 1 40%; }
  .grid.is-list .item { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-2xs); }
  .grid.is-list .item__top, .grid.is-list .item__title, .grid.is-list .item__sum, .grid.is-list .item__foot { grid-column: 1; grid-row: auto; }
  .drawer { align-items: flex-end; }
  .drawer__panel { width: 100%; height: 88svh; margin: 0; border-radius: var(--radius-band) var(--radius-band) 0 0; }
  @keyframes drawer-in { from { opacity: 0; transform: translateY(64px); } }
  .modal__body { grid-template-columns: minmax(0, 1fr); }
  .modal__preview { border-left: 0; border-top: var(--rule-hair) solid var(--color-rule); }
  .cmdk { padding-top: var(--space-md); }
  .cmdk__opt { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); }
  .cmdk__hint { display: none; }
  .prose { padding: var(--space-lg); }
}
