/* Editorial portfolio. Warm paper, Garamond headings, Inter body. */

:root {
  --bg: #faf8f4;
  --bg-nav: #f4f1ea;
  --text: #1c1916;
  --muted: #6f6a63;
  --line: #e4dfd6;
  --link-line: rgba(28, 25, 22, 0.28);
  --accent: #9a3b2f;
  --code-bg: #f1eee6;
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --measure: 44rem;
  --ease: 160ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration-color: var(--link-line);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--ease), text-decoration-color var(--ease);
}

a:hover {
  color: var(--accent);
  text-decoration-color: rgba(154, 59, 47, 0.45);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: #ead8d4;
  color: var(--text);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.4rem 0.7rem;
  z-index: 20;
}

.skip:focus {
  top: 0.5rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.nav {
  width: 100%;
  max-width: var(--measure);
  padding: 0.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.15rem 0.35rem;
  font-size: 0.875rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.4rem;
  text-decoration: none;
  color: var(--muted);
  flex-shrink: 0;
}

.logo:hover {
  color: var(--text);
  text-decoration: none;
}

.logo svg {
  width: 18px;
  height: 24px;
  display: block;
  transform-origin: bottom center;
  transition: transform 220ms ease;
}

.logo:hover svg {
  transform: rotate(-14deg);
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.4rem 0.45rem;
  min-height: 2rem;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
  background: rgba(28, 25, 22, 0.05);
  text-decoration: none;
}

.nav-social {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

.nav-social a {
  display: inline-flex;
  justify-content: center;
  min-width: 2rem;
}

.nav-social svg {
  width: 16px;
  height: 16px;
}

/* Main column */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.75rem 2rem 5rem;
}

@media (min-width: 640px) {
  .wrap {
    padding-top: 4.5vh;
  }
}

.page-resume .wrap {
  padding-bottom: 4rem;
}

h1,
h2,
h3,
.prose h1,
.prose h2,
.prose h3 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.15;
}

h1 {
  font-size: 1.9rem;
  margin-bottom: 0.85rem;
}

h2 {
  font-size: 1.55rem;
  margin: 2.25rem 0 0.85rem;
  scroll-margin-top: 3.5rem;
}

h3 {
  font-size: 1.25rem;
  margin: 1.6rem 0 0.55rem;
}

.lede,
.wrap > p {
  margin-bottom: 0.7rem;
}

.lede-last {
  margin-bottom: 0.4rem;
}

.kicker {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.bio h1 {
  font-size: clamp(2rem, 4vw, 2.45rem);
  margin-bottom: 0.5rem;
}

.aside {
  margin: 0.9rem 0 0;
  color: var(--muted);
}

/* Homepage bio */

.bio {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
}

.bio-text {
  flex: 1;
  min-width: 0;
}

.portrait {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-top: 0.55rem;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .bio {
    flex-direction: column-reverse;
    gap: 1rem;
  }

  .portrait {
    width: 96px;
    height: 96px;
    margin-top: 0;
  }
}

/* Skills */

.skill-row {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 0.4rem;
}

.skill-label {
  flex: 0 0 8.25rem;
  color: var(--muted);
}

.skill-list {
  min-width: 0;
}

@media (max-width: 700px) {
  .skill-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    margin-bottom: 0.75rem;
  }

  .skill-label {
    flex: none;
    font-size: 0.92rem;
  }
}

/* Notebook rows */

.entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.entry a {
  font-weight: 400;
}

.project-block :is(h2, h3) a {
  text-decoration-color: transparent;
}

.project-block :is(h2, h3) a:hover {
  text-decoration-color: rgba(154, 59, 47, 0.45);
}

.entry a:hover {
  color: var(--accent);
}

.entry-meta {
  color: var(--muted);
  flex-shrink: 0;
  text-align: right;
}

.section-end {
  margin-bottom: 0.35rem;
}

.more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.4rem;
  margin-top: 0.35rem;
}

.more a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.more svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 700px) {
  .wrap {
    padding: 1.75rem 1.25rem 4rem;
  }

  .entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    margin-bottom: 0.85rem;
  }

  .entry-meta {
    text-align: left;
    font-size: 0.92rem;
  }

  .nav {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    gap: 0.1rem 0.2rem;
  }
}

/* Notes index grouped by year */

.year {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 1.75rem 0 0.7rem;
}

.year:first-of-type {
  margin-top: 0.4rem;
}

/* Projects page blocks */

.project-block {
  margin-bottom: 1.75rem;
}

.project-block :is(h2, h3) {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
}

.project-block h3 {
  font-size: 1.28rem;
}

.project-block p {
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.project-block .stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  margin: 0 0 0.45rem;
  padding: 0;
}

.project-block .stack li {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.14rem 0.42rem;
}

.project-block .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.9rem;
  margin: 0.55rem 0 0.15rem;
  font-size: 0.95rem;
}

.project-block .links span {
  color: var(--muted);
}

.project-block .writeup {
  display: inline-flex;
  align-items: center;
  color: var(--bg);
  background: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  line-height: 1.2;
  padding: 0.32rem 0.75rem;
  border-radius: 4px;
}

.project-block .writeup:hover {
  color: var(--bg);
  background: #7e2f25;
  text-decoration: none;
}

.project-block .still {
  display: block;
  margin: 0.65rem 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--code-bg);
  transition: border-color var(--ease);
}

a.still:hover {
  border-color: rgba(154, 59, 47, 0.45);
}

.project-block .still img {
  width: 100%;
}

.coursework {
  margin-top: 2.6rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
}

.coursework > h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.parked {
  margin-top: 2.75rem;
}

.parked > p {
  color: var(--muted);
  margin-bottom: 1rem;
}

/* Resume */

.resume-id {
  margin-bottom: 1.75rem;
}

.resume-id h1 {
  margin-bottom: 0.15rem;
}

.resume-place,
.resume-line {
  color: var(--muted);
}

.resume-line {
  margin-top: 0.55rem;
  color: var(--text);
}

.resume-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.resume-row .when {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.95rem;
}

.resume-row p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

.resume-block {
  margin-bottom: 1.15rem;
}

.resume-block .resume-row {
  margin-bottom: 0.35rem;
}

.resume-points {
  margin: 0 0 0.1rem 1.15rem;
  font-size: 0.95rem;
}

.resume-points li {
  margin-bottom: 0.28rem;
  padding-left: 0.15rem;
}

.resume-points li::marker {
  color: var(--muted);
}

.resume-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
  margin-top: 2.5rem;
  color: var(--muted);
}

.resume-contact .icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  color: var(--muted);
  text-decoration: none;
}

.resume-contact .icon-link svg {
  width: 16px;
  height: 16px;
}

.resume-contact .icon-link:hover {
  color: var(--text);
}

.resume-id .resume-contact {
  margin-top: 0.8rem;
}

.resume-contact [aria-hidden="true"] {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  .resume-row {
    flex-direction: column;
    gap: 0.1rem;
  }
}

/* Long-form notes */

.note-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: -0.35rem 0 1.5rem;
}

.prose p {
  margin-bottom: 0.8rem;
}

.prose ul,
.prose ol {
  margin: 0.4rem 0 1rem 1.3rem;
}

.prose li {
  margin-bottom: 0.3rem;
}

.prose strong {
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

.prose h2 {
  margin-top: 2rem;
}

.prose figure {
  margin: 1.4rem 0 1.6rem;
}

.prose figcaption {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.4rem;
}

.prose pre,
.diagram {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  background: var(--code-bg);
  padding: 0.95rem 1.05rem;
  overflow-x: auto;
  margin: 1.1rem 0 1.35rem;
  color: var(--text);
}

.prose .mermaid {
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
}

.prose .mermaid svg {
  max-width: 100%;
  height: auto;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.08em 0.32em;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.note-nav {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

/* Bowling: a lane under the word, a strike by Honolulu */

.lane-ball {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 33% 34%, var(--bg) 0 1.1px, transparent 1.2px),
    radial-gradient(circle at 58% 28%, var(--bg) 0 1.1px, transparent 1.2px),
    radial-gradient(circle at 40% 56%, var(--bg) 0 1.1px, transparent 1.2px),
    var(--muted);
  opacity: 0.72;
}

.bowl {
  position: relative;
  display: inline-block;
  padding-bottom: 0.22em;
}

.bowl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.14em;
  height: 1px;
  background: var(--line);
}

.bowl .lane-ball {
  position: absolute;
  left: 0.04em;
  bottom: 0.03em;
  opacity: 0.8;
  transition: left 700ms cubic-bezier(0.22, 0.72, 0.28, 1),
    transform 700ms cubic-bezier(0.22, 0.72, 0.28, 1);
}

.bowl:hover .lane-ball {
  left: calc(100% - 9px);
  transform: rotate(240deg);
}

.lane {
  display: inline-flex;
  align-items: flex-end;
  height: 14px;
  margin-left: 0.2rem;
}

.lane .lane-ball {
  margin-right: 0.9rem;
  transition: transform 620ms cubic-bezier(0.22, 0.72, 0.28, 1);
}

.lane-pin {
  position: relative;
  width: 6px;
  height: 13px;
  flex-shrink: 0;
  transform-origin: 50% 92%;
  transition: transform 420ms ease;
}

.lane-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 5px;
  height: 12px;
  transform: translateX(-50%);
  background: var(--muted);
  border-radius: 50% 50% 30% 30% / 16% 16% 34% 34%;
  opacity: 0.5;
}

.lane-pin::after {
  content: "";
  position: absolute;
  top: 3.5px;
  left: 0.5px;
  right: 0.5px;
  height: 1.5px;
  background: var(--bg);
}

.colophon:hover .lane .lane-ball {
  transform: translateX(0.9rem) rotate(210deg);
}

.colophon:hover .lane-pin:nth-child(2) {
  transform: rotate(-44deg) translate(-1px, 1px);
  transition-delay: 360ms;
}

.colophon:hover .lane-pin:nth-child(3) {
  transform: rotate(8deg) translateY(1px);
  transition-delay: 400ms;
}

.colophon:hover .lane-pin:nth-child(4) {
  transform: rotate(50deg) translate(1px, 1px);
  transition-delay: 380ms;
}

/* Footer / colophon */

.colophon {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 3.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* 404 */

.not-found h1 {
  font-size: 2.4rem;
}

/* Motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .logo:hover svg {
    transform: none;
  }

  .bowl:hover .lane-ball,
  .colophon:hover .lane .lane-ball,
  .colophon:hover .lane-pin {
    transform: none;
    left: 0.04em;
  }

  .colophon:hover .lane-pin:nth-child(2),
  .colophon:hover .lane-pin:nth-child(3),
  .colophon:hover .lane-pin:nth-child(4) {
    transition-delay: 0s;
  }
}

/* Resume print */

@media print {
  .site-header,
  .skip,
  .colophon {
    display: none;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  a {
    text-decoration: none;
  }
}
