:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111318;
  color: #f4f4f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #a1a1aa;
  --line: #2d3038;
  --accent: #edbd62;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -20%, rgb(237 189 98 / 10%), transparent 52%),
    #111318;
}

button,
select {
  font: inherit;
}

.archive {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 88px;
}

.page-header {
  margin-bottom: 38px;
}

.page-header .eyebrow,
.page-header h1,
.page-header .intro {
  animation: archive-intro-in 650ms ease-out both;
}

.page-header h1 {
  animation-delay: 100ms;
}

.page-header .intro {
  animation-delay: 200ms;
}

@keyframes archive-intro-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-header .eyebrow,
  .page-header h1,
  .page-header .intro {
    animation: none;
  }
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(2.15rem, 5vw, 3.5rem);
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.intro {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.interface-language-label {
  display: grid;
  width: min(250px, 100%);
  gap: 8px;
  margin-top: 24px;
  color: #d4d4d8;
  font-size: 0.82rem;
  font-weight: 650;
}

.interface-language-label select {
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid #3a3d46;
  border-radius: 8px;
  background: #111318;
  color: #f4f4f5;
}

.primary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #56503f;
  border-radius: 8px;
  background: #29261f;
  color: #f5dfb5;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button:hover {
  border-color: var(--accent);
  background: #332e23;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.archive-navigation {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #191b21;
}

.account-bar p {
  margin: 0;
  color: var(--muted);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkout-form {
  display: grid;
  gap: 16px;
}

.checkout-form label {
  display: grid;
  gap: 7px;
  color: #d4d4d8;
  font-size: 0.9rem;
  font-weight: 650;
}

.checkout-form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #3a3d46;
  border-radius: 8px;
  background: #111318;
  color: #f4f4f5;
  font: inherit;
}

.checkout-message {
  margin: 0;
  color: #f3b5a8;
  line-height: 1.5;
}

.checkout-note {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

#paypal-buttons:empty {
  display: none;
}

.archive-view-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.filters {
  display: flex;
  align-items: end;
  gap: 16px;
  margin-bottom: 26px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #191b21;
}

.filters label {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: #d4d4d8;
  font-size: 0.82rem;
  font-weight: 650;
}

.filters select {
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid #3a3d46;
  border-radius: 8px;
  background: #111318;
  color: #f4f4f5;
}

.result-count {
  margin: 0 0 11px auto;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.archive-card {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #191b21;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.archive-card:hover {
  transform: translateY(-3px);
  border-color: #69604d;
  box-shadow: 0 12px 30px rgb(0 0 0 / 22%);
}

.archive-card:focus-visible,
.dialog-close:focus-visible,
.filters select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.card-artwork {
  position: relative;
  display: block;
  aspect-ratio: 1.47;
  overflow: hidden;
  background: #252831;
}

.gallery-thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-preview {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 900px);
  margin: 0 auto;
  object-fit: contain;
}

.gallery-document-preview {
  width: 100%;
  height: min(72vh, 900px);
}

.gallery-load-more {
  grid-column: 1 / -1;
  justify-self: center;
}

.cover {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 24px;
  text-align: center;
}

.cover-oxford {
  align-items: flex-start;
  justify-content: flex-end;
  background:
    linear-gradient(145deg, transparent 46%, rgb(237 189 98 / 12%) 46.2%, transparent 46.7%),
    #090a0c;
  color: #f7f7f5;
  text-align: left;
}

.cover-kicker,
.cover-label {
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.17em;
}

.cover-title {
  max-width: 17ch;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 750;
  line-height: 1.12;
}

.cover-icon {
  color: var(--accent);
  font-size: 2.9rem;
  line-height: 1;
}

.cover-monkeys {
  background: linear-gradient(145deg, #343229, #191b1c 70%);
}

.cover-report {
  background: linear-gradient(145deg, #273139, #171b21 72%);
}

.cover-video {
  background: linear-gradient(145deg, #322b32, #191a20 72%);
}

.cover-gallery {
  background: linear-gradient(145deg, #30352d, #191c1b 72%);
}

.cover-large {
  width: min(100%, 320px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.language-badge,
.type-badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 999px;
  background: rgb(12 13 16 / 83%);
  color: #fff;
  font-size: 0.71rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.language-badge {
  top: 12px;
  right: 12px;
}

.type-badge {
  bottom: 12px;
  left: 12px;
  color: #e4e4e7;
}

.card-content {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  color: #f4f4f5;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-author {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-format {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 650;
}

.card-availability {
  color: #a8d8ae;
  font-size: 0.72rem;
}

.card-availability.unavailable {
  color: var(--muted);
}

.empty-state {
  padding: 52px 20px;
  color: var(--muted);
  text-align: center;
}

.item-dialog {
  position: fixed;
  width: min(760px, calc(100% - 32px));
  max-width: none;
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 32px;
  border: 1px solid #3a3d46;
  border-radius: 16px;
  background: #191b21;
  color: #f4f4f5;
}

.item-dialog::backdrop {
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #111318;
  color: #f4f4f5;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-title {
  max-width: calc(100% - 44px);
  margin: 0 0 24px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
}

.dialog-details {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) 1.1fr;
  align-items: start;
  gap: 28px;
}

.dialog-information {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 12px;
  padding-top: 4px;
}

.dialog-information .language-badge {
  position: static;
}

.dialog-type,
.dialog-author,
.dialog-description {
  margin: 0;
  color: #d4d4d8;
  line-height: 1.5;
}

.dialog-type {
  color: var(--accent);
  font-weight: 650;
}

.availability-note {
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid #494238;
  border-radius: 8px;
  color: #e7d8bd;
  font-size: 0.9rem;
  line-height: 1.45;
}

.dialog-information audio {
  width: 100%;
  margin-top: 8px;
}

.media-player {
  width: 100%;
  max-height: 390px;
  margin-top: 8px;
  border-radius: 8px;
  background: #090a0c;
}

.document-preview {
  width: 100%;
  height: min(60vh, 700px);
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 640px) {
  .account-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .archive {
    width: min(100% - 28px, 520px);
    padding: 44px 0 60px;
  }

  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .filters label {
    min-width: 0;
  }

  .result-count {
    margin: 0;
  }

  .archive-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
  }

  .card-artwork {
    aspect-ratio: 1.15;
  }

  .card-content {
    min-height: 145px;
    padding: 12px;
  }

  .item-dialog {
    padding: 26px 20px;
  }

  .dialog-details {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .mapping-row {
    grid-template-columns: 1fr auto;
  }

  .mapping-details,
  .mapping-input-label {
    grid-column: 1 / -1;
  }

  .cover-large {
    width: min(100%, 260px);
  }
}
