/* ExtendedTimetable — the site's own styles. Pages link the design system's
   tokens.css and bundle.css, then this file, then halloween.css (see
   layout.html). Here: the self-hosted fonts (the CSP allows only 'self') and
   the pieces the bundle leaves to the app. */

/* ---------- Fonts (SIL OFL 1.1, see fonts/OFL-*.txt) ---------- */
/* Variable woff2 from @fontsource-variable/onest@5.3.1 and
   @fontsource-variable/jetbrains-mono@5.3.0: Latin and Cyrillic subsets
   (і, ї, є and ґ are in the Cyrillic one). */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/onest-cyrillic-wght-normal.woff2?v=68e5e01d6265") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/onest-latin-wght-normal.woff2?v=052df7453325") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic-wght-normal.woff2?v=d274604c4075") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2?v=18be452724bf") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Schedule: the day strip picks a day in place ---------- */
/* Today is ringed; the selected day is a filled circle, instead of the
   bundle's raised card. Hover only where there is a pointer, so a tapped
   day does not stay grey on phones. */
.day[aria-current="date"], .day:hover { background: none; border-color: transparent; box-shadow: none; }
@media (hover: hover) { .day:hover { background: var(--sunken); color: var(--text); } }
.day .num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; }
.day.is-today .num { box-shadow: inset 0 0 0 1.5px var(--accent); }
.day[aria-current="date"] .wd { color: var(--accent); }
.day[aria-current="date"] .num { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* ---------- Halloween: the graveyard in this sidebar ---------- */
/* halloween.css draws an 84px moonlit graveyard above the sidebar foot and
   hides it in windows under 760px. This sidebar is taller than the
   design's (Members, theme, time zone), so keep the graveyard's room free
   of the nav, and hide it under 800px, where a student's sidebar would
   start to scroll for it. */
@media (min-height: 800.02px) {
  [data-theme^="halloween"] .sidebar .nav { margin-bottom: calc(84px - var(--space-24)); }
}
@media (max-height: 800px) {
  [data-theme^="halloween"] .sidebar-foot::before, [data-theme^="halloween"] .sidebar-foot::after { display: none; }
}

/* On the schedule the phone top bar holds the week arrows: its bats fly
   right after the group code instead of over the arrows, and get smaller
   when a long week label leaves them little room. */
[data-theme^="halloween"] .topbar:has(.week-nav)::after { content: none; }
[data-theme^="halloween"] .topbar:has(.week-nav) .topbar-group::after {
  content: ""; flex: 0 1 auto; width: 46px; min-width: 0; height: 20px;
  background: var(--halloween-violet);
  -webkit-mask: var(--mask-bats) center / contain no-repeat; mask: var(--mask-bats) center / contain no-repeat;
  animation: hw-drift 4s ease-in-out infinite alternate;
}
@media (forced-colors: active) {
  [data-theme^="halloween"] .topbar-group::after { display: none; }
}

/* ---------- Pieces the bundle leaves to the app ---------- */
.skip-link {
  position: absolute; z-index: 50; left: var(--space-8); top: -100px;
  padding: var(--space-8) var(--space-12); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: var(--space-8); }
form.inline { display: inline; margin: 0; }
.visually-hidden, .sidebar .theme-switch .label, .auth .theme-switch .label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Shell */
/* The top bar keeps its height on a page shorter than the screen; the page
   takes the rest. From 768px the sidebar and the page share the first row. */
.app { grid-template-rows: auto 1fr; }
.group-switch .group-code { justify-self: start; }
a.group-code { text-decoration: none; }
a.group-code:hover { color: var(--text); }
button.nav-item { width: 100%; background: none; cursor: pointer; font-family: inherit; text-align: left; }
.sidebar-foot form:not(.inline) { margin: 0; }
.bottom-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.bottom-nav a > span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { cursor: pointer; }

/* The schedule's week arrows in the phone top bar */
.topbar .week-nav .label { font-size: 14px; padding: 0; }

/* Theme switch: a segmented control of form buttons */
.theme-switch .segmented > button { height: 28px; padding: 0 8px; }
.theme-switch .segmented > [aria-pressed="true"] .icon { color: var(--accent); }

/* Time zone switch: a select, applied on change; the button is for no JS */
.tz-switch { display: flex; align-items: center; gap: var(--space-8); min-width: 0; margin: 0; }
.tz-switch .select { width: auto; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.sidebar .tz-switch { flex: 1; justify-content: flex-end; }
/* A select is as wide as its longest option; let it take what is left. */
.sidebar .tz-switch .select { flex: 1; width: 0; min-height: 28px; height: 28px; padding: 0 26px 0 8px; font-size: 13px; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; }
.zone-note { display: flex; align-items: flex-start; gap: var(--space-6); }
.zone-note .icon { width: 14px; height: 14px; margin-top: 2px; }

/* Rows that are whole links (the More page) */
.row-link {
  display: flex; align-items: center; gap: var(--space-12); min-height: 48px; padding: var(--space-12) 0;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.row-link:hover { color: var(--text); }
.row-link > span { flex: 1; min-width: 0; }
.row-link > .icon:first-child { color: var(--text-secondary); }
.row-link > .icon:last-child { width: 16px; height: 16px; color: var(--text-tertiary); }
.settings { display: grid; gap: var(--space-16); }
.setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-8) var(--space-12); }

/* Signed-out pages: a bar with the language and theme, and one column */
.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.auth-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-12);
  padding: var(--space-12) var(--space-16); border-bottom: 1px solid var(--line);
}
.auth-bar .wordmark { padding: 0; }
.auth-main { width: 100%; max-width: 440px; margin: 0 auto; padding: var(--space-32) var(--space-16) var(--space-64); }
@media (min-width: 768px) {
  .auth-bar { padding: var(--space-16) var(--space-40); }
  .auth-main { padding-top: var(--space-64); }
}

/* Utilities */
@media (max-width: 767.98px) { .hide-sm { display: none !important; } }

/* Progress bars are <progress> elements: the CSP allows no inline widths. */
progress.bar {
  -webkit-appearance: none; appearance: none; display: block; width: 100%;
  border: 0; color: var(--hue, var(--accent)); background: var(--sunken);
}
progress.bar::-webkit-progress-bar { background: var(--sunken); border-radius: var(--radius-pill); }
progress.bar::-webkit-progress-value { background: var(--hue, var(--accent)); border-radius: var(--radius-pill); }
progress.bar::-moz-progress-bar { background: var(--hue, var(--accent)); border-radius: var(--radius-pill); }
/* halloween.css stripes the Now card's bar as a <span>; the same for <progress>. */
[data-theme^="halloween"] .now-time progress.bar::-webkit-progress-value { background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--halloween-candy) 8px 16px); }
[data-theme^="halloween"] .now-time progress.bar::-moz-progress-bar { background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--halloween-candy) 8px 16px); }

/* Rows */
/* A long subject name ("Об'єктно-орієнтоване програмування") wraps in a
   row's meta line instead of widening the row's text past its column. */
.rows .main { grid-template-columns: minmax(0, 1fr); }
.rows .meta .subject { white-space: normal; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-8); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-6); }
.class-row .no-link { font-size: 13px; line-height: 22px; color: var(--text-tertiary); white-space: nowrap; }
@media (max-width: 479.98px) {
  .class-row { grid-template-columns: 64px minmax(0, 1fr); }
  .class-row .row-actions { grid-column: 2; justify-content: flex-start; }
  .class-row .row-actions:not(:has(.btn)) { display: none; }
}
.hw-row.no-status { grid-template-columns: minmax(0, 1fr) auto; }
.status-form { margin: 0; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-12); align-items: center; padding: var(--space-12) 0; }
.link-row .main { display: grid; gap: var(--space-4); min-width: 0; }

/* Now card and notes */
.now-body { display: grid; gap: var(--space-8); }
.now-foot .btn-row { justify-content: flex-end; }
@media (max-width: 479.98px) {
  .now-foot .btn-row { width: 100%; }
  .now-foot .btn-row .btn { flex: 1; height: 44px; }
}
.note-head h2 { font-size: 16px; line-height: 24px; font-weight: 600; }
.read-more { font-size: 13px; line-height: 18px; font-weight: 500; justify-self: start; }

/* Schedule: every day on desktop (Week), one at a time in the Day view and
   always on phones. */
.week { display: grid; gap: var(--space-12); }
.week .toolbar { margin: 0; }
.day-card { scroll-margin: var(--space-16); }
.day-card.is-selected { border-color: var(--accent); }
.day-card.is-optional:not(.is-selected) { display: none; }
.view-day .day-card:not(.is-selected) { display: none; }
@media (max-width: 767.98px) {
  .day-card:not(.is-selected) { display: none; }
}

/* [hidden] must win over component display rules (.btn is inline-flex). */
[hidden] { display: none !important; }

/* Pages: a way back above the head */
.back-link { display: inline-flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-8); color: var(--text-secondary); text-decoration: none; font-size: 13px; line-height: 18px; font-weight: 500; }
.back-link:hover { color: var(--text); }
.back-link .icon { width: 16px; height: 16px; }
.page-head .meta.subtitle { margin-top: var(--space-6); }
/* An item's page (an assignment): its row menu stays at the top right,
   beside the title, on phones too. */
.page-head:has(> details.menu) > div:first-child { flex: 1 1 0; min-width: 0; }
.page-head > details.menu { align-self: flex-start; }

/* Homework */
.filters { display: grid; gap: var(--space-8); }
fieldset.chips { border: 0; min-width: 0; }
/* A subject in a chip takes the chip's colour: a selected chip is inverted. */
.chip .subject { color: inherit; }
.row-end { display: flex; align-items: flex-start; gap: var(--space-4); }
.row-end .points { line-height: 22px; }
.row-end details.menu { margin: -4px 0; }
.group-title h2, h2.group-title { margin-top: var(--space-20); }
.card > h2.group-title:first-child, .card > .group-title:first-child { margin-top: 0; }
details.group > summary .icon { width: 14px; height: 14px; transition: none; }
details.group[open] > summary .icon { transform: rotate(180deg); }
.status-segmented { flex-wrap: wrap; }
.grade-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-12); }
.grade-input { display: flex; align-items: center; gap: var(--space-8); }
.grade-input .input { width: 8rem; }

/* Section pages */
.note-head .note-menu { margin-left: auto; }
/* A note with a menu: the badge and title wrap on the left, the menu stays
   at the top right. */
.note-head:has(> .note-menu) { flex-wrap: nowrap; align-items: flex-start; }
.note-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); flex: 1; min-width: 0; }
/* Class links on narrow phones: the subject gets the row, Join goes under it. */
@media (max-width: 479.98px) {
  .page-links .link-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .page-links .link-row .row-end { justify-content: flex-start; }
}
.link-row .row-end { align-items: center; }
.subject-name { display: inline-flex; align-items: center; gap: var(--space-8); }
.subject-name .subject { gap: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: var(--space-6); }
.hue-chips { flex-wrap: wrap; overflow: visible; }

/* Home, sign-in pages, feedback, errors */
.group-cards { display: grid; gap: var(--space-16); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.group-card { display: grid; gap: var(--space-12); justify-items: start; }
.group-card .card-head { width: 100%; margin: 0; }
.auth-card { display: grid; gap: var(--space-20); }
.auth-card h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.page-error .empty h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.form-alert { margin-bottom: var(--space-16); }
li.feedback { display: grid; gap: var(--space-8); padding: var(--space-12) 0; }
.feedback-head { gap: var(--space-8); }
.feedback-author { font-size: 14px; line-height: 20px; }
.feedback-message { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; }
li.feedback.resolved .feedback-message { color: var(--text-secondary); }
/* The group request form: as narrow as the sign-in card when signed in too;
   its honeypot field is off-screen (people never reach it, bots fill it in). */
.page-request .auth-card { max-width: 440px; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.stars { color: var(--warning); letter-spacing: 0.1em; }
/* Running text with links in it (.meta is a flex row, which spaces links out). */
.small-text { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.small-text strong { color: var(--text); font-weight: 500; }

/* Skeleton loading: while htmx loads the next page (#main.htmx-request),
   a skeleton covers the old content. It appears only after 150ms, so fast
   loads never flash; without JavaScript it never shows. */
#main { position: relative; }
#main:focus { outline: none; }
.page-skeleton { display: none; }
#main.htmx-request > .page-skeleton {
  position: absolute; inset: 0; z-index: 5; display: grid; align-content: start; gap: var(--space-16);
  padding: inherit; background: var(--bg); visibility: hidden;
  animation: sk-appear 0s linear 150ms forwards;
}
@keyframes sk-appear { to { visibility: visible; } }
.page-skeleton > * { width: 100%; max-width: var(--content-max); }
.sk { display: block; background: var(--sunken); border-radius: var(--radius-xs); animation: sk-pulse 1.2s ease-in-out infinite alternate; }
@keyframes sk-pulse { from { opacity: 1; } to { opacity: 0.5; } }
.sk-head { display: grid; gap: var(--space-8); margin-bottom: var(--space-8); }
.sk-title { width: 40%; max-width: 240px; height: 28px; }
.sk-subtitle { width: 30%; max-width: 200px; height: 14px; }
.sk-card { display: grid; gap: var(--space-16); padding: var(--space-20); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.sk-heading { width: 30%; max-width: 180px; height: 18px; }
.sk-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-12); align-items: center; }
.sk-dot { width: 22px; height: 22px; border-radius: 50%; }
.sk-lines { display: grid; gap: var(--space-6); }
.sk-line { height: 14px; width: 70%; }
.sk-line.sk-short { width: 40%; height: 12px; }
.sk-tail { width: 48px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* Members, invites and the groups panel */
.claim { align-items: center; flex-wrap: wrap; margin-bottom: var(--space-16); }
.claim > div { flex: 1; min-width: 12rem; }
.claim form { margin: 0; }
.leader-name { display: flex; align-items: center; gap: var(--space-8); }
.leader-name .icon { color: var(--text-secondary); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-12); }
.inline-form .field { flex: 1 1 14rem; }
.invite-link { font-size: 14px; }
.log-empty { padding: 0 var(--space-16) var(--space-16); }
@media (min-width: 768px) { .log-empty { padding: 0 var(--space-20) var(--space-20); } }
.page-join .auth-card h2 { font-size: 18px; line-height: 26px; font-weight: 600; }

/* Subject page */
.subject-card { margin-bottom: var(--space-24); border-top: 3px solid var(--hue, var(--line)); }
.subject-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-12); }
.subject-card-head .subject-chip { margin-bottom: var(--space-8); }
.subject-card h1 { font-size: 22px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.teachers { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-4) var(--space-16); margin: var(--space-12) 0 0; font-size: 14px; line-height: 20px; }
.teachers dt { color: var(--text-tertiary); }
.teachers dd { margin: 0; }
.subject-links { margin-top: var(--space-16); padding-top: var(--space-16); border-top: 1px solid var(--line); }
.subject-hint { margin-top: var(--space-12); }
.subject-tabs .segmented .count { font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); }
.lesson-filter { margin-bottom: var(--space-16); }
a.chip { text-decoration: none; }
@media (min-width: 768px) { .subject-card h1 { font-size: 26px; line-height: 34px; } }
@media (max-width: 480px) { .teachers { grid-template-columns: minmax(0, 1fr); gap: 0; } .teachers dd + dt { margin-top: var(--space-8); } }

/* Recordings: YouTube playlist */
.playlist .card-head { margin-bottom: var(--space-4); }
.playlist .btn .icon { width: 14px; height: 14px; }
.playlist-status { color: var(--text-secondary); font-size: 13px; line-height: 18px; margin-bottom: var(--space-12); overflow-wrap: anywhere; }
.playlist .inline-form .field { flex: 1 1 18rem; min-width: 0; }
.playlist-unmatched { margin-top: var(--space-12); font-size: 13px; line-height: 18px; }
.playlist-unmatched summary { cursor: pointer; color: var(--text-secondary); }
.playlist-unmatched ul { margin: var(--space-8) 0 0; padding-left: var(--space-16); color: var(--text-secondary); overflow-wrap: anywhere; }
.playlist-list { margin-bottom: var(--space-12); }
.playlist-list .badge { white-space: normal; overflow-wrap: anywhere; }
.playlist-list form { margin: 0; }
