:root {
  --bg: #cfe8fb; --panel: #ffffff; --panel-hi: #eef7ff;
  --text: #12324a; --muted: #4a6a82; --accent: #2b8be0; --border: #a9d3f5;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e6f4ff, var(--bg) 60%);
  color: var(--text);
}
.navbar {
  background: #1d5f9e; color: #fff;
  box-shadow: 0 2px 8px rgba(18,50,74,.2);
}
.navbar ol {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem;
  max-width: 1100px; margin: 0 auto; padding: .9rem 1.5rem; list-style: none;
  font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; line-height: 1.3;
}
.navbar li + li::before { content: "›"; margin-right: .6rem; opacity: .7; }
.navbar a { color: inherit; text-decoration: none; opacity: .85; border-radius: 4px; }
.navbar a:hover { opacity: 1; text-decoration: underline; }
.navbar a:focus-visible { opacity: 1; outline: 3px solid #fff; outline-offset: 2px; }
.navbar [aria-current] { opacity: 1; }
.navbar li { display: flex; align-items: center; }
.navbar li:first-child > * { display: inline-flex; align-items: center; gap: .5rem; }
.navbar .logo { width: 30px; height: 30px; flex: none; }
@media (max-width: 480px) { .navbar ol { font-size: 1rem; padding: .7rem 1rem; gap: .15rem .4rem; } .navbar li + li::before { margin-right: .4rem; } }
main {
  max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  display: flex; flex-direction: column; gap: .5rem;
  padding: 1.5rem; border-radius: 16px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(18,50,74,.08);
  transition: transform .15s, background .15s, border-color .15s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px); background: var(--panel-hi);
  border-color: var(--accent); outline: none;
}
.emoji { font-size: 2.5rem; line-height: 1; }
.card h2 { margin: .25rem 0 0; font-size: 1.25rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Content pages */
.page { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.page h1 { margin: 0 0 .75rem; font-size: 2rem; }
.page p { color: var(--muted); font-size: 1.15rem; line-height: 1.6; margin: 0 0 1rem; }
.page h2 { margin: 2rem 0 .75rem; font-size: 1.4rem; }
.page ul, .page ol { margin: 0 0 1rem; padding-left: 1.4rem; color: var(--muted); font-size: 1.15rem; line-height: 1.6; }
.page li { margin-bottom: .5rem; }
.page li strong { color: var(--text); }
.page .lead { font-size: 1.3rem; color: var(--text); }
.page a { color: #1d5f9e; font-weight: 600; }
.page a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.resources { list-style: none; padding: 0 !important; display: grid; gap: .9rem; }
.resources li {
  margin: 0; padding: 1rem 1.25rem; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 2px 8px rgba(18,50,74,.08);
}
.resources a { font-size: 1.2rem; }
.resources p { margin: .25rem 0 0; font-size: 1.05rem; }
.tip { background: var(--panel-hi); border-left: 4px solid var(--accent); padding: .9rem 1.1rem; border-radius: 0 8px 8px 0; }

/* Try It Yourself lessons */
.lesson {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 2px 8px rgba(18,50,74,.08); padding: 1.25rem 1.5rem; margin: 1.5rem 0;
}
.lesson h2 { margin-top: 0; }
.lesson code { background: var(--panel-hi); padding: .1rem .35rem; border-radius: 4px; color: var(--text); }
.lesson textarea {
  width: 100%; min-height: 6rem; resize: vertical; padding: .75rem .9rem;
  font: 1.1rem/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--text);
  background: #f7fbff; border: 2px solid var(--border); border-radius: 10px;
}
.lesson textarea:focus { outline: none; border-color: var(--accent); }
.lesson .buttons { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0; }
.lesson button {
  font-size: 1.1rem; font-weight: 700; padding: .6rem 1.4rem; border-radius: 10px;
  border: 2px solid #1d5f9e; cursor: pointer;
}
.lesson button.run { background: #1d5f9e; color: #fff; }
.lesson button.reset { background: transparent; color: #1d5f9e; }
.lesson button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lesson .output {
  min-height: 3rem; margin: 0; padding: .75rem .9rem; white-space: pre-wrap;
  font: 1.1rem/1.5 ui-monospace, Menlo, Consolas, monospace;
  background: #12324a; color: #e8f4ff; border-radius: 10px;
}
.lesson .output .err { color: #ffb4b4; }
.lesson .output .hint { color: #9fb8cc; font-style: italic; }

/* Slide shows */
.page.wide { max-width: 1100px; }
.slideshow { margin: 1.5rem 0; }
.page .slides { list-style: none; margin: 0; padding: 0; }
.slide img {
  display: block; width: 100%; height: auto; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(18,50,74,.12); background: #fff;
}
.slide-text { margin-top: .75rem; }
.slide-text summary { cursor: pointer; color: #1d5f9e; font-weight: 600; font-size: 1.05rem; }
.slide-text pre { white-space: pre-wrap; font: 1.05rem/1.5 system-ui, sans-serif; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; }
.slide-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0 .5rem; flex-wrap: wrap; }
.slide-controls button, .slide-extra button {
  font-size: 1.15rem; font-weight: 700; padding: .65rem 1.4rem; border-radius: 10px; cursor: pointer;
  border: 2px solid #1d5f9e; background: #1d5f9e; color: #fff;
}
.slide-controls button:disabled { opacity: .35; cursor: default; }
.slide-controls button:focus-visible, .slide-extra button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.counter { font-size: 1.15rem; font-weight: 700; min-width: 8.5rem; text-align: center; }
.slide-extra { display: flex; justify-content: center; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.slide-extra button { background: transparent; color: #1d5f9e; font-size: 1rem; padding: .45rem 1rem; }
.slide-extra a { font-weight: 600; color: #1d5f9e; }
.slideshow:fullscreen { background: #0d1b2a; display: flex; flex-direction: column; justify-content: center; padding: 1rem; }
.slideshow:fullscreen .slide img { max-height: calc(100vh - 7rem); width: auto; margin: 0 auto; border: 0; }
.slideshow:fullscreen .slide-text, .slideshow:fullscreen .slide-extra a { display: none; }
.slideshow:fullscreen .counter { color: #fff; }
.slideshow:fullscreen .slide-extra button { color: #fff; border-color: #fff; }

/* HTML slide decks (scale with the slide's width via cqw units) */
.deck-slide {
  aspect-ratio: 16 / 9; container-type: inline-size; overflow: hidden;
  display: flex; flex-direction: column; background: #f7f9fc; color: #222;
  border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(18,50,74,.12);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.deck-slide > header { background: #1e3a5f; color: #fff; padding: 2.4cqw 4.5cqw; border-bottom: .5cqw solid #2b8be0; }
.deck-slide > header h2 { margin: 0; font-size: 4.2cqw; line-height: 1.15; white-space: nowrap; }
.deck-body { flex: 1; padding: 2.6cqw 4.5cqw; font-size: 2.3cqw; line-height: 1.4; }
.page .deck-body p { margin: 0 0 1.4cqw; font-size: inherit; color: inherit; line-height: inherit; }
.page .deck-body ul, .page .deck-body ol { margin: 0 0 1.4cqw; padding-left: 3cqw; font-size: inherit; color: inherit; line-height: inherit; }
.page .deck-body li { margin-bottom: .9cqw; }
.page .deck-body strong { color: #1e3a5f; }
.page .deck-body a { color: #1d5f9e; }
.page .deck-body .big { font-size: 2.9cqw; }
.deck-body .note { color: #4a6a82; font-style: italic; }
.deck-cols { display: grid; gap: 2cqw; margin-bottom: 1.6cqw; }
.deck-cols.c2 { grid-template-columns: 1fr 1fr; }
.deck-cols.c3 { grid-template-columns: repeat(3, 1fr); }
.deck-box { background: #fff; border: .15cqw solid #c9d6e6; border-radius: 1cqw; padding: 1.6cqw 2cqw; }
.deck-box h3 { margin: 0 0 .8cqw; font-size: 2.7cqw; color: #1e3a5f; }
.page .deck-box p { margin: 0; }
.deck-box .icon { font-size: 4cqw; line-height: 1; margin-bottom: .6cqw; }
.page .deck-body ul.plain { list-style: none; padding-left: 0; }
.deck-box.good { background: #e3f6e8; border-color: #9fd6ad; }
.deck-tip { background: #dcebfa; border-left: .6cqw solid #2b8be0; padding: 1.4cqw 2cqw; border-radius: 0 1cqw 1cqw 0; margin-bottom: 1.6cqw; }
.deck-table { border-collapse: collapse; font-size: 2.5cqw; }
.deck-table th { background: #1e3a5f; color: #fff; padding: .8cqw 3cqw; }
.deck-table td { background: #fff; border: .12cqw solid #c9d6e6; padding: .6cqw 3cqw; text-align: center; font-variant-numeric: tabular-nums; }
.page .deck-body .deck-bits { margin-top: 1cqw; font: 700 5cqw/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .6cqw; color: #2b8be0; }
/* Title slide */
.deck-slide.title { background: linear-gradient(#1e3a5f 0 62%, #2b8be0 62% 63%, #f7f9fc 63%); }
.deck-slide.title .deck-body { display: flex; flex-direction: column; padding: 9cqw 6cqw 0; color: #fff; }
.deck-slide.title h2 { margin: 0 0 2cqw; font-size: 7cqw; line-height: 1.05; }
.page .deck-slide.title p { color: #cfe3f7; font-size: 3cqw; }
.deck-slide.title .emoji-row { margin-top: auto; padding-bottom: 4cqw; display: flex; justify-content: space-around; font-size: 6cqw; }
.slideshow:fullscreen .deck-slide { width: min(100%, calc((100vh - 7rem) * 16 / 9)); margin: 0 auto; border: 0; }
