/* ============================================================
   RENDER — Apple Liquid Glass Design System
   Sleek, translucent, heavy blur, Vision Pro inspired
============================================================ */

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

:root {
  /* Apple-esque Dark Theme with Liquid Glass feel */
  --bg: #000000;
  --bg-2: #0a0a0a;
  
  /* Glassmorphism Tokens */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-light: rgba(255, 255, 255, 0.08);
  
  /* Heavy Blur & Saturation for the "Liquid" Apple effect */
  --liquid-blur: blur(40px) saturate(200%);
  --liquid-blur-sm: blur(20px) saturate(150%);

  /* Typography */
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.6);
  --text-3: rgba(255, 255, 255, 0.4);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; /* Dropping Outfit for Apple feel */

  /* Radii - Apple uses very continuous, squircle-like curves */
  --radius: 18px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-xl: 36px;
  --radius-pill: 999px;

  /* Shadows - deep, soft */
  --shadow-soft: 0 10px 40px rgba(0,0,0,0.3);
  --shadow-glass: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);

  --nav-h: 72px;
  --transition: 0.3s cubic-bezier(0.25, 1, 0.5, 1); /* Apple-like ease-out */
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   NAVBAR (Liquid Glass)
============================================================ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  padding: 0 2rem;
  transition: all var(--transition);
  border-bottom: 1px solid transparent;
  background: transparent;
}
#navbar.scrolled {
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border-bottom: 1px solid var(--glass-border-light);
}
.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%; max-width: 1600px; margin: 0 auto;
}
.nav-logo {
  display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.nav-logo:hover { opacity: 0.8; }
.logo-icon { font-size: 1.5rem; color: #fff; }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em; }

/* Search Bar in Nav */
.nav-search { width: 480px; margin: 0 2rem; }
.search-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(255,255,255,0.06); 
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-pill); 
  padding: 0.4rem 0.5rem 0.4rem 1.2rem;
  transition: all var(--transition);
}
.search-wrap:focus-within { 
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2); 
  box-shadow: 0 0 0 4px rgba(255,255,255,0.05); 
}
.search-icon { color: var(--text-2); flex-shrink: 0; }
.search-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 0.95rem; font-weight: 400;
}
.search-wrap input::placeholder { color: var(--text-3); }
.btn-search-submit {
  background: rgba(255,255,255,0.1); color: #fff;
  border-radius: var(--radius-pill); padding: 0.4rem 1.2rem;
  font-size: 0.85rem; font-weight: 500;
  backdrop-filter: blur(10px);
  transition: background var(--transition);
}
.btn-search-submit:hover { background: rgba(255,255,255,0.2); }

.nav-actions { display: flex; justify-content: flex-end; }
.nav-credit {
  color: var(--text-2); font-size: 0.85rem; font-weight: 500;
  transition: color var(--transition);
}
.nav-credit:hover { color: #fff; }

/* ============================================================
   HERO (Liquid Orbs & Glass)
============================================================ */
#hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 8rem 2rem 4rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background: #000;
}
.hero-video {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.7; /* Slight opacity so it blends nicely with the dark theme */
}
.hero-video-overlay {
  position: absolute; inset: 0;
  /* Cinematic vignette: deep black at top and bottom for readability and mood */
  background: linear-gradient(
    to bottom, 
    rgba(0,0,0,0.85) 0%, 
    rgba(0,0,0,0.2) 20%, 
    rgba(0,0,0,0.2) 80%, 
    rgba(0,0,0,0.95) 100%
  );
}

.hero-content {
  position: relative; z-index: 1;
  max-width: 800px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 1.75rem;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--glass-bg); 
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--liquid-blur-sm);
  -webkit-backdrop-filter: var(--liquid-blur-sm);
  border-radius: var(--radius-pill); padding: 0.4rem 1.2rem;
  font-size: 0.85rem; font-weight: 500; color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34c759; /* Apple Green */
  box-shadow: 0 0 10px rgba(52, 199, 89, 0.5);
}

.hero-title {
  font-family: var(--font-display); 
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.04em;
}
.hero-gradient {
  /* No color gradient, just pure white text for Apple feel, maybe a slight transparency */
  color: #fff;
}
.hero-subtitle { 
  font-size: 1.2rem; font-weight: 400; color: var(--text-2); 
  max-width: 600px; line-height: 1.5; letter-spacing: -0.01em;
}

/* Hero Search - Liquid Glass style */
.hero-search-wrap { width: 100%; max-width: 640px; margin-top: 1rem; }
.hero-search-inner {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(255,255,255,0.05); 
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  box-shadow: var(--shadow-glass);
  transition: all var(--transition);
}
.hero-search-inner:focus-within {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 4px rgba(255,255,255,0.05);
}
.hero-search-inner svg { color: var(--text-2); flex-shrink: 0; }
.hero-search-inner input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 1.1rem; font-weight: 400;
}
.hero-search-inner input::placeholder { color: var(--text-3); }
.hero-search-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: #ffffff; color: #000000;
  border-radius: var(--radius-pill); padding: 0.8rem 1.6rem;
  font-size: 1rem; font-weight: 600; flex-shrink: 0;
  transition: all var(--transition);
}
.hero-search-btn:hover { background: #e0e0e0; transform: scale(0.98); }

/* Hero Stats - Refined */
.hero-stats {
  display: flex; align-items: center; gap: 3rem;
  margin-top: 2rem;
  padding: 1.5rem 3rem;
  background: var(--glass-bg);
  backdrop-filter: var(--liquid-blur-sm);
  -webkit-backdrop-filter: var(--liquid-blur-sm);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border-light);
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.stat-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.stat-label { font-size: 0.85rem; font-weight: 500; color: var(--text-2); }
.stat-divider { width: 1px; height: 40px; background: rgba(255,255,255,0.1); }

/* Hero scroll hint */
.hero-scroll-hint {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: var(--text-3); font-size: 0.85rem; font-weight: 500;
  animation: scrollFade 2.5s ease-in-out infinite;
  z-index: 1;
}
@keyframes scrollFade { 
  0%, 100% { opacity: 0.4; transform: translate(-50%, 0); } 
  50% { opacity: 1; transform: translate(-50%, 4px); } 
}

/* ============================================================
   CATEGORY BAR (Glass Filter)
============================================================ */
.category-bar {
  position: sticky; top: var(--nav-h); z-index: 80;
  background: rgba(0, 0, 0, 0.4); 
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border-bottom: 1px solid var(--glass-border-light);
  padding: 0.8rem 2rem;
}
.category-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.5rem;
  overflow-x: auto; scrollbar-width: none;
  /* Prevent right edge chip clipping on mobile */
  padding-right: 1rem;
}
.category-inner::-webkit-scrollbar { display: none; }
.category-label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); white-space: nowrap; flex-shrink: 0; }
.category-chips { display: flex; gap: 0.5rem; }
.category-chip {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-pill); padding: 0.5rem 1rem;
  font-size: 0.9rem; font-weight: 500; color: var(--text-2);
  white-space: nowrap; flex-shrink: 0;
  transition: all var(--transition);
}
.category-chip:hover { background: rgba(255,255,255,0.1); color: #fff; }
.category-chip.active { 
  background: #fff; color: #000; border-color: #fff;
  font-weight: 600;
}

/* ============================================================
   RESULTS HEADER
============================================================ */
.results-header {
  max-width: 1600px; margin: 0 auto;
  padding: 2rem 2rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.results-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.results-count { font-size: 0.95rem; font-weight: 400; color: var(--text-2); margin-top: 0.25rem; }

/* ============================================================
   ERROR BANNER
============================================================ */
.error-banner {
  max-width: 1600px; margin: 0 auto 1.5rem;
  padding: 1rem 2rem;
  display: flex; align-items: center; gap: 1rem;
  background: rgba(255, 59, 48, 0.15); /* Apple Red */
  border: 1px solid rgba(255, 59, 48, 0.3);
  backdrop-filter: var(--liquid-blur-sm);
  border-radius: var(--radius-lg); color: #ff453a;
  font-size: 0.95rem; font-weight: 500;
  margin-left: 2rem; margin-right: 2rem;
}
.error-banner.hidden { display: none; }

/* ============================================================
   GALLERY GRID
============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  padding: 1rem 2rem 4rem;
  max-width: 1600px; margin: 0 auto;
}

/* ============================================================
   PHOTO CARD (Apple Glass Style)
============================================================ */
.photo-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg); 
  height: 320px; /* Fixed height for clean horizontal loading */
  cursor: pointer;
  background: var(--bg-2);
  /* Inner shadow for glass edge effect */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: all var(--transition);
  transform: translateZ(0); /* Hardware accel */
}
.photo-card:hover { 
  transform: translateY(-6px) scale(1.01); 
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(255,255,255,0.15); 
}
.photo-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.photo-card:hover .photo-img { transform: scale(1.05); }

/* Overlay - Frosted Glass panel */
.photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
  opacity: 0; transition: opacity var(--transition);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0.75rem; /* Reduced so content has room on small screens */
}
.photo-card:hover .photo-overlay { opacity: 1; }

.photo-info { 
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; 
  background: rgba(20, 20, 20, 0.5);
  backdrop-filter: var(--liquid-blur-sm);
  -webkit-backdrop-filter: var(--liquid-blur-sm);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  transform: translateY(10px);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden; /* Prevent any child from bleeding outside */
  min-width: 0;
}
.photo-card:hover .photo-info { transform: translateY(0); }

/* Prevent photographer info from overflowing the card */
.photographer-info { display: flex; align-items: center; gap: 0.6rem; min-width: 0; overflow: hidden; }
.photographer-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600; color: #fff; flex-shrink: 0;
}
.photographer-name {
  font-size: 0.85rem; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-dims { font-size: 0.72rem; color: rgba(255,255,255,0.6); margin-top: 0.1rem; white-space: nowrap; }

.photo-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.btn-preview {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.15); 
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: background var(--transition);
}
.btn-preview:hover { background: rgba(255,255,255,0.3); }
.btn-download {
  display: flex; align-items: center; gap: 0.35rem;
  background: #fff; color: #000;
  border-radius: var(--radius-pill); padding: 0.35rem 0.75rem;
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  transition: background var(--transition);
}
.btn-download:hover { background: #e0e0e0; }

.photo-color-strip { display: none; }

/* ============================================================
   SKELETON LOADERS (Smooth pulsing glass)
============================================================ */
.skeleton-card {
  background: rgba(255,255,255,0.03); 
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
  break-inside: avoid; margin-bottom: 1.5rem;
  overflow: hidden; cursor: default;
}
.skeleton-card:hover { transform: none; box-shadow: none; }
.skeleton-shimmer {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.05) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state {
  text-align: center; padding: 8rem 2rem;
  max-width: 400px; margin: 0 auto;
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 3.5rem; margin-bottom: 1.5rem; opacity: 0.8; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-2); font-size: 1rem; }

/* ============================================================
   INFINITE SCROLL / LOADING
============================================================ */
#scroll-sentinel { height: 1px; }
.loading-more {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 3rem; color: var(--text-2); font-size: 0.95rem; font-weight: 500;
}
.loading-more.hidden { display: none; }
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: #fff;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* ============================================================
   FOOTER
============================================================ */
.footer {
  border-top: 1px solid var(--glass-border-light);
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg);
}
/* Logo SVG (unused now, kept for safety) */
.logo-svg { height: 22px; width: auto; filter: invert(1); flex-shrink: 0; }

/* "by Anvex" badge next to RENDER wordmark */
.logo-by {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-left: 0.25rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(255,255,255,0.12);
}
.logo-anvex-svg {
  height: 14px; width: auto;
  filter: invert(1) brightness(0.6);
  transition: filter var(--transition);
}
.nav-logo:hover .logo-anvex-svg { filter: invert(1) brightness(1); }
.footer-logo:hover .logo-anvex-svg { filter: invert(1) brightness(1); }

.footer-inner { max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.footer-logo { display: flex; align-items: center; gap: 0.5rem; opacity: 0.8; }
.footer-text { color: var(--text-2); font-size: 0.9rem; }
.footer-text a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); text-underline-offset: 4px; transition: all var(--transition); }
.footer-text a:hover { text-decoration-color: #fff; }
.footer-copy { color: var(--text-3); font-size: 0.85rem; margin-top: 0.5rem; }

/* Anvex Studio Attribution */
.footer-agency {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text-3); font-size: 0.82rem;
  margin-top: 0.25rem;
}
.footer-agency-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text-2); font-weight: 600;
  transition: color var(--transition);
}
.footer-agency-link:hover { color: #fff; }
.footer-agency-logo {
  height: 16px; width: auto;
  filter: invert(1) brightness(0.7);
  transition: filter var(--transition);
}
.footer-agency-link:hover .footer-agency-logo { filter: invert(1) brightness(1); }

/* ============================================================
   LIGHTBOX MODAL (Vision Pro Window Style)
============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4); 
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.active { opacity: 1; visibility: visible; display: flex; }

.modal-container {
  position: relative; width: 100%; max-width: 1200px;
  background: rgba(20, 20, 20, 0.6); 
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-xl); overflow: hidden;
  display: grid; grid-template-columns: 1fr 340px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  max-height: 90vh; 
  animation: modalIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1); /* Spring-like Apple bounce */
}
@keyframes modalIn { 
  from { transform: scale(0.95) translateY(20px); opacity: 0; } 
  to { transform: scale(1) translateY(0); opacity: 1; } 
}

.modal-close {
  position: absolute; top: 1.5rem; right: 1.5rem; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); 
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,0.1);
}
.modal-close:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.modal-img-wrap {
  position: relative; overflow: hidden;
  background: transparent; min-height: 500px; max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.modal-photo {
  width: 100%; height: 100%; object-fit: contain;
  border-radius: var(--radius-lg);
  transition: opacity 0.4s ease;
  box-shadow: var(--shadow-soft);
}
.modal-img-loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}

.modal-panel {
  display: flex; flex-direction: column;
  padding: 2.5rem 2rem; gap: 2rem;
  border-left: 1px solid rgba(255,255,255,0.1);
  background: rgba(30, 30, 30, 0.3);
  overflow-y: auto;
}
.modal-meta { display: flex; flex-direction: column; gap: 1rem; }
.modal-photographer-wrap { display: flex; align-items: center; gap: 1rem; }
.modal-avatar-wrap { flex-shrink: 0; }
.modal-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 600; color: #fff;
}
.modal-photographer-label { font-size: 0.8rem; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.modal-photographer-name { font-size: 1.2rem; font-weight: 600; margin-top: 0.2rem; }
.modal-dims { font-size: 0.95rem; color: var(--text-2); font-weight: 400; }
.modal-pexels-link {
  font-size: 0.9rem; color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); text-underline-offset: 4px;
  transition: all var(--transition);
  display: inline-block; margin-top: 0.5rem;
}
.modal-pexels-link:hover { text-decoration-color: #fff; }

.modal-downloads { display: flex; flex-direction: column; gap: 1rem; margin-top: auto; }
.modal-download-label { font-size: 0.8rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.modal-download-btns { display: flex; flex-direction: column; gap: 0.6rem; }
.modal-download-btn {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm); padding: 0.85rem 1.2rem;
  font-size: 0.95rem; font-weight: 500; color: #fff;
  transition: all var(--transition);
}
.modal-download-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); transform: scale(1.02); }
.modal-download-btn.btn-primary {
  background: #fff; border-color: #fff; color: #000; font-weight: 600;
}
.modal-download-btn.btn-primary:hover { background: #f0f0f0; border-color: #f0f0f0; }

/* ============================================================
   BACK TO TOP (Floating Glass Button)
============================================================ */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 90;
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #fff;
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glass);
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.back-to-top:hover { transform: translateY(-4px) scale(1.05); background: rgba(255,255,255,0.15); }
.back-to-top.hidden { opacity: 0; pointer-events: none; transform: translateY(20px) scale(0.9); }

/* ============================================================
   RESPONSIVE — TABLET (≤900px)
============================================================ */
@media (max-width: 900px) {
  /* Grid: 2 columns on tablet */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem 1.5rem 3rem;
  }
  .photo-card { height: 280px; }

  /* Modal stacks vertically */
  .modal-container {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh auto;
    max-height: 95vh;
  }
  .modal-panel {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem; gap: 1.5rem;
    overflow-y: auto;
  }
  .modal-img-wrap { min-height: unset; padding: 1rem; }

  /* Hero stats: wrap cleanly */
  .hero-stats { flex-wrap: wrap; justify-content: center; gap: 1.5rem; padding: 1.25rem 2rem; }
  .stat-divider { display: none; }
  .stat-num { font-size: 1.5rem; }

  /* Nav: switch to simple 2-col (logo + credit) */
  .nav-inner { grid-template-columns: auto 1fr auto; gap: 1rem; }
  .nav-search { width: 100%; margin: 0 1rem; }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤640px)
============================================================ */
@media (max-width: 640px) {
  :root { --nav-h: 60px; }

  /* Navbar: logo left, credit hidden, full-width search below is handled by hero */
  #navbar { padding: 0 1rem; }
  .nav-inner { grid-template-columns: 1fr auto; gap: 0.75rem; }
  .nav-search { display: none; } /* Hidden — hero search handles this on mobile */
  .nav-credit { font-size: 0.78rem; }

  /* Hero: tighter padding, smaller text */
  #hero { padding: 6rem 1.25rem 3rem; min-height: 100svh; }
  .hero-content { gap: 1.25rem; }
  .hero-badge { font-size: 0.78rem; padding: 0.35rem 0.9rem; }
  .hero-title {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
    letter-spacing: -0.03em;
  }
  .hero-subtitle { font-size: 1rem; max-width: 100%; }

  /* Hero search: compact on mobile */
  .hero-search-wrap { margin-top: 0.5rem; }
  .hero-search-inner { padding: 0.5rem 0.5rem 0.5rem 1rem; gap: 0.5rem; }
  .hero-search-inner input { font-size: 0.95rem; }
  .hero-search-btn { padding: 0.7rem 1.2rem; font-size: 0.9rem; }
  .hero-search-btn svg { display: none; } /* Icon only wastes space on small screens */

  /* Hero stats: horizontal row on mobile */
  .hero-stats {
    flex-direction: row; gap: 1rem;
    padding: 1rem 1.25rem; width: 100%;
    justify-content: space-around;
    border-radius: var(--radius-lg);
  }
  .stat { gap: 0.1rem; }
  .stat-num { font-size: 1.3rem; }
  .stat-label { font-size: 0.75rem; }

  /* Hero scroll hint hidden on mobile (finger scroll is obvious) */
  .hero-scroll-hint { display: none; }

  /* Category bar: smaller chips, horizontal scroll */
  .category-bar { padding: 0.6rem 1rem; }
  .category-label { display: none; } /* Save space on mobile */
  .category-chip { font-size: 0.82rem; padding: 0.45rem 0.85rem; }

  /* Results header */
  .results-header { padding: 1.25rem 1rem 0.5rem; }
  .results-title { font-size: 1.15rem; }
  .results-count { font-size: 0.82rem; }

  /* Gallery: 2 columns, tighter gap, safe edge padding */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 5rem; /* Bottom padding accounts for back-to-top btn */
  }
  .photo-card { height: 195px; border-radius: var(--radius); }

  /* Photo overlay: always visible on mobile (no hover on touch) */
  .photo-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 55%);
    padding: 0.5rem;
  }
  .photo-info {
    background: transparent; border: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 0.4rem 0; transform: none !important;
    gap: 0.35rem;
  }
  .photographer-avatar { width: 24px; height: 24px; font-size: 0.7rem; }
  .photographer-name { font-size: 0.72rem; }
  .photo-dims { display: none; }
  .btn-preview { display: none; }
  /* Download button: compact icon + text, ensure it never clips */
  .btn-download {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    gap: 0.2rem;
    flex-shrink: 0;
  }
  .btn-download svg { width: 12px; height: 12px; }

  /* Modal: bottom sheet on mobile — image top, panel scrolls below */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 1fr; /* image fixed, panel fills & scrolls */
    height: 92svh;            /* fixed total height — no overflow surprise */
    max-height: 92svh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-bottom: none;
    width: 100%;
    overflow: hidden;         /* contain children within rounded corners */
  }
  .modal-img-wrap {
    min-height: unset; height: 100%;
    padding: 0.75rem 0.75rem 0;
  }
  .modal-photo { border-radius: var(--radius); }
  .modal-panel {
    padding: 1rem 1.25rem 1.5rem;
    gap: 0.85rem;
    overflow-y: auto;         /* panel scrolls if content overflows */
    -webkit-overflow-scrolling: touch; /* smooth momentum scroll on iOS */
  }
  .modal-close { top: 0.85rem; right: 0.85rem; width: 36px; height: 36px; }
  .modal-photographer-name { font-size: 0.95rem; }
  /* Compact download buttons so all 4 fit without scrolling if possible */
  .modal-download-btn { padding: 0.6rem 0.9rem; font-size: 0.85rem; gap: 0.5rem; }
  .modal-download-btns { gap: 0.4rem; }
  .modal-download-label { margin-top: 0.25rem; }
  .modal-dims { font-size: 0.85rem; }
  .modal-meta { gap: 0.6rem; }

  /* Error banner */
  .error-banner { margin: 0 1rem 1rem; padding: 0.75rem 1rem; font-size: 0.85rem; }

  /* Loading more */
  .loading-more { padding: 2rem 1rem; }

  /* Back to top: larger tap target */
  .back-to-top {
    width: 46px; height: 46px;
    bottom: 1.25rem; right: 1.25rem;
  }

  /* Footer */
  .footer { padding: 2.5rem 1.25rem; }
  .footer-text { font-size: 0.8rem; }
  .footer-copy { font-size: 0.75rem; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤400px)
============================================================ */
@media (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 3rem;
  }
  .photo-card { height: 170px; }
  .hero-stats { flex-direction: column; gap: 0.5rem; }
  .stat-divider { display: none; }
}

/* ============================================================
   TOUCH: disable hover effects on touch devices for performance
============================================================ */
@media (hover: none) {
  .photo-card:hover { transform: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05); }
  .photo-card:hover .photo-img { transform: none; }
  .modal-download-btn:hover { transform: none; }
  .hero-search-btn:hover { transform: none; }
}

/* Focus styles */
:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 4px;
  border-radius: 6px;
}

.hidden { display: none !important; }


