:root {
  color-scheme: dark;
  font-family: "Diatype Semi-Mono Variable", Arial, Helvetica, sans-serif;
  background: #1886fc;
  color: #fff;
}

@font-face {
  font-family: "Diatype Semi-Mono Variable";
  src: url("https://type.cargo.site/files/Cargo-DiatypePlusVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
}

@font-face {
  font-family: "Repro Variable";
  src: url("https://type.cargo.site/files/CargoReproVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; margin: 0; overflow: hidden; }

body {
  background-color: #1886fc;
  background-image: url("background.jpg");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 120%;
  background-attachment: fixed;
}

.site-shell { width: 100%; height: 100svh; min-height: 100svh; }
main { width: 100%; height: 100%; }

.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 0 1rem clamp(2.5rem, 9vh, 7rem);
}
.gate[hidden], .gallery[hidden] { display: none; }

.password-form { width: min(22rem, 100%); }
.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; }
.password-row { display: flex; width: 100%; border: 1px solid rgba(255, 255, 255, 0.8); background: rgba(0, 0, 0, 0.84); }
input, button { min-height: 3rem; border: 0; border-radius: 0; font: inherit; }
input { min-width: 0; flex: 1; padding: 0 0.9rem; outline: 0; color: #fff; background: transparent; font-size: 0.72rem; letter-spacing: 0.12em; }
input::placeholder { color: rgba(255, 255, 255, 0.8); opacity: 1; }
button { width: 3.2rem; padding: 0; color: #050505; background: #fff; cursor: pointer; font-size: 1.2rem; line-height: 1; }
button:hover { background: #d9d9d9; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 0.25rem; }
.form-message { min-height: 1.1rem; margin: 0.6rem 0 0; color: #fff; font-size: 0.7rem; text-align: center; }

.gallery { height: 100svh; min-height: 100svh; overflow: auto; background: transparent; }
.collage { position: sticky; top: 0; width: 100%; height: 100svh; min-height: 100svh; perspective: 1200px; perspective-origin: 50% 50%; transform-style: preserve-3d; }
.gallery::after { display: block; height: 80svh; content: ""; }
.tag-ring { position: absolute; inset: 0; z-index: 3; pointer-events: none; --tag-distance: -48vmin; }
.tag-bubble { position: absolute; top: 50%; left: 50%; display: grid; width: max-content; min-width: 0.5rem; min-height: 0.5rem; padding: 0.08rem 0.45rem; place-items: center; border: 0; border-radius: 999px; color: #000; background: #fff; cursor: pointer; font-size: 0.81rem; letter-spacing: normal; pointer-events: auto; white-space: nowrap; transform: translate(calc(-50% + var(--tag-x, 0vmin)), calc(-50% + var(--tag-y, 0vmin))) rotate(var(--tag-angle, 0deg)); }
.tag-bubble.is-filter-active { border: 1px solid #000; color: #fff; background: #1886fc; }
.tag-bubble.tag-no-tag { color: #fff; background: #777; }
.tag-bubble.tag-no-tag.is-filter-active { color: #fff; background: #777; }
.tag-bubble:focus-visible { outline: 2px solid #000; outline-offset: 0.2rem; }
.tag-add { font: inherit; }
.collage-card { position: absolute; top: 50%; left: 50%; z-index: 1; width: min(22vw, 18rem); margin: 0; border: 1px solid #c8c8c8; opacity: 1; cursor: pointer; transform: translate3d(calc(-50% + var(--x, 0vw)), calc(-50% + var(--y, 0vh)), var(--z, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotateZ(var(--rz, 0deg)) scale(var(--scale, 1)); transform-style: preserve-3d; will-change: transform, opacity; }
.media-card-visual { display: block; width: 100%; height: auto; object-fit: cover; }
.collage-card:focus-visible { outline: 2px solid #fff; outline-offset: 0.4rem; }
.gallery.is-modal-open { overflow: hidden; }
.media-modal[hidden] { display: none; }
.media-modal { position: fixed; inset: 0; z-index: 20; padding: clamp(1rem, 3vw, 3rem); color: #fff; background: rgba(0, 0, 0, 0.72); }
.media-modal-scrim { position: absolute; inset: 0; }
.media-modal-shell { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(12rem, 25vw) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: clamp(1rem, 3vw, 3rem); width: 100%; height: 100%; }
.media-modal-tags { align-self: center; min-width: 0; max-height: 100%; overflow: auto; }
.media-modal-hint { margin: 0 0 0.8rem; color: rgba(255, 255, 255, 0.72); font-size: 1.24rem; line-height: 1.25; }
.media-tag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 0.5rem; align-content: start; align-items: start; }
.media-tag-column { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.media-tag { display: inline-flex; width: fit-content; max-width: 100%; min-width: 0.5rem; min-height: 0.5rem; margin: 0; padding: 0.16rem 0.9rem; align-items: center; justify-content: center; overflow-wrap: anywhere; color: #000; background: #fff; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-size: 1.08rem; line-height: 1.15; text-align: center; white-space: normal; }
.media-tag:hover { background: #fff; }
.media-tag.is-selected { border: 1px solid #000; color: #fff; background: #1886fc; }
.media-tag.is-selected:hover { background: #1886fc; }
.media-tag:focus-visible { outline: 2px solid #fff; outline-offset: 0.2rem; }
.media-tag-add { margin: 0 0 0.8rem; }
.media-modal-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; align-items: center; justify-items: center; }
.media-modal-preview { position: relative; width: 100%; height: 100%; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; background: #0b0b0b; transform-origin: center; }
.media-modal-visual { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.media-modal-preview .placeholder-art { width: 100%; height: 100%; aspect-ratio: auto; }
.media-modal-close { position: absolute; top: 0; right: 0; z-index: 2; width: 2.4rem; min-height: 2.4rem; font-size: 1.5rem; }
.placeholder-art { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #c2b5a0, #4b4239 44%, #161513 45%, #817365); filter: grayscale(0.55); }
.card-tall .placeholder-art { aspect-ratio: 3 / 4; background: linear-gradient(160deg, #25221e, #897863 48%, #c7bba8 49%, #3a332d); }
.card-small .placeholder-art { aspect-ratio: 1; background: linear-gradient(45deg, #151513 35%, #777064 36%, #b6aa96 70%, #282521 71%); }

@media (max-width: 700px) {
  body { background-position: 70% bottom; background-size: auto 100%; }
  .collage { height: 100svh; min-height: 100svh; }
  .gallery::after { height: 65svh; }
  .tag-ring { --tag-distance: -58vmin; }
  .tag-bubble { width: max-content; min-width: 0.5rem; min-height: 0.5rem; padding: 0.06rem 0.3rem; font-size: 0.6rem; }
  .collage-card { width: min(34vw, 13rem); }
  .media-modal { padding: 0.75rem; }
  .media-modal-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 0.65rem; }
  .media-modal-tags { align-self: stretch; max-height: 22.5vh; }
  .media-modal-hint { margin-bottom: 0.45rem; font-size: 1.04rem; }
  .media-tag-grid { grid-template-columns: 1fr; gap: 0.2rem; }
  .media-tag-column { gap: 0.2rem; }
  .media-tag { padding: 0.12rem 0.6rem; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .gallery { animation: reveal 500ms ease both; }
  @keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
}
