/* Styles for the /learn pages (generated by scripts/build-learn.mjs). Same
   modest-ui theme as the landing page, tuned for reading. */
:root {
  --mdst-color-fg: #2a1b45;
  --mdst-color-bg: #fff7ef;
  --mdst-color-border: #e2d3c4;
  --mdst-color-muted: #6c6189;
  --mdst-color-subtle: #fdeee2;
  --mdst-color-surface: #fdeee2;
  --mdst-color-focus: #ff77a8;
  --mdst-radius: 10px;
  --mdst-button-hover-bg: #ff77a8;
  --mdst-button-hover-color: #2a1b45;
  --mdst-button-hover-border: #ff77a8;
  --mdst-font-sans: "DejaVu Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html,
body {
  margin: 0;
}
body {
  background: var(--mdst-color-bg);
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--mdst-color-bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--mdst-color-border);
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-link {
  display: inline-block;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: var(--mdst-radius);
  background: var(--mdst-color-fg);
  color: var(--mdst-color-bg);
  border: 1px solid var(--mdst-color-fg);
}
.btn-link:hover {
  background: var(--mdst-button-hover-bg);
  border-color: var(--mdst-button-hover-border);
  color: var(--mdst-button-hover-color);
}
.btn-link.ghost {
  background: transparent;
  color: var(--mdst-color-fg);
}
@media (max-width: 520px) {
  .site-header {
    flex-direction: column;
    padding: 12px 16px;
    gap: 12px;
  }
  .btn-link {
    padding: 7px 12px;
    font-size: 0.85rem;
  }
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.crumbs {
  font-size: 13px;
  color: var(--mdst-color-muted);
  margin: 0 0 18px;
}
.crumbs a {
  color: inherit;
}
.page h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  margin: 0 0 14px;
}
.page h2 {
  font-size: 20px;
  margin: 34px 0 10px;
}
.page p,
.page li {
  line-height: 1.7;
}
.page p {
  margin: 0 0 14px;
}
.keys {
  margin: 0 0 22px;
}
.page .answer {
  font-size: 1.12rem;
  margin: 0 0 24px;
}

/* The mini-game, framed the same way as the landing-page demo. */
.lesson-game {
  display: flex;
  justify-content: center;
}
.lesson-game vic-app {
  width: 100%;
  max-width: 780px;
}
/* Hold space for the game and wallpaper preview until their script runs, so
   the text below doesn't jump (layout shift counts against the page). */
.lesson-game vic-app:not(:defined) {
  display: block;
  min-height: 700px;
  border-radius: 16px;
  background: #0c0818;
}
vic-wallpaper {
  display: block;
}
/* Buttons arrive with the script; hold their rows so nothing jumps. */
vic-wallpaper:not(:defined) {
  padding-top: 56px;
  padding-bottom: 150px;
}
.lesson-game noscript {
  display: block;
  padding: 20px;
  text-align: center;
}

.practise {
  margin: 0 0 8px;
  padding: 18px 20px;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: var(--mdst-color-subtle);
}
.page .practise h2 {
  margin: 0 0 6px;
}
.practise ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

kbd {
  font-family: var(--mdst-font-mono);
  font-size: 0.9em;
  padding: 1px 6px;
  border: 1px solid var(--mdst-color-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: var(--mdst-color-fg);
}
code {
  font-family: var(--mdst-font-mono);
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--mdst-color-subtle);
}

.keys {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  overflow: hidden;
  background: var(--mdst-color-subtle);
}
.keys th,
.keys td {
  text-align: left;
  padding: 9px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--mdst-color-border);
}
.keys tr:last-child td {
  border-bottom: none;
}
.keys th {
  font-size: 13px;
  color: var(--mdst-color-muted);
}
.keys td:first-child {
  white-space: nowrap;
  width: 1%;
}

.gotcha {
  margin: 26px 0 0;
  padding: 14px 18px;
  border-left: 4px solid #ff77a8;
  border-radius: 0 var(--mdst-radius) var(--mdst-radius) 0;
  background: #fff0f5;
}
.gotcha strong {
  display: block;
  margin-bottom: 2px;
}

.related {
  padding-left: 1.2em;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--mdst-color-border);
}
.pager a {
  color: var(--mdst-color-fg);
  text-decoration: none;
  font-weight: 700;
}
.pager a:hover {
  text-decoration: underline;
}
.pager .next {
  margin-left: auto;
  text-align: right;
}
.pager small {
  display: block;
  font-weight: 400;
  color: var(--mdst-color-muted);
}

.cta {
  margin: 36px 0 0;
  padding: 22px;
  text-align: center;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: var(--mdst-color-subtle);
}
.page .cta p {
  margin: 0 0 14px;
}

/* Hub */
.intro {
  font-size: 1.08rem;
  color: var(--mdst-color-muted);
}
.lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.lesson-list a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: var(--mdst-color-subtle);
  color: inherit;
  text-decoration: none;
}
.lesson-list a:hover {
  border-color: #ff77a8;
}
.lesson-list strong {
  display: block;
  margin-bottom: 2px;
}
.lesson-list span {
  color: var(--mdst-color-muted);
  font-size: 14px;
}

/* Cheat sheet */
.page-wide {
  max-width: 1080px;
}
.cheat-grid {
  column-width: 300px;
  column-gap: 16px;
}
.cheat-card {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--mdst-color-border);
  border-radius: var(--mdst-radius);
  background: var(--mdst-color-subtle);
}
.cheat-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.cheat-card table {
  width: 100%;
  border-collapse: collapse;
}
.cheat-card td {
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.45;
  vertical-align: top;
}
.cheat-card td:first-child {
  white-space: nowrap;
  padding-right: 12px;
  width: 1%;
}
.cheat-card a {
  color: inherit;
}
.wallpapers,
.try {
  margin-top: 36px;
}
.wallpaper-themes {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}
.wallpaper-themes button[aria-pressed="true"] {
  background: var(--mdst-color-fg);
  color: var(--mdst-color-bg);
  border-color: var(--mdst-color-fg);
}
.wallpaper-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--mdst-radius);
  box-shadow: 0 14px 34px rgba(20, 10, 40, 0.28);
}
.wallpaper-sizes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.wallpaper-sizes button {
  flex-direction: column;
  gap: 2px;
}
.wallpaper-direct {
  margin-top: 14px;
  font-size: 14px;
  color: var(--mdst-color-muted);
}
.wallpaper-sizes small {
  color: var(--mdst-color-muted);
}

/* Print just the commands. */
@media print {
  .site-header,
  .crumbs,
  .wallpapers,
  .try,
  .cta,
  .pager,
  vic-footer {
    display: none !important;
  }
  .page-wide {
    max-width: none;
    padding: 0;
  }
  .cheat-card {
    background: none;
  }
}

vic-footer {
  margin-top: 20px;
}
