/* Calculator widget gallery (/calculator-widget/) and the per-widget pages
   (/calculator-widget/<slug>/), 2026-10-14. Loaded only on those pages,
   after wm-tools.css, so it reuses its tokens (--wm-green, --wm-line ...).
   Every selector starts with .wg or is scoped to a widget page. */

/* ---- gallery ------------------------------------------------------------ */
.wg { max-width: 1320px; margin: 6px auto 0; padding: 0 24px; }
.wg-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; }
.wg-jump a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--wm-line);
  border-radius: 999px; background: #fff; color: var(--wm-text); font: 600 .875rem/1 'Segoe UI', system-ui, sans-serif; }
.wg-jump a span { color: var(--wm-mute); font-weight: 500; }
.wg-jump a:hover { border-color: var(--wm-green-line); background: var(--wm-green-bg); color: var(--wm-green); text-decoration: none; }
.wg-jump a:focus-visible { outline: 2px solid var(--wm-green-2); outline-offset: 2px; }
.wg-group { margin-top: 30px; scroll-margin-top: 72px; }
.wg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 0 0 14px; }
.wg-head h2 { margin: 0; padding: 0; border: 0; font-size: 1.375rem; line-height: 1.25; letter-spacing: -.015em; color: var(--wm-ink); scroll-margin-top: 72px; }
.wg-head p { margin: 0; color: var(--wm-mute); font-size: .95rem; }
.wg-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.wg-grid li { margin: 0; }
.wg-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: #fff; border: 1px solid var(--wm-line); border-radius: 14px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(15,23,42,.05);
  transition: border-color var(--wm-mid) var(--wm-ease), box-shadow var(--wm-mid) var(--wm-ease), transform var(--wm-mid) var(--wm-ease); }
.wg-card:hover { border-color: var(--wm-green-line); box-shadow: 0 10px 26px rgba(15,23,42,.09); transform: translateY(-2px); }
.wg-shot { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: top center;
  background: var(--wm-soft); border-bottom: 1px solid var(--wm-line); }
.wg-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; }
.wg-name { margin: 0; padding: 0; border: 0; font-size: 1.0625rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.wg-name a { color: var(--wm-ink); }
.wg-name a:hover { color: var(--wm-green); text-decoration: none; }
/* the name link covers the whole card, so a tap anywhere opens the widget page */
.wg-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 14px; }
.wg-name a:focus-visible { outline: none; }
.wg-name a:focus-visible::after { outline: 2px solid var(--wm-green-2); outline-offset: -2px; }
.wg-desc { margin: 0; color: var(--wm-text); font-size: .925rem; line-height: 1.55; }
.wg-meta { margin: 0; color: var(--wm-mute); font-size: .8125rem; }
.wg-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; }
.wg-copy { position: relative; z-index: 2; min-height: 40px; padding: 0 16px; font-size: .875rem; }
.wg-copy.done, .wg-copy.done:hover { background: #166534; border-color: #166534; color: #fff; }
.wg-more { font-size: .84rem; font-weight: 600; color: var(--wm-green); }
.wg-more::after { content: " \2192"; }
.wg-card:hover .wg-more { text-decoration: underline; }
.wg-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 860px) { .wg { padding: 0 14px; } .wg-group { margin-top: 24px; } }
@media (prefers-reduced-motion: reduce) { .wg-card { transition: none; } .wg-card:hover { transform: none; } }

/* ---- one widget's page -------------------------------------------------- */
.wg-page .wm-ec-preview iframe { margin: 0 auto; }
.wg-page .wm-ec .wm-row > label { flex: 0 1 150px; }
.wg-page .wm-ec .wm-row .wm-field { font-family: 'Segoe UI', system-ui, sans-serif; }
.wg-try { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 18px; }
.wg-try .wm-chip { font-weight: 600; color: var(--wm-green); border-color: var(--wm-green-line); background: var(--wm-green-bg); }
.wg-url { display: block; overflow-x: auto; white-space: nowrap; padding: 8px 12px; margin: 8px 0 0; }
/* related widget cards inside the article column: undo the article type scale */
.wg-page .content .wg-grid { margin-top: 16px; padding: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.wg-page .content .wg-grid li { margin: 0; }
.wg-page .content .wg-card .wg-name { font-size: 1.0625rem; margin: 0; }
.wg-page .content .wg-card .wg-name a { color: var(--wm-ink); }
.wg-page .content .wg-card .wg-desc { font-size: .925rem; line-height: 1.55; }
.wg-page .content .wg-card .wg-meta { font-size: .8125rem; line-height: 1.5; }
/* long link examples (query strings) must wrap on a 360 px phone */
.wg-page .content p, .wg-page .content li { overflow-wrap: anywhere; }
