/* Steinscan -- one small stylesheet for all three pages. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f2f0ec;
  color: #26221c;
}

/* -- header bar ---------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.8em;
  padding: 0.6em 1em;
  background: #26221c; color: #f2f0ec;
  font-size: 0.95em;
}
.bar .spacer { flex: 1; }
.bar .brand { font-weight: 700; letter-spacing: 0.04em; }
.bar .count, .bar .who { opacity: 0.7; }
.bar a.quiet {
  color: #f2f0ec; opacity: 0.8; text-decoration: none;
}
.bar a.quiet:hover { opacity: 1; text-decoration: underline; }
.doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-nav a { font-size: 1.2em; padding: 0 0.2em; }
#page-indicator { opacity: 0.7; white-space: nowrap; }

/* -- login ---------------------------------------------------------------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: #fff; border-radius: 10px; padding: 2em 2.2em;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  width: min(20em, 90vw);
}
.login-card h1 { margin: 0; font-size: 1.5em; text-align: center; }
.login-card .sub { margin: 0.2em 0 1.2em; opacity: 0.6; text-align: center; }
.login-card label { display: block; margin: 0.8em 0; font-size: 0.9em; }
.login-card input {
  display: block; width: 100%; margin-top: 0.3em;
  padding: 0.55em 0.7em; font-size: 1em;
  border: 1px solid #c9c2b6; border-radius: 6px;
}
.login-card button {
  width: 100%; margin-top: 1em; padding: 0.65em;
  font-size: 1em; font-weight: 600;
  background: #26221c; color: #f2f0ec;
  border: none; border-radius: 6px; cursor: pointer;
}
.error { color: #a52a1d; }
.page-error { margin: 2em; text-align: center; opacity: 0.8; }

/* -- the list ------------------------------------------------------------- */
.doclist { max-width: 46em; margin: 1em auto; padding: 0 0.6em; }
.doc {
  display: flex; align-items: baseline; gap: 0.8em; flex-wrap: wrap;
  padding: 0.7em 0.9em; margin-bottom: 0.4em;
  background: #fff; border-radius: 8px;
  text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.doc:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.14); }
.doc.selected { background: #8d93dc; }
.doc.selected .doc-name { opacity: 0.7; }
.doc-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.doc-name { opacity: 0.45; font-size: 0.8em; }
.doc-label { margin-left: auto; }
.chip {
  display: inline-block; padding: 0.1em 0.55em; margin-left: 0.25em;
  background: #b8d4f6; color: #1d3a5f;
  border-radius: 999px; font-size: 0.8em; white-space: nowrap;
}
.chip.none { background: #e8e4dc; color: #6d675c; }

/* Pacman crumbs: in a label hierarchy the chips bite into each other --
   every chip but the last ends in a > point, and the chip after it starts
   with a matching > notch. Falls back to plain pills where :has()/clip-path
   are unsupported. The 7px point sits in the notch with a 3px seam of page
   background (margin -4px), which is what makes the interlock readable
   between two same-coloured chips. */
.chip:has(+ .chip) {          /* not last: rounded left, pointed right */
  border-radius: 999px 0 0 999px;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 50%,
                     calc(100% - 7px) 100%, 0 100%);
  padding-right: 0.9em;
}
.chip + .chip {               /* not first: notched left, rounded right */
  border-radius: 0 999px 999px 0;
  clip-path: polygon(7px 50%, 0 0, 100% 0, 100% 100%, 0 100%);
  padding-left: 0.9em;
  margin-left: -4px;
}
.chip + .chip:has(+ .chip) {  /* middle: notched left AND pointed right */
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 50%,
                     calc(100% - 7px) 100%, 0 100%, 7px 50%);
}

/* -- the activity calendar ------------------------------------------------ */
.calendar {
  background: #fff; border-radius: 8px; padding: 0.9em;
  margin-bottom: 0.8em; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cal-scroll {
  overflow-x: auto;
  /* centre the grid in the card; "safe" keeps the left edge reachable
     when a narrow phone has to scroll instead */
  display: flex; flex-direction: column;
  align-items: center; align-items: safe center;
}
.cal-months {
  display: flex; font-size: 0.7em; opacity: 0.6; height: 1.4em;
  margin-left: 22px;              /* clears the day-name axis below */
}
.cal-months span { flex: none; overflow: hidden; white-space: nowrap; }
.cal-body { display: flex; }
.cal-daylabels {
  display: grid; grid-template-rows: repeat(7, 11px); gap: 3px;
  width: 22px; font-size: 0.6em; opacity: 0.6;
}
.cal-daylabels span { line-height: 11px; }
.cal-grid { display: flex; gap: 3px; }
.cal-week { display: grid; grid-template-rows: repeat(7, 11px); gap: 3px; }
.cal-day {
  width: 11px; height: 11px; border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(27,31,35,0.08);
}
.cal-day.future { background: #b4b4b4; box-shadow: none; }
.cal-day.empty { box-shadow: none; background: transparent; }
.cal-header {
  /* the same visual weight as the dates in the list below */
  margin: 0 0 0.6em; text-align: center;
  font-size: 1em; font-weight: 600;
}
.cal-caption {
  margin: 0.6em 0 0; text-align: center; line-height: 1.5;
  font-size: 0.75em; opacity: 0.6; letter-spacing: 0.04em;
}
.cal-note { margin: 0.6em 0 0; font-size: 0.75em; opacity: 0.55; }

/* -- the keyboard bar ------------------------------------------------------ */
.keybar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 28px;
  display: flex; align-items: center; justify-content: center; gap: 1.8em;
  background: #26221c; color: #f2f0ec; font-size: 0.78em;
  white-space: nowrap; overflow: hidden;
}
.keybar kbd {
  font-family: inherit; font-size: 0.9em;
  background: #45402f; border-radius: 4px; padding: 0.05em 0.45em;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.5);
}
.doclist { padding-bottom: 40px; }   /* the last row must clear the bar */
/* Keys mean nothing on a phone; give the space back. */
@media (max-width: 700px), (pointer: coarse) {
  .keybar { display: none; }
  .viewer-body #viewer { height: calc(100vh - 2.6em); }
}

/* -- the viewer ----------------------------------------------------------- */
.viewer-body { background: #8f8a80; }
#viewer {
  height: calc(100vh - 2.6em - 28px);   /* header bar and key bar */
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}
#page-container {
  max-width: 60em; margin: 0.6em auto; padding: 0 0.4em;
}
/* pdfchat's visibility trick: a raw .pf stays invisible until it has been
   measured and wrapped, so the reader never sees an unscaled page jump. */
#page-container > .pf, #page-container > .pf * { visibility: hidden; }
#page-container .page-wrapper { margin-bottom: 0.35em; overflow: hidden; }
#page-container .page-wrapper .pf,
#page-container .page-wrapper .pf * { visibility: visible; }
#page-container .page-wrapper .pf { box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

/* Not ours: a browser extension injects an "Annotate" button into the
   viewer. Hiding it here beats asking every family member to configure
   their extensions. */
.rm-btn-annotate-pdf { display: none !important; }

#loading { text-align: center; padding-top: 18vh; color: #f2f0ec; }
#loading .spin {
  width: 2.2em; height: 2.2em; margin: 0 auto 1em;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #f2f0ec; border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
#loading button {
  margin-top: 0.8em; padding: 0.5em 1em; font-size: 1em;
  border: none; border-radius: 6px; cursor: pointer;
}
@keyframes spin { to { transform: rotate(360deg); } }
