/* imgsite gallery layer — dark-friendly default. */
:root { color-scheme: dark; }
body { margin: 0; font-family: system-ui, sans-serif; background: #141416; color: #ddd; line-height: 1.5; }
a { color: #7ab0ff; text-decoration: none; }
header.site { padding: 1rem 1rem 0; }
header.site h1 { font-size: 1.3rem; margin: 0; }
header.site p { color: #999; margin: 0.25rem 0 0; }

/* Grid, NOT CSS columns: multi-column layout fills column 1 top-to-
   bottom, then column 2 — DOM order (newest first) reads correctly
   only VERTICALLY, so a row shows mixed ages ("ordering by columns").
   Grid auto-flow (row) fills left-to-right, top-to-bottom: reading
   order == DOM order == newest→oldest. auto-fill makes it responsive
   without media queries. Cards crop to a uniform aspect so rows stay
   tidy; the details page shows the true image. */
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 1rem; padding: 1rem; align-items: start; }

/* The min() floor above (mobile audit #4): a bare minmax(360px, 1fr)
   makes 360px the column's MINIMUM, so iPhone-SE-class viewports
   (320px window, 288px content box) overflow by design — the layout
   viewport expanded 320→376 and the whole gallery panned sideways.
   min(360px, 100%) collapses the floor to the available width on
   narrow screens while leaving ≥360px viewports (and the 2-column
   tablet/desktop layout above ~736px) exactly as before. */

.card { background: #1d1d21; border: 1px solid #2c2c31; border-radius: 8px; overflow: hidden; }
/* Touch feedback (mobile audit #6): activation propagates from the
   pressed link up its ancestor chain, so .card:active fires while any
   part of the card is pressed. */
.card:active { border-color: #4a6fb5; }
.card:active img { opacity: 0.85; }
.card a.card-link { color: inherit; display: block; }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: #0d0d0f; min-height: 120px; }
.card img.pending {
	background: linear-gradient(100deg, #1d1d21 40%, #26262c 50%, #1d1d21 60%);
	background-size: 200% 100%;
}
/* Animate the placeholder only for users who haven't asked for reduced
   motion; the static gradient above still marks pending cards. */
@media (prefers-reduced-motion: no-preference) {
	.card img.pending { animation: shimmer 1.4s infinite; }
}
@keyframes shimmer { to { background-position: -200% 0; } }
/* Type floor (mobile audit #8): prompts were 13.6px / timestamps
   12px — legible but squint-grade on phones. 14px / 13px. */
.card .prompt { margin: 0.5rem 0.75rem 0.25rem; font-size: 0.875rem; overflow-wrap: anywhere; }
.card .prompt mark { background: #5b4a12; color: #ffe9a8; border-radius: 3px; padding: 0 1px; }
/* Meta row: timestamp left, vote counts right-justified on the same
   line (owner request, Oct 2026). The .counts wrapper is the single
   flex child on the right (likes + dislikes inside it, own gap), so
   space-between stays two-sided however many count spans exist. The
   time keeps its own type floor; counts are the same size and never
   wrap. The glyphs are the emoji heart pair (❤️/💔 — see the details
   page's vote CSS for why emoji, not text glyphs): color emoji ignore
   CSS `color`, so the stance tints below reach only the DIGITS; the
   glyphs ride natively colored (cards show tallies, not toggles — no
   unpressed state to desaturate). A card with a zero tally ships no
   span for it at all (server template guards it; the SSE handler adds
   one when a count first moves past zero, and drops the wrapper when
   both fall back to zero). */
.card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin: 0 0.75rem 0.75rem; }
.card .meta time { display: block; color: #999; font-size: 0.8125rem; }
.card .counts { display: flex; align-items: baseline; gap: 0.5rem; margin-left: auto; white-space: nowrap; }
.card .likes { color: #ff6b81; font-size: 0.8125rem; white-space: nowrap; }
.card .dislikes { color: #7f96ad; font-size: 0.8125rem; white-space: nowrap; }
/* Reaction badges: the top reaction keys by count (keys ARE the
   emoji — rendered directly; JS rebuilds them from image-reacted
   SSE). Own separator gap so a badge strip reads as one group next
   to the vote tallies. The .more span is the "…" overflow marker —
   more non-zero keys than the badge cap. */
.card .reacts { display: flex; align-items: baseline; gap: 0.4rem; padding-left: 0.35rem; border-left: 1px solid #2c2c31; font-size: 0.8125rem; white-space: nowrap; }
.card .react.more { color: #999; }
.sentinel { width: 100%; height: 1px; grid-column: 1 / -1; }

/* Search box (gallery header form). No-JS search is a plain GET to
   /search; JS adds debounced fragment swapping on top. */
header.site .head-row { display: flex; align-items: flex-start; gap: 1rem; }
header.site .head-row > div:first-child { flex: 1; min-width: 0; }
#search-form { padding: 0.15rem 0; }
#search-box {
	background: #1d1d21;
	color: #ddd;
	border: 1px solid #3c3c44;
	border-radius: 6px;
	padding: 0.35rem 0.6rem;
	font: inherit;
	width: min(20rem, 42vw);
}
#search-box:focus { outline: 1px solid #4a6fb5; border-color: #4a6fb5; }

/* Sort nav (gallery header): quiet inline links; the current mode is
   visually marked so the control reads as a state, not a mystery. */
.sort-nav { padding: 0.35rem 0 0; color: #999; font-size: 0.875rem; }
.sort-nav a { color: #7ab0ff; }
.sort-nav a[aria-current="page"] { color: #ddd; font-weight: 600; text-decoration: underline; }

/* Full-width search row on phones (mobile audit #9): the 42vw-capped
   box (164px at 390) was functional but cramped for real queries; on
   SE-class widths the header grew a tall stacked block. ≤480px the
   row wraps and the input takes the full width. */
@media (max-width: 480px) {
	header.site .head-row { flex-wrap: wrap; }
	#search-form { width: 100%; }
	#search-box { width: 100%; }
}

/* Search empty state — spans the CSS columns so it reads as a page
   note, not one column's card. */
.no-results { color: #999; padding: 2.5rem 1rem; text-align: center; grid-column: 1 / -1; }

/* "+N new" pill: shown while a search filter (M5) holds live arrivals
   back so the filtered view never lies; click clears the filter and
   prepends the batch. Padding sized for a ≥48px tap target (mobile
   audit #7) — it was 40px tall. */
#new-pill {
	position: fixed;
	left: 50%;
	bottom: 1.25rem;
	transform: translateX(-50%);
	z-index: 10;
	background: #2a4b8d;
	color: #fff;
	border: 1px solid #4a6fb5;
	border-radius: 999px;
	padding: 0.75rem 1.25rem;
	font: inherit;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
#new-pill:hover { background: #3560b0; }
#new-pill:active { background: #3560b0; transform: translateX(-50%) scale(0.96); }
#new-pill[hidden] { display: none; }
