/*
 * SE Library styles
 * 1. Foundation and shared components
 * 2. Current minimal theme
 * 3. Responsive layouts and reduced motion
 */

/* 1. Foundation and shared components */
:root {
  /* MÀU SÁNG - THIẾT KẾ iOS/NOTION CAO CẤP */
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --list-bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --text: #1a1a1a;
  --text-sub: #666666;
  --border: #e5e7eb;
  --accent: #000000;
  --accent-2: #8e44ad;
  --accent-3: #ff7eb3;
  --accent-soft: rgba(255, 126, 179, 0.12);
  --brand-pink: #ff7eb3;
  --brand-purple: #8e44ad;
  --brand-blue: #4facfe;
  --brand-gradient: linear-gradient(135deg, #ff7eb3, #8e44ad, #4facfe);
  --nav-bg: rgba(255, 255, 255, 0.95);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.04);
  --blur: blur(20px);
}

body.dark-mode {
  /* MÀU TỐI - THIẾT KẾ iOS CAO CẤP */
  --bg: #111111;
  --bg-soft: #181818;
  --list-bg: #1f1f1f;
  --surface: rgba(31, 31, 31, 0.78);
  --surface-strong: #252525;
  --text: #ffffff;
  --text-sub: #a0a0a0;
  --border: #333333;
  --accent: #ffffff;
  --accent-2: #8e44ad;
  --accent-3: #ff7eb3;
  --accent-soft: rgba(255, 126, 179, 0.14);
  --nav-bg: rgba(17, 17, 17, 0.95);
  --shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* =========================================
   2. RESET & BASE
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background:
    linear-gradient(135deg, var(--bg-soft), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 0.4s ease, color 0.4s ease;
  padding-top: 70px;
  -webkit-font-smoothing: antialiased;
}

body.is-ready .hero-kicker,
body.is-ready .hero-title,
body.is-ready .hero-subtitle,
body.is-ready .resource-toolbar,
body.is-ready .semester-tabs-container {
  animation: riseIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body.is-ready .hero-title {
  animation-delay: 0.08s;
}

body.is-ready .hero-subtitle {
  animation-delay: 0.16s;
}

body.is-ready .resource-toolbar {
  animation-delay: 0.24s;
}

body.is-ready .semester-tabs-container {
  animation-delay: 0.3s;
}

h1,
h2,
h3,
.hero-title,
.empty-state h3,
.course-info h3 {
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 0;
}

a {
  text-decoration: none !important;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================
   FLOATING UNIVERSITY CLOCK
   ========================================= */
.university-clock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(390px, calc(100vw - 32px));
  padding: 13px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.62)),
    var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: hidden;
}

body.dark-mode .university-clock {
  background:
    linear-gradient(135deg, rgba(20, 28, 43, 0.92), rgba(17, 24, 39, 0.68)),
    var(--surface);
}

.university-clock::before {
  content: "";
  position: absolute;
  inset: -50% auto auto -12%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(142, 68, 173, 0.22), transparent 64%);
  pointer-events: none;
}

.clock-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 14px 28px rgba(142, 68, 173, 0.28);
}

.clock-icon::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(142, 68, 173, 0.18);
  border-radius: 18px;
  animation: clockRing 2.8s ease-in-out infinite;
}

.clock-content {
  position: relative;
  min-width: 0;
  flex: 1;
}

.clock-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.clock-label,
#university-progress {
  display: block;
  color: var(--text-sub);
  font-size: 0.72rem;
  font-weight: 800;
}

#university-percent {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
}

#university-elapsed {
  display: block;
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 1.05rem;
  line-height: 1.2;
}

.clock-progress {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(138, 138, 142, 0.16);
}

.clock-detail-button {
  position: relative;
  z-index: 2;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(142, 68, 173, 0.16);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.clock-detail-button i {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  font-size: 0.75rem;
}

.clock-detail-button:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(142, 68, 173, 0.3);
  transform: translateY(-2px);
}

#university-progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 16px rgba(142, 68, 173, 0.36);
  transition: width 0.45s ease;
}

@keyframes clockRing {

  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.45;
  }

  50% {
    transform: scale(1.04);
    opacity: 0.95;
  }
}

/* =========================================
   3. NAVBAR (Minimal App Style)
   ========================================= */
.navbar {
  background-color: var(--nav-bg) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 0.5px solid var(--border);
  padding: 10px 0;
  transition: all 0.4s ease;
}

.navbar-brand {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text) !important;
}

.navbar-nav .nav-link {
  color: var(--text-sub) !important;
  font-weight: 600;
  font-size: 0.95rem;
  margin-left: 20px;
  border-radius: 8px;
  transition: color 0.2s, background-color 0.2s;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--text) !important;
  background: var(--accent-soft);
}

/* Theme Toggle Button */
#theme-toggle {
  background: var(--list-bg);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.3rem;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, color 0.2s;
}

#theme-toggle:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.navbar-toggler {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  padding: 0 10px;
  outline: none;
}

/* =========================================
   4. HERO SECTION
   ========================================= */
.hero-section {
  position: relative;
  padding: 54px 20px 28px;
  text-align: center;
  max-width: 1080px;
  margin: 0 auto;
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 22px 20px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.hero-kicker i {
  animation: softPulse 2.4s ease-in-out infinite;
}

body.dark-mode .hero-kicker {
  background: rgba(17, 22, 32, 0.72);
}

.hero-title {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 15px;
  color: var(--text);
  line-height: 1.02;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-sub);
  line-height: 1.6;
  max-width: 860px;
  margin: 0 auto 12px;
}

/* =========================================
   4.5 RESOURCE TOOLBAR
   ========================================= */
.resource-toolbar {
  max-width: 760px;
  margin: 0 auto 22px;
  padding: 16px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

body.dark-mode .resource-toolbar {
  background: rgba(17, 22, 32, 0.76);
}

.search-box {
  min-width: 0;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-sub);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.search-box input::placeholder {
  color: var(--text-sub);
  font-weight: 600;
}

#clear-search {
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}

#clear-search.is-visible {
  display: inline-flex;
}

/* =========================================
   5. STICKY TABS NAVIGATION
   ========================================= */
.semester-tabs-container {
  position: sticky;
  top: 70px;
  z-index: 900;
  background: transparent;
  padding: 12px 0 18px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  border-bottom: 0;
}

/* Ẩn thanh cuộn nhưng cho phép cuộn ngang gọn gàng trên mobile */
.semester-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  background: var(--surface);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-soft);
  max-width: 100%;
}

.semester-tabs::-webkit-scrollbar {
  display: none;
}

.semester-tabs .nav-link {
  border-radius: 9px;
  padding: 9px 16px;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.semester-tabs .nav-link:hover {
  color: var(--text);
}

.semester-tabs .nav-link.active {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

body.dark-mode .semester-tabs .nav-link.active {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* =========================================
   6. PREMIUM iOS-STYLE LIST VIEW
   ========================================= */
.tab-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 15px 50px;
  animation: fadeInList 0.4s ease forwards;
}

.global-results {
  display: none;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 15px 50px;
}

.global-results.is-visible {
  display: block;
  animation: fadeInList 0.25s ease forwards;
}

.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 14px;
}

.results-kicker {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.results-header h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
}

.results-count {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--list-bg);
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

@keyframes fadeInList {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.78;
  }

  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@keyframes skeletonSweep {
  from {
    background-position: 220% 0;
  }

  to {
    background-position: -220% 0;
  }
}

.course-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.course-item {
  display: flex;
  align-items: center;
  position: relative;
  min-height: 132px;
  padding: 18px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.course-item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--semester-accent, var(--accent));
  opacity: 0.8;
}

.course-item.reveal-card {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
}

.course-item.reveal-card.is-visible {
  animation: cardReveal 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body:not(.is-ready) .course-item {
  background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  background-size: 220% 100%;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}

.course-item:last-child {
  border-bottom: 0.5px solid var(--border);
}

.course-item:hover {
  border-color: rgba(142, 68, 173, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

body.dark-mode .course-item:hover {
  background: #162033;
}

.course-item:active {
  background: rgba(0, 0, 0, 0.05);
  /* Tap highlight */
}

.course-item:focus-visible,
#clear-search:focus-visible,
#theme-toggle:focus-visible,
.navbar-toggler:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Icon / Graphic Left */
.course-icon {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  flex-shrink: 0;
  margin-right: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 10px 24px rgba(15, 23, 42, 0.12);
  transition: transform 0.25s;
  overflow: hidden !important;
  position: relative;
}

.course-thumb {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 12px !important;
  display: block !important;
}

.course-item:hover .course-icon {
  transform: rotate(-2deg) scale(1.06);
}

.course-item:hover .course-action {
  transform: translateX(3px);
}

/* Vibrant App Gradients */
.bg-gradient-1 {
  background: var(--brand-gradient);
}

.bg-gradient-2 {
  background: var(--brand-gradient);
}

.bg-gradient-3 {
  background: var(--brand-gradient);
}

.bg-gradient-4 {
  background: var(--brand-gradient);
}

.bg-gradient-5 {
  background: var(--brand-gradient);
}

.bg-gradient-6 {
  background: var(--brand-gradient);
}

/* Center Text Content */
.course-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.course-tools {
  position: absolute;
  top: 9px;
  right: 10px;
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
}

.course-item:hover .course-tools,
.course-item:focus-within .course-tools {
  opacity: 1;
  transform: translateY(0);
}

.course-tool {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgba(138, 138, 142, 0.14);
  color: var(--text);
  cursor: pointer;
}

.course-status {
  color: var(--accent-3);
  background: rgba(255, 126, 179, 0.12);
}

.course-info h3 {
  font-size: 1.32rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-info p {
  font-size: 0.94rem;
  color: var(--text-sub);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges / Tags */
.tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(138, 138, 142, 0.15);
  color: var(--text-sub);
  padding: 5px 8px;
  border-radius: 8px;
}

.highlight-alert {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
}

.highlight-success {
  color: #8e44ad;
  background: rgba(142, 68, 173, 0.1);
}

.semester-tag {
  color: var(--accent);
  background: var(--accent-soft);
}

body.dark-mode .highlight-alert {
  color: #ff453a;
}

body.dark-mode .highlight-success {
  color: #ff7eb3;
}

/* Right Chevron */
.course-action {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
  margin-left: 10px;
  transition: transform 0.2s, background-color 0.2s;
}

body.dark-mode .course-action {
  color: rgba(235, 235, 245, 0.3);
}

.semester-theme-1 {
  --semester-accent: #ff7eb3;
}

.semester-theme-2 {
  --semester-accent: #8e44ad;
}

.semester-theme-3 {
  --semester-accent: #4facfe;
}

.semester-theme-4 {
  --semester-accent: #ff7eb3;
}

.semester-theme-5 {
  --semester-accent: #8e44ad;
}

.semester-theme-6 {
  --semester-accent: #4facfe;
}

.semester-theme-7 {
  --semester-accent: #ff7eb3;
}

.semester-theme-8 {
  --semester-accent: #8e44ad;
}

.semester-theme-9 {
  --semester-accent: #4facfe;
}

/* =========================================
   7. EMPTY STATE (Trạng thái chờ)
   ========================================= */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  background: var(--surface-strong);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.no-results {
  display: none;
}

.no-results.is-visible {
  display: block;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--text-sub);
  margin-bottom: 15px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.empty-state p {
  font-size: 1rem;
  color: var(--text-sub);
}

/* =========================================
   8. FOOTER
   ========================================= */
footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 20px;
  color: var(--text-sub);
  font-size: 0.9rem;
}

#back-to-top {
  position: fixed;
  right: 18px;
  bottom: 118px;
  z-index: 1090;
  width: 44px;
  height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

#back-to-top.is-visible {
  display: inline-flex;
}

.toast-root {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1400;
  display: grid;
  gap: 10px;
}

.app-toast {
  padding: 11px 13px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 850;
  animation: riseIn 0.25s ease both;
}

.app-toast.error {
  border-color: rgba(255, 59, 48, 0.4);
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

.course-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  padding: 18px;
  background: rgba(8, 13, 22, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.course-modal.is-open {
  display: grid;
  place-items: start center;
}

.modal-card {
  width: min(720px, 100%);
  margin-top: 8vh;
  padding: 14px;
  border: 0.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.modal-card {
  position: relative;
  max-width: 620px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions a,
.modal-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.social-icons {
  margin-bottom: 15px;
}

.social-icons .social-link {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin: 0 5px;
  border-radius: 50%;
  background: var(--list-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-size: 1.1rem;
  transition: all 0.2s;
}

.social-icons .social-link:hover {
  transform: scale(1.1);
  color: var(--accent);
}

/* =========================================
   9. MOBILE OPTIMIZATION
   ========================================= */
@media (max-width: 991px) {
  .navbar-collapse {
    background-color: var(--list-bg);
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    padding: 15px;
    border-radius: 16px;
    border: 0.5px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    z-index: 1000;
  }

  .navbar-nav .nav-link {
    margin-left: 0;
    padding: 12px 15px !important;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 60px;
  }

  .navbar {
    padding: 8px 0;
  }

  .navbar .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .navbar-brand {
    max-width: calc(100vw - 132px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.02rem;
  }

  .hero-section {
    padding: 26px 18px 14px;
    text-align: left;
  }

  .hero-section::before {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.08;
    margin-bottom: 12px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 10px;
  }

  .hero-kicker {
    margin-bottom: 12px;
    font-size: 0.78rem;
  }

  main.container {
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  .resource-toolbar {
    max-width: none;
    margin: 4px 0 10px;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
  }

  .search-box {
    height: 46px;
    padding: 0 12px;
    border-radius: 10px;
  }

  .search-box input {
    font-size: 0.92rem;
  }

  .semester-tabs-container {
    top: 60px;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--bg);
    overflow: hidden;
  }

  .semester-tabs {
    justify-content: flex-start;
    width: 100%;
    padding: 4px;
    border-radius: 12px;
  }

  .semester-tabs .nav-link {
    padding: 8px 13px;
    font-size: 0.84rem;
  }

  .course-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .course-item {
    min-height: 0;
    padding: 13px;
    border-radius: 12px;
    box-shadow: none;
  }

  .course-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    margin-right: 12px;
    font-size: 1.12rem;
    box-shadow: none;
  }

  .course-info h3 {
    font-size: 1.04rem;
    margin-bottom: 1px;
  }

  .course-info p {
    font-size: 0.86rem;
  }

  .tags {
    gap: 6px;
    margin-top: 8px;
  }

  .badge-tag {
    padding: 4px 7px;
    font-size: 0.68rem;
    border-radius: 7px;
  }

  .tab-content,
  .global-results {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 32px;
  }

  .results-header {
    margin: 4px 0 10px;
  }

  .results-header h2 {
    font-size: 1.12rem;
  }

  .results-count {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .course-tools {
    position: static;
    margin-left: auto;
    opacity: 1;
    transform: none;
  }

  .university-clock {
    display: none;
  }

  /* ── Hero Services Mobile ── */

}

@media (max-width: 900px) {
  .course-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-title {
    font-size: 1.82rem;
  }

  .course-item {
    align-items: flex-start;
  }

  .course-action {
    display: none;
  }

  .course-icon {
    width: 40px;
    height: 40px;
    margin-right: 11px;
  }

  /* ── Hero Services Extra Small ── */

  .course-info p {
    white-space: normal;
  }

  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #back-to-top {
    right: 14px;
    bottom: 96px;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    bottom: 76px;
  }

  .course-modal {
    padding: 12px;
  }

  .modal-card {
    margin-top: 4vh;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .course-item.reveal-card {
    opacity: 1;
    transform: none;
  }
}
/* 2. Current minimal theme */
:root {
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #666666;
  --line: #e5e7eb;
  --strong-line: #e5e7eb;
  --primary: #000000;
  --primary-soft: #f8f9fa;
  --success: #000000;
  --warning: #f8f9fa;
  --danger: #000000;
  --list-bg: var(--paper);
  --surface: var(--paper);
  --surface-strong: var(--paper);
  --text: var(--ink);
  --text-sub: var(--muted);
  --border: var(--line);
  --accent: var(--primary);
  --accent-2: var(--primary);
  --accent-3: var(--primary);
  --accent-soft: var(--primary-soft);
  --brand: #000000;
  --brand-soft: rgba(0, 0, 0, .08);
  --brand-pink: #000000;
  --brand-purple: #000000;
  --brand-blue: #000000;
  --brand-gradient: #000000;
  --nav-bg: rgba(255, 255, 255, .95);
  --shadow: 0 4px 15px rgba(0, 0, 0, .05);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, .04);
  --blur: none;
}

body.dark-mode {
  --bg: #111111;
  --bg-soft: #181818;
  --paper: #1f1f1f;
  --ink: #ffffff;
  --muted: #a0a0a0;
  --line: #333333;
  --strong-line: #333333;
  --primary: #ffffff;
  --primary-soft: #252525;
  --success: #ffffff;
  --warning: #1f1f1f;
  --danger: #ffffff;
  --brand: #ffffff;
  --brand-soft: rgba(255, 255, 255, .10);
  --brand-pink: #ffffff;
  --brand-purple: #ffffff;
  --brand-blue: #ffffff;
  --brand-gradient: #ffffff;
  --nav-bg: rgba(17, 17, 17, .95);
  --shadow: 0 4px 15px rgba(255, 255, 255, .05);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, .25);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 82px;
}

body {
  min-height: 100vh;
  padding-top: 72px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", sans-serif;
}

body::before {
  display: none;
}

body.services-open {
  overflow: hidden;
}

a,
button,
input {
  font-family: inherit;
}

::selection {
  background: var(--brand);
  color: #ffffff;
}

/* Header */
.promo-bar,
.university-clock {
  display: none;
}

.navbar {
  top: 0;
  min-height: 72px;
  padding: 0;
  background: var(--paper) !important;
  border-bottom: 0;
  box-shadow: none;
}

.navbar .container-fluid {
  width: min(100%, 1080px);
  min-height: 71px;
  margin: 0 auto;
  padding-inline: 20px !important;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink) !important;
  font-size: .95rem;
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #ffffff;
  font-size: .75rem;
}

.navbar-nav .nav-link {
  margin: 0;
  padding: 9px 12px !important;
  border-radius: 9px;
  color: var(--muted) !important;
  font-size: .8rem;
  font-weight: 600;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  background: var(--primary-soft);
  color: var(--ink) !important;
}

#theme-toggle,
.navbar-toggler {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: none;
  font-size: .8rem;
}

/* Intro */
.hero-section {
  width: min(calc(100% - 40px), 1080px);
  display: block;
  margin: 24px auto 0;
  padding: 72px 32px;
  border: 1px solid transparent;
  border-radius: 24px;
  background: var(--paper);
  text-align: center;
}

.hero-section::before,
.hero-summary {
  display: none;
}

.hero-copy {
  max-width: 780px;
  margin: 0 auto;
}

.hero-kicker,
.section-index,
.section-eyebrow {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  box-shadow: none;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-title {
  max-width: 780px;
  margin: 0 auto 18px;
  color: var(--ink);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: 1.04;
}

.hero-subtitle {
  max-width: 650px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hero-kicker,
body.dark-mode .hero-kicker {
  width: max-content;
  display: inline-flex;
  margin: 0 auto 18px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  box-shadow: none;
}

body.dark-mode .hero-section {
  border-color: var(--line);
  background: var(--bg-soft);
}

.btn-primary-action,
.btn-secondary-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

.btn-primary-action {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff !important;
}

.btn-secondary-action {
  background: var(--paper);
  color: var(--ink) !important;
}

.btn-primary-action:hover,
.btn-secondary-action:hover {
  opacity: .72;
  transform: none;
  box-shadow: none;
}

/* Services */
.motivation-widget {
  position: relative;
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  margin: 36px auto 0;
  padding: 18px 18px 18px 20px;
  overflow: hidden;
  border: 1px solid rgba(142, 68, 173, .28);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-soft), var(--paper) 72%);
  color: var(--ink);
  box-shadow: 0 4px 15px rgba(142, 68, 173, .1);
  text-align: left;
  animation: motivationIn .5s cubic-bezier(.2, .8, .2, 1) both;
}

.motivation-widget::after {
  content: "\201D";
  position: absolute;
  right: 72px;
  bottom: -40px;
  color: var(--brand);
  font-family: Georgia, serif;
  font-size: 8rem;
  line-height: 1;
  opacity: .06;
  pointer-events: none;
}

.motivation-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: var(--brand);
  color: #ffffff;
  font-size: .95rem;
}

.motivation-content {
  min-width: 0;
  transition: opacity .15s ease, transform .15s ease;
}

.motivation-widget.is-changing .motivation-content {
  opacity: 0;
  transform: translateY(4px);
}

.motivation-label {
  display: block;
  margin: 0 0 6px;
  color: var(--brand);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.motivation-content p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  margin: 0;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.5;
}

.motivation-content small,
.motivation-content a {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: .66rem;
  font-weight: 600;
  text-decoration: none;
}

.motivation-content a:hover {
  color: var(--brand);
  text-decoration: underline !important;
}

#motivation-refresh {
  min-width: 86px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .3s ease;
}

#motivation-refresh:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  transform: translateY(-2px);
}

#motivation-refresh:hover i {
  transform: rotate(90deg);
}

#motivation-refresh i {
  transition: transform .3s ease;
}

body.dark-mode .motivation-widget {
  background: linear-gradient(135deg, var(--brand-soft), var(--bg-soft) 72%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .24);
}

@keyframes motivationIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.services-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1500;
  min-width: 278px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid rgba(142, 68, 173, .25);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .16);
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.services-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .2);
}

.services-launcher-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--brand);
  color: #ffffff;
  font-size: .95rem;
}

.services-launcher-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.services-launcher-copy small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--brand);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.services-launcher-copy small::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.services-launcher-copy strong {
  margin-top: 2px;
  font-size: .83rem;
  font-weight: 700;
}

.services-launcher-copy > span {
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.services-launcher-count {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .67rem;
  font-weight: 800;
}

.services-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  visibility: hidden;
  background: rgba(0, 0, 0, .42);
  opacity: 0;
  backdrop-filter: blur(3px);
  transition: opacity .22s ease, visibility .22s ease;
}

.services-backdrop.is-open {
  visibility: visible;
  opacity: 1;
}

.services-section {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1700;
  width: min(calc(100% - 48px), 1180px);
  max-height: calc(100vh - 48px);
  margin: 0;
  padding: 30px;
  overflow-y: auto;
  visibility: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(24px) scale(.98);
  transform-origin: right bottom;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.services-section.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.services-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
}

.services-close:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.services-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.services-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 700;
}

.services-heading p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  border-top: 0;
}

.service-entry {
  position: relative;
  min-height: 286px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  perspective: 1100px;
}

.service-entry:first-child {
  border-left: 0;
}

.service-card-inner {
  height: 100%;
  display: grid;
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.2, .75, .25, 1);
}

.service-entry.is-flipped .service-card-inner {
  transform: rotateY(180deg);
}

.service-card-face {
  min-width: 0;
  display: flex;
  flex-direction: column;
  grid-area: 1 / 1;
  padding: 26px 24px 22px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--bg-soft);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.service-card-back {
  transform: rotateY(180deg);
}

.service-number {
  position: static;
  display: block;
  margin-bottom: 20px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}

.service-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper) !important;
  color: var(--ink);
  font-size: .78rem;
}

.service-entry:nth-child(1) .service-icon {
  border-color: #fed7aa;
  background: #fff7ed !important;
  color: #ff7eb3;
}

.service-entry:nth-child(1) .service-card-face {
  background: #fffaf5;
}

.service-entry:nth-child(2) .service-icon {
  border-color: #bfdbfe;
  background: #eff6ff !important;
  color: #4facfe;
}

.service-entry:nth-child(2) .service-card-face {
  background: #f7faff;
}

.service-entry:nth-child(3) .service-icon {
  border-color: #ddd6fe;
  background: #f5f3ff !important;
  color: #7c3aed;
}

.service-entry:nth-child(3) .service-card-face {
  background: #faf8ff;
}

.service-entry:nth-child(4) .service-icon {
  border-color: #a7f3d0;
  background: #ecfdf5 !important;
  color: #8e44ad;
}

.service-entry:nth-child(4) .service-card-face {
  background: #f5fffb;
}

body.dark-mode .service-entry:nth-child(1) .service-card-face,
body.dark-mode .service-entry:nth-child(2) .service-card-face,
body.dark-mode .service-entry:nth-child(3) .service-card-face,
body.dark-mode .service-entry:nth-child(4) .service-card-face {
  background: var(--bg-soft);
}

body.dark-mode .service-entry:nth-child(1) .service-icon {
  border-color: #7c2d12;
  background: #431407 !important;
  color: #ff7eb3;
}

body.dark-mode .service-entry:nth-child(2) .service-icon {
  border-color: #1e40af;
  background: #172554 !important;
  color: #60a5fa;
}

body.dark-mode .service-entry:nth-child(3) .service-icon {
  border-color: #5b21b6;
  background: #2e1065 !important;
  color: #a78bfa;
}

body.dark-mode .service-entry:nth-child(4) .service-icon {
  border-color: #065f46;
  background: #022c22 !important;
  color: #34d399;
}

.service-entry h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 700;
}

.service-card-front > p {
  min-height: 58px;
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.55;
}

.service-flip-trigger,
.service-flip-back {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: .7rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.service-flip-trigger i {
  color: var(--brand);
  font-size: .56rem;
  transition: transform .2s ease;
}

.service-flip-trigger:hover i {
  transform: translateX(3px);
}

.service-back-label {
  margin-bottom: 8px;
  color: var(--brand);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.service-card-back h3 {
  font-size: 1.05rem;
}

.service-card-back ul {
  display: grid;
  gap: 10px;
  margin: 10px 0 20px;
  padding: 0;
  list-style: none;
}

.service-card-back li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
}

.service-card-back li i {
  margin-top: 2px;
  color: var(--brand);
  font-size: .64rem;
}

.service-flip-back {
  color: var(--brand);
}

.service-flip-back i {
  font-size: .62rem;
}

.service-contact {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink) !important;
  font-size: .72rem;
  font-weight: 700;
}

.service-contact i {
  color: var(--brand);
}

/* Library */
main.container {
  max-width: 1080px;
  padding: 66px 0 80px;
  border: 0;
}

.catalog-layout {
  display: block;
}

.catalog-sidebar {
  display: none;
}

.catalog-main {
  min-width: 0;
  scroll-margin-top: 90px;
}

.library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 22px;
}

.library-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.library-heading p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}

.resource-toolbar {
  max-width: none;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: transparent !important;
  box-shadow: none;
  backdrop-filter: none;
}

.search-box {
  height: 46px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--bg-soft);
  box-shadow: none;
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  transform: none;
}

.search-box input {
  color: var(--ink);
  font-size: .78rem;
  font-weight: 500;
}

.search-box input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.search-box i,
#clear-search {
  color: var(--muted);
}

.semester-tabs-container {
  position: static;
  justify-content: flex-start;
  max-width: none;
  margin: 0 0 22px;
  padding: 0;
  overflow-x: auto;
  background: transparent;
}

.semester-tabs {
  width: 100%;
  min-width: 650px;
  gap: 3px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-soft);
  box-shadow: none;
}

.semester-tabs .nav-item {
  flex: 1 0 auto;
}

.semester-tabs .nav-link {
  padding: 10px 9px;
  border-right: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  text-align: center;
}

.semester-tabs .nav-item:last-child .nav-link {
  border-right: 0;
}

.semester-tabs .nav-link:hover {
  background: var(--primary-soft);
  color: var(--ink);
}

.semester-tabs .nav-link.active,
body.dark-mode .semester-tabs .nav-link.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.tab-content,
.global-results {
  max-width: none;
  padding: 0;
}

/* Course rows */
.course-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 0;
}

.course-item {
  min-width: 0;
  min-height: 128px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 20px;
  overflow: visible;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--bg-soft);
  box-shadow: none;
}

.course-item:nth-child(odd) {
  border-left: 1px solid transparent;
}

.course-item::before {
  display: none;
}

.course-item:hover,
body.dark-mode .course-item:hover {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: var(--paper);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
  transform: translateY(-1px);
}

.course-icon,
.bg-gradient-1,
.bg-gradient-2,
.bg-gradient-3,
.bg-gradient-4,
.bg-gradient-5,
.bg-gradient-6 {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  font-size: .95rem;
}

.course-icon.bg-gradient-1 {
  background: #fff1f2;
  color: #e11d48;
}

.course-icon.bg-gradient-2 {
  background: #eff6ff;
  color: #4facfe;
}

.course-icon.bg-gradient-3 {
  background: #ecfdf5;
  color: #8e44ad;
}

.course-icon.bg-gradient-4 {
  background: #f5f3ff;
  color: #7c3aed;
}

.course-icon.bg-gradient-5 {
  background: #fffbeb;
  color: #8e44ad;
}

.course-icon.bg-gradient-6 {
  background: #fdf2f8;
  color: #ff7eb3;
}

body.dark-mode .course-icon.bg-gradient-1 {
  background: #4c0519;
  color: #fb7185;
}

body.dark-mode .course-icon.bg-gradient-2 {
  background: #172554;
  color: #60a5fa;
}

body.dark-mode .course-icon.bg-gradient-3 {
  background: #022c22;
  color: #34d399;
}

body.dark-mode .course-icon.bg-gradient-4 {
  background: #2e1065;
  color: #a78bfa;
}

body.dark-mode .course-icon.bg-gradient-5 {
  background: #451a03;
  color: #fbbf24;
}

body.dark-mode .course-icon.bg-gradient-6 {
  background: #500724;
  color: #f472b6;
}

body.dark-mode .course-item:hover {
  border-color: #3b3b3b;
  background: #252525;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

body.dark-mode .services-launcher {
  border-color: rgba(79, 172, 254, .35);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .42);
}

body.dark-mode .services-backdrop {
  background: rgba(0, 0, 0, .68);
}

.course-item:hover .course-icon {
  transform: none;
}

.course-info {
  min-width: 0;
  display: block;
  padding: 0;
  overflow: visible;
}

.course-info h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
}

.course-info p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.45;
  white-space: normal;
}

.tags {
  gap: 4px;
  margin-top: 8px;
}

.badge-tag,
.highlight-alert,
.highlight-success,
.semester-tag,
.course-status,
body.dark-mode .highlight-alert,
body.dark-mode .course-status {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: .56rem;
  font-weight: 600;
}

.highlight-alert,
.course-status,
body.dark-mode .highlight-alert,
body.dark-mode .course-status {
  border-color: transparent;
  background: #fff1f2;
  color: #e11d48;
}

.highlight-success,
body.dark-mode .highlight-success {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}

body.dark-mode .highlight-alert,
body.dark-mode .course-status {
  background: #4c0519;
  color: #fb7185;
}

.course-status,
body.dark-mode .course-status {
  border-color: transparent;
  background: #fff7ed;
  color: #ff7eb3;
}

body.dark-mode .course-status {
  background: #431407;
  color: #ff7eb3;
}

.course-action {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: .65rem;
}

.course-action::before {
  display: none;
}

.course-tools {
  top: 9px;
  right: 9px;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .1);
  backdrop-filter: blur(10px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.course-item:hover .course-tools,
.course-item:focus-within .course-tools {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.course-tool {
  width: auto;
  min-width: 0;
  height: 32px;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: .62rem;
  font-weight: 700;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.course-tool i {
  font-size: .65rem;
}

.course-tool:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.course-tool-primary,
.course-tool-primary:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.course-tool:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.results-header {
  padding: 8px 0 14px;
}

.results-count {
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-soft);
  box-shadow: none;
}

.misc-resources {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  padding: 22px;
  border: 1px dashed var(--strong-line);
  border-radius: 16px;
  background: var(--bg-soft);
}

.misc-resources-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}

.misc-resources h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 700;
}

.misc-resources p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
}

/* Dialogs and footer */
#back-to-top {
  right: 18px;
  bottom: 112px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.course-modal {
  padding: 24px;
  overflow-y: auto;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(7px);
}

body.course-modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(650px, 100%);
  max-width: 650px;
  margin-top: 4vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .24);
}

.modal-close {
  top: 18px;
  right: 18px;
  z-index: 4;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: none;
}

.modal-close:hover {
  background: var(--primary-soft);
  color: var(--brand);
  transform: none;
}

.modal-course-hero {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 28px 76px 23px 28px;
  border-bottom: 1px solid var(--line);
}

.modal-course-hero .course-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 16px;
  font-size: 1.2rem;
}

.modal-course-title {
  min-width: 0;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--brand);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.modal-course-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.025em;
}

.modal-course-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.course-modal-content {
  padding: 20px 28px 24px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.modal-tags .badge-tag {
  padding: 4px 7px;
  background: var(--bg-soft);
}

.modal-tags .semester-tag {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}

.modal-info-list {
  display: grid;
}

.modal-info-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 13px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.modal-info-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .8rem;
}

.modal-info-item h3 {
  margin: 1px 0 5px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 750;
}

.modal-info-item p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.58;
}

.modal-meta-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.modal-meta-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 13px;
  background: var(--bg-soft);
  color: var(--ink);
}

.modal-meta-item > i {
  color: var(--brand);
  font-size: .84rem;
}

.modal-meta-item.is-ready > i {
  color: #8e44ad;
}

.modal-meta-item.is-pending > i {
  color: #ff7eb3;
}

.modal-meta-item div {
  min-width: 0;
}

.modal-meta-item span,
.modal-meta-item strong {
  display: block;
}

.modal-meta-item span {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: .57rem;
  font-weight: 650;
  text-transform: uppercase;
}

.modal-meta-item strong {
  overflow: hidden;
  color: var(--ink);
  font-size: .68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 15px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.modal-actions a,
.modal-actions button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  font-size: .7rem;
  font-weight: 700;
}

.modal-actions a:hover,
.modal-actions button:hover {
  border-color: var(--strong-line);
  background: var(--paper);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.modal-actions .modal-action-primary {
  margin-left: auto;
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.modal-actions .modal-action-primary:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  opacity: .88;
}

.modal-actions .modal-action-primary.is-pending {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

body.dark-mode .course-modal {
  background: rgba(0, 0, 0, .76);
}

body.dark-mode .modal-card {
  box-shadow: 0 28px 90px rgba(0, 0, 0, .56);
}

.app-toast {
  border: 1px solid var(--strong-line);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

footer {
  padding: 38px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.social-icons .social-link {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}

@media (max-width: 1120px) {
  main.container {
    padding-inline: 20px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 64px;
  }

  .navbar {
    min-height: 64px;
  }

  .navbar .container-fluid {
    min-height: 63px;
  }

  .navbar-collapse {
    position: absolute;
    top: 100%;
    right: 20px;
    width: 200px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
  }

  .navbar-nav {
    align-items: stretch !important;
  }

  .hero-section {
    width: calc(100% - 32px);
    margin-top: 12px;
    padding: 46px 20px;
    border-radius: 20px;
  }

  .hero-title {
    font-size: 2.45rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn-primary-action,
  .btn-secondary-action {
    width: 100%;
  }

  .services-section {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    padding: 28px 18px 20px;
    border-radius: 20px;
  }

  .services-heading,
  .library-heading {
    display: block;
  }

  .services-heading p,
  .library-heading p {
    margin-top: 8px;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .services-launcher {
    right: 14px;
    bottom: 14px;
    min-width: 0;
    width: min(310px, calc(100% - 28px));
  }

  .motivation-widget {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    margin-top: 28px;
    padding: 16px;
  }

  .motivation-icon {
    width: 42px;
    height: 42px;
  }

  #motivation-refresh {
    grid-column: 2;
    width: max-content;
    min-width: 0;
  }

  .service-entry,
  .service-entry:first-child {
    border-left: 0;
  }

  .service-card-front > p {
    min-height: 0;
    margin-bottom: 22px;
  }

  .service-contact {
    width: 100%;
    justify-content: center;
  }

  #back-to-top {
    right: 18px;
    bottom: 102px;
  }

  main.container {
    padding: 50px 16px 60px;
  }

  .course-list {
    grid-template-columns: 1fr;
  }

  .course-item,
  .course-item:nth-child(odd) {
    border-left: 1px solid transparent;
  }

  .course-tools {
    display: none;
  }

  footer {
    padding-bottom: 36px;
  }

  .course-modal {
    padding: 12px;
  }

  .modal-card {
    margin-top: 2vh;
    border-radius: 20px;
  }

  .modal-course-hero {
    padding: 22px 60px 18px 18px;
  }

  .modal-course-hero .course-icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    border-radius: 14px;
  }

  .course-modal-content {
    padding: 16px 18px 20px;
  }

  .modal-meta-strip {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    padding: 13px 18px;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 2.15rem;
  }

  .course-item {
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    gap: 11px;
    padding: 16px 13px;
  }

  .course-icon,
  .bg-gradient-1,
  .bg-gradient-2,
  .bg-gradient-3,
  .bg-gradient-4,
  .bg-gradient-5,
  .bg-gradient-6 {
    width: 42px;
    height: 42px;
  }

  .motivation-content small {
    display: none;
  }
}

/* Mobile focus mode: keep the study flow compact and distraction-free. */
@media (max-width: 768px) {
  body {
    padding-top: 60px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .navbar,
  .navbar .container-fluid {
    min-height: 60px;
  }

  .navbar .container-fluid {
    padding-inline: 14px !important;
  }

  .navbar-brand {
    font-size: .9rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  #theme-toggle,
  .navbar-toggler {
    width: 40px;
    height: 40px;
  }

  .hero-section {
    width: 100%;
    margin: 0;
    padding: 28px 16px 24px;
    border-inline: 0;
    border-radius: 0;
    text-align: left;
  }

  .hero-kicker {
    display: none;
  }

  .hero-title {
    margin: 0 0 10px;
    font-size: 2rem;
    line-height: 1.08;
    text-align: left;
  }

  .hero-subtitle {
    margin: 0 0 18px;
    font-size: .84rem;
    line-height: 1.55;
    text-align: left;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .btn-primary-action,
  .btn-secondary-action {
    width: 100%;
    min-height: 44px;
    padding-inline: 14px;
  }

  .hero-actions .btn-secondary-action {
    order: -1;
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff !important;
  }

  .hero-actions .btn-primary-action {
    border-color: var(--line);
    background: var(--paper);
    color: var(--ink) !important;
  }

  .motivation-widget {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 10px;
    margin-top: 20px;
    padding: 14px;
    border-radius: 16px;
    box-shadow: none;
  }

  .motivation-widget::after,
  .motivation-icon {
    display: none;
  }

  .motivation-label {
    margin-bottom: 4px;
    font-size: .58rem;
  }

  .motivation-content p {
    -webkit-line-clamp: 2;
    font-size: .82rem;
    line-height: 1.42;
  }

  .motivation-content a {
    overflow: hidden;
    margin-top: 5px;
    font-size: .6rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #motivation-refresh {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
  }

  #motivation-refresh span {
    display: none;
  }

  .services-launcher {
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    min-width: 0;
    grid-template-columns: 40px minmax(0, 1fr) 26px;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  }

  .services-launcher-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .services-launcher-copy small {
    display: none;
  }

  .services-launcher-copy strong {
    font-size: .78rem;
  }

  .services-launcher-copy > span {
    margin-top: 1px;
    font-size: .58rem;
  }

  .services-launcher-count {
    width: 26px;
    height: 26px;
  }

  main.container {
    padding: 28px 16px 48px;
  }

  .library-heading {
    margin-bottom: 14px;
  }

  .library-heading .section-eyebrow,
  .library-heading p {
    display: none;
  }

  .library-heading h2 {
    font-size: 1.28rem;
  }

  .resource-toolbar {
    margin-bottom: 10px;
  }

  .search-box {
    height: 44px;
    padding-inline: 12px;
    border-color: var(--line);
    border-radius: 12px;
    background: var(--paper);
  }

  .search-box input {
    font-size: .82rem;
  }

  .semester-tabs-container {
    position: sticky;
    top: 60px;
    z-index: 30;
    margin: 0 -16px 6px;
    padding: 8px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(10px);
    scrollbar-width: none;
  }

  .semester-tabs-container::-webkit-scrollbar {
    display: none;
  }

  .semester-tabs {
    width: max-content;
    min-width: 0;
    gap: 6px;
    padding: 0;
    background: transparent;
  }

  .semester-tabs .nav-item {
    flex: 0 0 auto;
  }

  .semester-tabs .nav-link {
    min-width: 62px;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    font-size: .72rem;
  }

  .course-list {
    gap: 0;
    border-block: 1px solid var(--line);
  }

  .course-item,
  .course-item:nth-child(odd) {
    min-height: 0;
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    gap: 11px;
    padding: 14px 2px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }

  .course-item:last-child {
    border-bottom: 0;
  }

  .course-item:hover,
  body.dark-mode .course-item:hover {
    border-color: var(--line);
    background: var(--bg-soft);
    box-shadow: none;
    transform: none;
  }

  .course-icon,
  .bg-gradient-1,
  .bg-gradient-2,
  .bg-gradient-3,
  .bg-gradient-4,
  .bg-gradient-5,
  .bg-gradient-6 {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    font-size: .82rem;
  }

  .course-info h3 {
    margin-bottom: 2px;
    font-size: .9rem;
  }

  .course-info p {
    -webkit-line-clamp: 1;
    font-size: .7rem;
  }

  .course-item .tags,
  .course-tools {
    display: none !important;
  }

  .course-action {
    display: flex;
    width: 18px;
    color: var(--muted);
  }

  .course-action i {
    display: none;
  }

  .course-action::after {
    content: "\f05a";
    font-family: "Font Awesome 6 Free";
    font-size: .82rem;
    font-weight: 900;
  }

  .course-item.reveal-card,
  .course-item.reveal-card.is-visible {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .misc-resources {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    border-style: solid;
  }

  .misc-resources-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .misc-resources h3 {
    font-size: .9rem;
  }

  .misc-resources p {
    font-size: .68rem;
  }

  .services-section {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 90dvh;
    padding: 24px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    transform-origin: center bottom;
  }

  .services-section .section-index,
  .services-heading p,
  .service-number {
    display: none;
  }

  .services-heading {
    margin-bottom: 16px;
  }

  .services-heading h2 {
    font-size: 1.3rem;
  }

  .services-close,
  .modal-close {
    width: 44px;
    height: 44px;
  }

  .services-grid {
    gap: 10px;
  }

  .service-entry {
    min-height: 196px;
  }

  .service-card-face {
    padding: 16px;
  }

  .service-icon {
    margin-bottom: 10px;
  }

  .service-card-front > p {
    min-height: 0;
    margin-bottom: 16px;
  }

  .service-contact {
    width: 100%;
    justify-content: center;
    margin-top: 14px;
  }

  #back-to-top {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  footer {
    padding: 24px 16px;
  }

  .social-icons {
    margin-bottom: 10px;
  }

  .social-icons .social-link {
    width: 36px;
    height: 36px;
  }

  .course-modal {
    align-items: end;
    padding: 0;
  }

  .course-modal.is-open {
    place-items: end center;
  }

  .modal-card {
    position: relative;
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: 0;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
  }

  .modal-card::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 5;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--strong-line);
    transform: translateX(-50%);
  }

  .modal-course-hero {
    padding: 22px 58px 18px 18px;
  }

  .course-modal-content {
    padding: 16px 18px 18px;
  }

  .modal-tags,
  .modal-meta-strip {
    display: none !important;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 28px color-mix(in srgb, var(--paper) 88%, transparent);
  }

  .modal-actions .modal-action-primary {
    width: 100%;
    min-height: 48px;
    margin: 0;
    font-size: .78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .service-card-inner {
    transition-duration: .01ms;
  }

  .motivation-widget {
    animation: none;
  }
}

/* Portfolio color and typography synchronization */
.navbar {
  background: var(--nav-bg) !important;
}

.navbar-brand,
.hero-title {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

h1,
h2,
h3,
.services-heading h2,
.library-heading h2,
.course-info h3,
.modal-course-copy h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
}

.navbar-nav .nav-link,
button,
.btn-primary-action,
.btn-secondary-action,
.semester-tabs .nav-link,
.badge-tag,
label {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.motivation-label,
.section-index,
.section-eyebrow,
.modal-meta-item span,
.results-kicker {
  font-family: "Inter", "Poppins", sans-serif;
}

.brand-mark,
.semester-tabs .nav-link.active,
body.dark-mode .semester-tabs .nav-link.active,
.btn-primary-action,
.services-launcher-icon,
.modal-action-primary,
#university-progress-bar {
  background: var(--brand-gradient);
  color: #ffffff;
}

.course-icon,
.course-icon.bg-gradient-1,
.course-icon.bg-gradient-2,
.course-icon.bg-gradient-3,
.course-icon.bg-gradient-4,
.course-icon.bg-gradient-5,
.course-icon.bg-gradient-6,
body.dark-mode .course-icon.bg-gradient-1,
body.dark-mode .course-icon.bg-gradient-2,
body.dark-mode .course-icon.bg-gradient-3,
body.dark-mode .course-icon.bg-gradient-4,
body.dark-mode .course-icon.bg-gradient-5,
body.dark-mode .course-icon.bg-gradient-6 {
  background: var(--brand-gradient);
  color: #ffffff;
}

.course-item:hover,
.search-box:focus-within,
.course-item:focus-visible,
#theme-toggle:focus-visible,
.navbar-toggler:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .08), var(--shadow);
}

/* Monochrome primary brand controls */
.brand-mark,
.btn-primary-action,
.hero-actions .btn-primary-action {
  border-color: #000000;
  background: #000000;
  color: #ffffff !important;
}

.brand-mark,
body.dark-mode .brand-mark {
  overflow: hidden;
  border-color: transparent;
  background: transparent;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

body.dark-mode .brand-mark,
body.dark-mode .btn-primary-action,
body.dark-mode .hero-actions .btn-primary-action {
  border-color: #ffffff;
  background: #ffffff;
  color: #000000 !important;
}

.service-entry:nth-child(1) .service-icon,
.service-entry:nth-child(2) .service-icon,
.service-entry:nth-child(3) .service-icon,
.service-entry:nth-child(4) .service-icon,
.motivation-icon,
.services-launcher-icon,
.misc-resources-icon,
.course-tool-primary,
.course-tool-primary:hover,
.modal-actions .modal-action-primary,
.modal-actions .modal-action-primary:hover,
.service-contact {
  border-color: #000000;
  background: #000000 !important;
  color: #ffffff !important;
}

body.dark-mode .service-entry:nth-child(1) .service-icon,
body.dark-mode .service-entry:nth-child(2) .service-icon,
body.dark-mode .service-entry:nth-child(3) .service-icon,
body.dark-mode .service-entry:nth-child(4) .service-icon,
body.dark-mode .motivation-icon,
body.dark-mode .services-launcher-icon,
body.dark-mode .misc-resources-icon,
body.dark-mode .course-tool-primary,
body.dark-mode .course-tool-primary:hover,
body.dark-mode .modal-actions .modal-action-primary,
body.dark-mode .modal-actions .modal-action-primary:hover,
body.dark-mode .service-contact {
  border-color: #ffffff;
  background: #ffffff !important;
  color: #000000 !important;
}

body.dark-mode .course-item:hover,
body.dark-mode .search-box:focus-within,
body.dark-mode .course-item:focus-visible,
body.dark-mode #theme-toggle:focus-visible,
body.dark-mode .navbar-toggler:focus-visible {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .10), var(--shadow);
}

.service-entry:nth-child(1) .service-card-face,
.service-entry:nth-child(2) .service-card-face,
.service-entry:nth-child(3) .service-card-face,
.service-entry:nth-child(4) .service-card-face {
  background: var(--bg-soft);
}

.highlight-alert,
.highlight-success,
.course-status,
.semester-tag,
.results-kicker,
.results-count,
.services-launcher-copy small,
.services-launcher-count,
.modal-meta-item.is-ready > i,
.modal-meta-item.is-pending > i {
  color: var(--ink);
}

.highlight-alert,
.highlight-success,
.course-status,
.semester-tag,
.results-count,
.services-launcher-count {
  background: var(--brand-soft);
}

/* Flat subject colors: restrained, recognizable, and gradient-free */
.course-icon.bg-gradient-1,
body.dark-mode .course-icon.bg-gradient-1 {
  background: #000000;
  color: #f97316;
}

.course-icon.bg-gradient-2,
body.dark-mode .course-icon.bg-gradient-2 {
  background: #000000;
  color: #3b82f6;
}

.course-icon.bg-gradient-3,
body.dark-mode .course-icon.bg-gradient-3 {
  background: #000000;
  color: #10b981;
}

.course-icon.bg-gradient-4,
body.dark-mode .course-icon.bg-gradient-4 {
  background: #000000;
  color: #8b5cf6;
}

.course-icon.bg-gradient-5,
body.dark-mode .course-icon.bg-gradient-5 {
  background: #000000;
  color: #eab308;
}

.course-icon.bg-gradient-6,
body.dark-mode .course-icon.bg-gradient-6 {
  background: #000000;
  color: #f43f5e;
}
