/* ==========================================================================
   Dan Wray Photography - Editorial Styling
   ========================================================================== */

:root {
  /* Dark Theme (Default) */
  --bg-primary: #0a0a0c;
  --bg-secondary: #121316;
  --bg-tertiary: #1b1c20;
  --bg-elevated: #22242a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #ffffff;
  --accent-glow: rgba(255, 255, 255, 0.12);
  --live-green: #10b981;
  --live-glow: rgba(16, 185, 129, 0.35);
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  
  --header-height: 72px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

[data-theme="light"] {
  --bg-primary: #fafafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f4;
  --bg-elevated: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-medium: rgba(0, 0, 0, 0.14);
  --text-primary: #121214;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --accent: #000000;
  --accent-glow: rgba(0, 0, 0, 0.08);
  --live-green: #059669;
  --live-glow: rgba(5, 150, 105, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 20px 40px -15px rgba(0, 0, 0, 0.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button, select, input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background-color: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

[data-theme="light"] .site-header {
  background-color: rgba(250, 250, 252, 0.85);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Sync Status Badge */
.sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--live-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--live-glow);
  position: relative;
}

.status-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid var(--live-green);
  animation: pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(0.9); opacity: 0; }
}

/* Header Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.btn-icon {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-medium);
}

.btn-icon:active {
  transform: scale(0.96);
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Theme Toggle Icons */
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Sync Button Spinning Animation */
.spinning .icon-sync {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  padding: 3.5rem 0 2rem;
  text-align: center;
}

.hero-content {
  max-width: 680px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Gallery Controls Bar
   ========================================================================== */
.controls-section {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  background-color: rgba(10, 10, 12, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.5rem;
}

[data-theme="light"] .controls-section {
  background-color: rgba(250, 250, 252, 0.8);
}

.controls-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Filter Buttons */
.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.filter-count {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* View Controls */
.view-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.select-wrapper {
  position: relative;
}

.custom-select {
  appearance: none;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 2rem 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: all var(--transition-fast);
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--border-medium);
  color: var(--text-primary);
  outline: none;
}

.layout-toggle {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  gap: 0.15rem;
}

.layout-btn {
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.layout-btn:hover {
  color: var(--text-primary);
}

.layout-btn.active {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* ==========================================================================
   Gallery Layouts
   ========================================================================== */
.main-content {
  flex: 1;
  padding-bottom: 5rem;
}

/* Masonry Layout */
.layout-masonry {
  column-count: 3;
  column-gap: 1.5rem;
}

@media (max-width: 1024px) {
  .layout-masonry { column-count: 2; column-gap: 1.25rem; }
}

@media (max-width: 640px) {
  .layout-masonry { column-count: 1; }
}

.layout-masonry .photo-card {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

/* Uniform Grid Layout */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.layout-grid .photo-card {
  aspect-ratio: 1 / 1;
}

.layout-grid .card-img {
  height: 100%;
  object-fit: cover;
}

/* Editorial Stream Layout */
.layout-stream {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.layout-stream .photo-card {
  box-shadow: var(--shadow-elevated);
}

/* ==========================================================================
   Photo Card Component
   ========================================================================== */
.photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}

.photo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-medium);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.card-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-img.loaded {
  opacity: 1;
  transform: scale(1);
}

.photo-card:hover .card-img.loaded {
  transform: scale(1.04);
}

/* Card Overlay on Hover */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  transition: opacity var(--transition-smooth);
}

.photo-card:hover .card-overlay {
  opacity: 1;
}

.card-meta {
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-date {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.725rem;
  color: rgba(255, 255, 255, 0.8);
}

.meta-pill {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Video Card Indicators */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform var(--transition-smooth), background-color var(--transition-smooth);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.video-play-btn svg {
  margin-left: 3px;
}

.photo-card:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(0, 0, 0, 0.78);
  border-color: rgba(255, 255, 255, 0.85);
}

.video-duration-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 2;
  pointer-events: none;
}

/* Skeleton Loaders */
.skeleton-card {
  width: 100%;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty & Error States */
.empty-state, .error-state {
  text-align: center;
  padding: 5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
}

.empty-state h3, .error-state h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   Lightbox Modal
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(5, 5, 8, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.lightbox-dialog {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Lightbox Toolbar */
.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  color: #ffffff;
}

.lightbox-counter {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lb-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.lb-btn:hover {
  background-color: rgba(255, 255, 255, 0.22);
  transform: scale(1.06);
}

.lb-btn:active {
  transform: scale(0.95);
}

.lb-close:hover {
  background-color: rgba(239, 68, 68, 0.35);
}

/* Lightbox Stage */
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: relative;
  overflow: hidden;
}

.lb-nav {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all var(--transition-fast);
}

.lb-nav:hover {
  background-color: rgba(255, 255, 255, 0.26);
  transform: scale(1.08);
}

.lightbox-image-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.5rem;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  user-select: none;
}

.lightbox-img.loaded {
  opacity: 1;
}

.lightbox-img.zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lightbox-video {
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  background: #000000;
  outline: none;
}

/* Lightbox Spinner */
.lightbox-spinner {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.lightbox-image-container.loading .lightbox-spinner {
  display: block;
}

/* Lightbox Footer Info */
.lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  color: #ffffff;
  font-size: 0.85rem;
}

.lightbox-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.info-divider {
  opacity: 0.4;
}

.info-resolution, .info-camera {
  opacity: 0.75;
}

.lightbox-hint {
  opacity: 0.5;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .lightbox-toolbar { padding: 1rem; }
  .lightbox-footer { padding: 1rem; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .lightbox-stage { padding: 0; }
  .lb-nav { width: 40px; height: 40px; }
  .lb-prev { margin-left: 0.5rem; }
  .lb-next { margin-right: 0.5rem; }
  .lightbox-hint { display: none; }
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-elevated);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  pointer-events: none;
}

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

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.toast-btn {
  background-color: var(--accent);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  transition: opacity var(--transition-fast);
}

.toast-btn:hover {
  opacity: 0.9;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  padding: 2.5rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-title {
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.footer-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-primary);
}

.footer-hosting a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-hosting a:hover {
  color: var(--text-primary);
}
