/* ============================================================
   THE BRAIN GALLERY — a catalogue of minds
   Aesthetic: scientific specimen archive / cabinet of curiosities
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink:        #14110d;
  --ink-soft:   #211c16;
  --paper:      #f4eee1;
  --paper-edge: #e7dcc6;
  --mount:      #100d09;
  --text:       #221d15;
  --text-mute:  #6f6451;
  --cream-mute: #b9ad97;
  --accent:     #d93f1e;
  --accent-2:   #c79a3a;
  --line:       rgba(244, 238, 225, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(120% 80% at 50% -10%, #241d14 0%, transparent 55%),
    radial-gradient(80% 60% at 100% 100%, #1c1810 0%, transparent 60%);
  color: var(--paper);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* film grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- Masthead ---------------- */
.masthead {
  max-width: 1320px;
  margin: 0 auto;
  padding: 4.5rem 2rem 2rem;
  position: relative;
}

.masthead .topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cream-mute);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.masthead h1 {
  font-family: 'Fraunces', serif;
  font-optical-sizing: 144;
  font-weight: 600;
  font-size: clamp(3rem, 11vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 0.4rem;
  color: var(--paper);
}

.masthead h1 em {
  font-style: italic;
  font-weight: 340;
  color: var(--accent-2);
}

.masthead .sub {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 360;
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  color: var(--cream-mute);
  max-width: 46ch;
  line-height: 1.4;
}

.masthead .rule {
  margin-top: 2.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.masthead .rule::before,
.masthead .rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.masthead .admin-link {
  color: var(--cream-mute);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  transition: all 0.25s ease;
}
.masthead .admin-link:hover { color: var(--ink); background: var(--accent-2); border-color: var(--accent-2); }

/* ---------------- Gallery (masonry) ---------------- */
.gallery {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2.5rem 2rem 6rem;
  column-count: 3;
  column-gap: 1.6rem;
}
@media (max-width: 980px) { .gallery { column-count: 2; } }
@media (max-width: 620px)  { .gallery { column-count: 1; } }

/* ---------------- Specimen plate ---------------- */
.plate {
  break-inside: avoid;
  margin: 0 0 1.6rem;
  background: var(--paper);
  color: var(--text);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.25) inset,
    0 18px 40px -22px rgba(0,0,0,0.85),
    0 2px 6px rgba(0,0,0,0.4);
  overflow: hidden;
  position: relative;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes rise { to { opacity: 1; transform: none; } }

.plate .mount {
  background: var(--mount);
  padding: 0.9rem;
  position: relative;
}
.plate .mount img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 1px;
  filter: saturate(1.02) contrast(1.02);
}

.plate .mount img.hero { cursor: zoom-in; }

.plate .noimg {
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  color: var(--cream-mute); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
}

/* image counter pill (multi-image entries) */
.plate .imgcount {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  background: rgba(16,13,9,0.7);
  color: var(--paper);
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  z-index: 2;
  backdrop-filter: blur(4px);
}

/* thumbnail strip */
.plate .thumbs {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.7rem 0;
  background: var(--mount);
  flex-wrap: wrap;
}
.plate .thumb {
  flex: 0 0 auto;
  width: 56px; height: 42px;
  padding: 0; border: 1px solid transparent; border-radius: 2px;
  overflow: hidden; cursor: pointer; background: #000;
  opacity: 0.55; transition: opacity 0.18s, border-color 0.18s;
}
.plate .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plate .thumb:hover { opacity: 0.85; }
.plate .thumb.active { opacity: 1; border-color: var(--accent); }

/* corner accession tab */
.plate .accession {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  background: var(--accent);
  color: #fff;
  padding: 0.22rem 0.5rem;
  border-radius: 1px;
  z-index: 2;
}

.plate .caption { padding: 1.15rem 1.25rem 1.35rem; position: relative; }

.plate .label {
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}

.plate .name {
  font-family: 'Fraunces', serif;
  font-weight: 560;
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
  color: var(--ink);
}

.plate .thought {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 380;
  font-size: 1.06rem;
  line-height: 1.45;
  color: #3c3327;
  margin: 0;
  position: relative;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--paper-edge);
}
.plate .thought::before {
  content: "thinking about";
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 0.4rem;
}

.plate .date {
  margin-top: 0.9rem;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-mute);
}

.plate .del {
  position: absolute;
  bottom: 1.1rem;
  right: 1.1rem;
  border: none;
  background: transparent;
  color: var(--text-mute);
  font-family: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.plate .del:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- Empty state ---------------- */
.empty {
  max-width: 1320px;
  margin: 1rem auto 8rem;
  padding: 4rem 2rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--cream-mute);
}
.empty .glyph { font-family: 'Fraunces', serif; font-size: 4rem; font-style: italic; color: var(--text-mute); }
.empty p { font-family: 'Fraunces', serif; font-style: italic; font-size: 1.3rem; margin-top: 0.5rem; }
.empty a { color: var(--accent-2); }

footer.colophon {
  text-align: center;
  padding: 2.5rem 2rem 4rem;
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-mute);
  border-top: 1px solid var(--line);
  max-width: 1320px;
  margin: 0 auto;
}
