:root {
  --ink: #18241d;
  --muted: #6f6657;
  --deep: #234234;
  --deep-2: #5b3c45;
  --gold: #a77d2d;
  --gold-soft: #d8bd78;
  --paper: #fffaf0;
  --panel: #ffffff;
  --panel-2: #fff4df;
  --line: rgba(108, 83, 39, 0.18);
  --line-strong: rgba(108, 83, 39, 0.3);
  --wash: rgba(167, 125, 45, 0.1);
  --wash-2: rgba(35, 66, 52, 0.055);
  --shadow: 0 22px 52px rgba(73, 52, 21, 0.18);
  --shadow-soft: 0 12px 30px rgba(73, 52, 21, 0.12);
  --container: 1120px;
  font-family: "Lora", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(35, 66, 52, 0.1), transparent 310px),
    linear-gradient(180deg, rgba(167, 125, 45, 0.14), transparent 340px),
    linear-gradient(180deg, #fff7e8 0%, var(--paper) 48%, #f7efe1 100%);
  animation: page-in 420ms ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes header-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

button,
input,
textarea,
a {
  font: inherit;
}

a {
  color: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(108, 83, 39, 0.14);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(18px) saturate(140%);
  animation: header-in 520ms ease both;
}

.header-inner {
  width: min(var(--container), calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 150ms ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: block;
  object-fit: contain;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(35, 66, 52, 0.14);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.12;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.site-nav {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  --nav-indicator-left: 0px;
  --nav-indicator-width: 0px;
}

.site-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  z-index: 1;
  height: 1px;
  background: rgba(108, 83, 39, 0.22);
  pointer-events: none;
}

.site-nav::after {
  content: "";
  position: absolute;
  left: var(--nav-indicator-left);
  bottom: 3px;
  z-index: 2;
  width: var(--nav-indicator-width);
  height: 2px;
  border-radius: 999px;
  background: var(--gold);
  pointer-events: none;
  transition:
    left 260ms ease,
    width 260ms ease;
}

.nav-link,
.filter-button,
.menu-button,
.language-toggle,
.primary-action,
.secondary-action,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.nav-link {
  position: relative;
  z-index: 3;
  min-height: 38px;
  min-width: 92px;
  padding: 9px 12px;
  color: #8a8174;
  background: transparent;
  white-space: nowrap;
  border-radius: 0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:
    color 180ms ease,
    opacity 180ms ease;
}

.nav-link.is-active {
  color: var(--ink);
  font-weight: 750;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.nav-link:hover:not(.is-active) {
  color: var(--ink);
  background: transparent;
}

.nav-link:focus-visible,
.language-toggle:focus-visible,
.menu-button:focus-visible {
  outline: 3px solid rgba(167, 125, 45, 0.22);
  outline-offset: 2px;
}

.language-toggle {
  display: none;
}

.language-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 125, 45, 0.48);
  box-shadow: var(--shadow-soft);
}

.menu-button {
  display: none;
  margin-left: auto;
  min-height: 40px;
  padding: 9px 15px;
  color: var(--ink);
  border-color: rgba(108, 83, 39, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 700;
}

.menu-button::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-right: 8px;
  background-color: currentColor;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16'/%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='M4 18h16'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

main {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 78px;
}

.site-footer {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: #8a8174;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
  transition-delay: calc(var(--reveal-index, 0) * 55ms);
  will-change: opacity, transform;
}

.reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hero {
  min-height: calc(100vh - 74px - 42px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: clamp(30px, 4vw, 52px);
  align-items: center;
  padding: 26px 0 54px;
  border-bottom: 0;
}

.hero-copy {
  min-width: 0;
  max-width: 700px;
  animation: hero-in 620ms 80ms ease both;
}

.hero-copy .eyebrow {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-style: italic;
  letter-spacing: 0;
}

h1,
h2 {
  color: var(--gold);
}

.contact-panel h2 {
  color: #6a6256;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 4.4vw, 60px);
  line-height: 0.96;
}

.hero-copy h1 {
  white-space: nowrap;
}

h2 {
  margin: 0;
  font-size: clamp(26px, 3.8vw, 40px);
  line-height: 1.08;
}

h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
}

.resource-card h3 {
  color: #6a6256;
}

.lead {
  max-width: 620px;
  margin: 22px 0 0;
  color: #574f43;
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.62;
}

.hero-note {
  max-width: 600px;
  margin: 18px 0 0;
  color: #6a6256;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.55;
}

.hero-actions,
.reader-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  display: none;
  margin-top: 26px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.15;
}

.primary-action {
  color: #fffaf0;
  border-color: rgba(167, 125, 45, 0.76);
  background: var(--gold);
  box-shadow: 0 12px 30px rgba(167, 125, 45, 0.18);
}

.secondary-action {
  color: #6a6256;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.primary-action:hover,
.secondary-action:hover,
.icon-button:hover,
.filter-button:hover,
.menu-button:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  color: #fffaf0;
  background: #8d6420;
}

.secondary-action:hover,
.icon-button:hover,
.menu-button:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-soft);
}

.hero-feature {
  align-self: stretch;
  min-height: 410px;
  display: grid;
  align-items: center;
  animation: hero-in 700ms 170ms ease both;
}

.book-showcase {
  width: 100%;
  height: auto;
  min-height: 360px;
  display: grid;
  grid-template-rows: auto;
  gap: 16px;
}

.book-cover-stack {
  position: relative;
  height: 360px;
  min-height: 360px;
}

.cover-frame {
  position: absolute;
  width: 62%;
  aspect-ratio: 0.72;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #f7ecd9;
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.cover-frame:first-child {
  right: 0;
  top: 0;
  transform: rotate(1.5deg);
}

.cover-frame:last-child {
  left: 0;
  bottom: 0;
  transform: rotate(-2deg);
}

.cover-frame:hover {
  box-shadow: 0 26px 58px rgba(73, 52, 21, 0.2);
}

.cover-frame:first-child:hover {
  transform: translateY(-4px) rotate(1.5deg);
}

.cover-frame:last-child:hover {
  transform: translateY(-4px) rotate(-2deg);
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.showcase-caption {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  line-height: 1.48;
}

.section-block {
  margin-top: 56px;
  padding-top: 42px;
  border-top: 1px solid var(--line);
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(460px, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(28px, 5vw, 56px);
  margin-top: 38px;
  padding: 8px 0 34px;
}

.home-intro .eyebrow {
  display: none;
}

.home-intro h2 {
  max-width: 560px;
}

.intro-copy {
  display: grid;
  gap: 16px;
  max-width: 680px;
}

.intro-copy p {
  margin: 0;
  color: #5a5247;
  font-size: 17px;
  line-height: 1.72;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
  margin-bottom: 18px;
}

.section-block .section-heading .eyebrow {
  display: none;
}

.section-heading h2 {
  grid-column: 1;
}

.carousel-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-link {
  min-height: 38px;
  padding: 8px 10px;
  color: #6a6256;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}

.section-link:hover {
  color: var(--gold);
  text-decoration: none;
}

.carousel-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 22px rgba(73, 52, 21, 0.08);
  cursor: pointer;
  transition:
    opacity 520ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease,
    color 220ms ease;
}

.carousel-button.is-disabled {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.carousel-button::before {
  content: "";
  width: 18px;
  height: 18px;
  background-color: currentColor;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.carousel-prev::before {
  transform: rotate(180deg);
}

.carousel-button:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 125, 45, 0.42);
  color: #fffaf0;
  background: var(--gold);
}

.carousel-button:focus-visible {
  outline: 3px solid rgba(167, 125, 45, 0.22);
  outline-offset: 2px;
}

.feature-grid,
.books-layout {
  display: grid;
  gap: 18px;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.feature-grid.is-transitioning {
  opacity: 0;
  transform: translateY(8px);
}

.books-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-title {
  max-width: 760px;
  margin-bottom: 28px;
}

#biblioteca .page-title .eyebrow {
  display: none;
}

.page-title p:not(.eyebrow) {
  margin: 14px 0 0;
  color: #5a5247;
  font-size: 18px;
  line-height: 1.55;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(167, 125, 45, 0.08), rgba(35, 66, 52, 0.035)),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.search-box input {
  width: 100%;
  min-height: 46px;
  padding: 12px 16px 12px 46px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    #fffdf8
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a77d2d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3C/svg%3E")
    no-repeat 17px center / 18px 18px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(167, 125, 45, 0.14);
}

.search-box input::placeholder {
  color: rgba(111, 102, 87, 0.62);
}

.library-category-nav {
  position: relative;
  display: flex;
  gap: 0;
  margin: 0 0 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  --filter-indicator-left: 0px;
  --filter-indicator-width: 0px;
}

.library-category-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 1px;
  background: rgba(108, 83, 39, 0.22);
}

.library-category-nav::after {
  content: "";
  position: absolute;
  left: var(--filter-indicator-left);
  bottom: 3px;
  width: var(--filter-indicator-width);
  height: 2px;
  border-radius: 999px;
  background: var(--gold);
  transition:
    left 260ms ease,
    width 260ms ease;
}

.filter-button {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 14px;
  color: #8a8174;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
}

.filter-button:hover {
  color: #6a6256;
}

.filter-button.is-active {
  color: var(--ink);
  font-weight: 750;
}

.library-count {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

#libraryGrid {
  transition:
    opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

#libraryGrid.is-leaving-left,
#libraryGrid.is-entering-left {
  opacity: 0;
  transform: translateX(-18px);
}

#libraryGrid.is-leaving-right,
#libraryGrid.is-entering-right {
  opacity: 0;
  transform: translateX(18px);
}

.resource-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  gap: 12px;
  min-height: 410px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.9), rgba(246, 235, 214, 0.78)),
    var(--panel);
  box-shadow: 0 12px 28px rgba(73, 52, 21, 0.11);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.resource-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 125, 45, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(244, 230, 203, 0.9)),
    var(--panel-2);
  box-shadow: var(--shadow-soft);
}

.resource-card.is-feature:focus-visible {
  outline: 3px solid rgba(167, 125, 45, 0.24);
  outline-offset: 3px;
}

.resource-card.reveal-item:hover {
  transform: translateY(-2px);
}

.resource-card.is-book {
  min-height: 410px;
  padding: 14px;
}

.resource-card.is-primary-book {
  position: relative;
  border-color: rgba(167, 125, 45, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.96), rgba(242, 224, 190, 0.88)),
    var(--panel);
  box-shadow: 0 16px 34px rgba(167, 125, 45, 0.16);
}

.resource-card.is-feature {
  min-height: 360px;
  padding: 8px 8px 14px;
  cursor: pointer;
}

#libraryGrid .resource-card {
  min-height: 360px;
  padding: 8px 8px 14px;
}

.resource-card.is-feature * {
  cursor: pointer;
}

.resource-card.is-feature .card-actions,
.resource-card.is-feature .card-actions * {
  cursor: auto;
}

.resource-card.is-feature .card-actions a {
  cursor: pointer;
}

.thumb {
  position: relative;
  width: 100%;
  height: clamp(178px, 18vw, 226px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7ecd9;
}

.resource-card.is-feature .thumb,
#libraryGrid .resource-card .thumb {
  height: 184px;
  background: #f3eadb;
}

.resource-card.is-feature .thumb::before,
#libraryGrid .resource-card .thumb::before {
  content: "";
  position: absolute;
  inset: -18px;
  background: var(--thumb-bg) center / cover no-repeat;
  filter: blur(16px) brightness(0.82) saturate(0.95);
  opacity: 0.45;
  transform: scale(1.08);
}

.resource-card.is-feature .thumb::after,
#libraryGrid .resource-card .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  pointer-events: none;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  cursor: pointer;
}

.thumb-image-link {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.thumb-image-link:focus-visible {
  outline: 3px solid rgba(167, 125, 45, 0.26);
  outline-offset: -5px;
  border-radius: 6px;
}

.thumb-pages {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 3;
  max-width: calc(100% - 20px);
  padding: 5px 9px;
  border: 1px solid rgba(255, 250, 240, 0.34);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 250, 240, 0.34);
  box-shadow: 0 8px 18px rgba(24, 36, 29, 0.14);
  backdrop-filter: blur(12px) saturate(130%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(255, 250, 240, 0.75);
  white-space: nowrap;
}

.thumb-read {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, 0.34);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 250, 240, 0.34);
  box-shadow: 0 8px 18px rgba(24, 36, 29, 0.14);
  backdrop-filter: blur(12px) saturate(130%);
}

.thumb-read::before {
  content: "";
  width: 17px;
  height: 17px;
  background-color: currentColor;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.thumb-read:hover {
  color: #fffaf0;
  background: rgba(167, 125, 45, 0.84);
}

.resource-card.is-feature .thumb img,
#libraryGrid .resource-card .thumb img {
  object-fit: contain;
}

.card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(167, 125, 45, 0.12);
  color: var(--gold);
  font-size: 12px;
  font-weight: 650;
}

.pages {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.resource-card p {
  margin: 0;
  color: #62594c;
  line-height: 1.48;
}

.card-actions {
  margin-top: auto;
  justify-content: flex-end;
}

.card-actions .primary-action,
.card-actions .secondary-action {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 14px;
}

.card-actions .secondary-action::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: 16px 16px;
}

.card-actions .secondary-action::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
}

.resource-card.is-feature .card-actions .secondary-action:hover {
  color: #fffaf0;
  border-color: rgba(167, 125, 45, 0.78);
  background: var(--gold);
  box-shadow: 0 12px 24px rgba(167, 125, 45, 0.2);
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: start;
}

.home-contact {
  margin-top: 72px;
  padding-top: 52px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 96px;
}

.home-contact .section-heading .eyebrow {
  display: none;
}

.contact-heading {
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: end;
}

.contact-heading h2 {
  font-style: italic;
}

.contact-heading p:not(.eyebrow) {
  display: none;
}

.contact-panel,
.contact-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 232, 0.72)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.contact-panel {
  min-height: 100%;
  padding: 6px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.contact-panel .eyebrow {
  display: none;
}

.contact-panel p:not(.eyebrow),
.form-status {
  color: #5d5548;
  line-height: 1.6;
}

.contact-form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.contact-form label {
  display: grid;
  gap: 8px;
}

.contact-form label span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  outline: none;
}

.contact-form input {
  min-height: 42px;
  padding: 10px 13px;
}

.contact-form textarea {
  min-height: 132px;
  resize: vertical;
  padding: 11px 13px;
  line-height: 1.5;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(167, 125, 45, 0.14);
}

.form-status {
  min-height: 22px;
  margin: 0;
  font-size: 14px;
}

.reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  justify-content: flex-end;
  background: rgba(24, 36, 29, 0.34);
}

.reader.is-open {
  display: flex;
}

.reader-panel {
  width: min(980px, 92vw);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  box-shadow: -24px 0 70px rgba(73, 52, 21, 0.18);
}

.reader-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 247, 232, 0.88);
}

.reader-header h2 {
  font-size: 24px;
}

.icon-button {
  min-height: 38px;
  padding: 8px 13px;
  color: var(--ink);
  border-color: var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  font-weight: 800;
}

#pdfFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.reader-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.96);
}

@media (max-width: 1040px) {
  .header-inner,
  main {
    width: min(100% - 32px, var(--container));
  }

  .brand {
    min-width: 230px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 18px;
  }

  .hero-feature {
    min-height: 420px;
    max-width: 560px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-card.is-feature .thumb,
  #libraryGrid .resource-card .thumb {
    height: 220px;
  }
}

@media (max-width: 820px) {
  .site-header {
    position: sticky;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
    min-height: 68px;
  }

  .brand {
    min-width: 0;
    order: 1;
    flex: 1 1 min(260px, 100%);
  }

  .language-toggle {
    order: 2;
    margin-left: auto;
  }

  .menu-button {
    display: none;
    order: 3;
    margin-left: 0;
  }

  .site-nav {
    order: 4;
    display: grid;
    flex-basis: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    margin-left: 0;
    overflow-x: visible;
    padding: 8px 0 2px;
    border-top: 1px solid rgba(108, 83, 39, 0.14);
    scrollbar-width: thin;
  }

  .site-nav.is-open {
    display: grid;
  }

  .nav-link {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding-inline: 10px;
    text-align: center;
  }

  main {
    padding-top: 28px;
  }

  .hero {
    gap: 22px;
    padding-bottom: 24px;
  }

  .books-layout,
  .home-intro,
  .contact-layout,
  .toolbar,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .home-intro h2 {
    max-width: 620px;
  }

  .resource-card,
  .resource-card.is-book {
    min-height: auto;
  }

  .is-book .thumb,
  .thumb {
    height: clamp(180px, 48vw, 260px);
  }
}

@media (max-width: 560px) {
  .header-inner,
  main {
    width: min(100% - 24px, var(--container));
  }

  .header-inner {
    gap: 10px;
  }

  .brand {
    flex: 1 1 auto;
    gap: 8px;
    max-width: calc(100% - 112px);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .language-toggle {
    min-width: 40px;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .menu-button {
    min-height: 38px;
    padding: 8px 12px;
  }

  .site-nav {
    gap: 6px;
  }

  .nav-link {
    min-height: 40px;
    font-size: 13px;
  }

  main {
    padding-top: 24px;
    padding-bottom: 52px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 10.5px;
  }

  h1 {
    font-size: 39px;
    line-height: 1;
  }

  .hero-copy h1 {
    white-space: normal;
  }

  h2 {
    font-size: 29px;
  }

  .lead {
    margin-top: 20px;
    font-size: 16.5px;
  }

  .hero-actions {
    margin-top: 24px;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .card-actions .primary-action,
  .card-actions .secondary-action,
  .reader-actions .primary-action,
  .reader-actions .secondary-action {
    width: auto;
    flex: 1 1 150px;
  }

  .hero {
    padding-bottom: 14px;
  }

  .hero-feature {
    min-height: 310px;
    margin-top: 6px;
  }

  .book-showcase {
    min-height: 310px;
    gap: 10px;
  }

  .book-cover-stack {
    min-height: 288px;
  }

  .cover-frame {
    width: min(54%, 190px);
  }

  .showcase-caption {
    display: none;
  }

  .section-block {
    margin-top: 18px;
    padding-top: 18px;
  }

  .section-heading {
    grid-template-columns: 1fr;
  }

  .carousel-controls {
    grid-column: 1;
    justify-content: flex-end;
  }

  .home-intro {
    margin-top: 18px;
    padding: 4px 0 24px;
  }

  .intro-copy p {
    font-size: 16px;
    line-height: 1.65;
  }

  .toolbar {
    padding: 12px;
  }

  .filter-button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 13px;
  }

  .library-category-nav {
    scrollbar-width: none;
  }

  .library-category-nav::-webkit-scrollbar {
    display: none;
  }

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

  .resource-card.is-feature .thumb,
  #libraryGrid .resource-card .thumb {
    height: clamp(190px, 52vw, 260px);
  }

  .resource-card,
  .resource-card.is-book {
    gap: 12px;
    padding: 12px;
  }

  .is-book .thumb,
  .thumb {
    height: clamp(170px, 52vw, 240px);
  }

  .contact-panel,
  .contact-form {
    padding: 18px;
  }

  .contact-heading {
    grid-template-columns: 1fr;
  }

  .reader-header {
    padding: 16px 14px;
  }

  .reader-header h2 {
    font-size: 21px;
  }

  .reader-actions {
    padding: 12px 14px;
  }

  .reader-panel {
    width: 100vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .reveal-item {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 380px) {
  .header-inner {
    gap: 6px;
  }

  .brand {
    max-width: calc(100% - 102px);
  }

  .brand small {
    display: none;
  }

  .brand-mark {
    display: none;
  }

  .language-toggle {
    min-width: 38px;
    padding: 7px 8px;
  }

  .menu-button {
    padding: 8px 10px;
  }

  h1 {
    font-size: 34px;
  }

  .book-cover-stack {
    min-height: 250px;
  }
}
