/* Personal materials gallery and shared work/material detail dialog. */
.local-materials-mode {
    container: materials-gallery / inline-size;
    --material-ink: #292725;
    --material-muted: #8a8580;
    --material-line: #e9e5e1;
}
.masonry-grid.local-materials-mode { gap: 0; }
.materials-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px; margin-bottom: 28px; }
.materials-heading h2 { margin: 0; color: var(--material-ink); font-size: 24px; line-height: 1.4; font-weight: 600; letter-spacing: -.5px; }
.materials-heading h2 span { margin-left: 12px; color: var(--material-muted); font-size: 12px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.materials-heading p { margin: 8px 0 0; color: var(--material-muted); font-size: 12px; line-height: 1.6; }
.materials-heading-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.materials-local-note { display: inline-flex; align-items: center; gap: 6px; color: var(--material-muted); font-size: 11px; }
.materials-view-switch { display: inline-flex; padding: 3px; border: 1px solid var(--material-line); border-radius: 9px; background: #f3f1ee; }
.materials-view-switch button { min-width: 48px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #918b85; font-size: 12px; }
.materials-view-switch button[aria-pressed="true"] { background: #fff; color: #39342f; box-shadow: 0 1px 4px #2927250a; }
.local-materials-mode .my-works-date-group { margin-bottom: 0; }
.local-materials-mode .my-works-date-list { grid-template-columns: minmax(0, 1fr); column-gap: 24px; row-gap: 20px; }
.local-materials-mode.materials-small-view .my-works-date-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 16px; }
@container materials-gallery (min-width: 560px) {
    .local-materials-mode .my-works-date-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .local-materials-mode.materials-small-view .my-works-date-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container materials-gallery (min-width: 1000px) {
    .local-materials-mode .my-works-date-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .local-materials-mode.materials-small-view .my-works-date-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container materials-gallery (min-width: 1400px) {
    .local-materials-mode .my-works-date-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .local-materials-mode.materials-small-view .my-works-date-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.local-materials-mode .my-work-card-shell,
.local-materials-mode .my-work-list-item:hover .my-work-card-shell,
.local-materials-mode .my-work-list-item:focus-within .my-work-card-shell { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; transform: none; }
.local-materials-mode .my-work-card-media { border-radius: 10px; background: #eeebe7; }
.local-materials-mode .my-work-card-media.has-ratio { min-height: 120px; }
.local-materials-mode .my-work-card-image { display: block; object-fit: contain; }
.local-materials-mode .my-work-list-item:hover .my-work-card-image,
.local-materials-mode .my-work-list-item:focus-within .my-work-card-image { transform: none; }
.local-materials-mode .my-work-card-body { padding: 12px 1px 2px; gap: 0; }
.local-materials-mode .my-work-card-title { color: var(--material-ink); font-size: 13px; font-weight: 500; line-height: 1.6; }
.material-open-btn { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; border: 0; background: transparent; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.material-action-bar { position: absolute; inset: auto 0 0; display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 32px 14px 14px; border-radius: 0 0 10px 10px; background: linear-gradient(transparent, #16131280); opacity: 0; transition: opacity .18s; pointer-events: none; }
.local-material-item:hover .material-action-bar,
.local-material-item:focus-within .material-action-bar,
.local-material-item:has(.material-more[open]) .material-action-bar { opacity: 1; pointer-events: auto; }
.material-action-bar button,
.material-action-bar summary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 1px solid #ffffffa6; border-radius: 8px; background: #fffffff2; color: #3c3631; box-shadow: none; font-size: 12px; cursor: pointer; white-space: nowrap; }
.material-action-bar .material-use-btn { margin-right: auto; padding: 0 12px; font-weight: 500; }
.material-action-bar .material-icon-btn { width: 36px; padding: 0; flex: none; }
.material-action-bar button:hover,
.material-action-bar summary:hover { background: #fff; color: #7659a0; }
.material-more { position: relative; }
.material-more summary { list-style: none; }
.material-more summary::-webkit-details-marker { display: none; }
.material-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; min-width: 116px; padding: 5px; border: 1px solid #e9e5e1; border-radius: 9px; background: #fffdfa; box-shadow: 0 8px 24px #2927251f; }
.material-action-bar .material-menu button { width: 100%; justify-content: flex-start; height: 36px; padding: 0 10px; border: 0; background: transparent; }
.material-action-bar .material-menu-download { display: none; }
.material-action-bar .material-delete-btn { color: #b44d47; }
.material-action-bar .material-delete-btn:hover { background: #fff0ee; color: #a83c34; }
@container (max-width: 260px) {
    .material-action-bar { padding: 24px 8px 8px; gap: 4px; }
    .material-action-bar .material-download-btn { display: none; }
    .material-action-bar .material-menu-download { display: flex; }
    .material-action-bar .material-use-btn { padding: 0 6px; font-size: 11px; }
    .material-action-bar .material-use-btn i { display: none; }
    .material-action-bar .material-icon-btn { width: 30px; }
}
.material-detail { width: min(1180px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #e9e5e1; border-radius: 18px; background: #fffdfa; color: #292725; overflow: hidden; box-shadow: 0 24px 90px #16131233; }
.material-detail::backdrop { background: #29272566; backdrop-filter: blur(8px); }
.material-detail-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 50px); }
.material-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid #e9e5e1; font-size: 13px; flex: none; }
.material-detail-navigation { display: flex; align-items: center; gap: 6px; }
.material-detail-navigation span { margin-right: 10px; color: #8a8580; font-size: 11px; }
.material-detail-navigation button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: #716a64; font-size: 12px; cursor: pointer; }
.material-detail-navigation [data-detail-action="close"] { margin-left: 6px; font-size: 25px; font-weight: 300; }
.material-detail-navigation button:hover:not(:disabled) { background: #f0ece6; }
.material-detail-navigation button:disabled { opacity: .3; cursor: default; }
.material-detail-content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); min-height: 0; height: min(680px, calc(100dvh - 118px)); overflow: auto; }
.material-detail-image { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 28px; background: #f1eeea; }
.material-detail-image img { display: block; max-width: 100%; max-height: min(624px, calc(100dvh - 178px)); width: auto; height: auto; object-fit: contain; }
.material-detail-expand { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.material-detail-expand img { width: 100%; height: 100%; object-fit: contain; }
.material-detail-expand-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); padding: 6px 10px; border-radius: 6px; background: #fffdfaeb; color: #716a64; font-size: 11px; white-space: nowrap; }
.material-detail-info { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; padding: 28px 24px; border-left: 1px solid #e9e5e1; }
.material-detail-info h2 { margin: 0; font-size: 20px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.material-detail-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 14px; color: #8a8580; font-size: 11px; overflow-wrap: anywhere; }
.material-detail-prompt { flex: 1; min-height: 0; overflow-y: auto; margin: 26px 0; }
.material-detail-prompt h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: #8a8580; }
.material-detail-prompt p { margin: 0; font-size: 13px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.material-detail-buttons { display: flex; flex: none; flex-direction: column; gap: 8px; margin-top: auto; }
.material-detail-buttons button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 14px; border: 1px solid #e2dce8; border-radius: 8px; background: transparent; color: #655b6d; font-size: 12px; cursor: pointer; }
.material-detail-buttons [data-detail-action="use"] { border-color: #795f98; background: #795f98; color: #fff; }
.material-detail-buttons [data-detail-action="use"]:hover { background: #695085; }
.material-detail-buttons button:disabled { opacity: .5; cursor: default; }
.material-detail-local { margin: 12px 0 0; font-size: 11px; line-height: 1.6; color: #938b83; text-align: center; }
.materials-view-switch button:focus-visible,
.material-open-btn:focus-visible,
.material-action-bar button:focus-visible,
.material-action-bar summary:focus-visible,
.material-detail button:focus-visible { outline: 2px solid #987bb9; outline-offset: 3px; }
@media (max-width: 640px) {
    .materials-heading { gap: 16px; margin-bottom: 22px; }
    .materials-heading h2 { font-size: 21px; }
    .materials-heading-controls { width: 100%; justify-content: space-between; }
    .material-detail { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
    .material-detail-shell { max-height: calc(100dvh - 26px); }
    .material-detail-header { padding: 10px 14px; }
    .material-detail-content { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; height: auto; max-height: calc(100dvh - 82px); }
    .material-detail-image { padding: 18px; }
    .material-detail-image img { max-height: 42dvh; }
    .material-detail-expand { height: 42dvh; }
    .material-detail-info { padding: 22px 20px; border-left: 0; overflow: visible; }
    .material-detail-prompt { flex: none; max-height: 180px; overflow-y: auto; margin: 20px 0; }
}
@media (hover: none), (max-width: 1024px) {
    .material-action-bar { opacity: 1; pointer-events: auto; }
}
@media (pointer: coarse) {
    .material-action-bar button, .material-action-bar summary,
    .materials-view-switch button, .material-detail-navigation button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .material-action-bar { transition: none; }
}
