:root {
  color-scheme: light;
  --bg-main: #2d2a72;
  --bg-main-soft: #3a378f;
  --text-dark: #1b1b1b;
  --text-light: #ffffff;
  --primary: #4f7cff;
  --primary-soft: #e8edff;
  --muted: #6b6b6b;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

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

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

.bg-shape {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 20% 20%,
    rgba(255, 255, 255, 0.16),
    transparent 45%
  );
  opacity: 0.4;
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  padding: 32px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  color: var(--text-light);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo img {
  width: 40px;
  height: 40px;
  filter: brightness(0%) invert(100%);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}

.nav a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.hero-content {
  width: min(1100px, 92vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
}

.hero h1 {
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  line-height: 1.05;
}

.sub {
  color: rgba(255, 255, 255, 0.75);
  max-width: 620px;
}

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

.btn {
  padding: 12px 20px;
  border-radius: 999px;
  background: #ffffff;
  color: #1b1b1b;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.btn.ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  margin: 0 auto 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.semester {
  padding: 18px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.semester-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.semester-header h2 {
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.semester-header p {
  color: var(--muted);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.resource-overview {
  padding: 0;
  overflow: hidden;
  position: relative;
  border-radius: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.resource-overview:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
}

.resource-cover {
  width: 100%;
  height: clamp(160px, 22vw, 220px);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #ddd3c4;
  border-radius: 14px;
  position: relative;
  transition: transform 0.25s ease;
}

.resource-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
  border-radius: 14px;
}

.resource-overview:hover .resource-cover {
  transform: scale(1.02);
}

.resource-cover.is-empty {
  background-image: linear-gradient(
    130deg,
    rgba(16, 22, 31, 0.15),
    rgba(242, 140, 40, 0.2)
  );
}

.resource-overview .resource-head,
.resource-overview .resource-warning,
.resource-overview .resource-cta {
  padding: 0;
}
.sae-card {
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
}
.sae-link {
  position: relative;
  display: block;
  min-height: clamp(200px, 22vw, 260px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sae-card .resource-cover {
  height: 100%;
  min-height: inherit;
  border-radius: 18px;
  transition: transform 0.45s ease;
}
.sae-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  color: var(--text-light);
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.75));
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.sae-cta {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition:
    background 0.3s ease,
    transform 0.3s ease;
}
.sae-link:hover .resource-cover,
.sae-link:focus-visible .resource-cover {
  transform: scale(1.05);
}

.sae-link:hover .sae-cta,
.sae-link:focus-visible .sae-cta {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

.resource-link {
  display: block;
  position: relative;
  color: inherit;
}

.resource-overview .resource-head {
  position: absolute;
  left: 16px;
  bottom: 16px;
  color: var(--text-light);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  max-width: calc(100% - 32px);
}

.resource-cta {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #1b1b1b;
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.resource-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.25);
}

.resource-detail {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.detail-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.back-link {
  color: var(--primary);
  font-weight: 600;
}

.resource-callout {
  padding: 16px;
  border-radius: 18px;
  background: var(--primary-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-card {
  background: var(--card);
  color: var(--text-dark);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  transform: translateY(12px);
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
  animation-delay: var(--delay, 0s);
}

.resource-card:hover {
  transform: translateY(0);
}

.resource-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.resource-code {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.resource-detail .resource-code {
  color: var(--primary);
}

.resource-title {
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 1.4rem;
  line-height: 1.15;
}

.resource-count {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
  border-radius: 999px;
}

.resource-detail .resource-count {
  color: #1f1f1f;
  background: rgba(0, 0, 0, 0.08);
}

.resource-warning {
  font-size: 0.85rem;
  color: #b23b00;
}

.resource-card.is-missing {
  border-color: rgba(178, 59, 0, 0.3);
  box-shadow: 0 18px 30px rgba(178, 59, 0, 0.18);
}

.resource-card.resource-overview {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.resource-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.resource-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #f3f3f3;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.resource-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(16, 22, 31, 0.2);
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #d9d9d9;
}

.thumb.is-empty {
  background-image: linear-gradient(
    130deg,
    rgba(16, 22, 31, 0.15),
    rgba(242, 140, 40, 0.2)
  );
}

.item-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f1f1f;
}

.item-subtitle {
  font-size: 0.8rem;
  color: #6b6b6b;
}

.item-subtitle.is-empty {
  color: #a07c5b;
  font-style: italic;
}

.resource-links .empty,
.empty-section {
  color: var(--muted);
  font-size: 0.9rem;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 24px 16px 40px;
  color: var(--text-light);
}

.footer div {
  width: min(1100px, 92vw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.footer img {
  width: 110px;
  filter: brightness(0%) invert(100%);
}

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

@media (min-width: 720px) {
  .hero {
    padding: 40px 24px 32px;
  }
}

@media (max-width: 540px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    flex-wrap: wrap;
  }

  .resource-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer div {
    flex-direction: column;
    align-items: flex-start;
  }
}
