/* Flex1 Campus kit: what every page frame shares (week 2 of "improve in place", 2026-11-26).

   Loaded by every frame, next to that frame's own stylesheet (flex1.css, portal.css or the seating
   plan's app.css). Those three name their colours differently, so nothing here uses their names: the
   kit has its own, all starting --k-, and its own class names, all starting sb- (site bar). That way the
   bar looks the same on every page whatever else the page loads.

   Light by default; the dark colours are in a (prefers-color-scheme: dark) block like every other
   stylesheet, which static/theme.js switches on or off from the choice in My account.
   System fonts only. Works from 320 px wide. */

:root {
  --k-bg: #fbfaf7;
  --k-paper: #ffffff;
  --k-ink: #2f3a48;
  --k-muted: #7a8494;
  --k-line: #e6e3dc;
  --k-on: #e8e3f6;          /* the place you are in */
  --k-on-ink: #4b3d7a;
  --k-shadow: 0 10px 30px rgba(60, 60, 90, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --k-bg: #171a20;
    --k-paper: #1f232b;
    --k-ink: #e7eaf0;
    --k-muted: #9aa3b2;
    --k-line: #2e333d;
    --k-on: #2c2742;
    --k-on-ink: #d3c9f5;
    --k-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

/* ---------- the site bar ---------- */

/* The bar is as wide as the page's own column, so its first place lines up with the left edge of what is
   under it and the name menu with the right edge (2026-11-27: it was 1180 px on every page, wider than the
   home page's 1080 px column and the 880 px of most pages). Each frame's stylesheet says how wide its
   column is and how far in it starts: --k-col and --k-pad (flex1.css and portal.css). A frame that says
   nothing (flex1 seating plan, a lesson file) gets 1180 px and 16 px, as before. */
.sitebar {
  display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap;
  box-sizing: border-box; width: 100%; max-width: var(--k-col, 1180px); margin: 0 auto;
  padding: 14px max(var(--k-pad, 16px), env(safe-area-inset-left)) 10px;
  font: 14px/1.3 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--k-ink);
}
.sitebar * { box-sizing: border-box; }
.sitebar a { text-decoration: none; color: inherit; }

.sb-logo { display: block; line-height: 0; padding: 4px 0; border-radius: 4px; margin-right: 6px; }
.sb-logo img { display: block; width: 150px; height: auto; }
/* The home page, signed in: the two-line logo, as big as a page title, in front of the places (2026-11-30). */
.sb-logo.sb-logo-stacked { margin-right: 14px; padding: 0; }
.sitebar .sb-logo.sb-logo-stacked img { width: 128px; }
h1.sr-only { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The places: quiet words in a row; the current one sits on a soft pill. */
.sb-places { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.sb-places a { padding: 7px 12px; border-radius: 99px; font-weight: 600; color: var(--k-muted); white-space: nowrap; }
.sb-places a:hover, .sb-places a:focus-visible { color: var(--k-ink); background: var(--k-paper); outline: none; box-shadow: inset 0 0 0 1px var(--k-line); }
.sb-places a[aria-current="page"] { color: var(--k-on-ink); background: var(--k-on); }

/* The name, and the menu under it. */
.sb-me { position: relative; margin-left: auto; }
.sb-me > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 14px; border-radius: 99px; border: 1px solid var(--k-line); background: var(--k-paper);
  font-weight: 600; color: var(--k-ink); max-width: 46vw;
}
.sb-me > summary::-webkit-details-marker { display: none; }
.sb-me > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--k-muted); border-bottom: 2px solid var(--k-muted); transform: translateY(-2px) rotate(45deg); flex: none; }
.sb-me[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.sb-me > summary:hover, .sb-me > summary:focus-visible { border-color: var(--k-muted); outline: none; }
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 180px;
  background: var(--k-paper); border: 1px solid var(--k-line); border-radius: 14px; box-shadow: var(--k-shadow);
  padding: 6px; display: flex; flex-direction: column;
}
.sb-menu a, .sb-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px;
  font: inherit; font-weight: 500; color: var(--k-ink); background: none; border: 0; cursor: pointer; box-shadow: none;
}
.sb-menu a:hover, .sb-menu button:hover, .sb-menu a:focus-visible, .sb-menu button:focus-visible { background: var(--k-on); color: var(--k-on-ink); outline: none; }
.sb-menu form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--k-line); display: block; }

/* Visitors: Sign in and Create account, on the right. */
.sb-visitor { display: flex; gap: 8px; margin-left: auto; }
.sb-visitor a { padding: 7px 16px; border-radius: 99px; border: 1px solid var(--k-line); background: var(--k-paper); font-weight: 600; }
.sb-visitor a:hover, .sb-visitor a:focus-visible { border-color: var(--k-muted); outline: none; }
.sb-visitor a.sb-solid { background: var(--k-ink); border-color: var(--k-ink); color: var(--k-bg); }

/* The portal pages' big title sat close under their old top row; keep that gap. */
.sitebar + .mast { padding-top: 34px; }
.sitebar + .mast > .crumb:first-child { margin-top: 0; }

/* A tablet held upright (2026-11-27, when "Seats" and "Exams" became "Seating plan" and "Exam builder"):
   the logo a little smaller and the places a little closer, so the bar stays on one line. */
@media (min-width: 721px) and (max-width: 900px) {
  .sitebar { gap: 6px 8px; }
  .sb-logo img { width: 112px; }
  .sb-places a { padding: 7px 8px; }
}

/* A phone: the logo and the name on the first line, the places on a second line that can be swiped
   sideways, so the bar never grows to three or four rows. */
@media (max-width: 720px) {
  .sitebar { padding-top: 12px; }
  .sb-logo img { width: 130px; }
  .sb-places { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
  .sb-places::-webkit-scrollbar { display: none; }
  .sb-places a { padding: 7px 11px; }
  .sitebar + .mast { padding-top: 22px; }
}

@media print { .sitebar { display: none; } }

/* ---------- a teacher's class cards on the home page (week 3, 2026-11-26) ----------
   The home page's own cards (portal.css) are tall, for a product and its description. A class card says
   less, so it is shorter, and more of them fit above the fold. */
/* Signed in, the home page's big logo is a third of its size: the visitor's welcome, not a thing to scroll
   past every morning. */
.mast.signed { padding-top: 16px !important; padding-bottom: 4px !important; }
.mast.signed h1 { margin: 0 0 6px !important; font-size: clamp(26px, 3.4vw, 34px) !important; line-height: 1.15 !important; }
.card.class-card { min-height: 150px; padding: 18px 20px 16px; }
.card.class-card h2 { font-size: 22px; margin: 6px 0 2px; }
.card.class-card .note { margin-top: 6px; max-width: none; }
.card.class-card .go { padding-top: 12px; }
.home-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; font: 14px/1.3 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.home-links a { padding: 7px 16px; border-radius: 99px; border: 1px solid var(--k-line); background: var(--k-paper); color: var(--k-ink); font-weight: 600; text-decoration: none; }
.home-links a:hover, .home-links a:focus-visible { border-color: var(--k-muted); outline: none; }
.home-links a.hl-main { background: var(--k-ink); border-color: var(--k-ink); color: var(--k-bg); }
h1 + .home-links { margin: 10px 0 24px; }        /* under a page's title (Your classes), not a small heading */

/* ---------- "Today" on a teacher's home page (2026-11-27, lib/home-today.php) ----------
   The day's lessons and duties as quiet rows in one card: when, the class and what is taught, and
   "Open lesson" at the end of the row. Under it, what is waiting (to mark, help requests). */
.home-today { margin-bottom: 18px; }
.home-today .td-date { letter-spacing: 0; text-transform: none; font-weight: 500; margin-left: 6px; }
.home-today .td-note { margin: 4px 0 10px; color: var(--k-muted); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.td-list { list-style: none; margin: 6px 0 12px; padding: 4px 16px; border: 1px solid var(--k-line); border-radius: 16px; background: var(--k-paper);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.td-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 0; }
.td-row + .td-row { border-top: 1px solid var(--k-line); }
.td-when { flex: 0 0 132px; color: var(--k-muted); font-size: 13.5px; white-space: nowrap; }
.td-when b { display: inline-block; min-width: 30px; color: var(--k-ink); font-weight: 650; font-size: 14.5px; }
.td-what { flex: 1 1 220px; min-width: 0; }
.td-what a, .td-what b { color: var(--k-ink); font-weight: 650; text-decoration: none; }
/* A class or duty in Today is a small round button, not a word to click (2026-11-30). */
.td-what a { display: inline-block; padding: 1px 10px; border: 1px solid var(--k-line); border-radius: 99px; background: var(--k-paper); }
.td-what a:hover, .td-what a:focus-visible { border-color: var(--k-muted); outline: none; }
.td-item { color: var(--k-muted); margin-left: 4px; }
.td-row[data-kind="session"] .td-what a, .td-row[data-kind="session"] .td-what b { font-weight: 500; }
.td-lost .td-what a { text-decoration: line-through; color: var(--k-muted); }
.td-nowtag { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 99px; background: var(--k-ink); color: var(--k-bg); font-size: 12px; font-weight: 650; }
.td-open { flex: none; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--k-line); color: var(--k-ink); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.td-open:hover, .td-open:focus-visible { border-color: var(--k-muted); outline: none; }
.home-links.td-links { margin: 0 0 4px; }
.home-links a.td-wait { background: var(--k-ink); border-color: var(--k-ink); color: var(--k-bg); }
.home-today .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 560px) {
  .td-when { flex-basis: 100%; }
  .td-list { padding: 2px 14px; }
}
