/* ========== Base / Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}

/* ========== Helpers ========== */
.container {
  width: min(100% - 2rem, 900px);
  margin-inline: auto;
}

/* ========== Header ========== */
.site-header {
  background: #0a66c2;
  color: #fff;
  padding: 0.75rem 0 0; /* room for the nav strip below */
}

.site-header .brand {
  padding: 1rem 0 0.5rem;
}

.course-title {
  margin: 0;
  font-size: 1.6rem; /* slightly larger for visibility */
  font-weight: 700;
}

.subtitle {
  margin: 0.2rem 0 0;
  opacity: 0.9;
  font-size: 1rem;
}

/* Navigation */
.site-nav {
  position: relative;
  margin-top: 0.5rem; /* small breathing room */
}

/* Top-level menu */
.site-nav > ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  display: flex; /* horizontal */
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.site-nav a {
  color: #eaf3ff;
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  display: inline-block;
}

.site-nav a:hover,
.site-nav a:focus {
  background: rgba(255, 255, 255, 0.18);
}

/* Active/current-page styles */
.site-nav a.active,
.site-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
  font-weight: 600;
}

/* If a submenu item is active, style the parent link */
.site-nav .has-submenu.active > a {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 600;
}

/* Dropdown */
.site-nav li {
  position: relative;
}

.site-nav .has-submenu > a {
  padding-right: 1.8rem;
}

.site-nav .has-submenu > a::after {
  content: "▾";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.9;
}

.site-nav .submenu {
  position: absolute;
  left: 0;
  top: 100%;
  background: #0a66c2;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.4rem;
  width: max-content;
  min-width: 0;
  max-width: 12rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 1000;
}

.site-nav .submenu a {
  white-space: normal;
}

/* Show submenu on hover or keyboard focus */
.site-nav .has-submenu:hover .submenu,
.site-nav .has-submenu:focus-within .submenu {
  display: flex;
}

/* ========== Main Content ========== */
main {
  flex: 1;
  padding: 1.25rem 0 2rem;
}

.card {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h2 {
  margin-top: 0.25rem;
}

/* Links */
a {
  color: #0a66c2;
}

a:hover,
a:focus {
  text-decoration: underline;
}

/* ========== Images ========== */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
}

.card img {
  max-width: 90%; /* scale relative to container width */
  margin-left: auto;
  margin-right: auto;
}

figure {
  text-align: center;
  margin: 0;
}

/* Desktop refinement */
@media (min-width: 720px) {
  .card img {
    max-width: 300px; /* cap image size on larger screens */
  }
}

/* ========== Footer ========== */
.site-footer {
  background: #fff;
  border-top: 1px solid #e6e6e6;
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.footer-nav a {
  color: #0a66c2;
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover,
.footer-nav a:focus {
  text-decoration: underline;
}

/* Hide content until header/footer are injected */
html.hf-wait body {
  visibility: hidden;
}
html.hf-ready body {
  visibility: visible;
}
