/* ==========================================================================
   Archive — imported sites, held off the board until the Archivist has archived them.
   The page is the room; cards are white. Four lanes of the same width, in the order a site moves; each head names
   its lane and counts its sites (what it shows of what it holds, while a search narrows the board). A card reads: the
   site, where it is, what its records hold, then where it stands with the one move a person makes beside it. What
   waits for a person (a site the Archivist gave back with a reason, Ready while the Archivist cannot work) takes the
   one attention treatment (.attn, shared); here it only keeps the layout. Dragging is the Board's: the card lifts and
   follows, a dashed slot shows where it lands, the lane it lands in is framed; the Archivist's two lanes step back,
   and the one under the pointer says why. Narrow windows: two lanes a row, then one; the page scrolls instead of the
   lanes.
   ========================================================================== */
.view-archive { overflow-x: hidden; overflow-y: hidden; }
.ar { height: 100%; min-width: 0; display: flex; flex-direction: column; padding: 0 32px; }

/* ---------- The Archivist's live line, its sessions and its settings: the dot hangs, so the words start on the lanes'
   text edge. The search at the far end. ---------- */
.ar-head { flex: none; display: flex; align-items: center; gap: 16px; min-height: 60px; padding-left: 16px; }
.ar-agent { flex: 0 1 auto; display: flex; align-items: center; gap: 16px; min-width: 0; }
.ar-live { flex: 0 1 auto; min-width: 0; margin-left: -22px; cursor: default; }
.ar-live:not(:has(.dot)) { margin-left: 0; }
.ar-head .slots { cursor: default; }
.ar-settings { flex: none; }
.ar-search { flex: 0 1 300px; min-width: 180px; margin-left: auto; }
.ar-search .input { width: 100%; padding-right: 36px; }
.ar-search .input:focus { background: var(--surface); }
.ar-search-clear { position: absolute; right: 2px; }

/* ---------- Lanes ---------- */
.ar-lanes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 16px; }
.ar-lane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; animation: rise var(--dur-3) var(--ease) backwards; }
.ar-lane > * { position: relative; z-index: 1; }
/* While a card is dragged, the lane it would land in is framed by an outline */
.ar-lane::before {
  content: ""; position: absolute; z-index: 0; inset: -8px -8px 20px; border-radius: var(--r-4);
  box-shadow: inset 0 0 0 1px transparent; pointer-events: none; transition: box-shadow var(--dur-2) var(--ease);
}
.ar.is-dragging .ar-lane.is-target::before { box-shadow: inset 0 0 0 1px var(--line-strong); }
/* Head: the name and the count; Not ready's move of all it shows to Ready at the far end (it adds no height) */
.ar-lane-head { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; padding: 0 16px 8px; }
.ar-lane-name { min-width: 0; margin: 0; font-size: var(--fs-heading); font-weight: 500; line-height: 24px; }
.ar-lane-n { flex: none; font-size: var(--fs-meta); line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ar-bulk { margin: -6px 0 -6px auto; }

/* The Archivist's lanes while a card is dragged: their cards step back; under the pointer, a panel says why */
.ar-lane-closed { flex: none; z-index: 3; height: 0; }
.ar-lane-why {
  position: absolute; left: 0; right: 0; top: 6px; margin: 0; padding: 12px 16px; border-radius: var(--r-3);
  background: var(--surface); box-shadow: var(--shadow-2); font-size: var(--fs-body); line-height: 20px;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.ar.is-dragging .ar-lane.is-refusing .ar-lane-why { opacity: 1; transform: none; }
.ar.is-dragging .ar-lane.is-closed .ar-lane-body { opacity: .35; }

/* Ready, while the Archivist cannot take it: one line that waits for a person (admins: it opens Admin) */
.ar-lane-wait:empty { display: none; }
.ar-lane-wait { flex: none; padding: 6px 0 4px; }
.ar-wait { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 14px; border-radius: var(--r-2); text-decoration: none; }
.ar-wait-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.45; }
.ar-wait-text b { font-weight: 500; }
.ar-wait-why { font-size: var(--fs-meta); line-height: 1.4; overflow-wrap: anywhere; }
.ar-wait > .ic { flex: none; width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease); }
.ar-wait:hover > .ic { transform: translateX(2px); }

/* The body scrolls on its own; its padding leaves room for the cards' shadows. A long lane ends in Show more. */
.ar-lane-body {
  position: relative; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; margin: 0 -12px; padding: 6px 12px 24px;
  scrollbar-width: none; transition: opacity var(--dur-2) var(--ease);
}
.ar-lane-body::-webkit-scrollbar { display: none; }
.ar-more { flex: none; align-self: center; margin-top: 2px; }

/* ---------- Cards ---------- */
.ar-card {
  position: relative; flex: none; display: flex; flex-direction: column; min-width: 0;
  padding: 14px 16px 16px; border-radius: var(--r-3); background: var(--surface); box-shadow: var(--ring); cursor: pointer;
  user-select: none; -webkit-user-select: none;
  transition: box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.ar-card:hover { box-shadow: var(--shadow-2); }
.ar-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ar-card.is-new { animation: rise var(--dur-3) var(--ease); }
/* The site: name (Strong), place and country (Meta); then what its records hold (Meta). Names wrap, never cut. */
.ar-card-name { min-width: 0; overflow-wrap: break-word; font-size: var(--fs-body); font-weight: 500; line-height: 20px; }
.ar-card-place { min-width: 0; margin-top: 1px; font-size: var(--fs-meta); line-height: 16px; }
.ar-card-records { align-self: flex-start; max-width: 100%; margin-top: 10px; font-size: var(--fs-meta); line-height: 16px; cursor: default; }
/* What its sources come to for the Archivist's model (Meta); a site that does not fit says so in the ink's weight, calmly:
   it is skipped for later, it does not wait for a person */
.ar-card-tokens { align-self: flex-start; max-width: 100%; margin-top: 2px; font-size: var(--fs-meta); line-height: 16px; font-variant-numeric: tabular-nums; cursor: default; }
.ar-card-records + .ar-card-tokens { margin-top: 2px; }
.ar-card-tokens:first-child, .ar-card-place + .ar-card-tokens { margin-top: 10px; }
.ar-card-tokens.is-large { font-weight: 500; }
/* The Too large filter beside the search */
.ar-large { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; }
.ar-large:not([hidden]) + .ar-search { margin-left: 0; }
/* Where it stands, and the one move a person makes beside it */
.ar-card-state { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 14px; padding-top: 12px; box-shadow: inset 0 1px 0 var(--line); }
.ar-card-where { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ar-card-state > .ar-move { flex: none; margin-left: auto; }
.ar-line { min-width: 0; font-size: var(--fs-body); line-height: 20px; }
.ar-line.is-live { display: flex; align-items: center; gap: 10px; }
.ar-line.is-live > .dot { margin: 0 1px; }
.ar-line.is-when { font-size: var(--fs-meta); line-height: 16px; font-variant-numeric: tabular-nums; }
.ar-line[data-tip] { cursor: default; }
/* The reason the Archivist gave it back: what waits, in full */
.ar-error { min-width: 0; font-size: var(--fs-body); font-weight: 500; line-height: 20px; overflow-wrap: break-word; }
.ar-board { color: inherit; text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ar-board:hover { text-decoration: underline; text-decoration-color: var(--stroke); }
.ar-card.is-dragging { display: none; }

/* ---------- Dragging (the Board's): the card lifts and follows; a dashed slot shows where it lands. Over the
   Archivist's lanes the pointer says no. ---------- */
html.ar-grabbing, html.ar-grabbing * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
html.ar-grabbing.ar-refused, html.ar-grabbing.ar-refused * { cursor: not-allowed !important; }
html.ar-grabbing .tooltip { display: none; }
.ar-slot { flex: none; border-radius: var(--r-3); border: 1.5px dashed var(--stroke); }
.ar-ghost { position: fixed; left: 0; top: 0; z-index: 65; pointer-events: none; will-change: transform; }
.ar-ghost > .ar-card { transition: transform 180ms var(--ease), box-shadow 180ms var(--ease); }
.ar-ghost.is-lifted > .ar-card { transform: rotate(1.5deg) scale(1.03); box-shadow: var(--shadow-3); }
.ar-ghost.is-settling { transition: transform 200ms var(--ease); }

.ar-none { flex: none; padding-bottom: 40px; }

/* ---------- The record (drawer): the site record's patterns; the archive, the unfinished archive and the raw records read as documents ---------- */
.ar-record .drawer-foot:empty { display: none; }
.ar-record .state-lines { margin-top: 4px; }
.ar-record .site-section:first-child { margin-top: 0; }
.ar-record .section-title .btn-link + .btn-link { margin-left: 16px; }
.ar-by { margin: -4px 0 14px; font-size: var(--fs-meta); line-height: 1.4; }
.ar-note { margin: 0; font-size: var(--fs-body); line-height: 1.5; }
.ar-read { margin: 0 0 14px; }
/* What the import brought (Body), then where from, when, and where the site joins the board (Meta) */
.ar-held { margin: 0; font-size: var(--fs-body); line-height: 1.5; }
.ar-from { margin: 2px 0 0; font-size: var(--fs-meta); line-height: 1.4; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1360px) {
  .ar { padding: 0 24px; }
}
@media (max-height: 860px) {
  .ar-head { min-height: 52px; }
  .ar-lane-head { padding-bottom: 6px; }
  .ar-lane-body { gap: 8px; }
  .ar-card { padding: 12px 16px 14px; }
  .ar-card-state { margin-top: 12px; padding-top: 10px; }
}
/* Two lanes a row, then one: the page scrolls, not the lanes */
@media (max-width: 1100px) {
  .view-archive { overflow-y: auto; }
  .ar { height: auto; min-height: 100%; padding-bottom: 24px; }
  .ar-lanes { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .ar-lane-body { flex: none; overflow: visible; padding-bottom: 8px; }
}
@media (max-width: 640px) {
  .ar { padding: 0 16px 24px; }
  .ar-head { flex-wrap: wrap; row-gap: 4px; padding: 8px 0 8px 16px; }
  .ar-search { flex-basis: 100%; margin-left: -16px; }
  .ar-lanes { grid-template-columns: minmax(0, 1fr); }
}
