/* ========================================================================
   Letters Catalogue — discovered alphabet of the circuit language
   ======================================================================== */

.atlas-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.atlas-intro {
  background: #0c0c0c;
  border-left: 3px solid #22d3ee;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0 4px 4px 0;
  color: #bbb;
  font-size: 0.92rem;
  line-height: 1.55;
}
.atlas-intro p { margin: 0 0 0.5rem; }
.atlas-intro p:last-child { margin: 0; }
.atlas-intro strong { color: #ddd; }

.atlas-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  background: #050505;
  padding: 0.75rem 0;
  z-index: 10;
  border-bottom: 1px solid #1a1a1a;
}
.atlas-controls input,
.atlas-controls select {
  background: #111;
  color: #ddd;
  border: 1px solid #222;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.atlas-controls input { flex: 1 1 220px; min-width: 220px; }
.atlas-controls input:focus,
.atlas-controls select:focus { border-color: #22d3ee; outline: none; }
.atlas-count {
  color: #777;
  font-size: 0.82rem;
  margin-left: auto;
}

.atlas-loading {
  color: #777;
  text-align: center;
  padding: 3rem 0;
  font-style: italic;
  grid-column: 1 / -1;
}

/* Letter card grid */
.letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
}
.letter-card {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 5px;
  padding: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.letter-card:hover {
  border-color: #22d3ee;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(34, 211, 238, 0.15);
}
.letter-card-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #050505;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.letter-card-thumb img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.letter-card-id {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #22d3ee;
  font-weight: 600;
}
.letter-card-meta {
  font-size: 0.74rem;
  color: #999;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  font-family: ui-monospace, monospace;
}
.letter-card-meta b { color: #ddd; font-weight: 600; }

.letter-mix-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: 2px;
  overflow: hidden;
  background: #1a1a1a;
}
.letter-mix-bar > span {
  display: block;
  height: 100%;
}

/* Drawer mix display */
.mix-rows {
  display: grid;
  gap: 4px;
  margin: 0.4rem 0 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}
.mix-row {
  display: grid;
  grid-template-columns: 130px 1fr 50px;
  gap: 0.6rem;
  align-items: center;
}
.mix-row .mix-name { font-weight: 600; }
.mix-row .mix-bar {
  display: block;
  height: 8px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
}
.mix-row .mix-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
}
.mix-row .mix-val { color: #aaa; text-align: right; }
.letter-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.15rem;
}
.letter-tag {
  background: #1a1a1a;
  color: #ccc;
  font-size: 0.66rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
}
.letter-tag.dim-3D { background: #2a2516; color: #ffbb6b; }
.letter-tag.dim-4D { background: #1a2030; color: #6b8bff; }
.letter-tag.dim-5D { background: #1c2a1a; color: #6bff8b; }
.letter-tag.dim-6D { background: #2a1a2a; color: #ff6bff; }

/* Detail drawer */
.letter-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.letter-drawer[hidden] { display: none; }
.letter-drawer-inner {
  background: #0a0a0a;
  border: 1px solid #222;
  border-radius: 6px;
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  position: relative;
}
.letter-drawer-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 1.7rem;
  cursor: pointer;
  line-height: 1;
}
.letter-drawer-close:hover { color: #fff; }
.letter-drawer-content h2 {
  margin: 0 0 0.5rem;
  color: #fff;
  font-size: 1.4rem;
}
.letter-drawer-content .meta-line {
  color: #888;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  font-family: ui-monospace, monospace;
}
.letter-drawer-content .rep-image {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.letter-drawer-content .rep-image img {
  width: 240px;
  height: 240px;
  object-fit: contain;
  background: #050505;
  border: 1px solid #222;
  border-radius: 4px;
}
.letter-drawer-content .rep-meta {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.86rem;
  color: #bbb;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.5rem;
  align-content: start;
}
.letter-drawer-content .rep-meta b { color: #ddd; }
.letter-drawer-content h3 {
  color: #22d3ee;
  font-size: 0.92rem;
  margin: 1.2rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.letter-drawer-content .members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.4rem;
}
.letter-drawer-content .member {
  text-decoration: none;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 3px;
  padding: 0.3rem;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: #ccc;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.12s;
}
.letter-drawer-content .member:hover { border-color: #22d3ee; color: #fff; }
.letter-drawer-content .member img {
  width: 100%; aspect-ratio: 1/1; object-fit: contain;
  background: #050505; border: 1px solid #1a1a1a; border-radius: 2px;
}
.letter-drawer-content .member b { color: #ddd; font-weight: 600; }
