/* jarchi's pages around the class (pages.js frame): the header, the content column, the link cards, the footer,
   and the /status and /help pages. Built on style.css's tokens and components (.card .btn .hint .chip …).
   The class room renders without .pg and keeps style.css's own layout. */

:root { --pg-gap: 16px; }

/* ---------- the frame ---------- */
/* A page sizes its own column: the shared .wrap stops limiting it (browsers without :has keep .wrap's column,
   and the container queries below keep such a page in one column). */
@supports selector(:has(a)) {
  .wrap:has(> .pg) { max-width: none; }
}
.pg { margin-inline: auto; container-type: inline-size; }
.pg-narrow { max-width: 540px; }
.pg-wide { max-width: 1120px; }
@media (min-width: 900px) {
  .wrap:has(> .pg) { padding-inline: 32px; padding-top: 24px; }
}

.pg-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; margin: 0 0 20px;
}
.pg-brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; color: var(--ink); text-decoration: none;
  font-size: 20px; font-weight: 800; letter-spacing: 0;
  border-radius: 12px;
}
.pg-logo { display: inline-flex; width: 34px; height: 34px; flex: none; }
.pg-logo svg { width: 100%; height: 100%; }
.pg-logo-tile { fill: var(--accent); }
.pg-logo-bar { fill: none; stroke: var(--accent-ink); }
.pg-headlink {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700;
}
.pg-headlink:hover { color: var(--accent); background: var(--accent-soft); }
.pg-brand:focus-visible, .pg-headlink:focus-visible, .pg a:focus-visible, .pg button:focus-visible,
.pg select:focus-visible, .pg textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.pg-ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.pg-ic svg { width: 100%; height: 100%; }

/* The page title (h1) and its line. */
.pg-title { font-size: 24px; line-height: 1.45; font-weight: 800; margin: 0 0 6px; overflow-wrap: anywhere; }
.pg-lede { color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.pg-eyebrow { color: var(--accent); font-size: 13px; font-weight: 800; margin: 0 0 2px; }
@container (min-width: 720px) {
  .pg-title { font-size: 30px; }
  .pg-lede { font-size: 17px; }
}

.pg .card h2 { line-height: 1.5; }
.pg a.btn { display: flex; }
.btn.pg-iconbtn .pg-ic { width: 18px; height: 18px; }
/* A quiet action that reads as a link but is a full-size target. */
.pg-textbtn {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 6px; border-radius: 10px;
  color: var(--accent-strong); font: inherit; font-weight: 700;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.pg-textbtn:disabled { opacity: .55; cursor: default; }

/* ---------- a link to copy or share (linkCard in app.js) ---------- */
.pg-linkcard h2 { display: flex; align-items: center; gap: 8px; }
.pg-linkcard h2 .pg-ic { color: var(--accent); }
.pg-linkrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.pg-linkrow .linkbox { flex: 1 1 240px; min-height: 44px; padding: 9px 12px; line-height: 24px; font-size: 13px; }
.pg-linkacts { display: flex; gap: 8px; flex: 0 0 auto; }
.pg-linkacts .btn { width: auto; flex: 1 1 auto; }
.pg-linkacts .btn[data-done="1"] { background: var(--ok-soft); color: var(--ok-ink); }
@container (max-width: 480px) {
  .pg-linkacts { flex: 1 1 100%; }
}
.pg-linkcard.secret { border-color: var(--line); }
.secret-note {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--live-soft); color: var(--warn);
  font-weight: 700; font-size: 14px;
  border-radius: 8px; padding: 2px 10px; margin: 0 0 12px;
}
.secret-note .pg-ic { width: 16px; height: 16px; }

/* ---------- the footer on every page ---------- */
.ver {
  max-width: 460px;
  margin: 0 auto;
  padding: 4px 16px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  opacity: .9;
}
.ver a { color: inherit; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; }
.ver a:hover { color: var(--accent); }
.ver bdi { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; }

/* ---------- /status and /help (static pages: .wrap.page) ---------- */
.wrap.page, #status.wrap { max-width: 720px; }
.page h2 { font-size: 18px; }
.page p, .page li { margin: 0 0 8px; }
.page ul, .page ol { padding-inline-start: 22px; margin: 0 0 8px; }
.page a, .back { color: var(--accent); }
.back { font-size: 14px; }
.page-title { margin: 4px 0 18px; }
.page-title h1 { font-size: 26px; line-height: 1.45; font-weight: 800; margin: 0 0 4px; }
.page-title p { color: var(--muted); margin: 0; }
@media (min-width: 720px) { .page-title h1 { font-size: 30px; } }

/* ---------- /status ---------- */
.state { display: flex; align-items: center; gap: 14px; }
.state .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 6px var(--ok-soft); margin-inline: 4px; }
.state.bad .dot { background: var(--danger); box-shadow: 0 0 0 6px var(--danger-soft); }
.state.unknown .dot { background: var(--faint); box-shadow: 0 0 0 6px var(--bg-sunken); }
.state b { font-size: 21px; font-weight: 800; line-height: 1.45; }
.state.bad b { color: var(--danger-ink); }
#down { margin: 12px 0 0; color: var(--ink); }
.checked { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.parts { list-style: none; padding: 0; margin: 0; }
.parts li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.parts li:first-child { border-top: 0; padding-top: 4px; }
.parts .what { display: flex; flex-direction: column; min-width: 0; }
.parts .what > span { font-weight: 700; }
.parts .what small { color: var(--muted); font-size: 13px; }
.parts .chip { display: inline-flex; align-items: center; gap: 6px; }
.parts .chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.incidents { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.incidents li { padding: 10px 0; border-top: 1px solid var(--line); }
.incidents li:first-child { border-top: 0; padding-top: 2px; }
.incidents small { color: var(--muted); }
.status-more { text-align: center; }
@media (min-width: 720px) {
  .status-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 var(--pg-gap); align-items: start; }
}

/* ---------- /help ---------- */
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.help-toc a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700;
}
.help-toc a:hover { border-color: var(--accent); color: var(--accent); }
.steps { counter-reset: step; list-style: none; padding: 0; }
.page .steps { padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-inline-start: 38px; margin-bottom: 12px; }
.steps > li::before {
  content: counter(step, persian);
  position: absolute; inset-inline-start: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
}
.shots { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 14px 0 4px; }
.shots figure { margin: 0; flex: 1 1 220px; max-width: 280px; }
.shots img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
}
.shots figcaption { color: var(--muted); font-size: 13px; text-align: center; margin-top: 6px; }
.tips { list-style: none; padding: 0; margin: 0; }
.page .tips { padding: 0; }
.tips li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.tips li:first-child { border-top: 0; padding-top: 2px; }
.tips .ic {
  flex: none; width: 26px; height: 26px; margin-top: 2px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
}
.kbd {
  display: inline-block; padding: 0 8px; border-radius: 8px; font-weight: 700; font-size: 14px; line-height: 1.7;
  background: var(--accent); color: var(--accent-ink); white-space: nowrap;
}
.kbd.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.report textarea {
  width: 100%; min-height: 110px; resize: vertical; direction: ltr; text-align: left;
  font: 12.5px/1.5 ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
.report .linkrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.report .linkrow .btn { width: auto; }

/* ---------- the join page, a finished class, a bad link (one centred card) ---------- */
.pg-join h2 { font-size: 20px; }
.pg-done { text-align: center; padding-block: 28px 22px; }
.pg-done h1 { font-size: 22px; line-height: 1.5; font-weight: 800; margin: 12px 0 4px; }
.pg-done .hint { margin: 0 auto 18px; max-width: 34ch; }
.pg-done-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}
.pg-done-mark .pg-ic { width: 26px; height: 26px; }
.pg-done-mark .pg-ic svg { stroke-width: 2.2; }
.pg-done.bad .pg-done-mark { background: var(--danger-soft); color: var(--danger-ink); }
.pg-done .btn { max-width: 320px; margin-inline: auto; }

/* ---------- the teacher's attendance at the end ---------- */
.pg-att-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
.pg-att-head .pg-lede { margin: 0; }
.pg-att-head .btn .pg-ic { width: 18px; height: 18px; }
.pg-att { display: flex; flex-direction: column; }
#attendance h2 { display: flex; align-items: center; gap: 8px; }
#attendance h2 .pg-ic { color: var(--accent); }
.pg-attsum { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.pg-attsum:empty { display: none; }
.pg-attsum .chip { font-size: 14px; padding: 3px 12px; }
.pg-attsum .chip.absent { background: var(--bg-sunken); color: var(--muted); }
.pg-att-acts { display: flex; justify-content: flex-start; }
.pg-att-acts .btn { width: auto; }
#attendance .tablewrap { margin: 8px 0 16px; }
table.att { font-size: 15px; }
table.att td:nth-child(n+3), table.att th:nth-child(n+3) { text-align: center; font-variant-numeric: tabular-nums; }
table.att .st { white-space: nowrap; }
table.att .st::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; margin-inline-end: 6px; vertical-align: middle;
}
@container (min-width: 860px) {
  .pg-att { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .pg-att > #attendance { grid-column: 1; grid-row: 1; }
  .pg-att > .fb-after { grid-column: 2; grid-row: 1; }
}
