/* START A BIT website. Calm and plain: off-white, charcoal text, grey-blue accent; brand yellow only in the logo and the top line.
   Works from phones (360 px) to large screens: grids use min(), the menu folds behind a button below 760 px. */
@font-face { font-family: "Lexend"; src: url("fonts/Lexend-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #1f2328; --soft: #57606a; --line: #e2e4e0; --paper: #fbfbf9; --panel: #ffffff; --tint: #f3f4f1;
  --accent: #155a6c; --accent-light: #e6f0f2; --yellow: #fdd835; --yellow-deep: #e8b800; --warn: #b3420a; --warn-light: #fff1e0;
  --round: 14px; --width: 1080px; --side: 22px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3, .brand { font-family: "Lexend", system-ui, sans-serif; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 4.2vw, 46px); margin: 0 0 12px; text-wrap: balance; }
h2 { font-size: clamp(22px, 2.8vw, 30px); margin: 0 0 12px; text-wrap: balance; }
h3 { font-size: 20px; margin: 0 0 6px; }
p { margin: 0 0 12px; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--width); margin: 0 auto; padding: 0 var(--side); }
.muted { color: var(--soft); }

/* site header: menu in one line on wide screens, behind a button on phones */
.site-header { background: var(--panel); border-top: 4px solid var(--yellow); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 8px 24px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 19px; letter-spacing: 0.06em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-left: auto; order: 2; }
.site-nav a { color: var(--soft); text-decoration: none; font-size: 16px; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.qr-button { margin-left: 4px; order: 3; background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 36px;
             padding: 6px; cursor: pointer; color: var(--soft); }
.qr-button svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.qr-button:hover { color: var(--accent); border-color: var(--accent); }
.site-card .card-logo { width: min(18vh, 120px); height: auto; image-rendering: auto; }
.site-card .card-name { font: 700 clamp(28px, 5vw, 44px) "Lexend", sans-serif; letter-spacing: 0.08em; margin: 10px 0 0; }
.site-card .card-slogan { font: 500 clamp(17px, 2.4vw, 22px) "Lexend", sans-serif; color: var(--accent); margin: 2px 0 14px; }
.site-card .card-qr { width: min(42vh, 72vw); height: auto; image-rendering: pixelated; }
.site-card .card-url { font: 700 clamp(22px, 4vw, 34px) "Lexend", sans-serif; margin: 10px 0 0; }
.site-card .card-hint { font: 400 16px system-ui, sans-serif; color: var(--soft); margin-top: 4px; }
/* the same card for one page: brand line, the page title big, its QR code and address */
.page-card .card-brand { display: flex; align-items: center; gap: 10px; font: 700 clamp(17px, 2.2vw, 22px) "Lexend", sans-serif;
                         letter-spacing: 0.08em; margin: 0 0 10px; }
.page-card .card-brand img { width: 34px; height: 34px; image-rendering: auto; }
.page-card .card-title { font: 700 clamp(30px, 5.5vw, 52px)/1.1 "Lexend", sans-serif; margin: 0; max-width: 18em; text-wrap: balance; }
.page-card .card-subtitle { font: 500 clamp(18px, 2.6vw, 26px) "Lexend", sans-serif; color: var(--accent); margin: 6px 0 0; }
.page-card .card-qr { width: min(40vh, 70vw); margin-top: 16px; }
.page-card .card-url { font: 600 clamp(16px, 2.4vw, 24px) "Lexend", sans-serif; overflow-wrap: anywhere; max-width: 90vw; }
.menu-button { display: none; margin-left: auto; align-items: center; gap: 4px; background: none; border: 1px solid var(--line); border-radius: 10px;
               padding: 7px 12px; font: 600 15px "Lexend", sans-serif; color: var(--ink); cursor: pointer; }
.menu-button .bars { display: grid; gap: 4px; }
.menu-button .bars span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.menu-button b { font-weight: 600; margin-left: 8px; }

/* site footer */
.site-footer { margin-top: 64px; background: var(--tint); border-top: 1px solid var(--line); font-size: 15px; color: var(--soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 40px; justify-content: space-between; padding-top: 26px; padding-bottom: 26px; }
.site-footer a { color: var(--soft); }
.site-footer .brand { font-size: 16px; }
.site-footer nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }

/* home hero: the slogan first and big, then the tagline */
.hero { padding: 56px 0 30px; }
.hero h1.slogan { font-size: clamp(36px, 5.6vw, 60px); letter-spacing: -0.02em; margin-bottom: 10px; }
.hero h1.slogan i { font-style: normal; color: var(--yellow-deep); }
.hero .tagline { font: 500 clamp(21px, 2.6vw, 28px)/1.3 "Lexend", sans-serif; color: var(--accent); margin-bottom: 18px; text-wrap: balance; }
.hero p.lead { font-size: 19px; color: var(--soft); }

/* page parts */
.page-head { padding: 40px 0 10px; display: flex; gap: 24px; align-items: center; }
.page-head .text { flex: 1 1 auto; min-width: 0; }
.page-head p { color: var(--soft); font-size: 20px; }
.page-head .qr { flex: 0 0 auto; text-align: center; font-size: 13px; color: var(--soft); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.page-head .qr img { width: 112px; height: 112px; display: block; }
.qr { cursor: zoom-in; }
.qr-big { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: flex; flex-direction: column;
          align-items: center; justify-content: center; cursor: zoom-out; padding: 20px; text-align: center; }
.qr-big img { width: min(70vh, 86vw); height: auto; image-rendering: pixelated; }
.qr-big p { font: 600 clamp(20px, 3vw, 30px) "Lexend", sans-serif; margin-top: 18px; }
.qr-big small { font: 400 15px system-ui, sans-serif; color: var(--soft); }
.block { padding: 26px 0; }
.block > h2 { margin-bottom: 18px; }
.buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.button { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; padding: 11px 20px; border-radius: 10px; white-space: nowrap; }
.button.secondary { background: var(--accent-light); color: var(--accent); }
.button:hover { filter: brightness(1.08); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--round); padding: 20px 22px; min-width: 0; }
.card p:last-child { margin-bottom: 0; }
a.card { color: inherit; text-decoration: none; display: block; transition: border-color 0.15s; }
a.card:hover { border-color: var(--accent); }
.card.with-image { padding: 0; overflow: hidden; margin: 0; }
.card.with-image img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--tint); }
.card.with-image img[src$=".webp"] { aspect-ratio: 1 / 1; }
.card.with-image.photo img { aspect-ratio: 3 / 2; }
.card.with-image .text { padding: 16px 20px 18px; }
.strip { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
.strip a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); color: inherit; text-decoration: none; }
.strip img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.strip span { display: block; padding: 8px 12px; font-size: 15px; color: var(--soft); }
.strip a:hover { border-color: var(--accent); }
.strip figure.tool { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.strip figure.tool img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.strip figure.tool figcaption { padding: 8px 12px; font-size: 15px; color: var(--ink); }
.block.cta { background: var(--accent-light); border-radius: var(--round); padding: 22px 24px; margin-top: 18px; }
.tag { display: inline-block; font-size: 13px; color: var(--accent); background: var(--accent-light); border-radius: 20px; padding: 1px 10px; margin: 0 6px 6px 0; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px 26px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.facts li { padding-left: 26px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 4px; top: 0.6em; width: 9px; height: 9px; border-radius: 2px; background: var(--accent); }
.path { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); counter-reset: step; }
.path .card { position: relative; padding-top: 50px; }
.path .card::before { counter-increment: step; content: counter(step); position: absolute; top: 16px; left: 22px; width: 28px; height: 28px; border-radius: 50%;
                      background: var(--accent); color: #fff; font: 600 15px/28px "Lexend", sans-serif; text-align: center; }
.path .card.with-image { padding-top: 0; }
.path .card.with-image::before { display: none; }
.list-plain { list-style: none; padding: 0; margin: 0; columns: 2 300px; column-gap: 32px; }
.list-plain li { break-inside: avoid; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* project guide parts */
section.part { background: var(--panel); border: 1px solid var(--line); border-radius: var(--round); padding: 18px 24px 22px; margin: 22px 0; }
section.part h2 .number { display: inline-block; width: 34px; height: 34px; line-height: 34px; text-align: center; border-radius: 50%;
                          background: var(--accent); color: #fff; font-size: 18px; margin-right: 10px; vertical-align: 3px; }
img.picture { display: block; width: 100%; max-width: 900px; margin: 8px auto; border-radius: 10px; }
a.zoom { display: block; cursor: zoom-in; }
img.picture.narrow { max-width: 420px; }
.two { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.two > * { flex: 1 1 min(380px, 100%); min-width: 0; }
.note { background: var(--accent-light); border-left: 5px solid var(--accent); border-radius: 8px; padding: 10px 16px; }
.note.warn { background: var(--warn-light); border-left-color: var(--warn); }
iframe.simulator { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
details { margin: 10px 0; } summary { cursor: pointer; font-weight: 600; color: var(--accent); }
pre { background: #1f2328; color: #eaeaea; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 14px; line-height: 1.5; }

/* when: date lists made by tools/schedule.py; past dates fade, the next one is marked */
.schedule h3 { margin: 18px 0 8px; }
.dates { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.dates li { background: var(--accent-light); border: 1px solid #cfe2e6; border-radius: 10px; padding: 7px 12px; font-size: 16px; }
.dates li span { color: var(--soft); font-size: 14px; margin-left: 4px; }
.dates li.past { background: transparent; border-color: var(--line); opacity: 0.32; }
.dates li.past::after { content: "done"; float: right; font-size: 12px; color: var(--soft); margin-top: 3px; }
.dates li.cancelled b { text-decoration: line-through; }
.dates li.next { background: var(--accent); border-color: var(--accent); color: #fff; }
.dates li.next span { color: #d7e9ee; }
.dates li.next::after { content: "next"; float: right; font-size: 12px; font-weight: 700; color: #fff; margin-top: 3px; }
.site-footer .quick { display: flex; gap: 18px; margin-top: 6px; }
.narrow { max-width: 820px; }

/* full-screen picture viewer (assets/site.js) */
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(20, 22, 25, 0.94); overflow: auto; display: flex;
          align-items: center; justify-content: center; touch-action: pinch-zoom pan-x pan-y; }
.viewer img { max-width: 96vw; max-height: 92vh; cursor: zoom-in; background: #fff; border-radius: 6px; }
.viewer.zoomed { display: block; }
.viewer.zoomed img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; margin: 0 auto; display: block; }
.viewer button { position: fixed; border: none; background: rgba(255, 255, 255, 0.9); color: var(--ink); cursor: pointer;
                 width: 46px; height: 46px; border-radius: 50%; font-size: 24px; line-height: 1; }
.viewer-close { top: 14px; right: 14px; }
.viewer-prev { left: 14px; top: 50%; transform: translateY(-50%); font-size: 32px !important; }
.viewer-next { right: 14px; top: 50%; transform: translateY(-50%); font-size: 32px !important; }
.viewer-hint { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, 0.7);
               font-size: 14px; margin: 0; pointer-events: none; }
@media (hover: none) { .viewer-hint { display: none; } }

/* project contents list */
.toc { background: var(--tint); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; }
.toc h3 { font-size: 17px; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 22px; }
.toc li { padding: 2px 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
section.part { scroll-margin-top: 80px; }

/* grouped facts: practical information in small cards */
.facts-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.facts-cards h3 { font-size: 18px; margin-bottom: 8px; }
.facts-cards ul { margin: 0; padding-left: 18px; }
.facts-cards li { padding: 3px 0; }

/* learning roadmap: one card per stage */
.stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stage-head .muted { font-size: 15px; }
.roadmap h4 { font: 600 15px "Lexend", sans-serif; color: var(--accent); margin: 12px 0 4px; }
.roadmap ul { margin: 0; padding-left: 18px; }
.roadmap li { padding: 2px 0; }

/* MakeCode-like blocks in project guides */
.blocks { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; align-items: center; }
.mc { color: #fff; font: 600 15px/1.5 "Segoe UI", system-ui, sans-serif; padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
.mc i { font-style: normal; background: #fff; color: var(--ink); border-radius: 12px; padding: 0 8px; margin: 0 2px; font-weight: 500; }
.mc.servo { background: #00a654; } .mc.basic { background: #1e90ff; } .mc.function { background: #3455db; }
.mc.neopixel { background: #2699bf; } .mc.input { background: #d400d4; } .mc.loops { background: #00aa00; }
.mc.logic { background: #00a4a6; } .mc.math { background: #9400d3; } .mc.variables { background: #dc143c; }
.mc-note { color: var(--soft); font-size: 16px; }
/* a small program: event blocks with their inner blocks indented below */
.stacks { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; margin: 10px 0 14px; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.stack > .mc, .stack .in > .mc { line-height: 1.9; }
.mc .mc { padding: 3px 8px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stack .in { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-left: 22px; }
.levels .level { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.levels .level h3 .tag { margin-left: 8px; vertical-align: middle; }

/* locked part: students ask the teacher for the code */
.locked { border: 1px dashed var(--accent); border-radius: 12px; padding: 14px 18px; background: var(--accent-light); }
.locked form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.locked input { font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); width: 160px; }
.locked button { font: inherit; padding: 7px 16px; border-radius: 8px; border: none; background: var(--accent); color: #fff; cursor: pointer; }
.locked .wrong { color: var(--warn); }

/* tablets and small laptops */
@media (max-width: 1000px) {
  .site-nav { gap: 4px 16px; }
}

/* phones */
@media (max-width: 760px) {
  :root { --side: 16px; }
  body { font-size: 17px; }
  .site-header .wrap { min-height: 54px; }
  .brand { font-size: 17px; }
  .brand img { width: 28px; height: 28px; }
  .menu-button { display: flex; margin-left: 0; order: 3; }
  .qr-button { margin-left: auto; order: 2; height: 38px; }
  .site-nav { display: none; width: 100%; margin: 0 0 10px; flex-direction: column; gap: 0; order: 4; }
  .site-header .wrap.open .site-nav { display: flex; }
  .site-nav a { font-size: 17px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .site-nav a.active { border-bottom-color: var(--line); color: var(--accent); font-weight: 600; }
  .hero { padding: 30px 0 18px; }
  .hero p.lead { font-size: 17px; }
  .page-head { padding: 26px 0 4px; }
  .page-head p { font-size: 18px; }
  .page-head .qr { display: none; }
  .block { padding: 18px 0; }
  .strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .strip span { font-size: 14px; padding: 6px 10px; }
  .card { padding: 16px 18px; }
  .card.with-image img[src$=".webp"] { aspect-ratio: 4 / 3; }
  .grid.gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dates { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .blocks { grid-template-columns: 1fr; gap: 4px; }
  .mc { white-space: normal; justify-self: start; }
  .mc-note { margin-bottom: 8px; font-size: 15px; }
  .dates li { padding: 6px 9px; font-size: 15px; }
  .dates li span { display: block; margin-left: 0; font-size: 13px; }
  .grid.gallery .card.with-image img[src$=".webp"] { aspect-ratio: 1 / 1; }
  .grid.gallery .text { padding: 8px 10px 10px; }
  .grid.gallery h3 { font-size: 15px; margin-bottom: 2px; }
  .grid.gallery p { font-size: 13px; line-height: 1.45; }
  section.part { padding: 12px 12px 16px; margin: 16px 0; }
  img.picture { border-radius: 6px; }
  iframe.simulator { display: none; }
  .site-footer { margin-top: 40px; }
}

/* project cards: every card picture is 4:3 (made by tools/card_picture.py), so the cards line up */
.card.with-image.project img[src] { aspect-ratio: 4 / 3; object-fit: cover; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.photo-pair img { display: block; width: 100%; border-radius: 8px; }
/* folded levels in a project guide: click the title to open */
details.level > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
details.level > summary::-webkit-details-marker { display: none; }
details.level > summary::before { content: "▸"; color: var(--accent); font-size: 20px; transition: transform 0.15s; }
details.level[open] > summary::before { transform: rotate(90deg); }
details.level > summary h3 { margin: 0; color: var(--ink); }
details.level > summary:hover h3 { color: var(--accent); }
details.level[open] > summary { margin-bottom: 8px; }
details.level h3 .tag { margin-left: 8px; vertical-align: middle; }
details.deep { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }

/* board choice in projects for more than one board: only the chosen board's parts show */
.track-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
             background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 0; margin: 4px 0 0; }
.track-bar span { font: 600 15px "Lexend", sans-serif; color: var(--soft); }
.track-bar button { font: 600 16px "Lexend", sans-serif; padding: 7px 18px; border-radius: 20px; cursor: pointer;
                    border: 1.5px solid var(--accent); background: #fff; color: var(--accent); }
.track-bar button[aria-pressed="true"] { background: var(--accent); color: #fff; }
body[data-track="microbit"] [data-track="arduino"], body[data-track="arduino"] [data-track="microbit"] { display: none !important; }
body:not([data-track]) [data-track="arduino"] { display: none; }
.track-label { display: inline-block; font: 600 13px "Lexend", sans-serif; color: #fff; background: var(--accent);
               border-radius: 12px; padding: 1px 10px; margin-bottom: 6px; }
.mc.pins { background: #b22222; }
pre.code { white-space: pre; font-size: 14px; }
/* the table of contents of a project: one compact row of numbered links above the first section */
.toc.toc-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 10px 16px; margin: 16px 0 0; }
.toc.toc-row h3 { font-size: 15px; margin: 0; color: var(--soft); }
.toc.toc-row ol { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 0; list-style: none; counter-reset: toc; }
.toc.toc-row li { counter-increment: toc; padding: 0; }
.toc.toc-row li::before { content: counter(toc); display: inline-block; width: 20px; height: 20px; line-height: 20px;
                          text-align: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px;
                          font-weight: 600; margin-right: 5px; vertical-align: 1px; }
.toc.toc-row li a { font-size: 15px; }
.toc.toc-row li:not(:last-child)::after { content: "·"; color: var(--line); margin-left: 8px; }
@media (max-width: 760px) { .toc.toc-row ol { flex-direction: column; gap: 4px; } .toc.toc-row li::after { display: none; } }
