/* The Library — dark reading-room theme. Vanilla CSS, no deps. */
:root {
  --bg: #0a0c0e;
  --bg2: #101316;
  --panel: #15191d;
  --ink: #eef1f4;
  --muted: #98a3ac;
  --faint: #5b656d;
  --line: #232a30;
  --amber: #e09634;
  --steel: #96a8b2;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 50% -200px, #161b20 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.view[hidden] { display: none; }

/* ===== Library header ===== */
.lib-head {
  max-width: 1180px;
  margin: 0 auto;
  padding: 54px 28px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; flex-direction: column; gap: 7px; }
.brand-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: .01em;
  line-height: 1;
}
.brand-tag { color: var(--muted); font-size: 15px; }
.brand-count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
  padding-bottom: 6px;
}

/* ===== Shelf grid ===== */
.shelf {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
}
.book { display: flex; flex-direction: column; gap: 10px; }
.book-open {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.book-recipe {
  align-self: flex-start;
  color: var(--steel);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.book-recipe:hover { color: var(--amber); border-color: rgba(224,150,52,.4); }
.book-cover {
  position: relative;
  aspect-ratio: 6.625 / 10.25;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform .22s ease, box-shadow .22s ease;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book:hover .book-cover { transform: translateY(-5px); box-shadow: 0 26px 60px rgba(0,0,0,.62); }
.book-cover::after {
  content: "Read →";
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 14px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  opacity: 0;
  transition: opacity .22s ease;
}
.book:hover .book-cover::after { opacity: 1; }
.book-meta { display: flex; flex-direction: column; gap: 5px; }
.book-title { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.1; }
.book-sub { color: var(--steel); font-size: 13.5px; font-weight: 500; }
.book-logline { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 3px; }
.book-status {
  margin-top: 4px;
  font-size: 12px;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.book-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 8px var(--amber);
}

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 50px;
  color: var(--faint);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* ===== Reader ===== */
.rd-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(10,12,14,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.rd-back {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.rd-back:hover { border-color: var(--steel); }
.rd-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rd-name { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-sub { color: var(--steel); font-size: 12.5px; }
.rd-tools { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.rd-page { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.rd-dl {
  color: var(--amber);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid rgba(224,150,52,.35);
  padding: 7px 12px;
  border-radius: 8px;
}
.rd-dl:hover { background: rgba(224,150,52,.1); }

.pages {
  max-width: 820px;
  margin: 0 auto;
  padding: 30px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.pages img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: var(--shadow);
  background: var(--panel);
}

.rd-up {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(21,25,29,.9);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.rd-up:hover { border-color: var(--steel); }

.rd-ghost {
  color: var(--steel);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 8px;
}
.rd-ghost:hover { color: var(--amber); border-color: rgba(224,150,52,.4); }

/* ===== Recipe / "How it was made" ===== */
.recipe {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 22px 120px;
}
.rc-head { margin-bottom: 36px; }
.rc-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.05;
  margin: 0 0 14px;
}
.rc-intro { color: var(--muted); font-size: 17px; line-height: 1.6; margin: 0; }
.rc-step { margin: 0 0 40px; }
.rc-step h3, .rc-anatomy h3, .rc-tools h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 10px;
  color: var(--ink);
}
.rc-step p, .rc-anatomy p { color: var(--muted); font-size: 15.5px; line-height: 1.65; margin: 0; }
.rc-media { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.rc-media.rc-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.rc-media figure { margin: 0; }
.rc-media img, .rc-final img, .rc-raws img {
  width: 100%; height: auto; display: block;
  border-radius: 6px; border: 1px solid var(--line);
  box-shadow: var(--shadow); background: var(--panel);
}
.rc-media figcaption, .rc-final figcaption {
  margin-top: 8px; color: var(--faint); font-size: 13px; line-height: 1.5;
}

.rc-anatomy {
  margin: 54px 0 40px;
  padding: 26px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
}
.rc-anatomy-flow { margin-top: 18px; }
.rc-raws { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rc-final { max-width: 360px; margin: 0 auto; }
.rc-final figure { margin: 0; }
.rc-arrow { text-align: center; color: var(--amber); font-size: 26px; margin: 16px 0; }

.rc-tools { margin: 44px 0 0; }
.rc-tools ul { margin: 12px 0 0; padding: 0; list-style: none; }
.rc-tools li {
  color: var(--muted); font-size: 15px; line-height: 1.5;
  padding: 10px 0 10px 22px; border-bottom: 1px solid var(--line); position: relative;
}
.rc-tools li::before { content: "→"; position: absolute; left: 0; color: var(--amber); }

.rc-outro { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 40px 0 0; font-style: italic; }
.rc-cta { margin-top: 38px; }
.rc-cta a {
  display: inline-block;
  color: var(--amber); text-decoration: none; font-weight: 600; font-size: 16px;
  border: 1px solid rgba(224,150,52,.4); padding: 12px 20px; border-radius: 9px;
}
.rc-cta a:hover { background: rgba(224,150,52,.1); }
.rc-loading { color: var(--faint); text-align: center; padding: 60px 0; }

@media (max-width: 560px) {
  .lib-head { padding: 34px 18px 16px; }
  .shelf { padding: 12px 18px 60px; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .book-logline { display: none; }
  .rd-tools .rd-page { display: none; }
}
