:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --bg-soft: #eef5fb;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #263744;
  --muted: #6f8190;
  --line: #d8e5ef;
  --line-soft: #e8f0f6;
  --blue: #5f98c7;
  --blue-strong: #3f7fb6;
  --blue-soft: #e4f1fb;
  --shadow: rgba(67, 105, 133, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(189, 220, 242, 0.52), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 42%, #f7fafc 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
.secondary-link {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
  border-color: #c4d9e8;
  box-shadow: 0 8px 20px var(--shadow);
}

.site-header,
.date-gate-inner,
main {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
}

.date-gate {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 42px 0;
}

.date-gate-inner {
  padding-bottom: 8vh;
}

.date-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.date-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px;
  border-color: rgba(202, 221, 235, 0.92);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 253, 0.9)),
    var(--panel);
  box-shadow: 0 14px 34px rgba(80, 116, 143, 0.1);
  text-align: left;
}

.date-card:hover {
  border-color: #9fc6e3;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 245, 252, 0.96)),
    var(--panel);
}

.date-card strong {
  color: #213443;
  font-size: 28px;
  font-weight: 760;
}

.date-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.date-card-kicker {
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 720;
}

.date-card-all {
  background:
    linear-gradient(180deg, rgba(236, 246, 253, 0.98), rgba(255, 255, 255, 0.9)),
    var(--panel);
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-strong);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  color: #213443;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 760;
}

.summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.header-actions,
.toolbar,
.toolbar-actions,
.preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

select,
input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
}

select {
  padding: 0 36px 0 12px;
}

input {
  width: min(360px, 100%);
  padding: 0 14px;
}

input:focus,
select:focus {
  border-color: #9fc6e3;
  box-shadow: 0 0 0 4px rgba(117, 169, 209, 0.16);
}

.primary-button {
  height: 42px;
  padding: 0 16px;
  border-color: transparent;
  background: linear-gradient(180deg, #6ca5d0, #4f8fc2);
  color: white;
  font-weight: 700;
}

.primary-button:disabled {
  opacity: 0.48;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.toolbar {
  position: sticky;
  z-index: 10;
  top: 0;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(250, 253, 255, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 34px rgba(82, 119, 145, 0.08);
}

.search-wrap {
  min-width: 220px;
}

.toolbar button,
.secondary-link {
  height: 38px;
  padding: 0 13px;
  color: #385468;
}

.selected-text {
  min-width: 120px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.gallery {
  column-count: 4;
  column-gap: 18px;
  padding-bottom: 56px;
}

.photo-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid rgba(216, 229, 239, 0.9);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(69, 105, 132, 0.1);
  break-inside: avoid;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--blue-soft);
}

.image-button:hover {
  transform: none;
  box-shadow: none;
}

.image-button img {
  display: block;
  width: 100%;
  height: auto;
}

.select-chip {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
}

.select-chip::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid #7c9caf;
  border-radius: 999px;
}

.photo-card.selected {
  border-color: #84b7dc;
  box-shadow: 0 16px 36px rgba(72, 134, 182, 0.18);
}

.photo-card.selected .select-chip {
  border-color: transparent;
  background: var(--blue-strong);
}

.photo-card.selected .select-chip::after {
  inset: 9px 8px 10px;
  width: 13px;
  height: 7px;
  border: 0;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  border-radius: 0;
  transform: rotate(-45deg);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 11px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
}

.preview-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid rgba(216, 229, 239, 0.86);
  border-radius: 18px;
  background: #fbfdff;
  box-shadow: 0 24px 70px rgba(52, 83, 107, 0.28);
}

.preview-dialog::backdrop {
  background: rgba(37, 58, 73, 0.42);
}

.preview-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 28px);
}

.preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.88);
}

.preview-title {
  color: #203240;
  font-weight: 720;
}

.preview-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 38px;
  padding: 0;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

#previewImage {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 112px);
  margin: auto;
  object-fit: contain;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: 0 14px 34px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .gallery {
    column-count: 3;
  }
}

@media (max-width: 760px) {
  .site-header,
  .date-gate-inner,
  main {
    width: min(100% - 24px, 1380px);
  }

  .site-header,
  .toolbar,
  .preview-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .toolbar-actions {
    justify-content: stretch;
  }

  .header-actions > *,
  .toolbar-actions > *,
  input {
    flex: 1 1 auto;
    width: 100%;
  }

  .selected-text {
    text-align: left;
  }

  .gallery {
    column-count: 2;
    column-gap: 12px;
  }

  .photo-card {
    margin-bottom: 12px;
    border-radius: 12px;
  }
}

@media (max-width: 460px) {
  .gallery {
    column-count: 1;
  }
}
