:root {
  --ink: #141414;
  --soft: #6b6b6b;
  --paper: #ffffff;
  --serif: "Spectral", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --gutter: clamp(1.5rem, 5vw, 4rem);
  --small: 0.875rem;
}

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

/* Always reserve the scrollbar, so the layout doesn't shift between short and long pages */
html { -webkit-text-size-adjust: 100%; overflow-y: scroll; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.1875rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* Link with an underline that draws in and dissolves to the right */
.line-link {
  padding-bottom: 0.2em;
  background: linear-gradient(90deg, var(--ink), transparent) left bottom / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease);
}
.line-link:hover,
.line-link:focus-visible,
.line-link[aria-current="page"] { background-size: 100% 1px; }
.line-link.is-open { background-size: 100% 1px; }

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.label {
  font-family: var(--sans);
  font-size: var(--small);
  font-weight: 500;
  color: var(--soft);
  line-height: 1.5;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  padding-top: 1.75rem;
}
.site-header .home,
.site-nav a {
  font-family: var(--sans);
  font-size: var(--small);
  font-weight: 500;
}
.site-nav { display: flex; gap: 1.5rem; }

/* Lines that fade toward the right; `.in` draws them */
.rule {
  height: 1px;
  background: linear-gradient(90deg, var(--ink), transparent);
  transform-origin: left;
}
.js .rule { transform: scaleX(0); transition: transform 1.6s var(--ease); }
.js .in .rule, .js .rule.in { transform: scaleX(1); }

/* Traces: a stack of lines, like verses, that appear and vanish */
.traces { display: grid; gap: clamp(1.1rem, 2.6vh, 1.75rem); }
.traces i {
  display: block;
  height: 1px;
  width: var(--w);
  background: linear-gradient(90deg, var(--ink), transparent);
  transform-origin: left;
  opacity: var(--end);
  animation: trace 3.6s var(--ease) var(--d) both;
}
@keyframes trace {
  0% { transform: scaleX(0); opacity: 1; }
  40% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: var(--end); }
}
.traces i:nth-child(1) { --w: 100%; --d: 0.2s; --end: 0.28; }
.traces i:nth-child(2) { --w: 74%; --d: 0.5s; --end: 0; }
.traces i:nth-child(3) { --w: 88%; --d: 0.8s; --end: 0.12; }
.traces i:nth-child(4) { --w: 46%; --d: 1.1s; --end: 0; }
.traces i:nth-child(5) { --w: 62%; --d: 1.4s; --end: 0.06; }
.traces i:nth-child(6) { --w: 28%; --d: 1.7s; --end: 0; }

/* Cover */
.cover {
  min-height: calc(100vh - 4rem);
  min-height: calc(100svh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
  padding: clamp(3rem, 9vh, 6rem) 0 3.5rem;
}
.cover .traces { flex: 1; align-content: center; }

h1 {
  font-size: clamp(3.25rem, 12vw, 8.5rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
}
.role { margin-top: 1.25rem; }

.verse {
  font-size: clamp(1.375rem, 3vw, 2rem);
  line-height: 1.3;
}
.verse span { display: block; }
.verse cite { display: block; margin-top: 1rem; font-style: normal; }

/* Sections: label on the left, content on the right */
.block { padding-bottom: clamp(3.5rem, 9vh, 6rem); }
.block > .rule { margin-bottom: 1.5rem; }
.block-body { display: grid; gap: 1.5rem; }
.block-body p + p { margin-top: 1.25em; }
.prose { max-width: 36rem; }

.more { margin-top: 2rem; }
.more a, .lost p a { font-family: var(--sans); font-size: var(--small); font-weight: 500; }

.big {
  font-size: clamp(1.5rem, 3.4vw, 2.25rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  max-width: 34rem;
}

/* Lists */
.list { list-style: none; }
.list li { padding-bottom: 1.5rem; }
.list li:last-child { padding-bottom: 0; }
.list .rule { margin-bottom: 1.25rem; opacity: 0.25; }
.list li:first-child .rule { display: none; }
.title { display: block; font-size: clamp(1.375rem, 2.6vw, 1.75rem); line-height: 1.3; }
.meta { display: block; margin-top: 0.3rem; font-family: var(--sans); font-size: var(--small); font-weight: 500; line-height: 1.5; color: var(--soft); }

/* Inner pages */
.page-head { padding: clamp(3.5rem, 12vh, 7rem) 0 clamp(3rem, 8vh, 5rem); }
.page-head h1 { font-size: clamp(3rem, 9vw, 6.5rem); }

/* 404 */
.lost {
  min-height: calc(100vh - 4rem);
  min-height: calc(100svh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5rem;
  padding: 3rem 0;
}
.lost .traces i { --end: 0 !important; }

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 0 2.5rem;
}

.site-footer { align-items: center; }
.footer-links { display: flex; align-items: center; gap: 1.25rem; text-transform: none; letter-spacing: 0; }
.icon-link { display: inline-flex; color: var(--soft); transition: color 0.3s; }
.icon-link:hover { color: var(--ink); }
.icon-link svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.4; }

/* Latest book on the home page */
.feature { display: grid; gap: 1.75rem; }
.feature img { display: block; width: min(15rem, 70%); height: auto; }
.feature h3 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 300; line-height: 1.1; letter-spacing: -0.015em; margin: 0.5rem 0 1rem; }

/* Book covers */
.covers { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem 1.25rem; }
.cover-art { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #f6f6f6; transition: transform 0.8s var(--ease); }
.covers a:hover .cover-art { transform: translateY(-0.35rem); }
.covers .title { font-size: 1.125rem; margin-top: 0.75rem; }

/* A book without a cover: its title over lines that fade */
.cover-blank { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 1rem; font-size: 1.125rem; line-height: 1.2; background: repeating-linear-gradient(180deg, transparent 0 1.4rem, #dcdcdc 1.4rem calc(1.4rem + 1px)); -webkit-mask-image: linear-gradient(90deg, #000 45%, rgba(0, 0, 0, 0.35)); mask-image: linear-gradient(90deg, #000 45%, rgba(0, 0, 0, 0.35)); }

/* Books page */
.book { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1.25rem; padding-bottom: clamp(3rem, 7vh, 4.5rem); }
.book > .rule { grid-column: 1 / -1; }
.book .cover-blank { font-size: 0.9375rem; padding: 0.5rem; }
.book h2 { font-size: clamp(1.625rem, 3.4vw, 2.5rem); font-weight: 300; line-height: 1.15; margin: 0.35rem 0 0.25rem; }
.book p + p { margin-top: 0.75em; }
.book .more { margin-top: 1.25rem; }

/* Archive */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 1rem; }
.filter { border: 0; background-color: transparent; cursor: pointer; color: var(--soft); font-family: var(--sans); font-size: var(--small); font-weight: 500; }
.filter[aria-pressed="true"] { color: var(--ink); background-size: 100% 1px; }
.entries { list-style: none; }
.entry { padding-bottom: 2rem; }
.entry .rule { margin-bottom: 2rem; opacity: 0.3; transform: none !important; }
.entry-body { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem; }
.entry-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; filter: grayscale(1); transition: filter 0.6s; }
.entry:hover .entry-thumb img { filter: none; }
.entry-title { display: block; font-size: clamp(1.25rem, 2.4vw, 1.625rem); line-height: 1.25; margin-top: 0.35rem; }
.entry-summary { margin-top: 0.5rem; font-size: 1.0625rem; max-width: 36rem; }
.block-body .entries .entry:first-child .rule { display: none; }

/* About */
.portrait { display: block; width: 100%; max-width: 36rem; height: auto; margin-bottom: 2.5rem; filter: grayscale(1); }

/* Contact */
.mail { font-size: clamp(1.375rem, 5.2vw, 3rem); font-weight: 300; line-height: 1.2; letter-spacing: -0.015em; overflow-wrap: anywhere; }

/* Soft reveal on scroll */
.js .reveal {
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 1.1s var(--ease) 0.15s, transform 1.1s var(--ease) 0.15s;
}
.js .in .reveal, .js .reveal.in { opacity: 1; transform: none; }

@media (min-width: 48rem) {
  .block-body { grid-template-columns: 1fr 3fr; gap: 2rem; }
  .feature { grid-template-columns: 15rem 1fr; gap: 3rem; align-items: end; }
  .feature img { width: 100%; }
  .covers { grid-template-columns: repeat(3, 1fr); gap: 3rem 2rem; }
  .book { grid-template-columns: 1fr 3fr; column-gap: 2rem; }
  .book .cover-art { max-width: 11rem; }
  .entry-body { grid-template-columns: 8rem 1fr; gap: 2rem; }
  .verse-wrap { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; }
  .verse-wrap .verse { grid-column: 2; }
  .site-nav { gap: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .traces i { animation: none; }
  .js .rule { transform: none; transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .line-link { transition: none; }
  .lost .traces i { --end: 0.2 !important; }
}
