/* The app's base stylesheet (spec 04). Colours and fonts come only from
   the custom properties that /static/theme.css sets per installation. */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--body-font);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--heading-font);
  color: var(--link);
  line-height: 1.2;
  margin: 1.5rem 0 0.75rem;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

/* Keyboard focus is always visible: the ring sits on the page, so it takes
   the text colour (checked against the background at startup), and white
   in the header (checked against the header colour). WCAG 1.4.11. */
:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}
.site-header :focus-visible { outline-color: var(--header-text); }

/* ---- Header ---------------------------------------------------------- */

.site-header {
  background: var(--header);
  color: var(--header-text);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.site-header a { color: var(--header-text); }
.site-name {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 1.35rem;
  margin-right: auto;
}
.site-header form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.site-header label { color: var(--header-text); }

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
}

/* ---- The staff menu (spec 04 §5) -------------------------------------- */

/* A side bar from 48rem up; below, the same menu folds into a disclosure
   between the header and the page. The one not shown is display: none, so
   assistive technology meets one menu at a time. The side bar sits on the
   page background, so its links keep the checked link contrast. */
.side-bar nav ul, .menu-fold nav ul { list-style: none; margin: 0; padding: 0; }
.side-bar nav a, .menu-fold nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-left: 4px solid transparent;
  text-decoration: none;
}
/* Hover and the current page sit on the accent tint, computed at startup
   (theme.css) and checked against the link colour; the hover is half way
   from it to the background, so it reads too. */
.side-bar nav a:hover, .menu-fold nav a:hover {
  text-decoration: underline;
  background: color-mix(in srgb, var(--accent-tint) 50%, var(--background));
}
/* The current page: bold and a bar, not colour alone (WCAG 1.4.1). */
.side-bar nav a[aria-current="page"], .menu-fold nav a[aria-current="page"] {
  font-weight: 700;
  border-left-color: var(--accent);
  background: var(--accent-tint);
}

.with-side-bar {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 0 1.5rem;
  max-width: 88rem;
  margin: 0 auto;
}
.with-side-bar main { max-width: 72rem; margin: 0; width: 100%; }
.side-bar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.25rem 0 1.5rem;
  border-right: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
}
.menu-fold { display: none; }

@media (max-width: 47.99rem) {
  .with-side-bar { display: block; }
  .side-bar { display: none; }
  .menu-fold {
    display: block;
    border-bottom: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  }
  .menu-fold summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--link);
    padding: 0.6rem 1.25rem;
  }
  .menu-fold nav { padding: 0 0.5rem 0.75rem; }
}

/* ---- Forms ----------------------------------------------------------- */

label { display: inline-block; margin: 0.25rem 0; }

input[type="text"], input[type="password"], input[type="date"],
input[type="file"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--background);
  border: 1px solid color-mix(in srgb, var(--text) 45%, transparent);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
  max-width: 100%;
}
textarea { width: 100%; min-height: 6rem; display: block; }
main input[type="text"], main input[type="password"] { min-width: 16rem; }

fieldset {
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
  margin: 1rem 0;
}
legend { font-weight: 600; padding: 0 0.35rem; }

button {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
}
button:hover { filter: brightness(0.95); }
.site-header button {
  padding: 0.3rem 0.9rem;
}

main form { margin: 0.75rem 0; }

/* ---- Content --------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
}
th { color: var(--link); font-weight: 600; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 12%, var(--background)); }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; }
dt { font-weight: 600; }
dd { margin: 0; }

code {
  font-size: 0.9em;
  background: color-mix(in srgb, var(--text) 8%, var(--background));
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

section { margin: 1rem 0; }

/* The enrolment QR code (spec 05): always black on white, whatever the
   theme, since scanners need that contrast. */
.qr { margin: 1rem 0; }
.qr svg {
  display: block;
  width: 14rem;
  height: 14rem;
  background: #FFFFFF;
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 6px;
}

[role="alert"] {
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--background));
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
}
[role="status"] {
  border-left: 4px solid var(--link);
  padding: 0.4rem 0.9rem;
}

/* ---- Small screens ---------------------------------------------------- */

@media (max-width: 40rem) {
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 0.5rem; }
  main input[type="text"], main input[type="password"] { min-width: 0; width: 100%; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  td { border: 0; padding: 0.15rem 0; }
  tr { border-bottom: 1px solid color-mix(in srgb, var(--text) 18%, transparent); padding: 0.5rem 0; }
}

/* ---- The printable destruction log (spec 10 R9) ----------------------- */

.print-page main { max-width: none; }
@media print {
  .no-print { display: none; }
  body.print-page { background: #FFFFFF; color: #000000; }
  .print-page table { font-size: 9pt; }
  .print-page tr { break-inside: avoid; }
}

/* ---- Attendance exports' print views (spec 11 R8) -------------------- */

.export-logo { max-height: 60px; max-width: 100%; }
.print-page table.signature td { min-width: 12em; height: 2.5em; }

/* ---- The occupancy notification's two totals (slice 12c) --------------- */

.totals { font-size: 1.5rem; }

/* ---- Who qualifies (spec 15) ----------------------------------------- */

.wq-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 70%, var(--background));
  margin: 0.5rem 0 0;
}
.wq-layers { margin: 1rem 0; }
.wq-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--link) 45%, transparent);
  color: var(--link);
}
.wq-tag-zakon { background: color-mix(in srgb, var(--link) 12%, var(--background)); }
.wq-tag-prispevek { background: color-mix(in srgb, var(--text) 8%, var(--background)); color: var(--text); }
.wq-tag-opz { background: color-mix(in srgb, var(--accent) 22%, var(--background)); color: var(--text); }
.wq-tag-awaiting { border-style: dashed; background: var(--background); }
.wq-index ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.wq-index a {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 999px;
  text-decoration: none;
}
.wq-section {
  border-top: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  padding-top: 0.5rem;
  margin-top: 2rem;
}
.wq-callout {
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--background));
  padding: 0.75rem 1rem;
  max-width: 78ch;
}
.wq-table { overflow-x: auto; }
.wq-table table { min-width: 36rem; }
.wq-table small { display: block; color: color-mix(in srgb, var(--text) 70%, var(--background)); }
.wq-limb { font-weight: 600; white-space: nowrap; }
.wq-mark { text-align: center; white-space: nowrap; }
.wq-mark-yes { font-weight: 600; }
.wq-row {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 0.25rem 1.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
}
.wq-row h3 { margin: 0; font-family: var(--body-font); color: var(--text); font-size: 1rem; }
.wq-row p, .wq-row ul { max-width: 68ch; }
.wq-tags { margin: 0.35rem 0 0; }
.wq-note { font-style: italic; }
.wq-figures { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.wq-figures li {
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
}
.wq-figures b { font-size: 1.2rem; margin-right: 0.3rem; color: var(--link); }
.wq-cite { font-size: 0.8rem; color: color-mix(in srgb, var(--text) 70%, var(--background)); }
.wq-footer { margin-top: 2rem; font-size: 0.9rem; }
@media (max-width: 40rem) {
  .wq-row { grid-template-columns: minmax(0, 1fr); }
}
/* The calendar (17a). */
.calendar-month { overflow-x: auto; }
.calendar-month table { min-width: 42rem; table-layout: fixed; width: 100%; }
.calendar-month td { vertical-align: top; padding: 0.3rem; font-size: 0.85rem; }
.calendar-month ul, .calendar-agenda ul { margin: 0.2rem 0 0; padding-left: 1rem; }
.calendar-number { margin: 0; font-weight: 600; }
.calendar-state { margin: 0; color: color-mix(in srgb, var(--text) 70%, var(--background)); }
.calendar-closed, .calendar-holiday, .calendar-blank { background: color-mix(in srgb, var(--text) 6%, var(--background)); }
.calendar-interrupted { background: color-mix(in srgb, var(--accent) 14%, var(--background)); }
.calendar-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.calendar-agenda dt { font-weight: 600; margin-top: 0.75rem; }
.calendar-agenda dd { margin-left: 0; }
