main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: 45px minmax(0, 1fr);
  height: calc(100vh - 120px);
  height: calc(100dvh - 120px);
  min-height: 260px;
}
.workspace-bar {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 45px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  font-size: 12px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.articles-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  padding: 0 20px;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 0 20px;
  border-left: 1px solid var(--line);
}
#index {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  border-right: 1px solid var(--line);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 0;
  background: transparent;
}
.tile {
  position: relative;
  appearance: none;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  min-height: min-content;
  padding: 11px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  text-align: center;
  text-decoration: none;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease;
}
/* Hover emphasis is transient; preview selection does not pin a tile's highlight. */
.tile:hover {
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--ice);
  z-index: 1;
}
.tile:focus-visible {
  background: var(--raised);
  outline: 2px solid var(--ice);
  outline-offset: -3px;
  z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
}
.tile-date {
  align-self: flex-start;
  max-width: 100%;
  color: var(--muted);
  font-size: clamp(10px, 0.8vw, 11px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tile-art {
  width: min(57%, 108px);
  min-height: 0;
  flex: 1;
  margin: 3px 0;
  color: var(--ice);
}
.tile-title {
  font-size: clamp(12px, 0.95vw, 14px);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
#preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#preview-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#preview-frame {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: var(--bg);
}
@media (max-width: 1100px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 45px auto;
    height: auto;
  }
  .workspace-bar {
    display: contents;
  }
  .articles-label {
    grid-row: 1;
    border-bottom: 1px solid var(--line);
  }
  #index {
    grid-row: 2;
    border-right: 0;
    overflow-y: visible;
  }
  .preview-bar,
  #preview {
    display: none;
  }
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tile-date {
    font-size: 11px;
  }
  .tile-title {
    font-size: 14px;
  }
}
@media (max-width: 480px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Alpha-only image: CSS chooses the colour in either theme. */

.tile-cell {
  display: contents;
}
.tile-preview {
  display: none;
}
#preview[hidden] {
  display: none;
}
html:not(.preview-enabled) main {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 45px auto;
  height: auto;
}
html:not(.preview-enabled) :is(#preview, .preview-bar) {
  display: none;
}
@media (min-width: 761px) and (pointer: coarse) {
  .tile-cell {
    display: flex;
    flex-direction: column;
    background: var(--surface);
  }
  .tile {
    flex: 1;
  }
  .tile-preview {
    display: block;
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    min-height: 36px;
    cursor: pointer;
  }
  .tile-preview:hover {
    background: var(--raised);
  }
}
