:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b2430;
  --muted: #5b6776;
  --line: #dfe3e8;
  --accent: #2563eb;
  --accent-soft: #e8effd;
  --mark: #e8590c;
  --tip: #fff8e6;
  --tip-line: #f2c94c;
  --code: #f0f2f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --ink: #e8ecf1;
    --muted: #9aa6b5;
    --line: #2b3440;
    --accent: #6f9bff;
    --accent-soft: #1d2a44;
    --mark: #ff8a4c;
    --tip: #2a2513;
    --tip-line: #a8862a;
    --code: #222a35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
code {
  background: var(--code);
  border-radius: 4px;
  padding: .1em .35em;
  font: .92em/1.4 Consolas, "Cascadia Mono", Menlo, monospace;
}
pre { background: var(--code); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
pre code { background: none; padding: 0; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1400px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 18px; }
.brand-sub { color: var(--muted); font-weight: 400; }
.logo { width: 30px; height: 30px; }
.logo rect { fill: #2563eb; }
.logo circle { fill: #fff; }
.logo path { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.top nav { display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.top nav a:hover { color: var(--accent); }

/* gallery */
.hero { padding: 54px 16px 30px; text-align: center; }
.hero h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.02em; }
.hero p { margin: 0 auto; max-width: 720px; font-size: 19px; color: var(--muted); }
.hero .hero-sub { margin-top: 14px; font-size: 16px; }
.gallery { max-width: 1240px; margin: 0 auto; padding: 0 16px 60px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 28px; }
.filter {
  font: inherit; font-size: 15px; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.filter:hover { border-color: var(--accent); }
.filter.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #d9dee6; }
.card-body { position: relative; padding: 16px 18px 18px; }
.card-number {
  position: absolute; top: -17px; left: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 650; border: 3px solid var(--surface);
}
.card h2 { margin: 12px 0 4px; font-size: 19px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.500px; padding: 2px 9px; border-radius: 999px; background: var(--code); color: var(--muted); }
.chip.topic { background: var(--accent-soft); color: var(--accent); }
.chip.level-beginner { background: #e3f6e8; color: #17713a; }
.chip.level-intermediate { background: #fdf0d9; color: #94590a; }
.chip.level-advanced { background: #fde4e4; color: #a12626; }
@media (prefers-color-scheme: dark) {
  .chip.level-beginner { background: #173524; color: #7bd69a; }
  .chip.level-intermediate { background: #3a2c12; color: #f0bd6a; }
  .chip.level-advanced { background: #3d1c1c; color: #f29a9a; }
}
.empty { text-align: center; color: var(--muted); }

/* a tutorial */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; max-width: 1400px; margin: 0 auto; padding: 28px 16px 60px; }
.contents { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; font-size: 14.500px; }
.contents .back { display: inline-block; margin-bottom: 14px; text-decoration: none; }
.contents-title { margin: 0 0 6px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.contents ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; border-left: 2px solid var(--line); }
.contents li { counter-increment: toc; }
.contents li a {
  display: block; padding: 4px 10px 4px 12px; margin-left: -2px;
  color: var(--muted); text-decoration: none; border-left: 2px solid transparent;
}
.contents li a::before { content: counter(toc) ". "; }
.contents li a:hover { color: var(--ink); }
.contents li a.here { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.tutorial { min-width: 0; max-width: 1100px; }
.tutorial > p, .tutorial > ul, .step > p, .step > ul, .step > ol, .tip, .learn { max-width: 820px; }
.crumb { margin: 0; color: var(--muted); font-size: 14px; }
.tutorial h1 { margin: 2px 0 6px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.02em; line-height: 1.2; }
.lead { margin: 0 0 12px; font-size: 19px; color: var(--muted); }
.learn { margin: 22px 0 8px; padding: 16px 20px; background: var(--accent-soft); border-radius: 12px; }
.learn h3 { margin: 0 0 6px; font-size: 16px; }
.learn ul { margin: 0; padding-left: 20px; }
.run-time { margin: 10px 0 0; font-size: 14.500px; color: var(--muted); }
.step { margin-top: 44px; padding-top: 6px; border-top: 1px solid var(--line); }
.step h2 { display: flex; align-items: center; gap: 12px; margin: 22px 0 10px; font-size: 24px; line-height: 1.25; }
.step-number {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 650;
}
ol.marks { list-style: none; counter-reset: mark; padding: 0; margin: 14px 0; }
ol.marks li { counter-increment: mark; position: relative; padding: 3px 0 3px 38px; margin: 4px 0; }
ol.marks li::before {
  content: counter(mark);
  position: absolute; left: 0; top: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mark); color: #fff; font-size: 14px; font-weight: 700;
}
figure { margin: 18px 0; }
figure img {
  display: block; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); cursor: zoom-in; background: #fff;
}
.tip { margin: 16px 0; padding: 4px 18px; background: var(--tip); border-left: 4px solid var(--tip-line); border-radius: 0 10px 10px 0; }
.tip p:first-child::before { content: "Tip: "; font-weight: 650; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 54px; }
.pager a {
  flex: 0 1 46%; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600;
}
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.pager .next { text-align: right; margin-left: auto; }

.lightbox {
  position: fixed; inset: 0; z-index: 50; padding: 2vmin;
  display: grid; place-items: center;
  background: rgba(10, 14, 20, .88); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 96vh; border-radius: 6px; }

.foot { border-top: 1px solid var(--line); padding: 22px 16px 34px; }
.foot p { max-width: 900px; margin: 0 auto; font-size: 13px; color: var(--muted); text-align: center; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 8px; padding-top: 16px; }
  .contents { position: static; max-height: none; }
  .contents ol { display: none; }
  .contents-title { display: none; }
  .step h2 { font-size: 21px; }
  .top nav { gap: 12px; }
  .brand-sub { display: none; }
}
