/* Shared presentation refinements; generation and workflow behavior live elsewhere. */
.app .view { scrollbar-gutter: stable; }
.app :is(button, .btn, a.btn) { max-width: 100%; }
.app .view :is(h1, h2, h3, h4, p, td, dd) { overflow-wrap: anywhere; }
.app .view :is(.row, .wk-head-actions, .wk-panel-actions) { flex-wrap: wrap; }
.app .view .row > :is(input, select, .field) { min-width: 0; }
.app .view .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 8px 14px; border: 1px solid var(--theme-line-strong); border-radius: 9px; font-size: 13px; line-height: 1.35; text-decoration: none; cursor: pointer; }
.app .view .btn-gold { background: var(--ui-accent); border-color: var(--ui-accent); color: #201b10; }
.app .view :is(.empty, .wk-inline-empty) { line-height: 1.7; }
.app .view label { line-height: 1.5; }
.app .view table { width: 100%; }
.app .view :is(th, td) { line-height: 1.6; }
.app .view :is(pre, .field textarea) { overflow-wrap: anywhere; }

/* Project cards: a quiet cover, readable copy, and two explicit actions. */
.wk-library .wk-page-head { align-items: center; gap: 20px; margin-bottom: 20px; }
.wk-library .wk-page-head h1 { margin: 0; font-size: clamp(26px, 2.6vw, 32px); }
.wk-library .wk-head-actions { flex-wrap: wrap; align-items: center; }
.wk-library .wk-project-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.wk-library .wk-project-card { display: flex; flex-direction: column; min-width: 0; border-radius: 16px; box-shadow: none; }
.wk-library .wk-project-card:hover { transform: translateY(-2px); box-shadow: var(--theme-shadow); }
.wk-library .wk-project-cover { flex: 0 0 auto; }
.wk-library .wk-project-image { width: 100%; height: 100%; }
.wk-library .wk-project-body { display: flex; flex-direction: column; flex: 1; padding: 18px; gap: 16px; }
.wk-library .wk-cover-copy { position: static; min-width: 0; }
.wk-library .wk-cover-copy > span { display: inline-block; margin-bottom: 6px; color: var(--theme-text-soft); font-size: 11px; font-weight: 500; }
.wk-library .wk-cover-copy h2 { margin: 0 0 8px; color: var(--theme-text); font-size: 18px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wk-library .wk-cover-copy p { margin: 0; color: var(--theme-text-soft); font-size: 13px; line-height: 1.6; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wk-library .wk-project-metrics { margin: auto 0 0; gap: 8px; }
.wk-library .wk-project-metrics span { font-size: 12px; line-height: 1.5; }
.wk-library .wk-project-metrics b { font-size: 17px; font-weight: 650; }
.wk-library .wk-project-updated { font-size: 11px; color: var(--theme-text-soft); }
.wk-library .wk-card-footer { margin-top: 0; padding-top: 14px; gap: 10px; }
.wk-library .wk-card-footer .btn { flex: 1; }
.wk-page .wk-thumb-fallback { font-size: 13px; font-weight: 500; color: var(--theme-text-soft); }
.wk-library .wk-cover-top span { font-size: 11px; }
.wk-library .wk-empty { margin: 48px auto; padding: 48px 20px; border-color: var(--theme-line-strong); }

/* Native dialog provides keyboard focus containment and Escape dismissal. */
.project-details-dialog { width: min(800px, calc(100vw - 40px)); max-width: none; max-height: min(860px, calc(100dvh - 40px)); padding: 0; border: 1px solid var(--theme-line-strong); border-radius: 18px; color: var(--theme-text); background: var(--theme-surface); box-shadow: var(--theme-shadow); overflow: hidden; }
.project-details-dialog[open] { display: flex; flex-direction: column; }
.project-details-dialog::backdrop { background: rgba(0, 0, 0, .42); backdrop-filter: blur(3px); }
.project-details-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--theme-line); }
.project-details-head > div { min-width: 0; }
.project-details-head p { margin: 0 0 7px; font-size: 12px; color: var(--theme-text-soft); }
.project-details-head h2 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.project-details-dialog .btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; border: 1px solid var(--theme-line-strong); border-radius: 9px; font: inherit; font-size: 13px; text-decoration: none; color: var(--theme-text); background: var(--theme-surface-soft); cursor: pointer; }
.project-details-dialog .btn-gold { background: var(--ui-accent); border-color: var(--ui-accent); color: #201b10; }
.project-details-close { flex-shrink: 0; }
.project-details-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px; scrollbar-gutter: stable; }
.project-details-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 26px; }
.project-details-meta dt { margin-bottom: 6px; font-size: 12px; color: var(--theme-text-soft); }
.project-details-meta dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.project-details-section + .project-details-section { margin-top: 26px; }
.project-details-section h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 15px; }
.project-details-section h3 > span { color: var(--theme-text-soft); font-size: 12px; font-weight: 400; }
.project-details-section p { margin: 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.project-details-assets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.project-details-assets section { padding: 14px; border: 1px solid var(--theme-line); border-radius: 10px; background: var(--theme-surface-soft); }
.project-details-assets h4 { display: flex; justify-content: space-between; margin: 0 0 10px; font-size: 13px; }
.project-details-assets h4 span { font-weight: 400; color: var(--theme-text-soft); }
.project-details-assets ul { list-style: none; margin: 0; padding: 0; }
.project-details-assets li { font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.project-details-empty { color: var(--theme-text-soft); }
.project-details-episodes { list-style: none; margin: 0; padding: 0; }
.project-details-episodes li { padding: 12px 0; border-bottom: 1px solid var(--theme-line); }
.project-details-episodes h4 { margin: 0 0 6px; font-size: 13px; }
.project-details-episodes p { color: var(--theme-text-soft); }
.project-details-source { margin-top: 26px; border-top: 1px solid var(--theme-line); padding-top: 18px; }
.project-details-source summary { cursor: pointer; font-size: 13px; font-weight: 650; }
.project-details-source pre { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; line-height: 1.8; color: var(--theme-text-soft); }
.project-details-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; padding: 16px 24px; border-top: 1px solid var(--theme-line); }
.project-details-footer > span { color: var(--theme-text-soft); font-size: 12px; }

@media (max-width: 640px) {
  .wk-library .wk-page-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .wk-library .wk-head-actions .btn { flex: 1; }
  .wk-library .wk-summary > div { padding: 14px; }
  .wk-library .wk-summary > div:nth-child(2) { border-right: 0; }
  .wk-library .wk-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--theme-line); }
  .project-details-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .project-details-head, .project-details-scroll, .project-details-footer { padding: 18px; }
  .project-details-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-details-assets { grid-template-columns: 1fr; }
}
