/* Palette lifted from the Holiday Blessings watercolour: its paper, ribbon and holly. */
:root {
  --paper: #f4efe4;
  --card: #fdfaf3;
  --ink: #3a2f2a;
  --muted: #7a6d63;
  --rule: #e4dccb;
  --red: #b93c43;
  --red-deep: #8e2a31;
  --green: #3c7560;
  --green-deep: #29523f;
  --gold: #b48f45;
  --radius: 14px;
  --display: "Fraunces", Georgia, serif;
  --body: "Nunito Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  /* A faint snowfall: two offset dot fields in the paper's own warm white. */
  background:
    radial-gradient(circle at 20% 30%, #fffdf8 0 1.6px, transparent 2.2px) 0 0 / 46px 46px,
    radial-gradient(circle at 70% 80%, #fffdf8 0 1.1px, transparent 1.7px) 0 0 / 31px 31px,
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-deep); }

/* ---------- masthead ---------- */
.masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 8px;
  text-align: center;
}

.hero {
  margin: 0 auto;
  max-width: 980px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 0 #fff inset, 0 18px 40px -22px rgba(80, 50, 30, .45);
}
.hero img { display: block; width: 100%; height: auto; }

h1 {
  margin: 28px 0 6px;
  font: 800 clamp(30px, 5.2vw, 58px)/1.02 var(--display);
  letter-spacing: -0.015em;
  color: var(--red-deep);
  text-wrap: balance;
}
h1 .kicker {
  display: block;
  font-size: .42em;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: .35em;
}
h1 .year { color: var(--green); }

.summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
}
.summary strong { color: var(--ink); font-weight: 800; }

.garland {
  display: block;
  width: min(560px, 90%);
  height: auto;
  margin: 18px auto 0;
}

/* ---------- grid ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 16px 20px 40px; }

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: 22px;
}

.tile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(130px, 38%) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 24px -18px rgba(80, 50, 30, .5);
}
/* Candy-cane ribbon along the top edge. */
.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  /* The tile doesn't clip (condition tooltips overflow it), so round the ribbon itself. */
  border-radius: var(--radius) var(--radius) 0 0;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #fff 10px 16px, var(--green) 16px 26px, #fff 26px 32px);
  opacity: .85;
}

.scan { display: block; align-self: start; cursor: zoom-in; border-radius: 4.5% / 3.3%; overflow: hidden; }
.scan img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 825;
  background: linear-gradient(135deg, #ede5d4, #f8f3e9);
  transition: transform .25s ease;
}
.scan:hover img { transform: scale(1.03); }

.info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile > *, .info > * { min-width: 0; }

.name {
  margin: 4px 0 0;
  font: 800 21px/1.15 var(--display);
  color: var(--ink);
}
.name .local { display: block; font: 600 13px var(--body); color: var(--muted); margin-top: 2px; }

.meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.meta .sep { margin: 0 .35em; opacity: .5; }

.price-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price { font: 800 26px/1 var(--body); color: var(--ink); letter-spacing: -.01em; }
.price.none { font-size: 15px; font-weight: 600; color: var(--muted); }
.change { font-size: 13px; font-weight: 700; color: var(--muted); }
.change .arrow { font-size: 11px; }

/* ---------- chart ---------- */
.chart { position: relative; flex: 1; min-height: 120px; overflow: visible; }
.chart svg { display: block; width: 100%; max-width: 100%; height: 130px; overflow: visible; touch-action: pan-y; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font: 600 10.5px var(--body); }
.chart .line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.chart .empty {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 110px;
  border: 1.5px dashed var(--rule);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 10px;
}
.tip {
  position: absolute;
  top: -6px;
  pointer-events: none;
  transform: translate(-50%, -100%);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  padding: 5px 8px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .1s;
}
.tip b { font-size: 13px; }
.tip.show { opacity: 1; }

/* ---------- links ---------- */
.links { display: flex; gap: 8px; }
.btn {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn.tcg { background: var(--green); color: #fff; }
.btn.tcg:hover { background: var(--green-deep); }
.btn.ebay { background: transparent; color: var(--red-deep); box-shadow: inset 0 0 0 1.5px var(--red); }
.btn.ebay:hover { background: var(--red); color: #fff; }
.btn[hidden] { display: none; }

/* ---------- desired condition ---------- */
.wanted {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  font-size: 13px;
}
.wanted-label { color: var(--muted); font-weight: 600; margin-right: 2px; }
.conditions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.conditions .or { color: var(--muted); font-size: 12px; }
.cond {
  position: relative;
  font: 800 12.5px/1 var(--body);
  padding: 6px 10px;
  border-radius: 999px;
  border: 0;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.cond.nm { background: #e3efe8; color: var(--green-deep); }
.cond.lp { background: #f6e4e2; color: var(--red-deep); }
.cond-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  width: 230px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font: 400 12.5px/1.4 var(--body);
  text-align: left;
  text-decoration: none;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .12s, transform .12s, visibility .12s;
  pointer-events: none;
}
.cond-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.cond:hover .cond-tip,
.cond:focus-visible .cond-tip,
.cond.open .cond-tip { opacity: 1; visibility: visible; transform: none; }

/* ---------- card viewer ---------- */
html:has(.viewer[open]) { overflow: hidden; }

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #fff;
}
.viewer:focus { outline: none; }
.viewer[open] { display: flex; animation: viewer-in .18s ease-out; }
.viewer::backdrop {
  background: rgba(32, 22, 18, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
@keyframes viewer-in { from { opacity: 0; transform: scale(.97); } }

.viewer-body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  perspective: 1200px;
}
.viewer-tilt {
  position: relative;
  width: min(86vw, calc((100dvh - 150px) * 600 / 825), 520px);
  aspect-ratio: 600 / 825;
  border-radius: 4.5% / 3.3%;
  overflow: hidden;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7);
  transition: transform .2s ease-out;
  will-change: transform;
  --shine-x: 50%;
  --shine-y: 50%;
}
.viewer-tilt img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A soft light that follows the pointer while the card tilts. */
.viewer-tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, .28), transparent 55%);
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.viewer figcaption { text-align: center; display: grid; gap: 3px; }
.viewer-name { font: 800 22px/1.15 var(--display); }
.viewer-meta { font-size: 14px; opacity: .8; }
.viewer-count { font-size: 12px; opacity: .55; }

.viewer-close, .viewer-nav {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  font: 400 30px/1 var(--body);
  display: grid;
  place-items: center;
  transition: background .15s;
}
.viewer-close:hover, .viewer-nav:hover { background: rgba(255, 255, 255, .25); }
.viewer-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; z-index: 1; }
.viewer-nav { width: 52px; height: 52px; flex: none; padding-bottom: 4px; }

@media (max-width: 560px) {
  /* Phones swipe; the arrows sit below the card instead of beside it. */
  .viewer-nav { position: fixed; bottom: 18px; width: 46px; height: 46px; }
  .viewer-nav.prev { left: calc(50% - 60px); }
  .viewer-nav.next { right: calc(50% - 60px); }
  .viewer-tilt { width: min(90vw, calc((100dvh - 210px) * 600 / 825)); }
  .viewer-body { margin-bottom: 60px; }
}

/* ---------- footer ---------- */
footer {
  text-align: center;
  padding: 10px 20px 48px;
  color: var(--muted);
  font-size: 13px;
}
footer .tree { display: block; width: min(560px, 92%); height: auto; margin: 0 auto 14px; }
footer p { max-width: 620px; margin: 0 auto; }

@media (max-width: 560px) {
  .masthead { padding: 12px 12px 4px; }
  .hero { border-radius: 12px; }
  main { padding: 12px 12px 32px; }
  .tile { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 14px; }
  .tile .chart, .tile .links, .tile .wanted { grid-column: 1 / -1; }
  .info { display: contents; }
  .head, .price-row { grid-column: 2; }
  .scan { grid-row: 1 / span 2; }
  .name { font-size: 18px; }
  .price { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
