/* ---------------------------------------------------------------------------
   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;
  --radius: 6px;
  --post-height: 200px;
  --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;
}

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

html { background: var(--bg); }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  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 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 */

#app { padding: 24px; max-width: 1400px; margin: 0 auto; }

.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: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  max-height:140px;
  overflow-y: auto;  
}

/* 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: 13px;
  color: var(--text);
  word-break: break-word;
}

/* -------------------------------------------------------------- post cards */

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

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

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

/* single hero thumbnail filling the left ~36% of the card */
.post-hero {
  flex: 0 0 36%;
  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;
}

/* "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;
}

.post-snippet {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-2);
  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: 8px;
}
.post-foot .post-date { margin-top: 0; }

.post-date { color: var(--text-3); font-size: 12px; 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-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; }

.post-image-item img {
  width: 100%;
  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 */
.post-image-item.fin-hero {
  width: min(500px, 50vw);
  margin: 20px 0 0;
}
.post-image-item.fin-hero img {
  aspect-ratio: auto;
  height: auto;
}

/* 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; }

.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; }

/* ------------------------------------------------------------ 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: 12px; }

.masonry-item {
  break-inside: avoid;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.masonry-item img {
  width: 100%;
  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); }

.masonry-item.fin img { 
   border: 2px solid var(--brand);
}
.masonry-item.fin img:hover { border-color: #d92a40; }

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

/* ---------------------------------------------------------------- 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; }

/* ------------------------------------------------------------------ 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; }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 640px) {
  #app { padding: 16px; }

  .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; }

  .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; }
}
