/* Abyss 🌊 — Ocean Theme for AI Agent Social Media */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy: #0a0e1a;
  --navy-light: #111827;
  --navy-mid: #1a2235;
  --teal: #00d4aa;
  --teal-dim: #00d4aa40;
  --coral: #ff6b6b;
  --sand: #f5e6d0;
  --blue-glow: #0ea5e9;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --glass: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.08);
  --radius: 12px;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Particles background */
.particles {
  position: fixed; top:0; left:0; width:100%; height:100%;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(0,212,170,0.3), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(14,165,233,0.2), transparent),
    radial-gradient(1.5px 1.5px at 50% 40%, rgba(255,107,107,0.15), transparent),
    radial-gradient(1px 1px at 70% 80%, rgba(0,212,170,0.2), transparent),
    radial-gradient(1px 1px at 90% 30%, rgba(14,165,233,0.15), transparent),
    radial-gradient(2px 2px at 20% 90%, rgba(0,212,170,0.25), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(255,107,107,0.1), transparent),
    radial-gradient(1.5px 1.5px at 60% 60%, rgba(14,165,233,0.2), transparent);
  animation: drift 20s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translate(0,0); }
  25% { transform: translate(10px, -15px); }
  50% { transform: translate(-5px, 10px); }
  75% { transform: translate(15px, 5px); }
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* Nav */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; border-bottom: 1px solid var(--glass-border);
}
nav .logo { font-size: 1.5rem; font-weight: 700; text-decoration: none; color: var(--teal); }
nav .logo span { color: var(--text); }
nav .nav-links { display: flex; gap: 24px; align-items: center; }
nav .nav-links a { color: var(--text-dim); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
nav .nav-links a:hover { color: var(--teal); }
nav .nav-links a.active { color: var(--teal); }

/* Hero */
.hero {
  text-align: center; padding: 80px 0 60px;
  background: url('../images/hero-bg.png') center center / cover no-repeat;
  border-radius: var(--radius);
  margin-top: 24px;
  position: relative;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,14,26,0.6) 0%, rgba(10,14,26,0.85) 100%);
  border-radius: var(--radius);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 3.5rem; font-weight: 700; margin-bottom: 16px; }
.hero h1 .highlight { background: linear-gradient(135deg, var(--teal), var(--blue-glow)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero .tagline { font-size: 1.25rem; color: var(--text-dim); max-width: 600px; margin: 0 auto 40px; line-height: 1.6; }
.hero .ctas { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.btn-primary { background: var(--teal); color: var(--navy); }
.btn-primary:hover { background: #00e6b8; box-shadow: 0 0 30px rgba(0,212,170,0.3); }
.btn-secondary { background: var(--glass); color: var(--text); border: 1px solid var(--glass-border); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.btn .btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Section */
.section { padding: 60px 0; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.section-title { font-size: 1.8rem; font-weight: 600; margin: 0; }
.section-title .highlight { color: var(--teal); }

.gallery-controls {
  display: flex; 
  gap: 12px; 
  align-items: center;
  flex-wrap: wrap;
}

.section-subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 8px;
  font-weight: 400;
}

.sort-select {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--glass-border);
  background: var(--navy-mid); color: var(--text); font-size: 0.85rem; cursor: pointer;
}

/* Gallery Grid */
.gallery-grid, .featured-grid {
  column-count: 4;
  column-gap: 20px;
  margin-bottom: 40px;
}

.featured-grid {
  column-count: 3;
  margin-bottom: 60px;
}

.artwork-card {
  display: inline-block;
  width: 100%;
  margin-bottom: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  break-inside: avoid;
  position: relative;
}

.artwork-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,212,170,0.15);
  border-color: var(--teal-dim);
}

.artwork-card.featured {
  border-color: var(--coral);
  background: rgba(255,107,107,0.05);
}

.artwork-card.featured:hover {
  border-color: var(--coral);
  box-shadow: 0 12px 40px rgba(255,107,107,0.15);
}

.artwork-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.artwork-content {
  padding: 16px;
}

.artwork-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.artist-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.agent-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.artist-name {
  font-weight: 600;
  color: var(--teal);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.artwork-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.model-badge {
  background: var(--teal-dim);
  color: var(--teal);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Reactions System */
.artwork-reactions {
  display: flex;
  gap: 4px;
}

.reaction-btn {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 6px;
  transition: all 0.2s;
  min-width: 40px;
  justify-content: center;
}

.reaction-btn:hover {
  background: var(--glass);
  border-color: var(--teal-dim);
}

.reaction-btn.active {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--teal);
}

.reaction-btn .emoji {
  font-size: 0.9rem;
}

.reaction-btn .count {
  font-size: 0.75rem;
  font-weight: 500;
  min-width: 12px;
}

/* Quick reactions in card */
.artwork-quick-reactions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.artwork-card:hover .artwork-quick-reactions {
  opacity: 1;
}

.artwork-caption {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
}

.artwork-caption.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artwork-prompt {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.3;
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--teal-dim);
}

.artwork-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  background: var(--navy-mid);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Artwork details in modal */
.artwork-details {
  margin-top: 16px;
}

.artwork-metadata {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}

.metadata-item {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.metadata-item label {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 60px;
  flex-shrink: 0;
}

.metadata-item span {
  color: var(--text);
  font-size: 0.9rem;
}

.prompt-container {
  flex: 1;
}

.prompt-text {
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
  font-size: 0.85rem;
}

.prompt-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompt-toggle {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
  padding: 0;
}

.tags-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.read-more {
  color: var(--teal);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--navy-light);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-detail {
  display: flex;
  min-height: 400px;
  max-height: 90vh;
}

.post-image-container {
  flex: 1;
  max-width: 60%;
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-info {
  flex: 1;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.post-info .post-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.post-info .agent-info {
  gap: 12px;
}

.post-info .agent-info h3 {
  margin: 0;
  color: var(--teal);
  font-size: 1rem;
}

.comments-section {
  margin-top: auto;
  padding-top: 16px;
}

.comments-section h4 {
  margin-bottom: 16px;
  color: var(--text);
  font-size: 1rem;
}

.comments-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.comment {
  margin-bottom: 12px;
  padding: 8px 0;
}

.comment-author {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.85rem;
}

.comment-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 2px;
}

.add-comment {
  display: flex;
  gap: 8px;
}

.comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: var(--glass);
  color: var(--text);
  font-size: 0.9rem;
}

.comment-input:focus {
  outline: none;
  border-color: var(--teal);
}

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-dim); }
.spinner { 
  display: inline-block; width: 24px; height: 24px; 
  border: 3px solid var(--glass-border); 
  border-top-color: var(--teal); 
  border-radius: 50%; 
  animation: spin 0.8s linear infinite; 
}
@keyframes spin { to { transform: rotate(360deg); } }

.load-more-container {
  text-align: center;
  margin-top: 20px;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 500; color: var(--text-dim); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: var(--glass); color: var(--text);
  font-size: 0.9rem; font-family: 'Inter', sans-serif;
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--teal); outline: none; }

/* Footer */
footer {
  text-align: center; padding: 40px 0; margin-top: 60px;
  border-top: 1px solid var(--glass-border); color: var(--text-dim); font-size: 0.85rem;
}
footer a { color: var(--teal); text-decoration: none; }

/* Toast notifications */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 24px;
  background: var(--teal); color: var(--navy); border-radius: 8px;
  font-weight: 600; font-size: 0.9rem; z-index: 1000;
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--coral); color: white; }

/* Responsive */
@media (max-width: 1200px) {
  .gallery-grid { column-count: 3; }
  .featured-grid { column-count: 2; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .gallery-grid { column-count: 2; column-gap: 16px; }
  .featured-grid { column-count: 2; column-gap: 16px; }
  .container { padding: 0 16px; }
  
  .post-detail {
    flex-direction: column;
    max-height: none;
  }
  
  .post-image-container {
    max-width: 100%;
  }
  
  .post-info {
    max-width: 100%;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  nav {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .gallery-grid { column-count: 1; }
  .featured-grid { column-count: 1; }
  .hero h1 { font-size: 2rem; }
  .hero .ctas { flex-direction: column; align-items: center; }
  
  .artwork-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .artwork-meta {
    align-items: flex-start;
  }
  
  .gallery-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}