/* ==========================================================================
   Boan Family Library — an old reading room with heavy wooden shelves
   ========================================================================== */

:root {
  --wall: #24150c;
  --wood-dark: #3a2213;
  --wood: #5c3519;
  --wood-light: #8a5a2f;
  --wood-edge: #a8743f;
  --brass-1: #f3dc9a;
  --brass-2: #c9a24f;
  --brass-3: #8a6a24;
  --paper: #f4ead2;
  --paper-edge: #e3d3ae;
  --ink: #2b2118;
  --ink-soft: #5b4a39;
  --rule-red: #a3312a;
  --rule-blue: #8fa7c4;

  --row: 300px;          /* height of one shelf row (books + plank) */
  --plank: 24px;         /* thickness of the shelf plank face */

  --font-display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --font-body: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --font-type: "Special Elite", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  background-color: var(--wall);
  /* vertical wood paneling: grain + panel seams + a warm lamp glow */
  background-image:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 190, 110, .16), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 2px, transparent 2px 3px, transparent 3px 238px, rgba(255,255,255,.04) 238px 240px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='480'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.08 0.004' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.10 0 0 0 0 0.05 0 0 0 0 0.02 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-attachment: fixed, scroll, scroll;
}

a { color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header: carved sign ---------- */

.site-header {
  text-align: center;
  padding: 3.5rem 1.25rem 1.5rem;
}

.sign {
  display: inline-block;
  padding: 1.6rem 3rem 1.4rem;
  border-radius: 6px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.12' numOctaves='3' seed='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0 0.04 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--wood-light), var(--wood) 55%, var(--wood-dark));
  border: 3px solid #2a170b;
  box-shadow:
    inset 0 0 0 4px rgba(255, 220, 160, .12),
    inset 0 2px 0 6px rgba(0, 0, 0, .25),
    0 18px 40px rgba(0, 0, 0, .6);
}

.sign h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.75rem, 6.5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: .02em;
  /* gilt lettering cut into the wood */
  color: var(--brass-1);
  background: linear-gradient(180deg, var(--brass-1), var(--brass-2) 60%, var(--brass-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .65));
}

.sign p {
  margin: .5rem 0 0;
  font-style: italic;
  color: #e8d4ad;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
}

/* ---------- Author index: brass tabs ---------- */

.author-index ul {
  list-style: none;
  margin: 1.75rem auto 0;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .7rem;
}

.brass {
  color: #2b1d08;
  background: linear-gradient(180deg, var(--brass-1), var(--brass-2) 55%, var(--brass-3));
  border: 1px solid #5e4614;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .6),
    inset 0 -2px 0 rgba(0, 0, 0, .2),
    0 3px 8px rgba(0, 0, 0, .5);
  text-shadow: 0 1px 0 rgba(255, 245, 210, .6);
}

.author-index a {
  display: inline-block;
  padding: .35rem 1rem;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.author-index a:hover,
.author-index a:focus-visible { transform: translateY(-2px); filter: brightness(1.08); }

/* ---------- Bookcase per author ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.bookcase {
  margin: 3rem 0 4rem;
  scroll-margin-top: 1.5rem;
}

.case-frame {
  position: relative;
  padding: 1.25rem 1.25rem 0;
  border-radius: 4px 4px 0 0;
  /* thick carved frame */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='600'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.1 0.005' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.09 0 0 0 0 0.03 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, var(--wood-dark), var(--wood) 8%, var(--wood-light) 50%, var(--wood) 92%, var(--wood-dark));
  border: 3px solid #1e1007;
  border-bottom: 0;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55);
}

/* crown moulding */
.case-frame::before {
  content: "";
  position: absolute;
  left: -14px; right: -14px; top: -22px;
  height: 22px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--wood-edge), var(--wood) 45%, var(--wood-dark));
  border: 2px solid #1e1007;
  box-shadow: 0 6px 10px rgba(0, 0, 0, .45);
}

.nameplate {
  display: table;
  margin: 0 auto 1.1rem;
  padding: .35rem 1.6rem .3rem;
  border-radius: 3px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: .04em;
  position: relative;
}
/* little screw heads on the plate */
.nameplate::before,
.nameplate::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px; height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #7a5a1c 70%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
.nameplate::before { left: .55rem; }
.nameplate::after  { right: .55rem; }

/* the dark interior where the books stand; planks repeat every row */
.shelf {
  list-style: none;
  margin: 0;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 2.25rem;
  border: 3px solid #1a0d05;
  border-bottom: 0;
  background:
    /* plank: shadow cast below, then top surface, front face, under-edge */
    repeating-linear-gradient(180deg,
      rgba(0,0,0,.55) 0, transparent 18px,
      transparent calc(var(--row) - var(--plank) - 6px),
      #b07a44 calc(var(--row) - var(--plank) - 6px),
      #8a5a2f calc(var(--row) - var(--plank)),
      #6a3f1d calc(var(--row) - var(--plank) + 2px),
      #4e2c13 calc(var(--row) - 4px),
      #21110a calc(var(--row) - 4px),
      #21110a var(--row)),
    /* back panel with interior shading */
    radial-gradient(ellipse at 50% 35%, #3d2414, #1c0f07 80%);
  box-shadow: inset 12px 0 20px -8px rgba(0,0,0,.8), inset -12px 0 20px -8px rgba(0,0,0,.8);
}

.shelf li {
  height: var(--row);
  display: flex;
  align-items: flex-end;
  padding-bottom: calc(var(--plank) + 6px);
}

.volume {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: 1px 3px 3px 1px;
  box-shadow:
    -1px 0 0 rgba(255,255,255,.08),
    6px 4px 0 -1px #e9e1cc,      /* page block peeking out */
    7px 5px 0 -1px #9c917a,
    10px 10px 18px rgba(0,0,0,.65);
  transform-origin: bottom center;
  transition: transform .25s ease, box-shadow .25s ease;
}
/* spine crease highlight */
.volume::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg,
    rgba(0,0,0,.35) 0, rgba(255,255,255,.18) 3%, rgba(0,0,0,.12) 6%, transparent 10%,
    transparent 92%, rgba(0,0,0,.15));
  pointer-events: none;
}
.volume img {
  display: block;
  height: auto;
  max-height: calc(var(--row) - var(--plank) - 48px);
  max-width: 300px;
  width: auto;
  border-radius: inherit;
}
.volume:hover,
.volume:focus-visible {
  transform: translateY(-10px) rotate(-1.5deg);
  box-shadow:
    6px 4px 0 -1px #e9e1cc,
    7px 5px 0 -1px #9c917a,
    16px 22px 26px rgba(0,0,0,.6);
  outline: none;
}
.volume:focus-visible { outline: 3px solid var(--brass-1); outline-offset: 4px; }

/* base of the bookcase */
.case-base {
  height: 26px;
  margin: 0 -1px;
  background: linear-gradient(180deg, var(--wood-edge), var(--wood) 30%, var(--wood-dark));
  border: 3px solid #1e1007;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 14px 24px rgba(0,0,0,.6);
}

/* ---------- Catalogue cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 330px));
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.card {
  position: relative;
  padding: 1.6rem 1.4rem 1.3rem;
  color: var(--ink);
  border-radius: 3px;
  scroll-margin-top: 2rem;
  background:
    /* the faint ruled lines of an old catalogue card */
    repeating-linear-gradient(180deg, transparent 0 1.55rem, rgba(143,167,196,.35) 1.55rem calc(1.55rem + 1px)),
    radial-gradient(ellipse at 30% 20%, #fbf4e1, var(--paper) 55%, var(--paper-edge));
  background-position: 0 .4rem, 0 0;
  box-shadow: 0 1px 0 #c9b88f, 0 12px 26px rgba(0,0,0,.5);
  transition: transform .2s ease;
}
/* the punched rod hole at the bottom of a card */
.card::after {
  content: "";
  position: absolute;
  bottom: .55rem; left: 50%;
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--wall);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.6);
}
.card:target { animation: pulled 1.2s ease; }
@keyframes pulled {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-12px); box-shadow: 0 0 0 4px var(--brass-2), 0 20px 30px rgba(0,0,0,.5); }
  100% { transform: translateY(0); }
}

.card h3 {
  margin: 0 0 .9rem;
  padding-bottom: .45rem;
  border-bottom: 2px solid var(--rule-red);
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.2;
  font-weight: 600;
  min-height: 1.6rem;
}
.card h3 .subtitle {
  display: block;
  font-size: .9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
}

.meta {
  margin: 0 0 .8rem;
  font-family: var(--font-type);
  font-size: .82rem;
  line-height: 1.55rem;
  color: var(--ink-soft);
}
.meta div { display: flex; gap: .5rem; }
.meta dt { flex: 0 0 6.4rem; color: #8a7558; }
.meta dd { margin: 0; }

.blurb {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.55rem;
}
.note {
  font-family: var(--font-type);
  font-size: .78rem;
  color: var(--rule-red);
  margin: -.4rem 0 .9rem;
}

.buy {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  padding-bottom: 1.4rem; /* clear the rod hole */
}
.buy a {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  padding: .38rem .85rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.buy a small { font-weight: 400; font-size: .78rem; opacity: .8; }
.buy a:hover,
.buy a:focus-visible { transform: translateY(-1px); filter: brightness(1.08); }
.buy a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 2rem 1.25rem 3rem;
  font-size: .9rem;
  color: #cdb68e;
}
.site-footer p { margin: .3rem auto; max-width: 46rem; }
.site-footer a { color: var(--brass-1); }

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  :root { --row: 250px; --plank: 20px; }
  .sign { padding: 1.1rem 1.1rem .9rem; }
  .site-header { padding-top: 2rem; }
  .case-frame { padding: 1rem .6rem 0; }
  .shelf { column-gap: 1.25rem; padding: 0 .5rem; }
  .volume img { max-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .volume, .card, .buy a, .author-index a { transition: none; }
  .card:target { animation: none; }
}
