/* ===========================================================================
   LONE TREE CREEK — Toys and Parts Registry
   ---------------------------------------------------------------------------
   The subject is a provenance registry, not a shop. People record what a piece
   is, what year it's from, where it lives, and who owned it before. So the page
   is built like a catalogue card: a photograph, and under it a line of hard data
   set in monospace — accession number, year, county. That data line is the one
   thing this site should be remembered by, and it's the only place besides the
   primary buttons where maroon is allowed to appear.

   Everything else stays black on white and gets out of the way.

   No inline styles anywhere in the templates — the Content-Security-Policy
   forbids them, which is what makes injected markup inert.
   ========================================================================= */

:root {
  --ink:        #0b0b0c;
  --ink-soft:   #2a282a;
  --paper:      #ffffff;
  --paper-warm: #f6f4f1;
  --maroon:     #6e1621;
  --maroon-lit: #8d2231;
  --maroon-ink: #4a0f16;
  --rule:       #ded9d3;
  --rule-soft:  #ebe7e3;
  --muted:      #6e6862;

  --display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --gap: 1.25rem;
  --wrap: 1220px;
  --radius: 2px;   /* a ledger has corners, not pillows */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-warm);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--maroon); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--maroon-lit); }

:focus-visible {
  outline: 2px solid var(--maroon);
  outline-offset: 2px;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: #fff; padding: .7rem 1rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }

/* ---------------------------------------------------------------- masthead */

.masthead { background: var(--ink); color: #fff; }

.masthead-in {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  padding-top: .8rem; padding-bottom: .8rem;
}

.brand { text-decoration: none; color: #fff; margin-right: auto; display: block; }
.brand:hover { color: #fff; }

.brand-name {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.1;
}
.brand-sub {
  display: block;
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #a89298;
  margin-top: .28rem;
}
.brand-sub .dot { color: var(--maroon-lit); }

/* Mobile menu, no JavaScript: a hidden checkbox drives the panel. */
.navtoggle { position: absolute; opacity: 0; width: 0; height: 0; }

.navbutton {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 44px; height: 44px; padding: 10px; cursor: pointer;
  border: 1px solid #33302f;
}
.navbutton span { display: block; height: 2px; background: #fff; }
.navtoggle:focus-visible + .navbutton { outline: 2px solid #fff; outline-offset: 2px; }

.nav {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: .2rem;
  padding-top: .8rem;
  margin-top: .6rem;
  border-top: 1px solid #2b2829;
}
.navtoggle:checked ~ .nav { display: flex; }

.nav a {
  color: #ddd8d4; text-decoration: none;
  font-size: .82rem; letter-spacing: .05em; text-transform: uppercase;
  font-weight: 600;
  padding: .65rem .2rem;
}
.nav a:hover, .nav a.on { color: #fff; }
.nav a.on { box-shadow: inset 3px 0 0 var(--maroon); padding-left: .7rem; }
.nav a.btn { color: #fff; }

.nav-me {
  display: flex; align-items: center; gap: .8rem;
  padding-top: .7rem; margin-top: .4rem;
  border-top: 1px solid #2b2829;
}
.avatar-link { display: block; line-height: 0; }

.linkish {
  background: none; border: 0; padding: .4rem 0; cursor: pointer;
  color: #9d9793; font: inherit;
  font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 600;
}
.linkish:hover { color: #fff; }
.inline { display: inline; }

@media (min-width: 900px) {
  .navbutton { display: none; }
  .nav {
    display: flex; flex-direction: row; align-items: center; gap: 1.4rem;
    width: auto; padding-top: 0; margin-top: 0; border-top: 0;
  }
  .nav a { padding: .3rem 0; }
  .nav a.on { box-shadow: inset 0 -2px 0 var(--maroon); padding-left: 0; }
  .nav-me { padding-top: 0; margin-top: 0; border-top: 0; border-left: 1px solid #2b2829; padding-left: 1.4rem; }
}

/* ------------------------------------------------------------------ avatars */

.avatar {
  border-radius: 50%; object-fit: cover;
  background: var(--rule-soft);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; color: var(--maroon);
}
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-lg { width: 92px; height: 92px; font-size: 2rem; }
.avatar-blank { background: #e6e1dc; }

/* ------------------------------------------------------------------- flash */

.flash {
  margin: 1rem 0 0;
  padding: .8rem 1rem;
  border-left: 3px solid var(--maroon);
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: .92rem;
}
.flash-error { border-left-color: var(--maroon); background: #fdf6f6; }

/* ------------------------------------------------------------------ typography */

h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .6rem; }

h1 {
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 800; letter-spacing: -.015em;
}
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.005em; }
h3 { font-size: 1rem; font-weight: 700; }

.eyebrow {
  font-family: var(--mono);
  font-size: .64rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.eyebrow b { color: var(--maroon); font-weight: 600; }

.lede { font-size: 1.02rem; color: var(--ink-soft); max-width: 60ch; margin: 0 0 1.2rem; }

/* Vertical padding only. These sit on `.wrap`, and the padding SHORTHAND would
 * reset its 1rem side gutter to zero — which on a phone puts the text hard
 * against the glass. Longhand keeps the gutter. */
.section { padding-top: 2rem; padding-bottom: 2rem; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: .7rem; margin-bottom: 1.3rem;
  border-bottom: 2px solid var(--ink);
}
.section-head h2 { margin: 0; }
.section-head .count { font-family: var(--mono); font-size: .72rem; color: var(--muted); letter-spacing: .08em; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-block;
  font-family: var(--body); font-weight: 600; font-size: .86rem;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .72rem 1.25rem;
  background: var(--maroon); color: #fff;
  border: 1px solid var(--maroon);
  border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
  text-align: center;
  transition: background .12s ease;
}
.btn:hover { background: var(--maroon-lit); border-color: var(--maroon-lit); color: #fff; }
.btn:active { background: var(--maroon-ink); }
.btn-sm { padding: .5rem .9rem; font-size: .76rem; }
.btn-block { display: block; width: 100%; }

.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--rule);
}
.btn-ghost:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }

.btn-danger { background: transparent; color: var(--maroon); border-color: var(--maroon); }
.btn-danger:hover { background: var(--maroon); color: #fff; }

.btn:disabled { opacity: .45; cursor: not-allowed; }

.actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------- hero */

.hero {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.hero-in { padding-top: 2rem; padding-bottom: 1.6rem; }
.hero h1 { max-width: 20ch; }
.hero-stats {
  display: flex; gap: 1.4rem; flex-wrap: wrap;
  margin: 1.1rem 0 0; padding: 0; list-style: none;
  font-family: var(--mono); font-size: .7rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.hero-stats b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ search */

.finder {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin: 1.4rem 0 0;
}
.finder-row { display: grid; gap: .8rem; }
.finder-q { display: flex; gap: .5rem; }
.finder-q input { flex: 1; min-width: 0; }

.finder-more {
  display: grid; gap: .8rem;
  padding-top: .9rem; margin-top: .9rem;
  border-top: 1px dashed var(--rule);
}
.finder-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; flex-wrap: wrap;
  padding-top: .9rem; margin-top: .9rem;
  border-top: 1px dashed var(--rule);
}
.yearpair { display: flex; align-items: center; gap: .5rem; }
.yearpair input { width: 100%; min-width: 0; }
.yearpair .to { font-family: var(--mono); font-size: .7rem; color: var(--muted); }

@media (min-width: 720px) {
  .finder-more { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .finder-more { grid-template-columns: 1.1fr 1.1fr 1fr; align-items: end; }
}

/* ------------------------------------------------------------------- forms */

.field { display: block; margin: 0 0 1rem; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  font-family: var(--mono);
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .38rem;
  font-weight: 500;
}
.label .req { color: var(--maroon); }
.label .opt { color: #a49d97; letter-spacing: .08em; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=search], select, textarea {
  width: 100%;
  font-family: var(--body); font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .68rem .75rem;
  min-height: 44px; /* comfortable tap target */
}
textarea { min-height: 8rem; resize: vertical; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(110, 22, 33, .1);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}
select:disabled { background-color: var(--paper-warm); color: #a49d97; }

.hint { font-size: .78rem; color: var(--muted); margin: .35rem 0 0; }
.hint-mono { font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; }

.err {
  display: block;
  font-size: .8rem; color: var(--maroon); font-weight: 600;
  margin: .35rem 0 0;
}
.field-bad input, .field-bad select, .field-bad textarea { border-color: var(--maroon); }

.counter { font-family: var(--mono); font-size: .66rem; color: var(--muted); letter-spacing: .06em; }
.counter.over { color: var(--maroon); font-weight: 700; }

.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.check input { width: 18px; height: 18px; min-height: 0; margin-top: .2rem; flex: none; accent-color: var(--maroon); }

/* Honeypot: off-screen for bots to find, invisible and unfocusable for people. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.panel + .panel { margin-top: 1.4rem; }
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-title h2 { margin: 0 0 1rem; }

.narrow { max-width: 460px; margin: 0 auto; }
.narrow-wide { max-width: 720px; margin: 0 auto; }

.form-foot {
  display: flex; gap: .8rem; align-items: center; flex-wrap: wrap;
  padding-top: 1.2rem; margin-top: 1.4rem;
  border-top: 1px solid var(--rule);
}

.pair { display: grid; gap: 0; }
@media (min-width: 560px) { .pair { grid-template-columns: 1fr 1fr; gap: 0 1rem; } }

/* ------------------------------------------------------------------- grid */

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}
@media (min-width: 560px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* -------------------------------------------------------------------- card */

.card {
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .14s ease;
}
.card:hover { border-color: var(--ink); }

.card-shot {
  position: relative; display: block;
  aspect-ratio: 1 / 1;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule-soft);
  overflow: hidden;
}
.card-shot img { width: 100%; height: 100%; object-fit: cover; }

.card-noshot {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .66rem;
  letter-spacing: .16em; text-transform: uppercase; color: #b3aca6;
}
.card-flag {
  position: absolute; top: 0; left: 0;
  background: var(--ink); color: #fff;
  font-family: var(--mono); font-size: .58rem;
  letter-spacing: .14em; text-transform: uppercase;
  padding: .3rem .5rem;
}

.card-body { padding: .85rem .9rem 1rem; flex: 1; }
.card-title { font-size: .98rem; margin: 0 0 .3rem; line-height: 1.25; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--maroon); }

.card-blurb {
  margin: 0 0 .65rem;
  font-size: .85rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===========================================================================
   THE ACCESSION LINE — the signature.
   Monospace, because it's a record, not prose. Maroon rule on the left, like the
   tab on a filed card. It says: this object has been catalogued.
   ========================================================================= */
.accession {
  display: flex; align-items: center; gap: .5rem;
  margin: 0;
  padding: .5rem .9rem;
  background: var(--paper-warm);
  border-top: 1px solid var(--rule-soft);
  box-shadow: inset 3px 0 0 var(--maroon);
  font-family: var(--mono);
  font-size: .63rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.accession-id { color: var(--maroon); font-weight: 600; flex: none; }
.accession-year { flex: none; color: var(--ink); }
.accession-loc {
  flex: 1 1 auto; min-width: 0;
  text-align: right;
  overflow: hidden; text-overflow: ellipsis;
}
.accession-year::before, .accession-loc::before {
  content: "/"; color: #c8c1ba; margin-right: .5rem; font-weight: 400;
}

/* -------------------------------------------------------------------- chips */

.chips { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }

.chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .03em;
  color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .22rem .5rem;
  background: var(--paper);
  white-space: nowrap;
}
.chip:hover { border-color: var(--maroon); color: var(--maroon); }
.chip-hash { color: var(--maroon); margin-right: .12rem; font-weight: 600; }
.chip.on { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.chip.on .chip-hash { color: #e6b8bf; }
.chip-count { color: #a49d97; margin-left: .4rem; }
.chip.on .chip-count { color: #d9a8b0; }

.chips-sm .chip { font-size: .63rem; padding: .16rem .4rem; }
.chip-more {
  font-family: var(--mono); font-size: .63rem; color: var(--muted);
  padding: .16rem .3rem; align-self: center;
}
.chips-big .chip { font-size: .78rem; padding: .35rem .7rem; }

/* ------------------------------------------------------------------ pager */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem;
  margin-top: 2rem; padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}
.pager-step {
  font-family: var(--body); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--maroon); text-decoration: none;
  padding: .5rem 0;
}
.pager-step.off { color: #bdb6b0; }
.pager-count {
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------- empty */

.empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--paper);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
}
.empty h2 { margin-bottom: .4rem; }
.empty p { color: var(--muted); margin: 0 auto 1.3rem; max-width: 42ch; }

/* --------------------------------------------------------------- item page */

.itempage { padding-top: 1.6rem; padding-bottom: 3rem; }

.crumb {
  font-family: var(--mono); font-size: .66rem;
  letter-spacing: .12em; text-transform: uppercase;
  margin: 0 0 1rem; color: var(--muted);
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--maroon); }

/* Single column on a phone, and the source order is already the reading order:
 * photo, then title/owner/facts, then the long write-up. On a wide screen the
 * areas below pull the stage and the write-up back into one column with the
 * sidebar running alongside — without touching the markup order. */
.itemgrid { display: grid; gap: 1.8rem; }

@media (min-width: 950px) {
  .itemgrid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-areas:
      "stage side"
      "main  side";
    align-items: start;
    gap: 2.5rem;
  }
  .item-stage { grid-area: stage; }
  .item-side  { grid-area: side; }
  .item-main  { grid-area: main; }
}

.stage {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.stage-shot { aspect-ratio: 4 / 3; background: var(--paper-warm); }
.stage-shot img { width: 100%; height: 100%; object-fit: contain; }

.filmstrip {
  display: flex; gap: .4rem; padding: .5rem;
  border-top: 1px solid var(--rule-soft);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filmstrip button {
  flex: none; width: 62px; height: 62px; padding: 0;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-warm); cursor: pointer; overflow: hidden;
}
.filmstrip button img { width: 100%; height: 100%; object-fit: cover; }
.filmstrip button[aria-current=true] { border-color: var(--maroon); box-shadow: 0 0 0 1px var(--maroon); }

.item-head { border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1.2rem; }
.item-head h1 { margin-bottom: .7rem; }

/* The accession line on the item page: bigger, and the page's masthead datum. */
.accession-bar {
  display: flex; flex-wrap: wrap; gap: .4rem .9rem;
  margin: 0;
  padding: .6rem .8rem;
  background: var(--ink); color: #cfc8c9;
  border-radius: var(--radius);
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase;
}
.accession-bar .k { color: #8a7d80; }
.accession-bar .v { color: #fff; }
.accession-bar .v-hi { color: #d99aa4; font-weight: 600; }

.facts { margin: 1.2rem 0 0; border-top: 1px solid var(--rule); }
.facts div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: .88rem;
}
.facts dt {
  font-family: var(--mono); font-size: .64rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  flex: none;
}
.facts dd { margin: 0; text-align: right; }
.facts dd a { text-decoration: none; }

.prose { max-width: 68ch; line-height: 1.7; }
.prose p { margin: 0 0 1rem; white-space: pre-wrap; }
.prose p:last-child { margin-bottom: 0; }

.owner {
  display: flex; align-items: center; gap: .85rem;
  padding: .95rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--maroon);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
}
.owner-name { font-weight: 700; font-family: var(--display); text-decoration: none; color: var(--ink); display: block; }
.owner-name:hover { color: var(--maroon); }
.owner-status { font-size: .82rem; color: var(--muted); margin: .1rem 0 0; }

/* ------------------------------------------------------------------- docs */

.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.doc {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .85rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.doc:hover { border-color: var(--maroon); color: var(--ink); }
.doc-icon {
  flex: none; width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--maroon); color: #fff;
  font-family: var(--mono); font-size: .54rem; font-weight: 700;
  letter-spacing: .04em;
  border-radius: var(--radius);
}
.doc-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-family: var(--mono); font-size: .62rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: .1rem 0 0; }
.doc-body { min-width: 0; flex: 1; }
.doc-get { font-family: var(--mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--maroon); flex: none; }

.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.gal a { display: block; aspect-ratio: 1/1; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--paper-warm); }
.gal a:hover { border-color: var(--maroon); }
.gal img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ uploads */

.dropzone {
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  background: var(--paper-warm);
  padding: 1.1rem;
  text-align: center;
}
.dropzone.hot { border-color: var(--maroon); background: #fbf5f6; }
.dropzone input[type=file] { display: block; width: 100%; font-size: .84rem; margin-top: .5rem; }
.dropzone-lead { font-size: .88rem; margin: 0; }
.dropzone-lead b { font-family: var(--display); }

.catblock { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); padding: 1rem; margin: 0 0 1rem; }
.catblock-head { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .1rem; }
.catblock h3 { margin: 0; font-size: .92rem; }
.catblock .tagline {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em;
  text-transform: uppercase;
}
.tagline-req { color: var(--maroon); font-weight: 600; }
.tagline-opt { color: #a49d97; }
.catblock .hint { margin: .1rem 0 .8rem; }

.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-top: .8rem; }
.preview:empty { display: none; }
.preview figure { margin: 0; position: relative; }
.preview img, .preview .pdfchip {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-warm);
}
.preview .pdfchip {
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .1em; color: var(--maroon);
}
.preview figcaption {
  font-family: var(--mono); font-size: .55rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .2rem;
}

.existing { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; margin: 0 0 .9rem; padding: 0; list-style: none; }
.existing figure { margin: 0; }
.existing img, .existing .pdfchip {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-warm);
}
.existing .pdfchip { display: grid; place-items: center; font-family: var(--mono); font-size: .58rem; color: var(--maroon); }
.existing .rm {
  display: flex; align-items: center; gap: .3rem;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-top: .3rem; cursor: pointer;
}
.existing .rm input { width: 15px; height: 15px; min-height: 0; margin: 0; accent-color: var(--maroon); }
.existing .marked img, .existing .marked .pdfchip { opacity: .3; border-color: var(--maroon); }
.existing .marked .rm { color: var(--maroon); font-weight: 700; }

/* ------------------------------------------------------------------- crop */

.avatar-editor { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.avatar-current { flex: none; text-align: center; }
.avatar-current img, .avatar-current .avatar-blank {
  width: 96px; height: 96px; border-radius: 50%;
  border: 1px solid var(--rule);
  object-fit: cover;
}
.avatar-controls { flex: 1; min-width: 220px; }

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11, 11, 12, .82);
  display: none;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--paper);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  max-height: 92vh; overflow: auto;
  border-top: 3px solid var(--maroon);
}
.modal-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-head p { margin: .25rem 0 0; font-size: .8rem; color: var(--muted); }
.modal-body { padding: 1.2rem; }
.modal-foot {
  display: flex; gap: .7rem; justify-content: flex-end; flex-wrap: wrap;
  padding: 1rem 1.2rem; border-top: 1px solid var(--rule);
  background: var(--paper-warm);
}
.cropstage { max-height: 56vh; background: var(--paper-warm); }
.cropstage img { max-width: 100%; display: block; }

/* ------------------------------------------------------------------ tables */

.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 620px; }
.tbl th {
  text-align: left; padding: .6rem .7rem;
  font-family: var(--mono); font-size: .6rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  border-bottom: 2px solid var(--ink); font-weight: 500;
}
.tbl td { padding: .7rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.tbl tr:hover td { background: var(--paper-warm); }
.tbl .mono { font-family: var(--mono); font-size: .74rem; }

.pill {
  display: inline-block;
  font-family: var(--mono); font-size: .58rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: .18rem .42rem; border-radius: var(--radius);
  border: 1px solid var(--rule); color: var(--muted);
}
.pill-on  { border-color: var(--maroon); color: var(--maroon); }
.pill-off { border-color: var(--rule); color: #a49d97; }
.pill-ink { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ------------------------------------------------------------------ footer */

.foot { background: var(--ink); color: #8d8785; margin-top: 3rem; }
.foot-in {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  padding-top: 1.5rem; padding-bottom: 1.5rem;
}
.foot-mark {
  font-family: var(--display); font-weight: 800; color: #fff;
  letter-spacing: .12em; text-transform: uppercase; font-size: .8rem;
  margin: 0;
}
.foot-sub {
  display: block;
  font-family: var(--mono); font-size: .58rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: #6d6462; margin-top: .3rem; font-weight: 400;
}
.foot-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.foot-nav a {
  color: #8d8785; text-decoration: none;
  font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
}
.foot-nav a:hover { color: #fff; }

/* ------------------------------------------------------------------- misc */

.stack > * + * { margin-top: 1.4rem; }
.mt { margin-top: 1.4rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.bignum {
  font-family: var(--mono); font-size: 2rem; font-weight: 600;
  color: var(--ink); line-height: 1; display: block;
}
.bignum-label {
  font-family: var(--mono); font-size: .6rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  margin-top: .4rem; display: block;
}
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--maroon); border-radius: var(--radius); padding: 1.1rem; }

.errpage { text-align: center; padding: 4rem 1rem; }
.errpage .code {
  font-family: var(--mono); font-size: 3.4rem; font-weight: 600;
  color: var(--maroon); line-height: 1; margin: 0 0 .6rem;
}
.errpage pre {
  text-align: left; overflow: auto; font-size: .72rem;
  background: var(--paper); border: 1px solid var(--rule);
  padding: 1rem; margin-top: 1.6rem; max-width: 800px;
  margin-left: auto; margin-right: auto;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
