/* The chrome around a running assignment.
 *
 * Everything here styles the frame and nothing inside the preview: the page u
 * are looking at sits in an iframe, so the assignment's own css cannot be
 * touched by this file and this file cannot be touched by it. That isolation
 * is the whole reason for the iframe -- chapter 7 sets `body { margin: 0 }` and
 * chapter 11 sets a font on the body, and neither should reach out here.
 *
 * The colours are in ../shared/theme.css, which is the study vault's palette,
 * so these pages and the playground and the vault all look like one site. This
 * file is layout written against those tokens. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

/* ---------- the bar across the top ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.top h1 .num {
  color: var(--faint);
  font-family: var(--mono);
  font-weight: 400;
  margin-right: 8px;
}

.top .sub {
  color: var(--dim);
  font-size: 13px;
}

.spacer {
  flex: 1;
}

.links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.links a,
.widths button {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surfaceUp);
  color: var(--dim);
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.links a:hover,
.widths button:hover {
  color: var(--ink);
  border-color: var(--faint);
}

.links a.primary {
  color: var(--onAccent);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.links a.primary:hover {
  color: var(--onAccent);
  background: var(--accentHover);
}

/* ---------- the width control ---------- */

.widths {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-wrap: wrap;
}

.widths .label {
  color: var(--faint);
  font-size: 12.5px;
  margin-right: 4px;
}

.widths button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accentSoft);
}

.widths .measured {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  margin-left: 4px;
}

/* ---------- the preview ---------- */

.stage {
  padding: 20px;
  display: flex;
  justify-content: center;
}

.stage iframe {
  width: 100%;
  max-width: 100%;
  height: 78vh;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  /* White in both themes. The assignment is a real page and every one of them
     is written on a white background; darkening it here would be showing the
     reader something their own file does not do. */
  background: #fff;
  display: block;
}

/* ---------- what to look at, and the source ---------- */

.notes {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.notes h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--faint);
  margin: 28px 0 10px;
  font-weight: 600;
}

.notes ul {
  margin: 0;
  padding-left: 20px;
  color: var(--dim);
  font-size: 14.5px;
}

.notes li {
  margin-bottom: 8px;
}

.notes li strong {
  color: var(--ink);
  font-weight: 600;
}

.notes code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--accent);
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
}

details {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

summary {
  cursor: pointer;
  padding: 11px 16px;
  color: var(--dim);
  font-size: 13.5px;
  user-select: none;
}

summary:hover {
  color: var(--ink);
}

details pre {
  margin: 0;
  padding: 0 16px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}

.foot {
  border-top: 1px solid var(--line);
  padding: 18px 20px 40px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

@media (max-width: 640px) {
  .top {
    gap: 10px;
  }
  .stage {
    padding: 12px;
  }
  .stage iframe {
    height: 65vh;
  }
}
