/* Public community theme gallery (/themes). Builds on blog.css tokens, nav and footer. */
.themes-shell { flex: 1 0 auto; width: min(100% - 40px, 1180px); margin: 0 auto; padding: clamp(56px, 8vw, 96px) 0 96px; }
.themes-header { max-width: 760px; margin-bottom: 40px; }
/* Large type's side bearing makes the heading look indented; pull it back to the text edge. */
.themes-header h1 { margin: 14px 0 0 -.03em; font-size: clamp(38px, 6vw, 62px); font-weight: 500; letter-spacing: -.05em; line-height: 1.04; }
.themes-lede { margin: 18px 0 0; max-width: 600px; color: var(--text-muted); font-size: 17px; line-height: 1.6; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.themes-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }
.themes-search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); }
.themes-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent); }
.themes-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.theme-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform .15s, box-shadow .15s; }
.theme-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgb(19 24 35 / .1); }
.theme-card-link { display: block; color: inherit; }
.theme-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-hover); color: var(--text-muted); font-size: 28px; overflow: hidden; }
.theme-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.theme-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; background: rgb(15 18 26 / .72); color: #fff; font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.theme-body { display: flex; flex: 1; flex-direction: column; padding: 16px 18px 18px; }
.theme-body h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.theme-body h2 a { color: inherit; text-decoration: none; }
.theme-body h2 a:hover { color: var(--accent); }
.theme-body p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.theme-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; color: var(--text-muted); font-size: 13px; }
.theme-creator { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.theme-creator img { width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }
.theme-creator a, .theme-creator span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.theme-creator a:hover { color: var(--text); }
.theme-grid .empty-state { min-height: 180px; }
.theme-grid .empty-state a { color: var(--accent); margin-left: 4px; }

.themes-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 32px; }
.themes-pagination .btn-ghost { gap: 6px; justify-self: start; }
.themes-pagination .btn-ghost[rel="next"] { justify-self: end; }
.themes-page { color: var(--text-muted); font-size: 13px; }

.themes-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 64px; padding: 28px 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.themes-cta h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.themes-cta p { margin: 6px 0 0; color: var(--text-muted); line-height: 1.55; }
.themes-cta .btn-primary { padding: 11px 18px; font-size: 14px; }

@media (max-width: 680px) {
  .themes-shell { width: min(100% - 32px, 1180px); padding-top: 44px; }
  .themes-tools { flex-direction: column; align-items: stretch; }
  .themes-search { flex-basis: auto; }
  .theme-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .theme-body { padding: 12px 12px 14px; }
  .theme-body p { display: none; }
  .themes-cta { padding: 22px; }
}
@media (max-width: 380px) { .theme-grid { grid-template-columns: 1fr; } }

/* Theme listing dialog (mirrors the dashboard's theme detail layout). */
body:has(.theme-dialog[open]) { overflow: hidden; }
.theme-dialog { width: min(100% - 48px, 1120px); max-height: min(88dvh, 860px); padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgb(10 14 24 / .28); overflow: hidden; }
.theme-dialog[open] { display: flex; flex-direction: column; }
.theme-dialog::backdrop { background: rgb(10 14 24 / .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.theme-dialog-close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-muted); cursor: pointer; transition: color .15s, background .15s; }
.theme-dialog-close:hover { color: var(--text); background: var(--surface-hover); }
.theme-dialog-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(410px, 1fr); min-height: 0; overflow: auto; }
.theme-detail-media { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 24px; background: var(--bg); }
.theme-detail-media img { display: block; width: 100%; height: auto; max-height: min(66dvh, 640px); object-fit: contain; border-radius: 10px; border: 1px solid var(--border); }
.theme-detail-media .theme-thumb { border-radius: 10px; }
.theme-detail-info { display: flex; flex-direction: column; gap: 16px; padding: 32px 28px 28px; }
.theme-detail-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 40px 8px 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.theme-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.theme-detail-info .theme-meta { justify-content: flex-start; gap: 16px; margin: 0; padding: 0; }
.theme-detail-description { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.theme-detail-description a { color: var(--accent); text-underline-offset: 3px; }
.theme-detail-attribution { display: grid; gap: 3px; margin: 0; color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.theme-detail-attribution span { color: var(--text); font-weight: 600; }
.theme-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
/* Compact enough that all three actions share one row wherever the column allows. */
.theme-detail-actions > * { white-space: nowrap; }
.theme-detail-actions .btn-primary, .btn-outline { padding: 10px 13px; font-size: 14px; }
.theme-detail-actions .btn-primary { gap: 7px; }
.btn-outline { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .15s; }
.btn-outline:hover { background: var(--surface-hover); }
.theme-detail-hint { margin: 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
@media (max-width: 860px) {
  .theme-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; border-bottom: 0; }
  .theme-dialog-body { grid-template-columns: 1fr; }
  .theme-detail-media { padding: 16px 16px 0; background: transparent; }
  .theme-detail-info { padding: 18px 16px 20px; }
  .theme-detail-actions { gap: 6px; }
  .theme-detail-actions > * { flex: 1 1 auto; justify-content: center; }
  .theme-detail-actions .btn-primary, .theme-detail-actions .btn-outline { padding: 10px 10px; font-size: 13.5px; }
}

/* Multi-image viewer inside the theme dialog. */
.theme-viewer { display: flex; flex-direction: column; gap: 10px; }
.theme-viewer-stage { position: relative; }
.theme-viewer-stage img { display: none; width: 100%; max-height: min(66dvh, 640px); object-fit: contain; background: var(--surface); }
.theme-viewer-stage img.is-active { display: block; }
.theme-viewer-arrow { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in oklab, var(--surface) 88%, transparent); color: var(--text); cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .15s; }
.theme-viewer-arrow:hover { background: var(--surface); }
.theme-viewer-arrow[data-step="-1"] { left: 10px; }
.theme-viewer-arrow[data-step="1"] { right: 10px; }
.theme-viewer-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.theme-viewer-thumbs button { width: 64px; height: 48px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); cursor: pointer; opacity: .6; transition: opacity .15s, border-color .15s; }
.theme-viewer-thumbs button:hover { opacity: .9; }
.theme-viewer-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; border-radius: 0; }

/* In-page theme preview window (mirrors the dashboard's desktop preview). */
.theme-preview-window { width: min(100% - 48px, 1400px); height: min(100dvh - 48px, 960px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgb(10 14 24 / .32); overflow: hidden; }
.theme-preview-window[open] { display: flex; flex-direction: column; }
.theme-preview-window::backdrop { background: rgb(10 14 24 / .6); }
.theme-preview-window header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border); }
.theme-preview-window-title { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; font-weight: 600; }
.theme-preview-window-title > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Align the eye to the text baseline (not the line box) so it stays level with
   the name across fonts; -.25em centers the glyph on lowercase-with-ascenders. */
.theme-preview-window-title i { display: inline-block; color: var(--text-muted); }
.theme-preview-window-title i::before { display: inline-block; vertical-align: -.25em; }
.theme-preview-window-note { color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.theme-preview-window-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-preview-window-actions .btn-outline { padding: 7px 12px; font-size: 13px; }
.theme-preview-window .theme-dialog-close { position: static; }
.theme-preview-window-stage { position: relative; flex: 1; min-height: 0; background: var(--bg); }
.theme-preview-window-stage iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); opacity: 0; transition: opacity .15s; }
.theme-preview-window-stage iframe.is-loaded { opacity: 1; }
.theme-preview-window-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--text-muted); font-size: 13px; }
@media (max-width: 860px) {
  .theme-preview-window { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
.theme-preview-window-status[hidden] { display: none; }

/* Sign-up prompt shown to signed-out visitors past the public page limit. */
.themes-gate { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; }
.themes-gate h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.themes-gate p { margin: 0; color: var(--text-muted); font-size: 16px; line-height: 1.6; }
.themes-gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.themes-gate-actions .btn-primary, .themes-gate-actions .btn-outline { padding: 11px 18px; font-size: 14px; }
.themes-gate-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.themes-gate-back:hover { color: var(--text); }
