/* Skillwell. Tokens follow .cmo/brand/brand.json */
:root {
  --volt: #C6F432;
  --ink: #0E1116;
  --paper: #FAFAF7;
  --shelf: #EFEFE8;
  --graphite: #5C6370;
  --line: #DCDCD2;
  --white: #FFFFFF;
  --success: #1F7A3D;
  --warning: #8A5A00;
  --error: #C4281C;
  --info: #2B59C3;
  --skill: #2B59C3;
  --plugin: #7A3FC4;
  --prompt: #B4470F;
  --display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.625 var(--text); }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: 24px; line-height: 30px; }
p { margin: 0 0 12px; }
pre, code, .mono { font-family: var(--mono); font-size: 14px; line-height: 22px; }
code { background: var(--shelf); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--graphite); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--white); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 10; }
.skip:focus { left: 8px; }

.wrap { max-width: 1168px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-top: 32px; padding-bottom: 72px; min-height: 70vh; }
main section { margin-top: 48px; }
.narrow { max-width: 720px; }
.narrow-left { max-width: 640px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.logo { display: flex; }
.logo img { display: block; height: 32px; width: auto; }
.main-nav, .user-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; font-weight: 500; }
.main-nav a, .user-nav a:not(.btn) { text-decoration: none; white-space: nowrap; }
.main-nav a:hover, .user-nav a:not(.btn):hover { text-decoration: underline; }
.user-nav form { margin: 0; }
.header-search { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; background: var(--shelf); border-radius: var(--radius-sm); padding: 0 12px; color: var(--graphite); }
.header-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; font: inherit; font-size: 14px; color: var(--ink); }
.header-search input:focus { outline: none; }
.header-search:focus-within { outline: 3px solid var(--info); outline-offset: 2px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--graphite); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 18px; font: 600 15px/1.2 var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn-volt { background: var(--volt); color: var(--ink); border-color: var(--ink); }
.btn-volt:hover { box-shadow: 3px 3px 0 var(--ink); }
.btn-ink { background: var(--ink); color: var(--white); }
.btn-ink:hover { background: #262B33; }
.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: var(--shelf); }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: #FBEAE8; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; color: var(--graphite); display: inline-flex; }
.icon-btn:hover { color: var(--error); border-color: var(--error); }

/* Hero */
.hero { padding: 40px 0 8px; max-width: 760px; }
.hero h1 { font-size: clamp(40px, 7vw, 56px); line-height: 1.07; }
.lede { font-size: 18px; line-height: 28px; color: var(--graphite); margin-top: 12px; max-width: 62ch; }
.hero-search { display: flex; gap: 8px; margin-top: 24px; }
.hero-search input { flex: 1; min-width: 0; }
.hero-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; color: var(--graphite); }
.hero-points li { display: flex; align-items: center; gap: 6px; }

/* Inputs */
input[type=text], input[type=search], input[type=url], input[type=password], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  padding: 10px 12px; font: 400 15px/1.5 var(--text); color: var(--ink);
}
textarea { resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: 14px; }
select { width: auto; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }

/* Kind labels, chips, status */
.kind { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.kind-skill { color: var(--skill); } .kind-plugin { color: var(--plugin); } .kind-prompt { color: var(--prompt); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--shelf); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
a.chip:hover { background: var(--line); }
.status { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 500; border: 1px solid currentColor; white-space: nowrap; }
.status-published, .status-approved { color: var(--success); }
.status-pending { color: var(--warning); }
.status-rejected { color: var(--error); }
.status-superseded { color: var(--graphite); }

.chip-line { background: transparent; box-shadow: inset 0 0 0 1px var(--line); display: inline-flex; align-items: center; gap: 4px; }
.chip .icon { vertical-align: -2px; }
.category-row { display: flex; flex-wrap: wrap; gap: 8px; }
.category { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; text-decoration: none; }
.category:hover { border-color: var(--ink); }
.category .muted { font-variant-numeric: tabular-nums; }
.result-link { margin: 0; padding: 12px 16px; font-size: 14px; background: var(--shelf); overflow-wrap: anywhere; }
.result-row input[type=url] { margin-top: 8px; }

/* Tiles and cards */
.kind-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; background: var(--shelf); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; border: 1px solid transparent; }
.tile:hover { border-color: var(--ink); }
.tile strong { font-size: 17px; }
.tile .muted { grid-column: 2; font-size: 14px; }
.tile > .icon { grid-row: 1 / span 2; grid-column: 3; }
.tile-tall { grid-template-columns: 1fr; padding: 24px; gap: 8px; }
.tile-tall .muted { grid-column: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head a:not(.btn) { font-size: 14px; font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card:hover { border-color: var(--ink); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-top form { margin: 0; }
.card h3 { font: 600 17px/24px var(--text); overflow-wrap: anywhere; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card-summary { color: var(--graphite); font-size: 14px; line-height: 21px; margin: 0; flex: 1; }
.card-meta { font-size: 13px; color: var(--graphite); margin: 0; }
.fav { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 4px 6px; margin: -4px -6px; border-radius: var(--radius-sm); font: 500 13px var(--text); color: var(--graphite); font-variant-numeric: tabular-nums; }
button.fav { cursor: pointer; }
button.fav:hover { background: var(--shelf); color: var(--ink); }
.fav.is-on { color: var(--ink); }
.empty { grid-column: 1 / -1; background: var(--shelf); border-radius: var(--radius); padding: 40px 24px; text-align: center; }

/* Browse */
.page-title { font-size: clamp(28px, 5vw, 36px); line-height: 1.17; margin: 4px 0 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.field-inline { display: flex; }
.field-inline.grow { flex: 1 1 240px; }
.result-count { margin: 20px 0 12px; font-size: 14px; }
.active-filter { margin-top: 16px; font-size: 14px; }
.pager { display: flex; justify-content: center; gap: 20px; margin-top: 32px; font-size: 14px; }

/* Notices */
.messages { margin-bottom: 20px; }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 21px; border-left: 4px solid; background: var(--shelf); }
.notice .icon { margin-top: 2px; }
.notice-success { border-color: var(--success); }
.notice-info { border-color: var(--info); }
.notice-warning { border-color: var(--warning); }
.notice-error { border-color: var(--error); }
.plain { margin: 0; padding: 0; list-style: none; }

/* Detail */
.detail-head h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.15; margin-top: 6px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.actions form { margin: 0; }
.detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; }
.detail-main section h2, .detail-side h2 { margin-bottom: 12px; }
.detail-side { margin-top: 48px; }
.detail-side h2 { font: 600 13px/18px var(--text); letter-spacing: 0; color: var(--graphite); margin-top: 24px; }
.detail-side h2:first-child { margin-top: 0; }
.side-note { margin-top: 28px; font-size: 13px; line-height: 19px; color: var(--graphite); }
.prose p { max-width: 68ch; }
.code-block { position: relative; }
pre { background: var(--shelf); border-radius: var(--radius); padding: 18px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 560px; overflow: auto; }
pre.short { padding: 10px 14px; }
.copy { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 10px; font: 500 13px var(--text); cursor: pointer; }
.copy:hover { border-color: var(--ink); }
.code-block pre { padding-top: 48px; }
.result { margin: 16px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.result figcaption { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; background: var(--white); border-bottom: 1px solid var(--line); }
.result figcaption .muted { font-weight: 400; }
.result pre { border-radius: 0; }

.install { background: var(--white); border: 1px solid var(--ink); border-radius: var(--radius); padding: 20px; }
.install h2 { margin-bottom: 12px; }
.install .help { margin-top: 10px; }
.install .help .icon { margin-right: 4px; }
.install-actions { margin-top: 12px; }
.install-actions:empty { display: none; }
.copy-primary { background: var(--volt); border-color: var(--ink); font-weight: 600; }
.copy-inline { cursor: pointer; }

/* Contributor profile */
[hidden] { display: none !important; }
.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-head h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.15; overflow-wrap: anywhere; }
.profile-head .lede { margin: 4px 0 0; }
.avatar { flex: none; width: 72px; height: 72px; border-radius: 50%; background: var(--ink); color: var(--white); display: grid; place-items: center; font: 700 32px/1 var(--display); text-transform: uppercase; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 24px 0 0; }
.stat { background: var(--shelf); border-radius: var(--radius); padding: 14px 18px; }
.stat dt { font-size: 13px; font-weight: 500; color: var(--graphite); }
.stat dd { margin: 0; font: 700 28px/36px var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.share { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 20px; }
.share .actions { margin-top: 0; }
.share code { font-size: 13px; }
.share-menu { position: relative; }
.share-menu summary { list-style: none; }
.share-menu summary::-webkit-details-marker { display: none; }
.share-menu[open] summary { background: var(--shelf); }
.share-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; display: grid; min-width: 200px; padding: 6px; background: var(--white); border: 1px solid var(--ink); border-radius: var(--radius-sm); box-shadow: 3px 3px 0 var(--ink); }
.share-panel-end { left: auto; right: 0; }
.share-option { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: 500 15px/1.2 var(--text); text-align: left; text-decoration: none; cursor: pointer; }
.share-option:hover, .share-option:focus-visible { background: var(--shelf); }
.share-option .icon { color: var(--graphite); }
.profile-side { margin-top: 24px; }
.profile-side h2 { font: 600 13px/18px var(--text); letter-spacing: 0; color: var(--graphite); margin-bottom: 8px; }
.category[aria-current] { border-color: var(--ink); background: var(--shelf); }
.actions-flush { margin-top: 0; }
.card-meta a, .detail-head .muted a { text-decoration-color: var(--line); }

/* Forms */
.form { margin-top: 24px; }
.field { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field label .muted { font-weight: 400; }
.help { font-size: 13px; line-height: 19px; color: var(--graphite); margin: 6px 0 0; }
.error { font-size: 13px; color: var(--error); margin: 6px 0 0; font-weight: 500; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex !important; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 14px; font-weight: 500 !important; margin: 0 !important; cursor: pointer; }
.check:has(input:checked) { border-color: var(--ink); background: var(--shelf); }
.check input { accent-color: var(--ink); margin: 0; }
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.result-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; background: var(--white); }
.result-row-head { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.result-row-head input { flex: 1; min-width: 160px; }
.auth { max-width: 420px; margin: 24px auto; }

.tool-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.tool-list code { margin-right: 8px; font-weight: 500; }
.token-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0 24px; }
.token-form .field { flex: 1 1 240px; margin: 0; }
.sub { font: 600 15px/22px var(--text); margin: 20px 0 8px; }
.link-btn.danger { color: var(--error); }
.agent-hint { margin-top: 24px; color: var(--graphite); }

/* Tables and review */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--graphite); font-size: 13px; }
.table th, .table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.diff-row { margin-top: 20px; }
.diff-row h3 { font: 600 14px/20px var(--text); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.diff-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.diff-cols p { font-size: 13px; margin-bottom: 4px; }
.diff-row.is-changed .diff-cols > div:last-child pre { box-shadow: inset 4px 0 0 var(--warning); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; }
.footer-row { display: flex; gap: 14px; align-items: flex-start; }
.footer-row p { font-size: 13px; line-height: 19px; color: var(--graphite); max-width: 80ch; margin: 2px 0 0; }

@media (max-width: 860px) {
  .detail-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .diff-cols { grid-template-columns: minmax(0, 1fr); }
  .header-search { order: 5; flex-basis: 100%; }
  .user-nav { margin-left: auto; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .main-nav { order: 4; flex-basis: 100%; }
  .hero-search { flex-direction: column; }
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .card, .tile, .chip { transition: box-shadow 150ms ease-out, border-color 150ms ease-out, background-color 150ms ease-out; }
}
