:root {
  --bg: #f7f3ee;
  --paper: #fffdf9;
  --ink: #17121f;
  --muted: #565063;
  --purple: #5a2fc2;
  --purple-d: #2a1466;
  --purple-dd: #1b0d45;
  --lilac: #ebe3fb;
  --lilac-2: #ddd0f7;
  --sand: #ece5da;
  --on-purple: #f4effd;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --r: 16px;
  --pad: clamp(18px, 4vw, 56px);
  --font: 'Heebo', system-ui, sans-serif;
  --display: 'Secular One', 'Heebo', sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 18px; line-height: 1.6; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
main { flex: 1; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--purple); color: #fff; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--purple); color: #fff; padding: 10px 16px; z-index: 50; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 12px var(--pad); background: var(--bg); transition: background-color 200ms ease; }
.bar.stuck { background: var(--paper); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-size: 24px; color: var(--ink); }
.brand-px { display: block; width: 40px; line-height: 0; }
.brand-px .pxlogo { width: 100%; height: auto; }
.nav { display: flex; gap: 6px; margin-inline-start: auto; }
.nav a { padding: 8px 14px; text-decoration: none; font-weight: 500; border-radius: 999px; transition: background-color 160ms ease; }
.cta-sm { background: var(--purple); color: #fff; text-decoration: none; padding: 9px 20px; border-radius: 999px; font-weight: 700; transition: transform 160ms var(--ease); }
.cta-sm:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .nav a:hover { background: var(--lilac); } .cta-sm:hover { background: var(--purple-d); } }
@media (max-width: 760px) { .nav { display: none; } .cta-sm { margin-inline-start: auto; } }

/* ---------- pixel logo ---------- */
.pxlogo { display: block; width: 100%; height: auto; }
.pxlogo .pi { fill: var(--ink); }
.pxlogo .pp { fill: var(--purple); }
.brand-px .pxlogo .pi, .brand-px .pxlogo .pp { fill: var(--purple); }

/* ---------- hero ---------- */
.hero { padding: clamp(36px, 7vw, 96px) var(--pad) clamp(40px, 6vw, 80px); max-width: 1100px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hero h1 { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; font-weight: 400; }
.logo-wrap { width: min(100%, 860px); direction: ltr; }
.h1-text { font-family: var(--display); font-size: clamp(26px, 4.4vw, 46px); line-height: 1.15; max-width: 22ch; }
.lede { font-size: clamp(18px, 2.2vw, 22px); color: var(--muted); max-width: 46ch; }
.facts { color: var(--muted); font-size: 16px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.search { display: flex; align-items: center; gap: 12px; width: min(100%, 640px); background: var(--paper); border-radius: 999px; padding: 6px 22px; box-shadow: 0 0 0 2px var(--lilac-2); min-height: 62px; transition: box-shadow 200ms ease; }
.search:focus-within { box-shadow: 0 0 0 3px var(--purple); }
.search svg { width: 24px; height: 24px; fill: var(--purple); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 18px; padding: 10px 0; }
.search input::placeholder { color: #7a7387; }
.search input::-webkit-search-cancel-button { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 28px; background: var(--purple); color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; border-radius: 999px; transition: transform 160ms var(--ease), background-color 200ms ease; }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 2px var(--lilac-2); }
.btn.big { min-height: 64px; font-size: 20px; width: 100%; }
.btn.sm { min-height: 40px; padding: 0 18px; font-size: 16px; }
.btn[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--purple-d); } .btn.ghost:hover { background: var(--lilac); } }

/* ---------- sections ---------- */
.sec { padding: clamp(44px, 7vw, 110px) var(--pad); max-width: 1320px; margin: 0 auto; }
.sec.narrow { max-width: 860px; }
.sec h2, .h1-page { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4.4vw, 52px); line-height: 1.12; margin-bottom: 28px; }
.h1-page { font-size: clamp(36px, 5.6vw, 68px); margin-bottom: 14px; }
.h2-s { font-size: clamp(24px, 3vw, 32px) !important; margin: 36px 0 14px !important; }
.lede-s { color: var(--muted); font-size: 20px; max-width: 60ch; margin-bottom: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.sec-head h2 { margin-bottom: 28px; }
.more-link { font-weight: 700; color: var(--purple); text-underline-offset: 4px; }

.sec-purple { max-width: none; background: var(--purple-d); color: var(--on-purple); }
.sec-purple .two { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(28px, 6vw, 90px); align-items: start; }
.on-purple { font-size: 22px; color: #cdbff0; max-width: 28ch; }
.steps { list-style: decimal; padding-inline-start: 1.4em; display: grid; gap: 26px; font-size: 24px; }
.steps li::marker { font-family: var(--display); color: #b79bff; }
.steps b { display: block; font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.2; margin-bottom: 4px; }
.steps span { font-size: 19px; color: #d8ccf5; display: block; max-width: 44ch; }
@media (max-width: 860px) { .sec-purple .two { grid-template-columns: 1fr; } }

.nonprofit { max-width: 900px; text-align: center; }
.nonprofit p { font-size: 21px; color: var(--muted); }

/* ---------- topics ---------- */
.topics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.topic { display: flex; flex-direction: column; gap: 10px; min-height: 210px; padding: 24px; border-radius: var(--r); text-decoration: none; background: var(--lilac); transition: transform 200ms var(--ease), background-color 200ms ease; }
.topic:nth-child(4n+2) { background: var(--sand); }
.topic:nth-child(4n+3) { background: var(--purple); color: #fff; }
.topic:nth-child(4n+3) span, .topic:nth-child(4n+3) i { color: #e4dafa; }
.topic:nth-child(4n) { background: var(--lilac-2); }
.topic b { font-family: var(--display); font-weight: 400; font-size: 27px; line-height: 1.15; }
.topic span { color: var(--muted); font-size: 16px; line-height: 1.45; }
.topic i { margin-top: auto; font-style: normal; font-weight: 700; font-size: 15px; color: var(--purple); }
.topic:nth-child(4n+3) i { color: #fff; }
.topic:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .topic.in:hover { transform: translateY(-4px); } }
@media (max-width: 1000px) { .topics { grid-template-columns: repeat(2, 1fr); } .topic:nth-child(4n+2), .topic:nth-child(4n+3), .topic:nth-child(4n) { background: var(--lilac); color: var(--ink); } .topic:nth-child(4n+3) span { color: var(--muted); } .topic:nth-child(4n+3) i { color: var(--purple); } .topic:nth-child(odd) { background: var(--lilac); } .topic:nth-child(even) { background: var(--sand); } }
@media (max-width: 520px) { .topics { grid-template-columns: 1fr; } .topic { min-height: 150px; } }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 24px; background: var(--paper); border-radius: var(--r); text-decoration: none; min-height: 230px; transition: transform 200ms var(--ease), background-color 200ms ease; box-shadow: 0 0 0 1px #ebe4d8; }
.card h3 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.2; }
.card p { color: var(--muted); font-size: 16px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-en { margin-top: auto; font-size: 14px; color: #7a7387; overflow-wrap: anywhere; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--lilac); color: var(--purple-d); font-size: 14px; font-weight: 700; }
.full { font-size: 13px; font-weight: 700; color: var(--purple); }
.card:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { .card.in:hover { transform: translateY(-4px); background: #fff; } }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } .card { min-height: 0; } }
.more { display: flex; margin: 26px auto 0; }
.empty { padding: 40px 0; font-size: 20px; color: var(--muted); }

/* ---------- library ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 14px; }
.filters button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; background: var(--paper); border-radius: 999px; font-weight: 500; box-shadow: 0 0 0 1px #e3dacb; transition: transform 160ms var(--ease), background-color 200ms ease; }
.filters button i { font-style: normal; font-size: 13px; color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--purple); color: #fff; box-shadow: none; }
.filters button[aria-pressed="true"] i { color: #e4dafa; }
.filters button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .filters button[aria-pressed="false"]:hover { background: var(--lilac); } }
.count { color: var(--muted); margin: 8px 0 22px; }
.lib .search { margin-top: 4px; }

/* ---------- skill page ---------- */
.crumbs { margin-bottom: 18px; color: var(--muted); font-size: 16px; }
.crumbs a { text-underline-offset: 3px; }
.sk-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: start; }
.sk-main h1 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 5vw, 60px); line-height: 1.1; }
.sk-en { color: #7a7387; font-size: 17px; margin-top: 6px; text-align: left; }
.sk-d { font-size: 22px; margin: 22px 0; max-width: 52ch; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 3px 12px; border-radius: 999px; background: var(--sand); font-size: 14px; font-weight: 500; }
.howto { padding-inline-start: 1.4em; display: grid; gap: 10px; max-width: 60ch; }
.plain { padding-inline-start: 1.2em; display: grid; gap: 12px; margin-bottom: 30px; }
.sec.narrow p { margin-bottom: 14px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.88em; background: var(--lilac); padding: 2px 8px; border-radius: 6px; }
.md { background: var(--purple-dd); color: #e7defa; padding: 22px; border-radius: var(--r); overflow: auto; max-height: 520px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap; text-align: left; }
.sk-side { display: grid; gap: 12px; position: sticky; top: 84px; }
.install { background: var(--paper); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; box-shadow: 0 0 0 1px #ebe4d8; }
.install code { display: block; padding: 12px; font-size: 13px; overflow-wrap: anywhere; text-align: left; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 16px; padding: 4px 4px 0; }
.meta dt { color: var(--muted); }
.meta a { text-underline-offset: 3px; overflow-wrap: anywhere; }
.note { font-size: 14px; color: var(--muted); line-height: 1.5; }
@media (max-width: 900px) { .sk-grid { grid-template-columns: 1fr; } .sk-side { position: static; order: -1; } }

/* ---------- footer ---------- */
.site-foot { --mg-credit-ink: #d3c6f3; background: var(--purple-dd); color: #d3c6f3; padding: 44px var(--pad) 18px; margin-top: 0; }
.foot-top { max-width: 1320px; margin: 0 auto 18px; display: grid; gap: 8px; font-size: 16px; line-height: 1.6; }
.foot-top a { color: #fff; text-underline-offset: 3px; }
.foot-top b { color: #fff; }
.site-foot mg-site-credit { padding-top: 14px; max-width: 1320px; margin: 0 auto; }

/* ---------- motion ---------- */
.rise { opacity: 0; transform: translateY(18px); transition: opacity 460ms var(--ease), transform 460ms var(--ease), background-color 200ms ease; transition-delay: calc(var(--i, 0) * 60ms), calc(var(--i, 0) * 60ms), 0ms; }
.rise.in { opacity: 1; transform: none; }
.hero > * { animation: up 520ms var(--ease) both; }
.hero > :nth-child(2) { animation-delay: 70ms; } .hero > :nth-child(3) { animation-delay: 140ms; } .hero > :nth-child(4) { animation-delay: 210ms; } .hero > :nth-child(5) { animation-delay: 280ms; }
@keyframes up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise, .hero > * { opacity: 1; transform: none; animation: none; transition: none; } html { scroll-behavior: auto; } }

.count-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 8px 0 22px; }
.count-row .count { margin: 0; }
