/* ============================================================
   Museum of Spatial Shirts — Stylesheet
   ============================================================ */

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

:root {
  --bg:           #f5f4f0;
  --bg2:          #ffffff;
  --bg3:          #eceae4;
  --surface:      #ffffff;
  --surface2:     #f0ede6;
  --border:       #ddd9d0;
  --accent:       #2563eb;
  --accent2:      #7c3abf;
  --accent-green: #0f7a4e;
  --text:         #1a1814;
  --text-muted:   #5a5650;
  --text-dim:     #9a9590;
  --tag-bg:       #ece9e2;
  --tag-border:   #d4d0c8;
  --card-shadow:  0 2px 12px rgba(0,0,0,0.08);
  --radius:       12px;
  --radius-sm:    7px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'Fira Code', 'Cascadia Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Site Header --- */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 64px;
  flex-wrap: wrap;
}

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

.header-icon {
  font-size: 2rem;
  line-height: 1;
}

.header-title h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-btn:hover, .nav-btn.active {
  background: #dbeafe;
  border-color: var(--accent);
  color: var(--accent);
}

.nav-btn-contribute {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.nav-btn-contribute:hover {
  background: #3a7ee0;
  border-color: #3a7ee0;
  color: #fff;
  text-decoration: none;
}

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, #eceae4 0%, #e8e4da 50%, #eceae4 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 2rem 2.5rem;
}

.hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-text {
  max-width: 680px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Filter bar --- */
.filter-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  position: sticky;
  top: 64px;
  z-index: 90;
}

.filter-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  width: 260px;
  outline: none;
  transition: border-color 0.15s;
}

#search-input::placeholder { color: var(--text-dim); }
#search-input:focus { border-color: var(--accent); }

.tag-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag-pill {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-pill:hover, .tag-pill.active {
  background: #ede9fe;
  border-color: var(--accent2);
  color: var(--accent2);
}

/* --- Gallery Grid --- */
.gallery-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
}

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

.card-thumb {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--bg3);
  position: relative;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
  display: block;
}

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

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--bg3), var(--surface2));
}

.card-thumb-wanted {
  background: repeating-linear-gradient(
    -45deg,
    #ece9e2,
    #ece9e2 8px,
    #e2dfd8 8px,
    #e2dfd8 16px
  );
  opacity: 0.9;
}

.wanted-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.card-wanted {
  border-style: dashed;
  opacity: 0.8;
}

.card-wanted:hover {
  opacity: 1;
  border-style: solid;
}

.card-photo-count {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.card-body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card-badge-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.card-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}

.cat-event   { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.cat-concept { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.cat-company { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.cat-sticker { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

.card-type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
  display: inline-block;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-year {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.card-tag {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
}

.card-stories-badge {
  font-size: 0.75rem;
  color: var(--accent-green);
  margin-top: auto;
  padding-top: 0.4rem;
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}

.empty-state span { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  z-index: 10;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  color: #fff;
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-content {
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-caption {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  text-align: center;
}

/* --- Detail Panel --- */
.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: stretch;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.detail-panel.open {
  opacity: 1;
  pointer-events: all;
}

.detail-overlay {
  flex: 1;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.detail-inner {
  width: min(560px, 100vw);
  background: #fff;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

.detail-panel.open .detail-inner {
  transform: translateX(0);
}

.detail-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.detail-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-share {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.detail-share:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-category {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.detail-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* Photo strip */
.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
}

.detail-photo-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-photo-credit {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Related items */
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.related-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem;
  width: 90px;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font);
}

.related-item:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

.related-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.related-placeholder {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--bg3);
  border-radius: 4px;
}

.related-item span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.detail-photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.detail-photo-thumb:hover {
  border-color: var(--accent);
}

.detail-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Stories */
.detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.story-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.story-author {
  font-weight: 600;
  color: var(--accent-green);
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.story-date {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.story-add-link {
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  text-align: center;
  display: block;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.story-add-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

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

.detail-tag {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
}

/* --- Contribute section --- */
.contribute-section {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 4rem 2rem;
}

.contribute-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contribute-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.contribute-section > .contribute-inner > p {
  color: var(--text-muted);
  max-width: 600px;
  font-size: 1rem;
}

.contribute-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.contribute-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contribute-card-icon {
  font-size: 2rem;
}

.contribute-card h3 {
  font-size: 1rem;
  font-weight: 700;
}

.contribute-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.contribute-card code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--bg3);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  color: var(--accent2);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
  text-align: center;
  align-self: flex-start;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: #3a7ee0;
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.contribute-format pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.contribute-format code {
  font-family: var(--font-mono);
}

.contribute-format h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Footer --- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-small {
  font-size: 0.75rem !important;
  color: var(--text-dim) !important;
}

/* --- Responsive --- */
@media (max-width: 700px) {
  .header-inner { padding: 0.75rem 1rem; }
  .hero { padding: 2rem 1rem; }
  .hero-inner { flex-direction: column; }
  .filter-bar { padding: 0.75rem 1rem; }
  .gallery-section { padding: 1.5rem 1rem 3rem; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
  .contribute-section { padding: 2.5rem 1rem; }
  .detail-inner { width: 100vw; border-left: none; border-top: 1px solid var(--border); }
  .detail-panel { align-items: flex-end; }
  .detail-overlay { position: absolute; inset: 0; }
}
