/* Reader styles. Colours that vary come from data as CSS variables set by
   app.js: --todayc drives the masthead bar and the on-now card, --dayc drives
   the day list and tag (the two-colour rule, spec 6.2). Everything else is a
   pinned light palette. */

:root {
  color-scheme: light dark;
  --ink: #231f20;
  --muted: #6e6a72;
  --paper: #ffffff;
  --rule: #e2e0e4;
  --brand: #672290; /* overridden from organisation.brandColour */
  --free: #66c430; /* the free-time colour, see 6.5 */
  --todayc: #bdbcbc; /* set from data */
  --dayc: #bdbcbc; /* set from data */
  --sans: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

/* Pin the palette even when the device is in dark mode, see 8.3. */
@media (prefers-color-scheme: dark) {
  html, body { background: var(--paper) !important; color: var(--ink) !important; }
}

* { box-sizing: border-box; }
/* The hidden attribute must always win. Class rules like .lock and .next set
   display, which would otherwise beat the UA [hidden] rule and leave a toggled
   element (the lock overlay, the next card) permanently on screen. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--paper); }
body {
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
.wrap { max-width: 540px; margin: 0 auto; padding: 0 18px; }

/* masthead */
header { padding: calc(18px + env(safe-area-inset-top)) 0 0; text-align: center; }
header img { width: 104px; height: auto; display: block; margin: 0 auto 6px; }
header h1 { font-weight: 700; color: var(--brand); font-size: 21px; line-height: 1.15; margin: 6px 0 2px; }
header .dates { font-weight: 300; color: var(--brand); font-size: 15px; letter-spacing: .04em; }
.daybar { height: 8px; margin: 14px -18px 0; background: var(--todayc); transition: background .45s ease; }
.standing { font-size: 12.5px; color: var(--muted); text-align: center; padding: 9px 0 0; }

/* on now */
.now {
  margin-top: 16px; background: var(--todayc); border-radius: 4px;
  padding: 16px 16px 14px; position: relative; overflow: hidden;
  transition: background .45s ease;
}
.now.free { background: var(--free); color: #fff; }
.now.idle { background: #f3f2f4; color: var(--ink); }
.now .eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.now h2 { margin: 4px 0 2px; font-size: 22px; line-height: 1.12; }
.now .when { font-weight: 600; }
.now .where { margin-top: 2px; }
.now .note { margin-top: 6px; font-size: 14px; }
.now .also { margin-top: 10px; font-size: 14px; font-weight: 600; }
.now .bar { height: 4px; background: rgba(0,0,0,.14); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.now .bar > i { display: block; height: 100%; background: rgba(0,0,0,.42); transition: width 1s linear; }
.now .left { margin-top: 6px; font-size: 12.5px; font-weight: 600; opacity: .8; }

/* next */
.next {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; padding: 12px 14px; border: 1px solid var(--rule);
  border-radius: 4px; text-decoration: none; color: inherit;
}
.next .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.next .ttl { font-weight: 600; }
.next .meta { font-size: 13px; color: var(--muted); }
.next .cd { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--brand); }

/* day strip. The horizontal padding leaves room for the selected chip's outline
   so it is not clipped at the ends (notably the first day). scroll-padding keeps
   that room when the strip scrolls a selected chip into view. */
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 16px 4px 8px; margin: 0 -4px; scroll-padding-inline: 4px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; width: 46px; border: 0; border-radius: 6px; padding: 7px 0 5px;
  background: var(--c); color: #23201f; font: inherit; text-align: center; cursor: pointer;
  opacity: .62; transition: opacity .2s;
}
.chip b { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.chip i { font-style: normal; font-size: 17px; font-weight: 700; }
.chip[aria-selected="true"] { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.chip.today::after { content: ""; display: block; width: 5px; height: 5px; border-radius: 50%; background: #23201f; margin: 3px auto 0; }

/* day head */
.dayhead { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.dayhead h2 { font-size: 18px; margin: 0; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--dayc); color: #23201f; }
.jump { margin-top: 8px; background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

/* day list. Each activity is washed in that day's colour so the day reads at a
   glance, matching the printed timetable's coloured blocks. color-mix gives a
   readable tint of the solid day colour; older browsers fall back to the plain
   near-white. */
.list { list-style: none; margin: 10px 0 0; padding: 0; }
.list > li {
  padding: 11px 12px; margin: 8px 0; border-left: 6px solid var(--dayc); border-radius: 4px;
  background: #f4f2f6;
  background: color-mix(in srgb, var(--dayc) 30%, white);
}
.list > li.plain { border-left: 0; background: none; padding: 6px 12px; color: var(--muted); }
.list > li.freeblock {
  border-left-color: var(--free);
  background: rgba(102,196,48,.12);
  background: color-mix(in srgb, var(--free) 26%, white);
}
/* Past sessions wash out to a much lighter tint of the day colour: clearly
   faded against current and future events, but still showing which day they
   belong to (the full-strength left band keeps the day cue). */
.list > li.done {
  background: #f7f6f8;
  background: color-mix(in srgb, var(--dayc) 12%, white);
}
.list > li.done h4, .list > li.done p { color: var(--muted); }
.list > li.on { box-shadow: inset 0 0 0 2px var(--ink); }
.list > li .t { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.list > li h4 { margin: 1px 0 2px; font-size: 15.5px; }
.list > li p { margin: 2px 0; font-size: 13.5px; }
.list > li .stamp { margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--brand); }
.mini { height: 3px; background: rgba(0,0,0,.1); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.mini > i { display: block; height: 100%; background: var(--ink); transition: width 1s linear; }
.classtag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--brand); color: #fff; margin: 6px 0 2px; }
.bul, .opts { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.opts { list-style: none; padding-left: 0; }
.opts li { margin: 4px 0; }
.opts b { display: block; }
.opts span { color: var(--muted); font-size: 12.5px; }
.opts em { display: block; font-style: normal; font-size: 12.5px; }
.pick { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }

/* footer */
footer { margin-top: 22px; font-size: 12px; font-weight: 300; color: var(--muted); line-height: 1.55; }
footer .updated { display: block; margin-top: 6px; opacity: .75; }
footer .credit { display: block; margin-top: 6px; opacity: .6; }

/* Access gate (spec 11.1). A full-screen cover shown until the shared course
   password unlocks the reader. */
.lock {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--paper);
}
.lockbox { width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lockbox img { width: 120px; height: auto; }
.lockbox h1 { margin: 4px 0 0; font-size: 20px; color: var(--brand); }
.lockbox p { margin: 0; color: var(--muted); font-size: 14px; }
.lockbox input {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--paper); color: var(--ink); text-align: center;
}
.lockbox button {
  width: 100%; font: inherit; font-weight: 600; padding: 12px 14px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; cursor: pointer; min-height: 48px;
}
.lockbox button:disabled { opacity: .6; }
.lockerr { color: #b00020; font-size: 14px; }
