:root {
  color-scheme: only light;
  --ink: #111111;
  --sheet-ink: #111111;
  --paper: #ffffff;
  --quiet: #6d6d6d;
  --edge: rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color-scheme: only light;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  overscroll-behavior-x: none;
}

button {
  color: inherit;
  font: inherit;
}

.viewer-bar {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 30px;
  min-height: 56px;
  padding: max(9px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 9px max(22px, env(safe-area-inset-left));
  background: #ffffff;
}

.section-nav-shell {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}

.section-nav-shell.is-compact {
  justify-content: center;
  gap: 5px;
}

.section-nav-shell.is-compact .section-nav {
  flex: 0 1 auto;
  width: auto;
  max-width: calc(100% - 38px);
}

.section-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2vw, 34px);
  min-width: 0;
  overflow: hidden;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.section-nav button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #777777;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.12em;
  white-space: nowrap;
  transition: color 160ms ease;
}

.section-nav button[hidden] {
  display: none;
}

.section-nav button:hover,
.section-nav button.is-active {
  color: var(--ink);
}

.nav-cue {
  display: none;
  flex: 0 0 auto;
  width: 18px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 17px;
  font-weight: 300;
  line-height: 1;
  opacity: 0.42;
}

.nav-cue:disabled {
  cursor: default;
  opacity: 0.1;
}

.nav-cue.is-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-nav-shell.is-compact .nav-cue {
  width: 14px;
}

.mode-switch {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding-left: 24px;
  border-left: 1px solid var(--edge);
}

.mode-switch > span {
  width: 20px;
  height: 1px;
  background: var(--edge);
}

.mode-button {
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--quiet);
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.19em;
}

.mode-button.is-active {
  color: var(--ink);
}

.mode-button:focus-visible,
.section-nav button:focus-visible,
.nav-cue:focus-visible,
.page-arrow:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

.book-view {
  position: relative;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, 1180px) minmax(44px, 1fr);
  align-items: center;
  min-height: 100svh;
  padding: 74px 22px 46px;
  background: #ffffff;
}

.book-view[hidden],
.continuous-view[hidden] {
  display: none;
}

.page-stage {
  position: relative;
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, calc((100svh - 120px) * 1.4142));
  margin: 0;
  aspect-ratio: 1.4142 / 1;
  overflow: hidden;
  background: var(--paper);
  container-type: inline-size;
}

.page-stage > #book-page {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  filter: none;
}

.page-stage > #book-page.has-content-shift {
  transform: translateY(-3.65%);
}

.page-footer-clone {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  clip-path: inset(87.5% 0 0 0);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.page-footer-clone[hidden] {
  display: none;
}

.page-footer-redraw {
  position: absolute;
  z-index: 5;
  inset: 0;
  color: #111111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.48cqw;
  font-style: normal;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0.015em;
  line-height: 1;
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.page-footer-redraw[hidden] {
  display: none;
}

.page-footer-redraw__identity,
.page-footer-redraw__number {
  position: absolute;
  bottom: 2.75%;
  display: flex;
  align-items: center;
  height: 3.2%;
  background: #ffffff;
  white-space: nowrap;
}

.page-footer-redraw__identity {
  left: 3.45%;
  justify-content: flex-start;
  width: 34%;
  padding-left: 0.8%;
}

.page-footer-redraw__number {
  right: 3.05%;
  justify-content: flex-end;
  width: 5.5%;
  padding-right: 0.6%;
  font-variant-numeric: tabular-nums;
}

.special-page-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: inline-size;
}

.special-page-layer[hidden] {
  display: none;
}

.cover-adjustment {
  position: absolute;
  inset: 0;
}

.cover-adjustment__title-group {
  position: absolute;
  top: 50.5%;
  left: 75%;
  width: 44%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2cqw;
  transform: translate(-50%, -50%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
}

.cover-adjustment__title {
  font-size: 2.12cqw;
  letter-spacing: 0.42em;
  line-height: 1;
}

.cover-adjustment__subtitle {
  font-size: 1.31cqw;
  letter-spacing: 0.4em;
  line-height: 1;
}

.biography-page {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: #ffffff;
}

.biography-page__portrait-column {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 9%;
}

.biography-page__portrait-frame {
  width: min(68%, 350px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #d0d0ce;
}

.biography-page__portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: grayscale(100%);
}

.biography-page__text-column {
  display: flex;
  align-items: center;
  padding: 0 8% 0 5%;
}

.biography-page__copy {
  width: 100%;
  color: #111111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84cqw;
  font-style: normal;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0.4em;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.biography-page__greeting,
.biography-page__paragraph {
  display: block;
}

.biography-page__greeting {
  margin: 0 0 2.2cqw;
  line-height: 1;
}

.biography-page__paragraph {
  margin: 0 0 1.4cqw;
  line-height: 1.9;
  text-wrap: pretty;
}

.biography-page__paragraph:last-child {
  margin-bottom: 0;
}

.exterior-replacements {
  position: absolute;
  inset: 0;
  transform: translateY(-3.65%);
}

.exterior-replacement {
  position: absolute;
  top: 13.24%;
  width: 39.08%;
  height: 73.7%;
  overflow: hidden;
  background: #fefefe;
}

.exterior-replacement--left {
  left: 9.55%;
}

.exterior-replacement--right {
  left: 51.31%;
}

.exterior-replacement img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  filter: none;
}

.exterior-replacement--right img {
  object-position: center;
  transform: scale(1.09);
}

.portfolio-page-copy {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: transparent;
  color: #111111;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.portfolio-page-copy::before {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--paper);
  content: "";
}

.portfolio-page-copy.is-left::before {
  left: 0;
  width: 50%;
}

.portfolio-page-copy.is-right::before {
  right: 0;
  width: 50%;
}

.portfolio-page-copy.is-full::before {
  right: 0;
  left: 0;
}

.portfolio-page-copy.uses-baked-background::before {
  display: none;
}

.portfolio-page-copy__group {
  position: absolute;
  z-index: 1;
  top: var(--copy-y);
  left: var(--copy-x);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2cqw;
  width: var(--copy-width);
  transform: translate(-50%, -50%);
}

.portfolio-page-copy[hidden] {
  display: none;
}

.portfolio-page-copy__title {
  font-size: 1.5cqw;
  letter-spacing: 0.42em;
  line-height: 1;
}

.portfolio-page-copy__subtitle {
  font-size: 0.9cqw;
  letter-spacing: 0.4em;
  line-height: 1;
}

.portfolio-page-copy.has-long-subtitle .portfolio-page-copy__subtitle {
  letter-spacing: 0.08em;
}

.page-arrow {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 72px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  opacity: 0.38;
  transition: opacity 180ms ease;
}

.page-arrow:hover {
  opacity: 1;
}

.page-arrow:disabled {
  cursor: default;
  opacity: 0.08;
}

.page-arrow span {
  display: block;
  width: 15px;
  height: 15px;
  border-top: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}

.page-arrow--previous {
  grid-column: 1;
}

.page-arrow--previous span {
  transform: rotate(-135deg);
}

.page-arrow--next {
  grid-column: 3;
}

.page-arrow--next span {
  transform: rotate(45deg);
}

.page-index {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(17px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--quiet);
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}

.page-index i {
  width: 20px;
  height: 1px;
  background: var(--edge);
}

.continuous-view {
  min-height: 100svh;
  padding: 86px 20px 60px;
  background: #ffffff;
}

.continuous-pages {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vw, 44px);
  width: min(1180px, 100%);
  margin: 0 auto;
}

.continuous-page-frame {
  position: relative;
  width: 100%;
  margin: 0;
  aspect-ratio: 1.4142 / 1;
  overflow: hidden;
  background: var(--paper);
  scroll-margin-top: 70px;
  container-type: inline-size;
}

.continuous-page {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--paper);
  filter: none;
}

.continuous-page.has-content-shift {
  transform: translateY(-3.65%);
}

.continuous-page-footer {
  background: var(--paper);
}

@media (max-width: 720px) {
  .viewer-bar {
    gap: 12px;
    min-height: 50px;
    padding-right: max(9px, env(safe-area-inset-right));
    padding-left: max(9px, env(safe-area-inset-left));
  }

  .section-nav {
    justify-content: center;
    gap: 18px;
  }

  .section-nav button {
    min-height: 30px;
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .section-nav-shell.is-compact {
    gap: 4px;
  }

  .section-nav-shell.is-compact .section-nav button[data-page="35"],
  .section-nav-shell.is-compact .section-nav button[data-page="47"] {
    letter-spacing: 0.07em;
  }

  .section-nav-shell.is-compact .nav-cue {
    width: 13px;
    font-size: 16px;
  }

  .mode-switch {
    gap: 9px;
    padding-left: 12px;
  }

  .mode-button {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .mode-switch > span {
    width: 14px;
  }

  .book-view {
    grid-template-columns: 1fr;
    padding: 58px 8px 42px;
  }

  .page-stage {
    grid-column: 1;
    width: min(100%, calc((100svh - 100px) * 1.4142));
  }

  .page-arrow {
    position: fixed;
    top: 50%;
    width: 38px;
    height: 64px;
    margin: 0;
    transform: translateY(-50%);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .page-arrow--previous {
    left: 0;
  }

  .page-arrow--next {
    right: 0;
  }

  .page-arrow span {
    width: 12px;
    height: 12px;
  }

  .page-index {
    right: max(11px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 10px;
  }

  .continuous-view {
    padding: 66px 8px 32px;
  }

  .continuous-pages {
    gap: 10px;
  }
}

/* Mobile phones held horizontally have plenty of width but very little height.
   Use that height almost entirely for the portfolio sheet instead of applying
   the roomier desktop spacing. */
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .viewer-bar {
    gap: 10px;
    min-height: 42px;
    padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left));
  }

  .section-nav {
    gap: 14px;
  }

  .section-nav button {
    min-height: 28px;
    font-size: 11px;
    letter-spacing: 0.09em;
  }

  .section-nav-shell.is-compact {
    gap: 3px;
  }

  .section-nav-shell.is-compact .nav-cue {
    width: 13px;
    min-height: 28px;
    font-size: 15px;
  }

  .mode-switch {
    gap: 8px;
    padding-left: 10px;
  }

  .mode-switch > span {
    width: 12px;
  }

  .mode-button {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .book-view {
    grid-template-columns: 1fr;
    min-height: 100svh;
    padding: 46px max(38px, env(safe-area-inset-right)) 4px max(38px, env(safe-area-inset-left));
  }

  .page-stage {
    grid-column: 1;
    width: min(100%, calc((100svh - 50px) * 1.4142));
  }

  .page-arrow {
    position: fixed;
    top: 50%;
    width: 34px;
    height: 56px;
    margin: 0;
    transform: translateY(-50%);
  }

  .page-arrow--previous {
    left: max(0px, env(safe-area-inset-left));
  }

  .page-arrow--next {
    right: max(0px, env(safe-area-inset-right));
  }

  .page-arrow span {
    width: 11px;
    height: 11px;
  }

  .page-index {
    display: none;
  }

  .continuous-view {
    padding: 48px max(8px, env(safe-area-inset-right)) 16px max(8px, env(safe-area-inset-left));
  }

  .continuous-pages {
    gap: 8px;
  }
}

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