/* A two-board field journal. The left board hinges at the middle of the spread. */
.field-tools button.notebook-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 43px;
  padding-inline: 7px 10px;
}
.notebook-trigger .notebook-icon {
  display: block;
  flex: none;
  width: 29px;
  height: 32px;
  overflow: visible;
  filter: drop-shadow(1px 1px #1e2c24);
}
.notebook-trigger[aria-expanded="true"] .notebook-icon { opacity: .24; }
.notebook-trigger-label {
  font: normal 13px/1.1 var(--pixel, monospace);
  color: #f7e6b7;
  text-shadow: 1px 1px #2c382b;
}

dialog.notebook-dialog,
body.field-mode dialog.notebook-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: #3d3525;
}
dialog.notebook-dialog[open] {
  display: grid;
  place-items: center;
}
dialog.notebook-dialog::backdrop,
body.field-mode dialog.notebook-dialog::backdrop { background: transparent; }
body:has(.notebook-dialog[open]) { overflow: hidden; }
.notebook-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 46%, #27332679, #162321c9);
}
.notebook-position {
  position: relative;
  width: min(880px, calc(100% - 76px));
  height: clamp(325px, 65vh, 585px);
  height: clamp(230px, 65svh, 585px);
  max-height: calc(100% - 72px);
  pointer-events: none;
}
.notebook-flight, .notebook-spread {
  position: absolute;
  inset: 0;
}
.notebook-flight { transform-origin: 75% 50%; }
.notebook-spread {
  perspective: 2000px;
  perspective-origin: 50% 47%;
  transform-style: preserve-3d;
}
.notebook-wing, .notebook-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
}
.notebook-right { left: 50%; }
.notebook-wing {
  left: 0;
  z-index: 2;
  transform-origin: 100% 50%;
  transform-style: preserve-3d;
}
.notebook-paper, .notebook-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-sizing: border-box;
}
.notebook-paper {
  --line: 28px;
  --padding-x: clamp(18px, 3.3vw, 47px);
  overflow: hidden;
  border: 1px solid #a88f63;
  background-color: #f3e2af;
  background-image:
    linear-gradient(90deg, transparent calc(var(--padding-x) - 9px), #b8775a66 calc(var(--padding-x) - 9px) calc(var(--padding-x) - 8px), transparent calc(var(--padding-x) - 8px)),
    repeating-linear-gradient(0deg, transparent 0 calc(var(--line) - 1px), #929c8378 calc(var(--line) - 1px) var(--line));
  background-position: 0 0, 0 13px;
  pointer-events: auto;
}
.notebook-paper::before, .notebook-paper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.notebook-paper::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9'%3E%3Cpath fill='%236a522611' d='M2 1h1v1H2zM6 6h1v1H6z'/%3E%3Cpath fill='%23fff4c62e' d='M0 5h1v1H0zM7 2h1v1H7z'/%3E%3C/svg%3E");
}
.notebook-paper-left {
  border-radius: 5px 6% 1.5% 5px / 5px 1.5% 1% 5px;
  box-shadow: -2px 2px #d5bf81, -3px 3px #ae9969, -4px 4px #dfca91, -5px 5px #b6a16b,
    -7px 6px #3c503d, -8px 8px #253a2d, -10px 13px 17px #1c211a48;
}
.notebook-paper-right {
  border-radius: 3% 5px 5px 2% / 1.5% 5px 5px 1.5%;
  background-color: #f3e4b6;
  box-shadow: 2px 2px #ddc990, 3px 3px #ae986a, 4px 4px #dfca91, 5px 5px #b6a16b,
    7px 6px #3c503d, 8px 8px #253a2d, 10px 13px 17px #1c211a58;
}
.notebook-paper-left::after {
  background: linear-gradient(90deg, #88733d10, transparent 8%, #fff0bf26 68%, #ddc28c11 84%, #765d2e49 98.8%, #72552b70 100%);
}
.notebook-paper-right::after {
  background: linear-gradient(90deg, #65482375, #baa16b48 3%, #fff1c344 11%, transparent 22%, transparent 90%, #a3895226);
}
.notebook-sheet {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4.8vh, 48px) var(--padding-x) clamp(20px, 3vh, 32px);
}
.notebook-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #9a8c60 transparent;
  scrollbar-width: thin;
  padding: 0 3px 4px 0;
}
.notebook-pagehead { margin: 0 0 19px; }
.notebook-dialog .notebook-kicker {
  margin: 0 0 7px;
  color: #625939;
  font: 700 10px/1.4 var(--mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.notebook-dialog .notebook-pagehead h2, .notebook-dialog .notebook-pagehead h3 {
  margin: 0;
  color: #344737;
  font: normal clamp(26px, 3.5vw, 48px)/1.06 Georgia, 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: -.055em;
}
.notebook-dialog .notebook-prompt {
  margin: 0 0 17px;
  color: #5e513a;
  font: italic clamp(15px, 1.45vw, 20px)/1.35 Georgia, serif;
  overflow-wrap: anywhere;
}
.notebook-dialog .notebook-index {
  display: grid;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.notebook-index button {
  display: flex;
  width: 100%;
  align-items: baseline;
  gap: 10px;
  padding: 7px 8px;
  min-height: 35px;
  border: 1px solid transparent;
  background: transparent;
  color: #413826;
  cursor: pointer;
  text-align: left;
}
.notebook-index button[aria-pressed=true] {
  background: #c5a34c40;
  border-color: #9985496b;
  box-shadow: inset 2px 0 #9e7747;
}
.notebook-index button:hover { background-color: #bd9f4936; }
.notebook-entry-number {
  flex: 0 0 auto;
  color: #78623e;
  font: 700 11px/1.4 var(--mono, monospace);
}
.notebook-entry-word {
  font: 600 clamp(15px, 1.6vw, 22px)/1.24 Georgia, serif;
  overflow-wrap: anywhere;
}
.notebook-dialog .notebook-word {
  margin: 0 0 13px;
  color: #463b28;
  font: bold clamp(21px, 2.4vw, 33px)/1.08 Georgia, serif;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.notebook-dialog .notebook-correction {
  margin: -6px 0 11px;
  color: #6b5c42;
  font: normal 12px/1.35 var(--body, sans-serif);
  overflow-wrap: anywhere;
}
.notebook-dialog .notebook-clue, .notebook-dialog .notebook-needle, .notebook-dialog .notebook-empty,
.notebook-dialog .notebook-empty-index {
  margin: 0;
  color: #514631;
  font: normal clamp(17px, 1.7vw, 23px)/1.46 Georgia, serif;
  overflow-wrap: anywhere;
}
.notebook-dialog .notebook-empty, .notebook-dialog .notebook-empty-index {
  font-style: italic;
  color: #706147;
}
.notebook-dialog .notebook-empty-index:empty { display: none; }
.notebook-dialog .notebook-points {
  margin: 17px 0 0;
  color: #5c5438;
  font: 700 11px/1.7 var(--mono, monospace);
}
.notebook-awards {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 5px 4px;
  margin: 5px 0 0;
  color: #4b4533;
  font: 14px/1.3 Georgia, serif;
  overflow-wrap: anywhere;
}
.notebook-awards dd { margin: 0; color: #405438; font-weight: bold; text-align: right; }
.notebook-collected {
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #a8915b80;
}
.notebook-collected[hidden] { display: none; }
.notebook-collected-heading {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 8px;
}
.notebook-dialog .notebook-collected h4 {
  margin: 0;
  color: #344737;
  font: bold clamp(13px, 1.5vw, 18px)/1.2 Georgia, serif;
}
.notebook-letter-count {
  color: #75603b;
  font: 700 11px/1.2 var(--mono, monospace);
}
.notebook-collected-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}
.notebook-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 4px;
  min-height: 28px;
  max-height: min(116px, 24svh);
  padding: 12px 2px 3px;
  margin-top: -12px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #9a8c60 transparent;
}
.notebook-letter {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 26px;
  color: #514631;
  font: 700 21px/1 var(--pixel, monospace);
}
.notebook-letter.clue-initial { color: #116037; }
.notebook-dialog .notebook-no-letters {
  margin: 0;
  align-self: center;
  font: italic 13px/1.4 Georgia, serif;
  color: #706147;
}
.notebook-shuffle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 6px;
  border: 1px solid #8a794c;
  border-radius: 2px;
  box-shadow: 1px 2px #b29c65;
  color: #405438;
  background: #e8d59b;
  cursor: pointer;
}
.notebook-shuffle svg { width: 19px; height: 19px; }
.notebook-shuffle:hover:not(:disabled) { background: #f3e2b1; }
.notebook-shuffle:disabled { opacity: .42; cursor: default; }
.notebook-front {
  display: grid;
  place-items: center;
  overflow: visible;
  transform: rotateY(180deg) translateZ(1px);
  border: 3px solid #2a3b2e;
  border-radius: 3px 5px 5px 3px;
  color: #edd187;
  background:
    repeating-linear-gradient(30deg, transparent 0 3px, #acb18c12 3px 4px),
    linear-gradient(90deg, #213a2e 0%, #38523e 3.3%, #51694f 4.4%, #3e5845 5.5%, #293e31 8%,
      #b4a260 8.4%, #52684b 8.8%, #556c4f 9%, #3d5845 11%, #374e3b 80%, #2c4535 100%);
  box-shadow: inset 0 2px #92a07a, inset 0 -3px #233a2b, 1px 2px #c4ad74, 3px 4px #8e794f, 4px 5px #324736,
    7px 10px 20px #21271d68;
  pointer-events: auto;
}
.notebook-cover-frame {
  position: absolute;
  inset: 6% 6% 6% 14%;
  border: 1px solid #c4ae6b;
  outline: 1px solid #a79d647a;
  outline-offset: -5px;
}
.notebook-cover-title {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding-left: 6%;
  color: #f0d991;
  text-align: center;
  text-shadow: 1px 2px #23382c;
  font: normal clamp(21px, 3.7vw, 48px)/1.13 var(--pixel, monospace);
}
.notebook-cover-title svg { display: block; width: 37%; max-width: 66px; }
.notebook-ribbon {
  position: absolute;
  bottom: -15px;
  right: 12%;
  width: 18px;
  height: 17px;
  background: #ad633d;
  clip-path: polygon(0 0,100% 0,100% 100%,50% 73%,0 100%);
}
.notebook-close {
  position: absolute;
  top: -17px;
  right: -15px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid #273c2e;
  box-shadow: inset 0 1px #8b9d78, 2px 3px #252d22a6;
  background: #3c5340;
  color: #fff0bf;
  cursor: pointer;
  pointer-events: auto;
}
.notebook-close:hover { background: #53694e; }
.notebook-close svg { width: 14px; height: 14px; }
.notebook-dialog :focus-visible { outline: 3px solid #9d6d2c; outline-offset: 2px; }
.notebook-dialog .notebook-close:focus-visible { outline-color: #f3d190; }

@media(max-width: 600px) {
  .field-tools button.notebook-trigger { padding-inline: 4px 7px; gap: 3px; }
  .notebook-trigger .notebook-icon { width: 25px; height: 28px; }
  .notebook-trigger-label { font-size: 11px; }
  .notebook-position { width: calc(100% - 26px); height: clamp(310px, 65svh, 485px); }
  .notebook-paper { --line: 24px; --padding-x: clamp(10px, 4vw, 21px); }
  .notebook-sheet { padding-top: 24px; }
  .notebook-paper-right .notebook-sheet { padding-left: calc(var(--padding-x) + 2px); }
  .notebook-dialog .notebook-kicker { font-size: 9px; letter-spacing: .035em; }
  .notebook-dialog .notebook-pagehead h2, .notebook-dialog .notebook-pagehead h3 { font-size: clamp(23px, 6.7vw, 33px); }
  .notebook-pagehead { margin-bottom: 15px; }
  .notebook-dialog .notebook-prompt { font-size: 14px; margin-bottom: 12px; }
  .notebook-index button { padding: 6px 3px; gap: 5px; min-height: 36px; }
  .notebook-entry-number { font-size: 10px; }
  .notebook-entry-word { font-size: 15px; }
  .notebook-dialog .notebook-word { font-size: 22px; }
  .notebook-dialog .notebook-clue, .notebook-dialog .notebook-needle, .notebook-dialog .notebook-empty,
  .notebook-dialog .notebook-empty-index { font-size: 16px; }
  .notebook-dialog .notebook-points { font-size: 10px; }
  .notebook-collected { margin-top: 9px; padding-top: 8px; }
  .notebook-collected-heading { gap: 5px; margin-bottom: 6px; }
  .notebook-collected-content { gap: 5px; }
  .notebook-letter { min-width: 15px; height: 22px; font-size: 19px; }
  .notebook-letters { gap: 4px 3px; }
  .notebook-close { right: 0; top: -17px; }
}
@media(max-height: 470px) {
  .notebook-position { height: calc(100% - 46px); max-height: calc(100% - 46px); }
  .notebook-sheet { padding-top: 13px; padding-bottom: 10px; }
  .notebook-pagehead { margin-bottom: 8px; }
  .notebook-dialog .notebook-pagehead h2, .notebook-dialog .notebook-pagehead h3 { font-size: 23px; }
}
