/* neutral light text instead of cream */
:root {
  --cream: #f2f2f2;
}

/* 3D book (shared by hero and grid) */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1000px;
}
.obj {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
    translateZ(var(--tz, 0px));
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.obj::before,
.obj::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--t);
  height: 100%;
  backface-visibility: hidden;
}
.obj::before {
  left: 0;
  transform: translateX(-50%) rotateY(-90deg);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.15)), var(--c2);
}
.obj::after {
  left: 100%;
  transform: translateX(-50%) rotateY(90deg);
  background: repeating-linear-gradient(0deg, #efefef 0 2px, #d0d0d0 2px 3px);
}
.cover {
  position: absolute;
  inset: 0;
  padding: 9%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  container-type: inline-size;
  transform: translateZ(calc(var(--t) / 2));
  backface-visibility: hidden;
  border-radius: 3px 8px 8px 3px;
  border-left: 4px solid rgba(0, 0, 0, 0.25);
  background: var(--motif), linear-gradient(160deg, var(--c1), var(--c2));
  text-align: left;
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.16),
    transparent 42%
  );
}
.cover h3 {
  font-size: max(0.72rem, 11cqw);
  line-height: 1.08;
}
.cover span {
  font-size: max(0.5rem, 6.5cqw);
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.m0 {
  --motif: radial-gradient(
    circle at 72% 24%,
    rgba(255, 255, 255, 0.24) 0 16%,
    transparent 17%
  );
}
.m1 {
  --motif: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0 10px,
    transparent 10px 22px
  );
}
.m2 {
  --motif: linear-gradient(to top, rgba(0, 0, 0, 0.32) 0 26%, transparent 26%);
}
.m3 {
  --motif: repeating-radial-gradient(
    circle at 28% 72%,
    rgba(255, 255, 255, 0.1) 0 6px,
    transparent 6px 14px
  );
}

/* 1 hero: books on an arc around the heading */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh; /* layout() raises this inline if the content needs more room */
  overflow: hidden;
  background: #0d0d0d;
}
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-bg .hb {
  --t: 0px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(130%, 110svh);
  aspect-ratio: 2 / 3;
  translate: -50% -50%;
  opacity: 0;
  transition: opacity 1.4s ease;
  /* blur + dim: tweak these two numbers */
  filter: blur(36px) brightness(0.5) saturate(1.1);
}
.hero-bg .hb.on {
  opacity: 1;
}
.hero-bg .hb .obj::before,
.hero-bg .hb .obj::after {
  display: none;
}
.hero-bg .hb .cover {
  border: 0;
  border-radius: 0;
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 13, 13, 0.35),
    rgba(13, 13, 13, 0.55) 60%,
    rgba(17, 17, 17, 0.9)
  );
}
.glow {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  width: min(90vw, 900px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #2f4a55;
  filter: blur(110px);
  opacity: 0.3;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.arc {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.hc {
  --t: calc(var(--w) * 0.13);
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--h);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  will-change: transform;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.45));
}
.hc * {
  pointer-events: none;
}
.hc.on .obj {
  --tz: calc(var(--w) * 0.22);
  transition-duration: 0.25s;
}
.center {
  position: absolute;
  z-index: 2;
  width: var(--tw, 520px);
  text-align: center;
  transform: translate(-50%, -50%);
}
.center {
  max-width: calc(100% - 32px);
}
.center h1 {
  text-wrap: balance;
  font-size: clamp(1.5rem, 3.2vw + 0.3rem, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.center .sub {
  margin: 14px auto 0;
  max-width: 30rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #bdbdbd;
}
.now {
  margin-top: 18px;
  min-height: 3.4rem;
}
.now strong {
  display: block;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.2rem;
}
.now small {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: #d0d0d0;
}

.stats {
  display: flex;
  justify-content: center;
  gap: clamp(20px, 3vw, 44px);
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(244, 239, 230, 0.12);
}
.stats b {
  display: block;
  font-family: "Playfair Display", serif;
  font-weight: 400;
  font-size: 1.5rem;
}
.stats span {
  font-size: 0.78rem;
  color: #a0a0a0;
}

/* 2 all books */
.books {
  padding: 120px 8% 100px;
  background: #e2e2e2;
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
}
.books h2 {
  scroll-margin-top: 90px;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 1.05;
  margin-bottom: 40px;
  color: #111111;
}
.tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tools .search {
  flex: 1;
}

.tools .sel {
  flex: 0 0 auto;
}
.search {
  position: relative;
  flex: 1 1 300px;
}
.search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  pointer-events: none;
}

.search input,
.sel select {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 1px solid rgb(0 0 0 / 28%);
  border-radius: 999px;
  background: transparent;
  color: #111111;
  font: inherit;
  transition:
    border-color 0.3s,
    background 0.3s,
    box-shadow 0.3s;
}
.search input {
  padding-left: 48px;
}
.search input::placeholder {
  color: #9b9b9b;
}
.search input:focus,
.sel select:focus {
  outline: none;
  border-color: #898989;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 4px rgb(209 209 209 / 15%);
}
.sel {
  position: relative;
  flex: 0 1 210px;
}
.sel select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.sel::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid rgb(0 0 0 / 28%);
  border-bottom: 1px solid rgb(0 0 0 / 28%);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.sel option {
  background: #ffffff;
  color: #111111;
}
.count {
  width: 100%;
  margin-bottom: 30px;
  margin-top: 15px;
  font-size: 0.9rem;
  color: #555555;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 52px clamp(20px, 3vw, 40px);
}
.card {
  display: block;
  text-align: center;
}
.gwrap {
  --t: 24px;
  width: min(100%, 210px);
  aspect-ratio: 2 / 3;
  margin: 0 auto 22px;
}
.gwrap.on .obj {
  --tz: 44px;
  transition-duration: 0.25s;
}
.gwrap .stage::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -14px;
  height: 22px;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(14px);
  border-radius: 50%;
  transition:
    transform 0.4s,
    opacity 0.4s;
}
.gwrap.on .stage::after {
  transform: scale(0.85);
  opacity: 0.7;
}
.card h3 {
  font-size: 1.5rem;
  line-height: 1.15;
  color: #111111;
}
.card .by {
  margin-top: 6px;
  font-size: 0.95rem;
  color: #555555;
}
.tag {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 14px;
  border: 1px solid rgb(61 61 61 / 45%);
  border-radius: 999px;
  font-size: 0.75rem;
  color: #111111;
}
mark {
  background: none;
  color: var(--gold);
}
.empty {
  grid-column: 1 / -1;
  padding: 70px 0;
  text-align: center;
  color: #555555;
  line-height: 1.8;
}
.empty .pg {
  margin-top: 18px;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 56px;
}
.pg {
  min-width: 40px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid rgb(0 0 0 / 28%);
  border-radius: 999px;
  background: none;
  color: #797979;

  font: inherit;
  cursor: pointer;
  transition:
    background 0.3s,
    color 0.3s,
    border-color 0.3s;
}
.pg:hover:not(:disabled),
.pg:focus-visible {
  background: #111111;
  color: rgb(226, 226, 226);
  border-color: var(--gold);
}
.pg[aria-current="page"] {
  background: #0f0e0d;
  color: var(--ink);
  border-color: var(--gold);
  cursor: default;
}
.pg:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pg-number {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

.pg-nav {
  padding: 0 12px;
}
.gap {
  color: #777777;
  padding: 0 4px;
}

@media (max-height: 760px) {
  .stats {
    display: none;
  }
}
@media (max-width: 1024px) {
  .books {
    padding: 100px 6% 80px;
  }
}
@media (max-width: 860px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .fgrid {
    grid-template-columns: 1fr 1fr;
  }
  .fgrid > :first-child {
    grid-column: 1 / -1;
  }
  .stats {
    display: none;
  }
}
@media (max-width: 600px) {
  .tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .tools .search {
    grid-column: 1 / -1;
    width: 100%;
  }

  .tools .sel {
    width: 100%;
  }

  .tools .sel select {
    width: 100%;
    padding: 10px 20px 10px 20px;
  }
  .center .sub {
    display: none;
  }
  .now {
    margin-top: 12px;
    min-height: 3rem;
  }
  .now strong {
    font-size: 1rem;
  }
  .cta {
    margin-top: 12px;
    padding: 11px 20px;
    font-size: 0.8rem;
  }
  .books {
    padding: 80px 5% 64px;
  }
  .sel {
    flex: 1 1 calc(50% - 8px);
  }
  .grid {
    gap: 36px 16px;
  }
  .gwrap {
    --t: 18px;
    margin-bottom: 16px;
  }
  .card h3 {
    font-size: 1.1rem;
  }
  .card .by {
    font-size: 0.8rem;
  }
  .pg {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .obj,
  .hero-bg .hb {
    transition: none;
  }
}

/* scroll cue (bottom of hero) */
.scroll-cue {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: max-content;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: #f2f2f2;
  font: inherit;
  cursor: pointer;
  transition:
    opacity 0.5s,
    translate 0.5s;
}
.scroll-cue.hide {
  opacity: 0;
  translate: 0 12px;
  pointer-events: none;
}
.scroll-cue__label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d0d0d0;
  animation: cue-in 0.9s 1.6s both;
}
.scroll-cue__arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gold, #c7a46b);
}
.scroll-cue__arrow svg {
  width: 22px;
  height: 13px;
  margin-top: -3px;
  opacity: 0;
  animation: cue-bob 1.8s ease-in-out 1.8s infinite;
}
.scroll-cue__arrow svg:nth-child(2) {
  animation-delay: 2s;
}
.scroll-cue:hover .scroll-cue__label,
.scroll-cue:focus-visible .scroll-cue__label {
  color: var(--gold, #c7a46b);
}
.scroll-cue:focus-visible {
  outline: 2px solid var(--gold, #c7a46b);
  outline-offset: 2px;
  border-radius: 12px;
}
@keyframes cue-bob {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes cue-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* extra responsive tweaks */
@media (max-width: 600px) {
  .now {
    min-height: 4.2rem;
  }
  .search {
    flex: 1 1 100%;
  }
  .fgrid {
    grid-template-columns: 1fr;
  }
  .scroll-cue__label {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
  }
}
@media (max-width: 380px) {
  .center h1 {
    font-size: 1.35rem;
  }
  .grid {
    gap: 30px 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue__arrow svg {
    animation: none;
    opacity: 0.8;
  }
  .scroll-cue__label {
    animation: none;
  }
}
