/* =================================================================
   RSCM course site
   Palette is an approximation of NTU's red and blue. Swap the hex
   values below for the official ones if you have them.
   ================================================================= */

:root {
  --red: #c8102e;
  --red-dark: #9e0d24;
  --navy: #1b2a49;
  --blue: #2a4d8f;
  --text: #2b2f3a;
  --text-light: #626a7c;
  --bg: #ffffff;
  --bg-alt: #f4f5f8;
  --border: #dfe2ea;

  --max-width: 900px;
}

/* ---------- Reset and base ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Alan Sans', -apple-system, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.02em;
}

a {
  color: var(--red);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--red-dark);
  text-decoration: underline;
}

/* ---------- Typography ---------- */
h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  color: var(--navy);
  font-weight: 600;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.6rem;
  line-height: 1.3;
  color: var(--navy);
  font-weight: 600;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.2rem;
  color: var(--navy);
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

p {
  margin-bottom: 1rem;
}

main ul,
main ol {
  margin: 0 0 1rem 1.5rem;
}

main li {
  margin-bottom: 0.25rem;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  padding: 2rem 0 4rem;
  min-height: calc(100vh - 220px);
}

/* ---------- Header and navigation ---------- */
.site-header {
  background: var(--bg);
  border-top: 5px solid var(--red);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.site-title:hover {
  color: var(--red);
  text-decoration: none;
}

.nav-links {
  list-style: none;
  margin: 0;
  display: flex;
  gap: 2rem;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--red);
  border-bottom-color: var(--red);
  text-decoration: none;
}

/* Hamburger button: hidden on desktop, shown on phones */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.3rem 0.6rem;
  color: var(--navy);
  cursor: pointer;
}

/* ---------- Home page ---------- */
.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}

.lede {
  font-size: 1.25rem;
  color: var(--text-light);
}

.intro {
  margin-top: 2rem;
}

.video-embed {
  margin-top: 2.5rem;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Carousel ---------- */
.carousel {
  position: relative;
  margin: 1.5rem 0;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 6px;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  position: relative;
}

.carousel-slide img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Project carousels show the whole image (posters, long graphics) */
.project .carousel-slide img {
  object-fit: contain;
  background: var(--bg-alt);
}

.carousel-slide figcaption {
  padding: 0.6rem 0.25rem 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 50%;
  background: rgba(27, 42, 73, 0.75);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.carousel-btn:hover {
  background: var(--red);
}

.carousel-btn.prev { left: 0.75rem; }
.carousel-btn.next { right: 0.75rem; }

/* ---------- Projects listing ---------- */
.year-section {
  margin: 2.5rem 0;
  padding-top: 1.5rem;
  border-top: 3px solid var(--red);
}

.year-section h2 {
  margin-top: 0;
}

.year-brief {
  color: var(--text-light);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.project-card {
  display: block;
  background: var(--bg-alt);
  border-radius: 6px;
  overflow: hidden;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(27, 42, 73, 0.12);
  text-decoration: none;
  color: var(--text);
}

.project-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.project-card h3 {
  margin: 0;
  padding: 1rem 1rem 0.25rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

.project-card p {
  margin: 0;
  padding: 0 1rem 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ---------- Individual project page ---------- */
.eyebrow {
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.team {
  color: var(--text-light);
  font-size: 1.05rem;
}

.writeup {
  margin-top: 2rem;
}

/* Images in a write-up: full column width, never cropped */
.writeup img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 4px;
}

/* Images in a write-up: 2X2 Grid */
.writeup .image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 1rem;
  margin: 1.5rem 0;
}

.writeup .image-grid img {
  width: 100%;
  height: auto;
  margin: 0;
}

@media (max-width: 600px) {
  .writeup .image-grid {
    grid-template-columns: 1fr;
  }
}

/* Consecutive images on adjacent lines sit side by side */
.writeup p:has(> img:nth-child(2)),
.image-row {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
}

.writeup p:has(> img:nth-child(2)) img,
.image-row img {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.back {
  margin-top: 3rem;
}

/* Download button for the final report */
.report-link a {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--red);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.report-link a:hover {
  background: var(--red-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}

/* ---------- Plain pages (About, Trivia, etc.) ---------- */

/* On the trivia page each year is a ## heading */
.page h2 {
  padding-top: 1rem;
  border-top: 3px solid var(--red);
  font-size: 2rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: #c9cfdd;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.15rem 0;
}

.site-footer a {
  color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  .hero h1 { font-size: 2rem; }
  h2 { font-size: 1.4rem; }

  .container,
  .nav-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .nav-container {
    position: relative;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
  }

  .nav-links.active {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem 1rem 1rem;
  }

  .nav-links li {
    padding: 0.5rem 0;
  }

  .carousel-btn {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.3rem;
  }

  /* Side-by-side images stack on phones */
  .writeup p:has(> img:nth-child(2)),
  .image-row {
    flex-direction: column;
  }
}
