/* Fresco: the teacher portal's look since October 2026. Calm white surfaces, one indigo
   for actions, cyan for what is new, green for what works, and Sora + DM Sans.

   It covers the portal's own chrome (menu, mobile bar, sign-in, News), every page that is
   not on a class route, and the Materials pages for browsing (.fresco-page: the index, a
   level, a block). Class routes (src/data/classroomThemes.js: /materials and /tools) carry
   [data-classroom-theme-root] on <main>, which the selectors below leave out, so the class
   itself (.module-workspace-page) and the other classroom views keep their classroom look.

   Loaded last in index.html. Earlier sheets (the kid theme in styles.css and
   no-gradients.css) set colours with !important, so the overrides here need it too. */

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans-latin-variable.woff2") format("woff2");
  font-style: normal;
  /* The portal asks for weights up to 1000 in many places; a variable font clamps to this
     range, so those render as a calm semibold instead of a heavy black. */
  font-weight: 300 650;
  font-display: swap;
}

@font-face {
  font-family: "Sora";
  src: url("/assets/fonts/sora-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 650;
  font-display: swap;
}

/* ---- Tokens ---- */

:root {
  --fresco-ground: #f5f7fb;
  --fresco-surface: #ffffff;
  --fresco-line: #e2e7f0;
  --fresco-ink: #12142b;
  --fresco-muted: #5b6380;
  --fresco-primary: #4326c9;
  --fresco-primary-hover: #3519ad;
  --fresco-primary-soft: #eeeaff;
  --fresco-accent: #12b5e5;
  --fresco-accent-ink: #05394a;
  --fresco-accent-soft: #e3f6fd;
  --fresco-success: #0e7556;
  --fresco-success-soft: #dff4ec;
  --fresco-danger: #b42318;
  --fresco-danger-soft: #fdecea;
  --fresco-warning-soft: #fdf3dc;
  --fresco-warning-ink: #7a4b00;
  --fresco-font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fresco-display: "Sora", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --fresco-radius: 12px;
  --fresco-radius-sm: 10px;
  --fresco-shadow: 0 1px 2px rgba(18, 20, 43, 0.04);
  --fresco-shadow-hover: 0 6px 20px rgba(18, 20, 43, 0.08);
  --fresco-focus: 0 0 0 3px rgba(67, 38, 201, 0.22);
}

/* The old tokens, remapped where Fresco applies, so every component built on them follows. */
:is(.sidebar, .mobile-nav, .sidebar-show-toggle, .auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) {
  --brand-navy: var(--fresco-ink);
  --brand-navy-2: var(--fresco-primary);
  --brand-cyan: var(--fresco-primary);
  --brand-cyan-strong: var(--fresco-primary);
  --brand-cyan-soft: var(--fresco-primary-soft);
  --brand-yellow: var(--fresco-accent);
  --brand-yellow-soft: var(--fresco-primary-soft);
  --accent-green: var(--fresco-success);
  --accent-green-soft: var(--fresco-success-soft);
  --accent-purple: var(--fresco-primary);
  --accent-purple-soft: var(--fresco-primary-soft);
  --accent-blue: var(--fresco-primary);
  --accent-blue-soft: var(--fresco-primary-soft);
  --accent-coral: #e5484d;
  --accent-coral-soft: var(--fresco-danger-soft);
  --accent-orange: #e8890c;
  --accent-orange-soft: var(--fresco-warning-soft);
  --page-bg: var(--fresco-ground);
  --surface: var(--fresco-surface);
  --surface-soft: var(--fresco-ground);
  --text: var(--fresco-ink);
  --muted: var(--fresco-muted);
  --line: var(--fresco-line);
  --panel-line: var(--fresco-line);
  --shadow-panel: var(--fresco-shadow);
  --shadow-card: var(--fresco-shadow);
  --shadow-hover: var(--fresco-shadow-hover);
  --radius-panel: 16px;
  --radius-card: var(--fresco-radius);
  --radius-control: var(--fresco-radius-sm);
  font-family: var(--fresco-font);
  font-synthesis: none;
  color: var(--fresco-ink);
}

/* Every page has the same calm ground; the kid theme painted the body with colour washes. */
html,
body {
  background-color: var(--fresco-ground) !important;
}

body::before {
  display: none !important;
}

/* ---- Menu ---- */

.sidebar {
  border-right: 1px solid var(--fresco-line);
  padding: 20px 16px;
  background: var(--fresco-surface) !important;
  color: var(--fresco-muted);
  box-shadow: none !important;
}

.sidebar::before {
  display: none;
}

.sidebar .brand,
.sidebar .teacher-profile {
  box-shadow: none !important;
}

.sidebar .brand {
  margin-bottom: 18px;
  border: 1px solid var(--fresco-line);
  border-radius: var(--fresco-radius);
  padding: 10px 12px;
  background-color: var(--fresco-ground) !important;
}

.sidebar .brand-logo {
  max-height: 64px;
  filter: none;
}

.sidebar .nav-list {
  gap: 2px;
}

.sidebar .nav-link {
  min-height: 44px;
  border: 0;
  border-radius: var(--fresco-radius-sm);
  padding: 0 10px;
  color: var(--fresco-muted);
  font-weight: 500;
  transform: none !important;
}

.sidebar .nav-link:hover {
  background: var(--fresco-ground);
  color: var(--fresco-ink);
}

.sidebar .nav-link[aria-current="page"] {
  border: 0 !important;
  background-color: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
  box-shadow: none !important;
  font-weight: 600;
}

.sidebar .nav-icon,
.mobile-nav .nav-icon,
.sidebar .nav-link[aria-current="page"] .nav-icon,
.mobile-nav-link[aria-current="page"] .nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: none !important;
  color: inherit !important;
  box-shadow: none !important;
}

.sidebar .nav-icon .ui-icon,
.mobile-nav .nav-icon .ui-icon {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.sidebar .teacher-profile {
  border: 1px solid var(--fresco-line);
  border-radius: var(--fresco-radius);
  padding: 10px;
  background-color: var(--fresco-ground) !important;
  color: var(--fresco-ink);
}

.sidebar .profile-name {
  color: var(--fresco-ink);
  font-weight: 600;
}

.sidebar .profile-role {
  color: var(--fresco-muted);
  font-weight: 400;
}

.sidebar .avatar {
  border-radius: 50%;
  background: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
}

.sidebar .profile-sign-out,
.sidebar-collapse-toggle,
.sidebar-show-toggle {
  border: 1px solid var(--fresco-line) !important;
  background-color: var(--fresco-surface) !important;
  color: var(--fresco-muted) !important;
  box-shadow: none !important;
}

.sidebar .profile-sign-out:hover,
.sidebar-collapse-toggle:hover,
.sidebar-show-toggle:hover {
  background-color: var(--fresco-ground) !important;
  color: var(--fresco-ink) !important;
}

/* The count of new items next to News and Teacher Space. */
.nav-news-count {
  border: 0;
  background: var(--fresco-accent);
  color: var(--fresco-accent-ink);
  font-weight: 600;
  line-height: 22px;
}

/* ---- Mobile bar ---- */

.mobile-nav {
  border: 1px solid var(--fresco-line);
  background-color: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 8px 28px rgba(18, 20, 43, 0.1);
}

.mobile-nav-link {
  border-radius: var(--fresco-radius-sm);
  color: var(--fresco-muted);
  font-weight: 500;
}

.mobile-nav-link[aria-current="page"] {
  background-color: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
  box-shadow: none !important;
}

/* ---- Type ---- */

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(h1, h2, h3) {
  color: var(--fresco-ink);
  font-family: var(--fresco-display);
  font-weight: 600;
  letter-spacing: -0.015em;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) h1 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  line-height: 1.15;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .eyebrow {
  color: var(--fresco-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ---- Pages ---- */

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .page-header {
  border: 1px solid var(--fresco-line);
  border-radius: 16px;
  padding: 24px 28px;
  background-color: var(--fresco-surface) !important;
  box-shadow: var(--fresco-shadow);
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .page-header::before {
  display: none !important;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .page-header p {
  color: var(--fresco-muted);
  font-weight: 400;
}

/* Cards and panels: white, a thin line, a whisper of shadow. */
:is(.main-area:not([data-classroom-theme-root]), .fresco-page) :is(
  .empty-state, .student-card, .assignment-summary-card, .assignment-dashboard-item,
  .student-assignment-row, .student-progress-card, .student-level-module-card,
  .student-level-block-progress, .assignment-history-item, .teacher-student-link-card,
  .students-panel, .assignment-dashboard-card, .assignment-detail-card, .assignment-detail-hero,
  .student-search-panel, .link-manager-form, .link-list-card, .search-panel,
  .assignment-dashboard-controls, .my-hours-card, .tool-card, .resource-card
) {
  border: 1px solid var(--fresco-line) !important;
  border-radius: var(--fresco-radius) !important;
  background-color: var(--fresco-surface) !important;
  box-shadow: var(--fresco-shadow) !important;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) :is(
  .student-card, .assignment-summary-card, .assignment-dashboard-item,
  .student-level-module-card, .student-level-block-progress, .tool-card
)::before {
  display: none !important;
}

/* ---- Controls ---- */

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(.button, .back-link, .clear-search, .filter-chip) {
  min-height: 42px;
  border-radius: var(--fresco-radius-sm);
  padding: 0 16px;
  font-weight: 600;
  box-shadow: none !important;
  transform: none !important;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(.button.primary, .assignment-form button[type="submit"]) {
  border-color: var(--fresco-primary) !important;
  background-color: var(--fresco-primary) !important;
  color: #fff !important;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(.button.primary, .assignment-form button[type="submit"]):hover {
  background-color: var(--fresco-primary-hover) !important;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(.button.secondary, .button.ghost, .back-link, .clear-search, .filter-chip) {
  border: 1px solid var(--fresco-line) !important;
  background-color: var(--fresco-surface) !important;
  color: var(--fresco-ink) !important;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(.button.secondary, .button.ghost, .back-link, .clear-search, .filter-chip):hover {
  border-color: #c9d1e1 !important;
  background-color: var(--fresco-ground) !important;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .filter-chip.is-active {
  border-color: var(--fresco-ink) !important;
  background-color: var(--fresco-ink) !important;
  color: #fff !important;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) .button.danger {
  border: 1px solid #f3c5c0 !important;
  background-color: var(--fresco-danger-soft) !important;
  color: var(--fresco-danger) !important;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: var(--fresco-line);
  border-radius: var(--fresco-radius-sm);
  font-family: inherit;
  font-weight: 400;
}

:is(.auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(input, select, textarea):focus {
  border-color: var(--fresco-primary);
  outline: none;
  box-shadow: var(--fresco-focus);
}

:is(.sidebar, .mobile-nav, .auth-shell, .pg-layer, .pg-panel, .ts-raffle-dialog, .main-area:not([data-classroom-theme-root]), .fresco-page) :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--fresco-primary);
  outline-offset: 2px;
}

/* Status pills: quiet tints instead of saturated badges. */
:is(.main-area:not([data-classroom-theme-root]), .fresco-page) :is(
  .status-badge, .header-meta, .assignment-dashboard-count, .link-count, .tool-status,
  .review-badge, .student-sync-badge, .assignment-history-status, .assignment-due-date,
  .resource-chip, .assignment-inline-status, .link-status
) {
  border-radius: 999px;
  font-weight: 600;
}

:is(.main-area:not([data-classroom-theme-root]), .fresco-page) :is(.student-avatar, .assignment-student-avatar, .link-person-icon, .empty-icon, .assignment-summary-icon, .tool-icon, .resource-icon) {
  border-radius: var(--fresco-radius-sm);
  background-color: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
}

/* ---- Sign-in ---- */

.auth-shell {
  background-color: var(--fresco-ground) !important;
}

.auth-card {
  border: 1px solid var(--fresco-line) !important;
  border-radius: 16px !important;
  background-color: var(--fresco-surface) !important;
  box-shadow: 0 12px 40px rgba(18, 20, 43, 0.08) !important;
}

.auth-card::before {
  display: none !important;
}

/* ---- News and the portal guide ---- */

.pg-panel,
.pg-card {
  border: 1px solid var(--fresco-line);
  border-radius: 16px;
  background-color: var(--fresco-surface);
  box-shadow: 0 16px 48px rgba(18, 20, 43, 0.14);
}

/* ---- Materials: levels and blocks ---- */

/* Each block keeps its colour, as a quiet accent instead of a solid tile and a top bar. */
.fresco-page .block-card {
  border: 1px solid var(--fresco-line) !important;
  border-radius: var(--fresco-radius) !important;
  background-color: var(--fresco-surface) !important;
  box-shadow: var(--fresco-shadow) !important;
  transform: none !important;
}

.fresco-page .block-card:hover {
  border-color: #c9d1e1 !important;
  box-shadow: var(--fresco-shadow-hover) !important;
}

.fresco-page .block-card::before,
.fresco-page .block-card::after,
.fresco-page .block-accent {
  display: none !important;
}

.fresco-page :is(.block-icon, .level-icon) {
  border-radius: var(--fresco-radius-sm) !important;
  background-color: color-mix(in srgb, var(--block-main, var(--level-main, var(--fresco-primary))) 14%, #fff) !important;
  color: color-mix(in srgb, var(--block-main, var(--level-main, var(--fresco-primary))) 80%, #000) !important;
  box-shadow: none !important;
}

.fresco-page :is(.block-number, .class-tag, .module-number) {
  border-radius: 999px;
  font-weight: 600;
  box-shadow: none !important;
}

.fresco-page :is(.arrow, .block-action .arrow) {
  box-shadow: none !important;
  transform: none !important;
}

.fresco-page .materials-view-tab-icon {
  border-radius: var(--fresco-radius-sm) !important;
  background-color: var(--fresco-primary-soft) !important;
  color: var(--fresco-primary) !important;
  box-shadow: none !important;
}

.fresco-page .materials-view-tab.is-active {
  border-color: var(--fresco-primary) !important;
  background-color: var(--fresco-primary-soft) !important;
  box-shadow: none !important;
}
