/* Styles the searchable, sortable Writings archive. */
/* Its grid keeps headings and entries aligned at every width. */

.archive-header {
  display: flex;
  max-width: 92rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin: 0 auto 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.archive-header h1 {
  margin: 0.7rem 0 0;
  color: var(--signal);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(3.5rem, 9vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 0.74;
}

.subtitle {
  margin: 1rem 0 0;
  color: var(--dim);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-stats {
  display: flex;
  gap: clamp(1.5rem, 5vw, 5rem);
  margin: 0;
}

.archive-stats div {
  min-width: 5rem;
}

.archive-stats dt {
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.archive-stats dd {
  margin: 0.2rem 0 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.25rem;
}

.browser {
  max-width: 92rem;
  min-height: 35rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1.5rem 5rem rgb(0 0 0 / 35%);
}

.list-scroll {
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-color: var(--line) var(--panel);
}

.toolbar {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-raised);
}

.archive-root {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.search {
  display: flex;
  width: 22rem;
  max-width: 100%;
  align-items: center;
  border-bottom: 1px solid var(--dim);
  color: var(--dim);
}

.search:focus-within {
  border-color: var(--signal);
  color: var(--signal);
}

.search input {
  width: 100%;
  padding: 0.45rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.search input::placeholder {
  color: var(--dim);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.list-heading,
.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5rem 7.5rem 5rem 1.5rem;
  gap: 1rem;
  align-items: center;
}

.list-heading {
  position: sticky;
  z-index: 2;
  top: 4rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.list-heading button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.list-heading button:hover,
.list-heading button[aria-pressed="true"] {
  color: var(--signal);
}

.list-heading button span {
  display: inline-block;
  width: 1ch;
}

.entry {
  min-height: 3.6rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgb(49 50 68 / 70%);
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
  text-decoration: none;
}

.entry:hover,
.entry:focus-visible {
  outline: 0;
  background: var(--line);
  color: var(--ink);
  box-shadow: inset 3px 0 var(--signal);
}

.entry-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 1rem;
}

.entry-title small {
  width: 1.5rem;
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.62rem;
}

.entry-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-arrow {
  color: var(--signal);
  font-size: 1rem;
  transition: transform 120ms ease;
}

.entry:hover .entry-arrow {
  transform: translateX(0.2rem);
}

.empty {
  margin: 0;
  padding: 5rem 1rem;
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 760px) {
  .archive-header {
    display: block;
  }

  .archive-stats {
    margin-top: 1.5rem;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .list-scroll {
    max-height: none;
    overflow-y: visible;
  }

  .toolbar,
  .list-heading {
    position: static;
  }

  .list-heading,
  .entry {
    grid-template-columns: minmax(0, 1fr) 5rem 1.5rem;
  }

  .list-heading > :nth-child(2),
  .list-heading > :nth-child(4),
  .entry > :nth-child(2),
  .entry > :nth-child(4) {
    display: none;
  }
}
