html {
  color-scheme: light dark;
}
:root {
  --color-accent: oklch(0.75 0.20 190); 
  accent-color: var(--color-accent); 
}


h1 {
  font-size: 300%;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.1;
  text-wrap: balance;
  margin-block: 1em 0.5em; 
}


body {
  font: 100%/1.5 system-ui;
  max-width: 100ch;
  margin-inline: auto;
  padding-inline: 1rem;
}

nav {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  --border-color: oklch(50% 10% 200 / 40%);
  border-bottom: 1px solid var(--border-color);
}

nav a {
  flex: 1;
  text-align: center;
  padding: 0.5em;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: -1px;
}


nav a.current {
  font-weight: bold;
  border-bottom: 0.4em solid var(--border-color);
  padding-bottom: 0.1em;
}


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


nav a:not(.current) {
  border-bottom: 1px solid transparent;
}

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

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


input,
textarea,
button {
  font: inherit;
  width: 100%;
}

form {
  display: grid;
  grid-template-columns: max-content 1fr; 
  gap: 1em 0.5em; 
}

form label,
form button {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
}

form button {
  padding: 0.75em;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;

  background-color: color-mix(in oklch, var(--color-accent), canvas 65%); 
  border: none;                       
  border-radius: 0.5em;              
  transition: background-color 0.3s ease;
}


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


.projects article {
  /* display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3; */
  display: grid;
  grid-template-rows: auto auto auto auto;
  background: color-mix(in oklch, var(--color-accent), canvas 75%);
  padding: 1em;
  border-radius: 0.5em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}


.projects article h2 {
  margin: 0;
}


.container {
  max-width: 1000px;
  margin: auto;
  padding: 1rem;
}

article {
  background-color: color-mix(in oklch, var(--color-accent), canvas 75%);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  margin-top: 1rem;
}

article header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

time {
  font-size: 0.9em;
  color: var(--color-muted);
  font-style: italic;
}

ul {
  padding-left: 1.2em;
}

li {
  margin-bottom: 1rem;
}


.cv-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.sidebar {
  flex: 1 1 200px;
  max-width: 250px;
  text-align: center;
  background-color: color-mix(in oklch, var(--color-accent), canvas 75%);
  border-radius: 0.75rem;
  padding: 1.5rem 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.sidebar img {
  width: 100%;
  max-width: 150px;
  border-radius: 50%;
  margin-bottom: 1rem;
  box-shadow: 0 0 0 4px var(--color-accent);
}

.sidebar h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--color-accent);
}


.cv-main {
  flex: 3 1 600px;
  min-width: 0;
}

dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr); 
  text-align: center;
}

dt {
  grid-row: 1;
  /* font-weight: bold; */
  color: #a9acae; 
  text-transform: uppercase;
  font-size: 0.9rem;
}

dd {
  grid-row: 2;
  font-size: 2rem;
  font-weight: 600;
}

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

.year {
  font-style: italic;
  font-family: "Baskerville", "Georgia", serif;
  font-variant-numeric: oldstyle-nums;
  font-size: 0.9em;
  color: #444; 
  margin-top: 0.5em;
}

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

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9em, 1fr));
  gap: 0.25em 1em;
  border: 1px solid #ccc;
  padding: 1em;
  margin-block: 1.5em;
  font-family: system-ui, sans-serif;
}

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

.legend-item .swatch {
  display: inline-block;
  width: 1em;
  aspect-ratio: 1 / 1;
  border-radius: 0.25em;
  background-color: var(--color);
}

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

svg {
  flex-shrink: 0;
}

.legend {
  flex: 1;
}

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

svg path {
  transition: 300ms;
}



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

.selected {
  --color: oklch(0.58 0.1283 137.12) !important;
}

path.selected {
  fill: var(--color);
}

.legend-item.selected .swatch {
  background-color: var(--color);
}

#stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10ch, 1fr)); /* 响应式列 */
  column-gap: 2rem;
  row-gap: 0.25rem;
  text-align: center;
  margin-block: 1.5rem;
}

#stats dt {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #a9acae;
}

#stats dd {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
}


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

.gridlines path {
  display: none;
}

dl.info.tooltip {
  position: fixed;
  top: 1em;
  left: 1em;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3em 0.6em;
  padding: 1em 1.2em;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-size: 0.85em;
  line-height: 1.4;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  max-width: 300px;
  z-index: 1000;
}

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

dl.info.tooltip dt {
  font-weight: bold;
  color: #444;
  font-size: 0.85em;
  white-space: nowrap;
}

dl.info.tooltip dd {
  margin: 0;
  color: #222;
  font-size: 0.8em;
  word-break: break-word;
}

#commit-link {
  color: #1a73e8;
  font-weight: 600;
  text-decoration: none;
}

#commit-link:hover {
  text-decoration: underline;
}

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

.commit-slider-wrapper {
  margin-bottom: 1.5rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 1em;
}

.slider-row label {
  white-space: nowrap;
  font-weight: bold;
}

.slider-row input[type="range"] {
  flex: 1;
}

.commit-slider-wrapper time {
  display: block;
  text-align: right;
  margin-top: 0.5em;
  font-size: 1rem;
  white-space: nowrap;
}

circle {
  transition: r 0.5s ease, fill-opacity 0.3s ease;
}

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

#files {
  display: grid;
  grid-template-columns: 1fr 4fr;
  gap: 1em; /* 推荐加间距，防止太拥挤 */

  > div {
    display: grid;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;  /* ✅ 关键修改 */
    grid-column: 1 / -1;
  }

  dt {
    grid-column: 1;
    grid-row: span 3;  /* ✅ 对齐文本和 code 结构 */
    margin: 0;         /* ✅ 避免段落高度不一致 */
  }

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

  dt small {
    display: block;
    font-size: 0.9em;
    color: #999;
    margin-top: 0.1em;
  }  
  
}

.loc {
  display: flex;
  width: 0.5em;
  aspect-ratio: 1;
  border-radius: 50%;
}

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


