/* Catalog — an extension of melissawiederrecht.com: pure white, Avenir, quiet. */
:root {
  --m: clamp(48px, 6vw, 92px); /* the one margin: page edges, rhythm, masonry */
  --bg: #ffffff;
  --panel: #fafafa;
  --line: #e6e6e6;
  --ink: #111111;
  --dim: #777777;
  --accent: #111111;
  --ok: #2e7d32;
  --warn: #b58a2c;
  --bad: #b3261e;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.6 Avenir, Inter, Helvetica, Arial, sans-serif;
  padding: var(--m);
}
h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.06em; margin: 0; text-transform: uppercase; }
h1 a { color: var(--ink); text-decoration: none; }
h2 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.sub { font-size: 12.5px; color: var(--dim); }
.hint { color: var(--dim); font-size: 12.5px; }
.err { color: var(--bad); font-size: 13px; margin-top: 12px; }
.spacer { flex: 1; }
.mono { font-family: Consolas, monospace; font-size: 12px; }

/* ---- the shell: everything on the left rail, art on the right ---- */
.shell { display: flex; gap: var(--m); align-items: flex-start; }
#rail { width: 190px; flex: none; display: flex; flex-direction: column; gap: var(--m); }
.brand { display: flex; flex-direction: column; gap: 3px; }
.brand h1 { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; line-height: 1.5; }
.brand .sub { font-size: 10px; letter-spacing: 0.04em; }
.sideNav { display: flex; flex-direction: column; gap: 11px; }
.sideNav a {
  color: var(--dim); text-decoration: none; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.16em;
}
.sideNav a:hover, .sideNav a.on { color: var(--ink); }
.railFoot {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  border-top: 1px solid var(--line); padding-top: 14px;
}
.railLabel {
  font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
}
#whoami { font-size: 12px; color: var(--ink); }
.railFoot button {
  margin-top: 8px; padding: 0; border: none; font-size: 11px; color: var(--dim);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.railFoot button:hover { background: none; color: var(--ink); }
#content { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .shell { flex-direction: column; gap: 18px; }
  #rail { width: auto; }
}

select, input, textarea, button {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 0; padding: 6px 12px; font: inherit;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--ink); }
textarea { width: 100%; min-height: 72px; resize: vertical; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--ink); }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover { opacity: 0.85; }
button.ghost { background: none; border-color: transparent; color: var(--dim); }
button.ghost:hover { color: var(--ink); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }

/* ---- login ---- */
#loginView { min-height: 90vh; display: grid; place-items: center; }
#loginCard { text-align: center; padding: 40px; }
#loginCard h1 { font-size: 22px; }
#loginCard .sub { margin: 6px 0 30px; }
#loginForm { display: flex; gap: 8px; justify-content: center; }
#codeInput { width: 230px; text-align: center; letter-spacing: 0.12em; }

/* ---- browse bar: the filter box and the sort box, sort set slightly apart
   on the right (her ask: move Sort separate from the filters) ---- */
#browseBar {
  display: flex; align-items: flex-start; gap: 30px; flex-wrap: wrap;
  margin: 0 0 var(--m);
}
#filters { flex: 1; min-width: 300px; }
#sortGroup {
  position: relative; display: flex; align-items: flex-start; gap: 24px;
  flex: none; border: 1px solid #eee; padding: 14px 16px 11px;
  /* a hair of extra left margin to read as "apart" from the filter box */
  margin-left: auto;
}
#sortGroup .fGroup select { font-size: 12.5px; padding: 4px 8px; min-width: 132px; }

/* ---- filters: one labeled box, each control in its own labeled group ---- */
#filters {
  position: relative; display: flex; align-items: flex-start; gap: 24px;
  flex-wrap: wrap; border: 1px solid #eee; padding: 14px 16px 11px;
}
.fTitle {
  position: absolute; top: -9px; left: 12px; background: #fff; padding: 0 8px;
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--dim);
}
.fGroup { display: flex; flex-direction: column; gap: 6px; }
.fGroup > label {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
}
.fGroup select { font-size: 12.5px; padding: 4px 8px; }
#statusToggle { display: flex; gap: 6px; flex-wrap: wrap; }
#tagChips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; padding: 1px 10px; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--dim); border: 1px solid var(--line);
}
.chip:hover { border-color: var(--dim); }
.chip.on { color: #fff; background: var(--ink); border-color: var(--ink); }

/* mosaic of artwork chunks: roomy between chunks, tight inside them */
/* Uniform cards, normal left-to-right flow (no masonry, so sorted order reads
   across rows, not down columns). Every card is the same outer size; the media
   box is one canonical shape and the thumbnails cover-fill it. */
main#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--m); align-items: start;
}
.tile {
  position: relative; cursor: pointer; overflow: hidden; background: #fff;
  border: 1px solid var(--line); padding: 8px;
}
/* the canonical card media: SAME outer shape for every piece (tweak --card to
   taste). A mat background shows behind the art so the thumbnails can sit at
   their TRUE aspect ratios with no cropping. */
.media {
  --card: 6 / 5; aspect-ratio: var(--card); width: 100%; overflow: hidden;
  display: grid; background: var(--panel);
}
.media > * { width: 100%; height: 100%; }
.media > img { object-fit: contain; display: block; }
.cap { display: flex; flex-direction: column; gap: 1px; padding: 8px 1px 2px; }
.cap .t {
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cap .i { font-size: 10px; color: var(--dim); letter-spacing: .03em; }

/* Three real-master aspects: ALWAYS show all three, each at its TRUE aspect
   ratio (object-fit: contain, never cropped). The vertical (9:16) anchors one
   full-height side; the horizontal (16:9) and square (1:1) stack beside it.
   Four arrangements cycle: vertical left/right, horizontal above/below the
   square, so neighbours differ while every card stays the same outer size. */
.trip { display: grid; gap: 6px; width: 100%; height: 100%; }
.trip img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* The square and horizontal fill their cells exactly; the vertical's column is a
   hair narrower than its full-height 9:16 needs, so it FILLS (not contains) to
   reach the full card height, matching square + gap + horizontal precisely. The
   width trim is sub-pixel-to-2px, invisible, and only ever on the vertical. */
.trip .tV { object-fit: cover; }
/* vertical (9:16) always full height down one side; square (1:1, taller row) and
   horizontal (16:9, shorter row) stack on the other. Track ratios 0.879 : 1 and
   1.778 : 1 make all three meet flush at the 6:5 card aspect, no crop, no spill. */
.trip.v0 { grid-template: "v sq" 1.778fr "v h" 1fr / 0.879fr 1fr; } /* V left,  Sq top */
.trip.v1 { grid-template: "sq v" 1.778fr "h v" 1fr / 1fr 0.879fr; } /* V right, Sq top */
.trip.v2 { grid-template: "v h" 1fr "v sq" 1.778fr / 0.879fr 1fr; } /* V left,  H top  */
.trip.v3 { grid-template: "h v" 1fr "sq v" 1.778fr / 1fr 0.879fr; } /* V right, H top  */
.trip .tH { grid-area: h; }
.trip .tV { grid-area: v; }
.trip .tSq { grid-area: sq; }
/* Two real-master aspects: show both at true aspect, side by side, no crop. */
.duo { display: grid; gap: 6px; width: 100%; height: 100%; grid-auto-flow: column; grid-auto-columns: 1fr; }
.duo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile { transition: transform .35s ease; }
.tile:hover { transform: scale(1.018); z-index: 2; }
.tile:hover .cap .t { text-decoration: underline; }
.tile .noimg {
  display: grid; place-items: center; height: 100%;
  color: #ccc; font-size: 10px; font-family: Consolas, monospace; padding: 8px;
  text-align: center;
}
.tile .dot {
  position: absolute; top: 8px; right: 8px; width: 8px; height: 8px;
  border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.8);
}
.tile .dot.ok { background: var(--ok); }
.tile .dot.wip { background: var(--warn); }
.badge {
  font-size: 10.5px; padding: 1px 8px; border-radius: 999px;
  background: #f4f4f4; color: var(--dim); white-space: nowrap;
}
/* production status — admin eyes only */
.badge.ok { background: none; border: 1px solid var(--ok); color: var(--ok); }
.badge.wip { background: none; border: 1px solid var(--warn); color: var(--warn); }
.status { font-size: 12.5px; margin: -8px 0 14px; }
.status.ok { color: var(--ok); }
.status.wip { color: var(--warn); }
#emptyNote { padding: 30px 0; }

/* ---- piece page ---- */
#pieceView { padding: 18px 0; max-width: 1100px; margin: 0 auto; }
.backlink { color: var(--dim); text-decoration: none; font-size: 12.5px; }
.backlink:hover { color: var(--ink); }
.piece {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 32px; margin-top: 16px;
}
@media (max-width: 900px) { .piece { grid-template-columns: 1fr; } }
/* media fits INSIDE the viewport — never larger than its true size or 62vh */
.preview {
  display: flex; flex-direction: column; align-items: center;
  background: var(--panel); border: 1px solid var(--line); padding: 14px;
}
/* the stage: a CONSTANT-size slot. Every aspect renders at the same height,
   centered — switching ratios changes the art's width, never the layout. */
.stage {
  height: min(58vh, 560px); width: 100%;
  display: flex; justify-content: center; align-items: center;
}
.stage img, .stage video {
  max-height: 100%; max-width: 100%; display: block;
}
.stage img { height: 100%; width: auto; object-fit: contain; }
.preview .noimg {
  display: grid; place-items: center; aspect-ratio: 16/9; width: 100%;
  color: #bbb; font-family: Consolas, monospace;
}
/* aspect tiles: all available ratios at a glance; click to play that master */
.aspectRow { display: flex; gap: 14px; margin-top: 14px; align-items: center;
  justify-content: center; width: 100%; }
.aspectTile {
  position: relative; height: 110px; cursor: pointer; overflow: hidden;
  background: #f4f4f4; border: 1px solid var(--line); flex: none;
}
.aspectTile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  max-height: none; max-width: none;
}
.aspectTile:hover, .aspectTile.on { border-color: var(--ink); }
.aspectTile .playGlyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 26px; text-shadow: 0 1px 8px rgba(0,0,0,.55);
}
.aspectTile.on .playGlyph { display: none; }
.aspectTile .aspectLabel {
  position: absolute; left: 6px; bottom: 4px; font-size: 11px; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); letter-spacing: .06em;
}
.meta h1 { font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
.meta .algo { margin: 4px 0 14px; }
.meta .desc {
  margin: 14px 0; max-width: 76ch; white-space: pre-line; color: #333;
  font: 10.5px/1.35 'Space Mono', Consolas, monospace; letter-spacing: -0.01em;
}
.meta .note {
  margin: 14px 0; padding: 10px 16px; border-left: 2px solid var(--ink);
  color: var(--dim); font-style: italic;
}
.specs { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 14px; }
.specs td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); color: var(--dim); }
.specs td:first-child { color: var(--ink); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 11px; width: 110px; }

/* ---- admin editor ---- */
.editor {
  margin-top: 22px; padding: 16px 18px; background: var(--panel);
  border: 1px solid var(--line);
}
.editor .row { margin: 8px 0; }
.editor label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--dim); margin-bottom: 3px;
}
.editor input[type="text"] { width: 100%; }
.colChecks { display: flex; gap: 10px; flex-wrap: wrap; }
.colChecks label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink); text-transform: none; letter-spacing: 0;
}
.flash { color: var(--ok); font-size: 12.5px; margin-left: 10px; }

/* ---- admin pages ---- */
#collectionsView, #agenciesView { padding: 18px 0; max-width: 1000px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  padding: 14px 18px; margin: 12px 0;
}
.panel .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list td, table.list th {
  padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left;
}
table.list th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--dim); font-weight: 600; border-bottom-color: var(--ink);
}
table.list td { color: var(--dim); }
table.list td:first-child { color: var(--ink); }
.newcode {
  margin: 12px 0; padding: 12px 16px; border: 1px solid var(--ink);
  font-family: Consolas, monospace; font-size: 16px; color: var(--ink);
}

/* the tags group stretches across whatever width remains */
.fGroup:has(#tagChips) { flex: 1; min-width: 260px; }


.qtoggle{margin-top:10px;font-size:12px;color:#8a8a8a;display:flex;gap:6px;align-items:center;justify-content:center;width:100%}
.qtoggle button{font:inherit;color:#aaa;background:transparent;border:1px solid #444;border-radius:4px;padding:2px 8px;cursor:pointer}
.qtoggle button.on{color:#111;background:#ddd;border-color:#ddd}
