:root {
  --color-accent: #667de3;
  --border-color: oklch(50% 10% 200 / 40%);
}

html {
  color-scheme: light dark;
  accent-color: var(--color-accent);
  background-color: canvas;
  color: canvastext;
}

h1 {
  color: canvastext;
  font-size: 4em;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0.5em 0;
}

h2,
h3,
h4,
h5,
h6 {
  line-height: 1.1;
  text-wrap: balance;
  margin: 0.5em 0;
  font-weight: inherit;
}

ul {
  display: contents;
}

ul li {
  display: contents;
}

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

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

nav a.current {
  border-bottom: 0.4em solid;
  padding-bottom: 0.1em;
  font-weight: bold;
  border-bottom-color: oklch(50% 10% 200 / 40%);
}

nav a:hover {
  background-color: color-mix(in oklch, var(--color-accent), canvas 85%);
  border-bottom: 0.4em solid var(--color-accent);
  color: var(--color-accent);
  /*background-color: hsl(230, 60%, 95%); /* light background with similar hue */
}

form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1em;
  align-items: center;
  max-width: 600px;
  margin-inline: auto;
}

form label {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  text-align: right;
  gap: 0.5em;
  font: inherit;
}

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

form button {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  margin-top: 1em;
  font: inherit;
  cursor: pointer;
  padding: 0.2px 1em;
}

@media (max-width: 500px) {
  form {
    grid-template-columns: 1fr;
  }

  form label {
    text-align: left;
  }
}

.profile {
  margin: 1em;
}

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 1em;
  margin: 1em 0;
  align-items: stretch;
}

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

.projects article h2 {
  margin: 0;
}

.projects article img {
  width: 100%;
  height: auto;
  display: block;
}

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

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

.project-year {
  margin-top: auto;
  font-style: italic;
  color: gray;
  font-size: 0.9em;
  align-self: flex-start;
}

.projects > * {
  display: flex;
  flex-direction: column;
}

.projects > * > .project-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.header-info,
.education,
.work {
  margin-bottom: 1em;
}

.education,
.work {
  margin-top: 2em;
}

.work,
.education {
  grid-template-columns: 1fr;
  gap: 0.5em;
}

.work,
.education h2,
h3,
h4 {
  font-weight: bold;
}

.work article ul {
  display: block;
  list-style-type: disc;
  padding-left: 1.5em;
  font-weight: normal;
}

.work article ul li {
  display: list-item;
  margin-bottom: 0.5em;
  font-weight: normal;
}

.project-link {
  margin-top: 0.5em;
  font-weight: bold;
  color: var(--color-accent);
  text-decoration: underline;
}

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

form label {
  position: static;
}

#profile-stats dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
  margin-top: 1rem;
  border: 5px;
}

#profile-stats dt {
  font-weight: normal;
  font-size: 100%;
  color: #4e567b;
  grid-row: 1;
  text-align: left;
}

#profile-stats dd {
  margin: 0;
  grid-row: 2;
  font-size: 160%;
  text-align: left;
}

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

  overflow: visible;
}

.container {
  display: flex;
  gap: 2em;
  align-items: flex-start;
}

.container svg {
  width: 200px;
  height: auto;
  flex: 1 1 auto;
}

.legend-ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9em, 1fr));
  gap: 0.5em;
  flex: 1 1 auto;
  min-width: 150px;
  border-radius: 1em;
  border: 1px solid oklch(21.374% 0.01327 204.787 / 0.4);
  padding: 0.5em;
}

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

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

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

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

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

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

#stats dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  text-align: center;
  margin-top: 1rem;
  border: 5px;
}

#stats dt {
  font-weight: normal;
  font-size: 100%;
  color: #4e567b;
  grid-row: 1;
  text-align: left;
}

#stats dd {
  margin: 0;
  grid-row: 2;
  font-size: 160%;
  text-align: left;
}

#slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin: 2em 0;
  width: 100%;
  max-width: 100ch;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  width: 100%;
}

#commit-progress {
  flex: 1; /* Take up remaining space */
}

#commit-max-time {
  align-self: flex-end; /* Right-align the time below */
  text-align: right;
  font-weight: bold;
}

.gridlines line {
  stroke: #b4aeae;
  stroke-opacity: 0.5;
  shape-rendering: crispEdges;
}

.gridlines path {
  stroke: none;
}

dl.info {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1rem;
  row-gap: 0.4rem;
  align-items: center;
  margin: 0;
  padding: 0;
  transition-duration: 500ms;
  transition-property: opacity, visibility;
}

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

dt.info {
  font-weight: normal;
  font-size: 100%;
  color: #4e567b;
  grid-row: 1;
  text-align: left;
}

dd.info {
  margin: 0;
  grid-row: 2;
  font-size: 160%;
  text-align: left;
}

#commit-tooltip {
  position: fixed;
  top: 1em;
  left: 1em;
  background-color: white;
  box-shadow: oklch(73.696% 0.01582 202.28);
  border-radius: 10px;
  padding: 1em;
}

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

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

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

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

  dt {
    grid-column: 1;
  }

  dd {
    grid-column: 2;
  }
}

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

#files 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;
}

#files dt small {
  display: block;
  opacity: 0.6;
  font-size: 0.8em;
  margin-top: 0.15em;
}

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

  > * {
    flex: 1;
  }
}

#scatter-story {
  position: sticky;
  left: 0;
  bottom: auto;
}

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

#slider-container {
  display: none;
}

/* Container for the two-column layout */
#meta-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* Left column: scatter plot + file dots */
#visuals {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1rem; /* keep visuals visible when scrolling steps */
}

/* Right column: scrollytelling steps */
#steps-container {
  flex: 1;
  max-height: 80vh;
  overflow-y: auto; /* scrollable steps */
  padding-left: 1rem;
}

.meta-row {
  display: flex;
  gap: 2rem; /* space between history and visualization */
}

.history-column {
  flex: 1; /* scrollable text */
}

.visual-column {
  flex: 1; /* sticky visualization */
}

#file-visuals {
  position: sticky;
  top: 1rem;
  align-self: flex-start;
}

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

@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;
}

circle {
  fill: #4e79a7;
  fill-opacity: 0.7;
}

#language-breakdown {
  display: grid;
  grid-template-columns: auto 1fr;
}

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: auto;
  padding: 15px;
}
