/* The diary looks out from Raven Hill over Seal Bay at night. */
body[data-view="devlog"], body[data-view="post"]:has(#post-content[data-kind="devlog"]:not([hidden])) {
  isolation: isolate;
  background-color: #112838;
}
body[data-view="devlog"]::before, body[data-view="post"]:has(#post-content[data-kind="devlog"]:not([hidden]))::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgb(7 20 36 / 64%) 0 clamp(16rem, 38vh, 24rem), transparent 75%, rgb(8 22 37 / 46%)),
    url('assets/chronicle/raven-hill.webp') 49% center / cover no-repeat;
}
#devlog .inner-banner::before { content: none; }
#devlog-title { text-shadow: 0 2px 4px #0b1c30; }
#devlog :is(.author-link, .status:not(:empty)), .article-page:has(#post-content[data-kind="devlog"]:not([hidden])) #post-back {
  width: fit-content;
  padding-inline: .65rem;
  border-radius: .25rem;
  background: rgb(8 24 39 / 85%);
}
/* Both home previews use a heading above the landscape and a permanent link below it. */
.chronicle-feature {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  container-type: inline-size;
}
.chronicle-feature h2 { margin: 0 0 .6rem; font-size: clamp(1.45rem, 3vw, 2rem); }
.chronicle-scene {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 10.25rem;
}
.chronicle-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--scene) center / cover no-repeat;
  mask-image: linear-gradient(to right, transparent, black 4% 96%, transparent),
    linear-gradient(to bottom, transparent, black 8% 89%, transparent);
  mask-composite: intersect;
  image-rendering: pixelated;
}
.chronicle-scene--diary {
  --scene: url('assets/chronicle/raven-hill.webp');
  align-content: center;
  padding: clamp(1rem, 3.25cqw, 1.65rem);
}
.chronicle-scene--roadmap { --scene: url('assets/roadmap/mirholm-valley-mobile.webp'); }
.chronicle-scene--roadmap::before { background-size: 100% 400%; background-position: center 33.333333%; }
.chronicle-scene--roadmap :is(#home-roadmap, .atlas-roadmap, .atlas-trail) { display: grid; }
.chronicle-scene .status { margin-inline: 1.1rem; }
.chronicle-more { width: fit-content; margin-top: .2rem; font-size: 1rem; }
@container (min-width: 40rem) {
  .chronicle-scene--roadmap { --scene: url('assets/roadmap/mirholm-valley.webp'); }
  .chronicle-scene--diary #home-devlog { width: min(100%, 39rem); justify-self: center; }
}
@container (max-width: 25rem) {
  .chronicle-scene--diary { padding-inline: .625rem; }
  /* On small screens the mill is beside the heading at 4.75rem. Its road is 37.5% down the 228 × 720 map. */
  .chronicle-scene--roadmap::before { background-size: 100% auto; background-position: center calc(4.75rem - 118.42cqw); }
}
@media (max-width: 44rem) {
  body[data-view="devlog"]::before, body[data-view="post"]:has(#post-content[data-kind="devlog"]:not([hidden]))::before {
    background-position: center, 28% center;
  }
}

/* The eight-color paper tile comes from the common castle card. */
.journal-scroll, #post-content[data-kind="devlog"] {
  --ink: #302115;
  --faded-ink: #4c341d;
  --inset: clamp(1.125rem, 3.5vw, 2.75rem);
  position: relative;
  min-width: 0;
  margin-inline: .65rem;
  padding-block: .6875rem;
  color: var(--ink);
  background:
    linear-gradient(90deg, #89654259 0 2px, transparent 2px calc(100% - 3px), #75502c58 calc(100% - 3px)),
    url('assets/chronicle/parchment.webp') 0 0 / 384px 321px repeat, #d7c4ab;
  image-rendering: pixelated;
  box-shadow: 3px 3px #704c2f, 6px 7px #0b121680;
}
.journal-scroll { container-type: inline-size; }
.journal-scroll::before, .journal-scroll::after,
#post-content[data-kind="devlog"]::before, #post-content[data-kind="devlog"]::after {
  content: '';
  position: absolute;
  z-index: 1;
  pointer-events: none;
  inset-inline: -.6rem;
  height: 1rem;
  /* Hard color bands form the spindle, brass ferrules and rolled paper. */
  background:
    linear-gradient(90deg,
      #513622 0 3px, #a77542 3px 6px, #70482a 6px 9px, #d4a450 9px 12px, #614126 12px 15px, transparent 15px calc(100% - 15px),
      #614126 calc(100% - 15px) calc(100% - 12px), #d4a450 calc(100% - 12px) calc(100% - 9px),
      #70482a calc(100% - 9px) calc(100% - 6px), #a77542 calc(100% - 6px) calc(100% - 3px), #513622 calc(100% - 3px)),
    linear-gradient(#835f3b 0 12%, #e8cca5 12% 29%, #f3dcba 29% 46%, #d3b28a 46% 65%, #b48f63 65% 82%, #7b5735 82%);
  clip-path: polygon(0 6px, 3px 6px, 3px 3px, 9px 3px, 9px 0, calc(100% - 9px) 0, calc(100% - 9px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px,
    100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 9px) calc(100% - 3px), calc(100% - 9px) 100%, 9px 100%, 9px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px));
}
.journal-scroll::before, #post-content[data-kind="devlog"]::before { top: -.25rem; }
.journal-scroll::after, #post-content[data-kind="devlog"]::after { bottom: -.29rem; }
.scroll-summary {
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .15rem clamp(.75rem, 2.6cqw, 1.4rem);
  min-height: 4rem;
  padding: clamp(.75rem, 2.6cqw, 1.3125rem) var(--inset);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  list-style: none;
}
.scroll-summary::-webkit-details-marker { display: none; }
.scroll-summary:focus-visible { outline: 3px dashed #724127; outline-offset: -.65rem; }
.scroll-heading { min-width: 0; }
.scroll-byline { display: block; margin-bottom: .2rem; color: var(--faded-ink); font-size: .82rem; }
.scroll-title { display: block; overflow-wrap: anywhere; font: 400 clamp(1.35rem, 3.75cqw, 2rem)/1.15 var(--font-ui); }
.scroll-action { color: var(--faded-ink); font: .92rem/1.4 var(--font-ui); text-decoration: underline; text-underline-offset: 3px; }
.scroll-action .roll, .journal-scroll[open] .unroll { display: none; }
.journal-scroll[open] .roll { display: inline; }
.scroll-summary:hover .scroll-action, .scroll-summary:focus-visible .scroll-action { color: #712b1e; }
.scroll-seal {
  position: relative;
  width: 40px;
  height: 50px;
  background: linear-gradient(90deg, #713023 0 18%, #b75840 18% 35%, #923a2d 35% 72%, #642b27 72%) center bottom / 24px 22px no-repeat;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 26px 100%, 26px calc(100% - 3px), 22px calc(100% - 3px), 22px calc(100% - 6px), 18px calc(100% - 6px), 18px calc(100% - 3px), 14px calc(100% - 3px), 14px 100%, 0 100%);
}
.scroll-seal::before, .scroll-seal::after { content: ''; position: absolute; }
.scroll-seal::before {
  inset: 0 0 auto;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #bd6747 0 26%, #a84834 26% 39%, #91392b 39% 76%, #733023 76%);
  box-shadow: inset 0 4px #e49568, inset 0 -5px #60261e;
  clip-path: polygon(0 9px, 3px 9px, 3px 6px, 6px 6px, 6px 3px, 12px 3px, 12px 0, 28px 0, 28px 3px, 34px 3px, 34px 6px, 37px 6px, 37px 9px, 40px 9px, 40px 31px, 37px 31px, 37px 34px, 34px 34px, 34px 37px, 28px 37px, 28px 40px, 12px 40px, 12px 37px, 6px 37px, 6px 34px, 3px 34px, 3px 31px, 0 31px);
}
.scroll-seal::after {
  top: 8px; left: 8px;
  width: 24px; height: 24px;
  background: #ffe6ac;
  mask: url('assets/game-star.png') center / contain no-repeat;
}
.scroll-sheet { padding: 0 var(--inset) clamp(1rem, 2.5cqw, 1.6rem); overflow-wrap: anywhere; }
.scroll-sheet::before { content: ''; display: block; height: 2px; margin-bottom: .75rem; background: repeating-linear-gradient(90deg, #8e704e80 0 4px, transparent 4px 8px); }
.scroll-text, #post-content[data-kind="devlog"] .post-body { color: var(--ink); white-space: pre-wrap; max-width: 66ch; font: 1.125rem/1.5 var(--font-ui); }
.scroll-cover, #post-content[data-kind="devlog"] img { image-rendering: auto; }
.scroll-cover { max-height: 21rem; width: auto; margin-bottom: 1rem; }
.scroll-status { display: block; color: var(--faded-ink); font-size: .875rem; margin-top: .5rem; }
.scroll-status:empty { display: none; }
.scroll-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: .35rem; color: #462b18; text-decoration: underline; text-underline-offset: .23em; text-decoration-color: #895f37; }
.scroll-link:focus-visible { outline-color: var(--faded-ink); }
.scroll-link:hover { color: var(--ink); }
.compact-scroll { --inset: clamp(1rem, 2.5vw, 1.8rem); }
#post-content[data-kind="devlog"] { padding: clamp(1.75rem, 4vw, 3.25rem) var(--inset); }
#post-content[data-kind="devlog"] .eyebrow { color: var(--faded-ink); }
#post-content[data-kind="devlog"] h1 { font-size: clamp(1.95rem, 3.8vw, 3.25rem); }

body[data-motion="on"] .journal-scroll[open] .scroll-seal { animation: wax-lift .32s steps(1, end); }
body[data-motion="on"] .journal-scroll[open]::after { animation: spindle-turn .42s steps(1, end); }
@keyframes wax-lift { 25% { transform: translateY(-4px); } 65% { transform: translateY(-2px); } }
@keyframes spindle-turn { 18%, 65% { transform: scaleY(.72); } 38%, 84% { transform: scaleY(.9); } }
@supports (interpolate-size: allow-keywords) and selector(details::details-content) {
  body[data-motion="on"] .journal-scroll::details-content {
    interpolate-size: allow-keywords;
    height: 0;
    overflow: clip;
    transition: height .42s cubic-bezier(.24,.82,.28,1), content-visibility .42s allow-discrete;
  }
  body[data-motion="on"] .journal-scroll[open]::details-content { height: auto; }
}
@supports not ((interpolate-size: allow-keywords) and selector(details::details-content)) {
  body[data-motion="on"] .journal-scroll[open] .scroll-sheet { animation: unroll-sheet .34s ease-out both; }
  @keyframes unroll-sheet { from { clip-path: inset(0 0 100%); } to { clip-path: inset(0); } }
}
@container (max-width: 26rem) {
  .scroll-summary { grid-template-columns: auto minmax(0, 1fr); column-gap: .625rem; }
  .scroll-seal { grid-row: span 2; }
  .scroll-action { grid-column: 2; }
}
@media (min-width: 90rem) and (min-aspect-ratio: 2/1) {
  #devlog {
    width: min(calc(100% - 2 * var(--edge)), 94rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 50rem);
    column-gap: clamp(3rem, 5vw, 7rem);
    align-content: start;
    align-items: start;
    padding-top: clamp(4rem, 10svh, 9rem);
  }
  #devlog .inner-banner { padding-top: 0; }
  #devlog .journal-desk { margin: 0; }
}
@media (forced-colors: active) {
  .journal-scroll, #post-content[data-kind="devlog"] { border: 1px solid CanvasText; }
  .scroll-summary:focus-visible, .scroll-link:focus-visible { outline-color: Highlight; }
}
