:root {
  --ink: #191714;
  --paper: #f4f0e8;
  --paper-deep: #ebe4d8;
  --muted: #676057;
  --line: #c9bca9;
  --accent: #d64b2a;
  --blue: #234f70;
  --green: #496b46;
  --shadow: rgba(25, 23, 20, 0.08);
  --shadow-hover: rgba(25, 23, 20, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(214, 75, 42, 0.22);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(214, 75, 42, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 92%, rgba(35, 79, 112, 0.1), transparent 24rem),
    linear-gradient(135deg, rgba(35, 79, 112, 0.1), transparent 30rem),
    linear-gradient(180deg, rgba(73, 107, 70, 0.07), transparent 42rem),
    var(--paper);
  font-family: "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

.shell {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
}

.nav a,
.text-link {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.nav a:hover,
.text-link:hover {
  border-bottom-color: var(--accent);
}

.nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.mast {
  display: grid;
  min-height: calc(100vh - 180px);
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 48px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 24px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h1,
.page-title {
  margin: 0;
  max-width: 860px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(60px, 10vw, 148px);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.02em;
}

.page-title {
  max-width: 980px;
  font-size: clamp(52px, 8vw, 112px);
}

.dek {
  max-width: 720px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(20px, 2.4vw, 34px);
  line-height: 1.22;
}

aside,
.rule {
  border-top: 2px solid var(--ink);
  padding-top: 18px;
}

.label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.label-spaced {
  margin-top: 28px;
}

.link {
  display: block;
  width: fit-content;
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.note {
  margin: 28px 0 0;
  border-left: 4px solid var(--blue);
  padding-left: 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 56px;
  align-items: start;
}

.page-copy {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
}

/* Library */

.library-page {
  display: grid;
  gap: 56px;
}

.library-header {
  max-width: 820px;
}

.shelf {
  display: grid;
  gap: 20px;
}

.shelf-label {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.1;
}

.shelf-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-card {
  position: relative;
  height: 100%;
  margin: 0;
  padding: 20px 20px 20px 24px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.book-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  border-radius: 4px 0 0 4px;
  background: var(--spine, var(--accent));
}

.book-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--line) 60%, var(--ink));
  box-shadow: 0 8px 24px var(--shadow-hover);
}

.book-author {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.book-title {
  margin: 0 0 12px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.book-signal {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Legacy entry styles (now page) */

.entry-list {
  display: grid;
  gap: 18px;
  margin: 0;
}

.entry {
  border-top: 2px solid var(--line);
  padding-top: 18px;
}

.entry h2 {
  margin: 0 0 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.entry p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.meta {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 28px, 1120px);
    padding-top: 22px;
    padding-bottom: 48px;
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 36px;
  }

  .mast,
  .page {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .library-page {
    gap: 44px;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }
}
