/*
 * Global styles
 *
 * Colors are defined using CSS variables so that dark mode can be toggled.
 * See the :root and [data-theme='dark'] definitions below.  When you
 * introduce a new element, avoid hard‑coded colours; instead refer to
 * variables such as --bg-color, --card-bg, --text-color, etc.  This
 * ensures that the site adapts gracefully between light and dark modes.
 */

:root {
  --bg-color: #f7f9fc;
  --header-bg: #ffffff;
  --text-color: #333333;
  --text-secondary: #555555;
  --text-muted: #888888;
  --card-bg: #ffffff;
  --border-color: #e0e0e0;
  --primary-color: #007bff;
  --primary-hover: #0056b3;
  --link-color: #007bff;
  --link-hover-color: #0056b3;
  --cloud-color: #ffffff;
  --ground-color: #d3dbe4;
  --button-text-color: #ffffff;
  --toggle-glow: rgba(0, 123, 255, 0.35);
}

[data-theme='dark'] {
  --bg-color: #1e2230;
  /* Use the same background colour for the header and page body to
     eliminate subtle horizontal bands when switching to dark mode. */
  --header-bg: #1e2230;
  --text-color: #eaeaea;
  --text-secondary: #b5b5b5;
  --text-muted: #888888;
  --card-bg: #2b3145;
  --border-color: #3c425c;
  --primary-color: #6c9eff;
  --primary-hover: #8ab0ff;
  --link-color: #6c9eff;
  --link-hover-color: #8ab0ff;
  --cloud-color: #3a415a;
  --ground-color: #4a536e;
  --button-text-color: #ffffff;
  --toggle-glow: rgba(108, 158, 255, 0.45);
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Fixed header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--header-bg);
  /* Remove the bottom border to avoid a light strip remaining in dark mode */
  border-bottom: none;
  z-index: 100;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
}

nav .logo {
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text-color);
}

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

nav .nav-links a {
  text-decoration: none;
  color: var(--text-color);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

nav .nav-links a:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--primary-color);
}

/* Highlight the active link on scroll (optional). We can enhance with JS later. */
nav .nav-links a.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* Theme toggle button */
.theme-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  border: none;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-color);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  transition: color 0.3s ease, transform 0.3s ease, background-color 0.4s ease,
              box-shadow 0.4s ease, border-color 0.4s ease;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--toggle-glow) 0%, rgba(0, 0, 0, 0) 65%);
  opacity: 0;
  transform: scale(0.6);
}

.theme-toggle:hover {
  color: var(--primary-color);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-toggle.is-animating {
  animation: theme-toggle-spin 0.6s ease;
}

.theme-toggle.is-animating::after {
  animation: theme-toggle-pulse 0.6s ease;
}

@keyframes theme-toggle-spin {
  0% {
    transform: scale(1) rotate(0);
  }
  50% {
    transform: scale(1.15) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

@keyframes theme-toggle-pulse {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  40% {
    opacity: 0.6;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}
/* Hero section styling */
.hero-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  /* Use a solid background colour for the hero.  Gradients can
     introduce subtle horizontal bands between the header and page
     content, particularly when switching themes.  A single colour
     ensures the transition from the fixed header is seamless. */
  background-color: var(--bg-color);
  padding-top: 80px; /* allow space for fixed header */
  text-align: center;
}

.hero-section h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.hero-section p {
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-secondary);
}

/* Call to action button in hero section */
.cta-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6rem 1.2rem;
  background-color: var(--primary-color);
  color: var(--button-text-color);
  border-radius: 4px;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Content section base styling */
.content-section {
  padding: 4rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

.content-section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  border-left: 4px solid var(--primary-color);
  padding-left: 0.5rem;
}

/* Team grid */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.team-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Team avatar styling */
.team-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.team-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.team-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  color: var(--text-color);
}

.team-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Awards list styling */
.awards-list {
  list-style: none;
  padding: 0;
}

.awards-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.awards-list li::before {
  content: '🏆';
  position: absolute;
  left: 0;
  top: 0;
}

/* Awards container styles: cards for each award */
.award-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Timeline styling */
.timeline {
  position: relative;
  border-left: 2px solid var(--border-color);
  margin-left: 1rem;
  padding-left: 1rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.05rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  background-color: var(--primary-color);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--card-bg) inset;
}

.timeline-item h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.timeline-item ul {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding-left: 1rem;
}

.timeline-item li {
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Generic reveal animation for sections or cards */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Culture list styling */
.culture-list {
  list-style: none;
  padding: 0;
}

.culture-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 1rem;
}

.culture-list li::before {
  content: '🌟';
  position: absolute;
  left: 0;
  top: 0;
}

/* Small helper text */
.small-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Contact form styling */
.contact-form {
  max-width: 600px;
  margin-top: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  color: var(--text-color);
}

.contact-form input[type="text"],
.contact-form textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background-color: var(--card-bg);
  color: var(--text-color);
}

.contact-form input[type="text"]:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.submit-button {
  display: inline-block;
  background-color: var(--primary-color);
  color: var(--button-text-color);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.submit-button:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/*
 * Embedded game section
 * The iframe hosts the open‑source T‑Rex runner game.  We give it
 * consistent dimensions and remove borders.  In dark mode the entire
 * iframe is inverted via a CSS filter so that the white background
 * becomes dark.  The hue‑rotate offset helps preserve colours.
 */
.game-section {
  margin: 0;
  width: 100%;
}

.dino-iframe {
  width: 100vw;
  max-width: none;
  height: 200px;
  border: none;
  pointer-events: none;
  display: block;
  /* Provide a smooth transition when switching themes */
  transition: filter 0.4s ease;
}

[data-theme='dark'] .dino-iframe {
  filter: invert(1) hue-rotate(180deg);
}

/* Teacher page styling */
.teacher-hero {
  padding-bottom: 2rem;
}

.teacher-subtitle {
  margin-top: -0.5rem;
  color: var(--text-secondary);
}

.teacher-profile {
  display: grid;
  grid-template-columns: minmax(90px, 110px) 1fr;
  gap: 1.5rem;
  align-items: center;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.teacher-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-size: 2.2rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary-color), var(--link-hover-color));
}

.teacher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  position: relative;
  z-index: 1;
}

.teacher-avatar span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 0;
}

.teacher-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.teacher-header h3 {
  margin: 0;
  font-size: 1.6rem;
}

.teacher-title {
  margin: 0.3rem 0 0;
  color: var(--text-secondary);
  font-weight: 500;
}

.teacher-role {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 0.9rem;
}

.teacher-summary {
  margin: 1rem 0 0.75rem;
  color: var(--text-secondary);
}

.teacher-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.teacher-tags span {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.teacher-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.teacher-stats div {
  padding: 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  text-align: center;
}

.teacher-stats strong {
  display: block;
  font-size: 1.4rem;
  color: var(--text-color);
}

.teacher-stats span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.teacher-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.teacher-card h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
  color: var(--text-color);
}

.teacher-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
}

.teacher-card li {
  margin-bottom: 0.5rem;
}

.teacher-note {
  margin-top: 1.25rem;
}

@media (max-width: 720px) {
  .teacher-profile {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .teacher-header {
    justify-content: center;
  }

  .teacher-tags {
    justify-content: center;
  }
}

/* Resources grid styling */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.resource-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.45s cubic-bezier(0.2, 0, 0.2, 1),
              box-shadow 0.45s cubic-bezier(0.2, 0, 0.2, 1),
              border-color 0.35s ease;
  will-change: transform, box-shadow;
}

.resource-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.05);
}

.resource-card:hover::before {
  opacity: 1;
}
.resource-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  color: var(--text-color);
}

.resource-card p {
  margin: 0;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.resource-card a {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--link-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.resource-card a:hover {
  text-decoration: underline;
}

/*
 * Team member tags and blog link styling
 */
.tags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  background-color: var(--primary-color);
  color: var(--button-text-color);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Align the member name and blog link in the same row */
.member-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* Blog link styling.
 * The blog link uses an inline SVG defined in script.js, so there is
 * no need for image filters.  The icon inherits the current colour
 * from its parent anchor.  On hover, the colour changes to the
 * primary hover colour to provide feedback.  */
.blog-link {
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.blog-link svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0;
}

.blog-link:hover {
  color: var(--primary-hover);
}

/*
 * Page container and transitions. Each page (home, team, awards, culture,
 * join) is absolutely positioned on top of each other. Only the page
 * with the .active class is visible. Others are hidden via opacity
 * and pointer-events. The transform provides a subtle slide effect.
 */
#pages {
  position: relative;
  width: 100%;
  /* Ensure children are stacked on top of each other */
  height: auto;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transform: translateX(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  /* Provide some base padding top for non-home pages to avoid header overlap */
  min-height: 100vh;
  padding-top: 70px;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.award-card .award-event {
  font-weight: 600;
  color: var(--text-color);
}

.award-card .award-details {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Dino game area styling */
#gameArea {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background-color: var(--bg-color);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

/*
 * Smooth dark mode transitions
 *
 * When toggling between light and dark themes, smoothly animate the
 * background, text, border and shadow colours for key interface
 * elements. We deliberately avoid setting a global transition on all
 * elements to preserve the existing page fade animations.
 */
html, body, header, nav, .team-card, .award-card, .resource-card,
.teacher-card, .teacher-profile, .teacher-stats div, .teacher-role,
.contact-form input[type="text"], .contact-form textarea, .submit-button,
footer, .timeline, .culture-list li, .cta-button, .hero-section {
  transition: background-color 0.4s ease, color 0.4s ease,
              border-color 0.4s ease, box-shadow 0.4s ease;
}



/* Footer styling */
footer {
  background-color: var(--header-bg);
  padding: 1rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background-color 0.4s ease, color 0.4s ease;
}
