/* Shared responsive layer. Keep this after the page-specific stylesheets. */
:root {
  --bmit-page-background: #F8FBFF;
  --page-gutter: clamp(16px, 3vw, 30px);
  --bmit-nav-height: 3.25rem;
  background-color: var(--bmit-page-background);
}
body,
body.catalogue-page {
  background-color: var(--bmit-page-background);
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { overflow-wrap: anywhere; }
main, section, article, aside, form { min-width: 0; }
p { font-size: clamp(1rem, .97rem + .15vw, 1.0625rem); }
h2 { font-size: clamp(1.625rem, 1.3rem + 1vw, 2rem); }
img { height: auto; }
.masthead {
  height: auto;
  min-height: 5.5rem;
  padding: 1rem max(var(--page-gutter), calc((100% - 1360px) / 2));
  gap: 1rem;
  background: var(--wine);
}
.brand { flex: none; background: white; border-radius: 50%; padding: .2rem; }
.brand img { width: 52px; height: 52px; }
.login {
  min-height: 2.75rem;
  padding: .6rem 1.2rem;
  border: 1px solid white;
  background: white;
  color: var(--wine);
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
}
.login:hover { background: #fff2e8; filter: none; }
.login .icon { width: 1.125rem; height: 1.125rem; }
.navigation { padding-inline: max(var(--page-gutter), calc((100% - 1360px) / 2)); gap: 1rem; }
.nav-links { gap: clamp(1rem, 2vw, 1.875rem); }
.nav-links a, .catalogue-page .nav-links a { font-size: 1rem; }
.menu-toggle, .search-toggle { min-height: 3.25rem; font-size: 1rem; }
.search-panel, .course-tabs-bar { top: var(--bmit-nav-height); }
.search-panel { padding: 1.25rem var(--page-gutter); }
.search-fields { flex-wrap: wrap; }
.search-fields input { flex: 1 1 12rem; width: auto; }
.search-fields button { min-height: 2.75rem; }
.hero .slide {
  display: grid;
  align-content: center;
  height: auto;
  min-height: clamp(30rem, 42vw, 42rem);
  padding: 4rem max(var(--page-gutter), calc((100% - 1540px) / 2)) 5rem;
}
.hero .slide-card {
  position: relative;
  inset: auto;
  transform: none;
  width: min(40.625rem, 100%);
}
.hero .slide-copy { padding: clamp(1.25rem, 2.4vw, 1.875rem); }
.hero .slide-copy h2 { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.75rem); line-height: 1.15; margin-bottom: 1.25rem; }
.hero .slide-copy p { font-size: clamp(1.125rem, .9rem + .8vw, 1.65rem); line-height: 1.4; }
.slide-actions { grid-template-columns: minmax(2.75rem, 1fr) minmax(0, 2fr) minmax(2.75rem, 1fr); }
.slide-actions a, .slide-actions button { min-height: 2.75rem; }
.slide-dots { bottom: .75rem; gap: .2rem; }
.slide-dots button { position: relative; width: 44px; height: 44px; background: transparent; border: 0; box-shadow: none; }
.slide-dots button[data-go]::before { content: ''; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 1rem; height: 1rem; border: 2px solid white; border-radius: 50%; background: white; box-shadow: 0 0 3px #0008; }
.slide-dots button[data-go][aria-pressed=true]::before { background: #26313a; }
.slide-dots .autoplay { width: 44px; height: 44px; font-size: 1rem; line-height: 1; background: #26313abc; }
.values, .departments { padding: clamp(2.75rem, 5vw, 5rem) max(var(--page-gutter), calc((100% - 1540px) / 2)); }
.values { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.values h2 { font-size: clamp(1.25rem, 1.1rem + .4vw, 1.5rem); }
.explore { padding-inline: max(var(--page-gutter), calc((100% - 1540px) / 2)); gap: clamp(1.25rem, 3vw, 3.125rem); scroll-margin-top: calc(var(--bmit-nav-height) + 1rem); }
.explore-copy { min-width: 0; padding-block: clamp(2.5rem, 4.5vw, 4.5rem); }
.explore>img { height: auto; max-width: 100%; }
.button { max-width: 100%; font-size: clamp(1rem, .95rem + .25vw, 1.2rem); padding: .9rem 1.5rem; }
.department-grid, .enlarged-text .department-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.875rem, 4vw, 3.75rem) 1.875rem;
  align-items: stretch;
  width: 100%;
  max-width: 75.625rem;
  margin-inline: auto;
}
/* New Learning-style department tiles with fixed-size, wrapping labels. */
.department-card {
  position: relative;
  isolation: isolate;
  display: block;
  min-height: 0;
  aspect-ratio: 700 / 395;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1.25rem 1.875rem #0000001a;
  transform: none;
}
.department-card img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  transition: transform .25s ease-in-out;
}
.department-card h3 {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  min-height: 0;
  margin: 0;
  padding: 1.25rem;
  color: #171c2a;
  background: #ffffffe0;
  font-size: 1.3125rem;
  line-height: 1.125;
  text-align: left;
  overflow-wrap: anywhere;
  transition: color .15s ease-in-out, background-color .15s ease-in-out;
}
.department-card h3 .icon {
  position: static;
  width: 1.125rem;
  height: 1.125rem;
  transform: none;
  flex: none;
}
.department-card:hover { transform: none; }
.department-card:focus-visible {
  outline: 3px solid #0069ba;
  outline-offset: 3px;
}
.department-card:focus-visible h3 {
  color: #fff;
  background: #8c2332e0;
}
@media (hover: hover) {
  .department-card:hover img { transform: scale(1.15); }
  .department-card:hover h3 {
    color: #fff;
    background: #8c2332e0;
  }
}
.resources { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); padding-inline: var(--page-gutter); }
.resources a { font-size: clamp(1.125rem, 1rem + .4vw, 1.35rem); }
.footer-contact, .footer-bottom { padding-inline: var(--page-gutter); flex-wrap: wrap; }
.contact-links, .contact-links a, .footer-bottom>*, .footer-bottom nav { min-width: 0; max-width: 100%; }
.contact-links a { overflow-wrap: anywhere; }
/* Copyright left, footer links right. Wrap naturally when a full row will not fit. */
.footer-bottom.footer-bottom--inline { flex-direction: row; align-items: center; gap: 1rem 2rem; padding-bottom: 4.5rem; }
.footer-bottom.footer-bottom--inline > p { flex: 0 1 auto; width: auto; max-width: 100%; order: 0; text-align: left; }
.footer-bottom.footer-bottom--inline nav { display: flex; margin-left: auto; justify-content: flex-end; gap: clamp(1rem, 2vw, 2rem); }
.footer-bottom nav { flex-wrap: wrap; }
.footer-bottom nav a { padding-block: .5rem; }
.moodle-container, .catalogue-shell { padding-inline: var(--page-gutter); }
.catalogue-page h1, .collection-header h1 { font-size: clamp(1.75rem, 1.3rem + 1.5vw, 3rem); }
.catalogue-page .department-banner h1, .programme-page .moodle-course-header h1 { font-size: clamp(1.75rem, 1.5rem + .75vw, 2.19375rem); line-height: 1.2; overflow-wrap: anywhere; }
.programme-page h2, .catalogue-page h2 { font-size: clamp(1.4rem, 1.25rem + .5vw, 1.75rem); }
.dictionary-grid, .enlarged-text .dictionary-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.course-grid, .enlarged-text .course-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.course-grid .card-copy h2 { font-size: clamp(1.125rem, 1rem + .4vw, 1.25rem); }
.card-copy>p:not(.eyebrow), .subject-content :is(p,li), .lms-panel p { font-size: 1rem; }
.department-links a { min-height: 2.75rem; display: inline-flex; align-items: center; font-size: .875rem; }
.catalogue-search>div { flex-wrap: wrap; }
.catalogue-search input { flex: 1 1 15rem; width: auto; }
.primary-button, .text-button { min-height: 2.75rem; max-width: 100%; text-align: center; }
.course-breadcrumbs a { min-width: 0; overflow-wrap: anywhere; }
.course-facts { font-size: .875rem; }
.course-enrol-button { white-space: normal; }
.course-tabs-bar .course-tabs { max-width: 100%; }
.course-tabs a { white-space: normal; max-width: min(19rem, 80vw); }
.course-tabs-help:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0; width: calc(100% - 405px); }
.enlarged-text .course-tabs-help:not([hidden]) { width: 100%; }
.programme-page .course-tabs-help p { margin: 0; font-size: .875rem; line-height: 1.4; }
.course-tabs-help strong, .course-tabs-help p>span { display: block; }
.course-tabs-arrows { display: flex; gap: .5rem; flex: none; }
.course-tabs-arrows button { display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border: 1px solid #0069ba; border-radius: 5px; background: white; color: #0069ba; }
.course-tabs-arrows button>span { font-size: 2rem; line-height: 1; }
.course-tabs-arrows button:disabled { border-color: #c7c7c7; color: #909090; background: #eee; }
.subject summary>span:first-child, .instructor-profile>div { min-width: 0; overflow-wrap: anywhere; }
.instructor-profile { flex-wrap: wrap; }
.instructor-profile>div { flex: 1 1 12rem; }
.enlarged-text .landing-banner-layout, .enlarged-text .subject-columns, .enlarged-text .programme-page .subject-columns { grid-template-columns: 1fr; }
.enlarged-text .course-enrol-card { display: block; }
.enlarged-text .course-card-image img { height: auto; aspect-ratio: 1.75; }
.enlarged-text .card-copy>p:not(.eyebrow) { display: block; -webkit-line-clamp: unset; }
dialog { max-height: 90dvh; padding: 1.25rem; }
.access-controls label { flex-wrap: wrap; min-width: 0; }
.access-controls select { max-width: 100%; min-height: 2.75rem; }
.access-close { min-width: 2.75rem; min-height: 2.75rem; }
.access-launcher { right: max(.75rem, env(safe-area-inset-right)); bottom: max(.75rem, env(safe-area-inset-bottom)); }
/* Enlarged text uses the same collapsible menu as phones and tablets. */
.enlarged-text .menu-toggle { display: flex; align-items: center; }
.enlarged-text .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--nav); padding: .5rem var(--page-gutter); flex-direction: column; align-items: stretch; gap: 0; max-height: calc(100dvh - var(--bmit-nav-height)); overflow-y: auto; }
.enlarged-text .nav-links.is-open { display: flex; }
.enlarged-text .nav-links a { padding: .75rem 0; }
.enlarged-text .navigation { flex-wrap: wrap; gap: 0 .5rem; }
@media (max-width: 60rem) {
  .department-grid, .enlarged-text .department-grid, .course-grid, .enlarged-text .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-toggle { display: flex; align-items: center; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--nav); padding: .5rem var(--page-gutter); flex-direction: column; align-items: stretch; gap: 0; max-height: calc(100dvh - var(--bmit-nav-height)); overflow-y: auto; }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: .75rem 0; }
  .course-enrol-card { display: block; }
  .course-card-image img { height: auto; aspect-ratio: 1.75; }
}
@media (max-width: 61.9375rem) {
  .department-grid, .enlarged-text .department-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 50rem;
  }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .course-tabs-help:not([hidden]) { width: calc(100% - 345px); }
}
@media (max-width: 900px) {
  .course-tabs-help:not([hidden]) { width: 100%; }
}
@media (max-width: 40rem) {
  .department-grid, .enlarged-text .department-grid, .course-grid, .enlarged-text .course-grid { grid-template-columns: 1fr; }
  .masthead { min-height: 4.75rem; padding-block: .75rem; gap: .5rem; }
  .brand img { width: 48px; height: 48px; }
  .login { min-width: 0; padding: .6rem; }
  .hero .slide { align-content: end; min-height: 34rem; padding-top: 10rem; padding-bottom: 5rem; }
  .hero-image { object-position: 61% center; }
  .explore { display: flex; flex-direction: column; gap: 0; }
  .explore-copy { padding-bottom: 1.25rem; }
  .explore>img { align-self: center; width: min(85%, 300px); }
  .course-tabs-help:not([hidden]) { flex-wrap: wrap; }
  .course-tabs-bar { position: static; }
  .course-panel, .course-panel :is(h2,h3,section,details) { scroll-margin-top: calc(var(--bmit-nav-height) + 1rem); }
  .department-banner .breadcrumbs { font-size: .875rem; }
  .dialog-heading h2 { overflow-wrap: anywhere; }
}
@media (max-width: 48rem) {
  .department-grid, .enlarged-text .department-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* BMIT compact footer spacing. Preserve bottom clearance for accessibility. */
#footer .footer-contact { padding-block: 28px; }
#footer .footer-bottom.footer-bottom--inline { padding-top: 24px; }
