:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #262626;
  --muted: #8e8e8e;
  --border: #dbdbdb;
  --accent: #e1306c;
  --gap: 4px;
  --max-width: 935px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.4;
}

/* Header / profile */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 24px;
}

.profile {
  display: flex;
  align-items: center;
  gap: 24px;
}

.avatar {
  flex: 0 0 auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 52px;
  user-select: none;
}

.profile-name {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
}

.profile-handle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.profile-bio {
  margin: 8px 0 0;
  font-size: 15px;
}

/* Grid */
.grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  background: #efefef;
  border: none;
  padding: 0;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.tile:hover img,
.tile:focus-visible img {
  transform: scale(1.03);
}

.tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.tile-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 14px;
}

.tile:hover .tile-overlay,
.tile:focus-visible .tile-overlay {
  opacity: 1;
}

/* Status / empty state */
.status {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 40px;
  text-align: center;
  color: var(--muted);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-content {
  margin: 0;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  color: #fff;
  max-width: 640px;
  text-align: center;
  font-size: 15px;
  padding: 0 8px;
  white-space: pre-wrap;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  user-select: none;
}

.lightbox-close {
  top: 16px;
  right: 24px;
  font-size: 40px;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  line-height: 1;
  padding: 0 12px;
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* Auto-refresh toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Footer */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 20px 48px;
}

/* Responsive */
@media (max-width: 640px) {
  .site-header {
    padding: 20px 16px;
  }

  .profile {
    gap: 16px;
  }

  .avatar {
    width: 72px;
    height: 72px;
    font-size: 36px;
  }

  .profile-name {
    font-size: 20px;
  }

  .grid {
    gap: 2px;
    padding: 0 2px 24px;
  }

  .lightbox-nav {
    font-size: 40px;
  }
}
