:root {
  --bg: #fff;
  --text: #111;
  --muted: #5f5f5f;
  --line: #e6e1d8;
  --soft: #faf8f3;
  --accent: #0b6b77;
  --github-empty: #f0eee8;
  --github-1: #9be9a8;
  --github-2: #40c463;
  --github-3: #30a14e;
  --github-4: #216e39;
  --max: 760px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  background: var(--bg);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10100e;
  --text: #f5f1e8;
  --muted: #aaa39a;
  --line: #343027;
  --soft: #171613;
  --accent: #8ad6e2;
  --github-empty: #20231f;
  --github-1: #2d6b3f;
  --github-2: #3d9a54;
  --github-3: #57c36d;
  --github-4: #85e89d;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.58;
}

.corner-sun {
  position: fixed;
  z-index: 0;
  top: -16px;
  left: -18px;
  width: clamp(104px, 12vw, 142px);
  height: auto;
  pointer-events: none;
  opacity: 0.74;
  user-select: none;
}

html[data-theme="dark"] .corner-sun {
  opacity: 0.24;
}

a {
  color: var(--text);
  text-decoration-color: color-mix(in srgb, var(--text) 34%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  body,
  a,
  .theme-switch,
  .detail-panel,
  .tag-row span,
  .github-day,
  .portrait,
  .list-disclosure,
  .more::after {
    transition:
      background-color 160ms ease,
      border-color 160ms ease,
      color 160ms ease,
      text-decoration-color 160ms ease;
  }
}

.theme-switch {
  position: fixed;
  z-index: 10;
  top: clamp(14px, 3vw, 24px);
  right: clamp(14px, 3vw, 28px);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 68%, transparent);
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  cursor: pointer;
  opacity: 0.68;
  padding: 0;
  backdrop-filter: blur(12px);
}

.theme-switch:disabled {
  cursor: default;
}

.theme-switch:hover {
  border-color: color-mix(in srgb, var(--muted) 42%, var(--line));
  color: var(--text);
  opacity: 0.9;
}

.theme-switch:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 4px;
  opacity: 1;
}

.theme-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.saber-transition {
  --saber-angle: -4deg;
  --saber-color: 225 28 44;
  --saber-core: #fff7f2;
  --saber-length: 260px;
  --saber-scale: 0.78;
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
}

.saber-transition.is-to-light {
  --saber-color: 51 153 255;
  --saber-core: #f5fbff;
}

.saber-rig {
  position: absolute;
  display: block;
}

.saber-rig {
  left: var(--saber-x);
  top: var(--saber-y);
  width: 0;
  height: 0;
  transform: rotate(var(--saber-angle)) scale(var(--saber-scale));
  transform-origin: 0 0;
}

.saber-flare,
.saber-blade,
.saber-hilt {
  position: absolute;
  display: block;
}

.saber-flare {
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--saber-core);
  box-shadow:
    0 0 16px 6px rgb(var(--saber-color) / 0.86),
    0 0 46px 18px rgb(var(--saber-color) / 0.42);
  transform: translate(-50%, -50%) scale(0);
  animation: saber-flare 980ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.saber-blade {
  left: 0;
  top: 0;
  width: var(--saber-length);
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      var(--saber-core) 0%,
      var(--saber-core) 72%,
      rgb(var(--saber-color) / 0.8) 92%,
      transparent 100%);
  box-shadow:
    0 0 7px 2px rgb(var(--saber-color) / 0.96),
    0 0 18px 6px rgb(var(--saber-color) / 0.64),
    0 0 42px 10px rgb(var(--saber-color) / 0.28);
  transform: translateY(-50%) scaleX(0);
  transform-origin: 0 50%;
  animation:
    saber-ignite 260ms cubic-bezier(0.16, 1, 0.3, 1) both,
    saber-blade-fade 930ms ease both;
}

.saber-blade::before {
  content: "";
  position: absolute;
  inset: -12px 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--saber-color) / 0.48), transparent 88%);
  filter: blur(10px);
}

.saber-hilt {
  left: -80px;
  top: 0;
  width: 86px;
  height: 20px;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 8px 11px 11px 8px;
  background:
    linear-gradient(180deg,
      #f8eedf 0%,
      #9a9187 28%,
      #35302b 50%,
      #cfc4b5 72%,
      #171412 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.58),
    inset 0 -2px 3px rgb(0 0 0 / 0.42),
    0 10px 22px rgb(0 0 0 / 0.28);
  transform: translateY(-50%) translateX(12px) scale(0.94);
  transform-origin: 100% 50%;
  animation: saber-hilt 930ms cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: visible;
}

.saber-hilt::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 4px;
  width: 31px;
  height: 12px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg,
      #14110f 0 4px,
      #4a433d 4px 7px);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.18),
    0 0 0 1px rgb(0 0 0 / 0.18);
}

.saber-hilt::after {
  content: "";
  position: absolute;
  right: -9px;
  top: -3px;
  width: 15px;
  height: 24px;
  border-radius: 6px 8px 8px 6px;
  background:
    linear-gradient(180deg, #eee6d7, #5d554d 45%, #111 100%);
  box-shadow:
    inset 1px 0 0 rgb(255 255 255 / 0.3),
    0 0 10px rgb(var(--saber-color) / 0.22);
}

.hilt-grip,
.hilt-control,
.hilt-pommel {
  position: absolute;
  display: block;
}

.hilt-control {
  left: 53px;
  top: 50%;
  width: 17px;
  height: 7px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      rgb(var(--saber-color) / 0.35),
      rgb(var(--saber-color)) 58%,
      #fff7ef 100%);
  box-shadow:
    0 0 7px rgb(var(--saber-color) / 0.72),
    inset 0 1px 0 rgb(255 255 255 / 0.65);
  transform: translateY(-50%);
}

.hilt-pommel {
  left: -8px;
  top: 2px;
  width: 13px;
  height: 16px;
  border-radius: 5px 3px 3px 5px;
  background:
    linear-gradient(180deg, #d3c7b7, #514a43 52%, #171412);
  box-shadow:
    inset 1px 0 0 rgb(255 255 255 / 0.25),
    -2px 0 0 rgb(0 0 0 / 0.18);
}

.hilt-grip {
  right: 8px;
  top: 3px;
  width: 6px;
  height: 14px;
  border-radius: 2px;
  background: #211d1a;
  opacity: 0.65;
}

@keyframes saber-ignite {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(10px) scaleX(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-50%) translateX(4px) scaleX(0.16);
  }

  100% {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scaleX(1);
  }
}

@keyframes saber-blade-fade {
  0%,
  78% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes saber-flare {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }

  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.25);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.1);
  }
}

@keyframes saber-hilt {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(18px) scale(0.88);
  }

  14%,
  84% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px) scale(0.94);
  }
}

@media (prefers-reduced-motion: reduce) {
  .saber-transition {
    display: none;
  }
}

.page {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100vw - 40px));
  margin: 0 auto;
  padding: clamp(56px, 11vw, 112px) 0 44px;
}

.intro {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.portrait {
  width: 132px;
  height: 132px;
  aspect-ratio: 1;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
}

p {
  margin: 14px 0 0;
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 34px 0 42px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  text-transform: lowercase;
}

.work,
.timeline,
.github-activity,
.patents,
.research {
  padding: 0;
}

.timeline,
.github-activity,
.patents,
.research {
  margin-top: 42px;
}

h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: lowercase;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.section-row a,
.github-meta {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.github-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 12px;
}

.github-chart-shell {
  overflow-x: auto;
  padding: 2px 0 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.github-chart-inner {
  --cell: 10px;
  --gap: 3px;
  --weekday-label: 30px;
  width: max-content;
  min-width: 100%;
}

.github-months {
  display: grid;
  grid-template-columns: var(--weekday-label) repeat(var(--weeks), var(--cell));
  gap: var(--gap);
}

.github-months {
  height: 18px;
  align-items: end;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.github-months span {
  white-space: nowrap;
}

.github-calendar-body {
  display: grid;
  grid-template-columns: var(--weekday-label) max-content;
  gap: var(--gap);
}

.github-weekdays,
.github-grid {
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  gap: var(--gap);
}

.github-weekdays {
  color: var(--muted);
  font-size: 11px;
  line-height: var(--cell);
}

.github-grid {
  grid-template-columns: repeat(var(--weeks), var(--cell));
}

.github-day {
  width: var(--cell);
  height: var(--cell);
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 2px;
  background: var(--github-empty);
}

.github-day[data-level="1"] {
  background: var(--github-1);
}

.github-day[data-level="2"] {
  background: var(--github-2);
}

.github-day[data-level="3"] {
  background: var(--github-3);
}

.github-day[data-level="4"] {
  background: var(--github-4);
}

.items > li,
.artifact-list > li {
  border-top: 1px solid var(--line);
}

.items > li:last-child,
.items.is-collapsed > li[data-collapse-edge],
.artifact-list > li:last-child {
  border-bottom: 1px solid var(--line);
}

[data-collapsible-list] {
  position: relative;
}

[data-collapsible-list].is-animating {
  will-change: height;
  transition: height 210ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-collapsible-list] > [hidden] {
  display: none !important;
}

[data-collapsible-list].is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 42px;
  pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 92%);
}

[data-static-details] .work-item summary {
  cursor: default;
}

[data-static-details] .more,
[data-static-details] .detail-panel {
  display: none !important;
}

[data-collapsible-list].is-expanding > [data-list-reveal] {
  animation: list-reveal-in 170ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--reveal-index) * 16ms);
}

[data-collapsible-list].is-collapsing > [data-list-reveal] {
  animation: list-reveal-out 120ms ease both;
  animation-delay: calc(var(--reveal-index) * 7ms);
}

.list-disclosure {
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  margin: -11px auto 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    margin-top 180ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.list-disclosure span {
  display: block;
  transform: translateY(-1px);
}

.list-disclosure:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--bg) 82%, var(--accent));
  color: var(--accent);
  transform: translateY(-1px);
}

.list-disclosure[aria-expanded="true"],
.list-disclosure[data-animating="true"] {
  margin-top: 12px;
}

.list-disclosure:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 3px;
}

.work + .timeline,
.timeline + .github-activity {
  margin-top: 28px;
}

.work-row {
  position: relative;
  display: block;
  padding-right: 32px;
}

@keyframes list-reveal-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes list-reveal-out {
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.work-item {
  min-width: 0;
}

.work-item summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.52fr) minmax(0, 1fr);
  gap: 10px 16px;
  align-items: start;
  padding: 13px 164px 13px 0;
  cursor: pointer;
  list-style: none;
}

.work-item summary::-webkit-details-marker {
  display: none;
}

.item-title,
.artifact-list strong {
  font-weight: 520;
}

.item-line,
.role {
  color: var(--muted);
}

.more {
  position: absolute;
  top: 13px;
  right: 0;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.more::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  line-height: 1;
}

.work-item[open] .more {
  color: var(--accent);
}

.work-item[open] .more::after {
  content: "-";
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  color: var(--accent);
}

.detail-panel {
  margin: 0 -32px 16px 0;
  padding: 14px 16px 16px;
  border-left: 1px solid var(--line);
  background: var(--soft);
}

.work-item:not([open]) .detail-panel {
  display: none;
}

.detail-panel p {
  margin-top: 0;
}

.detail-points {
  margin-top: 10px;
  color: var(--muted);
}

.detail-points > li {
  position: relative;
  padding-left: 16px;
  margin-top: 6px;
}

.detail-points > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.74em;
  width: 6px;
  height: 1px;
  background: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.tag-row span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.row-links {
  position: absolute;
  top: 13px;
  right: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  justify-content: flex-end;
  padding: 0;
  white-space: nowrap;
}

.row-links a {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.artifact-list > li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px 22px;
  padding: 13px 0;
}

.artifact-list span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.artifact-authors {
  color: var(--text);
  font-size: 0.94em;
}

.artifact-year {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.timeline-list {
  position: relative;
  padding-left: 22px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.timeline-list > li {
  position: relative;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 12px 22px;
  padding: 0 0 22px;
}

.timeline-list > li::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 0.55em;
  width: 9px;
  height: 9px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.timeline-list > li:last-child {
  padding-bottom: 0;
}

.when {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.role {
  display: block;
  margin-top: 2px;
}

.timeline-meta {
  display: inline-block;
  margin-top: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

@media (max-width: 680px) {
  .corner-sun {
    display: none;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .portrait {
    width: 104px;
    height: 104px;
  }

  .work-row,
  .work-item summary,
  .artifact-list > li,
  .timeline-list > li {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .work-item summary {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-right: 32px;
  }

  .item-line {
    grid-column: 1 / -1;
  }

  .detail-panel {
    margin-left: 0;
  }

  .row-links {
    position: static;
    justify-content: flex-start;
    padding: 0 0 13px;
  }

  .artifact-list > li {
    gap: 2px;
  }

  .timeline-list {
    padding-left: 18px;
  }

  .timeline-list > li::before {
    left: -17px;
  }

  .github-chart-inner {
    --cell: 9px;
    --gap: 2px;
    --weekday-label: 28px;
  }

  .github-months,
  .github-weekdays {
    font-size: 10px;
  }

  .row-links {
    justify-content: flex-start;
  }
}
