/* The reading views. Palette, type, and space come from tokens.css, which the
 * page links ahead of this file, so these pages and the lab stay one design. */

:root {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
a:hover {
  color: var(--green);
  text-decoration-color: currentColor;
}
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 5px;
}
::selection {
  background: var(--green-soft);
}

.reading-layout {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
.reading-main {
  width: min(100% - 48px, 760px);
  margin-inline: auto;
  flex: 1;
  padding-block: 68px 72px;
}

.story-page {
  overflow-wrap: break-word;
  font-size: var(--text-base);
  line-height: var(--leading-body);
}
.story-header {
  margin-bottom: 32px;
}
h1 {
  margin: 0 0 19px;
  max-width: 700px;
  font-size: clamp(33px, 4.2vw, 52px);
  font-weight: 550;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}
h2 {
  margin: 0 0 16px;
  font-size: var(--text-xl);
  font-weight: 550;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
h3 {
  margin: 0 0 7px;
  font-size: var(--text-md);
  font-weight: 550;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
p {
  margin: 0 0 16px;
}
.story-lead {
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: var(--leading-body);
}
.profile-location {
  margin-top: 14px;
  color: var(--muted);
  font-size: var(--text-sm);
}
.profile-section {
  margin-top: 54px;
  scroll-margin-top: 30px;
}
.profile-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 28px;
  font-size: var(--text-sm);
  color: var(--green);
}
.story-section {
  margin-top: 29px;
}
.story-section h2 {
  font-size: 22px;
}

.story-project-list {
  border-top: 1px solid var(--line);
}
.story-project-row {
  position: relative;
  padding: 24px 32px 24px 0;
  border-bottom: 1px solid var(--line);
}
.story-project-row h3 {
  font-size: 23px;
}
.story-project-row h3 a {
  display: block;
  text-decoration: none;
}
.story-project-row h3 a::after {
  position: absolute;
  inset: 0;
  content: "";
}
.story-project-row:hover h3 {
  color: var(--green);
}
.story-project-row h3 {
  transition: color var(--fast) var(--ease);
}
.story-project-row p {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.timeline {
  border-top: 1px solid var(--line);
}
.timeline-item {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 25px;
  padding-block: 25px;
  border-bottom: 1px solid var(--line);
}
.timeline-item time {
  padding-top: 2px;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}
.timeline-item .role {
  margin-bottom: 10px;
  color: var(--green);
  font-size: var(--text-sm);
}
.timeline-item p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.8;
}

.story-flow {
  margin: 34px 0;
  padding: 25px 0 19px;
  border-block: 1px solid var(--line);
}
.story-flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.story-flow-steps li {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.story-flow-steps li + li::before {
  position: absolute;
  left: -23px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  content: "→";
}
.story-flow-steps strong {
  display: block;
  margin-bottom: 5px;
  font-size: var(--text-sm);
  font-weight: 550;
  line-height: 1.4;
}
.story-flow-steps span {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.65;
}
.story-flow figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.65;
}
.story-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 24px;
  margin-top: 22px;
  color: var(--green);
  font-size: var(--text-sm);
}
.story-next {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: var(--text-sm);
}
.story-email {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(21px, 4vw, 28px);
  letter-spacing: -0.5px;
  text-underline-offset: 6px;
}

@media (max-width: 560px) {
  .reading-main {
    width: calc(100% - 36px);
  }
  .reading-main {
    padding-block: 43px 50px;
  }
  h1 {
    letter-spacing: -1.2px;
  }
  .story-lead {
    font-size: 17px;
  }
  .profile-section {
    margin-top: 42px;
  }
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .story-flow-steps {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  .story-flow-steps li + li::before {
    top: -25px;
    left: 16px;
    transform: none;
    content: "↓";
  }
}

@media print {
  @page {
    /* Respect the visitor's A4 or Letter paper choice. */
    size: auto;
    margin: 16mm 18mm 18mm;
  }
  :root {
    --ink: #232a26;
    --muted: #4e5b52;
    --green: #2f6046;
    --line: #d0d4c9;
    color: var(--ink);
    background: #fff;
  }
  body {
    min-width: 0;
    background: #fff;
  }
  .reading-layout {
    display: block;
    min-height: 0;
  }
  .site-chrome-header,
  .site-chrome-footer,
  .profile-contents,
  .story-next,
  .skip-link {
    display: none;
  }
  .reading-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .story-page {
    font-size: 10.5pt;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .story-header {
    margin-bottom: 18pt;
    break-inside: avoid;
  }
  h1 {
    max-width: none;
    margin-bottom: 10pt;
    font-size: 27pt;
    letter-spacing: -0.035em;
  }
  h2,
  .story-section h2 {
    margin-bottom: 9pt;
    font-size: 15pt;
  }
  h3,
  .story-project-row h3 {
    margin-bottom: 5pt;
    font-size: 11.5pt;
  }
  h1,
  h2,
  h3 {
    break-after: avoid;
  }
  p,
  li {
    orphans: 3;
    widows: 3;
  }
  p {
    margin-bottom: 8pt;
  }
  .story-lead {
    font-size: 12pt;
    line-height: 1.45;
  }
  .profile-location {
    margin-top: 8pt;
    font-size: 9pt;
  }
  .profile-section {
    margin-top: 22pt;
  }
  .story-section {
    margin-top: 14pt;
  }
  .timeline-item,
  .story-flow,
  .story-project-row,
  .profile-page [id^="book-"] {
    break-inside: avoid;
  }
  .timeline-item {
    grid-template-columns: 30mm minmax(0, 1fr);
    gap: 6mm;
    padding-block: 10pt;
  }
  .timeline-item time {
    padding-top: 0;
    font-size: 8.5pt;
    line-height: 1.5;
  }
  .timeline-item .role,
  .timeline-item p:last-child,
  .story-project-row p {
    font-size: 10pt;
    line-height: 1.45;
  }
  .timeline-item .role {
    margin-bottom: 5pt;
  }
  .story-project-row {
    padding: 10pt 0;
  }
  .story-project-row h3 a::after {
    display: none;
  }
  .story-flow {
    margin: 16pt 0;
    padding-block: 12pt;
  }
  .story-flow-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16pt;
  }
  .story-flow-steps li {
    padding: 8pt;
  }
  .story-flow-steps strong {
    font-size: 10pt;
  }
  .story-flow-steps span,
  .story-flow figcaption {
    font-size: 9pt;
    line-height: 1.4;
  }
  .story-links {
    margin-top: 10pt;
    gap: 6pt 14pt;
    font-size: 9pt;
    break-inside: avoid;
  }
  .story-email {
    font-size: 15pt;
  }
  .story-page .health-grid {
    margin: 12pt 0;
    gap: 8pt 12pt;
  }
  .story-page:has(.health-identity) .story-section {
    margin-top: 8pt;
  }
  .story-page .health-grid > div {
    padding-top: 8pt;
    break-inside: avoid;
  }
  .story-page .health-grid dt {
    font-size: 9pt;
  }
  .story-page .health-grid dd {
    margin: 4pt 0;
    font-size: 17pt;
    line-height: 1.2;
  }
  .story-page .health-grid small,
  .story-page .health-muted {
    font-size: 9pt;
    line-height: 1.4;
  }
  .story-page .health-identity {
    margin: 8pt 0;
    font-size: 8.5pt;
    line-height: 1.4;
    break-inside: avoid;
  }
  .story-page .health-identity dt {
    margin-top: 6pt;
    break-after: avoid;
  }
  .story-section:has(> .health-identity) .story-links {
    display: none;
  }
  a {
    color: var(--green);
    text-decoration: underline;
    text-decoration-thickness: 0.5pt;
    text-underline-offset: 2pt;
  }
  a[download],
  .story-links a[href="/cv.md"] {
    display: none;
  }
}
