:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #69655e;
  --line: #e3e0da;
  --accent: #7a5a12;
  --accent-text: #ffffff;
  --up: #2e7d32;
  --down: #b3261e;
  --radius: 6px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131312;
    --surface: #1c1b1a;
    --text: #edebe7;
    --muted: #a39f97;
    --line: #2f2e2b;
    --accent: #d8ad57;
    --accent-text: #19140a;
    --up: #6cc070;
    --down: #f2867e;
  }
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.75rem;
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Spot price bar */

.spot-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.spot-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem 1.25rem;
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

.spot,
.spot-time {
  white-space: nowrap;
}

.spot strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.spot-change {
  font-variant-numeric: tabular-nums;
}

.spot-change[data-direction="up"] {
  color: var(--up);
}

.spot-change[data-direction="down"] {
  color: var(--down);
}

.spot-change[data-direction="up"]::before {
  content: "\25B2\00A0";
  content: "\25B2\00A0" / "";
  font-size: 0.75em;
}

.spot-change[data-direction="down"]::before {
  content: "\25BC\00A0";
  content: "\25BC\00A0" / "";
  font-size: 0.75em;
}

@media (max-width: 40rem) {
  .spot-bar-inner {
    justify-content: center;
  }

  .spot-label {
    display: none;
  }
}

/* Header and footer */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
  text-decoration: none;
}

.site-header nav,
.site-footer nav {
  display: flex;
  gap: 1.75rem;
}

.site-header nav a {
  text-decoration: none;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.site-header nav a:hover {
  border-bottom-color: var(--line);
}

.site-header nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

@media (max-width: 40rem) {
  .site-header-inner {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .site-header nav {
    gap: 1.125rem;
  }
}

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

.site-footer p {
  margin: 0;
}

.footer-contact {
  display: grid;
  gap: 0.25rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

/* Shared pieces */

.lede {
  font-size: 1.1875rem;
  color: var(--muted);
  max-width: 38rem;
  margin: 0;
}

.meta,
.empty {
  color: var(--muted);
  font-size: 0.9375rem;
}

.button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  filter: brightness(1.08);
}

.button-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.button-quiet:hover {
  border-color: var(--muted);
  filter: none;
}

.tag {
  display: inline-block;
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.section {
  padding-top: 3.5rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-bottom: 0.875rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}

.section-head a {
  color: var(--muted);
  font-size: 0.9375rem;
}

.section-head a:hover {
  color: var(--text);
}

.page-head {
  padding: 3rem 0 0.5rem;
  margin-bottom: 1.75rem;
}

.crumbs {
  color: var(--muted);
  font-size: 0.9375rem;
  padding: 1.75rem 0;
}

.crumbs a {
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text);
}

/* Home */

.intro {
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

.intro h1 {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  margin-bottom: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0;
}

/* Photos */

.photo {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

/* Pinned to the square frame so tall (portrait) photos and videos shrink to fit and
   sit centered, instead of stretching the frame's row and getting cut off at the bottom. */
.photo img,
.photo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8%;
}

/* A play button on video thumbnails. */
.photo-video::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.75rem;
  height: 1.75rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4.5v7l5.5-3.5z' fill='white'/%3E%3C/svg%3E")
    center / 70% no-repeat;
  pointer-events: none;
}

.no-photo {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Coin grid */

.coin-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 2rem 1.25rem;
}

@media (max-width: 40rem) {
  .coin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem 1rem;
  }
}

.coin-card a {
  display: block;
  text-decoration: none;
}

.coin-card a:hover .photo {
  border-color: var(--muted);
}

.coin-card a:hover h3 {
  text-decoration: underline;
}

.coin-card h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0.875rem 0 0.25rem;
}

.coin-details {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0;
}

.coin-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin: 0.375rem 0 0;
}

/* Featured coins: a gold edge on the photo (the ring is a shadow so nothing
   changes size) and a "Featured" label on its top edge. Change the word here. */
.coin-grid .coin-card[data-featured] a .photo,
.coin-grid .coin-card[data-featured] a:hover .photo {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.coin-card[data-featured] a {
  position: relative;
}

.coin-card[data-featured] a::before {
  content: "Featured";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The last card in a row of coins on the home page when there are more than fit. */
.more-photo {
  align-content: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.more-count {
  color: var(--text);
  font-family: var(--serif);
  font-size: 2.75rem;
  line-height: 1;
}

.coin-grid .coin-card-more .photo {
  border-style: dashed;
}

/* Gallery deck on the home page */

/* --reach is how many cards show on each side of the front one. The script reads it.
   --spread is the gap between cards, --tilt and --shrink how much each step turns and shrinks. */
.coin-deck {
  --reach: 2;
  --card: min(15rem, 58vw);
  --spread: min(9.5rem, 21vw);
  --tilt: 4deg;
  --shrink: 0.08;
  --drop: 0.5rem;
}

@media (min-width: 48rem) {
  .coin-deck {
    --reach: 3;
    --card: 14rem;
    --spread: 12vw;
    --tilt: 3.5deg;
    --shrink: 0.07;
  }
}

@media (min-width: 72rem) {
  .coin-deck {
    --reach: 4;
    --card: 15rem;
    --spread: min(9.25vw, 10rem);
    --tilt: 3deg;
    --shrink: 0.05;
    --drop: 0.375rem;
  }
}

/* Lets the fan run past the page margins and cuts it off at the edge of the screen. */
.home-gallery {
  overflow-x: clip;
}

/* Before the script runs: a row that scrolls sideways. */
.coin-deck-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.coin-deck-cards > li {
  flex: none;
  width: var(--card);
  scroll-snap-align: start;
}

.coin-deck .coin-card a {
  height: 100%;
  padding: 0.75rem 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.05),
    0 0.75rem 2rem -1rem rgb(0 0 0 / 0.3);
  transition:
    border-color 0.15s ease,
    transform 0.2s ease;
}

.coin-deck .coin-card a:hover {
  border-color: var(--muted);
}

/* Featured coins in the deck: the gold edge goes on the whole card. */
.coin-deck .coin-card[data-featured] a,
.coin-deck .coin-card[data-featured] a:hover {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0.75rem 2rem -1rem rgb(0 0 0 / 0.3);
}

.coin-deck .photo {
  border: 0;
}

.coin-deck .coin-card h3 {
  margin-top: 0.5rem;
}

/* The deck: every card in the same spot, fanned out by its offset from the front card. */
.coin-deck[data-ready] .coin-deck-cards {
  display: grid;
  justify-content: center;
  overflow: visible;
  padding: 1rem 0 2.5rem;
  touch-action: pan-y;
}

.coin-deck[data-ready] .coin-deck-cards > li {
  grid-area: 1 / 1;
  transform-origin: 50% 100%;
  transform: translateX(calc(var(--offset) * var(--spread)))
    translateY(calc(var(--depth) * var(--drop)))
    rotate(calc(var(--offset) * var(--tilt)))
    scale(calc(1 - var(--depth) * var(--shrink)));
  transition:
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.5s ease;
}

.coin-deck[data-ready] [data-away] {
  opacity: 0;
  pointer-events: none;
}

.coin-deck [data-front] a:hover {
  transform: translateY(-0.25rem);
}

.coin-deck-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.coin-deck-controls span {
  min-width: 3.5rem;
  text-align: center;
}

.coin-deck-controls button {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0 0 0.125rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.coin-deck-controls button:hover {
  border-color: var(--muted);
}

.coin-deck-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .coin-deck[data-ready] .coin-deck-cards > li,
  .coin-deck .coin-card a {
    transition: none;
  }
}

/* Post list */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li + li {
  border-top: 1px solid var(--line);
}

.post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem 0;
  text-decoration: none;
}

.post-list li:first-child .post-row {
  padding-top: 0;
}

.post-row:hover h3 {
  text-decoration: underline;
}

.post-row h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 0.375rem;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.post-row .meta {
  margin: 0;
}

.post-summary {
  max-width: 40rem;
  margin: 0.5rem 0 0;
}

.post-photo {
  width: 13rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.post-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 40rem) {
  .post-photo {
    width: 6.5rem;
  }

  .post-row h3 {
    font-size: 1.25rem;
  }
}

/* Coin page */

.coin-layout {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 52rem) {
  .coin-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
    gap: 3.5rem;
  }
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.625rem;
  margin-top: 0.75rem;
}

.gallery-thumbs .photo img,
.gallery-thumbs .photo video {
  padding: 6%;
}

.gallery-thumbs a:hover {
  border-color: var(--muted);
}

.gallery-thumbs a[aria-current="true"] {
  border-color: var(--accent);
}

.coin-info h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.coin-info .coin-price {
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
}

.coin-ask {
  margin: 0 0 1.5rem;
}

.specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  margin: 1.75rem 0 0;
  border-top: 1px solid var(--line);
}

.specs div {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.specs dt {
  color: var(--muted);
  font-size: 0.875rem;
}

.specs dd {
  margin: 0;
  font-weight: 600;
}

.coin-info .prose {
  margin-top: 1.75rem;
}

/* Blog post */

.article {
  max-width: 46rem;
}

.article-head {
  padding-top: 3.5rem;
}

.article-head .meta {
  margin: 0;
}

.article-image {
  width: 100%;
  margin-top: 2rem;
  border-radius: var(--radius);
}

.prose {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.article .prose {
  font-size: 1.125rem;
  margin-top: 2rem;
}

.prose a {
  color: var(--accent);
}

.prose h2,
.prose h3 {
  margin: 2.25rem 0 0.75rem;
}

.prose h3 {
  font-size: 1.25rem;
}

.prose img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

/* Contact page */

.page-head .lede + .lede {
  margin-top: 0.75rem;
}

.contact-list {
  display: grid;
  gap: 0;
  max-width: 32rem;
  margin: 0;
  border-top: 1px solid var(--line);
}

.contact-list div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.contact-list dt {
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Search box on the Shop and Gallery */

.filter {
  margin: 0 0 2rem;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  max-width: 30rem;
}

/* One button per category, under the search box. */
.filter-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.filter-categories .chip {
  padding: 0.375rem 0.875rem;
}

.filter input {
  flex: 1;
  min-width: 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.filter input::placeholder {
  color: var(--muted);
}

.filter input:focus {
  outline: none;
  border-color: var(--accent);
}

/* The Featured button next to the search box. Gold while it's on. */
.chip {
  flex: none;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--muted);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* Contact popup on coin pages */

.contact-dialog {
  width: calc(100% - 2rem);
  max-width: 28rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 0.25);
}

.contact-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.contact-dialog-inner {
  padding: 1.5rem;
}

.contact-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.contact-dialog h2 {
  font-size: 1.5rem;
}

.contact-dialog p {
  margin: 0.5rem 0 1.25rem;
  color: var(--muted);
}

.contact-dialog .contact-list div {
  grid-template-columns: 5rem minmax(0, 1fr);
  padding: 0.75rem 0;
}

.contact-dialog .contact-list div:last-child {
  border-bottom: 0;
}

.contact-dialog dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.contact-dialog-close,
.contact-copy {
  font-family: inherit;
  cursor: pointer;
}

.contact-dialog-close:focus-visible,
.contact-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-dialog-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.5rem 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

.contact-dialog-close:hover {
  color: var(--text);
}

.contact-copy {
  color: inherit;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
}

.contact-copy:hover {
  border-color: var(--muted);
}
