:root {
  --ink: #24170f;
  --paper: #f0e3ca;
  --paper-soft: #f8efdf;
  --muted: #745c46;
  --wood: #5a321f;
  --wood-dark: #24140e;
  --brass: #c39345;
  --green: #1f5146;
  --red: #88322b;
  --line: rgba(85, 48, 28, 0.24);
  --shadow: 0 14px 24px rgba(37, 21, 12, 0.17);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(80, 43, 24, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #23140d 0, #392112 260px, #7a4a2c 261px, #e8d4b8 270px, #efe2ca 100%);
  background-size: 30px 30px, auto;
  font-family: "Crimson Pro", Georgia, serif;
  font-size: 16px;
  line-height: 1.35;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  padding: 8px clamp(14px, 3vw, 34px);
  color: #f8ecd4;
  background: rgba(30, 17, 11, 0.94);
  border-bottom: 1px solid rgba(248, 236, 212, 0.14);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 4px;
  background: linear-gradient(90deg, var(--brass), #ead09a);
  box-shadow: 8px 5px 0 rgba(136, 50, 43, 0.95), 16px -4px 0 rgba(31, 81, 70, 0.95);
  transform: rotate(-8deg);
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 24px);
  overflow-x: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.67rem;
  text-transform: uppercase;
}

nav a {
  color: rgba(248, 236, 212, 0.78);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  color: #fff7e6;
}

.library-top {
  position: relative;
  min-height: 164px;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 12px solid #4b2a19;
  box-shadow: inset 0 -7px 0 rgba(255, 225, 156, 0.18), 0 13px 28px rgba(34, 18, 10, 0.24);
}

.desk-image,
.desk-shade {
  position: absolute;
  inset: 0;
}

.desk-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
  filter: saturate(0.82) contrast(1.1);
}

.desk-shade {
  background:
    linear-gradient(90deg, rgba(29, 17, 10, 0.9), rgba(29, 17, 10, 0.68) 44%, rgba(29, 17, 10, 0.28)),
    linear-gradient(180deg, rgba(29, 17, 10, 0.16), rgba(29, 17, 10, 0.78));
}

.title-plaque {
  position: relative;
  width: min(920px, calc(100% - 28px));
  margin: 0 auto 13px;
  padding: 10px clamp(14px, 3vw, 22px) 12px;
  color: #fff1d4;
  background:
    linear-gradient(180deg, rgba(126, 70, 37, 0.84), rgba(40, 22, 13, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 12px, transparent 12px 34px);
  border: 1px solid rgba(238, 197, 119, 0.5);
  border-radius: 6px;
  box-shadow: 0 18px 32px rgba(20, 10, 5, 0.34), inset 0 0 0 1px rgba(255, 241, 212, 0.08);
}

.title-plaque::before,
.title-plaque::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(24px, 7vw, 72px);
  height: 3px;
  background: linear-gradient(90deg, transparent, #d3a45c, transparent);
  opacity: 0.82;
}

.title-plaque::before {
  left: 12px;
  transform: translateY(-50%) rotate(-7deg);
}

.title-plaque::after {
  right: 12px;
  transform: translateY(-50%) rotate(7deg);
}

.title-plaque p,
.shelf-head span,
.book-card span,
.site-footer p {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0;
}

.title-plaque p {
  margin: 0 0 1px;
  color: #d7ad63;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 5vw, 3.8rem);
  text-shadow: 0 2px 0 rgba(45, 24, 14, 0.62);
}

.title-plaque span {
  display: block;
  margin-top: 2px;
  max-width: 720px;
  color: rgba(255, 241, 212, 0.84);
  font-size: clamp(0.92rem, 1.8vw, 1.12rem);
}

.shelves {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 26px) clamp(10px, 2vw, 24px) 26px;
}

.shelf {
  position: relative;
  margin: 0 0 clamp(18px, 3vw, 28px);
  padding: 14px clamp(10px, 2vw, 18px) 28px;
  background:
    linear-gradient(180deg, rgba(255, 249, 236, 0.88), rgba(241, 226, 202, 0.75)),
    linear-gradient(90deg, rgba(88, 50, 29, 0.09), transparent 15%, transparent 85%, rgba(88, 50, 29, 0.09));
  border: 1px solid rgba(88, 50, 29, 0.18);
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(50, 29, 18, 0.11);
}

.shelf::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 9px;
  height: 13px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #8d5732, #4d2a19),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 9px, transparent 9px 23px);
  box-shadow: 0 9px 16px rgba(35, 18, 10, 0.25);
}

.shelf-head {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 9px 12px;
  align-items: baseline;
  margin-bottom: 12px;
  padding: 7px 10px;
  color: #f8ecd4;
  background:
    linear-gradient(180deg, rgba(91, 50, 28, 0.95), rgba(55, 30, 18, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 14px, transparent 14px 29px);
  border: 1px solid rgba(238, 197, 119, 0.28);
  border-radius: 5px;
}

.shelf-head span {
  color: #e0b46d;
  font-size: 0.66rem;
  font-weight: 700;
}

.shelf-head h2 {
  font-size: clamp(1.1rem, 2vw, 1.65rem);
}

.shelf-head p {
  margin: 0;
  color: rgba(248, 236, 212, 0.72);
  font-size: 0.95rem;
}

.book-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: clamp(10px, 1.7vw, 16px);
  align-items: stretch;
}

.book-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 5px;
  min-height: 100%;
  padding: 8px 8px 10px;
  color: var(--ink);
  background: rgba(255, 251, 242, 0.86);
  border: 1px solid rgba(86, 48, 28, 0.15);
  border-radius: 5px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: rgba(195, 147, 69, 0.68);
  box-shadow: 0 18px 30px rgba(37, 21, 12, 0.23);
}

.book-card img,
.cover-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px;
  background: #d5bd99;
  box-shadow: 0 8px 14px rgba(29, 17, 10, 0.22);
}

.cover-fallback {
  display: grid;
  place-items: center;
  padding: 9px;
  color: #f8ecd4;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(18, 12, 8, 0.24)),
    linear-gradient(160deg, var(--green), #17342f 55%, var(--red));
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}

.book-card strong {
  margin-top: 3px;
  font-family: "Cinzel", serif;
  font-size: clamp(0.78rem, 1.1vw, 0.96rem);
  line-height: 1.08;
}

.book-card span {
  color: var(--muted);
  font-size: 0.64rem;
}

.featured-book {
  background: linear-gradient(180deg, rgba(255, 248, 229, 0.98), rgba(239, 219, 181, 0.86));
  border-color: rgba(195, 147, 69, 0.42);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(14px, 3vw, 34px) 16px;
  color: rgba(248, 236, 212, 0.74);
  background: #21130d;
  border-top: 1px solid rgba(248, 236, 212, 0.12);
}

.site-footer strong {
  font-family: "Cinzel", serif;
  color: #f8ecd4;
  white-space: nowrap;
}

.site-footer p {
  max-width: 820px;
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.35;
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .site-header {
    position: relative;
    display: grid;
    gap: 7px;
  }

  .library-top {
    min-height: 150px;
  }

  .title-plaque {
    margin-bottom: 12px;
  }

  .title-plaque::before,
  .title-plaque::after {
    display: none;
  }

  .shelf-head {
    grid-template-columns: auto 1fr;
  }

  .shelf-head p {
    grid-column: 1 / -1;
    font-size: 0.88rem;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .book-card {
    padding: 7px;
  }

  .book-card strong {
    font-size: 0.72rem;
  }

  .book-card span {
    font-size: 0.58rem;
  }

  .site-footer {
    display: grid;
  }
}

@media (max-width: 420px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
