/*
 * Shared student portal stylesheet — used by every brand site.
 *
 * Rebuilt from the inline CSS in Context/Backend Designs/, which carried the
 * original portal's own tokens and measurements. Structure, spacing and type
 * follow those captures.
 *
 * One deliberate divergence: the WordPress portal was the same navy for every
 * brand. Here the accent is per-brand, injected by theme.php as --portal-primary
 * on :root. Everything else (page background, body text, borders) stays shared,
 * so the four portals read as one system with different accents.
 */

:root {
  /* Shared portal palette, identical for every brand. */
  --portal-text: #0a1e40;
  --portal-text-alt: #414b5c;
  --portal-text-light: #f8fbff;
  --portal-background: #f8fbff;
  --portal-border: #dbdee5;
  --light: #ffffff;

  /* Per-brand accent. theme.php overrides these; the navy fallback is the
     original network default, used if a brand row has no colours. */
  --portal-primary: #023790;
  --portal-on-primary: #ffffff;

  /* Derived accent tints. Kept as color-mix so a brand only has to supply one
     colour and the tints follow automatically. */
  --portal-primary-30: color-mix(in srgb, var(--portal-primary) 30%, transparent);
  --portal-highlight: color-mix(in srgb, var(--portal-primary) 28%, #ffffff);

  /* Type and spacing scales, matching the reference. */
  --text-xs: clamp(1.26rem, calc(-0.23vw + 1.34rem), 1.01rem);
  --text-s: clamp(1.42rem, calc(-0.07vw + 1.44rem), 1.35rem);
  --text-m: clamp(1.6rem, calc(0.19vw + 1.54rem), 1.8rem);
  --text-l: clamp(1.8rem, calc(0.55vw + 1.62rem), 2.4rem);
  --text-xl: clamp(2.02rem, calc(1.09vw + 1.68rem), 3.2rem);
  --text-2xl: clamp(2.28rem, calc(1.84vw + 1.69rem), 4.26rem);

  --space-4xs: 0.5rem;
  --space-3xs: clamp(0.66rem, calc(0.04vw + 0.64rem), 0.7rem);
  --space-2xs: clamp(0.82rem, calc(0.16vw + 0.77rem), 0.99rem);
  --space-xs: clamp(1.02rem, calc(0.35vw + 0.91rem), 1.4rem);
  --space-s: clamp(1.28rem, calc(0.65vw + 1.07rem), 1.98rem);
  --space-m: clamp(1.6rem, calc(1.11vw + 1.24rem), 2.8rem);
  --space-l: clamp(2rem, calc(1.81vw + 1.42rem), 3.96rem);
  --space-xl: clamp(2.5rem, calc(2.87vw + 1.58rem), 5.6rem);

  --radius-s: clamp(0.6rem, calc(0.19vw + 0.54rem), 0.8rem);
  --radius-m: clamp(1rem, calc(0.19vw + 0.94rem), 1.2rem);
  --radius-l: clamp(1.6rem, calc(0.37vw + 1.48rem), 2rem);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  font-size: 62.5%;
}

body {
  margin: 0;
  padding: var(--space-s);
  background: var(--portal-background);
  color: var(--portal-text);
  font-family: var(--font);
  font-size: var(--text-s);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--portal-primary);
  outline-offset: 2px;
}

/* ================================================================== shell */

.portal-wrapper {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: var(--space-s);
  align-items: start;
}

/* ================================================================ sidebar */

.portal-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  row-gap: var(--space-l);
  padding-block: var(--space-l);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-l);
  background: #fff;
}

.portal-side-head {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-l);
}

.portal-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-inline: var(--space-l);
}

.portal-welcome__image {
  width: 100%;
  max-width: 13.5rem;
  border: 5px solid var(--portal-background);
  border-radius: 100%;
}

.portal-welcome__heading {
  margin-top: var(--space-2xs);
  font-size: var(--text-l);
  color: var(--portal-text);
  text-align: center;
}

.portal-welcome__name {
  font-size: var(--text-s);
  font-style: italic;
  text-align: center;
}

.portal-sidebar-divider {
  margin-inline: var(--space-l);
  border: 0;
  border-top: 1px solid var(--portal-border);
}

.portal-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.portal-nav__item {
  border-left: 3px solid transparent;
  transition: border-color 0.3s ease-in-out;
}

.portal-nav__item:hover {
  border-left-color: var(--portal-primary);
}

.portal-nav__item.is-active {
  border-left-color: var(--portal-primary);
}

.portal-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-3xs) var(--space-m) var(--space-3xs) var(--space-l);
  color: var(--portal-text-alt);
  font-weight: 500;
}

.portal-nav__item.is-active .portal-nav__link {
  color: var(--portal-primary);
  font-weight: 700;
}

.portal-nav__link svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.portal-today {
  padding-inline: var(--space-l);
  font-size: var(--text-xs);
  font-style: italic;
  text-align: center;
}

/* ================================================================== main */

.portal-main {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-s);
  min-width: 0;
}

.portal-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding: var(--space-s) var(--space-m);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-l);
  background: #fff;
}

.portal-head__logo {
  max-width: 11rem;
}

.portal-head__actions {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

/* Search, inbox and notifications each sit in a positioned shell so their
   panel can hang beneath them. */
.portal-tool {
  position: relative;
  display: flex;
  align-items: center;
}

.portal-tool__button {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--portal-text);
  cursor: pointer;
}

.portal-tool__badge {
  position: absolute;
  top: -6px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border-radius: 100px;
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* ---------------------------------------------------------- drop panels */

.portal-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  width: 23rem;
  min-width: 23rem;
  margin-top: var(--space-3xs);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-m);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(5, 19, 43, 0.12);
}

.portal-panel--right {
  left: auto;
  right: 0;
}

.portal-panel__head {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2xs) var(--space-xs);
  background: var(--portal-primary);
  color: var(--portal-on-primary);
}

.portal-panel__heading {
  font-size: var(--text-s);
}

.portal-panel__count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 100px;
  background: var(--portal-primary-30);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

.portal-panel__body {
  display: flex;
  flex-direction: column;
  padding: var(--space-s) var(--space-xs);
  row-gap: var(--space-2xs);
}

.portal-panel__body--roomy {
  row-gap: var(--space-m);
}

.portal-panel__row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: var(--space-xs);
  cursor: default;
}

.portal-panel__name {
  font-size: var(--text-xs);
  font-weight: 500;
}

.portal-panel__time {
  font-size: var(--text-xs);
  font-weight: 700;
}

.portal-panel--menu .portal-panel__body {
  padding: var(--space-2xs);
  row-gap: 0;
}

.portal-panel__link {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs);
  border-radius: var(--radius-s);
  color: var(--portal-text);
  font-size: var(--text-s);
  font-weight: 500;
  transition: background-color 0.2s ease-in-out;
}

.portal-panel__link:hover {
  background: var(--portal-background);
}

/* --------------------------------------------------------------- user chip */

.portal-user {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 6px var(--space-2xs) 6px 6px;
  border: 0;
  border-radius: 100px;
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-family: var(--font);
  font-size: var(--text-m);
  font-weight: 600;
  cursor: pointer;
}

.portal-user__avatar {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 100%;
  object-fit: cover;
}

/* The search icon is decorative — no panel, no pointer affordance. */
.portal-tool--static {
  color: var(--portal-text);
  pointer-events: none;
}

/* ========================================================= content panel */

.portal-content {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-l);
  padding: var(--space-l);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-l);
  background: #fff;
}

.portal-content__head {
  display: flex;
  flex-direction: row;
  align-items: center;
  column-gap: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--portal-border);
}

.portal-content__head svg {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--portal-primary);
}

.portal-content__heading {
  font-size: var(--text-xl);
  color: var(--portal-text);
}

/* ============================================================== card grid */

/* Shared by the dashboard cards and the documents categories: an accent
   header strip above a tinted body. */
.portal-card {
  border-radius: var(--radius-l);
  overflow: hidden;
}

.portal-card__head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs);
  padding: var(--space-s);
  background: var(--portal-primary);
}

.portal-card__heading {
  font-size: var(--text-m);
  color: var(--portal-text-light);
}

.portal-card__view-all {
  border-bottom: 2px dotted var(--portal-highlight);
  color: var(--portal-highlight);
  font-size: var(--text-s);
  font-weight: 600;
  line-height: 1;
}

.portal-card__body {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-2xs);
  padding: var(--space-s);
  border-right: 1px solid var(--portal-border);
  border-bottom: 1px solid var(--portal-border);
  border-left: 1px solid var(--portal-border);
  border-radius: 0 0 var(--radius-l) var(--radius-l);
  background: var(--portal-background);
}

/* A row of "icon + label" links inside a card body. */
.portal-link-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3xs);
  flex-wrap: nowrap;
  transition: padding-left 0.2s ease-in-out;
}

.portal-link-row:hover {
  padding-left: var(--space-3xs);
}

.portal-link-row svg {
  flex: none;
  min-width: 15px;
  margin-top: 2px;
  color: var(--portal-primary);
}

.portal-link-row__label {
  color: var(--portal-text);
  font-size: var(--text-s);
  font-weight: 600;
  transition: color 0.2s ease-in-out;
}

.portal-link-row:hover .portal-link-row__label {
  color: var(--portal-primary);
}

/* ============================================================== dashboard */

.dashboard-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  align-items: start;
}

.dashboard-dates__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  padding-top: var(--space-l);
}

/* --------------------------------------------------------- date chips */

/* Dashboard variant: white tile, accent year pill straddling the top edge. */
.date-chip {
  display: grid;
  grid-template-columns: 1.4fr 4fr;
  gap: var(--space-s);
  align-items: center;
}

.date-chip__date {
  /* Sizing below is in cqi (1% of this element's width) so the tile scales with
     its own box rather than the viewport — the dashboard and calendar chips are
     different widths at the same breakpoint. */
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  aspect-ratio: 1.1;
  padding: var(--space-2xs) var(--space-4xs) var(--space-4xs);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-m);
  background: var(--light);
  color: var(--portal-text);
  text-align: center;
}

.date-chip__year {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: clamp(2px, 2.5cqi, 4px) clamp(6px, 7cqi, 10px);
  border: 1px solid var(--portal-primary);
  border-radius: 100px;
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-size: clamp(0.85rem, 11cqi, 1.4rem);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.date-chip__day {
  font-size: clamp(1.6rem, 30cqi, 3.2rem);
  font-weight: 800;
  line-height: 1;
}

.date-chip__month {
  font-size: clamp(0.85rem, 11cqi, 1.35rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: clamp(0.5px, 1.5cqi, 2px);
  text-transform: uppercase;
}

.date-chip__title {
  font-size: calc(var(--text-s) * 1.15);
}

.date-chip__time {
  font-size: var(--text-xs);
  font-style: italic;
}

/* Calendar-page variant: the tile is filled with the accent and the year pill
   inverts. Same markup, one modifier. */
.date-chip--filled {
  padding: var(--space-s);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-l);
}

.date-chip--filled .date-chip__date {
  aspect-ratio: auto;
  padding: var(--space-xs);
  border-color: var(--portal-primary);
  background: var(--portal-primary);
  color: var(--portal-on-primary);
}

.date-chip--filled .date-chip__year {
  background: var(--light);
  color: var(--portal-primary);
  font-weight: 800;
}

.date-chip--filled .date-chip__day {
  font-size: clamp(1.8rem, 34cqi, 4.2rem);
}

/* ============================================================== documents */

.portal-doc-wrapper {
  columns: 2;
  column-gap: 20px;
}

.portal-doc-wrapper .portal-card {
  break-inside: avoid;
  margin-bottom: 20px;
  display: block;
}

/* ========================================================== knowledgebase */

.kb-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: var(--space-l);
  align-items: start;
}

.kb-left {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-s);
}

.kb-search {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 4px;
}

.kb-search__field {
  padding: var(--space-2xs);
  border: 2px solid var(--portal-border);
  border-radius: var(--radius-s);
  font-family: var(--font);
  font-size: var(--text-s);
}

.kb-search__field::placeholder {
  color: var(--portal-text-alt);
  opacity: 0.5;
}

.kb-search__button {
  padding: var(--space-2xs);
  border: 0;
  border-radius: var(--radius-s);
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-family: var(--font);
  font-size: var(--text-s);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}

.kb-info {
  color: var(--portal-text-alt);
  font-size: var(--text-s);
  white-space: pre-line;
}

.kb-items {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-m);
}

.kb-item {
  position: relative;
  display: flex;
  flex-direction: row;
  column-gap: 6px;
  flex-wrap: nowrap;
  transition: padding-left 0.15s ease-in-out;
}

.kb-item:hover {
  padding-left: 10px;
}

.kb-item:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: calc(var(--space-m) * -0.5);
  left: 0;
  width: 100%;
  border-bottom: 1px solid var(--portal-border);
}

.kb-item svg {
  flex: none;
  min-width: 14px;
  margin-top: 3px;
  color: var(--portal-primary);
}

.kb-item__title {
  color: var(--portal-text);
  font-size: var(--text-s);
  font-weight: 500;
}

.kb-empty {
  color: var(--portal-text-alt);
  font-size: var(--text-s);
  font-style: italic;
}

/* ================================================================ updates */

.updates-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  align-items: stretch;
}

.updates-item {
  position: relative;
  display: flex;
  flex-direction: column;
  row-gap: var(--space-2xs);
  padding: var(--space-m);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-l);
  background: var(--portal-background);
  transition: background-color 0.2s ease-in-out;
}

.updates-item:hover {
  background: var(--light);
}

.updates-item__heading {
  font-size: var(--text-m);
  color: var(--portal-text);
}

.updates-item__date-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  column-gap: var(--space-3xs);
}

.updates-item__date-wrapper svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--portal-primary);
}

.updates-item__date {
  color: var(--portal-text);
  font-size: var(--text-s);
  font-weight: 500;
}

.updates-item__excerpt {
  color: var(--portal-text);
  font-size: var(--text-s);
  line-height: 1.4;
}

.updates-item__tag {
  position: absolute;
  right: 18px;
  bottom: -12px;
  padding: 1px 10px;
  border-radius: 50px;
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-size: var(--text-xs);
}

/* ============================================================= pagination */

.portal-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

.portal-pagination__button {
  padding: var(--space-2xs) var(--space-s);
  border: 0;
  border-radius: var(--radius-s);
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-family: var(--font);
  font-size: var(--text-s);
  font-weight: 600;
  transition: background-color 0.3s ease-in-out;
}

.portal-pagination__button:hover {
  background: var(--portal-text);
}

.portal-pagination__button[aria-disabled='true'] {
  opacity: 0.4;
  pointer-events: none;
}

/* ================================================================== login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-s);
}

.login-wrap {
  width: min(100%, 40rem);
}

.login__logo {
  max-width: 15rem;
  margin: 0 auto var(--space-m);
}

.login__card {
  display: flex;
  flex-direction: column;
  padding: var(--space-m);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-m);
  background: #fff;
}

.login__label {
  margin-bottom: var(--space-4xs);
  color: var(--portal-text-alt);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login__input {
  margin-bottom: var(--space-s);
  padding: var(--space-2xs);
  border: 1px solid var(--portal-border);
  border-radius: var(--radius-s);
  font-family: var(--font);
  font-size: var(--text-s);
}

.login__input::placeholder {
  color: var(--portal-text-alt);
  opacity: 0.6;
}

.login__button {
  padding: var(--space-2xs);
  border: 0;
  border-radius: var(--radius-s);
  background: var(--portal-primary);
  color: var(--portal-on-primary);
  font-family: var(--font);
  font-size: var(--text-m);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease-in-out;
}

.login__button:hover {
  background: var(--portal-text);
}

.login__error {
  margin-bottom: var(--space-s);
  padding: var(--space-2xs);
  border-radius: var(--radius-s);
  background: color-mix(in srgb, #d92d20 12%, #fff);
  color: #91231a;
  font-size: var(--text-s);
}

/* ============================================================ responsive */

@media (max-width: 900px) {
  .kb-wrapper,
  .dashboard-top,
  .updates-wrapper,
  .dashboard-dates__body {
    grid-template-columns: 1fr;
  }

  .portal-doc-wrapper {
    columns: 1;
  }
}

@media (max-width: 767px) {
  .portal-wrapper {
    grid-template-columns: 1fr;
  }

  /* The reference hides the sidebar outright at this width, which leaves a
     phone with no way to move between portal pages. Instead it becomes a
     horizontal nav strip: the welcome block and date drop away, the links stay.
     Deliberate divergence — see the note in README. */
  .portal-sidebar {
    padding: var(--space-2xs);
  }

  .portal-welcome,
  .portal-sidebar-divider,
  .portal-today {
    display: none;
  }

  .portal-nav {
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .portal-nav::-webkit-scrollbar {
    display: none;
  }

  .portal-nav__item {
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .portal-nav__item:hover,
  .portal-nav__item.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--portal-primary);
  }

  .portal-nav__link {
    padding: var(--space-2xs) var(--space-xs);
    white-space: nowrap;
  }

  .portal-nav__link span {
    display: none;
  }

  .portal-nav__link svg {
    width: 22px;
    height: 22px;
  }

  .portal-head {
    flex-direction: column;
    row-gap: var(--space-m);
  }

  .portal-head__logo {
    max-width: 15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
