:root {
  --bg: #eaf1f8;
  --panel: #ffffff;
  --accent: #1f70e2;
  --shadow: 0 16px 38px rgba(11, 30, 51, 0.18);
  --text: #0b1e33;
  --muted: #5f6e7d;
  --tile: #f6f8fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 110% at 25% 20%, #f5f8fd 0%, #e9eff8 50%, #dce6f3 100%);
  color: var(--text);
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

.toolbar {
  display: none;
}

.toolbar h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: 0.3px;
}

.date-range {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

select {
  background: #eef3f9;
  color: var(--text);
  border: 1px solid #cfd8e4;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

main {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  padding: 14px 16px 28px;
}

.gallery-wrapper {
  position: relative;
  height: 100%;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid #dce5ef;
  box-shadow: 0 26px 60px rgba(14, 34, 57, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: auto;
  cursor: grab;
  scroll-behavior: auto;
  touch-action: none;
  overscroll-behavior: contain;
}

.gallery-wrapper.dragging {
  cursor: grabbing;
  user-select: none;
}

.gallery-wrapper::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.gallery-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.gallery-wrapper::-webkit-scrollbar-thumb {
  background: #c2cede;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.gallery {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  grid-auto-rows: 150px;
  gap: 10px;
  min-height: 100%;
  padding: 22px;
  align-content: start;
}

.photo-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--tile);
  border: 1px solid #e3e9f2;
  box-shadow: 0 12px 22px rgba(27, 60, 97, 0.12);
  transition: transform 120ms ease, box-shadow 120ms ease;
  transform-origin: center;
  content-visibility: auto;
  contain-intrinsic-size: 190px 150px;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-card .clip {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.photo-card:hover,
.photo-card:focus-visible {
  z-index: 20;
  transform: translateY(-6px) scale(1.08);
  box-shadow: var(--shadow);
}

.photo-card:focus-within {
  outline: 2px solid var(--accent);
}

.photo-card .meta {
  display: none;
}

.photo-card.hidden {
  opacity: 0.12;
  pointer-events: none;
}

.gallery-wrapper.dragging .photo-card {
  transition: none;
}

.hint {
  position: sticky;
  bottom: 14px;
  left: 0;
  text-align: right;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(238, 243, 249, 0.85);
  border-radius: 12px;
  border: 1px solid #dce5ef;
  pointer-events: none;
  width: fit-content;
  float: right;
  margin-right: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 140px;
  }
}
