/* Brand theme: same font and colour tokens as the public website (src/styles/design-system.css). */
@font-face {
  font-family: "Funnel Display";
  src: url("/fonts/FunnelDisplay-Variable-latin.woff2") format("woff2-variations");
  font-weight: 300 800;
  font-display: swap;
  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: "Funnel Display";
  src: url("/fonts/FunnelDisplay-Variable-latin-ext.woff2") format("woff2-variations");
  font-weight: 300 800;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C0,
    U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --blue-50: #f1f8ff;
  --blue-100: #e0effd;
  --blue-200: #c3dcf6;
  --blue-300: #9ac2e9;
  --blue-500: #4685bf;
  --blue-600: #2b6da6;
  --blue-700: #185689;
  --blue-800: #0b426d;
  --blue-950: #041c31;
  --ice-50: #f6fbfe;
  --ice-100: #e8f3f9;
  --ice-200: #d8e7f0;
  --ice-300: #c7d9e5;
  --ice-700: #4f6775;
  --neutral-300: #d0d5da;
  --neutral-500: #6b727a;
  --neutral-600: #4f565e;
  --neutral-800: #242c35;
  --neutral-900: #101922;
  --white: #fbfcfd;
  --black: #0a1520;
  --danger: #b3261e;
  --danger-strong: #a12e27;
  --danger-bg: #fdecea;
}
:root {
  font-family: "Funnel Display", ui-sans-serif, system-ui, sans-serif;
  color: var(--neutral-800);
  background: var(--ice-50);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  outline-offset: 4px;
}
button,
.primary {
  cursor: pointer;
  border: 1px solid var(--ice-200);
  border-radius: 999px;
  padding: 11px 20px;
  background: var(--white);
  color: var(--blue-700);
  text-decoration: none;
  font-weight: 600;
}
button:hover {
  background: var(--ice-100);
}
.primary {
  background: var(--blue-700);
  color: var(--white);
  border-color: var(--blue-700);
  display: inline-block;
}
.primary:hover {
  background: var(--blue-800);
  border-color: var(--blue-800);
}
h1,
h2,
h3 {
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--neutral-900);
}
h1 {
  font-weight: 300;
}
h1 {
  font-size: 36px;
  margin: 5px 0 24px;
}
h2 {
  font-size: 24px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--ice-700);
}
.brand {
  font-weight: 600;
  font-size: 22px;
  display: flex;
  gap: 13px;
  align-items: center;
}
.brand span {
  font-size: 15px;
  letter-spacing: -0.02em;
}
.login {
  max-width: 630px;
  margin: 12vh auto;
  padding: 40px;
}
.login h1 {
  font-size: 60px;
  line-height: 1.1;
  margin-top: 30px;
}
.login p {
  line-height: 1.7;
}
.login .primary {
  margin: 24px 0;
}
.muted {
  color: var(--ice-700);
  font-size: 13px;
}
aside {
  width: 240px;
  position: fixed;
  height: 100vh;
  padding: 32px 22px;
  background: var(--white);
  border-right: 1px solid var(--ice-200);
  display: flex;
  flex-direction: column;
  gap: 25px;
}
nav {
  display: grid;
  gap: 6px;
}
nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ice-700);
}
nav button.active {
  color: var(--blue-700);
  background: var(--ice-200);
}
.site-link {
  margin-top: auto;
  color: var(--blue-700);
  font-size: 13px;
}
main {
  margin-left: 240px;
  padding: 45px;
  max-width: 1450px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
#identity {
  font-size: 12px;
  color: var(--ice-700);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.card {
  background: var(--white);
  border: 1px solid var(--ice-200);
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 18px;
}
.card strong {
  font-size: 32px;
  display: block;
  margin: 16px 0;
}
.toolbar,
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar {
  justify-content: space-between;
  margin: 18px 0;
}
.row {
  justify-content: space-between;
  border-bottom: 1px solid var(--ice-100);
  padding: 16px 0;
}
.badge {
  font-size: 11px;
  background: var(--ice-200);
  color: var(--blue-700);
  padding: 5px 9px;
  border-radius: 100px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 18px 0 8px;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  border: 1px solid var(--blue-300);
  background: var(--white);
  border-radius: 8px;
  padding: 12px;
  color: var(--neutral-800);
}
textarea {
  min-height: 110px;
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
  display: inline-block;
  margin-right: 8px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.error {
  color: var(--danger-strong);
}
#notice {
  min-height: 20px;
}
.body-field {
  min-height: 320px;
}
.empty {
  padding: 35px;
  text-align: center;
  color: var(--ice-700);
}
details {
  padding: 14px 0;
  border-bottom: 1px solid var(--ice-200);
}
summary {
  cursor: pointer;
  font-weight: 600;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
td,
th {
  text-align: left;
  padding: 13px;
  border-bottom: 1px solid var(--ice-200);
  word-break: break-word;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
[hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  aside {
    position: static;
    width: auto;
    height: auto;
    padding: 20px;
  }
  nav {
    grid-template-columns: repeat(3, 1fr);
  }
  main {
    margin: 0;
    padding: 22px;
  }
  header {
    display: block;
  }
  .login h1 {
    font-size: 42px;
  }
  .login {
    margin: 4vh auto;
  }
  table {
    font-size: 11px;
  }
}

/* Phase 3 additions: filters, danger action, version history, reorder buttons */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.toolbar input[type="search"] {
  flex: 1 1 260px;
}
.toolbar select,
.toolbar input {
  min-height: 40px;
}
a.button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid currentColor;
  text-decoration: none;
}
button.danger {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
  margin-top: 12px;
}
button.danger:hover {
  background: var(--danger-bg);
}
details.card summary {
  cursor: pointer;
  font-weight: 500;
}
details.card .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgb(0 0 0 / 0.06);
}
.card.row button[aria-label^="Move"] {
  min-width: 36px;
}
article.card textarea {
  width: 100%;
  min-height: 80px;
}

/* Sign-in forms */
.login .or {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--neutral-500);
}
.login-form {
  display: grid;
  gap: 0.75rem;
  max-width: 360px;
}
.login-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.login-form input {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font: inherit;
}
.login-form button {
  justify-self: start;
}
.login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
}
button.link {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  min-height: 0;
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
.small {
  font-size: 0.85rem;
}
#login-message {
  min-height: 1.4em;
  max-width: 360px;
}

/* Student dashboard */
.course-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1.25rem;
  align-items: start;
}
.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.lesson-list button {
  width: 100%;
  text-align: left;
}
.lesson-list button[aria-current="true"] {
  font-weight: 600;
  outline: 2px solid currentColor;
}
.lesson-view video {
  width: 100%;
  max-height: 70vh;
  background: var(--black);
  border-radius: 8px;
  margin: 0.5rem 0 1rem;
}
.lesson-body {
  white-space: pre-wrap;
  line-height: 1.6;
}
progress {
  width: 100%;
  height: 8px;
}
@media (max-width: 760px) {
  .course-layout {
    grid-template-columns: 1fr;
  }
}
.thread {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.message {
  max-width: 70ch;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--ice-100);
}
.message.mine {
  justify-self: end;
  background: var(--blue-100);
}
.message p {
  margin: 0.2rem 0;
}

/* ---------- Phones and small tablets: compact top bar with a swipeable menu ---------- */
@media (max-width: 800px) {
  aside {
    position: sticky;
    top: 0;
    z-index: 20;
    width: auto;
    height: auto;
    padding: 12px 16px 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ice-200);
    box-shadow: 0 6px 18px rgb(4 28 49 / 0.06);
  }
  aside .brand span {
    font-size: 14px;
  }
  aside .brand img {
    width: 32px;
    height: 32px;
  }
  aside .eyebrow,
  aside .site-link {
    display: none;
  }
  #logout {
    margin-left: auto;
    padding: 8px 14px;
    font-size: 14px;
  }
  nav {
    order: 3;
    flex: 1 0 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  nav::-webkit-scrollbar {
    display: none;
  }
  nav button {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 14px;
    background: var(--ice-100);
  }
  main {
    margin: 0;
    padding: 20px 16px 48px;
  }
  header {
    display: block;
  }
  header h1 {
    font-size: 30px;
    margin: 4px 0 6px;
  }
  #identity {
    display: block;
    margin-bottom: 14px;
    overflow-wrap: anywhere;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .card {
    padding: 16px;
  }
  /* Wide tables scroll sideways inside their card instead of stretching the page. */
  table {
    display: block;
    overflow-x: auto;
    font-size: 12px;
  }
  /* 16px text stops iPhones zooming in when a field is tapped. */
  input,
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
  }
  .toolbar > * {
    flex: 1 1 100%;
  }
  .message {
    max-width: 92%;
  }
  .lesson-view video {
    max-height: 56vh;
  }
  .login {
    margin: 0 auto;
    padding: 36px 20px 48px;
  }
  .login h1 {
    font-size: 40px;
    line-height: 1.05;
  }
  .login .primary,
  .login-form,
  .login-form button {
    width: 100%;
    max-width: none;
    text-align: center;
  }
}

/* Phase 2: grouped sidebar, page subtitle, checkbox groups */
nav {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  align-content: start;
}
.nav-group {
  margin: 14px 0 2px;
  padding-left: 16px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ice-700);
  opacity: 0.7;
}
#subtitle {
  margin: 6px 0 0;
}
#subtitle:empty {
  display: none;
}
fieldset.checks {
  border: 1px solid var(--ice-200);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 18px 0;
  display: grid;
  gap: 10px;
}
fieldset.checks legend {
  padding: 0 6px;
  font-weight: 600;
}
label.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}
label.check input {
  width: auto;
}
@media (max-width: 800px) {
  .nav-group {
    grid-column: 1 / -1;
    padding-left: 0;
  }
}
.row-title {
  display: block;
  font-weight: 600;
  font-size: 16px;
}
.row .muted {
  margin: 4px 0 0;
}
.card .toolbar strong,
.card .row strong {
  font-size: 15px;
  display: inline;
  margin: 0;
}

/* Phase 3: student portal and protected player */
.player {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
}
.player video {
  display: block;
  width: 100%;
  max-height: 70vh;
}
.player:fullscreen {
  border-radius: 0;
  display: flex;
  align-items: center;
}
.player:fullscreen video {
  max-height: 100vh;
  height: 100%;
}
.watermark {
  position: absolute;
  left: 8%;
  top: 12%;
  pointer-events: none;
  user-select: none;
  color: #fff;
  opacity: 0.38;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition:
    left 2.5s cubic-bezier(0.22, 1, 0.36, 1),
    top 2.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.player-full {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 12px;
  padding: 6px 12px;
  opacity: 0.85;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.home-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.home-card h3,
.announcement h3,
.resource h3 {
  margin: 0;
}
.home-card progress {
  width: 100%;
}
ul.ticks {
  margin: 4px 0 0;
  padding-left: 20px;
}
.announcement {
  padding: 16px 0;
  border-bottom: 1px solid var(--ice-100);
}
.announcement:last-child {
  border-bottom: 0;
}
.pre-line {
  white-space: pre-line;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips button[aria-pressed="true"] {
  background: var(--blue-700);
  color: var(--white);
  border-color: var(--blue-700);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
a.button-link {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 100px;
  border: 1px solid var(--ice-200);
  color: var(--blue-700);
  text-decoration: none;
  font-weight: 500;
  margin-top: 8px;
}
a.button-link:hover,
a.button-link:focus-visible {
  border-color: var(--blue-700);
}
.resource .eyebrow {
  margin: 0 0 6px;
}
/* With the sidebar, the course page needs room for the video: stack below 1100px, video first. */
@media (max-width: 1100px) {
  .course-layout {
    grid-template-columns: 1fr;
  }
  .course-layout .lesson-view {
    order: -1;
  }
}

/* Phase 4: attachments, documents */
.file-chip {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  padding: 6px 12px;
}
.file-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.file-picker input {
  width: auto;
}
button.small {
  font-size: 12px;
  padding: 5px 10px;
  margin-top: 8px;
}
.badge.status-submitted,
.badge.status-in_review {
  background: #fff4dc;
  color: #7a5200;
}
.badge.status-changes_requested {
  background: #ffe7e3;
  color: #8f2a1c;
}
.badge.status-approved {
  background: #e3f6ea;
  color: #1d6b3c;
}

/* Phase 5: form builder */
.builder-step {
  background: var(--white);
}
.builder-field {
  margin: 0;
  padding: 14px 18px;
}
.builder-field summary {
  cursor: pointer;
  font-weight: 500;
}

/* ---------- Phase 6: app-like mobile layout ---------- */
#screen.enter {
  animation: screen-in 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  #screen.enter {
    animation: none;
  }
}
/* Long words, emails and links never push the page sideways. */
.card,
.message,
.lesson-body,
#identity,
.row-title {
  overflow-wrap: anywhere;
}
#tabbar,
.menu-backdrop {
  display: none;
}
.offline {
  text-align: left;
}
@media (max-width: 800px) {
  html,
  body {
    overflow-x: hidden;
  }
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  aside {
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }
  /* The menu lives in the bottom tab bar; the full list opens as a sheet from "More". */
  aside nav {
    display: none;
  }
  /* Lift the header (which contains the sheet) above the backdrop. */
  body.menu-open aside {
    z-index: 46;
  }
  body.menu-open aside nav {
    display: grid;
    grid-template-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 45;
    max-height: min(72vh, 640px);
    overflow-y: auto;
    margin: 0;
    padding: 18px calc(16px + env(safe-area-inset-left)) 18px;
    gap: 2px;
    background: var(--white);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -24px 60px rgb(4 28 49 / 0.18);
    animation: sheet-in 380ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.menu-open aside nav button {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    background: transparent;
    font-size: 16px;
    text-align: left;
    white-space: normal;
  }
  body.menu-open aside nav button.active {
    background: var(--ice-100);
  }
  body.menu-open aside nav .nav-group {
    margin: 14px 0 4px;
    padding-left: 14px;
  }
  body.menu-open .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgb(4 28 49 / 0.32);
  }
  @keyframes sheet-in {
    from {
      transform: translateY(24px);
      opacity: 0;
    }
  }
  #tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    gap: 2px;
    padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom))
      calc(6px + env(safe-area-inset-left));
    background: rgb(251 252 253 / 0.94);
    backdrop-filter: saturate(1.4) blur(18px);
    -webkit-backdrop-filter: saturate(1.4) blur(18px);
    border-top: 1px solid var(--ice-200);
    /* Undo the generic sidebar "nav" rules, which also match this element. */
    grid-auto-columns: minmax(0, 1fr);
    margin: 0;
    flex: none;
    order: 0;
    overflow: visible;
    min-height: 0;
  }
  #tabbar button span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #tabbar button {
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    padding: 6px 2px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ice-700);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
    transition: color 300ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  #tabbar button.active,
  #tabbar button[aria-expanded="true"] {
    color: var(--blue-700);
  }
  #tabbar button.active svg {
    transform: translateY(-1px);
  }
  #tabbar svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  #tabbar button[data-badge]::after {
    content: attr(data-badge);
    position: absolute;
    top: 4px;
    left: calc(50% + 6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--blue-700);
    color: var(--white);
    font-size: 10px;
    line-height: 16px;
    text-align: center;
  }
  /* Comfortable touch targets. */
  button,
  .primary,
  a.button-link,
  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 44px;
  }
  label.check input,
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
  }
  .row {
    flex-wrap: wrap;
  }
  .row > button {
    flex: 0 0 auto;
  }
  .player-full {
    min-height: 36px;
  }
}

/* Alignment pass: spacing on the 8px grid across both portals. */
.card {
  padding: 24px;
  margin-bottom: 16px;
}
.toolbar {
  margin: 16px 0;
  gap: 8px 12px;
}
.home-grid {
  gap: 16px;
  margin-bottom: 16px;
}
fieldset.checks {
  margin: 16px 0;
  padding: 16px;
}
header {
  gap: 24px;
}
@media (max-width: 800px) {
  .card {
    padding: 16px;
  }
  main {
    padding: 24px 16px 48px;
  }
}
