Between 1000px and ~1300px the docs nav's links shrank to fit, so 快速上手
and "Get started" wrapped into columns of characters and the bar grew
two lines tall (owner's screenshot, zh docs). The links now never wrap
inside themselves (white-space: nowrap), the brand keeps its width, and
the link row is one 22px line: a link that doesn't fit wraps onto a
second line the bar clips. This fits every language without a per-language
breakpoint; the contents still list every page.
Run: served site/public locally and shot /docs/{zh,en,ja}/start in
headless Chrome at 1010, 1120, 1300 and 1500px: one line each, no clipped
half-links, buttons untouched. node --test site/*.test.mjs passes.
267 lines
18 KiB
CSS
267 lines
18 KiB
CSS
/* usemagpie.ai docs and the /import page. Black and white, like the home page. */
|
|
:root {
|
|
--bg: #fafafa;
|
|
--bg2: #f1f1f2;
|
|
--card: #ffffff;
|
|
--ink: #111112;
|
|
--ink2: #4a4a50;
|
|
--ink3: #85858c;
|
|
--line: #e4e4e7;
|
|
--btn: #111112;
|
|
--btn-ink: #fafafa;
|
|
--code: #f4f4f5;
|
|
--warn: #8a5a00;
|
|
--shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 40px -12px rgba(0,0,0,.18);
|
|
}
|
|
:root[data-theme="dark"] {
|
|
--bg: #0b0b0c;
|
|
--bg2: #121214;
|
|
--card: #161618;
|
|
--ink: #f2f2f3;
|
|
--ink2: #b3b3ba;
|
|
--ink3: #7a7a82;
|
|
--line: #26262a;
|
|
--btn: #f2f2f3;
|
|
--btn-ink: #0b0b0c;
|
|
--code: #131315;
|
|
--warn: #e0b35c;
|
|
--shadow: 0 1px 2px rgba(0,0,0,.3), 0 20px 60px -20px rgba(0,0,0,.8);
|
|
}
|
|
@media (prefers-color-scheme: dark) {
|
|
:root:not([data-theme="light"]) {
|
|
--bg: #0b0b0c;
|
|
--bg2: #121214;
|
|
--card: #161618;
|
|
--ink: #f2f2f3;
|
|
--ink2: #b3b3ba;
|
|
--ink3: #7a7a82;
|
|
--line: #26262a;
|
|
--btn: #f2f2f3;
|
|
--btn-ink: #0b0b0c;
|
|
--code: #131315;
|
|
--warn: #e0b35c;
|
|
--shadow: 0 1px 2px rgba(0,0,0,.3), 0 20px 60px -20px rgba(0,0,0,.8);
|
|
}
|
|
}
|
|
[data-theme="dark"] .bird { filter: invert(1); }
|
|
.for-dark { display: none !important; }
|
|
[data-theme="dark"] .for-light { display: none !important; }
|
|
[data-theme="dark"] .for-dark { display: block !important; }
|
|
|
|
* { box-sizing: border-box; }
|
|
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
|
|
body {
|
|
margin: 0;
|
|
background: var(--bg);
|
|
color: var(--ink);
|
|
font: 16px/1.65 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
a { color: inherit; }
|
|
code, pre, kbd, .mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }
|
|
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
|
|
|
|
nav { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
|
|
nav .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
|
|
.brand { flex: none; white-space: nowrap; display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; letter-spacing: -.01em; text-decoration: none; }
|
|
.brand img { width: 24px; height: 24px; }
|
|
.brand small { font-weight: 500; color: var(--ink3); font-size: 15px; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); }
|
|
/* one line only: a link that doesn't fit wraps onto a second line the bar clips, never into a column of characters */
|
|
nav .links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 40px 24px; min-width: 0; height: 22px; line-height: 22px; overflow: hidden; margin-left: auto; margin-right: 10px; font-size: 14px; color: var(--ink2); }
|
|
nav .links a { text-decoration: none; white-space: nowrap; }
|
|
nav .links a:hover { color: var(--ink); }
|
|
/* listed in the contents (docs.js reads them from here) but kept out of the bar, which has no room */
|
|
nav .links a.toc-only { display: none; }
|
|
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink2); cursor: pointer; padding: 0; flex: none; }
|
|
.icon-btn:hover { color: var(--ink); }
|
|
.icon-btn svg { width: 16px; height: 16px; }
|
|
.theme svg { display: none; }
|
|
.theme[data-mode="system"] .i-system, .theme[data-mode="light"] .i-light, .theme[data-mode="dark"] .i-dark { display: block; }
|
|
|
|
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; height: 42px; border-radius: 10px; background: var(--btn); color: var(--btn-ink); text-decoration: none; font: inherit; font-weight: 560; font-size: 15px; white-space: nowrap; border: 1px solid var(--btn); cursor: pointer; transition: transform .12s, opacity .12s; }
|
|
.btn:hover { opacity: .88; }
|
|
.btn:active { transform: translateY(1px); }
|
|
.btn.small { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
|
|
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
|
|
.btn.ghost:hover { border-color: var(--ink3); opacity: 1; }
|
|
.btn img { width: 18px; height: 18px; }
|
|
.btn .bird-inv { filter: invert(1); }
|
|
[data-theme="dark"] .btn .bird-inv { filter: none; }
|
|
|
|
/* docs layout */
|
|
.doc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 64px; padding-block: 56px 96px; }
|
|
.toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: -6px -10px 0; padding: 6px 10px 12px; font-size: 13.5px; }
|
|
.toc .toc-h { margin: 0 0 8px 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); }
|
|
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
|
|
.toc a { display: block; padding: 5px 10px; border-radius: 7px; line-height: 1.45; text-decoration: none; transition: color .15s, background-color .15s; }
|
|
.toc .pg > a { color: var(--ink2); font-weight: 520; }
|
|
.toc .pg > a:hover, .toc .secs a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, transparent); }
|
|
.toc .pg.cur > a { color: var(--ink); font-weight: 640; }
|
|
.toc .secs { display: grid; gap: 1px; margin: 2px 0 10px 10px; }
|
|
.toc .secs a { color: var(--ink3); font-size: 13px; }
|
|
.toc .secs a.on { color: var(--ink); font-weight: 560; background: color-mix(in srgb, var(--ink) 8%, transparent); }
|
|
.toc-bar, .toc-scrim { display: none; }
|
|
|
|
/* language menu, as on the home page */
|
|
.langs { position: relative; flex: none; }
|
|
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 11; display: grid; min-width: 150px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
|
|
.lang-menu[hidden] { display: none; }
|
|
.lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--ink2); text-decoration: none; }
|
|
.lang-menu a:hover, .lang-menu a:focus-visible { background: var(--code); color: var(--ink); outline: none; }
|
|
.lang-menu a[aria-current] { color: var(--ink); font-weight: 560; }
|
|
.lang-menu a[aria-current]::after { content: "✓"; font-weight: 400; }
|
|
:lang(ja) body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans CJK JP", system-ui, sans-serif; }
|
|
:lang(zh) article h1, :lang(zh) article h2, :lang(ja) article h1, :lang(ja) article h2 { letter-spacing: -.01em; }
|
|
article { max-width: 760px; min-width: 0; }
|
|
.eyebrow { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); margin: 0 0 12px; }
|
|
article h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.06; letter-spacing: -.035em; margin: 0 0 18px; font-weight: 700; }
|
|
.lede { font-size: 18.5px; color: var(--ink2); margin: 0 0 32px; max-width: 34em; }
|
|
article h2 { font-size: 26px; letter-spacing: -.025em; line-height: 1.2; margin: 72px 0 14px; font-weight: 660; }
|
|
article h3 { font-size: 16.5px; letter-spacing: -.01em; margin: 32px 0 8px; font-weight: 620; }
|
|
article p { margin: 0 0 16px; color: var(--ink2); }
|
|
article p b, article li b { color: var(--ink); font-weight: 600; }
|
|
article ul { color: var(--ink2); padding-left: 20px; margin: 0 0 16px; }
|
|
article li { margin: 6px 0; }
|
|
article :not(pre) > code { font-size: .86em; background: var(--code); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; color: var(--ink); white-space: nowrap; }
|
|
@media (max-width: 1100px) { article :not(pre) > code { white-space: normal; overflow-wrap: break-word; } }
|
|
.anchor { text-decoration: none; }
|
|
.anchor:hover::after { content: " #"; color: var(--ink3); }
|
|
|
|
.figure { margin: 8px 0 0; }
|
|
.figure img { width: 100%; height: auto; display: block; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
|
|
.figure figcaption { font-size: 13px; color: var(--ink3); margin-top: 12px; text-align: center; }
|
|
|
|
.steps { counter-reset: s; list-style: none; padding: 0 !important; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
|
|
.steps li { counter-increment: s; background: var(--card); margin: 0 !important; padding: 18px 20px 18px 60px; position: relative; min-width: 0; }
|
|
.steps li::before { content: counter(s); position: absolute; left: 20px; top: 18px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--ink); }
|
|
.steps li b { display: block; margin-bottom: 2px; }
|
|
|
|
.code { position: relative; margin: 0 0 20px; }
|
|
.code .lang { position: absolute; top: 0; left: 0; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3); padding: 12px 22px; }
|
|
pre { margin: 0; background: var(--code); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; overflow-x: auto; font-size: 13.5px; line-height: 1.75; color: var(--ink); }
|
|
.code .lang ~ pre { padding-top: 42px; }
|
|
.code > .copy ~ pre { padding-right: 84px; }
|
|
pre .c { color: var(--ink3); }
|
|
pre .k { color: var(--ink); font-weight: 600; }
|
|
pre .s { color: var(--ink2); }
|
|
.copy { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink2); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
.copy:hover { color: var(--ink); border-color: var(--ink3); }
|
|
.code > .copy { position: absolute; top: 8px; right: 8px; }
|
|
|
|
.url { font-size: 14.5px; line-height: 2; background: var(--code); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; overflow-x: auto; white-space: nowrap; margin: 0 0 12px; }
|
|
.url .p { color: var(--ink3); }
|
|
.url .n { color: var(--ink); font-weight: 600; }
|
|
.url .v { color: var(--ink2); }
|
|
|
|
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 20px; background: var(--card); }
|
|
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
|
|
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
tr:last-child td { border-bottom: 0; }
|
|
th { font-weight: 560; color: var(--ink3); font-size: 12.5px; letter-spacing: .02em; background: var(--bg2); }
|
|
td { color: var(--ink2); }
|
|
td:first-child { white-space: nowrap; }
|
|
td:first-child code { font-weight: 600; }
|
|
table.loose { table-layout: fixed; }
|
|
table.loose td:first-child { white-space: normal; }
|
|
pre.wrapped { white-space: pre-wrap; }
|
|
.req { font-size: 11.5px; color: var(--ink3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 6px; white-space: nowrap; }
|
|
|
|
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
|
|
.chip { display: inline-flex; align-items: baseline; gap: 7px; font-size: 13.5px; color: var(--ink2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
|
|
.chip code { background: none !important; border: 0 !important; padding: 0 !important; font-size: 12.5px !important; }
|
|
.chip span { color: var(--ink3); font-size: 12.5px; }
|
|
|
|
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 20px; }
|
|
.cards > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
|
|
.cards h3 { margin: 0 0 6px; font-size: 15px; }
|
|
.cards p { margin: 0; font-size: 14.5px; }
|
|
|
|
.note { border: 1px solid var(--line); border-left: 3px solid var(--ink); background: var(--card); border-radius: 10px; padding: 14px 18px; margin: 0 0 20px; font-size: 14.5px; color: var(--ink2); }
|
|
.note b { color: var(--ink); }
|
|
|
|
/* builder */
|
|
.builder { border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; margin: 0 0 20px; box-shadow: var(--shadow); }
|
|
.builder form { padding: 22px 22px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
|
|
.builder .full { grid-column: 1 / -1; }
|
|
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
|
|
.seg button { font: inherit; font-size: 13.5px; border: 0; background: transparent; color: var(--ink3); padding: 5px 14px; border-radius: 6px; cursor: pointer; }
|
|
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
|
|
label { display: block; font-size: 13px; color: var(--ink3); font-weight: 500; }
|
|
label i { font-style: normal; color: var(--ink3); font-weight: 400; opacity: .75; margin-left: 4px; }
|
|
label input, label select { display: block; margin-top: 6px; }
|
|
input, select { font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; width: 100%; min-width: 0; outline: none; transition: border-color .15s; }
|
|
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink3) 50%), linear-gradient(135deg, var(--ink3) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
|
|
input:focus, select:focus { border-color: var(--ink3); }
|
|
input.bad { border-color: var(--warn); }
|
|
.hide { display: none !important; }
|
|
.out { border-top: 1px solid var(--line); background: var(--bg2); padding: 8px 22px 20px; }
|
|
.out .row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
|
|
.out .row:last-of-type { border-bottom: 0; }
|
|
.out .row > span { font-size: 12.5px; color: var(--ink3); }
|
|
.out code { font-size: 12.5px; overflow-x: auto; white-space: nowrap; display: block; color: var(--ink); padding: 4px 0; scrollbar-width: thin; }
|
|
.out .msg { font-size: 13.5px; color: var(--warn); padding: 10px 0 0; }
|
|
.out .try { display: flex; gap: 10px; align-items: center; padding-top: 14px; }
|
|
.out .try small { color: var(--ink3); font-size: 12.5px; }
|
|
|
|
.badges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; }
|
|
.badges > div { border: 1px solid var(--line); border-radius: 14px; display: grid; place-items: center; padding: 34px 16px; }
|
|
.badges .on-light { background: #fafafa; }
|
|
.badges .on-dark { background: #0b0b0c; border-color: #26262a; }
|
|
.badges img { height: 40px; width: auto; display: block; }
|
|
|
|
/* getting started */
|
|
.icon-btn.lang { width: auto; min-width: 34px; padding: 0 9px; font-size: 13px; font-weight: 560; text-decoration: none; }
|
|
.callout { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 14px 18px 14px 36px; margin: 0 0 20px; font-size: 14.5px; color: var(--ink2); position: relative; }
|
|
.callout::before { content: ""; position: absolute; left: 17px; top: 23px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
|
|
.callout b { color: var(--ink); }
|
|
.ui { font-weight: 600; color: var(--ink); }
|
|
|
|
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13.5px; color: var(--ink3); }
|
|
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
|
|
footer .links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px 20px; }
|
|
footer a { text-decoration: none; }
|
|
footer a:hover { color: var(--ink); }
|
|
|
|
/* the contents list the docs, so a narrow nav keeps to the brand and buttons */
|
|
@media (max-width: 1000px) {
|
|
nav .links { display: none; }
|
|
nav .links + .langs { margin-left: auto; }
|
|
}
|
|
@media (max-width: 900px) {
|
|
html { scroll-padding-top: 124px; }
|
|
.doc { grid-template-columns: 1fr; gap: 0; padding-top: 32px; }
|
|
/* on a phone the contents are a menu under a bar that names the section being read */
|
|
.toc-bar { display: block; position: sticky; top: 61px; z-index: 9; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
|
|
.toc-bar button { display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
|
|
.toc-bar .k { flex: none; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); padding-right: 10px; border-right: 1px solid var(--line); line-height: 1.2; }
|
|
.toc-bar .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; }
|
|
.toc-bar svg { flex: none; width: 16px; height: 16px; color: var(--ink3); transition: transform .2s; }
|
|
.toc-bar button[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
.toc { display: none; position: fixed; top: 115px; left: 24px; right: 24px; z-index: 12; margin: 0; max-height: calc(100vh - 135px); max-height: calc(100dvh - 135px); padding: 12px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); font-size: 15px; }
|
|
.toc.open { display: block; }
|
|
.toc a { padding: 9px 12px; }
|
|
.toc .secs a { font-size: 14.5px; }
|
|
.toc .toc-h { margin-left: 12px; }
|
|
.toc-scrim { display: block; position: fixed; inset: 0; z-index: 8; background: rgba(0,0,0,.28); }
|
|
.toc-scrim[hidden] { display: none; }
|
|
}
|
|
@media (max-width: 600px) {
|
|
.wrap { padding-left: 16px; padding-right: 16px; }
|
|
.toc { left: 16px; right: 16px; }
|
|
.brand small { display: none; }
|
|
.cards, .badges { grid-template-columns: 1fr; }
|
|
.builder form { grid-template-columns: 1fr; padding: 18px 16px 6px; }
|
|
.out { padding: 6px 16px 16px; }
|
|
.out .row { grid-template-columns: minmax(0, 1fr) auto; }
|
|
.out .row > span { grid-column: 1 / -1; padding-top: 2px; }
|
|
article h2 { margin-top: 56px; }
|
|
th, td { padding: 10px 12px; }
|
|
nav .wrap { gap: 10px; }
|
|
}
|
|
/* a phone's width holds the brand, the language, the theme and Download */
|
|
@media (max-width: 420px) {
|
|
.brand { margin-right: auto; }
|
|
nav .links + .langs { margin-left: 0; }
|
|
nav a.icon-btn[href*="discord"], nav a.icon-btn[href*="github.com"] { display: none; }
|
|
}
|