/* Learning Watch: shared styling. Base rules come from SafeYT (docs/STYLE.md in the safeyt
   repo); Learning Watch rules are at the end. No web fonts, no network assets. */
/* Colours and paper follow ourschoolboard.org: warm cream paper with a fibre
   texture (img/paper.svg, an SVG filter, no bitmap), brown-black ink, teal accent. */
:root {
  --paper: #fefcf6;
  --paper-img: url("/img/paper.svg");
  --ink: #241d15;                       /* warm ink */
  --ink-2: #6b5f52;                     /* secondary text, 5.9:1 on paper */
  --rule: rgba(132, 111, 83, .22);
  --rule-strong: rgba(132, 111, 83, .45);
  --field: rgba(255, 255, 255, .72);
  --accent: #0f7c72;                    /* teal: primary actions, mark */
  --accent-ink: #ffffff;                /* text on accent */
  --accent-text: #1f5b53;               /* teal used as text/links on paper */
  --good: #2e6a3a;
  --bad: #a8402c;
  --focus: #241d15;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
  --sans: "Avenir Next", Avenir, "Helvetica Neue", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r-1: 2px; --r-2: 3px; --r-3: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1915;
    --paper-img: none;
    --ink: #f1ece4;
    --ink-2: #c4b8aa;
    --rule: rgba(241, 236, 228, .16);
    --rule-strong: rgba(241, 236, 228, .40);
    --field: rgba(255, 255, 255, .05);
    --accent: #3fb3a6;
    --accent-ink: #0e1f1c;
    --accent-text: #7fd3c8;
    --good: #9fd29a;
    --bad: #f2a493;
    --focus: #f1ece4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100vh; position: relative; color: var(--ink);
  font: 15px/1.65 var(--sans); font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image: var(--paper-img);
  background-repeat: repeat;
  background-size: 600px 600px;
  animation: ft-fade 150ms ease-out both;
}
main { position: relative; z-index: 1; }
@keyframes ft-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1 {
  font: 600 27px/1.15 var(--serif); letter-spacing: -.015em; margin: 0 0 6px;
  text-wrap: balance;
}
h2 {
  display: flex; align-items: center; gap: 10px;
  font: 600 12px/1.4 var(--sans); font-variant-caps: all-small-caps; letter-spacing: .09em; font-size: 14px;
  color: var(--ink); margin: 0 0 12px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
p { margin: 0 0 12px; }
.wrap { max-width: 620px; margin: 0 auto; padding: 44px 24px 48px; }
body.popup { width: 380px; }
body.popup .wrap { padding: 22px 20px 22px; }
body.popup h1 { font-size: 22px; }

/* Wordmark replaces the square icon. */
.brand { margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--rule-strong); }
.mark {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px;
  font: 600 15px/1 var(--serif); letter-spacing: -.005em; color: var(--ink);
}
.mark::before { content: ""; width: 7px; height: 7px; background: var(--accent); }
.sub { color: var(--ink-2); font-size: 14px; }

/* Sections are separated by whitespace and rules, not boxes. */
.card { margin: 0 0 30px; padding: 0; }
body.popup .card { margin-bottom: 24px; }

/* Definition grid with hairline dividers. */
.grid { display: grid; grid-template-columns: minmax(96px, auto) 1fr; margin: 0; border-top: 1px solid var(--rule); }
.grid dt, .grid dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.grid dt {
  padding-right: 16px; color: var(--ink); font-weight: 600; font-size: 14px;
  font-variant-caps: all-small-caps; letter-spacing: .06em; line-height: 1.5; padding-top: 9px;
}
.grid dd { overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }

.stats { display: flex; gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat { flex: 1; padding: 10px 0 12px; font-size: 13px; color: var(--ink-2); }
.stat + .stat { padding-left: 18px; border-left: 1px solid var(--rule); }
.stat b { display: block; font: 600 34px/1.1 var(--serif); letter-spacing: -.02em; margin-bottom: 2px; }
.good { color: var(--good); } .bad { color: var(--bad); }

ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
ul.log li:first-child { border-top: 1px solid var(--rule); }
ul.log li.r { color: var(--ink-2); }
ul.log .t { font-weight: 600; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
ul.log .r { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

#how p { font-size: 14px; }
.privacy {
  font-size: 13px; color: var(--ink-2); margin: 8px 0 0; padding: 12px 0 0 14px;
  border-top: 1px solid var(--rule-strong); position: relative;
}
.privacy::before { content: ""; position: absolute; left: 0; top: 20px; width: 5px; height: 5px; background: var(--good); }

textarea, input[type=text], input[type=url], input[type=password] {
  width: 100%; font: 13px/1.5 var(--mono); background: var(--field); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--r-1); padding: 9px 11px; margin-bottom: 4px;
}
textarea:focus, input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 300px; resize: vertical; }

button {
  font: 600 14px/1.2 var(--sans); padding: 10px 16px; border-radius: var(--r-2);
  border: 1px solid var(--rule-strong); background: transparent; color: var(--ink); cursor: pointer;
}
button:hover { border-color: var(--ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 10px 22px; }
button.primary:hover { filter: brightness(1.06); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 12px 16px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.row a { font-size: 14px; font-weight: 600; }
pre {
  margin: 0; padding: 12px 0 0; border-top: 1px solid var(--rule); overflow: auto;
  font: 12px/1.55 var(--mono); color: var(--ink);
}
.msg { font-size: 13px; white-space: pre-wrap; margin-top: 10px; }
.center { text-align: center; }
.warn {
  font-size: 13px; color: var(--bad); margin: 0 0 24px; padding: 10px 0 10px 14px;
  border-left: 3px solid var(--bad);
}

/* Interstitial pages (blocked, verifying): one statement, generous space. */
body.notice .wrap { padding-top: 12vh; max-width: 580px; }
body.notice .brand { border: 0; padding: 0; margin-bottom: 18px; }
body.notice h1 { font-size: clamp(30px, 5vw, 40px); margin-bottom: 18px; }
body.notice #why { font-size: 18px; line-height: 1.55; max-width: 34em; }
body.notice #detail { font-size: 14px; }
body.notice .card { padding-bottom: 26px; border-bottom: 1px solid var(--rule-strong); }

@media (max-width: 480px) {
  .wrap { padding: 28px 16px 36px; }
  .grid { grid-template-columns: 1fr; }
  .grid dt { border-bottom: 0; padding-bottom: 0; }
  .grid dd { padding-top: 0; }
}
body.notice .privacy { border-top: 0; padding-top: 0; margin-top: 18px; }
body.notice .privacy::before { top: 8px; }

/* ---------- Learning Watch ---------- */
input[type=text] { font: 15px/1.4 var(--sans); }
.wrap.wide { max-width: 980px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; gap: 10px; } }
/* The two landing-page boxes share one size; the class code adds the code look. */
input[type=text].big { font: 500 20px/1.3 var(--sans); padding: 12px 14px; }
input[type=text].big.code-in { font-family: var(--mono); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
textarea.paste { min-height: 140px; }
label.field { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.code { font: 600 34px/1.1 var(--mono); letter-spacing: .08em; margin: 0 0 4px; }
.copyline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.copyline input { flex: 1 1 260px; margin: 0; }
.note { font-size: 13px; color: var(--ink-2); }
.err { font-size: 13px; color: var(--bad); margin-top: 8px; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: .06em;
  padding-left: 9px; position: relative; color: var(--ink-2);
}
.tag::before { content: ""; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; background: var(--ink-2); }
.tag.ok { color: var(--good); } .tag.ok::before { background: var(--good); }
.tag.no { color: var(--bad); } .tag.no::before { background: var(--bad); }

/* video and channel lists */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 18px; margin: 0 0 26px; padding: 0; list-style: none; }
.videos button.vid { all: unset; display: block; cursor: pointer; width: 100%; }
.videos button.vid:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.videos img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-3); background: var(--rule); }
.videos .t { font-weight: 600; font-size: 14px; line-height: 1.35; margin-top: 8px; overflow-wrap: anywhere; }
.videos .m { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.chips button { font-weight: 500; font-size: 13px; padding: 7px 12px; }
.chips button[aria-pressed=true] { border-color: var(--ink); background: var(--field); font-weight: 600; }
.searchrow { display: flex; gap: 10px; margin: 0 0 22px; }
.searchrow input { margin: 0; font-family: var(--sans); font-size: 15px; }

/* player */
.player { position: fixed; inset: 0; z-index: 10; background: rgba(12, 8, 6, .82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.player .frame { width: min(1000px, 100%); }
.player .ratio { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .bar { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; color: #f1e9e1; margin-top: 10px; font-size: 14px; }
.player .bar button { color: #f1e9e1; border-color: rgba(241, 233, 225, .5); }

/* teacher tables */
table.items { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 14px; }
table.items th { text-align: left; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: .06em; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule-strong); }
table.items td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
table.items td.c { width: 28px; }
table.items .s { color: var(--ink-2); font-size: 12.5px; }
.scroll { overflow-x: auto; }
details.pack { border-bottom: 1px solid var(--rule); padding: 8px 0; }
details.pack summary { cursor: pointer; font-weight: 600; }
details.pack ul { margin: 8px 0 4px; padding-left: 18px; font-size: 14px; }
footer.foot { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 0 24px 36px; font-size: 13px; color: var(--ink-2); }
footer.foot a { margin-right: 14px; }
@media (max-width: 480px) { footer.foot { padding: 0 16px 28px; } .code { font-size: 28px; } }

/* landing hero */
figure.hero { margin: 0 0 34px; }
/* 16:9 keeps all three faces and the shared earbuds; phones show the whole 3:2 photo. */
figure.hero img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 20%; border-radius: var(--r-3); }
@media (max-width: 600px) { figure.hero img { aspect-ratio: 3 / 2; } }
#mine { margin-top: 40px; }
footer.foot p { margin: 0 0 6px; }
footer.foot .credit { font-size: 12px; }
footer.foot .credit a { margin-right: 0; }

/* ---------- teacher page: setup steps, then the dashboard (after ourschoolboard's start flow) ---------- */
.wrap.tpage { max-width: 860px; }
.tpage .brand { margin-bottom: 26px; }
.ob-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-3); background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-text); flex: none; }
.ob-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.step { margin: 0; padding: 40px 0 6px; border-top: 1px solid var(--rule); }
.step.wz-step, .dash-head + .step:not([hidden]) { border-top: 0; padding-top: 18px; }
.eyebrow { margin: 0 0 6px; font: 600 11.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
h2.step-h { display: block; margin: 0 0 6px; font: 600 25px/1.2 var(--serif); letter-spacing: -.015em; font-variant-caps: normal; color: var(--ink); }
h2.step-h::after { content: none; }
.step-sub { margin: 0 0 20px; color: var(--ink-2); max-width: 62ch; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
button.choice { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; font-weight: 400; background: var(--field); border: 1px solid var(--rule); border-radius: var(--r-3); }
button.choice strong { display: block; font-size: 15px; }
button.choice small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
button.choice[aria-selected=true] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.panel { margin: 0 0 8px; }

.packs-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pack-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--rule); border-radius: var(--r-3); background: var(--field); }
.pack-card.is-added { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.pack-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pack-n { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.pack-names { margin: 0; flex: 1; font-size: 13px; line-height: 1.5; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pack-card button { align-self: flex-start; padding: 7px 14px; }

.library { margin-top: 30px; }
.library h3 { margin: 0 0 10px; font: 600 17px/1.3 var(--serif); }
.lib-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lib-h { margin: 0 0 6px; font-size: 13px; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: .06em; }
.lib-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lib-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.lib-list li.empty { color: var(--ink-2); font-size: 13px; }
.lib-main { flex: 1; min-width: 0; display: grid; }
.lib-main a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-main .s, table.items .s { color: var(--ink-2); font-size: 12.5px; }
.lib-thumb { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-2); background: var(--rule); flex: none; }
button.linkish { border: 0; padding: 4px 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 13px; }
button.linkish:hover { text-decoration: underline; }

.share-card { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; padding: 20px; border: 1px solid var(--rule); border-radius: var(--r-3); background: var(--field); }
.share-card .code { font-size: 38px; margin-bottom: 10px; }
.share-link .copyline { margin-bottom: 6px; }

details.settings { margin: 36px 0 0; padding: 14px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
details.settings summary { cursor: pointer; font-weight: 600; }
details.settings[open] summary { margin-bottom: 14px; }

@media (max-width: 720px) {
  .choices, .lib-cols, .share-card { grid-template-columns: 1fr; }
  .share-card { gap: 16px; }
}

/* ---------- teacher verification ---------- */
a.button {
  display: inline-block; font: 600 14px/1.2 var(--sans); padding: 10px 16px; border-radius: var(--r-2);
  border: 1px solid var(--rule-strong); color: var(--ink); text-decoration: none;
}
a.button:hover { border-color: var(--ink); }
.vcode { font-family: var(--mono); letter-spacing: .04em; white-space: nowrap; }
/* the verification email, shown as an email */
.email-card { border: 1px solid var(--rule-strong); border-radius: var(--r-3); background: var(--field); max-width: 640px; }
.email-head { margin: 0; padding: 4px 18px; border-bottom: 1px solid var(--rule); }
.email-head div { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 8px 0; font-size: 14px; }
.email-head div + div { border-top: 1px solid var(--rule); }
.email-head dt { color: var(--ink-2); font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: .06em; }
.email-head dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
pre.email-body { border: 0; padding: 16px 18px; font: 14px/1.6 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.email-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 0 18px 16px; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 10px 22px; }
.email-note { margin: 12px 0 0; max-width: 62ch; }

/* what happened to each pasted link */
ul.results { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--rule); }
ul.results li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
ul.results .s { display: block; color: var(--ink-2); font-size: 12.5px; overflow-wrap: anywhere; }
@media (max-width: 480px) { ul.results li { grid-template-columns: 1fr; gap: 2px; } }
.vstatus { margin: 0 0 14px; }
.tag + .tag { margin-left: 10px; }
.banner { margin: 0 0 18px; padding: 12px 16px; font-size: 14px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.banner .linkish { padding: 0; font-size: 14px; }

/* the setup steps: one at a time */
.wizard-head { margin: 0 0 6px; }
.wz-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.wz-steps li { padding-top: 8px; border-top: 3px solid var(--rule); font-size: 12.5px; color: var(--ink-2); }
.wz-steps li.done { border-top-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.wz-steps li.current { border-top-color: var(--accent); color: var(--ink); font-weight: 600; }
.wz-nav { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin: 28px 0 0; padding: 18px 0 0; border-top: 1px solid var(--rule); }
.wz-nav .note { flex: 1; margin: 0; }
.wz-nav .primary { margin-left: auto; }
.dash-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.dash-head .banner { margin: 0; align-self: stretch; }
@media (max-width: 480px) { .wz-steps li span { display: none; } }
@media print { .wz-nav, .dash-head .linkish { display: none; } }

/* class page that is not live yet */
.not-live { margin-top: 10px; }
.not-live .lead { font: 500 20px/1.45 var(--serif); max-width: 32em; }

/* the teacher's "Preview student view": a slim bar above the class page */
.preview-bar {
  position: relative; z-index: 2; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; align-items: center;
  padding: 9px 24px; font-size: 13.5px; border-bottom: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--accent) 9%, var(--paper));
}
.preview-bar .tag { margin-left: 6px; }
.preview-bar a { font-weight: 600; }
@media (max-width: 480px) { .preview-bar { padding: 8px 16px; } }

/* the network check (/check) and the IT page (/network) */
.lead { font: 500 20px/1.45 var(--serif); max-width: 32em; }
ul.checks li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: baseline; }
ul.checks .t { font-family: var(--mono); font-size: 13.5px; }
ul.checks .r { grid-column: 1; }
ul.checks .tag { grid-row: 1; grid-column: 2; white-space: nowrap; }
.check-player { max-width: 560px; margin: 0 0 12px; }
.check-player .ratio { position: relative; aspect-ratio: 16 / 9; background: #000; }
.check-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#summary { white-space: pre-wrap; font-size: 13px; }
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li { margin: 0 0 10px; font-size: 14px; }
code { font: 12.5px/1.4 var(--mono); overflow-wrap: anywhere; }
.it table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0 0 14px; }
.it th, .it td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); }
.it th { font-weight: 600; }
.it pre { margin-bottom: 14px; }
.it h3 { margin: 18px 0 8px; font: 600 16px/1.3 var(--serif); }
