/* Canonical drawer chrome. Load after page/profile/filter CSS. Content geometry
   (portrait aspect ratio, saved image crops, typography and tabs) stays local. */
:root {
  --archive-drawer-duration: var(--duration-drawer);
  --archive-drawer-easing: var(--ease-drawer);
  --archive-drawer-top-gap: var(--drawer-top-gap);
  --archive-drawer-gutter: var(--drawer-gutter);
  --archive-drawer-radius: var(--radius-sheet);
  --archive-drawer-handle-width: var(--drawer-handle-width);
  --archive-drawer-handle-height: var(--drawer-handle-height);
  --archive-drawer-pill-width: var(--drawer-pill-width);
  --archive-drawer-pill-height: var(--drawer-pill-height);
  --archive-drawer-pill-color: var(--drawer-pill-color);
  --archive-drawer-content-padding: var(--drawer-content-padding);
  --archive-drawer-portrait-ratio: 4 / 5;
  --archive-toast-duration: var(--duration-base);
  --archive-control-inset: var(--drawer-control-inset);
}
.archive-drawer-overlay { z-index:var(--z-archive-drawer); }
html[data-theme] body .archive-drawer__media { position: relative; border-radius: var(--archive-drawer-radius); }
html[data-theme] body .archive-modal .archive-drawer__media { border-radius:var(--archive-drawer-radius) !important; overflow:hidden; }
html[data-theme] body .archive-share-button {
  position: absolute !important; inset: var(--drawer-control-inset) auto auto var(--drawer-control-inset) !important;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important; padding: 0 !important;
  background: rgb(20 20 19 / 90%); border: 1px solid rgb(244 241 233 / 35%);
  border-radius: 8px !important; color: var(--color-paper); z-index: var(--z-float) !important;
}
html[data-theme] body .archive-share-button.is-confirmed { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success-text); }
html[data-theme] body .archive-share-button .material-symbols-outlined { font-size: var(--icon-size-chrome-md); line-height: 1; }
html[data-theme] body .archive-copy-toast {
  display: block !important; position: absolute !important;
  inset: auto var(--drawer-control-inset) var(--drawer-control-inset) auto !important; margin: 0 !important;
  width: max-content !important; max-width: calc(100% - 24px) !important;
  padding: var(--space-chrome-2-5) var(--space-chrome-3) !important; font: 700 var(--font-size-chrome-sm)/16px var(--body) !important;
  background: var(--color-success-bg) !important; color: var(--color-success-text) !important;
  border: 1px solid var(--color-success-border) !important; border-radius: 0 !important;
  text-align: center; text-transform: uppercase; pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(8px) !important; z-index: calc(var(--z-float) + 1) !important;
  transition: opacity var(--archive-toast-duration) ease, transform var(--archive-toast-duration) ease, visibility var(--duration-instant) linear var(--archive-toast-duration) !important;
}
html[data-theme] body .archive-copy-toast.is-visible {
  opacity: 1; visibility: visible; transform: translateY(0) !important;
  transition-delay: var(--duration-instant) !important;
}
.archive-share-button:focus-visible { outline: 2px solid var(--color-paper); outline-offset: 3px; }
@media (max-width: 768px) {
  html[data-theme] body .archive-drawer-overlay .archive-drawer {
    --sheet-card-gutter: var(--drawer-gutter);
    top: var(--archive-drawer-top-gap); bottom: auto;
    height: calc(100dvh - var(--archive-drawer-top-gap));
    max-height: calc(100dvh - var(--archive-drawer-top-gap));
    width: var(--archive-viewport-width, 100vw);
    transition: transform var(--archive-drawer-duration) var(--archive-drawer-easing);
  }
  html[data-theme] body .archive-drawer__panel {
    border: 0 !important; outline: 0 !important;
    border-radius: var(--archive-drawer-radius) var(--archive-drawer-radius) 0 0;
    width: calc(var(--archive-viewport-width, 100vw) - 2 * var(--sheet-card-gutter));
    flex-basis: calc(var(--archive-viewport-width, 100vw) - 2 * var(--sheet-card-gutter));
  }
  html[data-theme] body .archive-drawer .archive-drawer__media {
    border: 0 !important; border-radius: var(--archive-drawer-radius) !important; overflow: hidden;
  }
  html[data-theme] body .archive-drawer .archive-share-button {
    inset: var(--drawer-control-inset) var(--drawer-control-inset) auto auto !important;
    width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important;
  }
  /* Compatibility bridge: legacy page modal rules used z-index:10010. */
  html[data-theme] body.detail-modal-open .archive-drawer-overlay .archive-drawer .archive-drawer__panel .archive-modal .archive-drawer__media .archive-share-button {
    position:absolute !important;
    inset:var(--drawer-control-inset) var(--drawer-control-inset) auto auto !important;
    z-index:var(--z-float) !important;
  }
}
html[data-theme] body .archive-drawer__handle {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  display: block; width: var(--archive-drawer-handle-width); height: var(--archive-drawer-handle-height);
  min-height: var(--archive-drawer-handle-height); padding: 0; margin: 0; border: 0;
  background: transparent; touch-action: pan-x pinch-zoom; cursor: ns-resize; z-index: calc(var(--z-float) + 2);
}
.archive-drawer__handle::after {
  content: ""; position: absolute; top: var(--space-chrome-1-5); left: 50%; transform: translateX(-50%);
  width: var(--archive-drawer-pill-width); height: var(--archive-drawer-pill-height);
  border-radius: 3px; background: var(--archive-drawer-pill-color); box-shadow: none;
}
.archive-drawer__handle:focus-visible::after { outline: 2px solid var(--color-paper); outline-offset: 4px; }
html[data-theme] body .archive-drawer__handle:focus-visible { outline:none; }
html[data-theme] body .archive-drawer.is-dragging { transition: none !important; }
html body .archive-drawer--filter { transition: transform var(--archive-drawer-duration) var(--archive-drawer-easing) !important; }
@media (max-width:1120px) {
  html[data-theme]:has(body.filter-sheet-open),
  html[data-theme]:has(.vault-room-page:is(.is-vault-filter-sheet-open,.is-vault-filter-sheet-closing)) { scrollbar-gutter:auto !important; }
  body:has(.vault-room-page:is(.is-vault-filter-sheet-open,.is-vault-filter-sheet-closing)) .site-header { visibility:hidden !important; pointer-events:none !important; }
  html[data-theme] body .archive-share-button { width:44px !important; height:44px !important; min-width:44px !important; min-height:44px !important; }
  html body .archive-drawer--filter {
    height:auto !important; min-height:0 !important;
    max-height:calc(100dvh - var(--archive-drawer-top-gap)) !important;
    border:0 !important; outline:0 !important;
    border-radius:var(--archive-drawer-radius) var(--archive-drawer-radius) 0 0 !important;
    z-index:var(--z-archive-drawer) !important;
    transition: transform var(--archive-drawer-duration) var(--archive-drawer-easing) !important;
  }
  /* Keep the modal lock during exit without the legacy open-body rule pulling
     a released drawer back to zero until the cleanup timer finishes. */
  html body.filter-sheet-open [data-filter-sheet].archive-drawer--filter:not(.is-open) {
    transform:translateY(calc(100% + 2px)) !important;
  }
  html body .archive-drawer--filter > .archive-drawer__handle {
    position: relative; top: auto; left: auto; transform: none; flex: 0 0 48px;
    width: 80px; height: 48px; margin: 0 auto;
  }
  html body .archive-drawer--filter .archive-drawer__handle { touch-action: none; }
}
@media (max-width:768px) {
  html body .archive-drawer--filter { width:100vw !important; }
  html body .vault-room-page .archive-drawer--filter { padding:0 !important; }
  html body .vault-room-page .archive-drawer--filter > :not(.archive-drawer__handle) { margin-inline:var(--space-chrome-5); }
}
.archive-drawer-overlay::before { transition: opacity var(--archive-drawer-duration) ease; }
@keyframes archiveModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes archiveModalFadeOut { from { opacity: 1; } to { opacity: 0; } }
@media (min-width:769px) {
  html[data-theme] body .archive-modal:is(.is-open,.is-modal-open) {
    animation: archiveModalFadeIn var(--archive-drawer-duration) var(--archive-drawer-easing) both !important;
    transition-duration: var(--archive-drawer-duration) !important;
    transition-timing-function: var(--archive-drawer-easing) !important;
  }
  html[data-theme] body .archive-modal.is-modal-closing {
    animation: archiveModalFadeOut var(--archive-drawer-duration) var(--archive-drawer-easing) both !important;
  }
  .vault-stream-page .vault-hero.archive-modal.is-open .vault-hero__poster { animation:none !important; }
}
@media (min-width:1121px) { html body .archive-drawer--filter > .archive-drawer__handle { display:none; } }
/* The recovered Vault is an adapter, with the same primary media and chrome. */
.stream-match-view .vault-hero__photo { display:block; height:40dvh; }
.stream-match-view .vault-info-rail { display:flex; flex-direction:column; }
.stream-match-view .vault-info-rail__inner { width:100%; flex:0 0 auto; }
.stream-match-view .vault-button--report { align-self:center; }
@media (min-width:769px) {
  .vault-stream-page .vault-hero .vault-hero__photo.archive-drawer__media {
    display:block; position:absolute; inset:0 280px 0 0;
    background-image:var(--hero-image); background-size:var(--hero-image-size,cover);
    background-position:var(--hero-image-position,center); background-repeat:no-repeat;
    pointer-events:none; z-index:auto;
  }
  .vault-stream-page .vault-hero.archive-modal .vault-hero__poster::before { display:none; }
  .vault-stream-page .vault-hero__photo .archive-share-button { pointer-events:auto; }
}
@media (min-width:769px) and (max-width:1120px) {
  .vault-stream-page .vault-hero .vault-hero__photo.archive-drawer__media { inset:0 0 auto; height:clamp(18rem,54vw,25rem); }
}
@media (prefers-reduced-motion:reduce) {
  .lineage-mobile-sheet { transition:none !important; }
  html[data-theme] body :is(.archive-drawer,.archive-copy-toast,.archive-modal) { transition: none !important; animation: none !important; }
  .archive-drawer-overlay::before { transition: none !important; }
  html[data-theme] body .archive-modal:is(.is-open,.is-modal-open,.is-modal-closing) { animation:none !important; transition:none !important; }
}


/* ==========================================================================
   Laptop compact filters (1121-1365px), generated 2026-11-05 from this file's
   (max-width: 1120px) filter rules: the filter rail becomes the same Filter
   button + bottom sheet as tablets, so cards get the rail's width. Keep in
   sync with the <=1120 rules above (or merge them when breakpoints are shared).
   ========================================================================== */
@media (min-width: 1121px) and (max-width: 1365px) {
  html[data-theme]:has(body.filter-sheet-open):where(:not([data-masks-page] *)),
  html[data-theme]:has(.vault-room-page:is(.is-vault-filter-sheet-open,.is-vault-filter-sheet-closing)):where(:not([data-masks-page] *)) {
    scrollbar-gutter:auto !important;
  }

  body:has(.vault-room-page:is(.is-vault-filter-sheet-open,.is-vault-filter-sheet-closing)) .site-header:where(:not([data-masks-page] *)) {
    visibility:hidden !important; pointer-events:none !important;
  }

  html body .archive-drawer--filter:where(:not([data-masks-page] *)) {
    height:auto !important; min-height:0 !important;
    max-height:calc(100dvh - var(--archive-drawer-top-gap)) !important;
    border:0 !important; outline:0 !important;
    border-radius:var(--archive-drawer-radius) var(--archive-drawer-radius) 0 0 !important;
    z-index:var(--z-archive-drawer) !important;
    transition: transform var(--archive-drawer-duration) var(--archive-drawer-easing) !important;
  }

  html body.filter-sheet-open [data-filter-sheet].archive-drawer--filter:not(.is-open):where(:not([data-masks-page] *)) {
    transform:translateY(calc(100% + 2px)) !important;
  }

  html body .archive-drawer--filter > .archive-drawer__handle:where(:not([data-masks-page] *)) {
    position: relative; top: auto; left: auto; transform: none; flex: 0 0 48px;
    width: 80px; height: 48px; margin: 0 auto;
  }

  html body .archive-drawer--filter .archive-drawer__handle:where(:not([data-masks-page] *)) {
    touch-action: none;
  }
}
