body {
  font: 100%/1.5 arial;
  max-width: 100ch;
  margin-inline: max(1em, (100% - 100ch) / 2);
  min-height: 100vh;
  margin-inline: auto;
  padding: 1em;
}

/* navigation */

:root {
  --brand: var(--color-accent, rgb(229, 77, 107));
  color-scheme: light dark;
  --nav-underline: var(--brand); 
  --nav-underline-strong: var(--brand);
  --nav-hover-bg: color-mix(in oklab, var(--brand) 12%, Canvas 88%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --nav-underline: color-mix(in oklab, var(--brand) 70%, Canvas 30%);
    --nav-underline-strong: color-mix(in oklab, var(--brand) 85%, Canvas 15%);
    --nav-hover-bg: color-mix(in oklab, var(--brand) 18%, Canvas 82%);
  }
}

nav ul,
nav li {
  display: contents;
}
nav { 
  display: flex;
  margin-bottom: 1em;
}
nav a {
  flex: 1;
  text-decoration: none;
  color: inherit;
  text-align: center;
  padding: 0.5em;
  border-bottom: 1px solid var(--nav-underline);
}
nav a.current {
  border-bottom: 0.4em solid var(--nav-underline-strong);
  padding-bottom: 0.3em;
  font-weight:600;
}
nav a:hover,
nav a:focus-visible {
  border-bottom-color: var(--nav-underline-strong);
  background-color: var(--nav-hover-bg);
  outline: none;
}

html {
  --color-accent: rgb(229, 77, 107);
  accent-color: var(--color-accent);
}

input, textarea, button, select {
  font: arial;
}
form label,
form input,
form textarea,
form button {
  display: block;
}
form input,
form textarea,
form button {
  width: 100%;
  box-sizing: border-box;
}
form label {
  margin-block: 0.5em; 
}
form { 
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1em;
}
form button {
  grid-column: 1 / -1;
}
.contact-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1em;
}
.contact-form .field {
  display: grid;
  grid-template-columns: subgrid; 
  grid-column: 1 / -1;
}
.contact-form label { grid-column: 1; }
.contact-form input,
.contact-form textarea { grid-column: 2; }
.contact-form button { grid-column: 1 / -1; }

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 1em;
  align-items: start;
}
.projects img {
  width: 100%;
  height: auto;
  display: block;
}
.projects > article {
  grid-row: span 3; 
  display: grid;
  grid-template-rows: subgrid; 
}
.projects h2 { margin: 0; }

h1 {
  font: Times;
  color: crimson;
  font-size: 300%;  
  line-height: 1;
  text-wrap: balance;
  padding-bottom: -0.5rem;
}
h2 {
  font: times;
  line-height: 1;
  text-wrap: balance;
}


/* Resume layout */
.resume { 
  padding-block: 3em;
  padding-inline: 2em;
  max-width: 95ch; 
  margin-inline: auto; 
}

.resume a {
  color: crimson;
  font-weight: bold;
  border: 1px solid crimson;
  padding: 5px 5px;
  background-color: white;
}

.resume a:hover{
  color: white;
  background: crimson;
}

.resume__header h1 { 
  margin-block-start: 0;
  margin-block-end: 0.5em; 
  font: times;
  color: crimson;
}
.resume__meta { 
  opacity: 0.8; 
  margin-top: 0.2em;
}
.resume__grid {
  display: grid;
  grid-template-columns: 20rem 1fr;
  row-gap: 2rem;
  column-gap: 3rem;
  align-items: start;
}
.resume__sidebar h2,
.resume__sidebar h3 
.resume__main h2 {
  margin-top: 2em;
  margin-bottom: 0.75em;
}
.resume__sidebar ul,
.resume__main ul {
  margin-block-start: 0.75em;
  margin-block-end: 2em;
  padding-inline-start: 1.25em;
}
@media (max-width: 700px) {
  .resume__grid {
    grid-template-columns: 1fr; 
    row-gap: 2.5rem;
  }
  .resume {
    padding-block: 2em;
    padding-inline: 1em;
  }
}
.job { 
  padding-top: 0em; 
  padding-bottom: 1.5em;
  border-bottom: 1px solid oklch(90% 3% 200); 
}
.job:last-of-type { 
  border-bottom: none; 
}
.job__head { 
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.75rem; 
  font: times;
}
.job__role { 
  margin: 0;
  font: times;
 }

.job__meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-self: end;
  opacity: .85; 
}
.job__bullets {
  margin: .75em 0 0 1.25em;
}

.color-scheme {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  font-size:0.9rem;
  background: color-mix(in oklab, Canvas 85%, CanvasText 15%);
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
}

.resume__sidebar h2:first-child,
.resume__main h2:first-child {
  margin-top: 0;
}

.resume__sidebar,
.resume__main {
  padding-top: 0.5rem;
}

.resume__sidebar h2:not(:first-child),
.resume__main h2:not(:first-child) {
  margin-top: 2em;
  margin-bottom: 0.75em;
}

/* projects grid */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.projects article {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: none;
}

.projects article h3,
.projects article h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

.projects article img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  margin: 0.5rem 0 0.75rem;
  object-fit: cover;
  aspect-ratio: 4 / 3; 
}

.projects article p {
  margin: 0;
}

@media (min-width: 900px) {
  .projects {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* tidy github stats as a small grid */
#profile-stats dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0;
}
#profile-stats dt {
  font-weight: 600;
}
#profile-stats dd {
  margin: 0;
}

.github-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  color: crimson;
  text-align: center;
}

.github-grid .stat {
  border: 1px solid oklch(90% 3% / 1);
  border-radius: 12px;
  padding: 0.875rem;
  background: Canvas;   
  box-shadow: none;
  text-align: center;
}

.github-grid .stat dt {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
  color: #333;
}

.github-grid .stat dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: bold;
  color: crimson;
}

/* project year */

.project-desc-wrap { 
  display: grid;
  gap: 0.25rem;
}

.project-year {
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  opacity: 0.85;
  margin-top: 0.25rem;
  color: Crimson;
}

/* visualization */

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

/* legend list */
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9em, 1fr));
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: 14px Times, serif;
}

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

#viz-section {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 1rem 1.25rem;
}

@media (max-width: 700px) {
  #viz-section { grid-template-columns: 1fr; }
}

#project-search {
  width: 100%;
  max-width: 20em;
  padding: 0.4em 0.6em;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: 14px Times, serif;
  margin-block: 1em;
}

/* Meta stats layout */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  gap: 2rem;
  margin: 2rem auto;
  max-width: 800px;
  text-align: center;
}

.stats dt:nth-of-type(n) {
  grid-row: 1;
}
.stats dd:nth-of-type(n) {
  grid-row: 2;
}

.stats dt {
  font-weight: 600;
  color: #222;
  font-size: 13.5pt;
  margin-bottom: -0.5rem;
}
.stats dd {
  color: crimson;
  font-size: 18pt;
  font-weight: 700;
  margin: 0;
}

.gridlines line {
  stroke: #ccc;
  stroke-opacity: 0.5;
}

/* Generic info <dl> layout for tooltips / info panels */
dl.info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  background-color: #ffffff;
  color: #222;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition-duration: 500ms;
  transition-property: opacity, visibility;
}

dl.info dt {
  font-weight: 600;
  opacity: 0.7;
}

dl.info dd {
  margin: 0;
}

/* Tooltip positioning */
.tooltip {
  position: fixed;
  top: 1em;
  left: 1em;
  z-index: 10;
}

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

.project-url {
  color: crimson;
  text-align: center;
  font-weight: bold;
  border: 1px solid crimson;
  padding: 4px 8px;
}

.project-url:hover {
  background: crimson;
  color: white;
}

/* Slider CSS, currently removed */
.time-filter {
  display: flex;
  flex: 1;
  align-items: baseline;
  padding-bottom: 5vh;
  display: none;
}

.time-filter label {
  display: flex;
  align-items: baseline;
  gap: 1em;
  width: 100%;
}

.time-filter time {
  margin-left: auto;
}

#commit-progress {
  flex: 1;
  min-width: 200px;
}

circle {
  transition: all 200ms ease-out;
}

@starting-style {
  circle {
    r: 0;
  }
}

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

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

#files dt {
  grid-column: 1;
}

#files dt small {
  display: block;
  font-size: 0.8em;
  opacity: 0.7;
}

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

.loc {
  width: 0.5em;
  aspect-ratio: 1;
  background: var(--color, rgb(220, 89, 141));
  border-radius: 50%;
}

#scrolly-1 {
  position: relative;
  display: flex;
  gap: 1.5rem;
  padding-bottom: 30vh;
}

#scrolly-1 > * {
  flex: 1;
}

#scatter-story {
  position: relative;
  flex: 1.5;
}

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

.step {
  padding-bottom: 2.5vh;
  font-size: 9.5pt;
}

.step a {
  background: white;
  color: crimson;
}

.step a:hover {
  color: whitesmoke;
  background-color: crimson;
  text-align: center;
  font-weight: bold;
  padding: 2px 2px;
}

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

#scrolly-2 > * {
  flex: 1;
}

#files-story {
  position: relative;
  flex: 1.5;
}

#files-plot {
  position: sticky;
  top: 0;
  height: 100vh;
  flex: 2.5;
  overflow-y: auto;
}

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

.intro-text {
  flex: 1;
}

.intro-photo {
  width: 335px;
  height: 350px;
  object-fit: cover;
  border-radius: 60%;
}

@media (max-width: 768px) {
  .intro-content {
    flex-direction: column;
  }
  
  .intro-photo {
    order: -1;
  }
}