/* Script directory: /scripts and /scripts/<slug> (worker/directory.js). Uses the tokens in site.css. */

/* ---------- /scripts ---------- */
.dir-head { padding-bottom: 40px; }
.dir-list { padding-top: 0; }
.dir-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.dir-search { flex: 1 1 320px; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 6px; color: var(--muted); }
.dir-search:focus-within { box-shadow: 0 0 0 3px rgba(179,192,255,0.45); border-color: var(--accent); }
.dir-search svg { width: 18px; height: 18px; flex: none; }
.dir-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 17px/1.4 var(--sans); }
.dir-search input::placeholder { color: var(--muted); }
.dir-search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.6); }
.dir-count { margin: 0; color: var(--muted); font: 400 13px/1.4 var(--mono); letter-spacing: 0.04em; }

.dir-cats { display: flex; flex-wrap: wrap; gap: 8px; padding: 24px 0 8px; }
.dir-cats a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font: 500 14px/1.3 var(--head); text-decoration: none; }
.dir-cats a:hover { border-color: var(--border-strong); color: var(--text); }
.dir-cats[hidden], .dir-group[hidden], .dir-apps li[hidden] { display: none; }
.dir-cats span { color: var(--muted); font: 400 12px/1 var(--mono); }

.dir-group { padding-top: 48px; scroll-margin-top: 24px; }
.dir-group h2 { font-size: 28px; line-height: 1.1; display: flex; align-items: baseline; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.dir-n { color: var(--muted); font: 400 14px/1 var(--mono); letter-spacing: 0.04em; }

.dir-apps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 24px; }
.dir-apps li { border-bottom: 1px solid var(--border); min-width: 0; }
.dir-apps a { display: block; padding: 12px 0; color: var(--text); font: 500 16px/1.35 var(--sans); text-decoration: none; overflow-wrap: anywhere; }
.dir-apps a:hover { color: var(--accent); }
.dir-empty { margin-top: 32px; color: var(--text-2); }
.dir-source { margin-top: 48px; max-width: 760px; font-size: 14px; color: var(--muted); }
.dir-source a, .app-src a { color: var(--accent); }

/* ---------- /scripts/<slug> ---------- */
.app-head { padding-bottom: 48px; }
.app-head .pf-back { display: flex; width: fit-content; margin-bottom: 32px; }
.app-head h1 { overflow-wrap: anywhere; }
.app-body { padding-top: 0; }
.app-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 64px; align-items: start; }
.app-part { padding: 32px 0; border-top: 1px solid var(--border); }
.app-part:first-child { padding-top: 0; border-top: 0; }
.app-part h2 { font-size: 28px; line-height: 1.1; margin-bottom: 16px; }
.app-part p { color: var(--text-2); max-width: 680px; }
.app-part p + p { margin-top: 12px; }
.app-part b { color: var(--text); font-weight: 600; }
.app-tag { margin-bottom: 16px; }
.app-hosts { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.app-hosts li { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); overflow-wrap: anywhere; }
.app-src { font-size: 14px; color: var(--muted) !important; }
.app-watch { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.app-watch li { padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.app-watch h3 { font-size: 19px; line-height: 1.25; margin-bottom: 8px; color: var(--text); }
.app-watch p { font-size: 16px; }
.app-side { position: sticky; top: 96px; } /* clears the 72 px sticky header */
.app-cta h2 { font-size: 24px; line-height: 1.15; margin-bottom: 12px; overflow-wrap: anywhere; }
.app-cta p { color: var(--text-2); margin-bottom: 20px; font-size: 16px; }
/* "Check if your site loads <App>": the home page's scan form, stacked to fit the 380 px column. */
.app-cta { scroll-margin-top: 96px; }
.app-cta .urlform { flex-wrap: wrap; padding: 6px; }
.app-cta .urlform .globe { margin-left: 10px; }
.app-cta .urlform input { flex: 1 1 0; padding: 0 6px; }
.app-cta .urlform .btn { flex: 1 1 100%; justify-content: center; }
.app-more h2 { font-size: 28px; line-height: 1.1; margin-bottom: 16px; }
.app-more .dir-apps { margin-bottom: 24px; }

@media (max-width: 1100px) {
  .dir-apps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-cols { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .app-side { position: static; order: -1; } /* the scan box comes right after the app's name on narrow screens */
}
@media (max-width: 760px) {
  .dir-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .dir-apps a { font-size: 15px; }
  .dir-group h2, .app-part h2, .app-more h2 { font-size: 24px; }
  .dir-search { flex-basis: 100%; max-width: none; }
  .app-head .pf-back { margin-bottom: 24px; }
}
