*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; }
body { font-family: system-ui, sans-serif; margin: 0; color: #0f172a; background-color: #f8fafc; }
header.dcl-header { background-color: #0f172a; color: #ffffff; padding: 1rem 1.5rem; }
header.dcl-header a { color: #ffffff; text-decoration: none; font-weight: 700; }
main { max-width: 56rem; margin: 0 auto; padding: 1.5rem; }
h1.dcl-page-title { font-size: 2rem; line-height: 1.2; margin: 0 0 1rem; overflow-wrap: anywhere; }
p.dcl-page-lead { margin: 0 0 1.5rem; color: #334155; overflow-wrap: anywhere; }
/* issue #592/#544: a labelled search region, search as the flexible primary
   control and the category filter a narrower fixed-basis filter on wide
   screens; both stay native, keyboard-operable controls with their own
   visible <label>. Each `.dcl-field` wrapper is a *column* flex container
   (label stacked above its control), so the desktop width/proportion
   rules that make search wider than the category filter live on the
   wrappers themselves (`.dcl-field-search`/`.dcl-field-category`, sized on
   the *row* `.dcl-toolbar`'s main axis) -- never as a `flex-basis` on the
   control, which would size the control's height (the wrapper's main
   axis), not its width. */
.dcl-toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; }
.dcl-field { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.dcl-field label { font-size: 1rem; font-weight: 600; color: #334155; }
.dcl-field-search { flex: 2 1 20rem; }
.dcl-field-category { flex: 1 1 12rem; }
#search-input { width: 100%; padding: 0.75rem 1rem; border: 1px solid #94a3b8; border-radius: 6px; font: inherit; min-height: 44px; }
#category-select { width: 100%; padding: 0.75rem 1rem; border: 1px solid #94a3b8; border-radius: 6px;
  font: inherit; background-color: #ffffff; color: #0f172a; min-height: 44px; }
#result-count { margin: 0 0 1.5rem; color: #334155; font-size: 1rem; overflow-wrap: anywhere; }
/* issue #544: phones get a stacked, full-width, 44px-tall search and category
   filter instead of the desktop's side-by-side layout above this width. */
@media (max-width: 40rem) {
  .dcl-toolbar { flex-direction: column; align-items: stretch; }
  .dcl-field { width: 100%; }
  /* issue #592 fix: `.dcl-field-search`/`.dcl-field-category` set an
     explicit `flex-basis` (`20rem`/`12rem`) for their desktop
     proportions. A flex item's *used* basis comes from `flex-basis`
     when it is not `auto`, never from `width` -- so the `.dcl-field {
     width: 100%; }` rule above never actually overrides either
     wrapper's basis, and at widths where both desktop bases (plus the
     toolbar's gap) still fit, they stay side by side instead of
     stacking. Overriding each wrapper's own `flex`/`width` here, at the
     same specificity the desktop rules use, is what actually flattens
     both to one full-width column at this breakpoint. */
  .dcl-field-search { flex: 1 1 100%; width: 100%; }
  .dcl-field-category { flex: 1 1 100%; width: 100%; }
  #search-input, #category-select { width: 100%; min-height: 44px; }
}
/* issue #592: a preview-first gallery -- the grid track shrinks below
   16rem rather than forcing a card (and its preview iframe) wider than the
   viewport, so nothing overflows horizontally even at 360px. */
.dcl-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1.5rem; }
.dcl-card { display: flex; flex-direction: column; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; background-color: #ffffff; }
.dcl-card-preview { width: 100%; margin-bottom: 1rem; }
.dcl-preview-frame { display: block; width: 100%; height: 12rem; border: 1px solid #e2e8f0; border-radius: 6px; background-color: #ffffff; }
.dcl-card-body { min-width: 0; }
h2.dcl-card-title { margin: 0 0 0.75rem; font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
h2.dcl-card-title a { color: #1d4ed8; text-decoration: none; }
p.dcl-card-category { margin: 0 0 0.75rem; color: #0f172a; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; overflow-wrap: anywhere; }
p.dcl-card-tags { margin: 0; color: #334155; font-size: 1rem; overflow-wrap: anywhere; }
.dcl-detail section { margin-bottom: 2rem; }
.dcl-meta { margin: 0 0 1.5rem; color: #334155; overflow-wrap: anywhere; }
.dcl-meta .dcl-card-category, .dcl-meta .dcl-card-tags { margin: 0; display: inline; }
pre { background-color: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#preview { border: 1px dashed #94a3b8; border-radius: 8px; padding: 1.5rem; background-color: #ffffff; max-width: 100%; overflow-x: auto; }
.dcl-report { background-color: #fff7ed; border: 1px solid #fb923c; border-radius: 8px; padding: 1rem; }
.dcl-nav { background-color: #e2e8f0; padding: 0.75rem 1.5rem; font-size: 1rem; overflow-wrap: anywhere; }
.dcl-nav a { color: #0f172a; text-decoration: underline; margin-right: 1rem; }
.dcl-feedback { border: 1px solid #94a3b8; border-radius: 8px; padding: 1rem; background-color: #ffffff; margin-top: 3rem; }
.dcl-feedback a { color: #1d4ed8; }
.dcl-footer { max-width: 56rem; margin: 0 auto; padding: 1rem 1.5rem 2rem; color: #334155; font-size: 1rem; overflow-wrap: anywhere; }
.dcl-footer a { color: #1d4ed8; }
.dcl-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 1rem; }
.dcl-copy { font: inherit; font-weight: 600; padding: 0.75rem 1.5rem; border: 1px solid #1d4ed8; border-radius: 6px; cursor: pointer; color: #ffffff; background-color: #1d4ed8; }
.dcl-copy:hover { background-color: #1e3a8a; }
.dcl-copy-status { color: #065f46; font-weight: 600; }
/* issue #592: every native control and link keeps a visible, AA-boundary
   focus ring (never only a colour change, which reduced-motion users and
   a glance at a screenshot both miss). */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #0f172a; outline-offset: 2px;
}
/* issue #592 fix: the rule above draws the same dark (#0f172a) outline
   the header's own background (#0f172a) is painted in, so a tabbed
   header link previously showed no visible focus boundary at all --
   this context-specific override (higher specificity than the generic
   rule, so it always wins for links inside the header) swaps in a
   colour that is visible, and AA (>= 3:1 UI-boundary contrast), against
   that one dark background instead. */
header.dcl-header a:focus-visible {
  outline: 2px solid #ffffff; outline-offset: 2px;
}
/* issue #592: no nonessential motion for a visitor who asked for less. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto !important; }
}
