:root {
  --ink: #21443a;
  --ink-soft: #4c6b60;
  --pine: #1f5c4a;
  --spruce: #16322b;
  --mist: #e6efe9;
  --line: #b9cfc3;
  --gutter: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Jost", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px var(--gutter);
}

.bar nav { display: flex; align-items: center; gap: 20px; }

.name {
  font-family: "Marcellus SC", serif;
  font-size: 17px;
  letter-spacing: 0.04em;
}

.main-site { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.main-site svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.narrow { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* Home */

.home { position: relative; min-height: 100dvh; }

.home .bar, .shelf { position: relative; }

.home .name { display: flex; align-items: center; gap: 10px; }

.logo { display: block; width: auto; height: 56px; }

.water {
  position: fixed;
  inset: auto 0 0;
  height: 50dvh;
  background: url("/img/wash-water.jpg") center bottom / cover no-repeat;
  mask-image: linear-gradient(transparent, #000 58%);
}

.shelf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 16px var(--gutter) 32px;
}

.report { display: block; text-align: center; }

.report img {
  display: block;
  width: auto;
  height: min(72dvh, 620px);
  box-shadow: 0 14px 28px rgb(23 60 48 / 0.36);
  transition: transform 0.2s ease;
}

.previous { width: 100%; }

.previous h2 {
  margin: 0 0 24px;
  font: 400 20px/1.2 "Marcellus SC", serif;
  letter-spacing: 0.03em;
  text-align: center;
}

.previous-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}

.previous .report img { height: min(40dvh, 300px); }

.report:hover img { transform: translateY(-4px); }

.report span { display: block; margin-top: 12px; font-size: 17px; }

/* Reader */

.reader {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
  color: var(--mist);
  background: var(--spruce) url("/img/wash-deep.jpg") center / cover;
}

.reader .bar, .foot { position: relative; z-index: 2; }
.reader .bar { padding-block: 8px 12px; }

.stage {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  min-height: 0;
}

.arrow { justify-self: center; }
.arrow:disabled { visibility: hidden; }

.frame {
  display: grid;
  place-items: center;
  height: 100%;
  min-width: 0;
  cursor: pointer;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#book { position: relative; width: var(--page-width); height: var(--page-height); }
#book.spreads { width: calc(var(--page-width) * 2); }

.slot {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--page-width);
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.slot[hidden] { display: none; }
.slot.left { right: auto; left: 0; }
.slot img { display: block; width: 100%; height: 100%; }
.slot img[hidden] { display: none; }

/* Where the pages meet at the spine. */
.open .slot::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7%;
  pointer-events: none;
}

.open .slot.left::after { right: 0; background: linear-gradient(90deg, transparent, rgb(0 0 0 / 0.14)); }
.open .slot.right::after { left: 0; background: linear-gradient(270deg, transparent, rgb(0 0 0 / 0.14)); }

/* The turning sheet: two faces, each a chain of strips. reader.js sets their angles. */
.flipper {
  position: absolute;
  inset: 0;
  pointer-events: none;
  perspective: var(--perspective);
}

.face {
  position: absolute;
  top: 0;
  width: var(--page-width);
  height: 100%;
  transform-style: preserve-3d;
}

.face.front { left: 0; transform-origin: left center; }
.face.back { left: calc(var(--page-width) * -1); transform-origin: right center; }
.spreads .face.front { left: 50%; }
.spreads .face.back { left: 0; }

.strip {
  position: absolute;
  top: 0;
  width: calc(var(--page-width) / 10 + 1px);
  height: 100%;
  transform-style: preserve-3d;
}

.skin {
  position: absolute;
  inset: 0;
  background: #fff 0 0 / var(--page-width) var(--page-height) no-repeat;
}

.face.front .strip { left: 0; transform-origin: left center; }
.face.front .strip .strip { left: calc(var(--page-width) / 10); }
.face.back .strip { right: 0; transform-origin: right center; }
.face.back .strip .strip { right: calc(var(--page-width) / 10); }

.foot { padding: 14px var(--gutter); text-align: center; }
.foot p { margin: 0; }

dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  overflow: auto;
  border: 0;
  background: #0f231e;
}

#zoom-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 8px 14px;
  font: inherit;
  color: var(--spruce);
  background: var(--mist);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

#zoom-pages { display: flex; justify-content: safe center; width: max-content; min-width: 100%; }
#zoom-pages img { display: block; width: min(1000px, 170vw); height: auto; }

/* Upload */

.admin main { max-width: 460px; margin: 0 auto; padding: 40px var(--gutter); }

.admin h1, .admin h2 {
  margin: 0 0 22px;
  font: 400 26px/1.2 "Marcellus SC", serif;
  letter-spacing: 0.03em;
}

.admin h2 { margin: 36px 0 12px; font-size: 20px; }

.admin label { display: block; margin-bottom: 6px; font-weight: 500; }

.admin input {
  display: block;
  width: 100%;
  padding: 10px;
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.hint { min-height: 1.4em; margin: 6px 0 14px; font-size: 14px; color: var(--ink-soft); }

.admin form button, .admin li button {
  font: inherit;
  cursor: pointer;
  border-radius: 3px;
}

.admin form button {
  padding: 10px 20px;
  font-weight: 500;
  color: #fff;
  background: var(--pine);
  border: 0;
}

.admin form button:disabled { opacity: 0.45; cursor: default; }

.status { min-height: 1.4em; margin-top: 16px; }
.status a { text-decoration: underline; }

.admin ul { margin: 0; padding: 0; list-style: none; }

.admin li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.admin li a { margin-right: auto; font-size: 17px; text-decoration: underline; text-underline-offset: 3px; }

.admin li button {
  padding: 5px 11px;
  color: var(--ink);
  background: none;
  border: 1px solid var(--line);
}

@media (max-width: 767px) {
  :root { --gutter: 14px; }
  .wide { display: none; }
  .narrow { display: inline; }
  .foot .main-site { display: inline-flex; }
  .bar { gap: 8px; }
  .bar nav { gap: 6px; }
  .name { font-size: 14.5px; letter-spacing: 0.02em; white-space: nowrap; }
  .home .name { gap: 6px; }
  .logo { height: 44px; }
  .report img { height: min(66dvh, 120vw); }
  .previous-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .previous .report img { width: 100%; height: auto; }
  .stage { grid-template-columns: minmax(0, 1fr); padding-inline: 12px; }
  .arrow { display: none; }
  .foot { display: flex; justify-content: space-between; }
}

@media (max-width: 340px) {
  .name { font-size: 13.5px; letter-spacing: 0; }
  .main-site svg { display: none; }
}

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