/* ChessPenguin site. Visual system: docs/design/website.md §5. */
:root {
  color-scheme: dark light;
  --bg: #161718; --surface: #1f2022; --code-bg: #111213;
  --border: #2e3033; --border-strong: #4a4d52;
  --text: #e8e8e8; --text-2: #a3a7ad;
  --accent: #1f6fa8; --accent-hover: #2a7fbd; --accent-text: #62aee6;
  --focus: #62aee6; --warn: #e0a64a; --ok: #7cbf6a;
  --shadow: none;
  --font: system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff; --surface: #f5f6f7; --code-bg: #f0f1f3;
    --border: #e1e3e6; --border-strong: #c4c8cd;
    --text: #1c1d1f; --text-2: #5d636b;
    --accent-hover: #195d8e; --accent-text: #1a5f91;
    --focus: #1f6fa8; --warn: #9a5b00; --ok: #2f7d32;
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
code { font: 14px/1.5 var(--mono); }
h1, h2, h3, h4, h5 { margin: 0; }
p { margin: 0 0 12px; }

.wrap { max-width: 1168px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 639px) { .wrap { padding: 0 16px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top.scrolled { border-bottom-color: var(--border); }
.top-in { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 20px; margin-left: 8px; }
.nav a { color: var(--text-2); font-size: 15px; }
.nav a:hover { color: var(--text); text-decoration: none; }
.lang { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.lang svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.lang select { background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 6px; font: 15px var(--font); padding: 4px 6px; cursor: pointer; }
.lang select:hover { border-color: var(--border); }
.lang select option { background: var(--surface); color: var(--text); }
.top-dl { visibility: hidden; opacity: 0; transition: opacity .2s; }
.top.show-dl .top-dl { visibility: visible; opacity: 1; }
@media (max-width: 899px) { .nav { display: none; } }
@media (max-width: 639px) {
  .top-in { gap: 8px; }
  .brand { flex-shrink: 0; }
  .lang svg { display: none; }
  .lang select { font-size: 14px; padding: 4px 2px; }
  .top-dl { padding: 0 12px; flex-shrink: 0; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font: 600 15px/1.2 var(--font); border: 1px solid transparent; cursor: pointer; text-decoration: none !important; }
.btn-small { height: 36px; padding: 0 16px; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--accent-text); border-color: var(--accent-text); }
.btn-secondary:hover { background: var(--surface); }
.btn-hero { flex-direction: column; align-items: flex-start; min-width: 280px; height: 60px; padding: 0 28px; border-radius: 10px; }
.btn-hero .l1 { font-size: 17px; }
.btn-hero .l2 { font-size: 13px; font-weight: 400; opacity: .85; margin-top: 3px; }
@media (max-width: 639px) { .btn-hero { width: 100%; } }

/* Hero */
.hero { padding-top: 72px; }
.hero h1 { font-size: 46px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; max-width: 24ch; text-wrap: balance; }
.hero .sub { font-size: 19px; line-height: 1.5; color: var(--text-2); max-width: 60ch; margin: 16px 0 32px; }
.cta .links { margin: 12px 0 0; font-size: 14px; color: var(--text-2); }
.cta .note { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.cta .note.warn { color: var(--warn); }
.mobile p { color: var(--text-2); max-width: 52ch; }
.mobile .btn { margin-right: 16px; }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 24px 0 8px; }
.badges a { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 1px solid var(--border); border-radius: 14px; font-size: 13px; color: var(--text-2); }
.badges a:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.free { font-size: 13px; color: var(--text-2); margin-bottom: 48px; }
@media (max-width: 639px) { .hero { padding-top: 48px; } .hero h1 { font-size: 32px; } .hero .sub { font-size: 17px; } }

.started { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-top: 16px; max-width: 640px; position: relative; font-size: 15px; }
.started .ok { color: var(--ok); font-weight: 600; }
.started .file { color: var(--text-2); font-size: 14px; }
.started h4 { font-size: 15px; margin: 12px 0 4px; }
.started ol { margin: 0; padding-left: 20px; }
.started .x { position: absolute; right: 8px; top: 8px; background: none; border: 0; color: var(--text-2); font-size: 18px; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; }
.started .x:hover { background: var(--bg); color: var(--text); }

/* Screenshots */
.shot a, .gallery a { display: block; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); cursor: zoom-in; }
.shot a:hover, .gallery a:hover { border-color: var(--border-strong); }
.shot figcaption { margin-top: 10px; font-size: 14px; color: var(--text-2); }
.hero-shot { margin: 0; }
.block { padding-top: 96px; }
.block h2 { font-size: 32px; line-height: 1.2; margin-bottom: 32px; }
@media (max-width: 639px) { .block { padding-top: 64px; } .block h2 { font-size: 26px; margin-bottom: 24px; } }
.gallery { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }
.gallery a { border-radius: 8px; aspect-ratio: 16 / 9; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery p { margin: 10px 0 0; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 899px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) {
  .gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 8px; }
  .gallery li { flex: 0 0 85%; scroll-snap-align: start; }
}

/* Features */
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px 32px; }
.features svg { width: 24px; height: 24px; fill: none; stroke: var(--accent-text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 12px; }
.features h3 { font-size: 17px; line-height: 1.35; font-weight: 600; margin-bottom: 6px; }
.features p { font-size: 15px; color: var(--text-2); margin: 0; }
@media (max-width: 1099px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .features { grid-template-columns: 1fr; } }

/* Download */
.meta { color: var(--text-2); margin-top: -20px; margin-bottom: 24px; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font: 600 15px var(--font); padding: 10px 16px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs small { font-size: 12px; font-weight: 400; color: var(--text-2); }
.js .panel[hidden] { display: none; }
.panel { padding-top: 8px; }
.js .panel-h { display: none; }
.panel-h { font-size: 20px; margin: 24px 0 8px; }
.row { padding: 20px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row:target { background: var(--surface); border-radius: 8px; padding: 20px 12px; }
.row-h { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.row-h h4 { font-size: 16px; font-weight: 600; flex: 1 1 280px; }
.fmt { color: var(--text-2); font-size: 14px; }
.row.quiet .row-h { margin-bottom: 4px; }
.steps { margin: 0 0 8px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.row h5 { font-size: 15px; margin: 14px 0 6px; }
.hint { font-size: 14px; color: var(--text-2); margin: 8px 0 0; }
.hint code { font-size: 13px; }
.cmd { display: flex; align-items: center; gap: 8px; background: var(--code-bg); border-radius: 8px; padding: 8px 8px 8px 16px; margin: 8px 0 0; }
.cmd code { flex: 1; overflow-x: auto; white-space: nowrap; padding: 4px 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.cmd code::before { content: "$ "; color: var(--text-2); user-select: none; }
.copy { flex: none; background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: 6px; font: 13px var(--font); height: 30px; padding: 0 10px; cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--border-strong); }
.copy.done { color: var(--ok); }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent-text); }
.verify { margin-top: 24px; color: var(--text-2); font-size: 15px; }
.verify-how { font-size: 15px; }

/* Engine, open source, support */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
@media (max-width: 899px) { .two { grid-template-columns: 1fr; gap: 0; } .two section + section { padding-top: 64px; } }
.two p, #support > p { max-width: 68ch; }
.dots { padding-left: 20px; margin: 0 0 12px; }
.dots li { margin-bottom: 6px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 16px; max-width: 760px; }
@media (max-width: 639px) { .cards { grid-template-columns: 1fr; } }
.card { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.card:hover { border-color: var(--border-strong); text-decoration: none; }
.card svg { width: 24px; height: 24px; fill: none; stroke: var(--accent-text); stroke-width: 1.5; stroke-linejoin: round; flex: none; }
.card span { display: flex; flex-direction: column; font-size: 16px; overflow-wrap: anywhere; }
.card b { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* Footer */
.foot { margin-top: 96px; border-top: 1px solid var(--border); padding: 32px 0 48px; font-size: 14px; color: var(--text-2); }
.foot p { margin: 0 0 8px; }
.foot .langs a { color: var(--text-2); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); color: #fff; display: grid; grid-template-rows: 56px 1fr; }
.lightbox[hidden] { display: none; }
.lb-top { display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.lb-count { font-size: 14px; opacity: .8; }
.lb-full { margin-left: auto; color: #fff; opacity: .85; font-size: 14px; }
.lb-btn { background: rgba(255,255,255,.08); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 22px; font-size: 26px; line-height: 1; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-btn:focus-visible { outline-color: #fff; }
#lb-close { font-size: 18px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 80px 16px; min-height: 0; }
.lb-fig img { max-width: 100%; max-height: calc(100vh - 56px - 96px); object-fit: contain; border-radius: 6px; transition: transform .2s ease-out, opacity .2s; touch-action: pan-y; user-select: none; }
.lb-fig figcaption { max-width: 70ch; text-align: center; font-size: 16px; margin-top: 16px; min-height: 48px; opacity: .9; }
@media (max-width: 639px) {
  .lb-fig { padding: 0 0 72px; }
  .lb-fig figcaption { padding: 0 16px; font-size: 15px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}

.nf { padding-top: 96px; }
.nf h1 { font-size: 40px; margin-bottom: 16px; }
