html {
    --color-accent: oklch(85% 0.15 300);
    accent-color: var(--color-accent);
    color-scheme: light dark;
}

body {
    /* Set line height to 1.5 times the font size
        and use the OS's UI font as the website font
        */
    font: 100%/1.5 system-ui;
    max-width: 100ch;
    margin-inline: max(1em, (100% - 100ch) / 2);
    padding: 24px;
}

.me-img {
  border-radius: 8px;
}

nav ul, nav li {
    display:contents;
}

nav {
    --border-color: oklch(50% 10% 200 / 40%);
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

nav a.current {
    border-bottom: 0.4em solid var(--border-color);
    padding-bottom: 0.1em;
}

nav a:hover {
    border-bottom: 0.4em solid var(--color-accent);
    background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
}

/* contact form */
form {
    font: inherit;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1em;

}

form input, form textarea {
    font: inherit;
}

form label {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    gap: 0.5em;
}

form button {
    grid-column: 1 / -1;
}

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

.projects article {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  gap: 1em;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1rem;
  background: white;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.projects img {
  width: 100%;
  border-radius: 8px;
}

.projects h2 {
    margin: 0;
}

h1 {
    font-size: 400%;
    line-height: 1.1;
    text-wrap: balance;
}

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

ul {
    padding-left: 1.2em;
    margin-bottom: 1em;
}

li {
    margin-bottom: 0.5em;
}

section {
    margin-bottom: 2em;
    padding-block: 1em;
    border-bottom: 1px solid oklch(90% 3% 200);
}

.resume article {
    margin-bottom: 1.5em;
}

.resume h4 {
  font-size: 1.25em;
  margin-bottom: 0.25em;
}

.resume h4 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
}

.resume h4 + ul {
    margin-top: 0;
}

.color-scheme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 80%;
  font-family: inherit;
}

form input,
form textarea,
form button,
select {
  font: inherit;
}

#profile-stats dl {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 1rem;

  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1rem;
  background: white;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

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

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

.project-info {
    display: flex;
    flex-direction: column;
}

.project-year {
  color: gray;
  font-family: Baskerville, serif;
  font-variant-numeric: oldstyle-nums;
  margin-top: 0.2em;
  font-size: 0.9em;
}

.project-year::before {
  content: "— ";
  color: gray;
}

/* pie chart */
#projects-plot {
    width: 100%;
    max-width: 20em;
    min-width: 8em;
    margin-block: 2em;
    flex: 1 1 12em;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    overflow: visible;
}

.chart-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2em;
  flex-wrap: nowrap;
  margin: 2em auto;
  max-width: 900px;
}

.legend {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 1em;
  border: 1px solid #ccc;
  border-radius: 0.5em;
  gap: 0.5em 1em;
  flex: 1;
  max-width: 25em;
  box-sizing: border-box;
  grid-template-columns: repeat(3, 1fr);
}

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

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

@media (max-width: 700px) {
  .legend {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 450px) {
  .legend {
    grid-template-columns: 1fr;
  }
}

/* Italic for value */
.legend-item em {
  font-style: italic;
  color: #555;
}

&:has(path:hover) {
  path:not(:hover) {
    opacity: 0.5;
  }
}

path {
  cursor: pointer;
  transition: 300ms;
}

.selected {
  --color: oklch(85% 0.15 300) !important;

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

.searchBar {
  display: block;
  width: 100%;
  max-width: 450px;
  margin: 0.5rem auto 1rem auto; /* 🔧 Moved closer to projects */
  padding: 0.65rem 1.2rem;       /* 🔧 Reduced height slightly */
  font-size: 1.05rem;
  border: 1px solid #ccc;
  border-radius: 25px;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease-in-out;
}