@font-face {
  font-family: Fraunces;
  src: url("/assets/fraunces-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Fraunces;
  src: url("/assets/fraunces-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Caladea;
  src: url("/assets/caladea-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Caladea;
  src: url("/assets/caladea-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Caladea;
  src: url("/assets/caladea-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #faf9f6;
  --ink: #302f2a;
  --quiet: #625e55;
  --link: #335768;
  --wash: #ecefeb;
  --image-ground: #eeece5;
  --rule: #d9d5ca;
  --focus: #234b60;
  --white: #fffefb;
  --display: Fraunces, Georgia, "Times New Roman", serif;
  --reading: Caladea, Georgia, "Times New Roman", serif;
  --body-size: clamp(1.1875rem, 1.1rem + .2vw, 1.3125rem);
  --small-size: 1.0625rem;
  --display-size: clamp(2.5rem, 1.65rem + 3.35vw, 4.5rem);
  --section-size: clamp(1.7rem, 1.45rem + .6vw, 2.15rem);
  --subhead-size: 1.3rem;
  --leading: 1.58;
  --tight-leading: 1.12;
  --page-width: 70rem;
  --reading-width: 40rem;
  --margin-width: 14.5rem;
  --page-edge: clamp(1.35rem, 5vw, 5rem);
  --gap: clamp(2rem, 5vw, 5rem);
  --space-xs: .5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4.5rem;
  --space-hero: clamp(2.5rem, 6vw, 5.5rem);
  --radius: 1.15rem;
  --touch: 2.75rem;
  --stroke: 1px;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-padding-top: var(--space-md); }
body {
  max-width: calc(var(--page-width) + var(--page-edge) * 2);
  margin: 0 auto;
  padding: 0 var(--page-edge);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--reading);
  font-size: var(--body-size);
  line-height: var(--leading);
  overflow-wrap: break-word;
}

body > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) 0 var(--space-md);
  border-bottom: var(--stroke) solid var(--rule);
}

body > header p { margin: 0; font-size: var(--small-size); }
body > header p:first-child { font-family: var(--display); font-size: 1.5rem; }
body > header span {
  display: block;
  margin-top: .15rem;
  font-family: var(--reading);
  font-size: var(--small-size);
  color: var(--quiet);
}

#skip {
  position: absolute;
  left: var(--space-sm);
  top: var(--space-sm);
  z-index: 2;
  transform: translateY(-180%);
  padding: var(--space-xs) var(--space-sm);
  background: var(--white);
  border: 2px solid var(--focus);
}
#skip:focus { transform: translateY(0); }

main { padding-bottom: var(--space-xl); }
main:focus { outline: none; }
main > header, #opening { margin: var(--space-hero) 0 var(--space-xl); }
main > header { max-width: var(--reading-width); }
main > header > p:first-child, #opening header > p:first-child {
  margin: 0 0 var(--space-md);
  color: var(--quiet);
  font-size: var(--small-size);
}
main > header > p:last-child, #opening header > p:last-child {
  max-width: 34rem;
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.5;
}

h1, h2 { font-family: var(--display); font-weight: 400; text-wrap: balance; }
h1 { margin: 0 0 var(--space-lg); font-size: var(--display-size); line-height: var(--tight-leading); }
h1 em { font-weight: 400; color: var(--link); }
h2 { margin: 0 0 var(--space-md); font-size: var(--section-size); line-height: 1.22; }
h3 { margin: var(--space-lg) 0 var(--space-xs); font-size: var(--subhead-size); line-height: 1.35; }
p { margin: 0 0 var(--space-sm); }
p:last-child { margin-bottom: 0; }

a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: .35rem 0;
  color: var(--link);
  text-decoration-thickness: var(--stroke);
  text-underline-offset: .22em;
  overflow-wrap: anywhere;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

main > section {
  display: grid;
  grid-template-columns: minmax(0, var(--reading-width)) minmax(0, var(--margin-width));
  gap: var(--gap);
  margin-bottom: var(--space-xl);
}
main > section > div { min-width: 0; }
aside { padding-top: .35rem; font-size: var(--small-size); color: var(--quiet); }
aside dl { margin: 0; border-top: 3px solid var(--rule); padding-top: var(--space-sm); }
aside dt { color: var(--ink); font-weight: 700; margin-bottom: var(--space-xs); }
aside dd { margin: 0; line-height: 1.5; }

#opening {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--gap);
}
#opening h1 { font-size: clamp(2.65rem, 1.65rem + 3vw, 4.15rem); }
figure { margin: 0; min-width: 0; }
img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  background: var(--image-ground);
  border-radius: var(--radius);
  color: var(--quiet);
  font: var(--small-size)/1.5 var(--reading);
  object-fit: cover;
}
#opening img { aspect-ratio: 960 / 704; }
aside img { aspect-ratio: 640 / 768; }
figcaption { margin-top: var(--space-sm); color: var(--quiet); font-size: var(--small-size); line-height: 1.45; }

ul, ol { padding-left: var(--space-md); margin: 0 0 var(--space-md); }
li { margin-bottom: var(--space-xs); padding-left: .15rem; }
li::marker { color: var(--quiet); }
#visit-steps li { padding-left: var(--space-xs); margin-bottom: var(--space-lg); }
#visit-steps h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: var(--body-size); }
caption { text-align: left; color: var(--quiet); margin-bottom: var(--space-sm); font-size: var(--small-size); }
th, td { text-align: left; vertical-align: top; border-bottom: var(--stroke) solid var(--rule); padding: var(--space-sm) var(--space-xs); }
thead th { background: var(--wash); }
tbody th { width: 28%; }

#notes > div { padding: var(--space-lg); border-radius: var(--radius); background: var(--wash); }
label { display: block; margin: var(--space-md) 0 var(--space-xs); font-weight: 700; }
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 13rem;
  resize: vertical;
  border: var(--stroke) solid var(--quiet);
  border-radius: .6rem;
  padding: var(--space-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  line-height: var(--leading);
}
#note-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-sm); margin-top: var(--space-sm); }
button {
  min-height: var(--touch);
  padding: .55rem var(--space-sm);
  border: 2px solid var(--link);
  border-radius: .65rem;
  color: var(--white);
  background: var(--link);
  font: 700 var(--small-size)/1.3 var(--reading);
  cursor: pointer;
}
button + button { color: var(--link); background: var(--white); }
button:hover:enabled { text-decoration: underline; text-underline-offset: .18em; }
button:disabled { cursor: default; color: var(--quiet); border-color: var(--quiet); background: var(--wash); }
#note-status { min-height: 3rem; margin: var(--space-sm) 0 0; font-size: var(--small-size); color: var(--quiet); }

#endnotes { padding-top: var(--space-lg); border-top: var(--stroke) solid var(--rule); }
#endnotes h2 { font-size: 1.65rem; }
#endnotes ul { list-style: none; padding: 0; margin: 0; }
#endnotes li { margin: 0 0 var(--space-sm); padding: 0; font-size: var(--small-size); }
#endnotes li a { font-weight: 700; }
#endnotes li p { color: var(--quiet); line-height: 1.45; }

#chapters { margin-top: var(--space-xl); }
#chapters > p { font-family: var(--display); font-size: 1.65rem; }
#chapters ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; margin: var(--space-md) 0 0; padding: 0; gap: var(--space-sm) var(--space-lg); }
#chapters li { margin: 0; padding: 0; border-top: 2px solid var(--rule); }
#chapters li > a, #chapters li > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: .15rem var(--space-xs);
  width: 100%;
  height: 100%;
  min-height: 7rem;
  padding: var(--space-sm) 0;
  font-size: var(--small-size);
  text-decoration: none;
}
#chapters strong { font-family: var(--display); font-size: 1.45rem; font-weight: 400; }
#chapters li > a > span:first-of-type, #chapters li > span > span:first-of-type { grid-column: 1; color: var(--quiet); }
#chapters li > a > span:last-child, #chapters li > span > span:last-child { grid-column: 2; grid-row: 1 / 3; align-self: center; }
#chapters li > span { color: var(--ink); }
#chapters [aria-current] > span:last-child { color: var(--quiet); font-style: italic; }
#chapters a:hover strong { text-decoration: underline; text-underline-offset: .18em; }

footer { padding: var(--space-lg) 0; border-top: var(--stroke) solid var(--rule); color: var(--quiet); font-size: var(--small-size); }
footer p { max-width: var(--reading-width); }

@media (max-width: 760px) {
  :root { --space-xl: 3.25rem; --body-size: 1.1875rem; --gap: 1.5rem; }
  body > header { align-items: start; gap: var(--space-sm); }
  body > header p:last-child { max-width: 6rem; text-align: right; line-height: 1.4; }
  main > section { grid-template-columns: minmax(0, 1fr); }
  main > section > aside { max-width: 30rem; padding: var(--space-sm) var(--space-md); background: var(--wash); border-radius: .85rem; }
  aside dl { padding-top: 0; border-top: 0; }
  #opening { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  #opening figure { max-width: 34rem; }
  #opening h1 { font-size: clamp(2.6rem, 9.4vw, 3.8rem); }
  main > header > p:last-child, #opening header > p:last-child { font-size: 1.3rem; }
  aside:has(figure) { max-width: 21rem; }
  #chapters ul { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
  #chapters li > a, #chapters li > span { min-height: 6rem; }
  #chapters li > span > span:last-child { max-width: 3.5rem; text-align: right; }
  #notes > div { padding: var(--space-md); }
  th, td { padding: var(--space-sm) .35rem; }
  tbody th { width: 31%; }
  #endnotes > aside { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media print {
  :root { --ink: #000; --quiet: #303030; --link: #000; --paper: #fff; }
  body { max-width: none; padding: 0; font-size: 12pt; }
  body > header { padding-top: 0; }
  #opening, main > section { display: block; }
  aside { margin-top: var(--space-sm); }
  #skip, #chapters, #note-actions, #note-status { display: none; }
  a { min-height: 0; }
  figure { max-width: 16rem; }
  textarea { border: var(--stroke) solid var(--quiet); }
}
