:root {
  color-scheme: dark;
  --bg: #061021;
  --surface: #0c1930;
  --surface-2: #122443;
  --line: rgba(255, 255, 255, 0.11);
  --text: #f7f9ff;
  --muted: #a9b6ce;
  --accent: #5d8dff;
  --accent-strong: #86a8ff;
  --radius: 1.15rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 95% -10%, rgba(71, 119, 239, 0.28), transparent 34rem),
    linear-gradient(180deg, #08152a 0, var(--bg) 32rem);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  padding: max(1.4rem, env(safe-area-inset-top)) max(1.1rem, env(safe-area-inset-right)) 1.2rem max(1.1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}

.topbar__inner,
main,
footer {
  width: min(100%, 78rem);
  margin-inline: auto;
}

.topbar__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  margin: 0 0 .25rem;
  color: var(--accent-strong);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2.2rem, 8vw, 4.6rem); line-height: .95; letter-spacing: -.055em; }
h2 { margin-bottom: .45rem; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.025em; }

.count {
  display: grid;
  justify-items: end;
  color: var(--muted);
  line-height: 1.05;
}

.count strong { color: var(--text); font-size: 1.6rem; }
.count span { font-size: .84rem; }

main { padding: 1.5rem 1rem 3rem; }

.intro {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.4rem;
}

.intro p { max-width: 42rem; margin-bottom: 0; color: var(--muted); }

.download-all {
  width: min(100%, 28rem);
  min-height: 4.2rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: 1.1rem;
  padding: .75rem 1rem;
  border: 1px solid rgba(134, 168, 255, .55);
  border-radius: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #3d70ee, #6c57d9);
  box-shadow: 0 .8rem 2rem rgba(36, 77, 190, .28);
  text-decoration: none;
}

.download-all__icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  font-size: 1.45rem;
  font-weight: 800;
}

.download-all strong,
.download-all small { display: block; }
.download-all strong { font-size: 1rem; line-height: 1.2; }
.download-all small { margin-top: .2rem; color: rgba(255,255,255,.78); font-size: .82rem; }
.download-all:active { transform: translateY(1px); }

.filters {
  display: flex;
  gap: .55rem;
  overflow-x: auto;
  padding: .1rem .05rem .35rem;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter {
  min-height: 2.8rem;
  flex: 0 0 auto;
  padding: .65rem .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,.04);
  font: inherit;
  font-weight: 700;
}

.filter span { margin-left: .25rem; color: var(--muted); font-size: .84rem; }
.filter.is-active { border-color: transparent; background: var(--text); color: #091328; }
.filter.is-active span { color: #4e5a70; }

.gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(255,255,255,.05), transparent 35%), var(--surface);
  box-shadow: 0 1rem 2.8rem rgba(0,0,0,.18);
}

.media-card[hidden] { display: none; }

.media-frame {
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  background: #020712;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020712;
}

.media-frame--photo { cursor: zoom-in; }
.media-frame--photo img { object-fit: cover; transition: transform .25s ease; }
.media-frame--photo:active img { transform: scale(.985); }

.media-body { padding: .9rem; }

.media-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.media-title { margin: 0; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.media-size { flex: 0 0 auto; color: var(--muted); font-size: .82rem; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.button {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  color: var(--text);
  background: var(--surface-2);
  font-size: .95rem;
  font-weight: 760;
  text-align: center;
  text-decoration: none;
}

.button--primary { border-color: transparent; background: var(--accent); color: #fff; }
.button--light { border-color: transparent; background: #fff; color: #0a1530; }

.button:focus-visible,
.download-all:focus-visible,
.filter:focus-visible,
.viewer__close:focus-visible,
.media-frame:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border: 0;
  color: var(--text);
  background: rgba(2, 7, 18, .96);
}

.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: .8rem; }
.viewer::backdrop { background: rgba(0,0,0,.86); }

.viewer__close {
  width: 3rem;
  height: 3rem;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.1);
  font-size: 2rem;
  line-height: 1;
}

.viewer__image { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.viewer__footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.viewer__title { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

footer {
  padding: 0 1rem max(2rem, env(safe-area-inset-bottom));
  color: var(--muted);
  text-align: center;
}

@media (min-width: 42rem) {
  .topbar { padding-inline: 1.5rem; }
  main { padding-inline: 1.5rem; }
  .intro { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 70rem) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .media-frame--photo img { transition: none; }
}
