/*
 * Sergey Photographic Journal.
 * One stylesheet, in this order: base reset, design tokens, album, viewer and card, notes, studio, small-screen and reduced-motion rules.
 */

/* base reset */
body {
  margin: 0;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}

/* Layout: a dark desk with one cloth-bound album on it. Pages are 4:5 boxes: two as a spread on wide screens, one on phones. */
:root {
  color-scheme: dark;
  --desk: #131412;
  --desk-ink: #d9d3c4;
  --desk-ink-soft: #989283;
  --cloth: #1d2723;
  --cloth-hi: #2c3a33;
  --paper: #efe9dc;
  --paper-shade: #e0d8c7;
  --ink: #25221d;
  --ink-soft: #5f584c;
  --accent: #7a2e2a;
  --card: #f3ecd8;
  --card-ink: #2b2823;
  --card-rule: #cfc5ab;
  --edge: rgba(20, 16, 10, 0.24);
  --gutter: rgba(40, 30, 15, 0.22);
  --stripe: rgba(40, 30, 15, 0.09);
  --serif: "Old Standard TT", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --typed: "Courier Prime", "Courier New", Courier, monospace;
  --card-accent: #7a2e2a;
  --focus: #e7b9a5;
  --bench: #191c1a;
  --bench-hi: #222725;
  --line: rgba(217, 211, 196, 0.14);
  --line-strong: rgba(217, 211, 196, 0.34);
  --ok: #a3c29f;
  --warn: #dcb774;
  --bad: #e09a8f;
  --pw: 480px;
  --t-small: 150ms;
  --t-turn: 300ms;
  --t-lift: 420ms;
}
:root[data-paper="black"] {
  --paper: #1b1a19;
  --paper-shade: #272523;
  --ink: #e9e3d5;
  --ink-soft: #a59e8e;
  --accent: #cf8a82;
  --edge: rgba(255, 255, 255, 0.12);
  --gutter: rgba(0, 0, 0, 0.55);
  --stripe: rgba(255, 255, 255, 0.05);
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--desk);
  color: var(--desk-ink);
  font-family: var(--serif);
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
label,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#app :focus-visible,
#viewer :focus-visible,
#psheet :focus-visible {
  outline-color: var(--focus);
}
.leaf :focus-visible {
  outline-color: var(--accent);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* One clipped screen contains every view, including modal sheets. Only the
   viewport controller changes its bounds; photo transforms cannot scroll it. */
#viewport {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow: clip;
  contain: layout paint;
}
#app {
  height: 100%;
  padding: var(--safe-top) max(16px, var(--safe-right)) var(--safe-bottom) max(16px, var(--safe-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  transition:
    transform var(--t-turn) ease,
    filter var(--t-turn) ease;
  transform-origin: 50% 50%;
}
#app.receded {
  transform: translateY(8px) scale(0.985);
}

/* top and bottom rails */
.bar,
.foot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-family: var(--typed);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--desk-ink-soft);
}
.bar {
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
}
.bar .left,
.bar .right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 0;
}
.bar .right {
  justify-content: flex-end;
}
.bar .where {
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--desk-ink);
}
.rail-btn {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--desk-ink-soft);
  white-space: nowrap;
}
.rail-btn:hover {
  color: var(--desk-ink);
}
.rail-btn[aria-pressed="true"] {
  color: var(--desk-ink);
  text-decoration: underline;
  text-underline-offset: 5px;
}
.rail-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.journal-tag {
  color: var(--desk-ink-soft);
  opacity: 0.75;
}
.foot {
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding-top: 4px;
}
.page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 580px;
  min-height: 48px;
}
.reader-help {
  margin: 2px 0 5px;
  color: var(--desk-ink);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: center;
}
.foot .pos {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  color: var(--desk-ink);
  font-variant-numeric: tabular-nums;
}
.foot .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-size: 24px;
  line-height: 1;
  color: var(--desk-ink);
}
.foot .arrow .nav-label {
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: none;
}
.foot .arrow:hover:not(:disabled) {
  border-color: var(--desk-ink);
}
.foot .arrow:disabled {
  opacity: 0.25;
  cursor: default;
}
.foot .open {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--desk-ink-soft);
  color: var(--desk-ink);
  letter-spacing: 0.14em;
}
.foot .open:hover {
  border-color: var(--desk-ink);
}

/* the album */
#stage {
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}
#book {
  position: relative;
  width: calc(var(--pw) * var(--leaves, 1));
  height: calc(var(--pw) * 1.25);
  perspective: calc(var(--pw) * 5);
  touch-action: pan-y;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
#book .board {
  position: absolute;
  inset: -7px;
  background: var(--cloth);
  border-radius: 3px;
  box-shadow:
    0 30px 50px -22px rgba(0, 0, 0, 0.8),
    0 2px 0 rgba(255, 255, 255, 0.04) inset;
  transition: opacity var(--t-turn);
}
#book .stack {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 5px;
  background: repeating-linear-gradient(90deg, var(--paper) 0 1px, var(--paper-shade) 1px 2px);
  opacity: 0.9;
  transition: opacity var(--t-turn);
}
#book .stack.l {
  left: -5px;
}
#book .stack.r {
  right: -5px;
}
#book[data-view="cover"] .board,
#book[data-view="cover"] .stack,
#book[data-view="cover"] .edge {
  opacity: 0;
  pointer-events: none;
}
#book[data-wide="0"] .stack.l {
  display: none;
}
#sheets {
  position: absolute;
  inset: 0;
}
.sheet {
  position: absolute;
  inset: 0;
  display: flex;
  perspective: calc(var(--pw) * 5);
}
.leaf {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  font-size: clamp(13.5px, calc(var(--pw) / 33), 19px);
  transform-origin: var(--hinge, 0%) 50%;
  overflow: hidden;
}
.leaf.left {
  --hinge: 100%;
}
.leaf.right {
  --hinge: 0%;
}
.leaf::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 11%;
  pointer-events: none;
}
.leaf.left::after {
  right: 0;
  background: linear-gradient(90deg, transparent, var(--gutter));
}
.leaf.right::after {
  left: 0;
  background: linear-gradient(270deg, transparent, var(--gutter));
}
.leaf.single::after {
  left: 0;
  width: 5%;
  background: linear-gradient(270deg, transparent, var(--gutter));
  opacity: 0.6;
}
.edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5%;
  z-index: 3;
}
.edge.l {
  left: 0;
  cursor: w-resize;
}
.edge.r {
  right: 0;
  cursor: e-resize;
}
.edge:disabled {
  cursor: default;
}

/* prints on a page */
.chapter-heading {
  position: absolute;
  top: 4%;
  left: 8%;
  right: 8%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chapter-heading h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(17px, calc(var(--pw) / 23), 28px);
  font-weight: 400;
  line-height: 1.15;
}
.chapter-heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-family: var(--typed);
  font-size: clamp(10px, calc(var(--pw) / 45), 12px);
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.s-mini-heading {
  position: absolute;
  top: 4%;
  left: 8%;
  right: 8%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.2;
}
.print {
  position: absolute;
  display: block;
  background: var(--paper-shade);
  box-shadow:
    0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 10px 16px -12px rgba(0, 0, 0, 0.5);
  transition:
    transform var(--t-small) ease,
    box-shadow var(--t-small) ease;
  cursor: zoom-in;
}
.print img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  -webkit-user-drag: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-small);
}
.print img.in {
  opacity: 1;
}
@media (hover: hover) {
  .print:hover {
    transform: translateY(-2px);
    box-shadow:
      0 0 0 1px var(--edge),
      0 2px 3px rgba(0, 0, 0, 0.3),
      0 16px 20px -12px rgba(0, 0, 0, 0.55);
  }
}
.print.lifted {
  box-shadow: 0 0 0 1px var(--edge) inset;
  transform: none;
}
.print.lifted img {
  visibility: hidden;
}
.folio {
  position: absolute;
  bottom: 3.2%;
  font-family: var(--typed);
  font-size: max(0.72em, 10.5px);
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}
.leaf.left .folio {
  left: 7%;
}
.leaf.right .folio {
  right: 7%;
}
.leaf.single .folio {
  left: 0;
  right: 0;
  text-align: center;
}
.plate-cap {
  position: absolute;
  left: 9%;
  right: 9%;
  font-family: var(--typed);
  font-size: max(0.74em, 11px);
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-align: center;
}

/* text pages */
.textpage {
  position: absolute;
  inset: 0;
  padding: 13% 12% 10% 11%;
  display: flex;
  flex-direction: column;
  gap: 1.1em;
}
.leaf.right .textpage {
  padding: 13% 11% 10% 12%;
}
.eyebrow {
  font-family: var(--typed);
  font-size: max(0.74em, 11px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.textpage h1,
.textpage h2 {
  margin: 0;
  font-weight: 400;
  font-size: 2.5em;
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.textpage .dates {
  font-family: var(--typed);
  font-size: max(0.78em, 11px);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.textpage p {
  margin: 0;
  font-size: 1.08em;
  line-height: 1.5;
  max-width: 34em;
}
.textpage .tail {
  margin-top: auto;
  font-family: var(--typed);
  font-size: max(0.74em, 11px);
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.rule {
  width: 2.2em;
  height: 1px;
  background: var(--ink-soft);
  opacity: 0.6;
}

/* contents */
.tocpage {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.tocpage > * {
  flex: none;
}
.toc {
  list-style: none;
  margin: 0.4em 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.toc li {
  border-top: 1px solid var(--edge);
}
.toc li:last-child {
  border-bottom: 1px solid var(--edge);
}
.toc button {
  display: grid;
  grid-template-columns: 1.8em 27% minmax(0, 1fr);
  align-items: center;
  gap: 0.9em;
  width: 100%;
  padding: 0.8em 0;
  text-align: left;
  color: var(--ink);
}
.toc .num {
  font-family: var(--typed);
  font-size: max(0.78em, 11px);
  color: var(--accent);
  letter-spacing: 0.06em;
}
.toc .thumb {
  display: block;
  box-shadow:
    0 0 0 1px var(--edge),
    0 6px 10px -8px rgba(0, 0, 0, 0.5);
  background: var(--paper-shade);
}
.toc .thumb img {
  display: block;
  width: 100%;
  height: auto;
}
.toc .name {
  display: block;
  font-size: 1.45em;
  line-height: 1.1;
}
.toc .meta + .meta {
  margin-top: 0.2em;
}
.toc .meta {
  display: block;
  margin-top: 0.45em;
  line-height: 1.2;
  font-family: var(--typed);
  font-size: max(0.7em, 11px);
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
@media (hover: hover) {
  .toc button:hover .name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
  }
}

/* endpaper with bookplate */
.endpaper {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg, transparent 0 13px, var(--stripe) 13px 14px);
}
.bookplate {
  width: 62%;
  padding: 1.5em 1.3em;
  background: var(--card);
  color: var(--card-ink);
  box-shadow:
    0 0 0 1px var(--card-rule),
    0 0 0 5px var(--card),
    0 0 0 6px var(--card-rule),
    0 12px 18px -14px rgba(0, 0, 0, 0.6);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  align-items: center;
}
.bookplate .bp-k {
  font-family: var(--typed);
  font-size: max(0.66em, 10.5px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.bookplate .bp-n {
  font-size: 2.1em;
  line-height: 1;
  font-style: italic;
}
.bookplate .bp-t {
  font-family: var(--typed);
  font-size: max(0.72em, 11px);
  line-height: 1.55;
}
.bookplate .rule {
  background: var(--card-ink);
}

/* end page */
.endpage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3em;
  padding: 12%;
  text-align: center;
}
.endmark {
  width: 0.55em;
  height: 0.55em;
  background: var(--accent);
  transform: rotate(45deg);
}
.endpage .t {
  font-size: 1.7em;
  font-style: italic;
  line-height: 1.1;
}
.endpage .k {
  font-family: var(--typed);
  font-size: max(0.72em, 11px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.endpage .go {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  align-items: center;
  margin-top: 0.6em;
}
.linkbtn {
  min-height: 44px;
  padding: 0 0.6em;
  font-family: var(--typed);
  font-size: max(0.8em, 12px);
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.linkbtn:hover {
  color: var(--accent);
}

/* closed cover */
.cover {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: var(--pw);
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transform-origin: 0% 50%;
  z-index: 5;
  display: block;
  cursor: pointer;
}
.cover .face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 2px 4px 4px 2px;
  overflow: hidden;
}
.cover .front {
  background-color: var(--cloth);
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.45) 0,
      rgba(0, 0, 0, 0.1) 5.5%,
      rgba(255, 255, 255, 0.07) 6.6%,
      rgba(0, 0, 0, 0.28) 7.6%,
      transparent 10%
    ),
    var(--weave);
  box-shadow:
    0 34px 54px -24px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7%;
  padding: 12% 12% 12% 16%;
  font-size: clamp(12.5px, calc(var(--pw) / 33), 19px);
}
.cover .front::before {
  content: "";
  position: absolute;
  inset: 5.5% 5.5% 5.5% 12.5%;
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.07) inset;
  pointer-events: none;
}
.cover .tipped {
  position: relative;
  width: 74%;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 0 0.5em var(--cloth-hi),
    0 0 0 calc(0.5em + 1px) rgba(0, 0, 0, 0.45),
    0 1px 0 calc(0.5em + 1px) rgba(255, 255, 255, 0.06);
}
.cover .tipped img {
  display: block;
  width: 100%;
  height: auto;
}
.cover .label {
  position: relative;
  background: var(--card);
  color: var(--card-ink);
  padding: 0.85em 1.3em 0.75em;
  text-align: center;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 0 0 1px var(--card-rule) inset,
    0 0 0 4px var(--card) inset,
    0 0 0 5px var(--card-rule) inset;
}
.cover .label .n {
  display: block;
  font-size: 1.9em;
  line-height: 1;
  font-style: italic;
}
.cover .label .k {
  display: block;
  margin-top: 0.6em;
  font-family: var(--typed);
  font-size: max(0.66em, 10px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cover .label .v {
  display: block;
  margin-top: 0.4em;
  font-family: var(--typed);
  font-size: max(0.62em, 10px);
  letter-spacing: 0.12em;
  color: var(--accent);
}
.cover .back {
  transform: rotateY(180deg);
  background-color: var(--paper);
  background-image: var(--grain);
  font-size: clamp(12.5px, calc(var(--pw) / 33), 19px);
  color: var(--ink);
}

/* photograph view */
#viewer {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  overflow: clip;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#viewer .shade {
  position: absolute;
  inset: 0;
  background: var(--cloth);
  background-image: radial-gradient(120% 90% at 50% 40%, transparent 30%, rgba(0, 0, 0, 0.55)), var(--weave);
  opacity: 0;
}
#frame {
  position: absolute;
  z-index: 2;
  transform-origin: 50% 50%;
  will-change: transform;
}
#frame.smooth {
  transition:
    left var(--t-turn) ease,
    top var(--t-turn) ease,
    width var(--t-turn) ease,
    height var(--t-turn) ease;
}
#frame img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 30px 60px -20px rgba(0, 0, 0, 0.85);
  transform-origin: 50% 50%;
  cursor: zoom-in;
  -webkit-user-drag: none;
}
#frame img.ease {
  transition: transform 220ms ease;
}
#viewer.zoomed #frame img {
  cursor: grab;
}
#viewer.zoomed.dragging #frame img {
  cursor: grabbing;
}
#viewer.nozoom #frame img {
  cursor: default;
}
#tab {
  position: absolute;
  z-index: 1;
  top: 100%;
  right: 9%;
  min-height: 44px;
  padding: 0 0 10px;
  display: flex;
  align-items: flex-start;
  transition:
    opacity var(--t-small),
    transform var(--t-small);
}
#tab span {
  display: block;
  background: var(--card);
  color: var(--card-ink);
  font-family: var(--typed);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 12px 6px;
  border-radius: 0 0 3px 3px;
  box-shadow:
    0 0 0 1px var(--card-rule) inset,
    0 6px 10px -6px rgba(0, 0, 0, 0.7);
}
#tab:hover span {
  padding-top: 10px;
}
#viewer.zoomed #tab {
  opacity: 0;
  pointer-events: none;
}
.vbtn {
  position: absolute;
  z-index: 4;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  color: var(--desk-ink);
  font-family: var(--typed);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: opacity var(--t-turn);
}
.vbtn:disabled {
  opacity: 0.2;
  cursor: default;
}
#vClose {
  top: calc(8px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--cloth);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: none;
}
#vClose span:first-child {
  font-size: 24px;
}
#vPrev,
#vNext {
  top: 50%;
  margin-top: -28px;
  width: 56px;
  height: 56px;
  font-size: 26px;
}
#vPrev {
  left: 6px;
}
#vNext {
  right: 6px;
}
#vCount {
  top: calc(8px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  cursor: default;
  pointer-events: none;
  color: var(--desk-ink-soft);
}
#vZoom {
  bottom: calc(12px + var(--safe-bottom));
  left: calc(12px + var(--safe-left));
  padding: 0 12px;
  border: 1px solid rgba(217, 211, 196, 0.25);
  min-height: 44px;
  margin: 0;
}
#viewer.idle .vbtn {
  opacity: 0.28;
}
#viewer.idle #vClose {
  opacity: 1;
}
#viewer.nozoom #vZoom {
  display: none;
}

/* the library card */
#card {
  position: absolute;
  z-index: 1;
  background: var(--card);
  color: var(--card-ink);
  font-family: var(--typed);
  font-size: 13px;
  line-height: 1.5;
  box-shadow:
    0 0 0 1px var(--card-rule),
    0 24px 40px -18px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--t-turn) ease,
    opacity var(--t-turn) ease;
  right: 76px;
  top: 50%;
  width: 310px;
  max-height: calc(100% - 48px);
  overflow: auto;
  transform: translate(-55%, -50%) rotate(-1.5deg);
  user-select: text;
  -webkit-user-select: text;
  touch-action: pan-y;
}
#viewer.card-open #card {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%);
}
.card-in {
  padding: 16px 20px 12px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--card-accent);
}
.card-title {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 23px;
  line-height: 1.15;
  text-wrap: balance;
}
.card-desc {
  margin: 8px 0 0;
}
#card dl {
  margin: 14px 0 0;
  padding: 0;
}
#card dl div {
  display: grid;
  grid-template-columns: 6.4em minmax(0, 1fr);
  gap: 8px;
  padding: 5px 0 4px;
  border-top: 1px solid var(--card-rule);
}
#card dl div:last-child {
  border-bottom: 1px solid var(--card-rule);
}
#card dt {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-top: 2px;
  opacity: 0.75;
}
#card dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.card-note {
  margin: 10px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
#cardClose {
  display: block;
  margin: 6px 0 0 -8px;
  min-height: 44px;
  padding: 0 8px;
  font-family: var(--typed);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
#card :focus-visible {
  outline-color: var(--card-accent);
}

/* notes: a sheet of writing paper pasted onto the album page */
.n-sheet {
  position: absolute;
  top: 5.5%;
  bottom: 6.5%;
  left: 6%;
  right: 7.5%;
  background: var(--card);
  color: var(--card-ink);
  box-shadow:
    0 0 0 1px var(--card-rule),
    0 1px 2px rgba(0, 0, 0, 0.25),
    0 14px 20px -16px rgba(0, 0, 0, 0.6);
  padding: 8% 8.5% 6.5%;
  display: flex;
  flex-direction: column;
  gap: 1.1em;
}
.leaf.right .n-sheet {
  left: 7.5%;
  right: 6%;
}
.leaf.single .n-sheet {
  top: 4.5%;
  bottom: 5.5%;
  left: 5.5%;
  right: 5.5%;
}
.n-head {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  padding-bottom: 1em;
  border-bottom: 2px solid var(--card-accent);
  flex: none;
}
.n-date {
  font-family: var(--typed);
  font-size: max(0.72em, 11px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.n-head h1 {
  margin: 0;
  font-weight: 400;
  font-style: italic;
  font-size: 2em;
  line-height: 1.08;
  text-wrap: balance;
}
.n-run {
  font-family: var(--typed);
  font-size: max(0.7em, 10.5px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
  padding-bottom: 0.8em;
  border-bottom: 1px solid var(--card-rule);
  flex: none;
}
.n-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  font-size: 1.04em;
  line-height: 1.5;
}
.n-body p {
  margin: 0;
}
.n-body p + p {
  text-indent: 1.4em;
}
.nlist {
  list-style: none;
  margin: 0.4em 0 0;
  padding: 0;
}
.nlist li {
  border-top: 1px solid var(--edge);
}
.nlist li:last-child {
  border-bottom: 1px solid var(--edge);
}
.nlist button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85em 0;
  color: var(--ink);
}
.nlist .d {
  display: block;
  font-family: var(--typed);
  font-size: max(0.7em, 11px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.nlist .name {
  display: block;
  margin-top: 0.35em;
  font-size: 1.45em;
  line-height: 1.1;
  font-style: italic;
}
.nlist .ex {
  margin-top: 0.45em;
  font-size: 0.95em;
  line-height: 1.4;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (hover: hover) {
  .nlist button:hover .name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
  }
}
.latest {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1em;
  padding: 12%;
  text-align: center;
}
.latest .ph {
  display: block;
  width: 80%;
  background: var(--paper-shade);
  box-shadow:
    0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 10px 16px -12px rgba(0, 0, 0, 0.5);
}
.latest .ph img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.latest .t {
  font-size: 1.7em;
  font-style: italic;
  line-height: 1.1;
  text-wrap: balance;
}
.textpage .links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: auto;
}
.textpage .links .linkbtn {
  padding-left: 0;
  text-align: left;
}
.textpage .links + .tail {
  margin-top: 0;
}
.s-rowbtn.note {
  grid-template-columns: minmax(0, 1fr) auto;
}
.s-field select {
  font-family: var(--serif);
  font-size: 18px;
  min-height: 50px;
  color: var(--desk-ink);
  background: var(--bench);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0 10px;
  width: 100%;
  margin: 0;
}
.s-tile[aria-pressed="false"] img {
  opacity: 0.4;
}

/* studio: the owner side. A plain workbench on the desk, sized for a thumb. */
#studio {
  align-self: stretch;
  justify-self: center;
  width: min(100%, 760px);
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-block: 4px 48px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  color: var(--desk-ink);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.s-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.s-head h1 {
  margin: 0;
  font-weight: 400;
  font-size: 34px;
  line-height: 1.05;
}
.s-note,
.s-meta,
.s-msg {
  font-family: var(--typed);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--desk-ink-soft);
  margin: 0;
}
.s-msg {
  color: var(--warn);
}
.s-msg:empty {
  display: none;
}
.s-primary,
.s-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  font-family: var(--typed);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  flex: none;
}
.s-primary,
.s-btn.solid {
  background: var(--card);
  color: var(--card-ink);
}
.s-btn {
  border: 1px solid var(--line-strong);
  color: var(--desk-ink);
}
.s-btn.solid {
  border-color: var(--card);
}
label.s-primary:focus-within,
label.s-btn:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.s-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.s-list li {
  border-bottom: 1px solid var(--line);
}
.s-rowbtn {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 12px 0;
  text-align: left;
}
.s-thumb {
  display: block;
  aspect-ratio: 3/2;
  background: var(--bench);
}
.s-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.s-rowtitle {
  display: block;
  font-size: 21px;
  line-height: 1.15;
}
.s-rowtext {
  min-width: 0;
}
.s-rowtext .s-meta {
  display: block;
  margin-top: 4px;
}
.s-go {
  font-size: 22px;
  color: var(--desk-ink-soft);
  padding: 0 6px;
}
.s-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.s-link {
  min-height: 44px;
  font-family: var(--typed);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--desk-ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}
.s-chip {
  font-family: var(--typed);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  color: var(--desk-ink-soft);
}
.s-chip.published {
  color: var(--ok);
  border-color: var(--ok);
}
.s-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: none;
}
.s-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: none;
}
.s-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.s-field label {
  font-family: var(--typed);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--desk-ink-soft);
}
.s-field input,
.s-field textarea {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  color: var(--desk-ink);
  background: var(--bench);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 11px 12px;
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}
.s-field textarea {
  resize: vertical;
  min-height: 92px;
  display: block;
}
.s-sec {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--line);
  flex: none;
}
.s-sechead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}
.s-sechead h2 {
  margin: 0;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
}
.s-seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.s-segbtn {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  font-family: var(--typed);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--desk-ink-soft);
}
.s-segbtn[aria-pressed="true"] {
  background: var(--desk-ink);
  color: var(--desk);
  border-color: var(--desk-ink);
}
.s-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.s-tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--bench);
  display: block;
  overflow: hidden;
}
.s-tile img {
  position: absolute;
  left: 6px;
  top: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  max-width: none;
  object-fit: contain;
}
.s-tile.out img {
  opacity: 0.3;
}
.s-n {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 22px;
  padding: 2px 5px;
  background: var(--desk);
  color: var(--desk-ink);
  font-family: var(--typed);
  font-size: 11.5px;
  text-align: center;
}
.s-flag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 4px;
  background: var(--card);
  color: var(--card-ink);
  font-family: var(--typed);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}
.s-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 12px;
}
.s-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.s-mini {
  position: relative;
  aspect-ratio: 4/5;
  background-color: var(--paper);
  background-image: var(--grain);
  box-shadow: 0 0 0 1px var(--line);
}
.s-mini img {
  position: absolute;
  display: block;
  max-width: none;
  box-shadow: 0 0 0 1px var(--edge);
}
.s-pagecap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--typed);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.s-ops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.s-op {
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  font-family: var(--typed);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--desk-ink);
}
.s-op:disabled {
  opacity: 0.3;
  cursor: default;
}
.s-op[aria-pressed="true"] {
  background: var(--desk-ink);
  color: var(--desk);
  border-color: var(--desk-ink);
}
.s-op.danger {
  color: var(--bad);
  border-color: var(--bad);
}
.s-batch {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bench);
  border: 1px solid var(--line);
  flex: none;
}
.s-batchhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  font-family: var(--typed);
  font-size: 13px;
}
.s-batchhead strong {
  font-weight: 700;
  padding: 6px 0;
}
.s-bar {
  height: 3px;
  background: var(--line);
}
.s-bar i {
  display: block;
  height: 100%;
  background: var(--card);
  transition: width 0.2s;
}
.s-files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--typed);
  font-size: 12.5px;
}
.s-files li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
}
.s-files .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-files .st {
  color: var(--desk-ink-soft);
}
.s-files .st.ready {
  color: var(--ok);
}
.s-files .st.skip {
  color: var(--warn);
}
.s-files .st.failed {
  color: var(--bad);
}
.s-files .why {
  grid-column: 1 / -1;
  color: var(--bad);
  line-height: 1.4;
}

/* one photograph, managed in a sheet that rises from the bottom */
#psheet {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.p-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.p-panel {
  position: relative;
  width: min(100%, 560px);
  max-height: 92%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bench-hi);
  color: var(--desk-ink);
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.6);
}
.p-panel > * {
  flex: none;
}
.p-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bench-hi);
  padding-top: 6px;
  font-family: var(--typed);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.p-head strong {
  font-weight: 400;
}
.p-x {
  width: 44px;
  height: 44px;
  font-size: 26px;
  line-height: 1;
}
.p-img {
  display: block;
  align-self: center;
  max-width: 100%;
  max-height: 32vh;
  width: auto;
  height: auto;
  box-shadow: 0 0 0 1px var(--line);
}
.p-row {
  display: grid;
  gap: 8px;
}
.p-row.two {
  grid-template-columns: 1fr 1fr;
}
.p-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}
.p-h {
  margin: 8px 0 0;
  font-weight: 400;
  font-size: 21px;
  line-height: 1.15;
}
.p-dl {
  margin: 0;
  font-family: var(--typed);
  font-size: 12.5px;
  line-height: 1.45;
  border-bottom: 1px solid var(--line);
}
.p-dl div {
  display: grid;
  grid-template-columns: 8.2em minmax(0, 1fr);
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.p-dl dt {
  color: var(--desk-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  padding-top: 1px;
}
.p-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.p-dl dd.none {
  color: var(--desk-ink-soft);
}
.p-raw summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-family: var(--typed);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
@media (min-width: 700px) {
  #psheet {
    align-items: center;
  }
  .p-panel {
    max-height: 88%;
  }
}
@media (max-width: 480px) {
  .page-nav {
    gap: 8px;
  }
  .foot .arrow {
    gap: 5px;
    padding-inline: 8px;
  }
  .foot .pos {
    font-size: 11px;
    letter-spacing: 0.01em;
  }
  .reader-help {
    font-size: 11px;
  }
  .rail-btn {
    padding: 0 7px;
    letter-spacing: 0.05em;
  }
  .s-pages {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 819px) {
  #card {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(12px + var(--safe-bottom));
    width: auto;
    max-height: 52%;
    transform: translate(0, -60%) rotate(-1deg);
  }
  #viewer.card-open #card {
    transform: none;
  }
  #vPrev,
  #vNext {
    top: auto;
    bottom: calc(12px + var(--safe-bottom));
    width: 48px;
    height: 48px;
    margin: 0;
  }
  #vPrev {
    left: auto;
    right: calc(64px + var(--safe-right));
  }
  #vNext {
    right: calc(12px + var(--safe-right));
  }
  #viewer.card-open #vPrev,
  #viewer.card-open #vNext,
  #viewer.card-open #vZoom {
    opacity: 0;
    pointer-events: none;
  }
  #tab {
    right: auto;
    left: 50%;
    margin-left: -40px;
    min-width: 80px;
    justify-content: center;
  }
  .journal-tag {
    display: none;
  }
  .bar .left,
  .bar .right {
    flex: 0 0 auto;
  }
  .bar .where {
    flex: 1 1 0;
    text-align: left;
    padding-left: 4px;
  }
  #card dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
  }
  #card dl div {
    grid-template-columns: 4.6em minmax(0, 1fr);
    border-bottom: 0;
  }
  #card dl div:last-child {
    border-bottom: 0;
  }
  #card dl {
    border-bottom: 1px solid var(--card-rule);
  }
  .card-in {
    padding: 14px 16px 6px;
  }
  .card-title {
    font-size: 21px;
    margin-top: 10px;
  }
  .foot .pos {
    min-width: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #app {
    transition: none;
  }
  #app.receded {
    transform: none;
  }
  .print {
    transition: none;
  }
  .print:hover {
    transform: none;
  }
  #card {
    transition: opacity var(--t-small);
    transform: translate(0, -50%);
  }
  #frame.smooth {
    transition: none;
  }
  #frame img.ease {
    transition: none;
  }
}
@media (prefers-reduced-motion: reduce) and (max-width: 819px) {
  #card {
    transform: none;
  }
}


/* Handmade album finish: full photographs, ivory print edges, paper mounts. */
:root {
  --print-paper: #f7f2e7;
  --print-mount: #c5b69c;
  --print-mount-edge: rgba(66, 48, 28, 0.2);
}
:root[data-paper="black"] {
  --print-mount: #b7a88e;
  --print-mount-edge: rgba(0, 0, 0, 0.32);
}
#book .chapter-heading h2 {
  font-style: italic;
  letter-spacing: -0.02em;
}
#book .print,
#book[data-mobile-album="1"] .mobile-print {
  isolation: isolate;
  box-shadow:
    0 0 0 7px var(--print-paper),
    0 4px 7px 7px rgba(30, 23, 14, 0.13),
    0 14px 25px -8px rgba(30, 23, 14, 0.25);
}
#book .print::before,
#book .print::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border-color: var(--print-mount);
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 1px 1px var(--print-mount-edge));
}
/* Mounts sit outside the photograph, over its paper border. */
#book .print::before {
  top: -8px;
  left: -8px;
  border-top-width: 8px;
  border-left-width: 8px;
}
#book .print::after {
  right: -8px;
  bottom: -8px;
  border-right-width: 8px;
  border-bottom-width: 8px;
}
#book .print:nth-of-type(3n + 1) {
  rotate: -0.7deg;
}
#book .print:nth-of-type(3n + 2) {
  rotate: 0.6deg;
}
#book .print:nth-of-type(3n) {
  rotate: -0.25deg;
}
#book .print:hover {
  box-shadow:
    0 0 0 7px var(--print-paper),
    0 5px 9px 7px rgba(30, 23, 14, 0.16),
    0 18px 28px -8px rgba(30, 23, 14, 0.28);
}
#book .print.lifted,
#book[data-mobile-album="1"] .mobile-print.lifted {
  rotate: 0deg;
  box-shadow: 0 0 0 1px var(--edge) inset;
}
#book .print.lifted::before,
#book .print.lifted::after {
  visibility: hidden;
}


/* Contents as a collection of mounted chapter prints, rather than a table. */
#book .tocpage {
  padding: 7.5% 11% 9%;
  gap: 1.15em;
  scrollbar-width: thin;
}
#book .tocpage > .eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
}
#book .tocpage > h1 {
  font-size: clamp(32px, calc(var(--pw) / 11), 52px);
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.035em;
}
#book .tocpage > h1::after {
  content: "Scroll to browse · Select a photograph to open";
  display: block;
  margin-top: 14px;
  font-family: var(--typed);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
#book .toc {
  gap: 2.5em;
  margin-top: 0.65em;
  padding: 8px 0 4px;
}
#book .toc li,
#book .toc li:last-child {
  position: relative;
  width: 94%;
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
}
#book .toc li:nth-child(3n + 2) {
  width: 87%;
  align-self: flex-end;
}
#book .toc li:nth-child(3n) {
  width: 92%;
  align-self: flex-start;
  margin-left: 2%;
}
#book .toc button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.1em;
  width: 100%;
  padding: 0;
  text-align: left;
  border-radius: 2px;
}
#book .toc button:focus-visible {
  outline-offset: 12px;
}
#book .toc .num {
  position: absolute;
  top: 8px;
  left: -24px;
  font-size: 10.5px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.04em;
}
#book .toc .thumb {
  position: relative;
  isolation: isolate;
  width: 100%;
  background: var(--print-paper, #f7f2e7);
  rotate: -0.8deg;
  box-shadow:
    0 0 0 7px var(--print-paper, #f7f2e7),
    0 4px 7px 7px rgba(30, 23, 14, 0.13),
    0 14px 25px -8px rgba(30, 23, 14, 0.25);
}
#book .toc li:nth-child(3n + 2) .thumb {
  rotate: 0.9deg;
}
#book .toc li:nth-child(3n) .thumb {
  rotate: -0.4deg;
}
#book .toc .thumb img {
  display: block;
  width: 100%;
  height: auto;
}
#book .toc .thumb::before,
#book .toc .thumb::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border-style: solid;
  border-width: 0;
  border-color: var(--print-mount, #c5b69c);
  filter: drop-shadow(0 1px 1px var(--print-mount-edge, rgba(66, 48, 28, 0.2)));
}
#book .toc .thumb::before {
  top: -8px;
  left: -8px;
  border-top-width: 8px;
  border-left-width: 8px;
}
#book .toc .thumb::after {
  right: -8px;
  bottom: -8px;
  border-right-width: 8px;
  border-bottom-width: 8px;
}
#book .toc button > span:last-child {
  display: block;
  padding-inline: 1px;
}
#book .toc .name {
  font-size: clamp(23px, calc(var(--pw) / 18), 34px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.025em;
}
#book .toc .meta {
  display: block;
  margin-top: 0.6em;
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: 0.025em;
}
#book .toc .meta + .meta {
  margin-top: 0.3em;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#book .tocpage .links {
  margin-top: 0.5em;
  padding-top: 1.2em;
  border-top: 1px solid var(--edge);
}
#book .tocpage .tail {
  margin-top: 0;
  font-size: 10px;
  line-height: 1.5;
}
@media (hover: hover) {
  #book .toc button:hover .name {
    color: var(--accent);
    text-decoration: none;
  }
  #book .toc button:hover .thumb {
    box-shadow:
      0 0 0 7px var(--print-paper, #f7f2e7),
      0 5px 9px 7px rgba(30, 23, 14, 0.16),
      0 18px 28px -8px rgba(30, 23, 14, 0.28);
  }
}
@media (max-width: 480px) {
  #book .tocpage {
    padding: 7% 10% 9%;
  }
  #book .toc {
    gap: 2.25em;
  }
  #book .toc li {
    width: 97%;
  }
  #book .toc li:nth-child(3n + 2) {
    width: 92%;
  }
  #book .toc li:nth-child(3n) {
    width: 96%;
    margin-left: 1%;
  }
  #book .toc .num {
    left: -20px;
    font-size: 10px;
  }
}


/* Studio: an album workbench, from first photograph to finished story. */
#studio { width: min(100%, 1100px); gap: 24px; padding: 12px 8px 36px; }
#studio > * { flex-shrink: 0; }
#studio .s-cloudbar { border-bottom: 1px solid var(--line); padding: 0 0 12px; min-height: 44px; gap: 10px 22px; flex-wrap: wrap; }
#studio .s-cloudbar > p { margin-right: auto; }
#studio .s-cloudbar .s-link { font-size: 11px; min-height: 32px; color: var(--desk-ink-soft); }

/* Private archive controls share the Studio's paper-and-ink workbench. */
#studio .s-backups { margin: 36px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#studio .s-backups > summary { padding: 22px 0; cursor: pointer; font: 12px "Courier Prime", monospace; letter-spacing: .08em; }
#studio .s-backup-body { padding: 12px 0 28px; max-width: 820px; }
#studio .s-backup-body h2 { font-size: clamp(27px, 4vw, 38px); font-weight: 400; margin: 12px 0; }
#studio .s-backup-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
#studio .s-backup-actions .s-primary { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
#studio .s-backup-picker { position: relative; cursor: pointer; }
#studio .s-backup-picker:focus-within { outline: 2px solid currentColor; outline-offset: 4px; }
#studio .s-backup-review:not(:empty) { padding: 24px; margin: 22px 0; border: 1px solid var(--line); background: rgba(193, 177, 141, .06); }
#studio .s-backup-review h3 { font-size: 28px; font-weight: 400; margin: 0 0 14px; }
#studio .s-backup-choices { display: grid; gap: 18px; margin: 24px 0; }
#studio .s-backup-choice { padding: 20px; border: 1px solid var(--line); min-width: 0; }
#studio .s-backup-choice h4 { margin: 0 0 6px; font-size: 24px; font-weight: 400; overflow-wrap: anywhere; }
#studio .s-backup-compare { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#studio .s-backup-compare p { margin: 0; padding: 14px; border-left: 2px solid var(--line); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
#studio .s-backup-choice-label { display: block; margin-top: 18px; font: 12px/1.6 "Courier Prime", monospace; }
#studio .s-backup-choice select { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); background: #e9e3d2; color: #20271f; font: 16px/1.4 "Courier Prime", monospace; }
@media (max-width: 600px) { #studio .s-backup-compare { grid-template-columns: 1fr; } #studio .s-backup-choice { padding: 15px 12px; } }
#studio .s-backup-agree { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0; line-height: 1.5; }
#studio .s-backup-agree input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
#studio .s-backup-confirm-label { display: block; font: 12px "Courier Prime", monospace; margin-bottom: 20px; }
#studio .s-backup-confirm { display: block; width: 100%; padding: 12px; margin-top: 10px; border: 1px solid var(--line); background: transparent; color: inherit; font: 16px "Courier Prime", monospace; }
#studio .s-backup-danger { margin-right: 18px; }
#studio .s-backup-history { margin-top: 26px; }
#studio .s-backup-history summary { cursor: pointer; font: 12px "Courier Prime", monospace; padding: 14px 0; }
#studio .s-backup-copies { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 12px 0; }
@media (max-width: 600px) { #studio .s-backup-actions { flex-direction: column; align-items: stretch; } #studio .s-backup-review:not(:empty) { padding: 18px 12px; } }
#studio .s-kicker { display: block; font: 11px/1.5 var(--typed); text-transform: uppercase; letter-spacing: .16em; color: #bcae94; }
#studio .s-intro { margin: 0; font-size: 18px; line-height: 1.55; color: var(--desk-ink-soft); max-width: 470px; }
.s-welcome { display: grid; grid-template-columns: 1.25fr 1fr; gap: 54px; padding: 32px 0 46px; align-items: center; }
.s-welcome-copy { display: flex; flex-direction: column; gap: 21px; align-items: flex-start; }
.s-welcome h1 { font-weight: 400; font-size: clamp(35px, 4.2vw, 58px); letter-spacing: -.025em; line-height: 1.12; margin: 0; max-width: 590px; text-wrap: balance; }
#studio .s-new-album { min-width: 180px; min-height: 52px; padding: 12px 24px; margin-top: 2px; }
.s-welcome-art { height: 270px; position: relative; margin-right: 16px; }
.s-welcome-print { position: absolute; background: #eae2d0; padding: 10px 10px 26px; box-shadow: 0 13px 30px #0006, 0 0 0 1px #ece5d329; width: 68%; aspect-ratio: 1.22; left: 10%; top: 17%; transform: rotate(-11deg); }
.s-welcome-print:nth-child(2) { left: 27%; top: 5%; transform: rotate(10deg); }
.s-welcome-print:nth-child(3) { left: 14%; top: 28%; transform: rotate(-2deg); }
.s-welcome-print img { width: 100%; height: 100%; object-fit: contain; display: block; background: #292d28; }
.s-welcome-print.blank::after { content: ''; display: block; width: 100%; height: 100%; background: #76796b; }
.s-albums { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 28px; margin: 0; padding: 0 0 20px; }
.s-album-card { width: 100%; display: block; text-align: left; }
.s-album-mount { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; aspect-ratio: 1.28; background: #252a24; padding: 20px; box-shadow: inset 0 0 0 1px var(--line); transition: background .2s; }
.s-album-card:hover .s-album-mount { background: #30362c; }
.s-album-mount img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 8px #0005); }
.s-album-caption { display: block; padding-top: 15px; }
.s-album-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
#studio .s-album-row .s-rowtitle { font-size: 25px; line-height: 1.25; }
.s-album-arrow { color: var(--desk-ink-soft); font-size: 21px; }
.s-album-caption > .s-meta { display: block; margin-top: 6px; }
.s-album-state { display: inline-block; margin-top: 10px; font: 10px/1.4 var(--typed); text-transform: uppercase; letter-spacing: .1em; color: #c6b28d; }
.s-album-state.published { color: var(--ok); }
.s-empty-cover { font-size: 40px; line-height: 1; color: #b6b09d; }
.s-empty-albums { border: 1px dashed var(--line-strong); padding: 32px; text-align: center; color: var(--desk-ink-soft); }
.s-notes-drawer { border-top: 1px solid var(--line); margin-top: 20px; }
.s-notes-drawer > div { display: flex; flex-direction: column; gap: 16px; padding-block: 10px 24px; }
.s-notes-drawer > summary, .s-layout-tools > summary { cursor: pointer; padding: 20px 4px; font-size: 22px; }
.s-notes-drawer .s-sechead { display: none; }
.s-notes-drawer .s-btn { align-self: flex-start; }
#studio.s-editing { gap: 24px; }
.s-editor-head { display: flex; flex-direction: column; gap: 10px; }
.s-editor-head h1 { font-weight: 400; margin: 0; font-size: clamp(32px, 4vw, 46px); line-height: 1.15; overflow-wrap: anywhere; }
.s-workflow { display: flex; align-items: center; list-style: none; padding: 0 0 20px; margin: 0; gap: 28px; border-bottom: 1px solid var(--line); }
.s-step { display: flex; align-items: center; gap: 10px; font: 12px/1.35 var(--typed); color: var(--desk-ink-soft); min-height: 44px; text-align: left; }
.s-step-number { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); flex-shrink: 0; color: var(--desk-ink); }
.s-workflow .done .s-step-number { color: var(--ok); border-color: var(--ok); }
.s-workflow .active .s-step { color: var(--desk-ink); }
.s-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 34px; align-items: start; }
.s-editor-photos { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.s-album-details { display: flex; flex-direction: column; gap: 22px; padding: 8px 0 24px; min-width: 0; }
#studio .s-album-details .s-fields { gap: 22px; }
#studio .s-album-details .s-field input, #studio .s-album-details .s-field textarea { background: transparent; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line-strong); }
#studio .s-album-details .s-field textarea { min-height: 130px; }
#studio .s-album-details input::placeholder, #studio .s-album-details textarea::placeholder { color: #8f8d7f; opacity: 1; font-size: 16px; }
.s-details-note { margin: 0; border-top: 1px solid var(--line); padding-top: 20px; color: var(--desk-ink-soft); font-size: 16px; line-height: 1.6; }
.s-dropzone { background: #e8e1d0; color: #2c3028; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 38px 28px 30px; position: relative; outline: 1px dashed #96927e; outline-offset: -12px; transition: background .15s, outline-color .15s; }
.s-dropzone.is-dragging { background: #f4ebd2; outline: 2px solid #3e654e; outline-offset: -9px; }
.s-upload-mark { border: 1px solid #8f9280; width: 52px; height: 42px; font: 29px/38px var(--serif); position: relative; margin: 4px 0 6px; }
.s-upload-mark::after { content: ''; position: absolute; inset: -5px 4px 4px -5px; border: 1px solid #8f9280; transform: rotate(-7deg); }
.s-dropzone h2 { font-size: 31px; line-height: 1.2; font-weight: 400; margin: 0; text-wrap: balance; }
.s-drop-copy { margin: 0; font-size: 17px; line-height: 1.5; max-width: 320px; color: #53594b; }
#studio .s-choose { background: #263f32; color: #f5efdd; padding: 13px 27px; min-height: 48px; margin: 2px 0; }
#studio .s-choose:focus-within { outline-color: #263f32; }
.s-upload-spec { margin: 0; font: 11px/1.7 var(--typed); color: #52594b; }
.s-drop-reassurance { margin: 0; max-width: 350px; font-size: 14px; line-height: 1.5; color: #626553; }
#studio .s-tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
#studio .s-tile { background: #242922; border-color: var(--line); }
#studio .s-tile img { padding: 7px; }
#studio .s-tile:hover { outline: 1px solid var(--line-strong); outline-offset: 2px; }
#studio .s-flag { background: #e9e3d1; color: #2b382e; font-size: 10px; }
#studio .s-batch { background: #1c241e; border: 1px solid #73857255; padding: 18px; gap: 14px; }
#studio .s-batchhead { justify-content: space-between; }
#studio .s-batchhead strong { font-family: var(--serif); font-size: 22px; font-weight: 400; }
#studio .s-batchhead .s-link { min-height: 32px; font-size: 10px; }
#studio .s-bar { height: 4px; background: #ffffff18; }
#studio .s-bar i { background: #b7c7a7; }
#studio .s-files { gap: 12px; }
#studio .s-upload-file { display: flex; gap: 12px; align-items: center; }
.s-upload-thumb { width: 46px; height: 46px; display: grid; place-items: center; flex: none; background: #30392e; color: #c6c5b4; }
.s-upload-thumb img { width: 100%; height: 100%; object-fit: contain; }
.s-upload-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.s-upload-text .st { font-size: 11px; }
#studio .s-error { color: var(--bad); }
.s-layout-tools { border-block: 1px solid var(--line); }
.s-layout-tools .s-sec { padding: 0 0 22px; border: 0; }
.s-layout-tools .s-sechead { display: none; }
.s-layout-tools .s-pages { grid-template-columns: repeat(4,minmax(0,1fr)); }
#studio .s-publish-bar { position: sticky; bottom: -1px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 0 calc(16px + env(safe-area-inset-bottom, 0px)); background: #131412f5; border-top: 1px solid var(--line-strong); z-index: 3; margin-top: 0; box-shadow: 0 -12px 22px #131412cc; }
.s-publish-status { display: flex; flex-direction: column; gap: 8px; max-width: 300px; }
.s-publish-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
#studio .s-publish-controls .s-btn { min-height: 48px; font-size: 11px; padding-inline: 18px; }
#studio .s-publish-controls button:disabled { opacity: .38; cursor: default; }
#studio .s-unpublish { color: var(--desk-ink-soft); font-size: 10px; padding-inline: 8px; }
@media (max-width: 850px) {
  .s-editor-layout { grid-template-columns: minmax(0,1fr) 250px; gap: 24px; }
  .s-welcome { gap: 28px; }
  .s-welcome-art { height: 220px; }
  .s-albums { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  #studio { padding-inline: 2px; gap: 22px; }
  .s-welcome { grid-template-columns: 1fr; padding: 16px 0 24px; gap: 12px; }
  .s-welcome h1 { font-size: 39px; }
  .s-welcome-art { height: 170px; width: 240px; justify-self: center; margin-top: 4px; }
  .s-welcome-print { width: 63%; padding: 7px 7px 18px; }
  .s-welcome-copy { gap: 16px; }
  #studio .s-new-album { width: 100%; }
  .s-albums { gap: 28px 16px; }
  .s-album-mount { padding: 12px; }
  #studio .s-album-row .s-rowtitle { font-size: 21px; }
  .s-album-caption > .s-meta { font-size: 11px; }
  .s-workflow { gap: 10px; justify-content: space-between; }
  .s-step { flex-direction: column; align-items: flex-start; gap: 8px; font-size: 10px; }
  .s-editor-layout { display: flex; flex-direction: column; gap: 28px; }
  .s-editor-photos, .s-album-details { width: 100%; }
  .s-album-details { order: -1; }
  .s-album-details .s-kicker, .s-details-note { display: none; }
  .s-dropzone { padding: 32px 20px 28px; }
  .s-dropzone h2 { font-size: 28px; }
  .s-drop-copy { font-size: 16px; }
  .s-upload-spec { font-size: 10px; }
  #studio .s-tiles { grid-template-columns: repeat(auto-fill,minmax(115px,1fr)); gap: 12px; }
  .s-layout-tools .s-pages { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #studio .s-publish-bar { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 13px; }
  .s-publish-status { max-width: none; }
  .s-publish-status .s-note { font-size: 11px; }
  .s-publish-controls { justify-content: stretch; }
  #studio .s-publish-controls .s-btn { flex: 1; padding: 10px; font-size: 10px; }
  #studio .s-cloudbar > p { font-size: 11px; flex-basis: 65%; }
}
@media (max-width: 380px) { .s-albums { grid-template-columns: 1fr; }.s-workflow { gap: 8px; }.s-step { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { #studio * { scroll-behavior: auto !important; transition: none !important; } }

.s-more-details > summary { cursor: pointer; font: 12px/1.5 var(--typed); color: var(--desk-ink-soft); padding: 4px 0 14px; }
.s-more-details[open] { display: flex; flex-direction: column; gap: 18px; }
.s-more-details .s-field + .s-field { margin-top: 20px; }

/* Portrait phones: let the scrollable Contents sheet fill the reader area. */
@media (max-width: 600px) and (orientation: portrait) {
  #book[data-wide="0"][data-view="contents"] {
    height: calc(100% - 20px);
  }
}

/* Short landscape screens: photographs use the height, controls sit beside them. */
@media (orientation: landscape) and (max-height: 500px) {
  .bar, .foot, .page-nav { min-height: 44px; }
  .foot { padding-top: 0; }
  .reader-help, .journal-tag { display: none; }
  #book[data-view="contents"] { width: min(calc(100% - 20px), 900px); height: calc(100% - 20px); }
  #book[data-view="contents"] .leaf.left { display: none; }
  #book[data-view="contents"] .leaf.right::after { width: 3%; }
  #book .tocpage { padding: 16px 36px; gap: 12px; }
  #book .tocpage > .eyebrow, #book .tocpage > h1::after { display: none; }
  #book .tocpage > h1 { font-size: 28px; }
  #book .toc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 36px; margin-top: 0; }
  #book .toc li, #book .toc li:nth-child(n) { width: 100%; margin: 0; }
  #book .toc button { display: grid; grid-template-columns: 45% minmax(0, 1fr); gap: 20px; align-items: center; }
  #book .toc .name { font-size: 22px; }
  #book .toc .num { left: -22px; }
  #vClose { width: 44px; padding: 0; }
  #vClose span:last-child { display: none; }
  #vCount { font-size: 10px; letter-spacing: 0; }
  #vPrev, #vNext {
    top: 50%; bottom: auto; margin-top: -22px;
    width: 44px; height: 44px;
  }
  #vPrev { left: calc(12px + var(--safe-left)); right: auto; }
  #vNext { right: calc(12px + var(--safe-right)); }
  #vZoom { width: 44px; padding: 0; font-size: 10px; }
  #tab { left: 50%; right: auto; margin-left: -40px; min-width: 80px; }
  #card {
    left: auto; right: calc(64px + var(--safe-right));
    top: calc(12px + var(--safe-top)); bottom: auto;
    width: min(310px, 40%);
    max-height: calc(100% - 24px - var(--safe-top) - var(--safe-bottom));
    transform: translateX(-24px) rotate(-1deg);
  }
  #viewer.card-open #card { transform: none; }
}

/* Phone album pages fill the reader; prints are fitted to the taller paper in JS. */
@media (max-width: 600px) and (orientation: portrait) {
  #book[data-wide="0"][data-view="chapter"] { height: calc(100% - 20px); }
  #book .album-page .chapter-heading { top: 16px; left: 24px; right: 24px; }
  #book .album-page .chapter-heading h2 { font-size: clamp(18px, 5vw, 24px); }
  #book .album-page .folio { bottom: 10px; }
  .foot { padding-bottom: 22px; }
  .reader-help { margin-block: 3px 7px; font-size: 10px; }
}

/* Through old glass: the artist's bookplate and a scrollable photographic light table.
   Uses the shared viewport; it introduces no separate screen sizing or zoom state. */
.glass-kicker { display: block; font: 10px/1.6 var(--typed); letter-spacing: .13em; text-transform: uppercase; }
.glass-invitation {
  display: flex; align-items: center; gap: 18px; width: 100%; padding: 17px 0;
  border-block: 1px solid var(--edge); text-align: left; color: var(--ink);
}
.glass-invitation-copy { display: grid; gap: 5px; min-width: 0; }
.glass-invitation .glass-kicker { color: var(--accent); font-size: 9px; }
.glass-invitation-title { font-size: clamp(20px, calc(var(--pw) / 19), 30px); font-style: italic; line-height: 1.15; }
.glass-invitation-link { font: 10px/1.5 var(--typed); color: var(--ink-soft); }
/* A small engraved lens motif, drawn in CSS rather than a photographic effect. */
.glass-mark {
  position: relative; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid currentColor; color: var(--accent);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px currentColor;
}
.glass-mark::before { content: ""; position: absolute; inset: 10px; border: 1px solid currentColor; border-radius: 50%; }
.glass-mark::after { content: ""; position: absolute; inset: 17px; border: 1px solid currentColor; transform: rotate(30deg); }
#book[data-view="table"] { width: min(calc(100% - 20px), 1180px); height: calc(100% - 20px); }
#book[data-view="table"] .leaf::after { display: none; }
.glass-page {
  position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain;
  touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  padding: clamp(24px, 4vw, 58px); color: var(--ink);
}
.glass-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; align-items: end; padding-bottom: 32px; }
.glass-intro .glass-kicker { color: var(--accent); }
.glass-title { margin: 22px 0 10px; max-width: 9em; font-size: clamp(38px, 5.4vw, 72px); font-weight: 400; font-style: italic; line-height: .98; letter-spacing: -.04em; }
.glass-deck { margin: 16px 0 0; font-size: 20px; font-style: italic; color: var(--ink-soft); }
.glass-statement p { margin: 14px 0 0; font-size: 17px; line-height: 1.55; max-width: 31em; }
.glass-index { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border-block: 1px solid var(--edge); padding: 17px 0; margin-bottom: 30px; }
.glass-index > .glass-kicker { letter-spacing: .06em; }
.glass-total { font: 10px/1.6 var(--typed); color: var(--ink-soft); }
.glass-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.glass-filter { padding: 10px 12px; min-height: 44px; border: 1px solid var(--edge); color: var(--ink); font: 10px/1.4 var(--typed); }
.glass-filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.glass-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 24px; }
.glass-frame { min-width: 0; margin: 0; }
.table-photo {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; padding: 10px;
  background: var(--print-paper, #f7f2e7); box-shadow: 0 1px 3px #221b1526, 0 9px 18px -12px #221b1566;
}
.table-photo img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.table-photo.lifted img { visibility: hidden; }
.glass-frame figcaption { display: flex; gap: 12px; margin-top: 14px; }
.glass-number { font: 11px/1.5 var(--typed); color: var(--accent); padding-top: 2px; }
.glass-details { display: grid; gap: 5px; min-width: 0; }
.glass-chapter { font-size: 17px; line-height: 1.2; }
.glass-settings { font: 10px/1.5 var(--typed); color: var(--ink-soft); overflow-wrap: anywhere; }
.glass-colophon { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 44px; padding-block: 34px 6px; border-top: 1px solid var(--edge); text-align: center; }
.glass-signature { font-size: 36px; font-style: italic; }
.glass-colophon p { margin: 0; font-size: 19px; font-style: italic; }
.glass-delivery { max-width: 48em; font: 10px/1.6 var(--typed); color: var(--ink-soft); }
.glass-back { padding: 12px 4px; min-height: 44px; color: var(--ink); font: 11px/1.5 var(--typed); text-decoration: underline; text-underline-offset: 5px; }
@media (hover: hover) {
  .glass-invitation:hover .glass-invitation-link { text-decoration: underline; text-underline-offset: 4px; }
  .table-photo:hover { outline: 1px solid var(--accent); outline-offset: 4px; }
}
@media (max-width: 700px) {
  .glass-intro { grid-template-columns: 1fr; gap: 25px; padding-bottom: 25px; }
  .glass-title { max-width: none; font-size: clamp(36px, 9vw, 58px); margin-top: 16px; }
  .glass-statement p { font-size: 16px; }
  .glass-statement .glass-kicker { font-size: 9px; letter-spacing: .05em; }
  .glass-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 17px; }
  .table-photo { padding: 6px; }
  .glass-frame figcaption { gap: 7px; margin-top: 11px; }
  .glass-chapter { font-size: 15px; }
  .glass-number { font-size: 10px; }
  .glass-settings { font-size: 9px; }
}
@media (max-width: 380px) {
  .glass-page { padding: 22px 18px; }
  .glass-grid { gap: 25px 13px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .glass-page { padding: 24px 32px; }
  .glass-intro { grid-template-columns: 1fr 1fr; gap: 28px; }
  .glass-title { font-size: 40px; }
  .glass-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
