:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0e1522;
  color: #edf4ff;
}

* { box-sizing: border-box; }

body { margin: 0; }

.shell {
  width: calc(100% - 2rem);
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.hero { margin: 0 0 2rem; }

.hero-heading { display: flex; gap: 1rem; align-items: start; justify-content: space-between; }

.theme-toggle {
  flex: 0 0 auto;
  min-height: 2.5rem;
  border: 1px solid #30435f;
  border-radius: .55rem;
  padding: .5rem .7rem;
  background: #162235;
  color: #edf4ff;
  cursor: pointer;
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
}

.theme-toggle:hover { border-color: #9cccff; }
.theme-toggle:focus-visible { outline: 3px solid #78b7ff; outline-offset: 2px; }

.eyebrow {
  margin: 0 0 .4rem;
  color: #49617f;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.7rem); letter-spacing: -.05em; }

.summary { margin: .75rem 0 0; color: #536078; font-size: 1.08rem; }

.controls {
  display: grid;
  grid-template-columns: minmax(15rem, 2.3fr) repeat(2, minmax(10rem, 1fr)) auto;
  gap: .7rem;
  align-items: end;
  padding: 1rem;
  background: #fff;
  border: 1px solid #dfe5ef;
  border-radius: 1rem;
  box-shadow: 0 .45rem 1.4rem rgb(23 32 51 / .05);
}

.controls label:not(.toggle) { display: block; margin: 0 0 .35rem; color: #47546a; font-size: .8rem; font-weight: 700; }

input[type="search"], select {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #cdd6e4;
  border-radius: .55rem;
  padding: .55rem .7rem;
  background: #fff;
  color: inherit;
  font: inherit;
}

input[type="search"]:focus, select:focus { outline: 3px solid #b9d7ff; border-color: #2a6ecb; }

.toggle { display: flex; gap: .5rem; align-items: center; min-height: 2.65rem; white-space: nowrap; color: #33425b; font-size: .9rem; }
.toggle input { accent-color: #2067c7; inline-size: 1rem; block-size: 1rem; }

.status { min-height: 1.5rem; margin: 1.3rem 0 1rem; color: #596780; font-size: .92rem; }
.status.error { color: #a02d2d; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.15rem;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: #fff;
  border: 1px solid #dfe5ef;
  border-radius: .95rem;
  box-shadow: 0 .35rem 1.1rem rgb(23 32 51 / .045);
}

.image-wrap { display: grid; place-items: center; aspect-ratio: 4 / 3; background: repeating-conic-gradient(#eef1f5 0 25%, #fff 0 50%) 50% / 24px 24px; }
.image-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }

.card-content { display: grid; gap: .65rem; padding: .9rem .95rem 1rem; }
.card h2 { margin: 0; font-size: 1.05rem; line-height: 1.28; overflow-wrap: anywhere; }
.card h2 a { color: #173c78; text-decoration-thickness: .08em; text-underline-offset: .13em; }
.filename { margin: 0; color: #526078; font: .78rem/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }

.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { padding: .2rem .42rem; border-radius: 999px; background: #e9f1ff; color: #214f92; font-size: .72rem; font-weight: 700; }

.metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .7rem; margin: 0; }
.metadata div { min-width: 0; }
.metadata dt { color: #738097; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.metadata dd { margin: .08rem 0 0; color: #2b3850; font-size: .86rem; overflow-wrap: anywhere; }
.metadata[hidden] { display: none; }

.links { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .86rem; }
.links a { color: #1a5eaf; }

.empty { grid-column: 1 / -1; padding: 3.5rem 1rem; border: 1px dashed #bdc9da; border-radius: 1rem; text-align: center; color: #58667e; }
.empty h2 { margin: 0 0 .4rem; color: #34445e; }
.empty p { margin: 0; }

@media (max-width: 850px) {
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-label, #search { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 1.15rem); padding-top: 2rem; }
  .controls { grid-template-columns: 1fr; }
  .search-label, #search { grid-column: auto; }
  .toggle { min-height: 2rem; }
}


:root.theme-light {
  color-scheme: light;
  background: #f4f6fb;
  color: #172033;
}

:root.theme-light .theme-toggle {
  border-color: #cdd6e4;
  background: #fff;
  color: #172033;
}

:root.theme-light .theme-toggle:hover { border-color: #1a5eaf; }
:root.theme-light .theme-toggle:focus-visible { outline-color: #2a6ecb; }

:root:not(.theme-light) body { background: #0e1522; color: #edf4ff; }
:root:not(.theme-light) .eyebrow { color: #8fa0b8; }
:root:not(.theme-light) .summary { color: #afbdd1; }

:root:not(.theme-light) .controls,
:root:not(.theme-light) .card {
  background: #162235;
  border-color: #30435f;
  box-shadow: 0 .45rem 1.4rem rgb(0 0 0 / .28);
}

:root:not(.theme-light) .card { box-shadow: 0 .35rem 1.1rem rgb(0 0 0 / .28); }

:root:not(.theme-light) .controls label:not(.toggle),
:root:not(.theme-light) .toggle,
:root:not(.theme-light) .status,
:root:not(.theme-light) .filename,
:root:not(.theme-light) .empty { color: #afbdd1; }

:root:not(.theme-light) input[type="search"],
:root:not(.theme-light) select {
  border-color: #30435f;
  background: #101a2a;
}

:root:not(.theme-light) input[type="search"]::placeholder { color: #8fa0b8; }

:root:not(.theme-light) input[type="search"]:focus,
:root:not(.theme-light) select:focus {
  outline-color: #78b7ff;
  border-color: #78b7ff;
}

:root:not(.theme-light) .toggle input { accent-color: #78b7ff; }
:root:not(.theme-light) .status.error { color: #ff9d9d; }

:root:not(.theme-light) .image-wrap {
  background: repeating-conic-gradient(#172235 0 25%, #203149 0 50%) 50% / 24px 24px;
}

:root:not(.theme-light) .card h2 a,
:root:not(.theme-light) .links a { color: #9cccff; }

:root:not(.theme-light) .badge { background: #243d60; color: #d4e8ff; }
:root:not(.theme-light) .metadata dt { color: #8fa0b8; }
:root:not(.theme-light) .metadata dd,
:root:not(.theme-light) .empty h2 { color: #edf4ff; }

:root:not(.theme-light) .empty { border-color: #30435f; }

.advanced-filters {
  margin-top: .85rem;
  border: 1px solid #dfe5ef;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 .35rem 1.1rem rgb(23 32 51 / .035);
}

.advanced-filters summary {
  display: flex;
  gap: .6rem;
  justify-content: space-between;
  cursor: pointer;
  padding: .9rem 1rem;
  color: #33425b;
  font-size: .9rem;
  font-weight: 750;
}

.advanced-filters summary span { color: #738097; font-size: .78rem; font-weight: 600; }
.advanced-content { padding: 0 1rem 1rem; }
.advanced-intro { margin: 0 0 1rem; color: #596780; font-size: .86rem; }

.advanced-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.advanced-grid fieldset { min-width: 0; margin: 0; border: 1px solid #dfe5ef; border-radius: .7rem; padding: .85rem; }
.advanced-grid legend { padding: 0 .3rem; color: #47546a; font-size: .82rem; font-weight: 750; }

.range-filter { display: grid; grid-template-columns: minmax(7rem, 1fr) repeat(2, minmax(4.25rem, .7fr)); gap: .5rem; align-items: end; margin-top: .7rem; }
.range-filter:first-of-type { margin-top: 0; }
.range-filter > span, .loop-filter > label { color: #47546a; font-size: .78rem; font-weight: 700; }
.range-filter label { display: grid; gap: .25rem; color: #738097; font-size: .7rem; font-weight: 700; }

.advanced-filters input[type="number"], .advanced-filters select {
  width: 100%;
  min-height: 2.3rem;
  border: 1px solid #cdd6e4;
  border-radius: .45rem;
  padding: .45rem .55rem;
  background: #fff;
  color: inherit;
  font: inherit;
}

.advanced-filters input[type="number"]:focus, .advanced-filters select:focus { outline: 3px solid #b9d7ff; border-color: #2a6ecb; }
.loop-filter { display: grid; grid-template-columns: 1fr 1.25fr; gap: .5rem; align-items: end; margin-top: .7rem; }
.loop-filter .range-filter { grid-column: 1 / -1; }
.reset-filters { margin-top: 1rem; border: 1px solid #cdd6e4; border-radius: .5rem; padding: .5rem .7rem; background: transparent; color: #1a5eaf; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 700; }
.reset-filters:hover { background: #e9f1ff; }

@media (max-width: 850px) {
  .advanced-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .advanced-filters summary { align-items: start; flex-direction: column; }
  .range-filter { grid-template-columns: 1fr 1fr; }
  .range-filter > span { grid-column: 1 / -1; }
}

:root:not(.theme-light) .advanced-filters,
:root:not(.theme-light) .advanced-grid fieldset {
  background: #162235;
  border-color: #30435f;
  box-shadow: 0 .35rem 1.1rem rgb(0 0 0 / .28);
}

:root:not(.theme-light) .advanced-filters summary,
:root:not(.theme-light) .range-filter > span,
:root:not(.theme-light) .loop-filter > label,
:root:not(.theme-light) .advanced-grid legend { color: #afbdd1; }

:root:not(.theme-light) .advanced-filters summary span,
:root:not(.theme-light) .advanced-intro,
:root:not(.theme-light) .range-filter label { color: #8fa0b8; }

:root:not(.theme-light) .advanced-filters input[type="number"] {
  border-color: #30435f;
  background: #101a2a;
}

:root:not(.theme-light) .advanced-filters input[type="number"]:focus,
:root:not(.theme-light) .advanced-filters select:focus {
  outline-color: #78b7ff;
  border-color: #78b7ff;
}

:root:not(.theme-light) .reset-filters { border-color: #30435f; color: #9cccff; }
:root:not(.theme-light) .reset-filters:hover { background: #243d60; }
