html {
  color-scheme: dark;
  --color-accent: oklch(52.88% 0.16747 140.424);
  accent-color: var(--color-accent);
}

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

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: 0 auto;
  margin-inline: auto;
  padding: 100px;
}

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

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

nav a.current {
  border-bottom: 0.4em solid oklch(60% 5% 200);
  padding-bottom: 0.3em;
}

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

input, textarea, button {
  font: inherit;
}

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

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

h1 {
  font-size: 300%;
}

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

.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 3;
  gap: 2em;
}

.projects h2 {
  margin: 0;
}

.cv-section {
  margin-bottom: 2em;
}

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

section h3 {
  margin-bottom: 0.25em;
  color: var(--color-accent);
}

section article p:first-of-type {
  font-weight: 600;
  margin: 0.25em 0;
}

section article p:has(time) {
  color: #666;
  font-style: italic;
}

section:last-child article p {
  font-weight: normal;
}

img[alt="profile picture"] {
  margin-bottom: 0.5em;
  border-radius: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 0;
  padding: 0;
  text-align: center;
}

.stats-grid dt {
  grid-row: 1;
  font-size: 1rem;
  font-weight: normal;
  color: #666;
  text-transform: uppercase;
  margin: 0;
}

.stats-grid dd {
  grid-row: 2;
  grid-column: auto; /* ← add this to cancel the global rule */
  font-size: 3rem;
  font-weight: bold;
  margin: 0;
  display: block; /* override the global flex */
}

/* Lab 5 - D3 Visualization */

.year {
  font-style: italic;
  color: #f7f2f2;
  margin-top: 0.1rem;
  margin-bottom: 5rem;
  display: block;
}

/* Container for pie chart and legend */
.container {
  display: flex;
  gap: 2em;
  align-items: center;
  flex-wrap: nowrap;
  margin: 2em 0;
  overflow-x: auto;
}

#projects-pie-plot {
  max-width: 20em;
  min-width: 15em;
  flex-shrink: 0;
  overflow: visible;
}

/* Pie chart path styling */
#projects-pie-plot path {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

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

/* Selected wedge styling */
#projects-pie-plot path.selected {
  fill: oklch(60% 45% 0);
}

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

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

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

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

/* Search bar styling */
.searchBar {
  width: 100%;
  padding: 0.75em 1em;
  font-size: 1rem;
  margin-bottom: 2em;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* meta summary box*/
#stats .stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: auto;
  row-gap: .25rem;
  column-gap: 2rem;
  margin-bottom: 2rem;
}

#stats .stats dt,
#stats .stats dd {
  margin: 0 !important;
}

#stats .stats dt {
  font-size: 1.2rem;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .6;
  grid-row: 1 !important;
}

#stats .stats dd {
  font-size: 1.5rem;
  font-weight: 700;
  grid-row: 2 !important;
}

/* tooltip styling */
/* Tooltip styling - dynamic with theme */
#commit-tooltip {
    position: fixed;
    background-color: light-dark(rgba(255, 255, 255, 0.95), rgba(40, 40, 40, 0.95));
    color: light-dark(#333, #fff);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: light-dark(
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.5)
    );
    pointer-events: none;
    z-index: 1000;
    min-width: 200px;
}

#commit-tooltip dt {
    font-weight: bold;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

#commit-tooltip dt:first-child {
    margin-top: 0;
}

#commit-tooltip dd {
    margin: 0.25rem 0 0 0;
    font-size: 0.95rem;
}

#commit-tooltip a {
    color: steelblue;
    text-decoration: none;
}

#commit-tooltip a:hover {
    text-decoration: underline;
}

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

dl.info[hidden] {
  opacity: 0;
  visibility: hidden;
}

dl.info:not([hidden]) {
  opacity: 1;
  visibility: visible;
}


/* Brush styling */
@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;
}

#language-breakdown {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 3rem;
  margin-top: 1rem;
  padding: 1.5rem;
  background-color: light-dark(rgba(240, 240, 240, 0.5), rgba(50, 50, 50, 0.5));
  border-radius: 8px;
}

#language-breakdown dt {
  font-weight: bold;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
  text-align: center;
}

#language-breakdown dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

#language-breakdown dd:last-of-type {
  margin-bottom: 0;
}

#language-breakdown div {
  display: flex;
  flex-direction: column;
  align-items: center;
}



/* Scatter plot styling */
circle {
  transition: 200ms;
  transform-origin: center;
  transform-box: fill-box;
  
  @starting-style {
    r: 0;
  }
}

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

circle.selected {
  fill: #ff6b6b;
}

.project-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 18px;
  margin: 10px;
  width: 250px;
  display: inline-block;
  vertical-align: top;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.img-container {
  width: 100%;
  aspect-ratio: 4 / 3;  /* fixed width:height ratio */
  overflow: hidden;
  border-radius: 4px;
  margin-bottom: 10px;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;    /* crops image to fit container */
}

.project-card p:not(.year) {
  margin-top: 1.5rem; /* Add space above description */
}

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

dt small {
  display: block;
  font-size: 0.85rem;
  color: #888;
  font-weight: normal;
  margin-top: 0.25rem;
}

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

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

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

#commit-progress {
    width: 500px; /* takes full width of parent */
    height: 15px;
    margin-top: 1em;
    margin-bottom: 2em;
}