:root {
  --bg: #fbf7f8;
  --card: #ffffff;
  --text: #1d1b1c;
  --muted: #6c6468;
  --line: #eadfe3;
  --accent: #e0457b;
  --accent-soft: #fde8ef;
  --shadow: 0 1px 2px rgba(60, 20, 40, .06), 0 8px 24px rgba(60, 20, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141113;
    --card: #1e1a1c;
    --text: #f4eef1;
    --muted: #a69da2;
    --line: #2e282b;
    --accent: #ff6fa0;
    --accent-soft: #35202a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #141113;
  --card: #1e1a1c;
  --text: #f4eef1;
  --muted: #a69da2;
  --line: #2e282b;
  --accent: #ff6fa0;
  --accent-soft: #35202a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
a { color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
header { padding: 72px 0 40px; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.02em; }
h1 span { color: var(--accent); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; margin: 0 0 20px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  text-decoration: none; font-size: .95rem;
}
.pill:hover { border-color: var(--accent); }
.pill.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
h2 { font-size: 1.5rem; margin: 48px 0 16px; letter-spacing: -.01em; }
.featured { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.card .top { display: flex; align-items: center; gap: 14px; }
.card img { width: 56px; height: 56px; border-radius: 13px; flex: none; }
.card .glyph {
  width: 56px; height: 56px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 600 1.3rem ui-monospace, SFMono-Regular, Menlo, monospace;
}
.card h3 { margin: 0; font-size: 1.2rem; }
.card .tag { color: var(--muted); font-size: .88rem; }
.card p { margin: 0; color: var(--muted); }
.card ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.card .actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.card .actions a {
  font-size: .9rem; padding: 6px 12px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line);
}
.card .actions a.main { background: var(--accent); border-color: var(--accent); color: #fff; }
.card .actions a:hover { border-color: var(--accent); }
.debut {
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 20px; padding: 22px;
  display: grid; gap: 6px;
}
.debut h3 { margin: 0; }
.debut p { margin: 0; color: var(--muted); }
.badge {
  display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px;
  background: var(--accent); color: #fff; margin-left: 8px; vertical-align: middle;
}
footer { padding: 56px 0 48px; color: var(--muted); font-size: .9rem; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform .15s ease, box-shadow .15s ease; }
  .card:hover { transform: translateY(-2px); }
}

nav.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0; flex-wrap: wrap; }
nav.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; text-decoration: none; }
nav.top .brand img { width: 28px; height: 28px; border-radius: 7px; }
nav.top ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
nav.top ul a { display: block; padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: .95rem; }
nav.top ul a:hover { color: var(--text); }
nav.top ul a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 8px; }
.page-head p { color: var(--muted); margin: 0; max-width: 38em; }
.prose { max-width: 40em; }
.prose p { color: var(--muted); }
.prose h2 { margin-top: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; margin: 0; }
.chips li { padding: 5px 13px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .9rem; }
.more-link { display: inline-block; margin-top: 16px; color: var(--accent); text-decoration: none; font-weight: 600; }
.more-link:hover { text-decoration: underline; }

/* ---------- project pages ---------- */
.crumbs { padding: 18px 0 0; color: var(--muted); font-size: .9rem; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span { margin: 0 6px; opacity: .5; }
.phead { position: relative; padding: 28px 0 24px; overflow: hidden; }
.ptitle { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ptitle img, .ptitle .glyph { width: 88px; height: 88px; border-radius: 20px; flex: none; }
.ptitle .glyph { font-size: 1.7rem; }
.ptitle h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.6rem); }
.ptitle .tag { color: var(--muted); margin-top: 2px; }
.ver { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: .8rem; }
.phead .lead { margin: 18px 0 16px; position: relative; }
.phead .links { position: relative; }
.detail section { margin-bottom: 8px; }
.detail h2 { margin-top: 36px; }
.prose-p { color: var(--muted); max-width: 40em; margin: 0; }
.feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.feats li {
  position: relative; padding: 14px 16px 14px 46px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; color: var(--muted);
}
.feats li::before {
  content: ""; position: absolute; left: 16px; top: 18px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.feats code, .steps code, .plain code { color: var(--text); }
.two { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.plain, .steps { color: var(--muted); padding-left: 1.2em; margin: 0; }
.plain li, .steps li { margin-bottom: 6px; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.code { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.code-h { padding: 8px 14px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.code pre { margin: 0; padding: 14px; overflow-x: auto; }
.code pre code { background: none; padding: 0; font-size: .86rem; color: var(--text); }
.warn { margin-top: 28px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--accent); background: var(--accent-soft); }
.note { color: var(--muted); margin-top: 24px; font-size: .92rem; }
.note a { color: var(--accent); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager a {
  display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  text-decoration: none; font-weight: 600;
}
.pager a:last-child { text-align: right; }
.pager a span { display: block; color: var(--muted); font-weight: 400; font-size: .85rem; }
.pager a:hover { border-color: var(--accent); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 40px; }
.hero > *:not(.blob):not(.petals), .phead > *:not(.petals) { position: relative; z-index: 1; }
.blob {
  position: absolute; z-index: 0; width: 460px; height: 460px; right: -80px; top: -120px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), transparent 65%); opacity: .22; filter: blur(30px);
}
.petals { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petals i {
  position: absolute; top: -30px; left: var(--x); width: calc(22px * var(--z)); height: calc(26px * var(--z));
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-70 -170 140 170'%3E%3Cpath d='M0 0C-47-35-75-105-31-155L0-134L31-155C75-105 47-35 0 0Z' fill='%23ff8fb5'/%3E%3C/svg%3E");
  opacity: 0;
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes fall {
    0% { opacity: 0; transform: translate(0, 0) rotate(var(--r)); }
    10% { opacity: .75; }
    100% { opacity: 0; transform: translate(60px, 380px) rotate(calc(var(--r) + 260deg)); }
  }
  @keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 30px) scale(1.12); }
  }
  @keyframes pop { from { transform: scale(.6) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes shine { to { background-position: 200% 0; } }

  body { animation: rise .5s ease both; }
  .rise { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 90ms); }
  .petals i { animation: fall var(--s) linear var(--d) infinite; }
  .blob { animation: drift 14s ease-in-out infinite; }
  .ptitle img, .ptitle .glyph { animation: pop .7s cubic-bezier(.2, .9, .3, 1.3) .1s both; }
  .brand img { transition: transform .4s cubic-bezier(.2, .9, .3, 1.3); }
  .brand:hover img { transform: rotate(72deg) scale(1.1); }
  h1 span { background: linear-gradient(90deg, var(--accent), #ff9dbf, var(--accent)); background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }

  .js .reveal { opacity: 0; translate: 0 22px; transition: opacity .7s ease, translate .7s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 90ms); }
  .js .reveal.in { opacity: 1; translate: 0 0; }

  .card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, opacity .7s ease, translate .7s cubic-bezier(.2, .7, .2, 1); }
  .card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 2px 4px rgba(60, 20, 40, .08), 0 16px 36px rgba(224, 69, 123, .18); }
  .card img, .card .glyph { transition: transform .35s cubic-bezier(.2, .9, .3, 1.3); }
  .card:hover img, .card:hover .glyph { transform: scale(1.1) rotate(-4deg); }
  .pill, .card .actions a { transition: transform .15s ease, border-color .15s ease, background .15s ease; }
  .pill:hover, .card .actions a:hover { transform: translateY(-2px); }
  nav.top ul a { transition: background .2s ease, color .2s ease; }
  .feats li { transition: transform .2s ease, border-color .2s ease; }
  .feats li:hover { transform: translateX(4px); border-color: var(--accent); }
  .more-link { transition: letter-spacing .2s ease; }
  .more-link:hover { letter-spacing: .02em; }
}
