/* =============================================================
   Treasure Trove Finds: the inventory page.
   Loaded after styles.css and pages.css. Everything here is scoped
   to .inv so the shared header, footer, buttons and chips stay shared.

   A ledger in the toy box look: a white sheet ruled in navy, a navy
   header band with a mustard rule, a colour edge per kind, and the
   tag text in the tag's own hand on tag paper.

   Phones and tablets (under 1024px): a row is the name with the price beside it,
   and maker and era on a line under it when we have them. The kind is
   the colour on the row's left edge and the buttons above. The tag text folds
   away and comes back when a search matches it. Tap a row for the
   record. 640 to 1023px sets the rows two across.
   Desktop: a real table, header stuck under the top bar.
   ============================================================= */

.inv{
  --inv-top:76px;                 /* height of the sticky top bar; inventory.js measures the real one */
  --inv-rule:rgba(27,47,94,.16);
  --inv-soft:#46557C;             /* navy, lightened: 7:1 on white */
  --k:var(--navy);
}
.inv-main{padding-block:10px var(--section)}
@media (min-width:1024px){ .inv-main{padding-block:32px var(--section)} }

/* ---------- the head: a plain label and one line ---------- */
.inv .inv-head h1{font-size:clamp(30px,4.6vw,56px);line-height:1}
.inv-note{margin:2px 0 0;font-size:18px;line-height:1.35;max-width:34em}
.inv-note a,.inv-none a{font-weight:700;white-space:nowrap;padding:11px 6px;margin:-11px -6px;display:inline-block}
@media (min-width:1024px){ .inv-note{margin-top:8px;font-size:20px} }

/* ---------- search: sticks under the top bar on phones ---------- */
.inv-search{position:sticky;top:var(--inv-top);z-index:20;margin:0 calc(-1 * var(--gutter));padding:6px var(--gutter);background:var(--cream)}
.inv-search input{
  display:block;width:100%;height:48px;margin:0;padding:0 14px 0 46px;
  font:500 18px/1 var(--body);color:var(--navy);
  background:var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%231B2F5E' stroke-width='2.6'/%3E%3Cpath d='M15.5 15.5L21 21' stroke='%231B2F5E' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") 13px 50%/24px 24px no-repeat;
  border:3px solid var(--navy);border-radius:6px;box-shadow:3px 3px 0 var(--navy);
  -webkit-appearance:none;appearance:none;
}
.inv-search input::placeholder{color:var(--inv-soft);opacity:1}
.inv-search input:focus-visible{outline:3px solid var(--mustard);outline-offset:2px}
@media (min-width:1024px){
  /* the label and its line on the left, the search box on the right, on one line */
  .inv-main>.wrap{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,440px);column-gap:48px;align-items:end}
  .inv-main>.wrap>*{grid-column:1 / -1}
  .inv-main>.wrap>.inv-head{grid-column:1}
  .inv-main>.wrap>.inv-search{grid-column:2;position:static;margin:0;padding:0 4px 4px 0}
  .inv-search input{height:52px;font-size:20px}
}

/* ---------- kind buttons (the shared chips), count and sort ---------- */
.inv .inv-chips{margin-top:2px;margin-bottom:0}
/* the kinds always wrap, so none is ever off the edge. A phone has no room for five rows of
   them above the list, so there the same choice is one drop-down (.inv-kind). */
.inv .inv-chips{flex-wrap:wrap;overflow:visible;margin-inline:0;padding-inline:0;padding-bottom:0;gap:8px}
.inv-kind{display:none}
.inv-kind select{
  display:block;width:100%;height:48px;margin:0;padding:0 44px 0 14px;
  font:700 18px/1 var(--body);color:var(--navy);
  background:var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9l7 7 7-7' fill='none' stroke='%231B2F5E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/22px 22px no-repeat;
  border:3px solid var(--navy);border-radius:6px;-webkit-appearance:none;appearance:none;
}
.inv-kind select:focus-visible{outline:3px solid var(--mustard);outline-offset:2px}
@media (min-width:600px) and (max-width:1023px){ .inv .inv-chips{margin-top:8px} .inv .inv-chips .chip{min-height:44px;padding:0 12px;font-size:18px} }
@media (min-width:1024px){
  .inv .inv-chips{margin-top:20px;gap:8px 6px}
  .inv .inv-chips .chip{min-height:44px;padding:0 10px;font-size:18px;border-width:2px}
}
.inv-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;margin:0 0 4px}
@media (min-width:1024px){ .inv-bar{min-height:0;margin:14px 0 8px} }
.inv-count{margin:0;font-weight:700;font-size:18px;white-space:nowrap}
/* a narrow screen (a Fold's cover): the count over the sort buttons, not squeezed to two lines beside them (2026-10-30) */
@media (max-width:379px){ .inv-bar{flex-wrap:wrap;gap:6px 12px} }
.inv-sort{display:flex;flex:0 0 auto;border:3px solid var(--navy);border-radius:6px;overflow:hidden;background:var(--white)}
.inv-sort button{
  min-height:44px;padding:0 12px;border:0;background:transparent;cursor:pointer;
  font:700 18px/1 var(--body);color:var(--navy);
}
.inv-sort button + button{border-left:3px solid var(--navy)}
.inv-sort button[aria-pressed="true"]{background:var(--navy);color:var(--cream)}
@media (min-width:1024px){ .inv .inv-sort{display:none} }   /* the column heads sort the table there */
/* with scripts off there is nothing to search, filter or sort with */
html:not(.js) .inv-search,html:not(.js) .inv-chips,html:not(.js) .inv-kind,html:not(.js) .inv-sort{display:none}

/* ---------- kind colours ---------- */
.inv [data-kind="christmas"],.k--christmas{--k:var(--red)}
.inv [data-kind="toys"],.k--toys{--k:var(--mustard)}
.inv [data-kind="trains"],.k--trains{--k:var(--navy)}
.inv [data-kind="cars-trucks"],.k--cars-trucks{--k:var(--teal)}
.inv [data-kind="dolls-plush"],.k--dolls-plush{--k:var(--red)}
.inv [data-kind="glass-bottles"],.k--glass-bottles{--k:var(--teal)}
.inv [data-kind="advertising-signs"],.k--advertising-signs{--k:var(--navy)}
.inv [data-kind="kitchen"],.k--kitchen{--k:var(--mustard)}
.inv [data-kind="jewelry"],.k--jewelry{--k:var(--red)}
.inv [data-kind="tools"],.k--tools{--k:var(--navy)}
.inv [data-kind="pictures"],.k--pictures{--k:var(--teal)}
.inv [data-kind="household"],.k--household{--k:var(--mustard)}
.inv [data-kind="books-paper"],.k--books-paper{--k:var(--teal)}
.inv [data-kind="halloween"],.k--halloween{--k:var(--mustard)}
.inv [data-kind="furniture"],.k--furniture{--k:var(--red)}
/* the kinds added with the seven sections (2026-11-13), in their section's colour */
.inv [data-kind="fisher-price"],.k--fisher-price{--k:var(--mustard)}
.inv [data-kind="games"],.k--games{--k:var(--mustard)}
.inv [data-kind="banks"],.k--banks{--k:var(--mustard)}
.inv [data-kind="other-holidays"],.k--other-holidays{--k:var(--red)}
.inv [data-kind="tins"],.k--tins{--k:var(--navy)}
.inv [data-kind="crates"],.k--crates{--k:var(--navy)}
.inv [data-kind="americana"],.k--americana{--k:var(--navy)}
.inv [data-kind="barware"],.k--barware{--k:var(--teal)}
.inv [data-kind="glassware"],.k--glassware{--k:var(--teal)}
.inv [data-kind="purses"],.k--purses{--k:var(--red)}
.inv [data-kind="belt-buckles"],.k--belt-buckles{--k:var(--red)}
.inv [data-kind="pins"],.k--pins{--k:var(--red)}
.inv [data-kind="sculptures"],.k--sculptures{--k:var(--teal)}
.inv [data-kind="sewing"],.k--sewing{--k:var(--navy)}
.inv [data-kind="medical"],.k--medical{--k:var(--navy)}
.inv [data-kind="cameras"],.k--cameras{--k:var(--navy)}

/* ---------- the ledger ---------- */
.inv-table{width:100%;border-collapse:separate;border-spacing:0;background:var(--white);border:4px solid var(--navy);border-radius:4px;font-size:18px;line-height:1.25;text-align:left}
.inv-table th,.inv-table td{padding:0;font-weight:500;vertical-align:top}
.inv-row{position:relative;cursor:pointer}
.inv-row[hidden]{display:none}
.inv-row .c-name a{color:var(--navy);font-weight:700;text-decoration:none}
/* the whole row is the link */
.inv-row .c-name a::after{content:"";position:absolute;inset:0;z-index:1}
.inv-row .c-name a:focus-visible{outline:none}
.inv-row:focus-within{outline:3px solid var(--mustard);outline-offset:-3px}
.inv-row .c-price{font-family:var(--display);font-weight:800;font-size:21px;line-height:1.05;white-space:nowrap}
.inv-row .c-tag span{display:inline-block;font-family:var(--hand);font-size:19px;line-height:1.3;color:var(--navy);background:var(--paper);border:2px solid var(--navy);border-radius:3px;padding:2px 8px}
.inv-meta{display:block;color:var(--inv-soft);font-weight:500}
.inv-none{margin:20px 0 0;font-size:20px}

/* phones: the label, the search box, the kinds and the count take as little height as
   18px text and 44px targets allow, so six rows or more show on a 344 by 700 screen */
@media (max-width:599px){
  .inv-main{padding-top:8px}
  .inv .inv-head h1{font-size:28px}
  .inv-note{margin:0;line-height:1.3}
  .inv-wide{display:none}          /* the number is behind Call in the top bar */
  .inv-search{padding-block:4px}
  .inv .inv-chips{display:none}
  .inv-kind{display:block;margin-bottom:4px}
  .inv-bar{margin:0}
  .inv-none{font-size:18px}
}

/* phones and tablets: each row is a small card line */
@media (max-width:1023px){
  .inv-table,.inv-table tbody{display:block}
  .inv-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .inv-table thead button{display:none}   /* the A to Z and By kind buttons sort here; the column heads stay as plain headings */
  .inv-row{
    display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;align-items:start;align-content:center;
    min-height:44px;padding:4px 10px 4px 12px;
    border-top:2px solid var(--inv-rule);border-left:6px solid var(--k);
  }
  .inv-row:first-child{border-top:0}
  .inv-row .c-name{display:block;min-width:0;grid-column:1;grid-row:1}
  .inv-row .c-name a{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;line-height:1.22}
  .inv-meta{line-height:1.22;overflow-wrap:anywhere}
  .inv-row .c-kind{display:none}
  .inv-row .c-price{display:block;padding-top:1px;grid-column:2;grid-row:1}
  .inv-row .c-tag{display:none;grid-column:1 / -1;grid-row:2;padding:3px 0 2px}
  .inv-row.tag-hit .c-tag{display:block}
  .inv-row:active{background:#FFF1C2}
}
@media (min-width:640px) and (max-width:1023px){
  .inv-table tbody{display:grid;grid-template-columns:1fr 1fr}
  .inv-row{border-top:2px solid var(--inv-rule)}
  .inv-row:first-child{border-top:2px solid var(--inv-rule)}
  .inv-row:nth-child(even){border-left:6px solid var(--k);box-shadow:-2px 0 0 var(--inv-rule)}
}

/* desktop: the table */
@media (min-width:1024px){
  .inv-table{table-layout:fixed;font-size:19px;overflow:clip}   /* clip: the strip behind the stuck head is wider than the table */
  .inv-meta{margin-top:2px;font-size:18px}
  .inv-table thead th{
    position:sticky;top:var(--inv-top);z-index:10;
    padding:14px 10px 12px;background:var(--navy);color:var(--cream);
    font-family:var(--display);font-weight:800;font-size:20px;line-height:1;letter-spacing:.08em;text-transform:uppercase;
    white-space:nowrap;border-bottom:4px solid var(--mustard);
  }
  /* one strip behind the whole stuck head, so no hairline shows between its cells */
  .inv-table thead th:first-child::before{content:"";position:absolute;left:0;top:0;bottom:-4px;width:400%;z-index:-1;background:linear-gradient(var(--navy) calc(100% - 4px),var(--mustard) 0)}
  .inv-table thead th.c-name{padding-left:24px}
  .inv-table thead th[data-sort]{padding-block:3px 1px}
  .inv-table thead th button{
    all:unset;display:inline-flex;align-items:center;gap:8px;cursor:pointer;min-height:44px;
    font:inherit;letter-spacing:inherit;text-transform:inherit;color:inherit;
  }
  .inv-table thead th button::after{content:"";width:0;height:0;border-inline:6px solid transparent;border-top:8px solid currentColor;opacity:.35}
  .inv-table thead th[aria-sort="ascending"] button::after{opacity:1;border-top-color:var(--mustard)}
  .inv-table thead th button:focus-visible{outline:3px solid var(--mustard);outline-offset:4px}
  /* four columns: the piece (its maker and date under the name), the kind, the tag, the price */
  .inv-table .c-name{width:34%}
  .inv-table .c-kind{width:18%}
  .inv-table .c-tag{width:38%}
  .inv-table .c-price{width:10%}
  .inv-row th,.inv-row td{padding:9px 10px;border-top:2px solid var(--inv-rule)}
  .inv-row:first-child th,.inv-row:first-child td{border-top:0;padding-top:13px}
  .inv-row th.c-name{padding-left:18px;border-left:6px solid var(--k)}
  .inv-row:nth-child(even) th,.inv-row:nth-child(even) td{background:var(--cream)}
  .inv-row td.c-price{text-align:right;padding-right:18px}
  .inv-table thead th.c-price{text-align:right;padding-right:18px}
  @media (max-width:1439px){
    .inv-table .c-name{width:32%}.inv-table .c-kind{width:18%}.inv-table .c-tag{width:34%}.inv-table .c-price{width:16%}
  }
  .k{display:flex;align-items:baseline;gap:9px}
  .k::before{content:"";flex:0 0 12px;width:12px;height:12px;background:var(--k);border:2px solid var(--navy);transform:translateY(1px)}
  .inv-row .c-name a{cursor:pointer}
  @media (hover:hover){
    .inv-row:hover th,.inv-row:hover td{background:#FFF1C2}
    .inv-row:hover .c-name a{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
  }
}

/* pass five review: the column-head sort buttons are full 44px targets, and every row is one */
.inv-table thead th button{min-height:44px}
@media (min-width:1024px){ .inv-row th,.inv-row td{height:44px} }
.inv-row .c-name a{padding-block:11px;margin-block:-11px}
@media (min-width:1024px){ .inv-row .c-name a{display:inline-block;padding-block:10px;margin-block:-10px} }
