/* Workpiece site: one stylesheet, system fonts, light and dark by the visitor's setting. */
:root {
  --bg: #ffffff;
  --surface: #f4f6f9;
  --surface-2: #e9edf3;
  --text: #1a1f27;
  --muted: #526071;
  --border: #d5dbe4;
  --accent: #1d5bcf;
  --accent-text: #ffffff;
  --accent-soft: #e5eefc;
  --ok: #19794a;
  --warn: #9a5b00;
  --code-bg: #f4f6f9;
  --c-k: #7a2e9d;
  --c-s: #0f6b3a;
  --c-c: #66707d;
  --c-n: #a3430b;
  --c-f: #1d5bcf;
  --shadow: 0 10px 30px rgba(20, 30, 50, .14);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1217;
    --surface: #161c24;
    --surface-2: #1e2630;
    --text: #e7ebf1;
    --muted: #9eabbb;
    --border: #2b3441;
    --accent: #7db4ff;
    --accent-text: #0b1420;
    --accent-soft: #19283d;
    --ok: #55c58b;
    --warn: #e0a24a;
    --code-bg: #121820;
    --c-k: #d6a1ff;
    --c-s: #86d9a6;
    --c-c: #8b97a6;
    --c-n: #ffb27a;
    --c-f: #7db4ff;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img { max-width: 100%; height: auto; display: block; }
code, pre { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
code { font-size: .92em; background: var(--surface); padding: .08em .35em; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1rem; }
.wrap { width: min(1160px, 100% - 2rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-text); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
.small { font-size: .9rem; color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
nav a { color: var(--text); text-decoration: none; font-size: .95rem; padding: .25rem 0; }
nav a:hover { color: var(--accent); text-decoration: underline; }

/* sections */
section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--border); }
section > .wrap > h2 { margin-bottom: .5rem; }

/* hero */
.hero { padding: 3rem 0 3.5rem; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; align-items: center; }
.hero-shot { margin: 0; }
.hero-shot img { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.4rem 0 1rem; }
.button, button.sheet, .lb-bar button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 2px solid var(--accent);
  padding: .6rem 1.2rem; border-radius: 8px; text-decoration: none;
}
.button:hover { filter: brightness(1.08); }
.button.plain { background: transparent; color: var(--accent); }
.big-button { font-size: 1.1rem; padding: .8rem 1.6rem; }

/* gallery */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.4rem; margin-top: 1.5rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-main { color: inherit; text-decoration: none; display: block; }
.card-main img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); transition: transform .25s; }
.card-main:hover img, .card-main:focus-visible img { transform: scale(1.03); }
.card-main { overflow: hidden; }
.card-main h3 { margin: .9rem 1rem .4rem; color: var(--accent); }
.card p { margin: 0 1rem .7rem; font-size: .93rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 1rem .8rem; }
.tags li { font-size: .75rem; padding: .05rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.card-links { margin-top: auto !important; padding: .8rem 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; border-top: 1px solid var(--border); font-size: .9rem; }
.card-links a, button.sheet { font-size: .88rem; }
/* drawing sheets: white paper in both themes; a click opens one full size */
.examples { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card-main img { border-bottom: 1px solid var(--border); }
.card h3 { margin: .9rem 1rem .4rem; }
.card h3 a { text-decoration: none; }
.sheet-fig { margin: 0; }
.card .sheet-fig { border-bottom: 1px solid var(--border); }
.sheet-open { display: block; width: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.sheet-open img { width: 100%; height: auto; background: #fff; }
.sheet-thumbs { display: flex; flex-wrap: nowrap; gap: .4rem; padding: .5rem; background: var(--surface-2); }
.sheet-thumb { display: flex; flex-direction: column; align-items: center; gap: .15rem; flex: 1 1 0; min-width: 0; max-width: 6rem; padding: .2rem; font: inherit; font-size: .72rem; color: var(--muted); background: transparent; border: 2px solid transparent; border-radius: 6px; cursor: pointer; }
.sheet-thumb img { width: 100%; height: auto; background: #fff; border: 1px solid var(--border); }
.sheet-thumb[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.sheet-thumb:hover { color: var(--text); }
/* the drawing feature near the top */
.drawings { background: var(--surface); }
.dr-row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 1.5rem; align-items: center; margin: 1.5rem 0; }
.dr-part { margin: 0; }
.dr-part img { border: 1px solid var(--border); border-radius: var(--radius); }
.drawings .sheet-fig { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
/* examples/index.html: a row per example */
.examples-page { padding: 2.5rem 0 3rem; }
.ex-row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 1.5rem; align-items: start; padding: 2rem 0; border-top: 1px solid var(--border); }
.ex-row h2 { font-size: 1.4rem; margin-top: .9rem; }
.ex-row h2 a { text-decoration: none; }
.ex-row .tags, .ex-row p { margin-left: 0; margin-right: 0; }
.ex-render img { border: 1px solid var(--border); border-radius: var(--radius); }
.ex-row .sheet-fig { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ex-row .card-links { border-top: 0; padding-top: 0; }
.mobile-note { display: none; }

/* features */
.features { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding-bottom: 1rem; }
.feature img { width: 100%; aspect-ratio: 900 / 520; object-fit: cover; object-position: top; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.feature h3 { margin: 1rem 1rem .4rem; font-size: 1.2rem; }
.feature ul { margin: 0; padding: 0 1rem 0 2.2rem; font-size: .93rem; color: var(--text); }
.feature li { margin-bottom: .3rem; }
.mini-code { aspect-ratio: 900 / 520; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--code-bg); }
.mini-stat { aspect-ratio: 900 / 520; display: flex; flex-direction: column; justify-content: center; gap: .6rem; padding: 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.mini-stat .big { font-size: 3.4rem; }
.mini-code pre { margin: 0; border: 0; border-radius: 0; height: 100%; font-size: .78rem; }

/* code */
pre { margin: 0 0 1rem; }
.code, .shell { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; overflow: auto; font-size: .85rem; line-height: 1.55; tab-size: 4; }
.code code, .shell code { background: none; padding: 0; font-size: inherit; }
.k { color: var(--c-k); font-weight: 600; } .s { color: var(--c-s); } .c { color: var(--c-c); font-style: italic; } .n { color: var(--c-n); } .f { color: var(--c-f); }
.script-row { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.5rem; align-items: start; margin: 1.5rem 0; }
.script-row .code { margin: 0; }
.script-out { display: grid; gap: 1rem; }
.script-out figure { margin: 0; }
.script-out img { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .3rem; }

/* benchmarks */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; font-size: .92rem; color: var(--muted); }
.big { font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -.02em; }
.big .of { font-size: 1.3rem; color: var(--muted); font-weight: 500; }
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 2rem; margin: 1.5rem 0 2rem; }
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.bar { display: grid; grid-template-columns: 11rem 1fr 8.8rem; gap: .6rem; align-items: center; font-size: .86rem; }
.bar-label { overflow-wrap: anywhere; }
.bar-track { height: .7rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar-fill.partial { background: var(--warn); }
.bar-num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: .6rem 0 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
caption { text-align: left; padding: .7rem .9rem; color: var(--muted); font-size: .85rem; caption-side: top; background: var(--surface); }
th, td { padding: .4rem .55rem; border-top: 1px solid var(--border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:nth-child(2), td:nth-child(3), thead th:nth-child(2), thead th:nth-child(3) { text-align: left; }
thead th { background: var(--surface); position: sticky; top: 0; }
tr.mine { background: var(--accent-soft); }
.badge { font-size: .72rem; font-weight: 500; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 0 .5rem; margin-left: .3rem; white-space: normal; }
.plain { padding-left: 1.2rem; }
.plain li { margin-bottom: .45rem; max-width: 88ch; }

/* downloads */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 1.2rem 0 .8rem; }
.button.dl { display: flex; flex-direction: column; gap: .1rem; text-align: center; padding: .9rem 1rem; }
.button.dl strong { font-size: 1.1rem; }
.button.dl small { font-weight: 400; opacity: .9; }
.button.dl.pending { background: transparent; color: var(--text); border-style: dashed; border-color: var(--muted); }
.button.dl.pending .soon { color: var(--warn); font-weight: 600; opacity: 1; }
.soon-tag { font-size: .75rem; font-weight: 600; color: var(--warn); border: 1px solid var(--warn); border-radius: 99px; padding: 0 .5rem; vertical-align: middle; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin: 1.2rem 0; }
.shell { white-space: pre; }

/* footer */
footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2rem 0 2.5rem; font-size: .92rem; }
footer p { margin-bottom: .6rem; }
footer .links a { margin-right: 1.1rem; }
footer .small { max-width: 80ch; }

/* script pages, 404 */
.prose { padding: 2.5rem 0 3rem; max-width: 960px; }
.crumb { font-size: .9rem; }

/* lightbox */
dialog#lightbox { width: min(1400px, 96vw); max-height: 94vh; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
dialog#lightbox[open] { display: flex; flex-direction: column; }
dialog#lightbox::backdrop { background: rgba(5, 8, 12, .7); }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem .9rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.lb-bar h2 { margin: 0; font-size: 1.05rem; }
.lb-links { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.lb-bar button { padding: .25rem .8rem; font-size: .88rem; }
#lb-zoom { background: transparent; color: var(--accent); }
#lb-zoom[aria-pressed="true"] { background: var(--accent-soft); }
.lb-body { overflow: auto; background: #fff; flex: 1; }
#lb-img { width: 100%; height: auto; background: #fff; }
#lb-img.actual { width: 2000px; max-width: none; }

/* small screens */
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 1.8rem; }
  .script-row { grid-template-columns: 1fr; }
  .dr-row, .ex-row { grid-template-columns: 1fr; }
  .mobile-note { display: block; }
  .needs-desktop { display: none; }
  section { padding: 2.5rem 0; }
  .bar { grid-template-columns: 6.5rem minmax(0, 1fr) 6.5rem; }
  .bar-num { white-space: normal; font-size: .8rem; }
}
@media (max-width: 480px) {
  nav { gap: .1rem .8rem; }
  nav a { font-size: .88rem; }
  .actions .button { flex: 1 1 100%; text-align: center; }
  .grid, .features, .examples { grid-template-columns: 1fr; }
}
@media print { .top, dialog { display: none; } }
td:nth-child(3) { white-space: normal; min-width: 9rem; max-width: 14rem; }
.badge { display: inline-block; margin: .1rem 0 0; }
