/* thinkschool.zpqv.io — single stylesheet, no JS frameworks.
   Voice principles: plainspoken layout, generous whitespace, terminal-
   aesthetic accents. Mirrors thinkbridge.zpqv.io/engineering/. */

:root {
  --bg: #fbf9f4;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --rule: #d8d3c4;
  --accent: #7a4a14;
  --good: #1e7d4f;
  --bad:  #b00020;
  --hold: #b88500;
  --code-bg: #f2efe6;
  --code-ink: #3a2410;
}
*, *::before, *::after { box-sizing: border-box; }
/* `display:flex` on .topbar nav otherwise wins over the html hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Helvetica Neue",
        "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--rule);
  background: #fff;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}
.topbar nav { display: flex; gap: 18px; align-items: center; }
#topnav-universal { margin-right: auto; }
.topbar nav a {
  font-size: 14px;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 4px;
}
.topbar nav a:hover { background: rgba(0,0,0,0.04); }
.whats-new-link { position: relative; }
.whats-new-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #b65f3f;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}
.whats-new-dot[hidden] { display: none; }
.topbar nav button {
  font-size: 13px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
.topbar .me {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

/* ── Main content ────────────────────────────────────────────── */
.content {
  max-width: 78ch;
  margin: 0 auto;
  padding: 40px 32px 80px;
}
/* Data-dense pages (admin, mentor queue, map) opt out of the reading column
   and use the available width for tables/cards. */
.content--wide {
  max-width: 1280px;
}
.page-title {
  font-size: 30px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.lede { color: var(--muted); margin: 0 0 28px; }

h2 { font-size: 20px; margin: 32px 0 12px; }
h3 { font-size: 16px; margin: 24px 0 8px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px;
  margin: 16px 0;
}
.card .tag {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--code-bg);
  color: var(--code-ink);
  margin-bottom: 8px;
}
.card .tag.good { background: #e6f4ec; color: var(--good); }
.card .tag.bad  { background: #fce8eb; color: var(--bad);  }
.card .tag.hold { background: #fdf4e0; color: var(--hold); }
.card h2 { margin-top: 0; }
.card-link {
  text-decoration: none; color: var(--ink); display: block;
}
.card-link .card:hover { border-color: var(--accent); }

/* ── Map / progress strip ────────────────────────────────────── */
.progress-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
  gap: 4px;
  margin: 16px 0;
}
.progress-strip .cell {
  height: 8px;
  background: var(--code-bg);
  border-radius: 2px;
}
.progress-strip .cell.passed { background: var(--good); }
.progress-strip .cell.current { background: var(--accent); }
.progress-strip .cell.pending { background: var(--hold); }

/* ── Piece content (Markdown-rendered) ───────────────────────── */
.piece-body {
  font-size: 17px;
  line-height: 1.65;
}
.piece-body p { margin: 14px 0; }
.piece-body code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1px 5px;
  border-radius: 3px;
}
.piece-body pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 14px 16px;
  border-radius: 5px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
.piece-body pre code { background: none; padding: 0; }
.piece-body ul, .piece-body ol { padding-left: 22px; }

/* ── Submission box ──────────────────────────────────────────── */
.exercise {
  margin: 32px 0;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.exercise h2 { margin-top: 0; }
.exercise textarea {
  width: 100%;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-ink);
  resize: vertical;
  min-height: 200px;
}
.exercise button {
  font-size: 15px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  padding: 10px 22px;
  margin-top: 12px;
  cursor: pointer;
}
.exercise button:disabled { opacity: 0.6; cursor: progress; }

.result {
  margin: 24px 0;
  padding: 20px;
  border-radius: 6px;
  border-left: 4px solid var(--rule);
  background: #fff;
}
.result.pass { border-color: var(--good); background: #f1faf4; }
.result.fail { border-color: var(--bad);  background: #fdf2f4; }
.result.pending { border-color: var(--hold); background: #fdf8eb; }
.result h3 { margin-top: 0; }

.attempts {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Empty / signed-out state ────────────────────────────────── */
.signed-out {
  max-width: 50ch;
  margin: 60px auto;
  text-align: center;
  color: var(--muted);
}
.signed-out h1 { color: var(--ink); margin: 0 0 16px; }

/* ── Laptop-required notice ──────────────────────────────────────
   The app is desktop-only (no responsive layout by design). Below a
   usable width, show a full-screen message instead of a broken layout. */
.needs-laptop { display: none; }
@media (max-width: 859px) {
  .needs-laptop {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 20000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 32px;
    background: var(--bg);
    color: var(--ink);
  }
  .needs-laptop .nl-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
  .needs-laptop p { color: var(--muted); max-width: 34ch; margin: 0; line-height: 1.55; font-size: 15px; }
}

/* ── Dev-environment marker ──────────────────────────────────────
   Hidden by default. base.njk sets html[data-env="dev"] only on the
   dev host (thinkschool-dev.local / localhost / 127.0.0.1), so this
   never renders on prod even though the HTML/CSS is identical. */
.dev-env-ribbon { display: none; }
html[data-env="dev"] .dev-env-ribbon {
  display: block;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10000;
  background: repeating-linear-gradient(45deg, #b65f3f, #b65f3f 8px, #8f4a2f 8px, #8f4a2f 16px);
  color: #fff;
  font: 700 11px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.18em;
  padding: 8px 16px;
  border-bottom-left-radius: 7px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  user-select: none;
}
/* Amber frame around the whole viewport so any dev page reads as dev. */
html[data-env="dev"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  border: 3px solid #b65f3f;
  pointer-events: none;
  z-index: 9999;
}
