html, body.library {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  color: #111;
  cursor: grab;
  display: block;
  font-family: "Cormorant Garamond", serif;
  touch-action: none;
}

body.library.is-dragging {
  cursor: grabbing;
}

body.library.is-reading {
  cursor: default;
}

.lib-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 1.15rem 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}

.lib-back {
  grid-column: 1;
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0;
  color: #111;
  text-decoration: none;
  font-family: Cinzel, serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.lib-back:hover {
  text-decoration: underline;
}

.lib-today {
  grid-column: 3;
  justify-self: end;
  appearance: none;
  background: none;
  border: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0;
  color: #650707;
  font-family: Cinzel, serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
}

.lib-today:hover {
  text-decoration: underline;
}

.lib-name {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-family: Cinzel, serif;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  pointer-events: none;
}

.lib-lamp {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(circle closest-side, rgb(0, 0, 0), #ffffff);
  opacity: 0.16;
}

.lib-stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  background: transparent;
}

.lattice {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hex {
  position: absolute;
  width: var(--hex-w, 176px);
  height: var(--hex-h, 152px);
  padding: 0;
  box-sizing: border-box;
  border: 0;
  margin: 0;
  color: #111;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  background: none;
  overflow: visible;
}

.hex__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.hex__shape polygon {
  fill: #fff;
  stroke: #111;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.hex:hover,
.hex:focus-visible {
  z-index: 3;
  outline: none;
  color: #fff;
}

.hex:hover .hex__shape polygon,
.hex:focus-visible .hex__shape polygon {
  fill: #111;
}

.hex.is-active,
.hex.is-active:hover {
  z-index: 5;
  color: #fff;
}

.hex.is-active .hex__shape polygon,
.hex.is-active:hover .hex__shape polygon {
  fill: #111;
  stroke: #111;
}

.hex.is-dim {
  opacity: 0.16 !important;
}

.hex.is-today .hex__shape polygon {
  stroke: #650707;
  stroke-width: 2;
}

.hex.is-today .hex__n {
  opacity: 0.85;
  letter-spacing: 0.2em;
}

.hex.is-today:hover .hex__shape polygon,
.hex.is-today:focus-visible .hex__shape polygon,
.hex.is-today.is-active .hex__shape polygon,
.hex.is-today.is-active:hover .hex__shape polygon {
  fill: #650707;
  stroke: #650707;
}

.hex__content {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 18%;
  bottom: 18%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
}

.hex__n {
  display: block;
  font-family: Cinzel, serif;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  opacity: 0.42;
  margin-bottom: 0.25rem;
}

.hex.is-active .hex__n,
.hex:hover .hex__n {
  opacity: 0.75;
}

.hex__text {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.72rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


.volume {
  position: fixed;
  left: 50%;
  bottom: max(3.4rem, calc(env(safe-area-inset-bottom) + 2.6rem));
  transform: translateX(-50%);
  z-index: 8;
  width: min(38rem, calc(100% - 2rem));
  max-height: min(58vh, 28rem);
  overflow: auto;
  padding: 1.7rem 1.9rem 1.4rem;
  background: #fff;
  border: 1px solid #111;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

.volume[hidden],
.leaf[hidden] {
  display: none;
}

.leaf {
  position: fixed;
  left: 50%;
  bottom: max(3.4rem, calc(env(safe-area-inset-bottom) + 2.6rem));
  transform: translateX(-50%);
  z-index: 8;
  width: min(38rem, calc(100% - 2rem));
  max-height: min(70vh, 34rem);
  overflow: auto;
  padding: 2rem 2.1rem 1.5rem;
  background: #fff;
  border: 1px solid #111;
  border-top: 2px solid #650707;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

.leaf__kicker {
  font-family: Cinzel, serif;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #650707;
  margin: 0 0 0.35rem;
}

.leaf__date {
  font-family: Cinzel, serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #111;
  opacity: 0.42;
  margin: 0 0 1.35rem;
}

.leaf__text {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.35rem, 2.7vw, 1.95rem);
  line-height: 1.4;
  margin: 0;
}

.leaf__close {
  margin-top: 1.35rem;
  appearance: none;
  background: none;
  border: 0;
  padding: 0.4rem 0.2rem;
  min-height: 44px;
  color: #111;
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
}

.leaf__close:hover {
  text-decoration: underline;
}

.volume__text {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.4;
  margin: 0;
}

.volume__close {
  margin-top: 1rem;
  appearance: none;
  background: none;
  border: 0;
  padding: 0.4rem 0.2rem;
  min-height: 44px;
  color: #111;
  font-family: Cinzel, serif;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
}

.volume__close:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .lib-top {
    padding: max(0.7rem, env(safe-area-inset-top)) 0.9rem 0.7rem;
  }

  .lib-name {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
  }

  .lib-back,
  .lib-today {
    font-size: 0.64rem;
    letter-spacing: 0.2em;
  }

  .hex__n {
    font-size: 0.7rem;
  }

  .hex__text {
    font-size: 0.92rem;
    -webkit-line-clamp: 6;
  }

  .volume {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: auto;
    max-height: 62vh;
    padding: 1.4rem 1.2rem max(1.4rem, env(safe-area-inset-bottom));
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .leaf {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: auto;
    max-height: 72vh;
    padding: 1.7rem 1.25rem max(1.4rem, env(safe-area-inset-bottom));
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .volume__text {
    font-size: 1.28rem;
  }

  .leaf__text {
    font-size: 1.38rem;
  }
}
