body {
    font-family: Arial, sans-serif;
    max-width: 100ch;
    margin: 40px;
    margin-inline: max(1em, (100% - 100ch) / 2);
    line-height: 1.6;
}

h1, h2 {
    color: #333;
}
.contact {
    margin-bottom: 20px;
}
.section {
    margin-bottom: 20px;
}

nav ul,
nav li {
  display: contents;
}

nav {
  display: flex;
  margin-bottom: 1.5em;
  border-bottom: 1px solid oklch(80% 3% 200); /* cool gray */
}

nav a {
  flex: 1;
  text-align: center;
  padding: 0.5em;
  text-decoration: none;
  color: inherit;
}

nav a:hover {
  background-color: #eee; /* subtle hover effect */
}

nav a.current {
  border-bottom: 0.4em solid oklch(90% 3% 200); /* thicker and lighter version of cool gray */
  padding-bottom: 0.1em; /* compensate for border height */
  font-weight: bold;
}

:root {
    --color-accent: oklch(65% 50% 0); /* your chosen accent color */
    accent-color: var(--color-accent); /* for form elements, etc. */
 }

nav a:hover {
    background-color: #7625f8;
    border-bottom: 0.4em solid var(--color-accent);
}

nav a {
    border-bottom: 0.4em solid transparent; /* keeps height consistent */
    transition: border-color 0.3s ease;
}

form {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 1em 2em; /* row gap and column gap */
  max-width: 700px;
  margin: 0 auto;
  align-items: center;
}

form label {
  text-align: right;
  align-self: center;
  white-space: nowrap; /* Prevent labels from wrapping */
}

form input,
form textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.5em;
}

form textarea {
  min-height: 6em;
  resize: vertical;
}

form button {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 0.75em 1.25em;
  font: inherit;
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 1.5em;
  padding: 2em 1em;
}

.projects article {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  background: #f9f9f9;
  padding: 1em;
  border-radius: 0.5em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.projects article:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.projects img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: 1em;
}

.projects h2 {
  margin: 0;
  font-size: 1.25em;
}

.projects img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
}

.projects p {
  margin: 0;
  line-height: 1.5;
}

h1 {
  font-size: 300%;
  line-height: 1.1;
  text-wrap: balance;
  margin-bottom: 1em;
}

h2, h3, h4, h5, h6 {
  font-size: 100%;
  line-height: 1.1;
  text-wrap: balance;
}

/* Step 4.1: Enable automatic dark mode */
html {
  color-scheme: light dark;
  background-color: canvas;
  color: canvastext;
}

/* Border color that adapts better */
nav {
  --border-color: oklch(50% 10% 200 / 40%);
  border-bottom: 1px solid var(--border-color);
}

/* Step 4.3: Position the theme switch top-right */
label.color-scheme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 80%;
  font-family: inherit;
}

/* Make form controls match fonts */
input, textarea, button, select {
  font-family: inherit;
  font-size: 1rem;
}

/* Optional: adaptive hover background */
nav a:hover {
  background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
}

/* Optional: style for current page link */
nav a.current {
  font-weight: bold;
  text-decoration: underline;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
}

.stats-grid dt {
  grid-row: 1;
  font-weight: bold;
}

.stats-grid dd {
  grid-row: 2;
  margin: 0;
}

.centered {
  text-align: center;
}

hr {
  border: none;
  height: 2px;
  background-color: #ccc;
  margin: 2rem 0;
}

.project-year {
  font-family: Baskerville, serif;
  color: gray;
  font-variant-numeric: oldstyle-nums;
  margin-top: 0.5rem;
}

.container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2em;
  margin-top: 2em;
  justify-content: center;
  flex-wrap: wrap;
}

#projects-pie-plot {
  max-width: 20em;
  aspect-ratio: 1 / 1;
  overflow: visible;
}

#projects-pie-plot path {
  transition: 500ms;
}

#projects-pie-plot:hover:has(path:hover) path:not(:hover) {
  opacity: 0.5;
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9em, 1fr));
  gap: 1em;
  padding: 1em;
  margin: 0;
  border: 1px solid #ccc;
  list-style: none;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.swatch {
  width: 1em;
  height: 1em;
  aspect-ratio: 1 / 1;
  background-color: var(--color);
  border-radius: 0.25em;
  display: inline-block;
}

.searchBar {
  font: inherit;
  padding: 0.75em 1em;
  border-radius: 0.5em;
  border: 1px solid oklch(70% 5% 200 / 50%);
  margin: 1.5em auto;
  display: block;
  width: min(100%, 30ch);
  background-color: canvas;
  color: canvastext;
}

.searchBar:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px oklch(70% 50% 0 / 40%);
}

.selected {
  --color: oklch(60% 45% 0) !important;
}

.selected:is(path) {
  fill: var(--color);
}

path {
  fill: var(--color);
  cursor: pointer;
}

.gridlines line {
  stroke: #ccc;
  stroke-opacity: 0.4;
  shape-rendering: crispEdges;
}

.gridlines path {
  display: none;
}

.dots circle {
  transition: fill 0.2s;
}

#scrolly-1 {
  position: relative;
  display: flex;
  gap: 1rem;

  > * {
    flex: 1;
  }
}

#scatter-story {
  position: relative;
}

#scatter-plot {
  position: sticky;
  top: 0;
  left: 0;
  bottom: auto;
  height: 50vh;
}

.project-link {
  text-decoration: none;
  color: inherit;
  display: block;
}