/* Mathematical accents over the original course design. */
:root { --math-grid: rgba(37, 99, 235, .055); }
[data-theme="dark"] { --math-grid: rgba(125, 211, 252, .055); }
body {
  background-image: linear-gradient(var(--math-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--math-grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.math-ribbon {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .65rem; margin: 0 0 1.5rem; position: relative; z-index: 1;
  pointer-events: none; user-select: none;
}
.math-ribbon span {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .45rem .85rem; border-radius: 12px;
  font-family: 'Fira Code', Consolas, monospace; font-size: .95rem;
  font-weight: 500; letter-spacing: -.025em; color: #1d4ed8;
  background: #eff6ff; border: 1px solid #bfdbfe;
  box-shadow: 0 3px 0 rgba(37, 99, 235, .08);
}
.math-ribbon span:nth-child(2) { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; transform: rotate(3deg); }
.math-ribbon span:nth-child(3) { color: #047857; background: #ecfdf5; border-color: #a7f3d0; transform: rotate(-3deg); }
.math-ribbon span:nth-child(4) { color: #b45309; background: #fffbeb; border-color: #fde68a; }
[data-theme="dark"] .math-ribbon span { color: #93c5fd; background: #172b4a; border-color: #315384; }
[data-theme="dark"] .math-ribbon span:nth-child(2) { color: #c4b5fd; background: #302449; border-color: #5b4580; }
[data-theme="dark"] .math-ribbon span:nth-child(3) { color: #6ee7b7; background: #143c35; border-color: #276558; }
[data-theme="dark"] .math-ribbon span:nth-child(4) { color: #fcd34d; background: #3d321e; border-color: #766137; }
.hero-content > .math-ribbon { justify-content: flex-start; }
.math-course-symbol {
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 2.4rem; font-weight: 600; color: var(--primary);
  letter-spacing: -.075em; line-height: 1.25;
}
.portal-card .math-course-symbol { width: fit-content; padding: .35rem .8rem; background: var(--primary-light); border-radius: 14px; }
/* Accessibilitat i navegació per teclat compartida */
:focus-visible {
  outline: 2px solid var(--primary, #2563eb) !important;
  outline-offset: 3px !important;
}

.skip-link {
  position: absolute;
  top: -120px;
  left: 1rem;
  z-index: 9999;
  padding: 0.6rem 1.2rem;
  background: var(--primary, #2563eb);
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Botó estàndard de retorn al curs des de subwebs/presentacions */
.btn-return-course {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary, #2563eb);
  text-decoration: none;
  border: 1px solid rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-return-course:hover {
  background: var(--primary, #2563eb);
  color: #ffffff;
  transform: translateX(-2px);
}

@media (max-width: 600px) {
  .math-ribbon { gap: .5rem; }
  .math-ribbon span { padding: .35rem .6rem; font-size: .85rem; }
  .portal-grid { grid-template-columns: minmax(0, 1fr); }
  .btn-return-course { font-size: 0.8rem; padding: 0.3rem 0.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background-image: none; }
  .math-ribbon { display: none; }
}

