:root {
  --bg: #000;
  --fg: #fff;
  --space: 6rem;
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space) 16px;
}

@media (min-width: 720px) {
  main {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-width: 719px) {
  :root {
    --space: 4rem;
  }
}

/* Type */

h1,
h2,
h3 {
  font-weight: 300;
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h1 s {
  opacity: 0.35;
  text-decoration-thickness: 0.06em;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

h3 {
  font-size: 1rem;
  letter-spacing: 0.04em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

button {
  background: none;
  border: 0;
  border-radius: 0;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
button:focus-visible {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

/* Opening */

.opening {
  margin-bottom: var(--space);
}

.logo {
  display: block;
  width: 160px;
  height: 160px;
  margin-bottom: 2rem;
}

.opening p {
  margin-top: 1.5rem;
  max-width: 40rem;
  font-size: 1.125rem;
}

.opening p:empty {
  display: none;
}

/* Receipts */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.thumb {
  display: block;
  position: relative;
  width: 100%;
}

.thumb:hover {
  text-decoration: none;
}

.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: top;
  background: #111;
}

.thumb:hover img {
  opacity: 0.8;
}

.badge {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0 0.5rem;
  background: var(--bg);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  line-height: 1.6;
}

.empty {
  max-width: 40rem;
  padding: 3rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1.25rem;
  font-style: italic;
}

/* Share */

.share {
  margin-top: var(--space);
  max-width: 40rem;
}

.share p {
  margin-bottom: 1rem;
}

#share-link {
  letter-spacing: 0.08em;
  text-decoration: underline;
}

footer {
  margin-top: var(--space);
  max-width: 40rem;
  font-size: 0.875rem;
  opacity: 0.6;
}

footer:empty {
  display: none;
}

/* Viewer */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0 0.5rem;
  background: var(--bg);
  color: var(--fg);
}

.viewer .stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer .stage img,
.viewer .stage video {
  display: block;
  max-width: 100vw;
  max-height: 85vh;
  max-height: min(85vh, calc(100dvh - 9rem));
  object-fit: contain;
}

.viewer .caption {
  margin: 1rem 1rem 0.25rem;
  max-width: 40rem;
  min-height: 1.6em;
  font-size: 0.875rem;
  text-align: center;
}

.viewer .save {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
}

.viewer .close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  z-index: 3;
  padding: 0 0.75rem;
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 200;
}

.viewer .close:hover,
.viewer .close:focus-visible {
  text-decoration: none;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0.5rem 1rem;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 200;
}

.arrow:hover,
.arrow:focus-visible {
  text-decoration: none;
}

.arrow.prev {
  left: 0;
}

.arrow.next {
  right: 0;
}

@media (max-width: 719px) {
  .arrow {
    padding: 0.5rem 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
