/* ============================================================
   MAIN.CSS — design tokens, reset, typography, header
   ============================================================ */

:root {
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-text-muted: #6b6b6b;
  --color-border: #e5e5e5;
  --color-surface: #f8f8f8;
  --color-hover: #f0f0f0;

  --sidebar-width: 240px;
  --header-height: 56px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  --radius-sm: 2px;
  --radius-md: 4px;

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

img, video {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select {
  font-family: inherit;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #000;
  color: #fff;
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-md);
  height: 100%;
}

.site-logo {
  display: flex;
  align-items: center;
  height: 100%;
}

.site-logo-img {
  height: calc(var(--header-height) - 16px);
  width: auto;
  display: block;
}

.site-tagline {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.03em;
  display: none;
}

@media (min-width: 480px) {
  .site-tagline {
    display: block;
  }
}

.header-filter-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  transition: background var(--transition-fast);
}

.header-filter-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Layout shell ── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  align-items: start;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-md);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.results-count {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sort-select {
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  outline-offset: 2px;
}

.sort-select:focus {
  outline: 2px solid var(--color-text);
}

/* ── Loading / end messages ── */
.loading-indicator {
  display: flex;
  justify-content: center;
  padding: var(--space-xl);
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: dot-pulse 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.end-message,
.empty-message {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ── Scroll sentinel ── */
#scroll-sentinel {
  height: 1px;
  margin-top: -1px;
}

/* ── Enlace al repositorio de fotos (header) ── */
.header-repo-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.header-repo-btn:hover,
.header-repo-btn:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

/* El enlace ya empuja a la derecha; el boton de filtros deja de hacerlo
   para que queden pegados (si no, el espacio libre se reparte entre ambos). */
.header-repo-btn + .header-filter-btn {
  margin-left: 0;
}

/* <480px: solo el icono, igual que el boton de filtros */
@media (max-width: 479px) {
  .header-repo-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .header-repo-btn span {
    display: none;
  }
}
