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

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

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

nav a {
    flex: 1;
    text-decoration: none;
    color: inherit;
    text-align: center;
    padding: 0.5em;
    border-bottom: 4px solid transparent;
}

nav a.current {
    background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
    padding-bottom: 0.2em;
    border-bottom: 4px solid var(--color-accent);
}

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

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

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

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

form button {
    grid-column: 1 / -1;
    text-align: center;
    padding: 0.2em;
}

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

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

h2 {
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 0.25em;
}

h3 {
    border-bottom: 2px solid color-mix(in oklch, var(--color-accent), canvas 75%);
    padding-bottom: 0.25em;
}

section h2 {
    margin: 10px 0px;
    border-bottom: 1px solid #a694c7;
    text-transform: uppercase;
    font-size: 16px;
    padding: 0;
}

section h3 {
    margin: 6px 0;
    display: flex;
    font-size: 15px;
    padding: 0;
    justify-content: space-between;
    border-bottom: none;
}

section h3 a {
    color: inherit;
    text-decoration: none;
}

section h3 a:hover {
  color: oklch(65% 0.15 300);
  text-decoration: underline;
}

section p {
    margin: 0;
    padding: 0;
}

section ul {
    margin: 4px 0;
    padding-left: 24px;
    padding-right: 24px;
}

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

/* github stats */
#profile-stats dl {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

#profile-stats dt {
    grid-row: 1;
    text-transform: uppercase;
    font-weight: 600;
}

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

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

.container {
    display: flex;
    align-items: center;
    gap: 2em;
    margin: 1em auto;
}

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

.legend li {
  display: flex;
  align-items: center;
  gap: 0.35em;
  cursor: pointer;
}

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

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

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

.selected {
  --color: oklch(52.919% 0.09288 312.594) !important;

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

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

.gridlines path {
    stroke-width: 0;
}

/* tooltip style */
dl.info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    transition-duration: 500ms;
    transition-property: opacity, visibility;
}

dl.info dt {
  color: #666;
  font-weight: 500;
}

dl.info dd {
  margin: 0;
}

circle {
  transition: 200ms;
  transform-origin: center;
  transform-box: fill-box;
  
  @starting-style {
    r: 0;
  }
}

circle:hover {
  transform: scale(1.5);
  stroke: #333;
  stroke-width: 1px;
}

.tooltip {
    position: fixed;
    top: 1em;
    left: 1em;

    color: #111;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.5em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
    padding: 0.75em 1em;

    pointer-events: none;
    opacity: 0;
    transition: opacity 150ms ease-out;
    z-index: 10;
}

.tooltip.visible {
  opacity: 1;
}

/* scatterplot brush */
@keyframes marching-ants {
  to {
    stroke-dashoffset: -8; /* 5 + 3 */
  }
}

.selection {
  fill-opacity: 0.1;
  stroke: black;
  stroke-opacity: 0.7;
  stroke-dasharray: 5 3;
  animation: marching-ants 2s linear infinite;
}

circle.selected {
  fill: #ff6b6b;
}

/* meta stats + language breakdown */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 2fr);
    text-align: left;
}

.stats dt {
    grid-row: 1;
    text-transform: uppercase;
    font-weight: 600;
}

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

/* meta commits slider */

.time-filter {
  margin-left: auto;
  display: flex;
  flex-direction: column;
}

.time-filter input[type="range"] {
  width: 675px;
}

.time-filter time,
.time-filter em {
  display: block;
  margin-left: auto;
}

/* meta files */

#files {
  display: grid;
  grid-template-columns: 1fr 4fr;

  > div {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
  }

  dt {
    grid-column: 1;
    display: block;
  }

  dt small {
    display: block;
    opacity: 0.6;
  }

  dd {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    align-content: start;
    gap: 0.15em;
    padding-top: 0.6em;
    margin-left: 0;
  }
}

.loc {
  display: flex;
  width: 0.5em;
  aspect-ratio: 1;
  background-color: var(--color);
  border-radius: 50%;
}

/* scrollytelling */

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

  > * {
    flex: 1;
  }
}

#scatter-story {
  position: relative;
}

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

  text {
    font-size: 20px;
  }
}