@font-face {
  font-family: "Pixelify Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/pixelify-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Azeret Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/azeret-mono-latin.woff2") format("woff2");
}

:root {
  --ground: #F3F4EF;
  --panel: #E3E5DD;
  --warm: #EBE6D5;
  --sage: #B8BFB2;
  --ink: #5B5853;
  --rule: 1px solid var(--ink);
  --pad: 20px;
  --display: "Pixelify Sans", "Azeret Mono", monospace;
  --mono: "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* The mono's fi ligature drops the dot of the i; `font:` shorthands reset this, hence !important. */
* { font-variant-ligatures: none !important; }
html { background: var(--panel); scrollbar-color: var(--ink) var(--panel); }
body {
  margin: 0;
  font: 400 14px/1.5 var(--mono);
  color: var(--ink);
  background: var(--panel);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--ground); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, p, ol, dl, dd { margin: 0; }
ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; }

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Frame ------------------------------------------------------------ */
.frame {
  max-width: 1480px;
  margin: 16px auto;
  background: var(--ground);
  border: var(--rule);
  overflow: hidden;
}
@media (min-width: 1512px) { .frame { margin-block: 24px; } }
@media (max-width: 1511px) { .frame { margin-inline: 16px; } }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--pad);
  border-bottom: var(--rule);
}

/* Header ----------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr) minmax(0, 1.1fr);
  border-bottom: var(--rule);
}
.hero > * + * { border-left: var(--rule); }

.title {
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.title h1 {
  font: 700 clamp(3.5rem, 8.2vw, 6rem)/0.86 var(--display);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.title p { max-width: 34ch; font-size: 15px; }

.fir {
  background: var(--warm);
  display: grid;
  place-items: center;
  padding: var(--pad);
}
.fir canvas { display: block; width: 100%; max-width: 300px; height: auto; }

.howto { display: flex; flex-direction: column; }
.howto h2 { padding: var(--pad) var(--pad) 12px; }
.howto ol { flex: 1; }
.howto li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 12px var(--pad);
  border-top: 1px solid var(--sage);
}
.howto li b { font-weight: 600; }
.howto .n {
  font: 600 20px/1.1 var(--display);
}
.counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: var(--rule);
  background: var(--panel);
}
.counts div { padding: 12px var(--pad); }
.counts div + div { border-left: var(--rule); }
.counts strong {
  display: block;
  font: 600 28px/1 var(--display);
  margin-bottom: 4px;
}

/* Product grid ----------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 -1px -1px 0;
}
.item {
  display: flex;
  flex-direction: column;
  border-right: var(--rule);
  border-bottom: var(--rule);
  background: var(--ground);
}
.item-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: var(--rule);
}
.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border: var(--rule); background: var(--ground); }

.photo {
  position: relative;
  aspect-ratio: 1;
  background: var(--panel);
  border-bottom: var(--rule);
  overflow: hidden;
}
.photo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.photo .missing {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  padding: 16px;
  background:
    linear-gradient(var(--panel), var(--panel)) center / calc(100% - 48px) 44px no-repeat,
    repeating-conic-gradient(var(--sage) 0 25%, transparent 0 50%) 0 0 / 8px 8px;
}

.body { display: flex; flex-direction: column; flex: 1; padding: 16px; gap: 16px; }
.body h2 { font: 600 17px/1.25 var(--mono); text-wrap: balance; }

.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.specs dd { font-weight: 500; text-align: right; }
.specs .was { font-weight: 400; text-decoration: line-through; margin-right: 6px; }
.specs .tbc { font-weight: 400; }

.search { margin-top: auto; }
.search .label { display: block; margin-bottom: 6px; }
.query {
  display: grid;
  grid-template-columns: 1fr auto;
  border: var(--rule);
  background: var(--warm);
}
.query code {
  font: 500 13px/1.4 var(--mono);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  user-select: all;
}
.copy {
  min-width: 76px;
  padding: 0 12px;
  border: 0;
  border-left: var(--rule);
  background: var(--ground);
  transition: background-color .15s ease-out, color .15s ease-out;
}
.copy:hover, .copy.done { background: var(--ink); color: var(--ground); }

.claim {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: var(--rule);
  background: var(--ink);
  color: var(--ground);
  font-weight: 500;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.claim:hover { background: var(--ground); color: var(--ink); }

/* Taken state */
.item.taken { background: var(--panel); }
.item.taken .status i { background: var(--ink); }
.item.taken .photo img { opacity: 0.5; filter: grayscale(1); }
.item.taken .photo:has(img)::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-conic-gradient(var(--panel) 0 25%, transparent 0 50%) 0 0 / 6px 6px;
}
.item.taken .query { background: var(--panel); }
.item.taken .claim {
  background: transparent;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}
.item.taken .claim u { text-underline-offset: 3px; font-weight: 400; }
.item.taken .claim:hover { background: var(--ground); }

.more {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  min-height: 200px;
  padding: 16px;
  border-right: var(--rule);
  border-bottom: var(--rule);
  background: var(--warm);
}
.more strong { font: 600 28px/1 var(--display); text-transform: uppercase; }

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 16px var(--pad);
  border-top: var(--rule);
}

/* Responsive ------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr) 240px; }
  .howto { grid-column: 1 / -1; border-left: 0; border-top: var(--rule); }
}
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  :root { --pad: 16px; }
  body { font-size: 15px; }
  .frame { margin: 0; border-inline: 0; border-top: 0; }
  .hero { grid-template-columns: minmax(0, 1fr) auto; }
  .title { display: contents; }
  .title h1 { grid-area: 1 / 1; padding: var(--pad); align-self: center; }
  .title p { grid-area: 2 / 1 / auto / -1; max-width: none; padding: var(--pad); border-top: var(--rule); }
  .fir { display: grid; grid-area: 1 / 2; padding: 12px var(--pad); }
  .fir canvas { width: 96px; }
  .howto { grid-column: 1 / -1; border-left: 0; border-top: var(--rule); }
  .grid { grid-template-columns: 1fr; }
  .query code { font-size: 14px; }
  .copy { min-height: 48px; }
  .claim { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Reservation states --------------------------------------------------- */
.claimed {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: var(--rule);
  display: flex;
  align-items: center;
}
.claim[disabled], .copy[disabled] { opacity: 0.6; cursor: progress; }

.state {
  grid-column: 1 / -1;
  padding: 48px var(--pad);
  border-right: var(--rule);
  border-bottom: var(--rule);
}
.state button {
  margin-top: 12px;
  padding: 10px 16px;
  border: var(--rule);
  background: var(--ground);
}
.state button:hover { background: var(--ink); color: var(--ground); }

.notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  background: var(--ink);
  color: var(--ground);
  z-index: 10;
}
.notice:empty { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .claimed { min-height: 48px; }
}

/* Admin ---------------------------------------------------------------- */
.admin .topbar a { color: inherit; text-underline-offset: 3px; }
.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}
.editor {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: var(--pad);
  background: var(--ground);
  max-height: 100dvh;
  overflow-y: auto;
}
.editor h1 { font: 600 28px/1.05 var(--display); text-transform: uppercase; text-wrap: balance; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label, .catalog-head { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.field input:not([type="file"]):not([type="checkbox"]), .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: var(--rule);
  border-radius: 0;
  background: var(--ground);
  color: var(--ink);
  font: 500 14px/1.4 var(--mono);
  caret-color: var(--ink);
}
.field textarea { resize: vertical; background: var(--warm); }
.field input::placeholder { color: var(--ink); opacity: 1; font-weight: 400; }
.field input[type="file"] { max-width: 100%; font: inherit; color: transparent; }
.file-name { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.file-name:empty { display: none; }
.field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: var(--rule);
  border-radius: 0;
  background: var(--ground);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.hint { font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
.photo-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; }
.photo-preview {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 8px;
  border: var(--rule);
  background: var(--panel);
}
.photo-preview img, .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.form-error:empty { display: none; }
.form-error { padding: 10px 12px; border: var(--rule); background: var(--warm); font-weight: 500; }
.editor-actions { display: flex; gap: 12px; }
.editor-actions .claim { flex: 1; }
.ghost {
  min-height: 36px;
  padding: 6px 12px;
  border: var(--rule);
  background: var(--ground);
  transition: background-color .15s ease-out, color .15s ease-out;
}
.editor-actions .ghost { min-height: 44px; }
.ghost:hover, .icon:hover:not([disabled]) { background: var(--ink); color: var(--ground); }
.icon {
  width: 36px; height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: var(--rule);
  background: var(--ground);
  transition: background-color .15s ease-out, color .15s ease-out;
}
.icon[disabled] { opacity: 0.35; cursor: default; }

.catalog { border-left: var(--rule); }
.catalog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--pad);
  border-bottom: var(--rule);
}
.catalog-head h2 { font: inherit; }
.rows { margin: 0; padding: 0; list-style: none; }
.row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--sage);
}
.row.taken { background: var(--panel); }
.row.taken .status i { background: var(--ink); }
.row.editing { background: var(--warm); }
.thumb { width: 56px; height: 56px; background: var(--panel); border: 1px solid var(--sage); }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-main strong { font-weight: 600; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions [data-delete] { margin-left: 12px; }
.row-state { padding: 32px var(--pad); }

@media (max-width: 1100px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .row-actions [data-delete] { margin-left: auto; }
}
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .editor { position: static; max-height: none; border-bottom: var(--rule); }
  .catalog { border-left: 0; }
}
@media (max-width: 620px) {
  .field input:not([type="file"]):not([type="checkbox"]), .field textarea { font-size: 16px; }
  .icon, .ghost { min-height: 44px; }
  .row { grid-template-columns: 56px minmax(0, 1fr); }
  .row .status { grid-column: 1 / -1; justify-self: start; }
  .icon { width: 44px; height: 44px; }
}
