/*
 * Global styles for Dennis Startsev’s personal website.
 *
 * Colour palette:
 *   --primary-color: a rich purple used for navigation and headings.
 *   --secondary-color: a complementary blue used in gradients and accents.
 *   --background-color: a subtle off‑white to keep the page bright and easy on
 *     the eyes.
 *   --text-color: dark grey for readability.
 */

:root {
  --primary-color: #6655aa;
  --secondary-color: #4872c0;
  --background-color: #f7f5fb;
  --text-color: #333333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Navigation bar styling */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: #ffffff;
  flex-wrap: wrap;
}

.navbar .logo {
  font-size: 1.8rem;
  font-weight: bold;
}

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

.navbar .nav-links a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.navbar .nav-links a:hover {
  opacity: 0.8;
}

/* Ensure navigation wraps nicely on small screens when many items are present */
.navbar .nav-links {
  flex-wrap: wrap;
}

/* Hero section uses a gradient and centers its text */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #ffffff;
}

.hero h1 {
  margin: 0;
  font-size: 2.4rem;
}

.hero p {
  margin-top: 0.8rem;
  font-size: 1.2rem;
}

/* Section styling */
section {
  padding: 3rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

section h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

section p {
  margin-top: 0;
  margin-bottom: 1.2rem;
}

/* Publication list */
#pub-list {
  list-style: disc;
  padding-left: 1.5rem;
}

#pub-list li {
  margin-bottom: 0.8rem;
}

/* Education list */
#edu-list {
  list-style: disc;
  padding-left: 1.5rem;
}

#edu-list li {
  margin-bottom: 0.8rem;
}

footer {
  background-color: var(--primary-color);
  color: #ffffff;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
 * About section styling
 *
 * The about section introduces Dennis with a portrait alongside text.  It
 * uses a flexbox container so that on wider screens the image and text sit
 * side by side, while on smaller screens they wrap gracefully.  The image
 * itself is styled as a circle with a coloured border that complements
 * the site’s palette.
 */

.about-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
}

/* Ensure the portrait remains a consistent size and retains its aspect ratio */
.about-image img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--secondary-color);
}

/* Allow text to take up the remaining space */
.about-content {
  flex: 1 1 300px;
}

/* ---------------------------------------------------------------------------
 * Research section figure alignment
 */
.research-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
}
.research-image img {
  width: 100%;
  max-width: 400px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.research-content {
  flex: 1 1 300px;
}
/* ---------------------------------------------------------------------------
 * Project figures
 *
 * Figures on the projects page are displayed at full width up to a
 * reasonable maximum and include a subtle shadow to separate them from
 * the page background.  They are responsive and will shrink on narrow
 * screens while maintaining their aspect ratio.
 */

.project-figure {
  width: 100%;
  max-width: 800px;
  border-radius: 6px;
  display: block;
  margin: 1rem auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ---------------------------------------------------------------------------
 * CV download link
 *
 * The CV link on the contact page is styled as a button to draw attention.
 */

.cv-download {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background-color: var(--secondary-color);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.cv-download:hover {
  background-color: #345ca7;
}

/* Styles specific to the demo section */
.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.demo-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: var(--text-color);
}

.demo-controls input {
  padding: 0.3rem;
  margin-top: 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.demo-controls button {
  padding: 0.5rem 1rem;
  background-color: var(--secondary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.demo-controls button:hover {
  background-color: #345ca7;
}

/* Chart styling: add a light border around the canvas */
#demo-chart {
  width: 100%;
  max-width: 600px;
  border: 1px solid #ddd;
  background-color: #ffffff;
  display: block;
  margin: 0 auto 1rem;
}

#demo-output {
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* Play area overlay */
#play-area {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

#dc-cell,
.pathogen {
  position: absolute;
  pointer-events: auto;
}

#dc-cell {
  width: 80px;
  height: 80px;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 50% 50%, #5da9f2, #346aa1 80%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  clip-path: polygon(
    50% 0%, 62% 8%, 74% 6%, 66% 18%, 86% 24%, 72% 34%, 100% 50%, 72% 66%,
    86% 76%, 66% 82%, 74% 94%, 62% 92%, 50% 100%, 38% 92%, 26% 94%, 34% 82%,
    14% 76%, 28% 66%, 0% 50%, 28% 34%, 14% 24%, 34% 18%, 26% 6%, 38% 8%
  );
}

#dc-cell::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #1a2e55, #0d1a2e 80%);
  opacity: 0.8;
  pointer-events: none;
}

.pathogen {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffc107, #c21807 70%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  cursor: grab;
  user-select: none;
}
.pathogen::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.pathogen:active {
  cursor: grabbing;
}

#toggle-play {
  display: block;
  margin: 0 auto 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--secondary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

#toggle-play:hover {
  background-color: #345ca7;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .navbar .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 1rem;
  }
  section {
    padding: 2rem 1rem;
  }
}
