:root {
  --bg: #0f172a;
  --bg-soft: #020617;
  --card-bg: #020617;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #1f2937;
  --danger: #f97373;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
  --transition-fast: 0.18s ease-out;
  --transition-normal: 0.25s ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at 0 0, #1e293b 0, #020617 55%, #000 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* HEADER */

.header {
  padding: 24px clamp(16px, 4vw, 40px) 8px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.header__title {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: 0.02em;
}

.header__subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.header__subtitle code {
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
}

/* TOOLBAR */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar__input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast);
}

.toolbar__input::placeholder {
  color: var(--text-muted);
}

.toolbar__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
  background: #020617;
}

/* BUTTONS */

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  color: #0b1120;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.35);
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), filter var(--transition-fast),
    background-position 0.28s ease-out;
  background-size: 150% 150%;
  background-position: 0 50%;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  background-position: 100% 50%;
  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.5);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.9);
}

.btn--secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.8);
}

.btn--secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: var(--accent);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.95);
}

/* MAIN / GALLERY */

.main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 8px clamp(16px, 4vw, 40px) 24px;
}

.status {
  margin: 8px 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  backdrop-filter: blur(10px);
}

.status--hidden {
  display: none;
}

.status--loading::before {
  content: "⏳ ";
}

.status--error {
  border-color: rgba(248, 113, 113, 0.7);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.8);
}

.status--empty {
  border-style: dashed;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

/* CARD */

.card {
  position: relative;
  background: radial-gradient(circle at top left, #1e293b 0, #020617 60%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal), border-color var(--transition-fast);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 1);
  border-color: rgba(56, 189, 248, 0.6);
}

.card__image-wrapper {
  position: relative;
  padding-top: 65%;
  overflow: hidden;
}

.card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease-out;
}

.card:hover .card__image {
  transform: scale(1.08);
}

.card__gradient {
  position: absolute;
  inset: auto 0 0;
  height: 60%;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.95), transparent);
  pointer-events: none;
}

.card__body {
  padding: 12px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card__author {
  margin: 0;
  font-weight: 500;
}

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

.card__actions {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card__btn {
  padding: 6px 10px;
  font-size: 12px;
}

/* LOAD MORE */

.load-more {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

/* MODAL */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal--hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  max-width: 900px;
  width: 100%;
  background: radial-gradient(circle at top left, #1f2937 0, #020617 60%);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 16px 16px 14px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.95);
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  animation: modalIn 0.22s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__image {
  width: 100%;
  max-height: min(70vh, 520px);
  object-fit: contain;
  border-radius: 14px;
  background: #020617;
}

.modal__meta {
  font-size: 14px;
  color: var(--text-muted);
  align-self: center;
}

.modal__meta p {
  margin: 0 0 8px;
}

.modal__meta a {
  color: var(--accent);
  text-decoration: none;
}

.modal__meta a:hover {
  text-decoration: underline;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.modal__close:hover {
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
}

/* FOOTER */

.footer {
  text-align: center;
  font-size: 12px;
  padding: 10px 16px 16px;
  color: var(--text-muted);
}

/* RESPONSIVE */

@media (max-width: 720px) {
  .modal__dialog {
    grid-template-columns: 1fr;
  }
}
