:root {
  --max-content-width: min(95vw, 1400px);
  --content-padding: max(1rem, 2vw);
  --primary-color: #4A90E2;
  --secondary-color: #2C3E50;
  --background-color: #F5F7FA;
  --text-color: #333;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --hover-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: var(--content-padding);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

.header {
  max-width: var(--max-content-width);
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.header-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.header-title-row h1 {
  margin: 2rem 0;
  flex: 1;
  text-align: center;
  margin-top: 0px;
  margin-bottom: 0px;
}

.header-buttons {
  display: flex;
  justify-content: right;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.main-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: .25rem;
}

.container {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .event-list {
    font-size: 0.9rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .header-title-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .header-title-row h1 {
    margin: 1rem 0 0.5rem;
  }
}

h1 {
  color: var(--secondary-color);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 300;
  margin: 2rem 0;
}

.upload-button, .list-button {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  transition: background-color 0.3s, transform 0.2s;
  display: inline-block;
}

.list-button {
  background-color: var(--secondary-color);
}

.list-button:hover {
  background-color: #1a2530;
  transform: translateY(-1px);
}

.upload-button:hover {
  background-color: #357ABD;
  transform: translateY(-1px);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 2rem;
  max-width: var(--max-content-width);
  margin: 0 auto;
}

@media (max-width: 600px) {
  .gallery-grid {
    display: block;
    max-width: 100%;
  }

  .memory-card {
    width: 100%;
    margin: 0 0 1rem 0;
  }

  :root {
    --max-content-width: 100%;
    --content-padding: 0.75rem;
  }

  .memory-info {
    transform: translateY(0);
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}

@media (min-width: 601px) and (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

.memory-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  aspect-ratio: 1;
}

.memory-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--hover-shadow);
}

.memory-card a {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

img.memory-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: white;
  padding: 0.5rem;
  box-sizing: border-box;
  loading: lazy;
}

.memory-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.75rem;
  font-size: 0.9rem;
  transform: translateY(100%);
  transition: transform 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
}

.memory-card:hover .memory-info {
  transform: translateY(0);
}

.story-count {
  color: var(--secondary-color);
  font-weight: 500;
  flex-shrink: 0;
}

.contributors {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #666;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 2rem auto;
  max-width: 600px;
}

.empty-state p {
  color: #666;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .memory-info {
    transform: translateY(0);
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  color: var(--secondary-color);
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
}

.modal-instructions {
  color: #666;
  margin: 1rem 0;
  line-height: 1.5;
  white-space: pre-line;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form input {
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

/* PWA Specific Styles */
.pwa-standalone {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.pwa-standalone .header {
  padding-top: env(safe-area-inset-top);
}

.install-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1000;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  display: none;
}

.install-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

.install-button:active {
  transform: translateY(0);
}

/* Offline indicator */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ff6b6b;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 14px;
  z-index: 1001;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-indicator.show {
  transform: translateY(0);
}

/* PWA splash screen styles */
@media (display-mode: standalone) {
  body {
    user-select: none;
    -webkit-user-select: none;
  }
  
  .header {
    -webkit-app-region: drag;
  }
  
  .header-buttons {
    -webkit-app-region: no-drag;
  }
}

/* Mobile PWA optimizations */
@media (max-width: 768px) and (display-mode: standalone) {
  .main-content {
    padding-bottom: calc(var(--content-padding) + env(safe-area-inset-bottom));
  }
  
  .install-button {
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
  }
} 

 