/* ---------------------------------------------------------------------------
   GARDEN theme — Geist bones (1px borders, 6px radius, 4px spacing scale,
   no animations, no transitions, no shadows, no gradients) with a vintage
   halftone-poster palette: deep botanical greens, red-pink brand, periwinkle
   links. Texture lives only on the page background; every component sits on
   a solid surface so nothing impedes reading.
--------------------------------------------------------------------------- */
:root {
  --bg: #04100a;
  --bg-2: #071a10;
  --bg-3: #0b2417;
  --border: #17402a;
  --border-strong: #26663f;
  --text: #e9f5ec;
  --text-2: #93cf9f;
  --text-3: #5f9e6d;
  --accent: #96a8ff;
  --brand: #f43b52;
  --brand-dark: #59101c;
  --danger: #f43b52;
  --app-mwidth: 1340px;
  --radius: 6px;
  --hero-thumb: 50%;
  --post-height: 320px;
  --list-post-height: 340px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}

/* Modern browsers — Chrome 121+, Edge 121+, Firefox, Safari 18.2+ */
* {
  scrollbar-width: 2px;
  scrollbar-color: #959aa1 transparent;
}

/* Legacy WebKit — older Chrome/Edge/Safari, radius, borders & shadows */
*::-webkit-scrollbar {
  width: 2px;
  height: 4px;
}

*::-webkit-scrollbar-track {
  /* background-color: rgba(255,255,255,.1); */
  background-color: #b1b4b4 !important;
  /* background-color: #afb0b1; */
  border-radius: 3px;
  padding: 1px;
}

*::-webkit-scrollbar-track:hover {
  background-color: #9b9ea1;
}

*::-webkit-scrollbar-track:active {
  background-color: #cbd5e1;
}

*::-webkit-scrollbar-thumb {
  background-color: #3a3d42;
  border-radius: 3px;
  min-height: 40px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: #40464f;
}

*::-webkit-scrollbar-thumb:active {
  background-color: #747981;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* stable gutter so the scrollbar appearing/disappearing never shifts layout */
html {
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: black;
  /* background-color: var(--bg); */
  /* vintage halftone grain: tiled SVG dot pattern, green on near-black */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23134422' fill-opacity='0.55'/%3E%3Ccircle cx='6' cy='6' r='1' fill='%23134422' fill-opacity='0.35'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--brand);
  color: #04100a;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
  background: var(--bg-3);
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* the search and tag/sort selects live below the prompt of the day on the
   home page; hide them while they're still parked in the topbar */
.topbar .controls,
.topbar .search {
  display: none;
}

.home-controls {
  margin-bottom: 12px;
}

.home-controls:empty {
  display: none;
}

/* search/filters + list tools stick below the topbar while scrolling */
.home-sticky {
  position: sticky;
  top: var(--topbar-h, 61px);
  z-index: 90;
  background: black;
  border-bottom: 1px solid var(--border);
  margin: 0 -24px 12px;
  padding: 10px 24px 10px;
}
.home-sticky .home-controls { margin-bottom: 10px; }
.home-sticky .list-tools { margin-bottom: 0; }

.list-sentinel { height: 1px; }

/* the post filters don't apply outside the posts views */
body.assets-page .search,
body.assets-page .controls {
  display: none;
}

.social {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}

.input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  height: 36px;
  padding: 0 10px;
}

.input:hover {
  border-color: var(--border-strong);
}

.input::placeholder {
  color: var(--text-3);
}

.search {
  flex: 1 1 200px;
  min-width: 140px;
}

.select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23a1a1a1' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn-sm {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.btn-primary {
  background: var(--brand);
  color: #04100a;
  border-color: var(--brand);
}

.btn-primary:hover {
  background: #d92a40;
  border-color: #d92a40;
}

/* -------------------------------------------------------------------- main */
/* min-height keeps the footer from jumping while a view renders */
#app {
  padding: 24px;
  max-width: var(--app-mwidth);
  margin: 0 auto;
  min-height: 60vh;
}

.status {
  color: var(--text-2);
  padding: 48px 0;
  text-align: center;
}

/* ------------------------------------------------------- prompt of the day */
.potd {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.potd > div {
  min-width: 0;
}

/* styled after the periwinkle "GARDEN" sign */
.potd-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1b1436;
  background: var(--accent);
  padding: 1px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
}

.potd-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
  max-height: 58px;
  /* ~3 lines; long prompts scroll, Copy stays visible */
  overflow-y: auto;
}

/* -------------------------------------------------------------- post cards */
.count {
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 12px;
}

.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.list-tools .count {
  margin-bottom: 0;
}

.list-actions {
  display: flex;
  gap: 8px;
}

.layout-toggle {
  display: flex;
}

.layout-toggle .btn {
  border-radius: 0;
}

.layout-toggle .btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.layout-toggle .btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-left: -1px;
}

.layout-toggle .btn.active {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-strong);
  z-index: 1;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* grid layout: full-width thumbnail on top, title + tags only */
.post-list.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.post-card-grid {
  flex-direction: column;
}

.post-card-grid .post-hero {
  flex: none;
  width: 100%;
  height: var(--post-height);
  min-height: 0;
  border-right: none;
  border-bottom: 1px solid var(--border);
}

.post-card-grid .post-hero.empty {
  height: 64px;
}

.post-card-grid .post-meta {
  padding: 12px 16px;
}

.post-card-grid .post-tags {
  margin-top: 8px;
}

.post-card {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

/* get  */
.post-card[data-source="GPT"] .post-meta {
  background-color: var(--bg);
}

.post-card[data-source="MJ"] .post-meta {
  background-color: var(--bg-2);
}

.post-card:hover {
  border-color: var(--border-strong);
}

/* single hero thumbnail filling the left ~36% of the card */
.post-hero {
  flex: 0 0 var(--hero-thumb);
  position: relative;
  min-height: var(--post-height);
  background: var(--bg-3);
  border-right: 1px solid var(--border);
}

.post-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* mult final sets: 2-column grid filling the hero area */
.post-hero-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 2px;
}

.post-hero-grid img {
  position: static;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

/* "fin" finals keep their red marker */
.post-hero.fin img {
  outline: 2px solid var(--border-dark);
  outline-offset: -2px;
}

.post-hero.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-meta {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px;
}

.post-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
}

/* prompt preview on list cards: dark scrollable box, pinned copy button */
.prompt-preview {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}

.prompt-preview-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 168px;
  overflow-y: auto;
  padding: 8px 76px 8px 10px;
  /* right gap clears the pinned toggle + copy buttons */
}

/* collapsed: a single ellipsized line until toggled open */
.prompt-preview.collapsed .prompt-preview-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: none;
}

.prompt-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

/* resource thumbnails on the card: small squares, no per-image actions;
   clicking opens the full image in the lightbox */
.card-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.card-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-3);
  cursor: zoom-in;
}
.card-thumb:hover { border-color: var(--border-strong); }

/* tags + date pinned to the card's bottom edge */
.post-meta {
  display: flex;
  flex-direction: column;
}
.post-bottom { margin-top: auto; padding-top: 12px; }
.post-bottom .post-tags { margin-top: 0; }

/* taller list cards (grid/masonry keep --post-height) */
.post-card:not(.post-card-grid) .post-hero {
  min-height: var(--list-post-height);
}

/* posts without a prompt preview (no gpt/mj/gem prefix) keep their height */
.post-card-short:not(.post-card-grid) .post-hero {
  min-height: 200px;
}

/* list mode: main column + sticky mini-thumbnail rail */
.list-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.list-wrap > .post-list,
.list-wrap > .masonry,
.list-wrap > .prompt-rows {
  flex: 1 1 auto;
  min-width: 0;
}

.post-rail {
  position: sticky;
  top: calc(var(--topbar-h, 61px) + 110px);
  flex: 0 0 64px;
  max-height: 62vh;
  overflow-y: auto;
  overflow-x:hidden;
  display: flex;
  flex-direction: column;
  /* padding-right: 2px; */
  /* gap: 6px; */
  /* padding: 2px; */
  background: var(--bg);
    scrollbar-width: none;     /* Hides scrollbar in Firefox */
  /* border: 1px solid var(--border); */
  /* border-radius: var(--radius); */
}

.post-rail::-webkit-scrollbar {
  display:none;
}
.post-rail:hover {
  scrollbar-width: auto;
}
.post-rail:hover::-webkit-scrollbar {
  display:block;
}
.rail-thumb {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bg);
  /* border-radius: 4px; */
  /* background: var(--bg-3); */
  cursor: pointer;
}
.rail-thumb:hover { border-color: var(--border-strong); }
.rail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* rail jumps land below the sticky topbar + home controls */
.post-card,
.masonry-item,
.prompt-row { scroll-margin-top: calc(var(--topbar-h, 61px) + 118px); }

/* prompts mode: compact title + copyable prompt rows */
.prompt-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}
.prompt-row:hover { border-color: var(--border-strong); }

.prompt-row-title {
  flex: 0 0 220px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-row-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-row .btn-icon { flex: 0 0 auto; }

.prompt-actions .btn { background: var(--bg-2); }

/* small resource-count badge on card thumbnails */
.hero-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 1;
  /* background: var(--accent);
  color: #1b1436; */
  background: var(--bg);
  /* color: #1b1436;  */
  color: var(--text-2);
  font-size: 10px;
  font-family: monospace;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.7;
  padding: 0 6px;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hero-badge svg {
  display: block;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  /* border-radius: 9999px; */
  font-size: 12px;
  color: var(--text-2);
  background-color: var(--bg-2);
  /* background: rgba(0, 0, 0, .7); */
  cursor: pointer;
}

.tag:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.tag.active {
  color: #04100a;
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
}

.post-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.post-foot .post-date {
  margin-top: 0;
}

.post-date {
  color: var(--text-2);
  font-size: 12px;
  font-family: monospace;
  margin-top: 8px;
}

.author-link {
  color: var(--accent);
  font-size: 12px;
}

.post-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.author-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* -------------------------------------------------------------- post view */
.post-view {
  max-width: 900px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 16px;
}

.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

.post-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.post-topnav .back-link {
  margin-bottom: 0;
}

.post-topnav {
  margin-bottom: 16px;
}

.post-cycle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-cycle-count {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.post-cycle .btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.post-view .post-title {
  font-size: 24px;
  line-height: 1.3;
}

.post-view .post-tags {
  margin: 12px 0 4px;
}

.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--post-height), 1fr));
  gap: 12px;
  margin: 20px 0;
}

.post-image-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Result section: single fin keeps the hero treatment; a mult set wraps */
.result-label {
  margin-top: 20px;
}

.result-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.result-row .post-image-item.fin-hero {
  margin: 0;
}

/* ordered-resource badge (res-a, res-b, …) */
.res-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  background: var(--bg);
  /* color: #1b1436;  */
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  padding: 0 7px;
  border-radius: 3px;
}

/* Resources: inset panel, clearly subordinate to the Result */
.resources-panel {
  margin-top: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.resources-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.resources-head .ref-label {
  margin-bottom: 0;
}

.post-images-resources {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin: 0;
}

.resources-panel .ref-section {
  margin: 16px 0 0;
}

/* fixed-width download/copy pair, left-aligned under the image */
.img-actions {
  display: flex;
  margin-top: -36px;
  margin-bottom: 4px;
  padding: 2px;
  gap: 6px;
}

.img-actions .btn {
  flex: 0 0 auto;
}

/* icon-only buttons: square, glyph centered */
.btn-icon {
  padding: 0;
  width: 32px;
}

.btn-icon.btn-sm {
  width: 28px;
}

.btn-icon svg {
  display: block;
}

.post-image-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
  background: var(--bg-3);
}

.post-image-item img:hover {
  border-color: var(--border-strong);
}

.post-image-item.fin img {
  border: 2px solid var(--brand);
}

.post-image-item.fin img:hover {
  border-color: #d92a40;
}

/* the fin final on its own row, shown uncropped, capped at 550px tall */
.post-image-item.fin-hero {
  width: min(700px, 50vw);
  margin: 20px 0 0;
}

.post-image-item.fin-hero img {
  /* the inline aspect-ratio (from build-time dims) reserves the box before
     load; the figure's inline width keeps the height <= 550px */
  width: 100%;
  height: auto;
  max-height: 550px;
  object-fit: contain;
}

.post-image-item .ref-label {
  align-self: flex-start;
  margin-bottom: 0;
}

/* fallback width for mult results when build-time dims are unavailable */
.post-image-item.fin-hero.result-multi {
  width: min(360px, 44vw);
}

/* midjourney reference-image sections */
.ref-section {
  margin: 4px 0 16px;
}

.ref-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  padding: 1px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
}

.post-images-refs {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin: 0;
}

.post-content {
  margin-top: 20px;
}

/* prompt directly under the fin image, with breathing room after it */
.post-content-prompt {
  margin-top: 16px;
  padding-bottom: 16px;
}

.post-content p {
  margin: 0 0 12px;
  color: var(--text);
}

.post-content h1,
.post-content h2,
.post-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 8px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 12px 20px;
  color: var(--text);
}

.post-content li {
  margin-bottom: 4px;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.codeblock {
  position: relative;
  margin: 0 0 12px;
}

.codeblock pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  padding-right: 64px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.codeblock .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ----------------------------------------------------------- style catalog */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.style-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}

.style-card:hover {
  border-color: var(--border-strong);
}

.style-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.style-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-media.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.style-card-meta {
  padding: 12px 16px;
}

.style-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.style-type {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #04100a;
}

.style-type-sref {
  background: var(--accent);
}

.style-type-profile {
  background: #ffae00;
}

.style-type-mood {
  background: #3ddc5a;
}

.style-type-style {
  background: var(--text-3);
}

.code-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 8px;
  cursor: copy;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-chip:hover {
  border-color: var(--text-3);
}

.active-filter {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.style-used {
  margin-top: 20px;
}

.style-used-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ------------------------------------------------------------ assets page */
.assets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.assets-head .count {
  margin-bottom: 0;
}

.masonry {
  columns: 220px;
  column-gap: 2px;
}

.masonry-item {
  break-inside: avoid;
  margin: 0 0 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid transparent;
}

.masonry-item img {
  width: 100%;
  height: auto;
  /* border: 1px solid var(--border); */
  border-radius: var(--radius);
  cursor: zoom-in;
  background: var(--bg-3);
}

.masonry-item img:hover {
  border-color: var(--border-strong);
}

/* front-page masonry: tags overlaid on the image, natural aspect ratios */
.post-masonry-item {
  position: relative;
  cursor: pointer;
}

.post-masonry-item img {
  cursor: pointer;
}

.masonry-tags {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  /* top: 8px;
  left: 8px;
  right: 8px; */
  /* border-radius: 0; */
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 1;
}

.masonry-tags .tag {
  opacity: 0;
}

.masonry-tags:hover .tag {
  opacity: 1;
}

.post-masonry-text {
  background: var(--bg-2);
  /* border: 1px solid var(--border); */
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
}

.post-masonry-text:hover {
  border-color: var(--border-strong);
}

.post-masonry-text .post-title {
  font-size: 14px;
}

.post-masonry-text .masonry-tags {
  position: static;
  margin-top: 8px;
}

.masonry-item.fin img {
  /* border: var(--border-dark); */
  border: 1px solid transparent;
  /* border: 1px solid var(--brand-dark); */
}

.masonry-item.fin img:hover {
  border-color: var(--brand)
}

.post-zip {
  margin-top: 12px;
}

/* ------------------------------------------------------------ content tree */
.tree-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.tree-modal[hidden] {
  display: none;
}

.tree-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(720px, 100%);
  /* width: 100%; */
  /* max-height: calc(100vh - 48px); */
  max-height: 80vh;
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.tree-heading {
  font-weight: 600;
  font-size: 15px;
}

.tree-body {
  overflow: auto;
  padding: 16px;
  min-width: 540px;
  width: 100%;
}

.tree-graph {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tree-group {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* collapsed groups show just their tag chip */
.tree-group.collapsed .tree-posts { display: none; }

.tree-tag { cursor: pointer; font-family: var(--font-sans); }

.tree-count {
  margin-left: 4px;
  color: var(--text-3);
  font-size: 11px;
}

.tree-chevron {
  margin-left: auto;
  display: inline-flex;
  color: var(--text-3);
}

.tree-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 160px;
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--border-strong);
  /* border-radius: 9999px; */
  background: var(--bg);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.tree-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  flex: 0 0 auto;
}

.tree-posts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tree-post {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.tree-post:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

/* ---------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.lightbox-counter {
  color: var(--text-2);
  font-size: 13px;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
}

.lightbox-img {
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
}

.lightbox-nav:hover {
  border-color: var(--border-strong);
}

.lightbox-nav.prev {
  left: 12px;
}

.lightbox-nav.next {
  right: 12px;
}

.lightbox-nav[disabled] {
  opacity: 0.3;
  cursor: default;
}

/* ------------------------------------------------------------------- links */
.links-section {
  margin-top: 20px;
}

.link-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.link-row:last-child {
  border-bottom: none;
}

.link-row a {
  white-space: nowrap;
}

.link-desc {
  color: var(--text-2);
  font-size: 13px;
}

/* ------------------------------------------------------------- back to top */
.back-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 90;
  width: 36px;
  height: 36px;
  background: var(--bg-2);
}

.back-top[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ footer */
.footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px 24px;
  text-align: center;
}

.footer-link {
  color: var(--text-3);
  font-size: 12px;
}

.footer-link:hover {
  color: var(--text-2);
}

/* --------------------------------------------------------------------- 404 */
.notfound {
  text-align: center;
  padding: 64px 0;
}

.notfound-code {
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 64px;
  color: var(--brand);
  line-height: 1;
}

.notfound-text {
  color: var(--text-2);
  margin: 12px 0 20px;
}
/* @media (max-width: 840px) {
  #app {
    padding: 8px;
  }
    .topbar-row {
    padding: 10px 16px;
    gap: 8px;
  }

} */
/* ------------------------------------------------------------------ mobile */
@media (max-width: 840px) {
    #app {
    padding: 4px;
  }
    .topbar-row {
    padding: 10px 16px;
    gap: 8px;
  }
  .search {
    order: 3;
    flex-basis: 100%;
  }

  .controls {
    order: 4;
    flex-basis: 100%;
  }

  .controls .select {
    flex: 1 1 0;
    min-width: 0;
  }

  /* prompts mode: title stacks above the prompt on narrow screens */
  .prompt-row { flex-wrap: wrap; }
  .prompt-row-title { flex-basis: 100%; }

  /* no thumbnail rail on small screens */
  .post-rail { display: none; }

  .home-sticky {
    margin: 0 -16px 12px;
    padding: 8px 16px;
  }

  /* grid stays at least two-up even on small screens; shorter thumbnails
     so half-width cards keep sane proportions */
  .post-list.grid {
    gap: 8px;
  }

  .post-card-grid .post-hero {
    height: 180px;
  }

  .post-card-grid .post-meta {
    padding: 8px;
  }

  .post-card-grid .post-meta .post-title {
    font-size: 12px;
  }

  .post-card-grid .post-meta .post-tags .tag {
    padding: 0 2px;
    height: 22px;
  }

  .list-tools {
    flex-wrap: wrap;
  }

  .tree-group {
    gap: 20px;
  }

  .tree-tag {
    flex-basis: 110px;
  }

  .post-meta {
    padding: 6px;
  }

  .post-card {
    flex-direction: column;
  }

  .post-hero {
    flex: none;
    min-height: 0;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .post-hero.empty {
    height: 48px;
  }

  .potd {
    flex-direction: column;
  }

  .post-images {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .lightbox-img {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 140px);
  }

  .lightbox-nav.prev {
    left: 8px;
    top: auto;
    bottom: 12px;
    transform: none;
  }

  .lightbox-nav.next {
    right: 8px;
    top: auto;
    bottom: 12px;
    transform: none;
  }

  .social {
    display: none;
  }

  .post-view {
    padding: 6px;
  }
}