html:has(body.jdm-page) { height: auto; overflow: visible; }
html:has(.jdm-page dialog[open]) { overflow: hidden; }
body.jdm-page {
  --bg: #100e0f;
  --panel: #1c171a;
  --line: #403439;
  --accent: #d7a6b6;
  --muted: #c7babd;
  --ink: #f6efeb;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
}
body.jdm-page main#page, body.jdm-page .page-inner {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  background: var(--bg);
  overflow: visible;
}
.jdm-page .site-footer { min-height: 64px; margin-bottom: 0; }
.jdm { --gutter: clamp(20px, 7vw, 104px); }
.jdm h1, .jdm h2, .jdm h3, .jdm p, .jdm figure { margin: 0; }
.jdm h1 { font-size: clamp(2.65rem, 8vw, 8rem); line-height: .85; font-weight: 900; letter-spacing: -.085em; }
.jdm h2 { font-size: clamp(2rem, 5vw, 5rem); line-height: 1; letter-spacing: -.055em; }
.jdm h3 { font-size: clamp(1.45rem, 3vw, 2.75rem); line-height: 1; letter-spacing: -.04em; }
.jdm img { display: block; width: 100%; height: auto; }
.jdm-hero { background: var(--bg); }
html:has(body.jdm-page) { scrollbar-width: none; }
.jdm-hero img { max-height: max(210px, calc(100svh - 230px)); object-fit: contain; object-position: top center; }
.jdm-section { max-width: 1550px; margin: auto; padding: clamp(32px, 4.5vw, 72px) var(--gutter); }
.jdm .jdm-kicker {
  color: var(--accent);
  font: 650 .73rem/1.4 ui-monospace, monospace;
  letter-spacing: .14em;
}
.jdm .jdm-prose { color: var(--muted); max-width: 55ch; font-size: clamp(1rem, 1.35vw, 1.2rem); }
.jdm-era { padding-top: clamp(22px, 2.5vw, 40px); }
.jdm-era h1 { margin: 12px 0 24px; }
.jdm-era h2 { font-size: clamp(1.6rem, 3vw, 3rem); }
.jdm-era .jdm-prose, .jdm-close .jdm-prose { margin-top: 18px; }
.jdm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.jdm-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #77746d;
  color: #f6f4ef;
  text-decoration: none;
  font-weight: 650;
}
.jdm-primary { color: #151413; background: #e5e1d8; border-color: #e5e1d8; }
.jdm-advisor {
  border: 0;
}
.jdm-button:is(:hover,:focus-visible) { background: #e3bcc9; color: #22171c; }
.jdm-chapters { max-width: 1800px; margin-inline: auto; }
.jdm-chapter { margin-bottom: clamp(10px, 1.6vw, 24px); }
.jdm-chapter img { aspect-ratio: 2 / 1; object-fit: cover; mask-image: linear-gradient(#000 83%, transparent); }
.jdm-caption { padding: clamp(20px, 3vw, 42px) var(--gutter); }
.jdm-chapter .jdm-caption { padding: 8px var(--gutter) 24px; }
.jdm-chapter h2 { font-size: clamp(2rem, 3.5vw, 4.5rem); }
.jdm-caption :is(h2,h3) { margin: 10px 0; }
.jdm-groups { background: #181416; }
.jdm-groups > .jdm-section { padding-bottom: 28px; }
.jdm-groups h2 { margin-top: 14px; }
.jdm .jdm-group { padding-bottom: clamp(8px, 1.5vw, 22px); }
.jdm-group img { aspect-ratio: 3 / 1; max-height: 75svh; object-fit: contain; mask-image: linear-gradient(transparent, #000 8% 90%, transparent); }
.jdm-close { border-top: 1px solid var(--line); }
.jdm-page #ltr-consultant-dialog { width: min(520px, calc(100% - 24px)); max-height: 90dvh; padding: 12px; border: 1px solid #5d504a; background: var(--panel); color: #f4f3ef; overflow: auto; }
.jdm-page #ltr-consultant-dialog::backdrop { background: #080807c4; }
.jdm-page #ltr-consultant-dialog .consultant { position: static; width: auto; max-width: none; margin: 0; background: var(--panel); }
.jdm-page #ltr-consultant-dialog #messages { max-height: 42dvh; }
.jdm-page .ltr-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.jdm-page .ltr-dialog-heading h2 { margin: 0; font-size: 1.1rem; }
.jdm-story-link {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  min-height: 44px;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.jdm .jdm-advisor {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 11;
  padding-inline: 14px;
  background: transparent;
  text-shadow: 0 1px 4px #100e0f;
}
.jdm .jdm-advisor:is(:hover, :focus-visible) { background: transparent; color: var(--accent); }
.jdm-sakura { color: var(--accent); }
.jdm-page:has(#ltr-consultant-dialog[open]) .jdm-advisor { visibility: hidden; }
.jdm-page .site-footer { padding-right: max(110px, calc(92px + env(safe-area-inset-right))); }
.jdm-close { padding-bottom: max(100px, calc(84px + env(safe-area-inset-bottom))); }
@media (min-width: 980px) {
  .jdm-chapter {
    display: grid;
    grid-template-columns: minmax(0, 30fr) minmax(0, 12fr) minmax(0, 58fr);
    align-items: center;
  }
  .jdm-chapter img { grid-column: 2 / 4; grid-row: 1; mask-image: linear-gradient(90deg, transparent, #000 27% 95%, transparent); }
  .jdm-chapter .jdm-caption { grid-column: 1 / 3; grid-row: 1; z-index: 1; padding: 22px clamp(40px, 6vw, 108px) 22px var(--gutter); }
  .jdm-chapter:nth-child(even) { grid-template-columns: minmax(0, 58fr) minmax(0, 12fr) minmax(0, 30fr); }
  .jdm-chapter:nth-child(even) img { grid-column: 1 / 3; mask-image: linear-gradient(270deg, transparent, #000 27% 95%, transparent); }
  .jdm-chapter:nth-child(even) .jdm-caption { grid-column: 2 / 4; padding-inline: clamp(40px, 6vw, 108px) var(--gutter); }
}
@media (max-width: 600px) {
  .jdm-group img { max-height: 55svh; }
  .jdm .jdm-advisor { right: max(8px, env(safe-area-inset-right)); }
  .jdm-story-link { max-width: calc(100% - 68px); }
}

.jdm .jdm-prose { font-size: clamp(1.08rem, 1.5vw, 1.28rem); line-height: 1.6; }
.jdm-story-link { font-size: 1.04rem; }
.jdm .jdm-advisor { flex-direction: column; gap: 1px; padding-block: 7px; }
.jdm-advisor .jdm-sakura { width: 38px; height: 38px; object-fit: contain; }
