/* ============================================================
   PIGEONHOLE — an accession desk for a studio's task inbox
   Direction: Archive Museum — catalog plates, hairline rules,
   one oxblood wall accent, a stamp for every status change.
   ============================================================ */

@font-face {
  font-family: "Catalog Serif";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Catalog Text";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Catalog Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FCFCFA;
  --surface: #FFFFFF;
  --paper: #F4F0E6;
  --ink: #1C1B18;
  --muted: #66625A;
  --oxblood: #7A2E2B;
  --hairline: #E2DED3;
  --hairline-2: #CFC9BB;
  --serif: "Catalog Serif", "DM Serif Display", Georgia, serif;
  --text: "Catalog Text", Literata, Georgia, serif;
  --mono: "Catalog Mono", "IBM Plex Mono", "Courier New", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.62;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 32px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px; top: -48px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--oxblood);
  color: #F7F3EA;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: top 180ms var(--ease);
}
.skip:focus { top: 12px; }

::selection { background: var(--oxblood); color: #F7F3EA; }

/* ---------- shared focus treatment ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
kbd:focus-visible {
  outline: 2px solid var(--oxblood);
  outline-offset: 2px;
}
input:focus, select:focus { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.row:focus-visible { outline-offset: -3px; }

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
  background: var(--bg);
  border-bottom: 3px double var(--ink);
}
.mast-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
  flex-wrap: wrap;
  padding-block: 16px;
}
.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark { width: 24px; height: 24px; flex: none; align-self: center; color: var(--ink); }
.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.edition {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.edition-sep { color: var(--oxblood); padding-inline: 6px; }

/* ============================================================
   Hero — copy left, cabinet right
   ============================================================ */
.hero { padding-block: 64px 72px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 64px;
  align-items: center;
}

.kicker {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker-tick { width: 8px; height: 8px; background: var(--oxblood); flex: none; }

h1 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  max-width: 15ch;
  animation: rise 560ms var(--ease) both 70ms;
}

.lede {
  margin: 0;
  max-width: 54ch;
  font-size: 18px;
  line-height: 1.65;
  animation: rise 560ms var(--ease) both 140ms;
}

.tally {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--hairline-2);
  padding-top: 22px;
  max-width: 480px;
  animation: rise 560ms var(--ease) both 210ms;
}
.tally-num {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(84px, 9vw, 128px);
  line-height: 0.85;
  letter-spacing: -0.05em;
}
.tally-side { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tally-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.tally-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxblood);
}

/* ---------- the cabinet ---------- */
.cabinet-wrap { min-width: 0; }
.cabinet-label {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.cabinet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
}
.bank {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 148px;
  padding: 12px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
  animation: rise 500ms var(--ease) both;
}
.bank:nth-child(1) { animation-delay: 120ms; }
.bank:nth-child(2) { animation-delay: 180ms; }
.bank:nth-child(3) { animation-delay: 240ms; }
.bank:nth-child(4) { animation-delay: 300ms; }

.slips {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  padding-top: 2px;
  min-height: 0;
}
.slip {
  width: 74%;
  height: 15px;
  background: var(--surface);
  border: 1px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(28, 27, 24, 0.14);
  transition: transform 180ms var(--ease);
}
.slip:nth-child(2) { margin-left: 8%; }
.slip:nth-child(3) { margin-left: 3%; }
.slip:nth-child(4) { margin-left: 11%; }
.slip:nth-child(5) { margin-left: 5%; }
.slip--empty {
  border: 1px dashed var(--hairline-2);
  box-shadow: none;
  background: transparent;
}
.bank-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bank-count { margin-left: auto; color: var(--oxblood); }

.mark {
  width: 12px; height: 12px;
  flex: none;
  color: var(--ink);
}
.mark--blocked { color: var(--oxblood); }

.cabinet-note {
  margin: 12px 2px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   Query desk — search & filter band
   ============================================================ */
.deskband {
  background: var(--paper);
  border-block: 1px solid var(--hairline-2);
  padding-block: 20px;
}
.controls {
  display: flex;
  align-items: flex-end;
  gap: 24px 28px;
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.field input,
.field select {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  height: 44px;
  padding: 8px 12px;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.field-search input { width: min(340px, 100%); }
.field-filter select { width: min(200px, 100%); }

.result-count {
  margin: 0 0 0 auto;
  align-self: flex-end;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-block: 12px;
}
.clear-btn {
  align-self: flex-end;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxblood);
  background: none;
  border: none;
  border-bottom: 1px solid var(--oxblood);
  padding: 16px 2px 8px;
  min-height: 44px;
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--hairline-2);
  border-bottom-width: 2px;
  border-radius: 2px;
  padding: 1px 5px;
}

/* ============================================================
   The register — ruled ledger
   ============================================================ */
.register { padding-block: 56px 80px; }
.register-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.register-note { margin: 0; font-size: 14.5px; color: var(--muted); font-style: italic; }

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--ink);
}
.ledger li { border-bottom: 1px solid var(--hairline-2); }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(0, 400px) 84px;
  gap: 20px;
  align-items: center;
  width: 100%;
  min-height: 68px;
  padding: 14px 10px;
  background: none;
  border: none;
  border-radius: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 170ms var(--ease);
}
.row::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  background: var(--oxblood);
  opacity: 0;
  transition: opacity 170ms var(--ease);
}
.row-no {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 170ms var(--ease);
  padding-top: 3px;
  align-self: start;
}
.row-main { min-width: 0; }
.row-title {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.2;
}
.row-sum {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 64px;
  gap: 18px;
  align-items: center;
  min-width: 0;
}
.row-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.row-status .mark { width: 11px; height: 11px; }
.row-assignee {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mono-badge {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--hairline-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}
.row-due {
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: right;
  color: var(--muted);
}
.row-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.row-open svg {
  width: 13px; height: 13px;
  transition: transform 180ms var(--ease);
}

/* ---------- empty state ---------- */
.empty {
  margin-top: 8px;
  padding: 56px 24px 64px;
  text-align: center;
  border: 1px dashed var(--hairline-2);
}
.empty-slot { width: 64px; height: 52px; display: block; margin: 0 auto 18px; }
.empty-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 22px;
}
.empty-detail {
  margin: 0 0 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.btn-primary {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #F7F3EA;
  background: var(--oxblood);
  border: 1.5px solid var(--oxblood);
  border-radius: 0;
  padding: 13px 22px;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}

.noscript-note {
  margin: 32px 0 0;
  padding: 20px;
  border: 1px dashed var(--hairline-2);
  font-style: italic;
  color: var(--muted);
}

/* ============================================================
   Colophon — the oxblood wall
   ============================================================ */
.colophon { background: var(--oxblood); color: #F7F3EA; }
.colophon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 48px;
  flex-wrap: wrap;
  padding-block: 34px;
}
.colophon-text { margin: 0; font-size: 14px; line-height: 1.6; max-width: 46ch; }
.marks { margin: 0; display: flex; gap: 24px; flex-wrap: wrap; }
.marks-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.marks .mark { color: #F7F3EA; }

/* ============================================================
   Catalog card — the detail drawer
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(28, 27, 24, 0.45);
  opacity: 0;
  transition: opacity 280ms var(--ease);
}
.scrim.open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(520px, 100%);
  background: var(--bg);
  border-left: 1.5px solid var(--ink);
  box-shadow: -14px 0 44px rgba(28, 27, 24, 0.14);
  transform: translateX(103%);
  transition: transform 280ms var(--ease);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer[hidden], .scrim[hidden] { display: none; }

.drawer-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 14px;
  border-bottom: 3px double var(--ink);
}
.drawer-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.close-btn {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.close-btn svg { width: 15px; height: 15px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px 44px;
  overscroll-behavior: contain;
}

.drawer-head { position: relative; }
.accession {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(40px, 4vw, 52px);
  line-height: 1;
  letter-spacing: 0.02em;
}
.filed {
  margin: 6px 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
#detail-title {
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.12;
  max-width: 20ch;
  margin: 0 0 4px;
}

.stamp-row { min-height: 64px; display: flex; align-items: center; margin-top: 10px; }
.stamp {
  margin: 0;
  display: inline-block;
  position: relative;
  padding: 9px 16px;
  border: 2px solid var(--oxblood);
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}
.stamp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--oxblood);
}
.stamp.press { animation: stamp-press 280ms var(--ease) both; }

.status-field {
  margin-top: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline-2);
}
.status-field label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#status-control {
  width: min(280px, 100%);
  height: 44px;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 8px 12px;
}
.stamp-note {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--oxblood);
  min-height: 18px;
}

.card-body { margin-top: 20px; max-width: 62ch; }
.card-body p { margin: 0 0 16px; font-size: 16.5px; line-height: 1.68; }
.card-body .outcome {
  border-left: 3px solid var(--ink);
  padding-left: 14px;
  background: var(--paper);
  padding-block: 10px;
  padding-right: 14px;
}
.lead-in { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

.card-meta {
  margin: 26px 0 0;
  border-top: 2px solid var(--ink);
}
.meta-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px dotted var(--hairline-2);
}
.meta-row dt {
  flex: none;
  width: 104px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta-row dd { margin: 0; font-size: 15px; min-width: 0; }

/* ============================================================
   Motion — entrances, hovers, press
   ============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes stamp-press {
  from { opacity: 0; transform: rotate(-3deg) scale(1.6); }
  55% { opacity: 1; }
  to { opacity: 1; transform: rotate(-3deg) scale(1); }
}

@media (hover: hover) and (pointer: fine) {
  .bank:hover { border-color: var(--oxblood); transform: translateY(-2px); }
  .bank:hover .slip { transform: translateY(-3px); }
  .bank:hover .bank-label { color: var(--oxblood); }

  .row:hover { background: var(--paper); }
  .row:hover::before { opacity: 1; }
  .row:hover .row-no { color: var(--oxblood); }
  .row:hover .row-open { color: var(--ink); }
  .row:hover .row-open svg { transform: translateX(4px); }

  .clear-btn:hover { color: var(--ink); border-color: var(--ink); }
  .btn-primary:hover { background: #5F2320; border-color: #5F2320; }
  .close-btn:hover { background: var(--ink); color: var(--bg); }
}

.bank:active { transform: translateY(0) scale(0.985); }
.row:active { background: #ECE7DA; }
.clear-btn:active,
.btn-primary:active,
.close-btn:active { transform: scale(0.97); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .row { grid-template-columns: 58px minmax(0, 1fr) minmax(0, 320px) 64px; }
  .row-meta { grid-template-columns: 118px minmax(0, 1fr) 56px; }
}

@media (max-width: 720px) {
  .wrap { padding-inline: 20px; }
  .hero { padding-block: 44px 52px; }
  h1 { font-size: clamp(32px, 9.4vw, 40px); }
  .lede { font-size: 16.5px; }
  .tally { margin-top: 30px; gap: 16px; }
  .tally-num { font-size: 76px; }
  .cabinet { gap: 10px; padding: 10px; }
  .bank { min-height: 118px; padding: 10px; gap: 10px; }
  .slip { height: 12px; }
  .deskband .controls { gap: 14px; }
  .field-search input, .field-filter select { width: 100%; }
  .field { width: 100%; }
  .result-count { margin-left: 0; padding-block: 0; }
  .controls .clear-btn { margin-left: auto; padding-block: 12px; }
  .register { padding-block: 40px 56px; }

  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "no   open"
      "main main"
      "meta meta";
    gap: 8px 16px;
    padding: 16px 10px;
  }
  .row-no { grid-area: no; }
  .row-main { grid-area: main; }
  .row-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 6px 18px; }
  .row-status { grid-area: auto; }
  .row-due { grid-area: auto; text-align: left; }
  .row-open { grid-area: open; }
  .row-sum { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

  .drawer { width: 100%; border-left: none; }
  .drawer-body { padding: 22px 20px 40px; }
  .drawer-top { padding: 14px 20px 12px; }
  .colophon-row { padding-block: 26px; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-copy h1, .lede, .tally, .bank { animation: none; }
}
