@font-face {
  font-family: 'Library Display';
  src: url('/fonts/eb-garamond-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Library Display';
  src: url('/fonts/eb-garamond-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Library Sans';
  src: url('/fonts/merriweather-sans-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Library Sans';
  src: url('/fonts/merriweather-sans-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.library-page {
  --library-paper: oklch(0.94 0.02 85);
  --library-ink: oklch(0.23 0.03 260);
  --library-ink-soft: oklch(0.4 0.03 250);
  --library-shadow: oklch(0.17 0.02 260 / 0.48);
  --library-border: oklch(0.73 0.04 82 / 0.24);
  --library-panel: linear-gradient(
    180deg,
    oklch(0.98 0.01 85 / 0.96) 0%,
    oklch(0.92 0.02 82 / 0.92) 100%
  );
  --library-surface: linear-gradient(
    180deg,
    oklch(0.19 0.03 258 / 0.96) 0%,
    oklch(0.16 0.03 255 / 0.97) 100%
  );
  --library-chip: oklch(0.28 0.03 255 / 0.82);
  --library-chip-hover: oklch(0.34 0.04 252 / 0.9);
  background:
    radial-gradient(circle at top left, oklch(0.52 0.08 76 / 0.18), transparent 28rem),
    radial-gradient(circle at 85% 12%, oklch(0.62 0.05 240 / 0.12), transparent 20rem),
    linear-gradient(180deg, oklch(0.12 0.02 255) 0%, oklch(0.09 0.015 250) 100%);
  color: var(--library-paper);
}

.library-page p,
.library-page li,
.library-page a,
.library-page button,
.library-page input,
.library-page select,
.library-page label {
  font-family: 'Library Sans', 'Raleway', sans-serif;
}

.library-page h1,
.library-page h2,
.library-page h3 {
  font-family: 'Library Display', 'Cinzel', serif;
  letter-spacing: 0.01em;
  text-transform: none;
}

.library-page .logo-text {
  font-family: 'Cinzel', 'Library Display', serif;
}

.library-page header {
  background: linear-gradient(
    180deg,
    oklch(0.1 0.02 255 / 0.96) 0%,
    oklch(0.1 0.02 255 / 0.84) 100%
  );
  border-bottom: 1px solid oklch(0.74 0.03 82 / 0.16);
}

.library-page .nav-links a {
  color: oklch(0.9 0.02 82);
}

.library-main {
  position: relative;
}

.library-hero {
  position: relative;
  padding: clamp(6rem, 10vw, 8.5rem) 0 clamp(2.5rem, 4vw, 4rem);
}

.library-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, oklch(0.68 0.09 82 / 0.08), transparent 28%),
    linear-gradient(180deg, transparent 0%, oklch(0.76 0.05 82 / 0.06) 100%);
  pointer-events: none;
}

.library-hero__inner,
.library-shell__inner {
  width: min(1200px, calc(100% - 2.5rem));
  margin: 0 auto;
}

.library-hero__inner {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.75rem);
}

.library-route-mark,
.library-hero__eyebrow,
.library-grid-section__eyebrow,
.library-rail__eyebrow,
.library-story-card__eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: oklch(0.84 0.04 83 / 0.78);
}

.library-route-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.library-route-mark::before {
  content: '';
  width: 4.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, oklch(0.78 0.05 82 / 0.7) 100%);
}

.library-hero__copy {
  max-width: 48rem;
  display: grid;
  gap: 1rem;
}

.library-hero__eyebrow {
  color: oklch(0.83 0.06 82);
}

.library-hero__subtitle {
  max-width: 38rem;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  line-height: 1.55;
  color: oklch(0.9 0.02 82);
}

.library-hero__lead {
  max-width: 36rem;
  font-size: 1rem;
  line-height: 1.8;
  color: oklch(0.8 0.02 82 / 0.88);
}

.library-chip-bar,
.library-grid-section,
.library-grid-section__head,
.library-content,
.library-mobile-controls,
.library-mobile-controls__grid,
.library-rail__block,
.library-hero__copy {
  display: grid;
}

.library-chip-bar {
  gap: 0.85rem;
}

.library-chip-bar__list,
.library-rail__genres,
.library-feature__meta,
.library-story-card__meta {
  display: flex;
  flex-wrap: wrap;
}

.library-chip-bar__list,
.library-rail__genres {
  gap: 0.75rem;
}

.library-chip,
.library-rail__button {
  appearance: none;
  border: 1px solid oklch(0.78 0.05 82 / 0.18);
  background: var(--library-chip);
  color: oklch(0.92 0.02 82);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.library-rail__button {
  background: transparent;
  color: var(--library-ink-soft);
  border-color: oklch(0.48 0.03 82 / 0.12);
}

.library-chip:hover,
.library-chip:focus-visible,
.library-rail__button:hover,
.library-rail__button:focus-visible {
  transform: translateY(-1px);
  background: var(--library-chip-hover);
  border-color: oklch(0.84 0.06 82 / 0.34);
  outline: none;
}

.library-chip.is-active,
.library-rail__button.is-active {
  background: linear-gradient(
    135deg,
    oklch(0.82 0.08 83 / 0.24) 0%,
    oklch(0.48 0.05 254 / 0.72) 100%
  );
  border-color: oklch(0.84 0.08 82 / 0.54);
  color: var(--library-paper);
}

.library-shell {
  padding-bottom: clamp(4rem, 7vw, 6rem);
}

.library-shell__inner {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}

.library-rail__inner {
  position: sticky;
  top: 7rem;
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.4rem, 2vw, 1.7rem);
  border-radius: 1.5rem;
  background: var(--library-panel);
  color: var(--library-ink);
  border: 1px solid var(--library-border);
  box-shadow: 0 28px 70px -44px var(--library-shadow);
}

.library-rail__block {
  gap: 0.8rem;
}

.library-rail__label {
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: oklch(0.44 0.04 245);
}

.library-sort-select {
  appearance: none;
  border: 1px solid oklch(0.62 0.03 82 / 0.32);
  border-radius: 1rem;
  padding: 0.95rem 2.75rem 0.95rem 1rem;
  background:
    linear-gradient(180deg, oklch(0.99 0.01 84) 0%, oklch(0.94 0.02 82) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath fill='%23454a61' d='M7 8 .8 1.7 2.1.4 7 5.4 11.9.4 13.2 1.7z'/%3E%3C/svg%3E")
      no-repeat right 1rem center / 0.85rem auto;
  color: var(--library-ink);
  font-size: 0.98rem;
}

.library-sort-select:focus-visible {
  outline: 2px solid oklch(0.68 0.09 82);
  outline-offset: 2px;
}

.library-story-count {
  font-family: 'Library Display', serif;
  font-size: clamp(1.9rem, 4vw, 2.45rem);
  line-height: 1;
  color: oklch(0.22 0.03 254);
}

.library-rail__note {
  font-size: 0.95rem;
  line-height: 1.8;
  color: oklch(0.36 0.03 248 / 0.84);
}

.library-status {
  min-height: 18rem;
}

.library-status__panel {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.6rem, 4vw, 2.25rem);
  border-radius: 1.6rem;
  background: linear-gradient(
    180deg,
    oklch(0.18 0.03 257 / 0.94) 0%,
    oklch(0.15 0.03 253 / 0.98) 100%
  );
  border: 1px solid oklch(0.8 0.04 82 / 0.15);
  box-shadow: 0 32px 90px -56px var(--library-shadow);
}

.library-status__title {
  font-size: clamp(2rem, 4vw, 2.9rem);
  color: var(--library-paper);
}

.library-status__body {
  max-width: 38rem;
  font-size: 1.02rem;
  line-height: 1.85;
  color: oklch(0.82 0.02 82 / 0.9);
}

.library-status__button {
  justify-self: start;
}

.library-loading-shelf {
  display: grid;
  gap: 1.25rem;
}

.library-skeleton,
.library-skeleton-line {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    oklch(0.24 0.02 255 / 0.84) 0%,
    oklch(0.28 0.03 252 / 0.96) 50%,
    oklch(0.24 0.02 255 / 0.84) 100%
  );
}

.library-skeleton::after,
.library-skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    oklch(0.92 0.02 82 / 0.12) 50%,
    transparent 100%
  );
  animation: library-shimmer 1.5s ease infinite;
}

.library-skeleton-feature,
.library-feature {
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 2vw, 1.8rem);
  padding: clamp(1.25rem, 2vw, 1.7rem);
}

.library-skeleton-feature {
  border-radius: 1.8rem;
  background: linear-gradient(180deg, oklch(0.19 0.03 256 / 0.92), oklch(0.16 0.03 253 / 0.98));
}

.library-skeleton-poster {
  min-height: 24rem;
  border-radius: 1.3rem;
}

.library-skeleton-copy {
  display: grid;
  align-content: center;
  gap: 0.9rem;
}

.library-skeleton-line {
  height: 0.9rem;
  border-radius: 999px;
}

.library-skeleton-line.is-short {
  width: 40%;
}

.library-skeleton-line.is-medium {
  width: 65%;
}

.library-skeleton-line.is-long {
  width: 92%;
}

.library-skeleton-grid,
.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.35rem);
}

.library-skeleton-card {
  min-height: 21rem;
  border-radius: 1.4rem;
}

.library-content {
  gap: clamp(1.6rem, 3vw, 2.4rem);
}

.library-feature,
.library-story-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--library-border);
  box-shadow: 0 34px 88px -58px var(--library-shadow);
}

.library-feature {
  border-radius: 1.9rem;
  background:
    linear-gradient(135deg, oklch(0.86 0.05 82 / 0.18), transparent 34%), var(--library-surface);
}

.library-story-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1.4rem;
  background:
    linear-gradient(180deg, oklch(0.88 0.03 82 / 0.12), transparent 24%),
    linear-gradient(180deg, oklch(0.17 0.03 256 / 0.96) 0%, oklch(0.15 0.03 253 / 0.98) 100%);
}

.library-feature__copy,
.library-story-card__copy {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.library-feature__title,
.library-story-card__title {
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.library-feature__title {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 0.98;
}

.library-story-card__title {
  font-size: clamp(1.5rem, 2vw, 1.95rem);
  line-height: 1.05;
}

.library-feature__meta,
.library-story-card__meta {
  gap: 0.7rem;
}

.library-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: oklch(0.95 0.02 84 / 0.1);
  border: 1px solid oklch(0.85 0.05 82 / 0.14);
  color: oklch(0.88 0.02 82);
}

.library-feature__note {
  font-size: 0.98rem;
  line-height: 1.8;
  color: oklch(0.8 0.02 82 / 0.86);
}

.library-disabled-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid oklch(0.82 0.06 82 / 0.28);
  color: oklch(0.92 0.02 82);
  text-decoration: none;
  background: linear-gradient(135deg, oklch(0.72 0.08 82 / 0.16), oklch(0.24 0.03 252 / 0.28));
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.library-disabled-link:hover,
.library-disabled-link:focus-visible {
  transform: translateY(-1px);
  border-color: oklch(0.86 0.08 82 / 0.52);
  outline: none;
}

.library-grid-section {
  gap: 1.25rem;
}

.library-mobile-controls {
  display: none;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 1.35rem;
  background: linear-gradient(
    180deg,
    oklch(0.18 0.03 256 / 0.94) 0%,
    oklch(0.15 0.03 253 / 0.98) 100%
  );
  border: 1px solid oklch(0.8 0.04 82 / 0.12);
}

.library-mobile-controls__title {
  font-size: 1.1rem;
  color: oklch(0.93 0.03 84);
}

.library-mobile-controls__grid {
  gap: 0.8rem;
}

.library-grid-section__head {
  gap: 0.35rem;
  align-items: start;
}

.library-grid-section__title {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
}

.library-poster {
  position: relative;
  overflow: hidden;
  border-radius: 1.2rem;
  isolation: isolate;
  min-height: 20rem;
  background:
    radial-gradient(circle at top, oklch(0.8 0.05 82 / 0.18), transparent 40%),
    linear-gradient(180deg, oklch(0.3 0.03 252) 0%, oklch(0.16 0.03 254) 100%);
  box-shadow: inset 0 0 0 1px oklch(0.84 0.05 82 / 0.1);
}

.library-feature .library-poster {
  min-height: 25rem;
}

.library-poster::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent 0%, oklch(0.11 0.02 254 / 0.92) 100%);
  z-index: 1;
  pointer-events: none;
}

.library-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-poster__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end start;
  padding: 1rem;
  z-index: 0;
}

.library-poster__fallback span {
  max-width: 70%;
  font-family: 'Library Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 0.95;
  color: oklch(0.94 0.03 84 / 0.86);
}

.library-poster.is-fallback img {
  opacity: 0;
}

.library-grid-section[hidden],
.library-content[hidden] {
  display: none;
}

.library-page [aria-disabled='true'] {
  cursor: not-allowed;
}

@keyframes library-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 1080px) {
  .library-shell__inner {
    grid-template-columns: 1fr;
  }

  .library-rail__inner {
    position: static;
  }
}

@media (max-width: 820px) {
  .library-hero__inner,
  .library-shell__inner {
    width: min(100% - 1.5rem, 100%);
  }

  .library-rail {
    display: none;
  }

  .library-mobile-controls {
    display: grid;
  }

  .library-feature,
  .library-skeleton-feature,
  .library-skeleton-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-feature .library-poster,
  .library-skeleton-poster {
    min-height: 21rem;
  }
}

@media (max-width: 768px) {
  .library-hero {
    padding-top: 5.6rem;
  }

  .library-hero__subtitle {
    font-size: 1.1rem;
  }

  .library-chip,
  .library-rail__button {
    min-height: 2.75rem;
  }

  .library-rail__inner {
    gap: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .library-chip,
  .library-rail__button,
  .library-disabled-link,
  .library-skeleton::after,
  .library-skeleton-line::after {
    animation: none;
    transition: none;
    transform: none;
  }
}
