/* Space Cat Systems gallery. art-gallery aesthetic: tight contact-sheet grid,
   squared edges, hover-revealed captions, sticky footer. */

:root {
  --bg: #121212;
  --bg-soft: #181818;
  --card: #1b1b1b;
  --border: #2a2a2a;
  --border-hover: #3d3d3d;
  --text: #ececec;
  --text-soft: #c9c9c9;
  --muted: #9b9b9b;
  --thumb: #0d0d0d;
  --accent: #d9a441;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --danger: #e06c6c;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Baskerville, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* keep the scrollbar gutter on every page so centered content (header,
   footer) never shifts when scrolling or when the lightbox locks scroll */
html { scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
  /* sticky footer: page is a full-height flex column */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a, button { touch-action: manipulation; }
.wrap { width: 100%; max-width: 2000px; margin: 0 auto; padding: 0 24px; }
/* gallery fills wide screens without hugging the edges */
.gallery-page { width: 100%; max-width: 2000px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; }

/* admin-configurable heading above everything on the homepage. serif by
   default; the custom CSS pack (Parker's look) switches it back to sans +
   the magenta glow. */
.home-header {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: 2px;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  margin: 36px auto 0;
  max-width: 100%;
}
.home-tagline {
  font-family: var(--serif);
  text-align: center;
  color: var(--accent);
  font-size: 17px;
  letter-spacing: 0.5px;
  margin: 12px auto 0;
  white-space: nowrap;
  max-width: 100%;
}
.muted { color: var(--muted); }

/* header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 8px 0; }
.site-header .wrap { padding-right: 20px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 34px; width: auto; display: block; opacity: 0.95; }
.brand:hover img { opacity: 1; }
.nav { display: flex; gap: 26px; font-size: 13.5px; letter-spacing: 0.02em; color: var(--muted); align-items: center; }
.nav-icons { display: inline-flex; align-items: center; gap: 14px; }
.nav-label { display: none; }
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger:hover { color: var(--text); }
.mobile-search { display: none; }
@media (max-width: 640px) {
  .hamburger { display: inline-flex; }
  .mobile-search { display: block; margin: 10px 0 26px; }
  /* backdrop-filter turns the header into a containing block for fixed
     descendants, trapping the full-screen menu inside it — drop it on mobile */
  .site-header { backdrop-filter: none; }
  .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--bg);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 18px 20px 14px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .nav.open { opacity: 1; pointer-events: auto; }
  .mobile-search form { position: relative; }
  .mobile-search .search-glyph { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
  .mobile-search input {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 14px 14px 40px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .mobile-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
  .nav > a {
    display: flex;
    align-items: center;
    font-size: 22px;
    font-family: var(--serif);
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
  }
  .nav > a.on { color: var(--accent); }
  .nav-icons {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    margin-top: auto;
    padding: 14px 0 6px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--bg);
  }
  .nav-icons .nav-icon {
    flex: 1;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    background: var(--bg-soft);
    font-size: 15px;
    color: var(--text-soft);
  }
  .nav-icons .nav-icon:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
  #search-toggle { display: none; }
  .nav-label { display: inline; }
}
.nav-icon { background: none; border: none; color: inherit; cursor: pointer; padding: 2px; display: inline-flex; align-items: center; }
.nav-icon:hover { color: var(--text); }
.nav a:hover, .nav a.on { color: var(--text); }

/* header search popover */
.header-search { position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 10px); width: min(520px, calc(100vw - 32px)); z-index: 20; }
.header-search[hidden] { display: none; }
.header-search form { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4); }
.header-search .search-glyph { position: absolute; left: 21px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.header-search input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px 10px 36px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.header-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.header-search input::placeholder { color: var(--muted); }
.theme-toggle {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  opacity: 0.8;
}
.theme-toggle:hover { color: var(--text); opacity: 1; }
/* the space cat logo is drawn for dark backgrounds; flip it in light mode */
.light .brand img { filter: invert(1); }

/* main content grows to push the footer down */
main { flex: 1 0 auto; }

/* tag filter row */
.tag-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 26px 0 16px; }
.chip {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 2px;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-hover); }
.chip.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* gallery grid. contact sheet: images border each other */
.grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(270px, 300px));
  justify-content: center;
  align-content: start;
  gap: 8px;
  margin: 0;
  padding: 26px 0 40px;
}
.grid.v-fill { flex: 1; }
.card {
  position: relative;
  background: var(--thumb);
}
.thumb {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card:hover .thumb img { transform: scale(1.04); }

/* hover caption overlay */
.card-overlay {
  position: absolute;
  inset: 1px; /* inside the accent border, so the frame stays visible */
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0) 55%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover .card-overlay,
.card:focus-visible .card-overlay { opacity: 1; }
.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--danger);
  border: 1px solid rgba(224, 108, 108, 0.6);
}
.card-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.card-meta { margin-top: 3px; font-size: 11.5px; color: #bcbcbc; letter-spacing: 0.04em; }

/* touch devices have no hover. keep the caption visible */
@media (hover: none) {
  .card-overlay { opacity: 1; background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0) 55%); }
}

.empty { margin: 0 auto; text-align: center; color: var(--muted); padding: 60px 0; }
.empty a { color: var(--accent); }

/* message of the day */
.motd {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  padding: 10px 48px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.motd[hidden] { display: none; }
.motd-text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-soft); white-space: pre-line; text-align: center; }
.motd-close { position: absolute; right: 14px; top: 8px; background: none; border: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px; }
.motd-close:hover { color: var(--text); }

/* pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 6px 0 46px; flex-wrap: wrap; }
.pagination a {
  min-width: 34px;
  text-align: center;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13.5px;
  color: var(--muted);
}
.pagination a:hover { color: var(--text); border-color: var(--border-hover); }
.pagination a.on { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* post page */
.back { display: block; max-width: 1000px; margin: 30px auto 6px; font-size: 13.5px; color: var(--muted); letter-spacing: 0.04em; }
.back:hover { color: var(--accent); }
.post-page article { max-width: 1000px; margin: 0 auto; }
.post-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  margin: 10px 0 4px;
  letter-spacing: 0.01em;
}
.post-desc { color: var(--text-soft); white-space: pre-line; max-width: 760px; margin: 18px 0 6px; }
.post-desc-below { max-width: 1000px; margin: 0 auto 60px; }
.post-images {
  margin: 26px auto 60px;
  max-width: 1200px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.post-figure {
  margin: 0;
  width: 100%;
  min-width: 0;
  justify-self: center;
  position: relative;
  cursor: zoom-in;
}
.post-figure:only-child {
  grid-column: 1 / -1;
  max-width: 1000px;
}
/* a lone image in the last row of an odd count is centered, not stuck left */
.post-figure:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 1000px;
}
.post-figure img { width: auto; max-width: 100%; height: auto; margin: 0 auto; }
.zoom-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #eee;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.post-figure:hover .zoom-hint { opacity: 1; }
.post-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 18px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.38) 55%, transparent);
  color: #f2f2f2;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
/* with a caption, the hover hint moves to the top so they don't collide */
.post-figure.with-caption .zoom-hint { bottom: auto; top: 12px; }

/* comments */
.comments { max-width: 1000px; margin: 46px auto 70px; border-top: 1px solid var(--border); padding-top: 26px; }
.comments-title { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 0 0 18px; }
.comment-list { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 16px; }
.comment { border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.reply-list { list-style: none; margin: 12px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); display: grid; gap: 10px; }
.reply { padding-top: 2px; }
.reply .comment-text { font-size: 14px; }
.comment-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.comment-name { color: var(--accent); }
.comment-tag {
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
}
.comment-text { margin: 0; font-size: 15px; color: var(--text-soft); white-space: pre-line; }
.comment-form { display: grid; gap: 12px; }

/* comment replies: small button, opens a small modal */
.reply-btn {
  margin-left: 8px;
  padding: 1px 9px;
  font-size: 11px;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  vertical-align: 1px;
}
.reply-btn:hover { color: var(--accent); border-color: var(--accent); }
.reply-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}
.reply-backdrop[hidden] { display: none; }
.reply-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
  width: 100%;
  max-width: 420px;
}
.reply-dialog h2 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin: 0 0 4px; }
.reply-as { margin: 0 0 14px; font-size: 13px; color: var(--text-soft); }
.reply-as strong { color: var(--accent); }
.reply-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.reply-dialog .comment-err { min-height: 18px; }
body.dialog-open { overflow: hidden; }
.comment-field { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.comment-field input, .comment-field textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 2px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
}
.comment-field input:focus, .comment-field textarea:focus { outline: none; border-color: var(--accent); }
.comment-form .btn { justify-self: start; }
.comment-err { color: var(--danger); font-size: 13px; margin: 0; }
.comment-hint { margin: -2px 0 0; font-size: 12px; }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lightbox[hidden] { display: none; }
.lb-img { max-width: 92vw; max-height: 88vh; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  width: 46px; height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.14); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-zoom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1;
}
.lb-zoom button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.lb-zoom button:hover { background: rgba(255, 255, 255, 0.14); }
.zoom-label { color: #bbb; font-size: 12.5px; letter-spacing: 0.05em; min-width: 44px; text-align: center; }
.lb-img { user-select: none; cursor: zoom-in; }
.lightbox.zoomed .lb-img { cursor: grab; }
.lightbox.zoomed.grabbing .lb-img { cursor: grabbing; }
body.lb-open { overflow: hidden; }

/* buttons */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--border-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #141414; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #4a2a2a; }
.btn.danger:hover { background: rgba(224, 108, 108, 0.08); border-color: var(--danger); }

/* footer. pinned to the bottom of short pages */
.site-footer { flex-shrink: 0; border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 18px 20px; font-size: 13px; color: var(--muted); }
.site-footer .footer-title { justify-self: start; }
.site-footer .footer-copy { justify-self: end; white-space: nowrap; }
.site-footer a:hover { color: var(--text); }
.empty-page { text-align: center; padding: 90px 0; }
.empty-page h1 { font-family: var(--serif); font-weight: 500; }

@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .gallery-page { padding: 0 12px; }
  .home-header { font-size: 26px; letter-spacing: 1px; margin-top: 24px; white-space: normal; }
  .home-tagline { font-size: 14px; white-space: normal; }
  .header-inner { padding: 8px 0; }
  .brand img { height: 26px; }
  .nav { gap: 16px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); justify-content: center; gap: 6px; }
  .post-images { grid-template-columns: 1fr; }
  .post-title { font-size: 24px; }
  .back { margin-top: 22px; }
  .site-footer .wrap { padding: 16px 14px; }
  /* iOS Safari zooms into fields smaller than 16px */
  input[type="text"], input[type="password"], textarea, select { font-size: 16px; }
}

/* ================= polish pass ================= */
.card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.card:hover { transform: translateY(-3px); }
a:focus-visible, .btn:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* hide the scrollbar track so it never crowds the content edge; scrolling
   still works with wheel / trackpad / keyboard. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* the hidden attribute must always win over element display rules */
[hidden] { display: none !important; }
