/* /resources/: cards for sites, open data and archives (templates/resources.html). Each category has a hue
   (--rs-h, from registry/resources.yaml); light and dark tints are derived here from the site's colour roles. */
:root { --rs-l: 94%; --rs-l2: 86%; --rs-ink-l: 30%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rs-l: 17%; --rs-l2: 24%; --rs-ink-l: 78%; } }
:root[data-theme="dark"] { --rs-l: 17%; --rs-l2: 24%; --rs-ink-l: 78%; }

.rs-agentline { color: var(--ink-2); margin-top: 8px; }
.rs-tools { display: grid; gap: 10px; margin-bottom: 22px; }
.rs-q { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-chip { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.rs-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.rs-chip[aria-pressed="true"] .muted { color: rgba(255, 255, 255, 0.8); }
.rs-random { margin-left: auto; border-style: dashed; }
.rs-count { margin: 0; }

.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rs-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: linear-gradient(160deg, hsl(var(--rs-h) 70% var(--rs-l)) 0%, var(--surface) 70%); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease; min-height: 150px; }
.rs-card, .rs-card:hover, .rs-idea, .rs-idea:hover, .rs-part, .rs-part:hover { text-decoration: none; }
.rs-card:hover, .rs-card:focus-visible { transform: translateY(-2px); border-color: hsl(var(--rs-h) 60% 50%); }
.rs-card[hidden] { display: none; }
.rs-card-top { display: flex; align-items: center; gap: 8px; }
.rs-glyph { font-size: 22px; line-height: 1; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: hsl(var(--rs-h) 65% var(--rs-l2)); }
.rs-cat { font-size: 12px; color: hsl(var(--rs-h) 45% var(--rs-ink-l)); }
.rs-name { font-size: 1.02rem; }
.rs-hook { font-size: 13.5px; color: var(--ink-2); flex: 1; }
.rs-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.rs-b { font-size: 11.5px; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.rs-b.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 35%, transparent); }
.rs-b.warn { color: #8a5a00; border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.rs-b.bad { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.rs-b.live i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--down-mark); margin-right: 5px; vertical-align: 1px; animation: rs-pulse 1.6s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rs-b.warn { color: #f5c04a; } }
:root[data-theme="dark"] .rs-b.warn { color: #f5c04a; }
@keyframes rs-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rs-b.live i { animation: none; } .rs-card { transition: none; } }

.rs-topics { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 18px; }
.rs-topics .rs-chip { text-decoration: none; }
.rs-shelf .section-head h2 a { color: inherit; text-decoration: none; }
.rs-shelf .section-head h2 a:hover { text-decoration: underline; }
.rs-ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rs-idea { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.rs-idea:hover b, .rs-part:hover b, .rs-card:hover .rs-name { text-decoration: underline; }
.rs-idea-glyphs { font-size: 20px; letter-spacing: 4px; }

.rs-hero { display: grid; grid-template-columns: auto 1fr; gap: 20px; padding: 22px; margin-bottom: 8px;
  background: linear-gradient(150deg, hsl(var(--rs-h) 70% var(--rs-l)) 0%, var(--surface) 65%); }
.rs-hero h1 { margin: 2px 0 6px; }
.rs-hero .lede { margin: 0 0 6px; }
.rs-hero-glyph { font-size: 44px; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 18px; background: hsl(var(--rs-h) 65% var(--rs-l2)); }
.rs-kicker { margin: 0; }
.rs-hook-big { color: var(--ink-2); margin: 0 0 10px; }
.rs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.rs-warn { color: var(--down); margin: 10px 0 0; }
.rs-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 0 0 10px; }
.rs-fact { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.rs-fact dt { font-size: 12px; color: var(--meta); text-transform: uppercase; letter-spacing: .04em; }
.rs-fact dd { margin: 4px 0 0; font-weight: 600; }
.rs-quote { font-weight: 400; font-size: 13px; color: var(--ink-2); margin: 8px 0 0; padding-left: 10px; border-left: 3px solid hsl(var(--rs-h, 210) 55% 55%); overflow-wrap: anywhere; }
.rs-agent h2 { margin-top: 0; }
.rs-code { display: flex; gap: 8px; align-items: flex-start; }
.rs-code code { flex: 1; display: block; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.rs-more-ideas { margin-top: 12px; }
.rs-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.rs-part { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.rs-steps li { margin-bottom: 6px; }
table.data.rs-table td { vertical-align: top; white-space: normal; }
table.data.rs-table td:first-child { min-width: 260px; max-width: 520px; }

@media (max-width: 600px) {
  .rs-hero { grid-template-columns: 1fr; padding: 16px; }
  .rs-hero-glyph { width: 60px; height: 60px; font-size: 32px; }
  .rs-random { margin-left: 0; }
  .rs-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rs-card { min-height: 0; padding: 11px; }
  .rs-hook { font-size: 13px; }
  .rs-code { flex-direction: column; }
}
@media (max-width: 380px) { .rs-grid { grid-template-columns: 1fr; } }
