/* Museum responsive reading safeguards.
   Load after all Museum preview styles. Scope is generated Museum UI and
   public source-reader layout. Wrap prose; do not hide overflowing evidence. */
@media screen {
  /* Several old source documents have no global border-box reset. The welcome
     card and new UI must still include their padding in their declared width. */
  :is(.museum-welcome, .museum-welcome-card, .museum-issue-hub,
      .museum-issue-hub *, .museum-issue-hub *::before, .museum-issue-hub *::after,
      .museum-claim-issue-entry, .museum-claim-source-notes,
      .museum-issue-breadcrumb, .museum-main-navigation, .museum-main-choice) {
    box-sizing: border-box;
  }

  /* Grid/flex descendants may otherwise retain their long-word min-content
     width. Existing minmax(0,1fr) columns alone do not wrap their own text. */
  body :is(.museum-issue-hub-header, .museum-issue-directory,
           .museum-issue-grid, .museum-exhibit-grid, .museum-exhibit-entry,
           .museum-exhibit-open, .museum-exhibit-children,
           .museum-issue-resource-links, .museum-life-latest,
           .museum-life-chapter, .museum-wide-record,
           .museum-latest-entry, .museum-current-account,
           .museum-sorted-source-group, .museum-sorted-source,
           .museum-issue-correspondence, .museum-issue-comparisons,
           .museum-issue-coverage, .museum-source-qualification) {
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body :is(.museum-issue-grid, .museum-exhibit-grid,
           .museum-issue-resource-links, .museum-exhibit-children nav) > * {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  /* Current latest-record blockquotes lack the wrapping rule already present
     on museum-sorted-source blockquotes. Retained sources include URL tokens
     up to 1,973 characters, so normal space wrapping is insufficient. */
  body .museum-issue-hub :is(h1,h2,h3,h4,p,blockquote,summary,a,time,small,strong,dt,dd),
  body .museum-claim-issue-entry :is(h2,p,a),
  body .museum-claim-source-notes :is(summary,p,a),
  body .museum-issue-breadcrumb :is(a,strong) {
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  body .museum-issue-hub :is(pre,blockquote),
  body .museum-reading-content pre {
    max-inline-size: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  /* Display:table section headings can grow to intrinsic content width.
     Preserve the compact heading sheet while allowing it to wrap. */
  body .museum-exhibit-group > h2,
  body .museum-sorted-source-group > h2 {
    display: block;
    inline-size: fit-content;
    max-inline-size: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
  }

  /* Original source-reader titles, author labels and summaries vary by source
     template. Keep their text inside the reading sheet on every template. */
  body .museum-reading-content :is(main,header,article,section,aside,details,nav),
  body .museum-reading-content :is(h1,h2,h3,h4,p,summary,blockquote,dt,dd,a,code,small,time) {
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body .museum-reading-content :is(h1,h2,h3,h4,p,summary,blockquote,dt,dd,a,code,small,time) {
    overflow-wrap: anywhere;
    word-break: normal;
  }
  body .museum-reading-content :is(img,svg,video,iframe) {
    max-inline-size: 100%;
  }
  body .museum-reading-content img { block-size:auto; }
  body .museum-reading-content table {
    display:block;
    max-inline-size:100%;
    overflow-x:auto;
  }

  /* Reader toolbar and dialog title cells need to shrink before long labels
     force the whole panel wider. Keep button labels readable by wrapping. */
  body :is(.reader-toolbar,.reader-share-toolbar,.museum-dialog-header,
           .reading-space-header,.evidence-export-header,.email-reader-topline) > * {
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body :is(.reader-toolbar,.reader-share-toolbar) :is(button,select),
  body :is(.museum-dialog-header,.reading-space-header,.evidence-export-header)
       :is(h1,h2,h3,p) {
    overflow-wrap:anywhere;
    word-break:normal;
  }
  body :is(.reader-toolbar,.reader-share-toolbar) button { white-space:normal; }

  @media(max-width:620px) {
    /* The legacy full-reader article plus nested sheets can consume 70–100px
       of each side. Reduce nesting padding without altering source wording. */
    body .museum-life-chapter .museum-exhibit-context-group { padding:15px 12px; }
    body .museum-life-chapter .museum-exhibit-open { padding:18px 15px; }
    body .museum-issue-hub .museum-sorted-source { padding:20px 18px!important; }
    body .museum-issue-hub :is(.museum-issue-resource-links,.museum-exhibit-grid) {
      grid-template-columns:minmax(0,1fr);
    }
    body .email-reader-heading .email-reader-topline {
      flex-wrap:wrap;
      gap:10px;
    }
    body .email-reader-heading .email-reader-topline > h1 {
      flex:1 1 180px;
    }
    body .email-reader-heading .email-reader-actions { flex:0 1 auto; }
  }

  @media(max-width:540px) {
    /* At390px the brand row's right half is173px. Its old23px left padding,
       nowrap Museum title, nonshrinking Guide and8px gap exceed that cell. */
    body .topbar.museum-compact-topbar > .topbar-actions {
      min-inline-size:0;
      padding-inline:8px;
      gap:6px;
    }
    body .topbar.museum-compact-topbar .museum-site-title {
      flex:1 1 auto;
      min-inline-size:0;
      max-inline-size:100%;
      white-space:normal;
      overflow-wrap:normal;
      font-size:10px;
      line-height:1.15;
    }
    body .topbar.museum-compact-topbar .museum-guide-trigger { flex:0 0 auto; }
    body .topbar.museum-compact-topbar .museum-brand-name > span {
      min-inline-size:0;
      white-space:normal;
      overflow-wrap:anywhere;
      line-height:1.15;
    }
  }
}
/* The unchanged ME silhouette is a clear opening in the surrounding frost. */
@media screen {
 html.museum-clear-mark .topbar.museum-compact-topbar {isolation:isolate;}
 html.museum-clear-mark .museum-compact-topbar > .museum-brand-band {
  -webkit-mask-image:linear-gradient(#000,#000),url('/assets/brand/museum-of-evidence-logo.svg');
  -webkit-mask-size:100% 100%,29px 29px;
  -webkit-mask-position:0 0,50% calc((var(--museum-brand-height) - 29px)/2);
  -webkit-mask-repeat:no-repeat,no-repeat;
  -webkit-mask-composite:xor;
  mask-image:linear-gradient(#000,#000),url('/assets/brand/museum-of-evidence-logo.svg');
  mask-size:100% 100%,29px 29px;
  mask-position:0 0,50% calc((var(--museum-brand-height) - 29px)/2);
  mask-repeat:no-repeat,no-repeat;
  mask-composite:exclude;
 }
 html.museum-clear-mark .museum-centered-mark > img {opacity:0;}
 @media(max-width:850px) {
  html.museum-clear-mark body .topbar.museum-compact-topbar {
   background:transparent!important;-webkit-backdrop-filter:none;backdrop-filter:none;
  }
  html.museum-clear-mark .museum-compact-topbar > .museum-brand-band {
   height:var(--museum-shell-height);background:var(--coast-floating-sheet);
   -webkit-backdrop-filter:blur(40px) saturate(1.1);backdrop-filter:blur(40px) saturate(1.1);
  }
 }
}


@media screen {
 .museum-context-messages {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:15px 0;min-width:0;}
 .museum-context-sequence {grid-template-columns:minmax(0,1fr);}
 .museum-context-message {min-width:0;padding:20px;border:1px solid rgba(255,255,255,.88);border-radius:16px;background:var(--coast-inner);box-shadow:inset 0 1px rgba(255,255,255,.8);}
 .museum-context-message h4 {font:600 14px/1.5 var(--font);margin:5px 0;}
 .museum-context-message .eyebrow {font-size:9px;line-height:1.6;letter-spacing:.8px;}
 .museum-context-message blockquote {font-size:14px;line-height:1.85;}
 .museum-context-message a {display:inline-flex;align-items:center;min-height:44px;font-size:12px;text-decoration:underline;}
 .museum-context-basis {padding:0 4px;font-size:11px;line-height:1.8;}
 .museum-context-basis summary {padding:10px 0;cursor:pointer;font-size:12px;}
 .museum-context-author {font-size:12px;margin:3px 0;}
 .museum-exhibit-grid > .museum-exhibit-entry:only-child {grid-column:1 / -1;}
 .museum-life-latest > summary {font:400 27px/1.4 var(--serif);cursor:pointer;min-height:34px;}
 .museum-life-latest[open] > summary {margin-bottom:18px;}
 @media(max-width:1000px){.museum-context-messages{grid-template-columns:minmax(0,1fr);}}
 @media(max-width:620px){.museum-context-message{padding:17px 15px;}.museum-context-message blockquote{font-size:14px;}}
}

/* Compact mobile directory row; either disclosure opens its own reading layer. */
@media screen and (max-width:850px) {
  html.museum-compact-navigation,
  html.museum-compact-navigation body.cinema-ui {
    --museum-sidebar-strip-height:62px;
    --museum-record-tools-height:62px;
  }
  body .sidebar.museum-has-record-tools,
  body .email-directory.museum-has-record-tools {
    display:grid;
    grid-template-columns:minmax(0,1fr) 128px;
    align-items:start;
    isolation:isolate;
  }
  body .museum-has-record-tools > :is(.sidebar-tools,.email-directory-disclosure) {
    grid-column:1;
    min-width:0;
    margin:0;
  }
  body .museum-has-record-tools > .museum-record-tools {
    grid-column:2;
    margin:0;
    min-width:0;
    width:100%;
    border:0;
    border-left:1px solid var(--line);
    border-radius:0;
  }
  body .museum-has-record-tools > .museum-record-tools > summary {
    min-height:62px;
    padding:12px 10px;
    gap:6px;
    font-size:12px;
  }
  body .museum-has-record-tools > :is(.sidebar-tools,.email-directory-disclosure)
       > :is(.sidebar-context,.sidebar-section-body,.museum-issue-sidebar,.email-directory-body),
  body .museum-has-record-tools > .museum-record-tools > .museum-record-tools-links {
    position:absolute;
    z-index:2;
    top:62px;
    left:0;
    right:0;
    box-sizing:border-box;
    width:100%;
    max-height:min(55dvh,520px);
    overflow:auto;
    overscroll-behavior:contain;
    padding:14px 18px 20px;
    background:var(--coast-floating-sheet);
    border:1px solid rgba(255,255,255,.85);
    border-radius:0 0 18px 18px;
    -webkit-backdrop-filter:blur(32px);
    backdrop-filter:blur(32px);
  }
}

@media screen and (max-width:540px) {
 body .topbar.museum-compact-topbar > .topbar-actions {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;padding-inline:8px;}
 body .topbar.museum-compact-topbar .museum-site-title {min-width:0;max-width:90px;white-space:normal!important;line-height:1.2;text-align:right;}
 body .topbar.museum-compact-topbar .museum-guide-trigger {margin-inline-start:0;min-width:38px;}
 body .museum-has-record-tools > .sidebar-tools > summary {font-size:12px;gap:6px;padding:12px 13px;}
 body .museum-has-record-tools > .sidebar-tools > summary > .sidebar-selected-label {display:none;}
}
@media screen and (max-width:850px) {
 body .museum-has-record-tools > :is(.sidebar-tools,.email-directory-disclosure)
      > :is(.sidebar-context,.sidebar-section-body,.museum-issue-sidebar,.email-directory-body),
 body .museum-has-record-tools > .museum-record-tools > .museum-record-tools-links {
  isolation:isolate;box-shadow:0 14px 28px rgba(8,54,71,.14);
 }
 body .museum-has-record-tools > :is(.sidebar-tools,.email-directory-disclosure)
      > :is(.sidebar-context,.sidebar-section-body,.museum-issue-sidebar,.email-directory-body)::before,
 body .museum-has-record-tools > .museum-record-tools > .museum-record-tools-links::before {
  content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;
  background:linear-gradient(120deg,rgba(238,253,248,.96),rgba(255,246,230,.96));pointer-events:none;
  -webkit-backdrop-filter:blur(40px);backdrop-filter:blur(40px);
 }
}
