:root {
  --ink: #1c1916;
  --muted: #5e574f;
  --paper: #f3eee6;
  --rule: #e0d6c8;
  --thread: #7a3142;
  --cloth: #221e1b;
  --cream: #f4efe8;
  --underline: #b08993;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.35'/></svg>");
  background-blend-mode: multiply;
  font-family: Newsreader, "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

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

button,
a {
  -webkit-tap-highlight-color: rgba(122, 49, 66, 0.16);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 5;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  text-decoration: none;
}

.skip:focus {
  top: 1rem;
}

.page {
  width: min(38rem, calc(100% - 2.5rem));
  margin-inline: auto;
  padding: 3.5rem 0 3.25rem;
  position: relative;
}

.kicker,
nav,
main h2,
.meta,
.cover-series,
form label[for="email"],
footer,
.preview-kicker,
.preview-actions,
.actions,
button {
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
}

.kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0.35rem 0 0;
  font-family: Fraunces, "Iowan Old Style", Palatino, Georgia, serif;
  font-weight: 560;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 40, "WONK" 1, "opsz" 144;
  font-size: clamp(3.4rem, 12vw, 5.5rem);
  letter-spacing: -0.035em;
  line-height: 0.92;
}

.lede {
  margin: 1.2rem 0 0;
  max-width: 34rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.35rem;
  font-size: 0.95rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--underline);
}

nav span {
  color: var(--muted);
}

main section {
  margin-top: 3.6rem;
  scroll-margin-top: 1.25rem;
}

main h2 {
  margin: 0 0 0.7rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

#books-intro,
.noscript {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.noscript {
  margin-bottom: 1rem;
}

.book {
  display: grid;
  grid-template-columns: 8.75rem minmax(0, 1fr);
  column-gap: 1.35rem;
  align-items: start;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}

.book:last-child {
  border-bottom: 1px solid var(--rule);
}

.cover {
  position: relative;
  background: var(--cloth);
  color: var(--cream);
  aspect-ratio: 2 / 3;
  padding: 0.7rem 0.6rem 0.95rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 4px 5px 0 rgba(28, 25, 22, 0.06);
}

.cover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--thread);
}

.cover-series {
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: #e7d9dc;
}

.cover strong {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 0.92rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover.has-image {
  padding: 0;
}

.cover.has-image::after {
  display: none;
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meta {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.book h3 {
  margin: 0 0 0.4rem;
  font-family: Fraunces, "Iowan Old Style", Palatino, Georgia, serif;
  font-weight: 560;
  font-size: clamp(1.6rem, 3vw, 1.9rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  overflow-wrap: break-word;
}

.blurb {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.45rem 0 0;
}

.actions a,
.actions button,
.preview-actions a,
.preview-actions button {
  font-size: 0.95rem;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0.35rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--underline);
  cursor: pointer;
}

.actions a:hover,
.actions button:hover,
.preview-actions a:hover,
.preview-actions button:hover {
  color: var(--thread);
}

.dot {
  color: var(--muted);
  padding: 0 0.55rem;
}

#notes p {
  margin: 0;
  max-width: 34rem;
}

form {
  margin-top: 1.15rem;
}

form label[for="email"] {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.signup-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 32rem;
  margin-top: 0.3rem;
  border-bottom: 1px solid var(--ink);
}

input[type="email"] {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: Newsreader, Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.4;
  padding: 0.7rem 0;
}

input[type="email"]:focus {
  outline: none;
}

input[type="email"]:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 4px;
}

.signup-row:focus-within {
  border-bottom-color: var(--thread);
}

button[type="submit"] {
  flex-shrink: 0;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.95rem;
  min-height: 44px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: #3a332e;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.fine,
.status {
  margin: 0.85rem 0 0;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

.status:empty {
  margin: 0;
}

footer {
  margin-top: 4rem;
}

footer p {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

dialog {
  width: min(52rem, calc(100vw - 2rem));
  height: min(90dvh, 52rem);
  max-width: calc(100vw - 2rem);
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  border: 1px solid #d9d1c4;
  background: var(--paper);
  color: var(--ink);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(28, 25, 22, 0.55);
}

.preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.preview-heading {
  min-width: 0;
}

.preview-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

#preview-title {
  margin: 0.1rem 0 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.preview-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 1rem;
}

.preview-body {
  flex: 1;
  min-height: 0;
  background: #e6e0d6;
  overflow: auto;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
  display: block;
}

.preview-note {
  max-width: 32rem;
  padding: 2rem 1.35rem 2.5rem;
}

.preview-note p {
  margin: 0;
}

.preview-note a {
  display: inline-flex;
  align-items: center;
  margin-top: 1.1rem;
  min-height: 44px;
  padding: 0.7rem 0.95rem;
  background: var(--ink);
  color: var(--paper);
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.88rem;
  text-decoration: none;
}

.preview-note a:hover {
  background: #3a332e;
  color: var(--paper);
}

@media (min-width: 960px) {
  .page {
    width: min(38rem, calc(100% - 12rem));
    margin-left: clamp(7.5rem, 18vw, 13rem);
    margin-right: auto;
    padding-top: 5rem;
  }

  .page::before {
    content: "";
    position: absolute;
    left: -2.25rem;
    top: 5rem;
    bottom: 3.25rem;
    width: 1px;
    background: #e3dacd;
  }
}

@media (max-width: 420px) {
  .signup-row {
    flex-wrap: wrap;
    border-bottom: 0;
    gap: 0.85rem;
  }

  input[type="email"] {
    flex: 1 1 100%;
    border-bottom: 1px solid var(--ink);
  }

  button[type="submit"] {
    align-self: flex-start;
  }
}

@media (max-width: 700px) {
  dialog {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border: 0;
  }

  .preview-bar {
    align-items: flex-start;
  }

  #preview-title {
    font-size: 1.05rem;
  }
}

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

@media print {
  body {
    background: white;
  }

  nav,
  form,
  .fine,
  .status,
  .preview-actions {
    display: none;
  }

  .page::before {
    display: none;
  }

  a {
    text-decoration: underline;
  }
}
