@font-face {
  font-family: "Ponomar";
  src: url("assets/ponomar.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --paper: #1a171f;
  --paper-deep: #131118;
  --ink: #f8f3ed;
  --ink-muted: rgba(248, 243, 237, 0.56);
  --accent: #ff784d;
  --accent-soft: #c65f44;
  --page-width: 51rem;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper-deep);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 6%, rgba(255, 120, 77, 0.035), transparent 31rem),
    linear-gradient(90deg, var(--paper-deep), var(--paper) 8%, var(--paper) 92%, var(--paper-deep));
  color: var(--ink);
  font-family: "Ponomar", Georgia, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.04) 15%, rgba(255, 255, 255, 0.04) 85%, transparent);
}

body::before {
  left: max(1.4rem, calc(50% - 34rem));
}

body::after {
  right: max(1.4rem, calc(50% - 34rem));
}

button {
  font: inherit;
}

.grain {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}

.topbar,
.footer {
  position: fixed;
  z-index: 20;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  margin: auto;
  padding-right: max(1.35rem, env(safe-area-inset-right));
  padding-left: max(1.35rem, env(safe-area-inset-left));
  color: var(--ink-muted);
}

.topbar {
  top: 0;
  justify-content: space-between;
  height: calc(4.6rem + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(var(--paper) 0%, rgba(26, 23, 31, 0.92) 64%, transparent 100%);
}

.home-link {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.69rem;
  font-weight: 400;
  letter-spacing: 0.17em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms ease;
}

.home-link:hover,
.home-link:focus-visible {
  color: var(--accent);
}

.reader {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: clamp(6.4rem, 12vh, 8.5rem) clamp(1.65rem, 7vw, 6rem) clamp(7.4rem, 13vh, 9rem);
}

.prayer {
  width: min(100%, var(--page-width));
  margin: auto;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 180ms ease, transform 280ms cubic-bezier(0.2, 0.72, 0.3, 1);
}

.prayer.is-leaving-left {
  opacity: 0;
  transform: translateX(-2rem);
}

.prayer.is-leaving-right {
  opacity: 0;
  transform: translateX(2rem);
}

.prayer.is-entering-left {
  animation: enter-left 380ms cubic-bezier(0.2, 0.72, 0.3, 1) both;
}

.prayer.is-entering-right {
  animation: enter-right 380ms cubic-bezier(0.2, 0.72, 0.3, 1) both;
}

.prayer__kicker {
  margin: 0 0 1.15rem;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.68rem, 1.2vw, 0.78rem);
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.prayer__title {
  max-width: 48rem;
  margin: 0 auto;
  color: var(--accent);
  font-size: clamp(2.1rem, 7vw, 4.25rem);
  font-weight: 400;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
}

.ornament {
  display: flex;
  align-items: center;
  width: min(100%, 34rem);
  margin: clamp(2rem, 6vh, 3.7rem) auto;
  color: var(--accent-soft);
}

.ornament::before,
.ornament::after {
  height: 1px;
  flex: 1;
  content: "";
  background: currentColor;
  box-shadow: 0 0 7px rgba(255, 120, 77, 0.14);
}

.ornament svg {
  width: 8.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  overflow: visible;
}

.prayer__body {
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  line-height: 1.53;
  text-wrap: pretty;
}

.prayer__body p {
  margin: 0 0 0.82em;
}

.prayer__body p:last-child {
  margin-bottom: 0;
}

.prayer__body p:first-child::first-letter {
  float: left;
  margin: 0.04em 0.12em -0.06em 0;
  color: var(--accent);
  font-size: 2.45em;
  line-height: 0.72;
}

.library {
  width: min(100%, 58rem);
}

.library__title {
  margin: 0;
  color: var(--accent);
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.library__sections {
  display: grid;
  width: min(100%, 46rem);
  margin: 0 auto;
  border-top: 1px solid rgba(248, 243, 237, 0.13);
}

.library__section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  width: 100%;
  padding: 1.3rem 0;
  border: 0;
  border-bottom: 1px solid rgba(248, 243, 237, 0.13);
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.55rem, 3.3vw, 2.35rem);
  line-height: 1.12;
  text-align: left;
  cursor: pointer;
  transition: color 160ms ease, padding 180ms ease;
}

.library__section:hover,
.library__section:focus-visible {
  padding-left: 0.45rem;
  color: var(--accent);
}

.library__arrow {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.loader,
.error {
  color: var(--ink-muted);
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.error strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-family: "Ponomar", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
}

.tap-zone {
  position: fixed;
  z-index: 10;
  top: 4.4rem;
  bottom: 3.2rem;
  width: min(22vw, 14rem);
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.tap-zone--left {
  left: 0;
}

.tap-zone--right {
  right: 0;
}

.tap-zone span {
  position: absolute;
  top: 50%;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 2.5rem;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 160ms ease, transform 160ms ease;
}

.tap-zone--left span {
  left: 1.2rem;
  transform: translate(-0.35rem, -50%);
}

.tap-zone--right span {
  right: 1.2rem;
  transform: translate(0.35rem, -50%);
}

.tap-zone:hover span,
.tap-zone:focus-visible span {
  opacity: 0.7;
  transform: translate(0, -50%);
}

.tap-zone:disabled {
  cursor: default;
  pointer-events: none;
}

.footer {
  bottom: 0;
  height: calc(3.3rem + env(safe-area-inset-bottom));
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(transparent 0%, rgba(26, 23, 31, 0.94) 62%, var(--paper) 100%);
}

.progress {
  width: min(calc(100% - 2.7rem), 34rem);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(248, 243, 237, 0.12);
}

.progress__value {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 340ms cubic-bezier(0.2, 0.72, 0.3, 1);
}

.is-hidden {
  display: none !important;
}

noscript {
  position: fixed;
  z-index: 30;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  padding: 1rem;
  background: var(--paper);
  color: var(--accent);
  text-align: center;
}

@keyframes enter-left {
  from { opacity: 0; transform: translateX(2rem); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes enter-right {
  from { opacity: 0; transform: translateX(-2rem); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 640px) {
  .reader {
    place-items: start center;
    padding-right: 1.55rem;
    padding-left: 1.55rem;
  }

  .prayer__body {
    line-height: 1.47;
  }

  .ornament {
    margin-top: 1.9rem;
    margin-bottom: 2.25rem;
  }

  .ornament svg {
    width: 6.4rem;
  }

  .tap-zone {
    width: 28vw;
  }

  .tap-zone span {
    display: none;
  }

  .home-link {
    font-size: 0.58rem;
    letter-spacing: 0.11em;
  }

  .library__title {
    font-size: clamp(3rem, 13.5vw, 5rem);
  }

  .library__section {
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    padding: 1.15rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
