:root {
  --bg: #ffffff;
  --bg-secondary: #f9f9f9;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #000000;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --grid-gap: 1rem;
  --transition: 0.2s ease;
  --header-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

code,
pre {
  font-family: monospace;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  width: 100%;
}

.header-content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 32px;
  height: 32px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.site-name {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.025em;
}

.search-container {
  flex: 1;
  max-width: 480px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.875rem;
  pointer-events: none;
  opacity: 0.5;
}

#search-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  border-radius: 8px;
  outline: none;
  font-size: 0.875rem;
  transition: all var(--transition);
}

#search-input:focus {
  background: var(--bg);
  border-color: #9ca3af;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

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

.filter-toggle-btn {
  display: none;
  background: none;
  border: none;
  padding: 1rem;
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-muted);
}

.filter-toggle-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.filter-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.filter-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 1024px) {
  .filter-toggle-btn {
    display: flex;
  }

  .filters {
    display: none;
    position: absolute;
    top: calc(var(--header-height) - 8px);
    right: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 60;
  }

  .filters.show {
    display: flex;
  }

  .filter-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 768px) {
  .site-header {
    height: auto;
    padding: 0.75rem 0;
  }

  .header-content {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .brand {
    order: 1;
  }

  .header-actions {
    order: 2;
  }

  .search-container {
    order: 3;
    flex: none;
    width: 100%;
    max-width: none;
  }
}

/* Gallery */
main {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
}

.gallery-grid {
  columns: 4;
  column-gap: var(--grid-gap);
}

@media (max-width: 1280px) {
  .gallery-grid {
    columns: 3;
  }
}

@media (max-width: 768px) {
  .gallery-grid {
    columns: 2;
  }
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--grid-gap);
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition);
}

.gallery-item:hover {
  transform: scale(1.01);
}

.gallery-card {
  position: relative;
  width: 100%;
}

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

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 50%);
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.overlay-content {
  color: #ffffff;
  width: 100%;
}

.gallery-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gallery-tags .tag {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #ffffff;
}

.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 4, 0.6);
}

.modal-dialog {
  position: relative;
  background: var(--bg);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  padding: 2.5rem;
  border-radius: var(--radius);
  overflow-y: auto;
}

@media (max-width: 640px) {
  .modal-dialog {
    padding: 1.5rem 1rem;
    width: 95%;
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
}

.modal-body h2 {
  margin-top: 0;
  font-size: 1.8rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.variations {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.variation-card {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.variation-image-container {
  position: relative;
  width: 100%;
  flex: 1;
  background: #fafafa;
}

.variation-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 1.5rem;
}

.copy-svg-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.variation-image-container:hover .copy-svg-btn {
  opacity: 1;
}

.copy-svg-btn:hover {
  background: var(--bg-secondary);
  border-color: #9ca3af;
}

.copy-svg-btn.copied {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  opacity: 1;
}

.copy-svg-btn.error {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  opacity: 1;
}

.variation-label {
  padding: 0.8rem;
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
}

.prompt-section {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.prompt-section h3 {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

#modal-prompt {
  margin: 0;
  font-size: 0.95rem;
  white-space: pre-wrap;
  color: var(--text);
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: var(--radius);
}

@media (max-width: 768px) {
  .site-header {
    padding-top: 2rem;
  }

  .variations {
    flex-direction: column;
  }

  .variation-card {
    min-width: 0;
    width: 100%;
  }
}