@font-face {
  font-family: "TT2020";
  src: url("assets/fonts/tt2020-style-d.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT2020 Header";
  src: url("assets/fonts/tt2020-style-e.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #efede7;
  --paper-light: #f2f2ef;
  --ink: #181614;
  --burgundy: #7d3040;
  --burgundy-dark: #5f2030;
  --book-measure: 42rem;
  --paper-image: url("assets/images/paper-texture.png");
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 18rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "TT2020", "Courier New", monospace;
  font-size: clamp(1.05rem, .93rem + .32vw, 1.26rem);
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--burgundy);
  font-weight: inherit;
  text-decoration-line: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: .09em;
  text-underline-offset: .16em;
  transition: color 160ms ease, text-decoration-thickness 160ms ease;
}

a:hover,
a:focus-visible {
  color: var(--burgundy-dark);
  text-decoration-thickness: .13em;
}

a:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  padding: .5rem .7rem;
  background: var(--ink);
  color: var(--paper-light);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.landing {
  position: relative;
  height: 91vh;
  height: 91svh;
  overflow: hidden;
  background: #eeeae2;
}

.landing::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(248, 246, 241, .26);
}

.landing img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.book {
  position: relative;
  isolation: isolate;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(248, 246, 241, .3), rgba(248, 246, 241, .3)),
    var(--paper-image);
  background-attachment: fixed;
  background-size: 100vw auto;
  font-weight: 700;
  text-shadow: .022em 0 rgba(23, 21, 17, .22);
}

.leaf {
  position: relative;
  min-height: 76svh;
  padding: clamp(5.2rem, 9vh, 7.5rem) clamp(1.35rem, 7vw, 7rem) clamp(6.5rem, 11vh, 8.5rem);
  border-top: 2px solid rgba(45, 39, 30, .2);
  box-shadow:
    inset 0 2px rgba(255,255,255,.36),
    0 -9px 20px rgba(45, 39, 30, .045);
}

.leaf::after {
  content: "— " attr(data-page) " —";
  position: absolute;
  bottom: 1.7rem;
  left: 50%;
  color: rgba(23, 21, 17, .58);
  font-size: 1em;
  font-weight: 700;
  letter-spacing: .04em;
  transform: translateX(-50%);
}

.opening {
  min-height: 71svh;
  padding-top: 2.4svh;
  border-top: 0;
}

.measure {
  width: min(100%, var(--book-measure));
  margin-inline: auto;
}

.measure p { margin: 0 0 1.35em; }
.measure p:last-child { margin-bottom: 0; }

h2 {
  margin: 0 0 clamp(2.5rem, 6vh, 4.6rem);
  font-family: "TT2020 Header", "TT2020", "Courier New", monospace;
  font-size: clamp(1.3rem, 1.1rem + .55vw, 1.62rem);
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: lowercase;
  text-shadow: .055em 0 rgba(23, 21, 17, .34);
}

.set {
  margin-top: clamp(2.2rem, 5vh, 3.8rem) !important;
  font-size: clamp(1.12rem, 1rem + .38vw, 1.36rem);
  line-height: 1.48;
}

.word-door {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--burgundy);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: .09em;
  text-underline-offset: .16em;
  text-shadow: none;
  transition: color 160ms ease, text-decoration-thickness 160ms ease;
}

.word-door:hover,
.word-door:focus-visible {
  color: var(--burgundy-dark);
  text-decoration-thickness: .13em;
}

.word-door:focus-visible,
.email-link:focus-visible,
.room-close:focus-visible,
.room a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: .22em;
}

.heading-door { text-transform: lowercase; }
.offers h2 { text-transform: none; }

.offers strong { font-weight: 900; text-shadow: .045em 0 currentColor; }

.email-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-weight: inherit;
}

.publication-note {
  margin-top: clamp(3.5rem, 8vh, 6rem) !important;
  color: rgba(24, 22, 20, .62);
  font-size: .78em;
  font-weight: 400;
  line-height: 1.55;
  text-shadow: none;
}

.legal-footer {
  padding: 1.6rem clamp(1.35rem, 7vw, 7rem) 2.2rem;
  border-top: 1px solid rgba(45, 39, 30, .16);
  font-size: .78em;
  font-weight: 400;
  text-shadow: none;
}

.legal-footer nav {
  display: flex;
  justify-content: center;
  gap: 1.6rem;
}

.closing-mark {
  margin-top: clamp(5rem, 12vh, 9rem) !important;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1;
}

.room {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper-light);
  color: #171717;
  opacity: 0;
  transform: translateY(.7rem);
  transition: opacity 200ms ease, transform 200ms ease, display 200ms allow-discrete, overlay 200ms allow-discrete;
}

.room[open] { opacity: 1; transform: translateY(0); }
.room:focus { outline: 0; }
.room::backdrop { background: rgba(15, 13, 10, .45); }

@starting-style {
  .room[open] { opacity: 0; transform: translateY(.7rem); }
}

.room-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 5rem;
  height: 100svh;
  overflow: hidden;
  background: var(--paper-light);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.branch-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 0;
}

.branch-image {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0 1.65rem 0 0;
  overflow: visible;
  background: #d7d7d3;
}

.branch-image img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.branch-image.symbol { background: #fff; }

.branch-image.symbol img {
  object-fit: contain;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  transform: scale(1.08);
}

.branch-image figcaption {
  position: absolute;
  z-index: 1;
  right: -1.45rem;
  bottom: .65rem;
  left: auto;
  max-height: calc(100% - 1.3rem);
  padding: 0;
  background: transparent;
  color: #4d4a45;
  font-size: .69rem;
  line-height: 1.3;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.branch-copy {
  min-width: 0;
  min-height: 0;
  padding: clamp(2rem, 4.2vw, 5rem) clamp(2rem, 5vw, 6rem);
  overflow: hidden;
}

.room-label {
  margin: 0 0 clamp(2rem, 5vh, 4.2rem);
  font-size: clamp(1rem, .85rem + .55vw, 1.42rem);
  font-weight: 700;
  letter-spacing: -.015em;
}

.room-header { margin: 0 0 clamp(1.8rem, 4vh, 3.4rem); }

.room-header h2 {
  margin: 0 0 .85rem;
  max-width: 17ch;
  font-family: "TT2020 Header", "TT2020", "Courier New", monospace;
  font-size: clamp(2rem, 2.8vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -.035em;
  text-transform: none;
  text-shadow: none;
}

.after {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(.9rem, .82rem + .3vw, 1.12rem);
  font-style: italic;
}

.branch-text {
  width: min(100%, 38rem);
  font-size: clamp(1.08rem, .9rem + .48vw, 1.3rem);
  font-weight: 400;
  line-height: 1.38;
}

.branch-text p { margin: 0 0 .95em; }
.branch-text .prompt { margin-top: clamp(1.5rem, 3.5vh, 2.8rem); }

.closing-question {
  margin-top: clamp(1.8rem, 4.5vh, 3.6rem) !important;
}

.sentence-pair,
.ending-pair { margin: clamp(1.2rem, 2.6vh, 2.1rem) 0; }

.sentence-pair p,
.ending-pair p { margin-bottom: .4em; }

.branch-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: .65rem clamp(1.25rem, 5vw, 5rem);
  border-top: 1px solid rgba(45,39,30,.14);
  background-color: var(--paper);
  background-image: var(--paper-image);
  background-size: 100vw auto;
  color: #312e29;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(.75rem, .69rem + .2vw, .9rem);
}

.room-close {
  justify-self: end;
  margin: 0;
  padding: .25rem 0;
  border: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.semicolon-return {
  min-width: 1.05em;
  padding: 0;
  font-family: "TT2020", "Courier New", monospace;
  font-size: clamp(3.6rem, 5vw, 5.5rem);
  font-weight: 700;
  line-height: .7;
  text-align: center;
  transform: translate(-1cm, -.3cm);
}

.semicolon-return { color: var(--burgundy); }
.semicolon-return:hover { color: var(--burgundy-dark); }

.semicolon-return:focus-visible {
  outline: 0;
  color: var(--burgundy-dark);
  text-decoration: underline;
  text-decoration-thickness: .04em;
  text-underline-offset: .1em;
}

body.room-open { overflow: hidden; }

@media (min-width: 53.01rem) and (max-height: 46rem) {
  .room-page { grid-template-rows: minmax(0, 1fr) 4.25rem; }
  .branch-copy { padding-top: 1.5rem; padding-bottom: 1.25rem; }
  .room-label { margin-bottom: 1.25rem; }
  .room-header { margin-bottom: 1.25rem; }
  .room-header h2 { font-size: clamp(1.8rem, 2.5vw, 3rem); }
  .branch-text { font-size: 1rem; line-height: 1.27; }
  .branch-text p { margin-bottom: .65em; }
  .branch-text .prompt,
  .closing-question { margin-top: 1rem !important; }
  .sentence-pair,
  .ending-pair { margin: .85rem 0; }
}

@media (max-width: 53rem) {
  .landing { height: 92svh; }
  .landing img { object-position: 36% center; }
  .book { background-size: auto 100svh; }

  .leaf {
    min-height: auto;
    padding: 5.2rem 1.35rem 6.7rem;
  }

  .opening {
    min-height: 67svh;
    padding-top: 2svh;
  }

  .room {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .room-page {
    display: block;
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  .branch-body { display: block; }

  .branch-image {
    height: 44svh;
    min-height: 20rem;
    margin-right: 1.5rem;
  }

  .branch-image.symbol img { padding: clamp(1rem, 6vw, 2.5rem); }
  .branch-copy { padding: 3rem 1.35rem 5rem; overflow: visible; }
  .room-label { margin-bottom: 3.5rem; }
  .room-header { margin-bottom: 3rem; }
  .room-header h2 { font-size: clamp(2rem, 9vw, 3.2rem); }
  .branch-text { font-size: 1.08rem; line-height: 1.45; }
  .closing-question { margin-top: 3rem !important; }
  .sentence-pair,
  .ending-pair { margin: 2.5rem 0; }

  .branch-footer {
    min-height: 6rem;
    grid-template-columns: 1fr auto;
    background-size: auto 100svh;
  }

  .room-close { justify-self: end; }
  .semicolon-return { transform: translate(-.5cm, -.2cm); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .room { transition: none; }
  a,
  .word-door { transition: none; }
}

.legal-page {
  min-height: 100svh;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(248, 246, 241, .3), rgba(248, 246, 241, .3)),
    var(--paper-image);
}

.legal-document {
  width: min(100% - 2.7rem, 46rem);
  margin-inline: auto;
  padding: clamp(4rem, 9vh, 7rem) 0 6rem;
  font-weight: 400;
}

.legal-document h1,
.legal-document h2 {
  font-family: "TT2020 Header", "TT2020", "Courier New", monospace;
  font-weight: 400;
  text-transform: none;
}

.legal-document h1 {
  margin: 0 0 4rem;
  font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.7rem);
}

.legal-document h2 {
  margin: 3.2rem 0 1rem;
  font-size: 1.15em;
  text-shadow: .035em 0 rgba(24, 22, 20, .26);
}

.legal-document p,
.legal-document li { letter-spacing: normal; }
.legal-document address { font-style: normal; }
.legal-document .back-mark { margin-top: 5rem; font-size: 3.5rem; line-height: 1; }
