/* Reference-style project sheets: hero, compact glass bar and persistent actions. */
body .case-dialog.polished-dialog { --case-tint: #6e89a0; --case-actions-height: 80px; width: min(680px,calc(100vw - 32px)); max-height: min(912px,calc(100dvh - 64px)); padding: 0; overflow: hidden; }
body .case-dialog.polished-dialog .case-sheet { display: flex; flex-direction: column; max-height: inherit; overflow: hidden; position: relative; isolation: isolate; background: var(--card); }
body .case-dialog.polished-dialog .case-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: var(--case-actions-height); scroll-padding: 68px 0 calc(var(--case-actions-height) + 24px); scrollbar-width: thin; }
.case-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
body .case-dialog.polished-dialog .case-sheet-top { position: absolute; inset: 0 0 auto; height: 56px; padding: 0 64px; display: flex; align-items: center; justify-content: center; gap: 10px; z-index: 3; pointer-events: none; opacity: 0; transform: translateY(-6px); background: color-mix(in srgb,var(--card) 82%,transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid color-mix(in srgb,var(--line) 65%,transparent); transition: opacity 160ms ease-out,transform 160ms ease-out; }
body .case-dialog.polished-dialog.is-scrolled .case-sheet-top { opacity: 1; transform: none; }
.case-sheet-top > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; line-height: 1.3; font-weight: 600; }
body .case-dialog.polished-dialog .case-close { position: absolute; top: 16px; right: 16px; z-index: 5; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; }
body .case-dialog.polished-dialog .case-hero { padding: 34px 32px 26px; margin-bottom: 20px; background: radial-gradient(ellipse at 100% 100%,color-mix(in srgb,var(--case-tint) 24%,transparent),transparent 75%),color-mix(in srgb,var(--case-tint) 7%,var(--card)); }
.case-identity { display: flex; align-items: center; gap: 16px; }
.case-identity > div { min-width: 0; }
.case-identity .eyebrow { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; margin-bottom: 6px; padding-right: 28px; }
body .case-dialog.polished-dialog h2 { margin: 0; padding-right: 0; font-size: 34px; line-height: 1.08; font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
body .case-dialog.polished-dialog .case-hero p { margin: 6px 0 0; color: var(--muted); font-size: 17px; line-height: 1.5; text-wrap: pretty; white-space: pre-line; }
.case-logo { display: grid; place-items: center; align-self: start; flex: 0 0 64px; width: 64px; height: 64px; border-radius: 16px; }
.case-logo > .ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; overflow: hidden; }
.case-logo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.case-logo svg { width: 34px; height: 34px; }
.case-logo-pair { display: flex; position: relative; }
.case-logo-pair > img { position: absolute; width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 0 0 3px var(--card); }
.case-logo-pair > img:first-child { left: 0; top: 0; }
.case-logo-pair > img:last-child { right: 0; bottom: 0; }
.case-compact-logo { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; position: relative; }
.case-compact-logo > .ico,.case-compact-logo img { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; }
.case-compact-logo svg { width: 20px; height: 20px; }
.case-compact-logo.case-logo-pair > img { position: absolute; width: 20px; height: 20px; border-radius: 6px; box-shadow: 0 0 0 2px var(--card); }
.directory-logo { background: var(--card2); }
body .case-dialog.polished-dialog .case-sheet-body { flex: none; overflow: visible; padding: 0 32px 28px; }
body .case-dialog.polished-dialog .case-story { margin-top: 8px; margin-bottom: 0; }
body .case-dialog.polished-dialog .case-sheet-foot { position: absolute; inset: auto 0 0; z-index: 4; border-radius: 0 0 32px 32px; flex: none; display: block; margin: 0; padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb,var(--card) 78%,transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); }
.polished-dialog .case-sheet-foot::before { content: none; }
.case-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
body .case-dialog.polished-dialog .case-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 0; border-radius: 99px; background: var(--card2); color: var(--text); font: inherit; font-size: 13px; line-height: 1.3; text-decoration: none; white-space: normal; text-align: center; }
body .case-dialog.polished-dialog .case-actions .primary { background: var(--text); color: var(--card); }
.case-actions .case-contact-action { margin-left: auto; }
.case-actions a:focus-visible,.case-resource-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.case-resources { margin-top: 26px; }
.case-resources[hidden] { display: none; }
.case-resources h3 { margin: 0 0 12px; font-size: 16px; }
.case-resource-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.case-resource-list a { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 16px 30px 16px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card2); color: var(--text); text-decoration: none; min-width: 0; }
.case-resource-list strong { font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.case-resource-list a > span:not(.case-resource-arrow) { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.case-resource-arrow { position: absolute; top: 16px; right: 12px; }
body .case-dialog.polished-dialog.projects-dialog #projects-dialog-title { background: transparent; padding: 0; margin: 0; }
body .case-dialog.polished-dialog.projects-dialog #projects-dialog-description { background: transparent; padding: 0; margin: 6px 0 0; }
.polished-dialog .project-directory { margin: 0; }
@media (max-width:640px) {
  body .case-dialog.polished-dialog { width: 100%; margin: auto 0 0; inset: auto 0 0; max-height: calc(100dvh - 12px - env(safe-area-inset-top)); }
  body .case-dialog.polished-dialog .case-hero { padding: 30px 22px 22px; }
  .case-identity { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 0 12px; }
  .case-identity > div { display: contents; }
  .case-identity .case-logo { grid-column: 1; grid-row: 1 / 3; }
  .case-identity .eyebrow { grid-column: 2; }
  body .case-dialog.polished-dialog h2 { grid-column: 2; font-size: 28px; }
  .case-logo,.case-logo > .ico { width: 52px; height: 52px; flex-basis: 52px; border-radius: 14px; }
  .case-logo-pair > img { width: 35px; height: 35px; border-radius: 10px; }
  body .case-dialog.polished-dialog .case-hero p { grid-column: 1 / -1; font-size: 16px; margin-top: 16px; }
  body .case-dialog.polished-dialog.projects-dialog #projects-dialog-description { margin-top: 16px; }
  body .case-dialog.polished-dialog .case-sheet-top { padding-inline: 56px; }
  body .case-dialog.polished-dialog .case-sheet-body { padding: 0 22px 24px; }
  body .case-dialog.polished-dialog .case-sheet-foot { border-radius: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  body .case-dialog.polished-dialog .case-actions .btn { padding: 9px 12px; font-size: 12px; }
  .case-resource-list { grid-template-columns: minmax(0,1fr); }
}
@media (max-width:360px) {
  .case-identity { column-gap: 10px; }
  body .case-dialog.polished-dialog h2 { font-size: 25px; }
  .case-actions .case-contact-action { margin-left: 0; }
}
@media (max-height:500px) {
  body .case-dialog.polished-dialog { max-height: calc(100dvh - 20px); }
  body .case-dialog.polished-dialog .case-sheet { display: flex; overflow: hidden; }
  body .case-dialog.polished-dialog .case-sheet-top { position: absolute; z-index: 3; }
  body .case-dialog.polished-dialog .case-sheet-foot { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  body .case-dialog.polished-dialog .case-sheet-art.case-media { max-height: none; }
  body .case-dialog.polished-dialog .case-sheet-art.case-media { --media-height: min(160px,calc(100dvh - 190px)); }
}
html[data-motion="off"] .polished-dialog .case-sheet-top,
.polished-dialog.is-instant .case-sheet-top { transition: none; }

/* A brief, composited entrance keeps project sheets from appearing abruptly. */
@keyframes case-sheet-enter {
  from { opacity: .01; transform: translate3d(0, 14px, 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes case-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
body .case-dialog.polished-dialog[open]:not(.is-instant) .case-sheet {
  animation: case-sheet-enter 220ms cubic-bezier(.23, 1, .32, 1) both;
  will-change: transform, opacity;
}
body .case-dialog.polished-dialog[open]:not(.is-instant)::backdrop {
  animation: case-backdrop-enter 160ms cubic-bezier(.23, 1, .32, 1) both;
}
html[data-motion="off"] body .case-dialog.polished-dialog[open] .case-sheet,
html[data-motion="off"] body .case-dialog.polished-dialog[open]::backdrop,
body .case-dialog.polished-dialog.is-instant[open] .case-sheet,
body .case-dialog.polished-dialog.is-instant[open]::backdrop {
  animation: none;
  will-change: auto;
}
@media (prefers-reduced-motion:reduce) {
  html:not([data-motion="full"]) body .case-dialog.polished-dialog .case-sheet-top { transition: none; }
  html:not([data-motion="full"]) body .case-dialog.polished-dialog[open] .case-sheet,
  html:not([data-motion="full"]) body .case-dialog.polished-dialog[open]::backdrop { animation: none; will-change: auto; }
}
@media (prefers-reduced-transparency:reduce) {
  body .case-dialog.polished-dialog .case-sheet-top,body .case-dialog.polished-dialog .case-sheet-foot { background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (forced-colors:active) {
  body .case-dialog.polished-dialog .case-sheet-top,body .case-dialog.polished-dialog .case-sheet-foot { background: Canvas; }
  body .case-dialog.polished-dialog .case-actions .btn { border: 1px solid ButtonText; }
}

/* Scope figures follow the reference's simple, readable KPI tiles. */
.case-metrics[hidden] { display: none; }
.case-metrics { margin: 20px 0 26px; }
.case-metric-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0 0 10px; }
.case-metric-grid > div { display: flex; flex-direction: column; gap: 7px; padding: 18px 20px; border-radius: 18px; background: var(--card2); min-width: 0; }
.case-metric-grid dd { order: -1; margin: 0; color: var(--text); font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.case-metric-grid dt { color: var(--muted); font-size: 13px; line-height: 1.4; text-wrap: pretty; }
.case-metric-source { color: var(--muted); font-size: 11px; line-height: 1.5; text-underline-offset: 3px; }
.case-metric-source:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width:640px) {
  .case-metric-grid > div { padding: 14px 16px; }
  .case-metric-grid dd { font-size: 28px; }
  .case-metric-grid dt { font-size: 12px; }
}
