:root {
  --bg: #f8f4ec;
  --paper: #fffdf8;
  --ink: #3f3930;
  --muted: #81776a;
  --line: #ded5c7;
  --sage: #75877f;
  --water: #8fa8b2;
  --clay: #b8775f;
  --shadow: 0 10px 28px rgba(63, 57, 48, 0.08);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(143, 168, 178, 0.16), transparent 420px),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

.back-link {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 10;
  padding: 7px 12px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--ink);
  border: 1px solid rgba(222, 213, 199, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-decoration: none;
}

main {
  width: min(100%, 760px);
  margin: 0 auto;
}

.hero {
  padding: 58px 22px 30px;
}

.eyebrow,
.chapter span {
  color: var(--sage);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  margin-top: 12px;
  font-size: 38px;
  line-height: 1.18;
}

.lead,
.intro,
.copy p,
.closing p {
  color: var(--muted);
}

.lead {
  max-width: 33em;
  margin: 18px 0 0;
  font-size: 15px;
}

.intro {
  margin: 8px 22px 18px;
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 15px;
}

.intro p,
.copy p,
.closing p {
  margin: 0;
}

.chapter {
  padding: 36px 14px 28px;
}

.copy {
  padding: 0 8px 16px;
}

.copy span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.copy span::after {
  content: "";
  width: 42px;
  height: 1px;
  background: var(--line);
}

h2 {
  font-size: 28px;
  line-height: 1.28;
}

.copy p {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 14.5px;
}

.chapter img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 16px;
  border: 1px solid rgba(222, 213, 199, 0.72);
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.chapter:nth-of-type(2n) .copy span {
  color: var(--water);
}

.chapter:nth-of-type(3n) .copy span {
  color: var(--clay);
}

.closing {
  padding: 38px 22px 58px;
  text-align: center;
}

.closing p {
  font-family: var(--serif);
  font-size: 15px;
}

.closing a {
  display: inline-block;
  margin-top: 22px;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid var(--clay);
}

.journal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(34px, env(safe-area-inset-bottom));
  background: rgba(28, 24, 20, 0.94);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.journal-lightbox.open {
  display: flex;
  opacity: 1;
}

.journal-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.45);
  touch-action: pan-y;
}

.journal-lightbox button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 253, 248, 0.2);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.1);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.journal-lightbox button:active {
  background: rgba(255, 253, 248, 0.2);
}

.jl-close {
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
}

.jl-prev,
.jl-next {
  top: 50%;
  transform: translateY(-50%);
}

.jl-prev {
  left: 14px;
}

.jl-next {
  right: 14px;
}

.jl-counter {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 253, 248, 0.72);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.16em;
}

@media (max-width: 560px) {
  .journal-lightbox {
    padding: max(58px, env(safe-area-inset-top)) 16px max(46px, env(safe-area-inset-bottom));
  }

  .journal-lightbox img {
    max-height: calc(100vh - 118px);
    max-height: calc(100svh - 118px);
  }

  .jl-prev,
  .jl-next {
    display: none;
  }
}

@media (min-width: 720px) {
  .hero {
    padding-top: 74px;
  }

  h1 {
    font-size: 48px;
  }

  .chapter {
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .chapter img {
    content-visibility: auto;
  }
}
