@font-face {
  font-family: "Big Shoulders Display";
  src: url("../fonts/big-shoulders-display-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("../fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #110e0c;
  --bg-raise: #1b1612;
  --card: #241c16;
  --sand: #f6efe4;
  --sand-soft: #e7d7c0;
  --sand-dim: #d4c4aa;
  --ochre: #e39a32;
  --amber: #f0b429;
  --amber-ink: #1a1208;
  --cyan: #5eead4;
  --cyan-ink: #04221e;
  --line: rgba(243, 230, 208, 0.18);
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  --display: "Big Shoulders Display", "Arial Narrow", "Segoe UI", sans-serif;
  --body: Inter, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 80% -10%, rgba(227, 154, 50, 0.16), transparent 60%),
    var(--bg);
  color: var(--sand);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.09;
  background-image: url("../assets/grain.png");
  background-size: 160px 160px;
  mix-blend-mode: overlay;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid #7af3e6;
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(227, 154, 50, 0.35);
}

img {
  max-width: 100%;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 8;
  background: var(--amber);
  color: var(--amber-ink);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(1120px, calc(100% - max(2rem, env(safe-area-inset-left) + env(safe-area-inset-right))));
  margin-inline: auto;
}

.mast {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 0 3.1rem;
  background:
    linear-gradient(180deg, rgba(48, 32, 18, 0.55), rgba(17, 14, 12, 0.2) 70%),
    #1a140f;
  border-bottom: 1px solid rgba(227, 154, 50, 0.35);
}

.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sun {
  position: absolute;
  border-radius: 50%;
}

.sun-a {
  width: min(190px, 42vw);
  height: min(190px, 42vw);
  right: 6%;
  top: -48px;
  background: radial-gradient(circle, #ffe1b0 0%, #e39a32 46%, rgba(227, 154, 50, 0) 72%);
}

.sun-b {
  width: min(112px, 26vw);
  height: min(112px, 26vw);
  right: calc(6% + min(150px, 34vw));
  top: 8px;
  background: radial-gradient(circle, #fff6e6 0%, #f0d2a4 48%, rgba(240, 210, 164, 0) 74%);
}

.dune {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 58px;
  pointer-events: none;
}

.mast-inner {
  position: relative;
  z-index: 1;
}

.mast-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
}

.kicker {
  margin: 0 0 0.2rem;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.7rem, 8vw, 4.75rem);
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 18px rgba(17, 14, 12, 0.9);
}

.tagline {
  margin: 0.45rem 0 0;
  max-width: 38rem;
  color: var(--sand-soft);
}

.plaque {
  min-width: 8.5rem;
  padding: 0.55rem 0.95rem 0.5rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8ead4, #e4c99a);
  color: var(--amber-ink);
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.tally {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.35rem, 6vw, 3.15rem);
  line-height: 0.88;
  letter-spacing: 0.02em;
}

.plaque-label {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.controls {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.search input {
  width: 100%;
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(243, 230, 208, 0.32);
  background: rgba(8, 6, 4, 0.55);
  color: var(--sand);
  font-size: 16px;
}

.search input::placeholder {
  color: var(--sand-dim);
}

.chips,
.filters,
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

.chip,
.btn,
.show-more,
select {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(243, 230, 208, 0.34);
  background: rgba(8, 6, 4, 0.28);
  color: var(--sand);
}

.chip {
  flex: 0 0 auto;
  padding: 0 0.9rem;
  font-weight: 600;
}

.chip-count {
  margin-left: 0.3rem;
  font-variant-numeric: tabular-nums;
  color: var(--sand-soft);
}

.chip[aria-pressed="true"] {
  background: var(--ochre);
  border-color: var(--ochre);
  color: var(--amber-ink);
}

.chip[aria-pressed="true"] .chip-count {
  color: var(--amber-ink);
}

#unowned-filter[aria-pressed="true"] {
  background: #d5d8dc;
  border-color: #d5d8dc;
  color: #1a1208;
}

#unowned-filter[aria-pressed="true"] .chip-count {
  color: #1a1208;
}

#wanted-filter[aria-pressed="true"] {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--cyan-ink);
}

#wanted-filter[aria-pressed="true"] .chip-count {
  color: var(--cyan-ink);
}

.select-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--sand-soft);
  font-weight: 600;
}

select {
  padding: 0 0.85rem;
  font-size: 16px;
  background: #1b1612;
}

.btn {
  padding: 0.4rem 0.9rem;
  font-weight: 600;
}

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

.btn-primary {
  background: var(--ochre);
  border-color: var(--ochre);
  color: var(--amber-ink);
}

.btn-quiet {
  background: transparent;
}

.tools {
  display: grid;
  grid-template-columns: 1fr;
}

main {
  padding: 1.15rem 0 0.5rem;
  position: relative;
  z-index: 1;
}

.result-line,
.loading,
.colophon {
  color: var(--sand-soft);
}

.result-line {
  margin: 0 0 0.8rem;
}

.shelf {
  display: grid;
  gap: 0.75rem;
}

.card {
  --stripe: var(--sand-soft);
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-areas:
    "cover body"
    "cover actions";
  column-gap: 0.75rem;
  row-gap: 0.45rem;
  padding: 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  border-bottom-color: rgba(227, 154, 50, 0.5);
  background: linear-gradient(180deg, #2c241c 0%, #1d1814 100%);
  box-shadow: var(--shadow);
}

.ed-1e { --stripe: #e39a32; }
.ed-2e { --stripe: #e7d7c0; }
.ed-re { --stripe: #ffb020; }
.ed-wotc { --stripe: #5eead4; }

.card.is-owned {
  border-color: rgba(240, 180, 41, 0.72);
}

.card.is-wanted {
  border-color: rgba(94, 234, 212, 0.7);
}

.card.is-highlight {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.cover {
  grid-area: cover;
  align-self: start;
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.1rem;
  padding: 0.4rem 0.4rem 0.4rem 0.7rem;
  background:
    linear-gradient(90deg, var(--stripe) 7px, transparent 7px),
    linear-gradient(165deg, #4a3b2c 0%, #16110d 78%);
  box-shadow: inset 0 0 0 1px rgba(243, 230, 208, 0.16);
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-cover {
  display: block;
  width: 148px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px 8px 8px 3px;
}

.cover-code,
.cover-year {
  position: relative;
  z-index: 1;
}

.cover-code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--sand);
}

.cover-year {
  font-size: 0.75rem;
  color: var(--sand-soft);
}

.body {
  grid-area: body;
  min-width: 0;
}

.card-title,
.dialog-body h2,
.empty h2 {
  font-family: var(--body);
  font-weight: 600;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
  margin: 0.3rem 0 0;
  color: var(--sand-dim);
  font-size: 0.86rem;
}

.meta .code,
.code {
  font-family: var(--mono);
  color: #f0d2a4;
  font-size: 0.82rem;
}

.notes {
  margin: 0.35rem 0 0;
  color: var(--sand-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notes-full {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-self: end;
}

.flag.own[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}

.flag.want[aria-pressed="true"] {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--cyan-ink);
}

.pager {
  display: flex;
  justify-content: center;
  margin: 0.9rem 0 0.4rem;
}

.show-more {
  width: min(100%, 28rem);
  min-height: 52px;
  padding: 0.55rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  font-weight: 700;
  background: #2a2118;
  border-color: var(--ochre);
  margin-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.show-more-count {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sand-soft);
}

.empty {
  border: 1px dashed rgba(243, 230, 208, 0.38);
  border-radius: 16px;
  padding: 1.25rem 1rem 1.4rem;
  background: rgba(255, 248, 236, 0.03);
}

.empty h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

.empty p {
  margin: 0.35rem 0 0;
  color: var(--sand-soft);
}

.banner {
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #3a221c;
  border: 1px solid #e7b1a0;
}

.colophon {
  position: relative;
  z-index: 1;
  padding: 0.4rem 0 calc(1.8rem + env(safe-area-inset-bottom));
  font-size: 0.92rem;
}

.colophon p {
  margin: 0.35rem 0;
}

dialog {
  width: min(42rem, calc(100vw - 1.25rem));
  max-height: min(88dvh, 46rem);
  padding: 0;
  border: 1px solid rgba(243, 230, 208, 0.32);
  border-radius: 16px;
  background: #1c1712;
  color: var(--sand);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(8, 6, 4, 0.74);
}

.dialog-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 0.55rem 0.55rem 0;
  background: linear-gradient(#1c1712, #1c1712 70%, rgba(28, 23, 18, 0));
}

.dialog-body {
  padding: 0.2rem 1rem 1.1rem;
}

.dialog-body h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1.15;
}

.dialog-layout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.dialog-cover,
.dialog-fallback {
  width: 148px;
  position: relative;
}

.dialog-fallback {
  aspect-ratio: 3 / 4;
}

.edition-line,
.publisher {
  margin: 0.25rem 0 0;
  color: var(--sand-soft);
}

.dialog-body h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand-dim);
}

.sources {
  margin: 0;
  padding-left: 1.1rem;
}

.sources a {
  color: #9cf6ea;
  font-weight: 600;
}

.sources a:hover {
  color: #d8fff8;
}

abbr {
  text-decoration: none;
  cursor: help;
}

@media (min-width: 720px) {
  .tools {
    grid-template-columns: auto auto auto;
    justify-content: start;
  }

  .card {
    grid-template-columns: 108px minmax(0, 1fr);
  }
}

@media (min-width: 860px) {
  .shelf {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1280px) {
  .shelf {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .dialog-cover,
  .dialog-fallback {
    width: 132px;
  }
}

@media (hover: hover) {
  .card:hover {
    border-color: rgba(243, 230, 208, 0.4);
  }

  .btn:hover:not(:disabled),
  .chip:hover,
  .show-more:hover {
    border-color: var(--sand-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

::selection {
  background: #e39a32;
  color: #1a1208;
}
