* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  color: #242424;
  background: #fff;

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.site-shell {
  min-height: 100vh;

  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

/* Sidebar */

.site-sidebar {
  height: 100vh;

  position: sticky;
  top: 0;

  overflow-y: auto;

  padding: 1.5rem;

  background: #f7f7f7;

  border-right: 1px solid #ddd;
}

.site-header {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.4rem;

  font-size: 0.75rem;
  font-weight: 800;

  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-title {
  color: inherit;

  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.15;

  text-decoration: none;
}

.site-title:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.site-description {
  margin: 0.75rem 0 0;

  color: #555;

  font-size: 0.875rem;
  line-height: 1.5;
}

/* Navigation */

.site-nav {
  display: grid;

  gap: 0.2rem;
}

.nav-heading {
  margin: 1.35rem 0 0.35rem;

  color: #666;

  font-size: 0.7rem;
  font-weight: 800;

  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-heading:first-child {
  margin-top: 0;
}

.site-nav a {
  display: flex;

  gap: 0.7rem;

  align-items: center;

  padding: 0.55rem 0.7rem;

  color: #333;

  border-left: 3px solid transparent;
  border-radius: 0.4rem;

  font-size: 0.9rem;

  text-decoration: none;
}

.site-nav a:hover {
  background: #e9e9e9;
}

.site-nav a.is-active {
  background: #222;
  color: white;

  border-left-color: #222;
}

.site-nav a span {
  flex: 0 0 1.4rem;

  font-size: 0.75rem;
  font-weight: 800;
}

/* Content */

.content-shell {
  min-width: 0;

  padding: 3rem clamp(1.5rem, 5vw, 5rem) 6rem;
}

.workshop-content,
#checkpoint-banner,
#page-navigation {
  max-width: 850px;

  margin-right: auto;
  margin-left: auto;
}

/*
  Gives in-page jumps a little breathing room
  above the heading.
*/

.workshop-content h1,
.workshop-content h2,
.workshop-content h3,
.workshop-content h4,
.workshop-content h5,
.workshop-content h6 {
  scroll-margin-top: 2rem;
}

.workshop-content h1 {
  margin-top: 0;

  font-size: clamp(2rem, 5vw, 3rem);

  line-height: 1.1;
}

.workshop-content h2 {
  margin-top: 3rem;

  padding-bottom: 0.4rem;

  border-bottom: 1px solid #ddd;

  font-size: 1.65rem;
}

.workshop-content h3 {
  margin-top: 2rem;

  font-size: 1.25rem;
}

.workshop-content p,
.workshop-content li {
  line-height: 1.7;
}

.workshop-content ul,
.workshop-content ol {
  padding-left: 1.4rem;
}

/* Code */

.workshop-content code {
  padding: 0.12rem 0.35rem;

  background: #f1f1f1;

  border-radius: 0.25rem;

  font-size: 0.9em;
}

.workshop-content pre {
  overflow-x: auto;

  margin: 1.25rem 0;

  padding: 1rem;

  background: #171717;
  color: #f6f6f6;

  border-radius: 0.6rem;
}

.workshop-content pre code {
  padding: 0;

  background: transparent;

  color: inherit;
}

/* Copyable code blocks */

.code-block {
  position: relative;

  margin: 1.25rem 0;
}

/*
  The wrapper controls the outer margin.
  Extra right padding keeps longer lines from
  sitting underneath the Copy button.
*/

.code-block pre {
  margin: 0;

  padding: 1rem 5.5rem 1rem 1rem;
}

.code-copy-button {
  position: absolute;

  top: 0.65rem;
  right: 0.65rem;

  z-index: 1;

  padding: 0.35rem 0.65rem;

  color: #f6f6f6;
  background: #333;

  border: 1px solid #666;
  border-radius: 0.35rem;

  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;

  cursor: pointer;
}

.code-copy-button:hover {
  background: #444;
}

.code-copy-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.code-copy-button.is-copied {
  color: #171717;
  background: #f6f6f6;

  border-color: #f6f6f6;
}

/* Quotes / callouts */

.workshop-content blockquote {
  margin: 1.5rem 0;

  padding: 0.2rem 0 0.2rem 1rem;

  border-left: 4px solid #777;

  color: #555;
}

/* Links */

.workshop-content a {
  color: inherit;

  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

/* Tables */

.workshop-content table {
  width: 100%;

  border-collapse: collapse;
}

.workshop-content th,
.workshop-content td {
  padding: 0.65rem;

  border: 1px solid #ddd;

  text-align: left;
}

/* Collapsed optional sections */

.optional-section {
  margin: 1.5rem 0;

  background: #fafafa;

  border: 1px solid #c9c9c9;
  border-radius: 0.7rem;
}

.optional-section__summary {
  padding: 0.9rem 1rem;

  cursor: pointer;

  list-style-position: inside;
}

.optional-section__summary:hover {
  background: #f2f2f2;
}

.optional-section__summary:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.optional-section[open] > .optional-section__summary {
  border-bottom: 1px solid #ddd;
}

.optional-section > :not(summary) {
  margin-right: 1rem;
  margin-left: 1rem;
}

.optional-section > h1,
.optional-section > h2,
.optional-section > h3 {
  margin-top: 1.25rem;
}

.optional-section > :last-child {
  margin-bottom: 1rem;
}

/* Interactive learning activities */

.learning-activity {
  margin: 1.75rem 0;
  padding: 1.1rem;

  background: #fafafa;

  border: 1px solid #c9c9c9;
  border-radius: 0.7rem;
}

.learning-activity.is-correct {
  border-color: #4f7a5d;
}

.learning-activity__heading {
  display: grid;
  gap: 0.2rem;

  margin-bottom: 0.65rem;
}

.learning-activity__eyebrow {
  margin: 0;

  color: #555;

  font-size: 0.75rem;
  font-weight: 800;

  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.learning-activity__title {
  font-size: 1.05rem;
}

.learning-activity__prompt {
  margin: 0.65rem 0 1rem;

  line-height: 1.6;
}

.workshop-content pre.learning-activity__context {
  margin: 0 0 1rem;
  padding: 0.8rem;

  overflow-x: auto;

  background: #f1f1f1;
  color: #242424;

  border: 1px solid #ddd;
  border-radius: 0.45rem;

  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.learning-activity__options {
  display: grid;
  gap: 0.5rem;

  margin: 0;
  padding: 0;

  border: 0;
}

.learning-activity__option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;

  padding: 0.65rem 0.75rem;

  background: #fff;

  border: 1px solid #ddd;
  border-radius: 0.45rem;

  cursor: pointer;
}

.learning-activity__option:hover {
  background: #f4f4f4;
}

.learning-activity__option:has(input:focus-visible) {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.learning-activity__option input {
  margin-top: 0.2rem;
}

.learning-activity__input-label {
  display: grid;
  gap: 0.4rem;

  margin-bottom: 0.85rem;

  font-size: 0.85rem;
  font-weight: 700;
}

.learning-activity__input {
  width: min(100%, 36rem);

  padding: 0.65rem 0.75rem;

  color: inherit;
  background: #fff;

  border: 1px solid #aaa;
  border-radius: 0.4rem;

  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.learning-activity__input:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.learning-activity__controls {
  margin-top: 0.85rem;
}

.learning-activity__button {
  padding: 0.6rem 0.85rem;

  color: #fff;
  background: #242424;

  border: 1px solid #242424;
  border-radius: 0.4rem;

  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;

  cursor: pointer;
}

.learning-activity__button:hover:not(:disabled) {
  background: #444;
}

.learning-activity__button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.learning-activity__button:disabled {
  cursor: default;
  opacity: 0.65;
}

.learning-activity__feedback {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;

  border-radius: 0.45rem;

  line-height: 1.55;
  white-space: pre-line;
}

.learning-activity__feedback--correct {
  background: #eef7f0;
  border: 1px solid #7da287;
}

.learning-activity__feedback--incorrect {
  background: #fff4f2;
  border: 1px solid #bf8a80;
}

.learning-activity__feedback--notice,
.learning-activity__feedback--reveal {
  background: #fff;
  border: 1px solid #bbb;
}

.visually-hidden {
  width: 1px;
  height: 1px;

  position: absolute;

  overflow: hidden;

  clip: rect(0 0 0 0);
  clip-path: inset(50%);

  white-space: nowrap;
}

/* Checkpoint banner */

.checkpoint-banner {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  margin-bottom: 2rem;

  padding: 1rem;

  background: #fafafa;

  border: 1px solid #bbb;
  border-radius: 0.6rem;
}

.checkpoint-banner p {
  margin: 0.25rem 0 0;

  color: #555;

  line-height: 1.5;
}

.checkpoint-banner__link {
  flex-shrink: 0;

  display: inline-block;

  padding: 0.6rem 0.8rem;

  color: inherit;

  font-weight: 700;

  text-decoration: none;

  background: #fff;

  border: 1px solid #777;
  border-radius: 0.4rem;
}

.checkpoint-banner__link:hover {
  background: #eee;
}

/* Previous / next */

.page-nav {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 1rem;

  margin-top: 3rem;

  padding-top: 2rem;

  border-top: 1px solid #ddd;
}

.page-nav__link {
  display: grid;

  gap: 0.25rem;

  min-width: 0;

  padding: 1rem;

  color: inherit;

  text-decoration: none;

  border: 1px solid #ccc;
  border-radius: 0.6rem;
}

.page-nav__link:hover {
  background: #f7f7f7;
}

.page-nav__link--next {
  text-align: right;
}

.page-nav__direction {
  color: #666;

  font-size: 0.8rem;
  font-weight: 600;
}

/* Error */

.page-error {
  padding: 1rem;

  background: #fafafa;

  border: 1px solid #ddd;
  border-radius: 0.6rem;
}

/* Mobile */

@media (max-width: 800px) {
  .site-shell {
    display: block;
  }

  .site-sidebar {
    height: auto;

    position: static;

    border-right: 0;
    border-bottom: 1px solid #ddd;
  }

  .content-shell {
    padding: 2rem 1.25rem 4rem;
  }

  .checkpoint-banner {
    align-items: flex-start;

    flex-direction: column;
  }

  .page-nav {
    grid-template-columns: 1fr;
  }

  .page-nav__link--next {
    text-align: left;
  }
}

/* ---------------------------------
   Explorer Passport
---------------------------------- */

.explorer-passport {
  margin: 0 0 1.25rem;

  padding: 0.9rem;

  background: white;

  border: 1px solid #ddd;
  border-radius: 0.7rem;

  box-shadow: 0 2px 8px rgb(0 0 0 / 0.05);
}

.passport-eyebrow,
.passport-dialog__eyebrow {
  margin: 0 0 0.45rem;

  color: #666;

  font-size: 0.68rem;
  font-weight: 800;

  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.passport-row {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 0.75rem;

  margin-bottom: 0.7rem;
}

#passport-name {
  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;
}

#passport-points {
  flex-shrink: 0;

  padding: 0.2rem 0.45rem;

  background: #f1f1f1;

  border-radius: 999px;

  font-size: 0.8rem;
  font-weight: 800;
}

.passport-button {
  width: 100%;

  padding: 0.45rem 0.6rem;

  color: #333;
  background: #f7f7f7;

  border: 1px solid #ddd;
  border-radius: 0.4rem;

  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;

  cursor: pointer;
}

.passport-button:hover {
  background: #e9e9e9;
}

/* Modal */

.passport-modal {
  position: fixed;
  inset: 0;

  z-index: 10000;

  display: grid;
  place-items: center;

  padding: 1rem;

  background: rgb(0 0 0 / 0.6);
}

.passport-modal[hidden] {
  display: none;
}

.passport-dialog {
  width: min(100%, 430px);

  position: relative;

  padding: 1.6rem;

  background: white;

  border-radius: 0.9rem;

  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}

.passport-dialog h2 {
  margin: 0 0 0.7rem;
}

.passport-dialog p {
  line-height: 1.55;
}

.passport-dialog__hint {
  color: #666;

  font-size: 0.85rem;
}

.passport-dialog form {
  display: grid;

  gap: 0.65rem;

  margin-top: 1rem;
}

.passport-dialog label {
  font-size: 0.8rem;
  font-weight: 800;
}

.passport-dialog input {
  width: 100%;

  padding: 0.7rem 0.8rem;

  border: 1px solid #bbb;
  border-radius: 0.45rem;

  font: inherit;
}

.passport-dialog form button {
  padding: 0.7rem;

  color: white;
  background: #222;

  border: 0;
  border-radius: 0.45rem;

  font: inherit;
  font-weight: 800;

  cursor: pointer;
}

.passport-error {
  min-height: 1.2rem;

  color: #9d2020;

  font-size: 0.82rem;
}

.dialog-close {
  position: absolute;

  top: 0.65rem;
  right: 0.75rem;

  padding: 0.25rem;

  background: transparent;

  border: 0;

  font-size: 1.5rem;

  cursor: pointer;
}

/* Leaderboard */

.leaderboard-list {
  display: grid;

  gap: 0.45rem;

  margin: 1rem 0 0;

  padding: 0;

  list-style: none;
}

.leaderboard-list li {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  padding: 0.6rem 0.7rem;

  background: #f7f7f7;

  border-radius: 0.45rem;
}

/* Hidden discoveries */

.discovery-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 1rem;
  height: 1rem;

  margin-left: 0.2rem;
  padding: 0;

  color: inherit;
  background: transparent;

  border: 0;

  font-size: 0.72rem;
  line-height: 1;

  opacity: 0.08;

  cursor: pointer;

  transform: rotate(-8deg);

  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.discovery-token:hover,
.discovery-token:focus-visible {
  opacity: 1;

  transform: rotate(0deg) scale(1.35);
}

.discovery-token:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

/* Discovery toast */

.discovery-toast {
  max-width: min(390px, calc(100vw - 2rem));

  position: fixed;

  right: 1rem;
  bottom: 1rem;

  z-index: 11000;

  display: grid;

  gap: 0.25rem;

  padding: 0.9rem 1rem;

  color: white;
  background: #222;

  border-radius: 0.7rem;

  box-shadow: 0 12px 35px rgb(0 0 0 / 0.25);
}

.discovery-toast[hidden] {
  display: none;
}

.discovery-toast strong {
  font-size: 0.95rem;
}

.discovery-toast span {
  font-size: 0.82rem;
  line-height: 1.4;
}

.discovery-toast.is-prize {
  outline: 4px solid #f4c542;
}
