/* base */
html {
  color-scheme: light dark;
  --color-accent: oklch(65% 50% 0);
  --border-color: oklch(50% 10% 200 / 40%);
  --text-muted: color-mix(in oklch, canvastext, canvas 40%);
  accent-color: var(--color-accent);
}

body {
  font: 100%/1.5 system-ui, sans-serif;
  max-width: 100ch;
  margin-inline: max(1em, (100% - 100ch) / 2);
  padding: 1em;
  background-color: canvas;
  color: canvastext;
}

h1 {
  font-size: 400%;
  margin-block: 0.5em;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 0;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

.intro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.intro-text {
  max-width: 600px;
  text-align: left;
}

.intro img {
  max-width: 300px;
  width: 100%;
  height: auto;
}

/* Github main page styling */
.github-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
  text-align: center;
}

.github-stats dt {
  grid-row: 1;
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.github-stats dd {
  grid-row: 2;
  margin: 0;
  font-size: 2.5rem;
  font-weight: bold;
}

#profile-stats {
  margin-top: 1rem;
}

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

/* navigation */
nav ul,
nav li {
  display: contents;
}

nav {
  display: flex;
  margin-bottom: 2em;
  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;
  font-weight: bold;
}

nav a:hover {
  border-bottom: 0.4em solid light-dark(
    var(--color-accent),
    oklch(from var(--color-accent) 95% 5% h)
  );
  background-color: light-dark(
    oklch(from var(--color-accent) 95% 5% h),
    var(--color-accent)
  );
  color: light-dark(inherit, white);
  padding-bottom: 0.1em;
}


/* theme switch */
.color-scheme {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 80%;
}

.color-scheme select {
  font: inherit;
}


/* homepage */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home p {
  max-width: 65ch;
}

.home img {
  margin-top: 1rem;
}


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

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

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

form input,
form textarea {
  width: 100%;
  box-sizing: border-box;
}

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


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

.projects article {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4;
  gap: 1em;
}

.project-year {
  margin: 0;
  color: var(--text-muted);
  font-family: Baskerville, Georgia, serif;
  font-variant-numeric: oldstyle-nums;
  font-style: italic;
}

.projects h2 {
  margin: 0;
}

.projects h2 a {
  color: inherit;
  text-decoration: none;
}

.projects h2 a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.projects img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

#projects-pie-plot {
  max-width: 20em;
  margin-block: 2em;
  overflow: visible;
}

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

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

.legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

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

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

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

svg:has(path.selected) path:not(.selected) {
  opacity: 0.3;
}

.legend li.selected {
  font-weight: bold;
}

.searchBar {
  width: 100%;
  max-width: 35rem;
  padding: 0.6rem 0.8rem;
  margin: 1.5rem 0;
  font: inherit;
  font-size: 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
}

/* resume */
.resume-page .resume-intro {
  text-align: center;
  margin-bottom: 2.5em;
}

.resume-page .resume-intro p {
  margin: 0.4em 0;
}

.resume-contact {
  margin-bottom: 2em;
}

.resume-contact a {
  color: inherit;
  text-decoration: none;
}

.resume-contact a:hover {
  color: var(--color-accent);
}

section {
  margin-bottom: 2em;
}

section h2 {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3em;
  margin-bottom: 0.75em;
}

section article {
  margin-bottom: 1.5em;
}

section header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  flex-wrap: wrap;
  margin-bottom: 0.5em;
}

section header h3 {
  margin: 0;
}

section header p {
  margin: 0;
  color: var(--text-muted);
}

section ul {
  margin-top: 0.5em;
  padding-left: 1.25em;
}

section p {
  margin: 0.4em 0;
}


/* screens */
@media (max-width: 700px) {
  h1 {
    font-size: 300%;
  }

  nav {
    flex-wrap: wrap;
  }

  nav a {
    min-width: 45%;
  }

  .color-scheme {
    position: static;
    display: block;
    margin-bottom: 1rem;
    text-align: right;
  }

  section header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Meta*/
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8em, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.stats dt {
  grid-row: 1;
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

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

#chart {
  max-width: 100%;
  margin-top: 1rem;
}

#chart svg {
  width: 100%;
  height: auto;
}

.gridlines line {
  stroke: var(--border-color);
  stroke-opacity: 0.4;
}

.gridlines path {
  display: none;
}

.dots circle {
  opacity: 0.8;
}

.info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.info dt {
  color: var(--text-muted);
  font-weight: bold;
}

.info dd {
  margin: 0;
}

.tooltip {
  position: fixed;
  top: 1em;
  left: 1em;
  z-index: 10;
  background: canvas;
  color: canvastext;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem;
  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 25%);
  pointer-events: none;
}

dl.info {
  transition-duration: 500ms;
  transition-property: opacity, visibility;
}

dl.info[hidden]:not(:hover, :focus-within) {
  opacity: 0;
  visibility: hidden;
}

circle {
  transition: 200ms;
  transform-origin: center;
  transform-box: fill-box;
}

circle:hover {
  transform: scale(1.5);
}

circle.selected {
  fill: #ff6b6b;
}

.selection {
  fill-opacity: 0.1;
  stroke: currentColor;
  stroke-opacity: 0.7;
  stroke-dasharray: 5 3;
}