/* A small floating envelope within the hero's normal flow: no overlay on existing charms. */
.jettyroot-page .jr-letter-charm{display:inline-flex;flex-direction:column;align-items:center;gap:.4rem;position:relative;margin:1.35rem 0 0 1rem;padding:.4rem .5rem;border:0;background:transparent;color:var(--jr-cream);cursor:pointer;animation:jr-charm-paper-drift 9.4s ease-in-out infinite;filter:drop-shadow(1px 8px 7px #0007)}
.jr-letter-charm .jr-envelope{position:relative;display:block;width:142px;height:98px;background:linear-gradient(145deg,#e7d4a4,#c5a97a 70%,#967a51);border:1px solid #7d6444;border-radius:2px;transform:rotate(-6deg);box-shadow:inset 0 0 16px #6b42182b,3px 5px 0 #20180f40}
.jr-envelope::before{content:"";position:absolute;inset:0;background:linear-gradient(30deg,transparent 49%,#8a6b442d 50%,transparent 51%),linear-gradient(150deg,transparent 49%,#8a6b442d 50%,transparent 51%);clip-path:polygon(0 30%,50% 73%,100% 30%,100% 100%,0 100%)}
.jr-envelope::after{content:"";position:absolute;left:0;right:0;top:0;height:65%;background:linear-gradient(#eaddb9,#bca072);clip-path:polygon(0 0,100% 0,50% 94%);filter:drop-shadow(0 1px 1px #5a4529)}
.jr-envelope-seal{position:absolute;z-index:2;width:27px;height:27px;left:calc(50% - 13px);top:47%;border-radius:48% 53% 47% 55%;background:radial-gradient(circle at 40% 30%,#b96556,#782d28 72%);border:2px solid #752a24;box-shadow:1px 2px 3px #3221165c}
.jr-letter-caption{font:700 .75rem/1.6 var(--font-mono);letter-spacing:.045em;text-shadow:0 2px 4px #000;max-width:180px;text-align:center}
.jr-letter-charm:hover .jr-envelope,.jr-letter-charm:focus-visible .jr-envelope{transform:rotate(-2deg) translateY(-3px)}

/* JETTYROOT FOUND NOTES — BORDERLESS PAPER READER */

.jr-notes-dialog:not([open]) {
  display: none;
}

.jr-notes-dialog[open] {
  position: fixed;
  inset: 0;
  display: flex;
  width: min(720px, calc(100vw - 1.5rem));
  height: min(92dvh, 960px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  color: #382b1e;
}

.jr-notes-dialog::backdrop {
  background: rgba(5, 9, 6, .83);
  backdrop-filter: blur(3px);
}

.jr-notes-reader,
.jr-notes-archive {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,.45));
}

/* The note itself is the entire reading surface. */

.jr-note-paper {
  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  /* The letter never scrolls vertically; its text flows into horizontal sheets. */
  overflow: hidden;
  overscroll-behavior: none;

  padding:
    clamp(3.2rem, 6vw, 4rem)
    clamp(1.6rem, 6vw, 3.8rem)
    5.5rem;

  border: 0;
  border-radius: 0;

  background-color: #f2e4c4;
  background-image:
    url("/assets/uploads/jettyroot/notes-paper-texture.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  box-shadow:
    inset 0 0 36px rgba(104,75,38,.10);

  clip-path: polygon(
    .5% .6%, 13% 0%, 35% .4%,
    64% 0%, 86% .3%, 99.5% .6%,
    100% 26%, 99.6% 56%,
    100% 83%, 99.2% 99%,
    75% 99.7%, 41% 99.3%,
    14% 100%, .6% 99.3%,
    0% 76%, .4% 46%, 0% 19%
  );
}

/* Letter contents */

.jr-note-entry {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  /* Each browser-created column is one full reading page. */
  column-count: auto;
  column-fill: auto;
  column-gap: 0;
  column-width: var(--jr-note-column-width, 560px);
  scrollbar-width: none;
}
.jr-note-entry::-webkit-scrollbar { display: none; }

/* An explicit [[pagebreak]] forces the next physical sheet.
   All other page breaks are determined by the available paper height. */
.jr-note-prose[data-jr-note-page]:not([data-jr-note-page="1"]) {
  break-before: column;
}

/* Archive lists can grow: allow touch/trackpad movement without a visible bar. */
.jr-note-paper--archive {
  overflow-y: auto;
  scrollbar-width: none;
}
.jr-note-paper--archive::-webkit-scrollbar { display: none; }

.jr-note-entry h2 {
  color: #493727 !important;
  font: 700 clamp(1.7rem, 4vw, 2.4rem)/1.25 Georgia, serif !important;
  margin: 0 0 1rem !important;
}

.jr-note-byline {
  font: .8rem/1.65 var(--font-mono);
  color: #765e45;
  margin-bottom: 2rem !important;
}

.jr-note-prose {
  font: 1.12rem/1.85 Georgia, "Times New Roman", serif;
  color: #34291e;
}

.jr-note-prose p {
  margin: 0 0 1.35rem;
}

.jr-note-prose h2,
.jr-note-prose h3 {
  color: #493727 !important;
  font-size: 1.4rem !important;
  margin: 1.6rem 0 .8rem !important;
}

.jr-note-prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.3rem auto;
}

.jr-note-prose a {
  color: #71462e;
}

.jr-note-prose blockquote {
  margin: 1.3rem 0;
  padding-left: 1rem;
  border-left: 2px solid #a08360;
  font-style: italic;
}

.jr-note-prose pre,
.jr-note-prose table {
  max-width: 100%;
  overflow: auto;
}

.jr-note-prose hr {
  border: 0;
  border-top: 1px solid #a98f6b;
  margin: 1.6rem 0;
}

.jr-note-prose ul,
.jr-note-prose ol {
  padding-left: 1.5rem;
}

/* Navigation: no bezel, borders or solid backgrounds */

.jr-note-controls {
  position: absolute;
  z-index: 4;
  left: 1.6rem;
  right: 1.6rem;
  bottom: .8rem;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .6rem;

  background: transparent;
  border: 0;
  padding: 0;
}

.jr-note-control-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .65rem;
}

.jr-note-controls > button:first-child {
  justify-self: start;
}

.jr-note-controls > button:last-child {
  justify-self: end;
}

.jr-note-text-control,
.jr-note-count {
  position: relative;
  isolation: isolate;
  font: .8rem/1.5 var(--font-mono);
  letter-spacing: .02em;
  color: #513a2b;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: .45rem .55rem;
  text-decoration: none;
  white-space: nowrap;
}

.jr-note-text-control {
  cursor: pointer;
  min-height: 36px;
}

/* Soft feathered highlight behind the labels. */

.jr-note-text-control::before,
.jr-note-count::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -.2rem -.55rem;

  background: radial-gradient(
    ellipse at center,
    rgba(247,232,200,.97) 0%,
    rgba(247,232,200,.84) 37%,
    rgba(247,232,200,.42) 62%,
    rgba(247,232,200,0) 82%
  );

  filter: blur(5px);
}

.jr-note-text-control:hover {
  color: #8a3e2b;
  text-decoration: underline;
}

.jr-note-text-control:disabled {
  opacity: .35;
  cursor: default;
  text-decoration: none;
}

.jr-note-count {
  min-width: 3ch;
  text-align: center;
}

/* A contextual breadcrumb appears only when another letter can be resumed. */
.jr-note-resume {
  position: absolute;
  z-index: 10;
  top: .6rem;
  left: .8rem;
}

/* Close is only floating text at the top-right. */

.jr-note-close {
  position: absolute;
  z-index: 10;
  top: .6rem;
  right: .8rem;
}

/* Archive — same physical paper, no boxed cards */

.jr-notes-archive h2 {
  color: #493727;
  font: 700 clamp(1.7rem, 4vw, 2.3rem)/1.3 Georgia, serif;
  margin: 0 0 1.8rem;
}

.jr-note-archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.jr-note-archive-list button {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;

  color: #493727;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(91,69,44,.3);
  padding: .8rem .2rem;

  font: 1.1rem/1.5 Georgia, serif;
}

.jr-note-archive-list button:hover {
  color: #8a3e2b;
}

.jr-note-archive-list button span {
  display: block;
  font: .75rem/1.5 var(--font-mono);
  color: #78634c;
  margin-top: .3rem;
}

.jr-note-archive-back {
  position: absolute;
  z-index: 4;
  bottom: .8rem;
  left: 50%;
  transform: translateX(-50%);
}

.jr-notes-dialog [hidden] {
  display: none !important;
}

.jettyroot-page .jr-notes-dialog :focus-visible {
  outline: 2px solid #92523c;
  outline-offset: 3px;
}

/* Mobile */
@media (max-width: 640px) {
  .jettyroot-page .jr-letter-charm {
    margin: 1.3rem 0 .7rem;
    align-items: center;
  }

  .jr-notes-dialog[open] {
    width: calc(100vw - .5rem);
    height: calc(100dvh - .5rem);
  }

  .jr-note-paper {
    padding: 3.2rem 1.3rem 5.5rem;
  }

  .jr-note-prose {
    font-size: 1.03rem;
    line-height: 1.75;
  }

  .jr-note-controls {
    left: .7rem;
    right: .7rem;
    bottom: .55rem;
    gap: .2rem;
  }

  .jr-note-control-center {
    gap: .25rem;
  }

  .jr-note-text-control,
  .jr-note-count {
    font-size: .76rem;
    padding: .4rem .3rem;
  }

  .jr-note-close {
    top: .45rem;
    right: .45rem;
  }

  .jr-note-resume {
    top: .45rem;
    left: .45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jettyroot-page .jr-letter-charm {
    animation: none;
  }
}

