:root {
  --paper: #f7f5ef;
  --white: #fffdf8;
  --ink: #393a35;
  --muted: #77776e;
  --sage: #69765f;
  --sage-light: #e7eadf;
  --line: #e7e3d9;
  --serif: "Literata", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.wrap {
  width: min(1160px, calc(100% - 56px));
  margin-inline: auto;
}

.site-header {
  height: 86px;
  padding: 0 max(28px, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(90, 88, 76, 0.12);
  position: relative;
  z-index: 5;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.wordmark small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.wordmark-mark {
  width: 38px;
  height: 38px;
  border: 1px solid #b9bfac;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--sage);
  font-family: var(--serif);
  font-size: 14px;
}

.main-nav {
  display: flex;
  gap: 34px;
  font-size: 12px;
  color: #55564f;
}

.main-nav a:hover,
.text-link:hover {
  color: var(--sage);
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  flex-wrap: wrap;
  gap: 14px 20px;
}

.footer-actions form {
  margin: 0;
}

.footer-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.footer-actions > a,
.footer-actions button {
  font-size: 11px;
  border-bottom: 1px solid #b7bcac;
  padding-bottom: 5px;
}

.menu-toggle {
  display: none;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--ink);
}

.hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 0.95fr;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 66px;
}

.hero-copy {
  padding: 0 0 15px 6%;
}

.eyebrow {
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.16em;
  color: var(--sage);
  font-weight: 600;
  margin: 0 0 20px;
}

.eyebrow-line {
  display: inline-block;
  width: 28px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-right: 8px;
}

.hero h1,
.page-intro h1,
.detail-copy h1,
.error-page h1 {
  font: 400 clamp(52px, 6.4vw, 86px) / 0.99 var(--serif);
  letter-spacing: -0.055em;
  margin: 0 0 24px;
}

.hero h1 em,
.error-page h1 em {
  color: var(--hero-heading-accent-color, #839078);
  font-weight: 400;
}

.hero h1 {
  color: var(--hero-text-color, var(--ink));
}

.hero-lead {
  font: 400 17px / 1.8 var(--serif);
  color: #66665e;
  margin: 0 0 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  border: 0;
  padding: 14px 19px;
  font-size: 12px;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.button:hover {
  transform: translateY(-2px);
}

.button-dark {
  background: #454a40;
  color: #fffdf8;
}

.button-dark:hover {
  background: #5e6954;
}

.button-outline {
  border: 1px solid #b9bfac;
  background: rgba(255, 253, 248, 0.65);
  color: var(--ink);
}

.button-outline:hover {
  background: var(--sage-light);
}

.button span {
  font-size: 16px;
}

.hero-art {
  height: 420px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background-color: var(--hero-background-color, #daddcf);
  background-image:
    radial-gradient(ellipse at 68% 29%, #f8eed2 0, rgba(248, 238, 210, 0.5) 11%, transparent 12%),
    linear-gradient(155deg, #e8e8dc, #daddcf 58%, #c9d0c0);
  margin: 4px 4% 0 6%;
}

.hero-art-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-cover {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: 90%;
  max-width: 78%;
  object-fit: contain;
  transform: rotate(-2deg);
  filter: drop-shadow(14px 20px 20px rgba(45, 48, 41, 0.28));
}

.section {
  padding-top: 74px;
  padding-bottom: 86px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-heading .eyebrow {
  margin-bottom: 8px;
}

.section-heading h2,
.mood-section h2,
.author-note h2 {
  font: 400 clamp(29px, 3.2vw, 42px) / 1.2 var(--serif);
  letter-spacing: -0.035em;
  margin: 0;
}

.text-link {
  font-size: 11px;
  color: #555b50;
  border-bottom: 1px solid #c5c9bc;
  padding-bottom: 6px;
}

.text-link span {
  margin-left: 12px;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.work-card {
  min-width: 0;
  position: relative;
}

.work-card__title-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.work-card__title-link:focus-visible::after {
  outline: 3px solid var(--sage);
  outline-offset: 4px;
}

.work-card .work-meta a {
  position: relative;
  z-index: 2;
}

/* Важно: эти контейнеры ограничивают абсолютное позиционирование обложек */
.cover-art,
.detail-cover {
  height: 274px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #e7e5d9, #d0d7c8);
}

/* Полная миниатюра обложки без обрезания и растягивания на страницу */
.cover-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position:
    var(--cover-position-x, 50%)
    var(--cover-position-y, 50%);
  z-index: 0;
}

.cover-2 {
  background: linear-gradient(145deg, #e7ddd8, #d5c9bf);
}

.cover-3 {
  background: linear-gradient(145deg, #dde2d9, #c6d1c4);
}

/* Круги показываются только на заглушках без загруженного изображения */
.cover-art:not(:has(img))::before,
.detail-cover:not(:has(img))::before {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  border: 1px solid #ffffff70;
  border-radius: 50%;
  left: calc(50% - 100px);
  top: 38px;
}

.cover-art:not(:has(img))::after,
.detail-cover:not(:has(img))::after {
  content: "";
  position: absolute;
  width: 122px;
  height: 122px;
  border: 1px solid #ffffff75;
  border-radius: 50%;
  left: calc(50% - 61px);
  top: 77px;
}

.cover-art:has(img) .cover-orbit,
.detail-cover:has(img) .cover-orbit {
  display: none;
}

.cover-orbit {
  position: absolute;
  width: 140px;
  height: 230px;
  border: 1px solid #ffffff65;
  border-radius: 50%;
  transform: rotate(35deg);
}

.cover-copy {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 75%;
  color: #495044;
}

.cover-copy small {
  font-size: 8px;
  letter-spacing: 0.17em;
}

.cover-copy strong {
  font: 500 26px / 1.2 var(--serif);
  margin: 40px 0 17px;
  max-width: 100%;
}

.cover-copy i {
  font: italic 12px var(--serif);
  color: #6c7165;
}

.work-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 7px;
  color: #818277;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.work-card h3 {
  font: 500 23px var(--serif);
  margin: 3px 0 7px;
}

.work-card p {
  font-size: 12px;
  color: #73746b;
  line-height: 1.7;
  margin: 0 0 13px;
}

.read-link {
  font-size: 10px;
  color: var(--sage);
  letter-spacing: 0.04em;
}

.read-link span {
  margin-left: 8px;
}

.mood-section {
  padding: 76px 0 82px;
  background: #eceee5;
}

.mood-section .eyebrow {
  margin-bottom: 10px;
}

.mood-section h2 {
  max-width: 600px;
}

.genre-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.genre-pills a {
  background: #f8f8f2;
  border: 1px solid #e1e4d9;
  padding: 12px 16px;
  font: 16px var(--serif);
  transition: background 0.2s;
}

.genre-pills a:hover {
  background: #dfe5d8;
}

.genre-pills span {
  font: 11px var(--sans);
  color: var(--sage);
  margin-left: 10px;
}

.author-note {
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: 10%;
  align-items: center;
  padding-top: 65px;
  padding-bottom: 90px;
}

.author-monogram {
  width: 100%;
  aspect-ratio: 1.15;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #e5e3d7, #cfd6c9);
  font: 400 100px var(--serif);
  color: #66725e;
  position: relative;
}

.author-monogram::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid #ffffff80;
  border-radius: 50%;
}

.author-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1.15;
  object-fit: cover;
}

.author-note .eyebrow {
  margin-bottom: 10px;
}

.author-note h2 {
  margin-bottom: 20px;
}

.author-note p:not(.eyebrow) {
  max-width: 440px;
  font: 15px / 1.85 var(--serif);
  color: #6e6e65;
  margin: 0 0 20px;
}

.site-footer {
  background: #e9e9df;
  padding: 40px max(28px, calc((100vw - 1160px) / 2)) 18px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 28px;
}

.footer-inner > p {
  font: 14px var(--serif);
  color: #77776c;
}

.footer-inner > a:last-child {
  font-size: 11px;
  border-bottom: 1px solid #b7bcac;
  padding-bottom: 5px;
}

.copyright {
  border-top: 1px solid #d7d8ce;
  padding-top: 14px;
  color: #8a8b81;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.page-intro {
  padding-top: 94px;
  padding-bottom: 24px;
}

.page-intro h1 {
  font-size: clamp(46px, 6vw, 72px);
  margin-bottom: 12px;
}

.page-intro > p:not(.eyebrow) {
  font: 17px / 1.75 var(--serif);
  color: #74746b;
  max-width: 640px;
}

.search-form {
  display: flex;
  gap: 9px;
  margin-top: 28px;
  max-width: 680px;
}

.search-form input,
.search-form select {
  background: #fffdf9;
  border: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--ink);
  font-size: 12px;
}

.search-form input {
  flex: 1;
}

.search-form select {
  min-width: 185px;
}

.search-form .button {
  padding: 12px 17px;
}

.quiet {
  color: #8a8a80;
  font: 14px var(--serif);
}

.detail-hero {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 9%;
  align-items: center;
  padding-top: 78px;
  padding-bottom: 68px;
}

.detail-cover {
  height: 435px;
  max-width: 350px;
  width: 100%;
  justify-self: center;
  box-shadow: 0 22px 50px #50554a18;
}

.detail-cover .cover-copy strong {
  font-size: 38px;
}

.detail-copy h1 {
  font-size: clamp(42px, 5vw, 66px);
  margin-bottom: 12px;
}

.detail-subtitle {
  font: italic 16px var(--serif);
  color: #828276;
  margin: 0 0 20px;
}

.detail-description {
  font: 16px / 1.9 var(--serif);
  color: #62635a;
  max-width: 600px;
}

.detail-stats {
  display: flex;
  gap: 22px;
  color: #85857a;
  font-size: 10px;
  margin: 18px 0 25px;
}

.detail-copy .work-meta {
  margin-top: 24px;
}

.contents {
  padding-top: 50px;
}

.chapter-row {
  display: grid;
  grid-template-columns: 64px 1fr 24px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 17px 6px;
  font: 17px var(--serif);
}

.chapter-row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.chapter-number {
  font: 10px var(--sans);
  color: #9b9b8e;
}

.chapter-arrow {
  color: var(--sage);
  text-align: right;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.genre-card {
  min-height: 188px;
  padding: 25px;
  background: #eeefe7;
  border: 1px solid #e4e5dc;
  position: relative;
  transition: background 0.2s;
}

.genre-card:hover {
  background: #e4e8dc;
}

.genre-index {
  font-size: 10px;
  color: #8b9380;
  letter-spacing: 0.12em;
}

.genre-card h2 {
  font: 400 28px var(--serif);
  margin: 20px 0 3px;
}

.genre-card p {
  font: 12px var(--serif);
  color: #7d7d73;
  margin: 0;
}

.genre-arrow {
  position: absolute;
  right: 23px;
  bottom: 23px;
  color: #737f67;
}

.intro-large {
  font: 20px / 1.8 var(--serif) !important;
  max-width: 620px;
}

.about-note {
  padding-top: 25px;
}

.contact-card {
  background: #eceee5;
  padding: 42px 48px;
  margin-bottom: 90px;
}

.contact-email {
  font: clamp(22px, 4vw, 39px) var(--serif);
  color: #555d4b;
}

.contact-links {
  display: flex;
  gap: 22px;
  margin-top: 24px;
  font-size: 11px;
  color: var(--sage);
}

.error-page {
  padding-top: 120px;
  padding-bottom: 150px;
}

.error-page h1 {
  font-size: clamp(42px, 6vw, 72px);
  margin-bottom: 30px;
}

.reader-page {
  background: var(--reader-background);
  color: var(--reader-text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

.reader-progress {
  height: 2px;
  background: var(--reader-border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.reader-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--reader-accent);
}

.reader-toolbar {
  position: sticky;
  top: 0;
  height: 65px;
  padding: 0 max(25px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--reader-background) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--reader-border);
  z-index: 4;
}

.back-link {
  font-size: 11px;
  color: var(--reader-muted);
}

.reader-settings-toggle {
  border: 1px solid var(--reader-border);
  background: var(--reader-surface);
  color: var(--reader-text);
  padding: 8px 11px;
  font-family: var(--serif);
  font-size: 16px;
  cursor: pointer;
}

.reader-settings-toggle span {
  font: 10px var(--sans);
  margin-left: 8px;
}

.reader-settings {
  position: fixed;
  top: 75px;
  right: 24px;
  z-index: 8;
  background: var(--reader-surface);
  border: 1px solid var(--reader-border);
  padding: 20px;
  width: 255px;
  box-shadow: 0 12px 34px #34362c18;
}

.reader-settings label {
  display: block;
  font-size: 10px;
  color: var(--reader-muted);
  margin-bottom: 14px;
}

.reader-settings select,
.reader-settings input {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.reader-settings select {
  border: 1px solid var(--reader-border);
  background: var(--reader-background);
  color: var(--reader-text);
  padding: 8px;
}

.reader-content {
  max-width: var(--reader-width, 720px);
  width: calc(100% - 44px);
  margin: 0 auto;
  padding: 82px 0 70px;
}

.reader-content > .eyebrow {
  text-align: center;
  color: var(--reader-muted);
  font-size: 9px;
}

.reader-content h1 {
  text-align: center;
  font: 400 38px / 1.25 var(--serif);
  margin: 0 0 55px;
}

.reader-prose {
  font: var(--reader-size, 20px) / var(--reader-leading, 1.85) var(--serif);
  color: var(--reader-text);
}

.reader-prose p {
  margin: 0 0 1.4em;
}

.reader-prose p:first-child:first-letter {
  font-size: 1.1em;
}

.reader-prose ::selection {
  background: var(--reader-selection);
}

.reader-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--reader-border);
  margin-top: 60px;
  padding-top: 20px;
  font-size: 10px;
  color: var(--reader-accent);
}

.reader-pagination span {
  color: var(--reader-muted);
}

.skip-link {
  position: absolute;
  z-index: 100;
  left: 12px;
  top: -100px;
  padding: 10px 14px;
  background: #fff;
  color: #222;
  border: 2px solid var(--sage);
}

.skip-link:focus {
  top: 12px;
}

:focus-visible {
  outline: 3px solid #68765c;
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  margin: 34px 0 0;
  font-size: 11px;
  color: var(--sage);
}

.pagination a {
  border-bottom: 1px solid #c5c9bc;
  padding-bottom: 4px;
}

.pagination span {
  color: var(--muted);
}

.reader-settings[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .wrap {
    width: calc(100% - 36px);
  }

  .site-header {
    height: 72px;
    padding: 0 18px;
  }

  .menu-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 71px;
    left: 0;
    right: 0;
    background: var(--paper);
    padding: 18px;
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    padding: 12px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 60px;
    padding-bottom: 48px;
    gap: 38px;
  }

  .hero-copy {
    padding: 0;
  }

  .hero h1 {
    font-size: 61px;
  }

  .hero-art {
    height: 330px;
    margin: 0 4%;
  }

  .section {
    padding-top: 52px;
    padding-bottom: 60px;
  }

  .section-heading {
    align-items: start;
    gap: 18px;
  }

  .section-heading h2,
  .mood-section h2 {
    font-size: 29px;
  }

  .work-grid {
    grid-template-columns: 1fr 1fr;
    gap: 26px 14px;
  }

  .cover-art {
    height: 220px;
  }

  .cover-copy strong {
    font-size: 21px;
  }

  .work-card h3 {
    font-size: 19px;
  }

  .work-card p {
    font-size: 11px;
  }

  .mood-section {
    padding: 55px 0;
  }

  .genre-pills {
    gap: 7px;
  }

  .genre-pills a {
    font-size: 14px;
    padding: 10px 12px;
  }

  .author-note {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 45px;
    padding-bottom: 58px;
  }

  .author-monogram,
  .author-photo {
    aspect-ratio: 1.5;
  }

  .author-monogram {
    font-size: 74px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 18px;
  }

  .footer-inner > p {
    order: 3;
    width: 100%;
    margin: 0;
  }

  .page-intro {
    padding-top: 65px;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-form input {
    min-width: 100%;
  }

  .search-form select {
    flex: 1;
    min-width: 0;
  }

  .detail-hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 45px;
  }

  .detail-cover {
    height: 360px;
  }

  .detail-copy h1 {
    font-size: 48px;
  }

  .detail-stats {
    gap: 12px;
    flex-wrap: wrap;
  }

  .genre-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .genre-card {
    min-height: 166px;
    padding: 18px;
  }

  .genre-card h2 {
    font-size: 23px;
  }

  .contact-card {
    padding: 30px 24px;
  }

  .reader-toolbar {
    height: 58px;
    padding: 0 18px;
  }

  .reader-content {
    padding-top: 57px;
    width: calc(100% - 38px);
  }

  .reader-content h1 {
    font-size: 31px;
    margin-bottom: 35px;
  }

  .reader-prose {
    font-size: var(--reader-size, 19px);
  }

  .reader-pagination {
    flex-wrap: wrap;
  }

  .reader-pagination a span {
    display: none;
  }

  .reader-settings {
    right: 12px;
    top: 68px;
  }

  .desktop {
    display: none;
  }
}

@media (max-width: 420px) {
  .work-grid {
    grid-template-columns: 1fr;
  }

  .cover-art {
    height: 270px;
  }

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

  .genre-card {
    min-height: 140px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > .text-link {
    display: inline-block;
    margin-top: 15px;
  }

  .reader-pagination {
    font-size: 9px;
  }
}

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

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