/* A quieter frame around a more expressive first page. */
:root {
  --paper: #fff9ef;
  --ink: #302822;
  --muted: #695c53;
  --rose: #763e4e;
  --line: #d9cabb;
  --green: #586653;
  background: #cfc1b0;
}

body {
  background:
    radial-gradient(ellipse 75% 65% at 50% -8%, #f7edda 0, transparent 80%),
    linear-gradient(110deg, #c9b9a8, #e6daca 52%, #cab8aa);
}

.masthead {
  padding-block: 25px 22px;
}
.book-name {
  font-size: clamp(1.75rem, 2.3vw, 2.2rem);
  letter-spacing: -.025em;
}
.book-name span { color: var(--rose); }
.masthead-note {
  font-family: var(--ui);
  font-size: .7rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.reading-tools {
  min-height: 52px;
  margin-bottom: 14px;
  background: #f8f0e3e8;
  border-color: #bca994;
  border-radius: 3px;
  box-shadow: 0 8px 20px #45342615;
}
.reader-tool { color: var(--ink); }
.reader-chapters { border-right-color: #d3c2af; }
.reader-location { letter-spacing: .09em; text-transform: uppercase; }

.book {
  border-color: #a17371;
  border-left-width: 6px;
  box-shadow:
    4px 4px 0 #f4e9d7,
    7px 7px 0 #ae9c87,
    0 26px 65px #45342633;
}
.book::before { background: linear-gradient(90deg, #533a32a8, #a4786b35 40%, transparent); }
.sheet { background-color: var(--paper); }
.left-sheet { background-color: #fdf6e9; }
.bookmark { left: 43px; }
.ribbon {
  width: 33px;
  height: 75px;
  background: #763e4e;
  font-size: 1.25rem;
  box-shadow: inset 3px 0 #ffffff25;
}
.bookmark-label {
  font-family: var(--ui);
  font-size: .68rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--rose);
}
.chapter-eyebrow {
  color: var(--rose);
  font-size: .66rem;
  letter-spacing: .17em;
  margin-bottom: 22px;
}
.chapter-dot { background: currentColor; }
.chapter-hello h1 {
  font-size: clamp(5rem, 7.5vw, 7.3rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.chapter-hello .left-sheet { padding-top: 105px; }
.chapter-hello .greeting { margin-top: 42px; max-width: 43ch; }
.greeting p:first-child { font-size: 1.5rem; line-height: 1.45; }
.greeting p:last-child { color: var(--muted); }
.chapter-hello .welcome-actions { margin-top: 34px; }
.primary-button {
  background: var(--rose);
  border-color: var(--rose);
  border-radius: 2px;
  box-shadow: none;
  font-weight: 500;
}
.primary-button:hover { background: #5e2e3d; }
.outline-button {
  border-color: #a78979;
  border-radius: 2px;
  background: #fff9ef85;
}
.outline-button:hover { background: #efe0d1; }

.chapter-hello .right-sheet {
  padding-top: 92px;
  justify-content: center;
  background: #f6ecdd;
}
.photo-preface {
  max-width: 330px;
  margin-bottom: 30px;
  font-size: 1.45rem;
  color: var(--rose);
}
.cover-photo {
  max-width: 370px;
  padding: 12px 12px 21px;
  background: #fffaf1;
  border-color: #d1bcaa;
  box-shadow: 0 18px 36px #48302436, 0 2px 5px #48302420;
  transform: rotate(2deg);
}
.cover-photo:hover { transform: rotate(0) translateY(-3px); }
.cover-photo .media-visual {
  aspect-ratio: 1.2;
  border: 0;
  background: #34443d;
}
.cover-photo .placeholder {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 49% 47%, #d7b893 0 28%, transparent 28.4%),
    linear-gradient(150deg, #4e6255, #263a34 70%);
  color: #f9ead4;
}
.cover-photo .placeholder::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid #e8d4b861;
  z-index: 1;
  pointer-events: none;
}
.cover-photo .placeholder::after {
  content: 'РЕЙ';
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  color: #f3e0c6;
  font: 500 1.1rem/1 var(--heading);
  letter-spacing: .35em;
  text-align: center;
}
.cover-photo .placeholder .sketch {
  position: relative;
  z-index: 1;
  width: 88%;
  height: 78%;
  max-height: 78%;
  margin-top: -14px;
  stroke-width: 2.5;
  filter: drop-shadow(0 3px 1px #263a3440);
}
.cover-photo .photo-caption {
  padding: 18px 12px 0;
  font-family: var(--heading);
  font-size: 1.75rem;
  font-style: italic;
  line-height: 1.12;
}
.cover-photo .photo-hint { color: var(--rose); }
.tape { background: #d9a1a2a8; border: 0; }
.photo-afterword { margin-top: 38px; }
.photo-afterword span { font-size: 1.2rem; }

.page-nav { background: #fff9ef; }
.page-nav a { color: var(--ink); }
.page-nav a:hover { color: var(--rose); }
.outside-note { color: #58483e; }

@media (max-width: 979px) {
  .chapter-hello .left-sheet { padding-top: 92px; }
}

@media (max-width: 680px) {
  body {
    background: linear-gradient(110deg, #d4c5b4, #e9ddcd 60%, #d8c7b8);
  }
  .masthead {
    padding: 13px 18px 10px;
  }
  .book-name { font-size: 1.65rem; }
  .masthead-note { display: none; }
  .reading-tools {
    margin: 0 8px 11px;
    min-height: 48px;
    border: 1px solid #c7b5a1;
  }
  .reader-tool { font-size: .72rem; min-height: 44px; }
  .reader-location { font-size: .58rem; }
  .book { margin-inline: 8px 12px; border-left-width: 4px; }
  .bookmark { left: 23px; top: -6px; }
  .ribbon { width: 28px; height: 57px; padding-top: 11px; }
  .bookmark-label { font-family: var(--ui); font-size: .58rem; }

  .chapter-hello {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 88px 26px 36px;
    background: var(--paper);
  }
  .chapter-hello > .left-sheet,
  .chapter-hello .left-content { display: contents; }
  .chapter-hello .chapter-eyebrow { order: 1; margin: 0 0 15px; }
  .chapter-hello h1 {
    order: 2;
    font-size: clamp(4.2rem, 17vw, 5.7rem);
    margin-bottom: 18px;
  }
  .chapter-hello .right-sheet {
    order: 3;
    display: block;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .chapter-hello .photo-preface,
  .chapter-hello .photo-afterword { display: none; }
  .cover-photo {
    display: grid;
    grid-template-columns: 42% 1fr;
    align-items: center;
    gap: 15px;
    max-width: none;
    padding: 8px;
    min-height: 165px;
    transform: rotate(0);
    box-shadow: 0 10px 24px #48302422;
  }
  .cover-photo .media-visual { height: 100%; aspect-ratio: 1; }
  .cover-photo .placeholder::before { inset: 7px; }
  .cover-photo .placeholder::after { bottom: 9px; font-size: .7rem; }
  .cover-photo .placeholder .sketch { width: 110%; max-height: 75%; }
  .cover-photo .photo-caption {
    padding: 0 5px 0 0;
    font-size: clamp(1.25rem, 6vw, 1.55rem);
    text-align: left;
  }
  .cover-photo .photo-hint {
    position: absolute;
    right: 22px;
    bottom: 18px;
    font-size: .6rem;
  }
  .cover-photo .tape { display: none; }
  .chapter-hello .greeting { order: 4; margin-top: 30px; }
  .chapter-hello .greeting p:first-child { font-size: 1.3rem; }
  .chapter-hello .greeting p:last-child { font-size: 1rem; }
  .chapter-hello .welcome-actions { order: 5; margin-top: 27px; }
  .chapter-hello .margin-note { order: 6; }
  .chapter-hello .welcome-actions .primary-button { font-size: 1.35rem; }
}

@media (max-width: 360px) {
  .chapter-hello { padding-inline: 19px; }
  .chapter-hello h1 { font-size: 4rem; }
  .cover-photo { gap: 10px; }
  .cover-photo .photo-caption { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cover-photo { transition: none; }
}
