/* Case study sheet: a report that rises from the bottom over a blurred page */

.sheet-root { position: fixed; inset: 0; z-index: 100; }
.sheet-root[hidden] { display: none; }

.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(12, 11, 10, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  will-change: opacity;
  opacity: 0; transition: opacity 0.45s var(--ease-out);
  cursor: pointer;
}

.sheet {
  --w: min(86vw, 1320px);
  position: absolute; left: 50%; bottom: 0; top: min(calc((100vw - var(--w)) / 2), 12vh);
  width: var(--w);
  contain: layout paint; will-change: transform;
  display: flex; flex-direction: column;
  border-radius: 14px 14px 0 0; overflow: hidden;
  border: 1px solid #3a3733; border-bottom: 0;
  box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, 100%);
  transition: transform 0.6s var(--ease-out);
}
.sheet-root.is-open .sheet-backdrop { opacity: 1; }
.sheet-root.is-open .sheet { transform: translate(-50%, 0); }

.sheet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; flex: none;
  /* Same edges as the case text: centred --max column with the wrap's inner padding */
  padding-inline: calc(max(0px, (100% - var(--max)) / 2) + var(--gutter));
  position: relative; background: var(--bg); box-shadow: 0 1px 0 var(--line);
}
.sheet-actions { display: flex; align-items: center; gap: 20px; }
.sheet-back {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 0;
  font: inherit; color: var(--fg); background: none; border: 0; cursor: pointer;
}
.sheet-back svg { width: 16px; height: 16px; transform: rotate(180deg); transition: transform 0.3s var(--ease-out); }
.sheet-back:hover svg { transform: rotate(180deg) translateX(3px); }
.sheet-title { color: var(--fg-3); font-size: var(--step--1); }

.sheet-scroll { flex: 1; min-height: 0; scrollbar-gutter: stable both-edges; contain: content; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #3a3835 var(--bg); }
.sheet-scroll .wrap { max-width: var(--max); padding-inline: var(--gutter); }
.sheet-scroll .case-top { padding-top: clamp(32px, 5vw, 56px); }
.sheet-scroll .chapter { scroll-margin-top: 24px; }
.sheet-loading { padding: 48px clamp(20px, 4vw, 64px); color: var(--fg-3); }

html.sheet-lock { overflow: hidden; }

@media (max-width: 800px) {
  .sheet { --w: 100%; top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop { transition: none; }
}
