/*
 * The back office.
 *
 * styles.css opens by saying nothing in it may develop a personality, and that
 * is still true — which is exactly why none of this is in that file. The
 * plinth stays a plinth. Everything here is either behind a keystroke or a
 * minute and a half of silence.
 *
 * Two things hold throughout: no rule in this file may target anything inside
 * `.canvas`, and no rule may move the chrome. Overlays sit on top and leave
 * when asked.
 */

:root {
  --eg-sheet: rgba(10, 10, 11, 0.94);
  --eg-hair: #26262a;
}

/* ---------- the sheet ---------- */
.eg-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--eg-sheet);
  backdrop-filter: blur(3px);
  color: var(--paper);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.18s ease;
  padding: 1.25rem;
  font-family: var(--f-mono);
  font-size: 12.5px;
}
.eg-sheet.open {
  opacity: 1;
}
.eg-inner {
  max-width: 52rem;
  margin: 0 auto;
  padding-bottom: 3rem;
}
.eg-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: -1.25rem;
  background: var(--eg-sheet);
  padding: 1.1rem 0 0.9rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--eg-hair);
}
.eg-title {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  margin: 0;
}
.eg-x {
  font-size: 10.5px;
  min-height: 1.9rem;
  padding: 0.3rem 0.55rem;
  background: transparent;
  color: var(--label);
  border: 1px solid var(--eg-hair);
}
.eg-x:hover:not(:disabled) {
  background: transparent;
  border-color: var(--paper);
  color: var(--paper);
}
.eg-lede {
  color: var(--label);
  max-width: 34rem;
  line-height: 1.7;
  margin: 1rem 0 1.6rem;
}
.eg-sheet h3 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  margin: 1.8rem 0 0.7rem;
}
.eg-foot {
  color: var(--label);
  font-size: 11.5px;
  line-height: 1.7;
  max-width: 34rem;
  margin-top: 1.8rem;
}
.eg-foot a {
  color: var(--label);
}

/* ---------- the index ---------- */
.eg-rows {
  border-top: 1px solid var(--eg-hair);
}
.eg-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.62rem 0.25rem;
  border-bottom: 1px solid var(--eg-hair);
}
.eg-row kbd {
  flex: 0 0 5.5rem;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--signal);
}
.eg-row.dim kbd,
.eg-row.dim span {
  /* Legible enough to read as a deliberate blank rather than a rendering
     fault. The point is that you can count them. */
  color: #4d4d55;
}

/* ---------- the morgue ---------- */
.eg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 2px;
}
.eg-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  /* Sized by its contents, with a floor. A fixed aspect ratio read nicely
     until a title needed four lines, at which point it ran under the author
     line — and clamping the title to fit only moved the damage into the
     words. Grid equalises each row anyway, so the run still looks like a run. */
  min-height: 9rem;
  padding: 0.6rem;
  overflow: hidden;
  text-decoration: none;
  font-size: 10.5px;
  line-height: 1.35;
  outline: 1px solid var(--eg-hair);
  transition: transform 0.12s ease;
}
.eg-card:hover {
  transform: scale(1.04);
  z-index: 1;
  outline-color: var(--signal);
}
.eg-card .eg-n {
  font-size: 9.5px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
.eg-card .eg-t {
  flex: 0 0 auto;
  font-size: 11.5px;
}
.eg-card .eg-a,
.eg-card .eg-p {
  font-size: 9.5px;
  opacity: 0.65;
}
/* Byline and price sit on the floor of the card, whatever the title did. */
.eg-card .eg-a {
  margin-top: auto;
  padding-top: 0.5rem;
}
.eg-card.blank {
  outline-style: dashed;
}
.eg-card.blank .eg-t {
  font-style: italic;
}
.eg-grid.deal .eg-card {
  animation: eg-deal 0.3s ease both;
  /* Capped, or day 400 waits twelve seconds to appear. */
  animation-delay: calc(min(var(--i) * 14ms, 700ms));
}
@keyframes eg-deal {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- the wire ---------- */
.eg-wire {
  position: fixed;
  right: 0.75rem;
  bottom: calc(var(--bar) + 0.75rem);
  z-index: 45;
  width: min(30rem, calc(100vw - 1.5rem));
  max-height: min(19rem, 45vh);
  display: flex;
  flex-direction: column;
  background: #050506;
  border: 1px solid var(--eg-hair);
  font-family: var(--f-mono);
  font-size: 10.5px;
  line-height: 1.55;
  color: #4ee07a;
}
.eg-wire-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--eg-hair);
  color: var(--label);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.eg-feed {
  padding: 0.55rem 0.6rem 0.7rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-wrap;
  word-break: break-word;
}
.eg-line {
  min-height: 1.55em;
}
.eg-cursor {
  animation: eg-blink 1.05s steps(1) infinite;
}
@keyframes eg-blink {
  50% {
    opacity: 0;
  }
}

/* ---------- undefine ---------- */
.eg-undef {
  color: var(--label);
  font-style: italic;
  opacity: 0.75;
}

/* ---------- the type case ---------- */
.eg-setting {
  color: var(--signal);
}

/* ---------- the press ---------- */
.eg-press {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Under the bid panel and under any sheet: the press is ambient, and it
     never gets in the way of something the reader actually asked for. */
  z-index: 20;
  height: var(--bar);
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--chrome);
  border-top: 1px solid var(--eg-hair);
  color: #3f3f46;
  font-family: var(--f-mono);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.eg-track {
  flex: 0 0 auto;
  padding-right: 2rem;
  animation: eg-run 90s linear infinite;
}
@keyframes eg-run {
  to {
    transform: translateX(-100%);
  }
}

/* ---------- a find ---------- */
.eg-found {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar) + 1rem);
  transform: translate(-50%, 0.5rem);
  z-index: 70;
  padding: 0.45rem 0.8rem;
  background: var(--paper);
  color: var(--chrome);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}
.eg-found.open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- the print edition ---------- */
/*
 * Ink on newsprint. The plinth inverts; the canvas does not, because the
 * canvas is not ours to reprint. A definer who chose ink on white gets ink on
 * white in every edition.
 */
.eg-print {
  --chrome: #f4f1ea;
  --paper: #12100c;
  --label: #6b665c;
  --edge: #cfc9bb;
  --eg-sheet: rgba(244, 241, 234, 0.96);
  --eg-hair: #cfc9bb;
}
.eg-print body {
  background: var(--chrome);
  color: var(--paper);
}
.eg-print .mast {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.eg-print button {
  color: #f4f1ea;
  background: #12100c;
  border-color: #12100c;
}
.eg-print button.ghost,
.eg-print .eg-x {
  background: transparent;
  color: var(--label);
  border-color: var(--edge);
}
.eg-print .archive a.row:hover {
  background: #e8e3d8;
}
.eg-print .eg-row.dim kbd,
.eg-print .eg-row.dim span {
  color: #b8b2a4;
}
.eg-print .eg-found {
  background: #12100c;
  color: #f4f1ea;
}
.eg-print .eg-press {
  color: #b8b2a4;
}
/* The frame keeps its own paper colour underneath, so the swap does not
   flash white behind a dark definition. */
.eg-print .canvas {
  background: var(--chrome);
}

/* ---------- the colophon ---------- */
.cl {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
  font-family: var(--f-mono);
  font-size: 12.5px;
}
.cl-lede {
  color: var(--label);
  line-height: 1.7;
  margin: 0 0 2.4rem;
  max-width: 34rem;
}
.cl h2 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  margin: 2.2rem 0 0.7rem;
  border-bottom: 1px solid var(--eg-hair);
  padding-bottom: 0.5rem;
}
.cl-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--eg-hair);
}
.cl-k {
  flex: 0 0 9rem;
  color: var(--label);
}
.cl-v {
  flex: 1 1 auto;
  min-width: 0;
}
.cl-note {
  color: var(--label);
  line-height: 1.75;
  max-width: 34rem;
  margin: 0.9rem 0 0;
}
.cl-note code,
.cl kbd {
  color: var(--paper);
}
.cl-foot {
  color: var(--label);
  font-size: 11.5px;
  line-height: 1.7;
  margin-top: 3rem;
}
.cl-foot a,
.cl-note a {
  color: var(--label);
}

/* ---------- support ---------- */
.sp-rail {
  border-top: 1px solid var(--eg-hair);
  padding: 1rem 0 0.4rem;
}
.sp-rail h3 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  margin: 0 0 0.6rem;
  border: none;
  padding: 0;
}
.sp-qr {
  /* The quiet zone must stay light for a scanner to find the symbol, so this
     keeps its own background in both editions rather than inheriting one. */
  width: 8.5rem;
  padding: 0.35rem;
  background: #ffffff;
  margin: 0 0 0.7rem;
  line-height: 0;
}
.sp-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.sp-addr {
  display: block;
  /* An address is copied, so it must be selectable in one gesture and must
     never be silently truncated to something that looks like an address. */
  user-select: all;
  word-break: break-all;
  color: var(--paper);
  background: rgba(127, 127, 140, 0.1);
  border: 1px solid var(--eg-hair);
  padding: 0.55rem 0.6rem;
  font-size: 11.5px;
  line-height: 1.5;
}
.sp-open {
  margin: 0.55rem 0 0;
  font-size: 11.5px;
}
.sp-open a {
  color: var(--signal);
}
.sp-button {
  display: inline-block;
  background: var(--paper);
  color: var(--chrome);
  padding: 0.5rem 0.8rem;
  min-height: 2.15rem;
  text-decoration: none;
  letter-spacing: 0.03em;
}
.sp-note {
  color: var(--label);
  font-size: 11.5px;
  line-height: 1.7;
  max-width: 34rem;
  margin: 0.55rem 0 0.9rem;
}
.sp-note a,
.sp .cl-note a {
  color: var(--label);
}

.sp-amounts {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 0 0 1rem;
}
.sp-amounts input {
  font-family: var(--f-mono);
  /* 16px or iOS zooms the page on focus. */
  font-size: 16px;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--eg-hair);
  padding: 0.42rem 0.6rem;
  min-height: 2.15rem;
  width: 8rem;
}
.sp-other {
  display: block;
  width: 100%;
  color: var(--label);
  font-size: 11px;
  margin-bottom: 0.2rem;
}

.sp-error,
.sp-thanks {
  border-left: 2px solid var(--signal);
  padding: 0.6rem 0 0.6rem 0.85rem;
  margin: 0 0 1.6rem;
  font-size: 11.5px;
  line-height: 1.7;
  max-width: 34rem;
}
.sp-error {
  color: var(--signal);
}
.sp-thanks {
  color: var(--paper);
}

@media (max-width: 640px) {
  .cl-k {
    flex-basis: 6.5rem;
  }
  .eg-grid {
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  }
  .eg-card {
    min-height: 7.5rem;
  }
  .eg-row kbd {
    flex-basis: 4.5rem;
  }
  .eg-wire {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: calc(var(--bar) + 0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .eg-sheet,
  .eg-card,
  .eg-found,
  .eg-track,
  .eg-cursor {
    animation: none;
    transition: none;
  }
  .eg-sheet {
    opacity: 1;
  }
}
