@media (max-width: 700px) {
  .bio {
    flex-direction: column;
    align-items: center;
  }
  /* Left-align bio paragraphs while keeping the name centered */
  .bio-text {
    text-align: left;
  }
  .bio-text h1 {
    text-align: center;
  }
  .bio-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transform: none;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
  padding: 0;
  }

  .bio-text p:last-child {
    margin-bottom: 0;
  }
}
/* Profile photo styling */
#profilePhoto {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  display: block;
  margin: 0 auto;
}
/* Nautical Color Palette */
:root {
  --navy: #0b3d91;
  --aqua: #00a9c0;
  --sand: #f1e3d3;
  --white: #ffffff;
  --gray: #f5f5f5;
  --highlight: #ff6f61;
  --dark-navy: #c0d6f0;
  --transition-speed: 0.4s;
  --side-gap: 40px; /* site-level horizontal gap used to compute centered items */
}

body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--gray);
  color: var(--navy);
  line-height: 1.5;
  font-size: 16px;
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Dark Mode Colors */
body.dark-mode {
  --navy: #c0d6f0;
  --aqua: #3399cc;
  --sand: #1b2a49;
  --white: #e0f0ff;
  --gray: #0b1a33;
  --highlight: #ff8c6a;
  --dark-navy: #0b3d91;
  background-color: var(--gray);
  color: var(--navy);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 50px var(--side-gap);
  transition: background-color var(--transition-speed), color var(--transition-speed);
  position: relative; /* positioning context for the top-right toggle */
}

/* Bio Section */
.bio {
  display: flex;
  align-items: center; /* align row items so h1 and toggle line up vertically */
  gap: 40px;
  margin-bottom: 50px;
}

.bio-text {
  flex: 1;
  position: relative;
  padding-right: 0; /* toggle moved out of this container */
  margin-bottom: 0;
}

/* brand: logo + heading inline */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap; /* prevent the logo + name from wrapping to multiple lines */
} 

.site-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

/* adjust heading now that it's inside .brand */
.bio-text h1 {
  font-size: 2em;
  margin: 0; /* keep heading vertically aligned with logo */
  color: var(--navy);
  transition: color var(--transition-speed);
  display: inline-block;
  white-space: nowrap; /* keep name on a single line */
} 

.bio-text p {
  font-size: 0.95em;
  color: var(--navy);
  max-width: 600px;
  transition: color var(--transition-speed);
}

.bio-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 50px;
}

.bio-right img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--aqua);
  object-fit: cover;
  transition: border-color var(--transition-speed);
}

/* place toggle at the top-right of the container (to the right of the header and above the bio/photo) */
.container .dark-toggle-slider {
  position: absolute;
  right: 20px; /* align with container's horizontal padding */
  top: 52px;   /* sits below the container top padding so it's visually to the right of the h1 and above photo */
  z-index: 50;
}

/* Dark Mode Toggle Slider */
.dark-toggle-slider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 80px;
  height: 34px;
  border-radius: 50px;
  background-color: var(--aqua);
  cursor: pointer;
  padding: 0 2px; /* smaller padding for full travel */
}

/* Hide checkbox */
.dark-toggle-slider input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Slider circle */
.dark-toggle-slider .slider-circle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 30px;
  height: 30px;
  background-color: var(--white);
  border-radius: 50%;
  transition: transform 0.3s ease;
  z-index: 2; /* ensure above background but below icons if needed */
}

/* Icons */
.dark-toggle-slider .icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  color: var(--navy);
  pointer-events: none;
  z-index: 3; /* on top of circle */
}

.dark-toggle-slider .icon.sun {
  left: 8px;
}

.dark-toggle-slider .icon.moon {
  right: 8px;
  color: var(--dark-navy);
}

/* Move circle when checked */
.dark-toggle-slider input:checked + .slider-circle {
  transform: translateX(50px); /* slider width - circle width - 2*padding */
}

/* Contact Bar */
.contact-bar {
  display: flex;
  justify-content: flex-start;
  gap: 25px;
  margin-bottom: 50px;
  font-size: 0.95em;
}

.contact-bar a {
  text-decoration: none;
  color: var(--aqua);
  font-weight: bold;
  transition: color var(--transition-speed);
}

.contact-bar a:hover {
  color: var(--highlight);
}

/* Projects Section */
.projects {
  display: flex; /* stack vertically and center children */
  flex-direction: column;
  align-items: center; /* center project-item blocks inside the projects container */
  gap: 50px;
}

/* Grid layout: image in left column, text on right spanning rows, meta becomes second row */
.project-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  width: calc(100% - (2 * var(--side-gap))); /* respect site side gap for even spacing */
  max-width: 820px; /* cap to container inner width */
  margin: 0 auto 50px auto; /* center and add bottom spacing */
  background-color: var(--white);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  transition: transform 0.3s, background-color var(--transition-speed);
  align-items: start;
  box-sizing: border-box;
}

.project-item:hover {
  transform: translateY(-5px);
}

.dark-mode .project-item {
  background-color: var(--sand);
}

.project-image {
  width: 200px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  justify-self: start;
}

/* Project text sits on the right in the first row; meta occupies the second row to avoid overlap */
.project-text {
  grid-column: 2 / 3;
  grid-row: 1 / 2; /* only the top row */
}

/* Ensure grid rows adapt to content height */
.project-item {
  grid-auto-rows: auto;
}

/* Give breathing room below project description so meta doesn't bump into it */
.project-text p {
  margin-bottom: 8px;
}
.project-text h2 {
  margin-top: 0;
  margin-bottom: 0; /* remove default bottom margin for h2 */
  font-size: 1.4em;
  color: var(--navy);
  transition: color var(--transition-speed);
}

.project-text p {
  margin-bottom: 0;
  margin-top: 0; /* remove space between h2 and paragraph */
  font-size: 0.95em;
  color: #333;
  transition: color var(--transition-speed);
  color: var(--navy);
  transition: color var(--transition-speed);
}

/* Project metadata becomes the second row and starts under the image */
.project-meta {
  grid-column: 1 / 3; /* span full width but starts at left edge under the image */
  grid-row: 2 / 3;
  display: flex;
  gap: 6px; /* reduced spacing between meta items */
  flex-direction: column;
  align-items: flex-start;
}

/* Reset spacing inside meta children to avoid extra gaps from default margins */
.project-meta > div {
  margin: 0;
  padding: 0;
}

.project-meta .project-tech,
.project-meta .project-awards,
.project-meta .project-links {
  line-height: 1.25;
} 

/* Nautical link styles for Bio and Projects */

.bio-text a,
.project-links a {
  color: var(--aqua); /* default link color (distinct from paragraph text) */
  text-decoration: none; /* remove underline as requested */
  transition: color var(--transition-speed), transform 0.12s ease;
}

.bio-text a:hover,
.project-links a:hover {
  color: var(--highlight); /* hover color switched to highlight */
  transform: translateY(-1px);
}

.bio-text a:focus-visible,
.project-links a:focus-visible {
  outline: 3px solid rgba(0,169,192,0.18); /* accessible focus ring using aqua */
  outline-offset: 3px;
  border-radius: 4px;
}

/* Collaborator links: light blue, no underline, normal weight (not bold) */
.project-meta .project-awards a {
  color: var(--aqua);
  text-decoration: none;
  font-weight: 400; /* normal weight */
  transition: color var(--transition-speed);
}

.project-meta .project-awards a:hover {
  color: var(--highlight);
  transform: none;
}

.project-meta .project-awards a:focus-visible {
  outline: 3px solid rgba(0,169,192,0.18);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Layout and styling for project link groups */
.project-links {
  display: flex;
  gap: 12px; /* space between each link */
  flex-wrap: wrap;
  align-items: center;
  justify-content: center; /* center links within project-meta */
  align-self: center; /* center the group within the project-meta row */
}

.project-links a {
  font-weight: 700; /* bold links */
}

/* Removed external link arrow icons — prefer cleaner links */

/* Small screens: even side margins for project items */
@media (max-width: 480px) {
  /* reduce the site-level side gap for narrow viewports */
  :root { --side-gap: 16px; }

  /* Keep container padded so project items are centered within the site */
  .container {
    padding-left: var(--side-gap);
    padding-right: var(--side-gap);
    padding-top: 18px;
    padding-bottom: 18px;
  }

  /* Make project items fill container width and remain centered */
  .project-item {
    width: 100%;
    max-width: none;
    margin: 0 auto 20px auto; /* centered in container */
    padding: 14px; /* slightly reduced padding to fit smaller screens */
    box-sizing: border-box;
    display: block;
  }
}

/* Footer */
footer {
  text-align: center;
  margin: 60px 0 30px;
  color: var(--navy);
  font-size: 0.9em;
  transition: color var(--transition-speed);
}

/* Responsive */
@media (max-width: 768px) {
  .bio {
    flex-direction: column;
    text-align: center;
  }

  /* Left-align bio paragraphs while keeping the name centered */
  .bio-text {
    text-align: left;
  }
  .bio-text h1 {
    text-align: center;
  }

  /* center the brand on small screens */
  .brand {
    justify-content: center;
  }

  .site-logo {
    width: 36px;
    height: 36px;
  }

  .bio-right img {
    margin-bottom: 10px;
  }

  .contact-bar {
    justify-content: center;
  }

  .project-item {
    /* switch to single-column grid on small screens */
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-items: start; /* left-align stack items */
  }

  .project-image {
    width: 100%;
    height: auto;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }

  .project-text {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    text-align: left; /* left-align body text */
  }

  /* Keep project headings centered for visual emphasis */
  .project-text h2 {
    text-align: center;
  }

  .project-meta {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    align-items: flex-start; /* left-align meta items */
    text-align: left;
  }

  /* Ensure project links are centered on small screens */
  .project-links {
    justify-content: center;
  }

  /* Ensure toggle stacks under heading on small screens and stays intact */
  .container .dark-toggle-slider {
    position: relative; /* keep relative so slider circle and icons stay inside */
    transform: none;
    margin: -64px auto 80px auto; /* slightly reduced space below so toggle is closer to the name */
    display: block; /* center as a block above the heading */
    width: 80px; /* fixed width so it centers and stays intact */
    margin-left: auto;
    margin-right: auto;
    z-index: 50;
    white-space: nowrap;
    text-align: center;
  }

  /* add extra top spacing to the bio on small screens so the name won't overlap */
  .bio {
    margin-top: 12px;
  }

  /* Keep a consistent fixed width so the toggle doesn't break into pieces */
  .dark-toggle-slider {
    width: 80px;
    height: 34px;
    padding: 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    border-radius: 50px;
    box-sizing: border-box;
  }

  .dark-toggle-slider .slider-circle {
    width: 30px;
    height: 30px;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
  }

  /* Move the circle when checked; exact calc keeps it inside the container */
  .dark-toggle-slider input:checked + .slider-circle {
    transform: translateX(calc(80px - 30px - 4px)); /* 46px */
  }

  /* Keep icons absolutely positioned and balanced so they don't collide */
  .dark-toggle-slider .icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1em;
    color: var(--navy);
    pointer-events: none;
    z-index: 3;
  }

  .dark-toggle-slider .icon.sun {
    left: 8px;
  }

  .dark-toggle-slider .icon.moon {
    right: 8px;
  }
}
