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

:root {
  --bg:          #0a0a0a;
  --fg:          #f0ede8;
  --fg-muted:    rgba(240,237,232,0.45);
  --overlay-bg:  rgba(8, 8, 8, 0.82);
  --font-display: 'Noto Sans', 'GulimChe', '굴림체', 'Noto Sans KR', sans-serif;
  --font-body:   'Noto Sans', 'GulimChe', '굴림체', 'Noto Sans KR', sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.4;
  min-height: 100vh;
}



/* ── About (hidden by default, toggled on click) ──────── */
.about {
  display: none;
}

/* ── Grid — zero-gap masonry via CSS columns ──────────── */
.works {
  /* no padding — tiles go edge-to-edge */
  padding: 0;
}

#grid {
  columns: 5 160px;
  column-gap: 0;
  /* Push content below fixed header (small so tiles still feel full-bleed) */
  padding-top: 0;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  break-inside: avoid;
  margin-bottom: 0;       /* zero gap vertically */
  background: var(--bg);
  border: none;
  border-radius: 0;
  overflow: hidden;
  cursor: grab;
  position: relative;
  /* subtle transition for drag feedback */
  transition: filter 0.15s ease;
}

.card:active {
  cursor: grabbing;
}

/* ── Card image wrap ──────────────────────────────────── */
.card-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  min-height: 320px;
}

.card-img-wrap img {
  width: 100%;
  min-height: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  /* tiny 1px black line between tiles to separate them cleanly */
  border-bottom: 1px solid var(--bg);
}

#download-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0;
  background: rgba(240, 237, 232, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(240, 237, 232, 0.2);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: all 0.2s ease;
}
#download-btn:hover {
  background: var(--fg);
  color: var(--bg);
  transform: scale(1.08);
}

/* Placeholder (no image) */
.card-img-wrap:not(:has(img)) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-label {
  font-size: 0.65rem;
  color: rgba(240,237,232,0.2);
  letter-spacing: 0.04em;
}

/* ── Hover overlay ────────────────────────────────────── */
.card-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  color: var(--fg);
  padding: 0.85rem 0.9rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  /* hide scrollbar */
  scrollbar-width: none;
}
.card-overlay::-webkit-scrollbar { display: none; }

.card-img-wrap:hover .card-overlay {
  opacity: 1;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  color: #fff;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding-bottom: 0.35rem;
}

.overlay-brand {
  font-size: 0.68rem;
  color: var(--fg-muted);
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.card-overlay dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.18rem 0.55rem;
  font-size: 0.68rem;
  line-height: 1.5;
}

.card-overlay dt {
  color: rgba(240,237,232,0.42);
  white-space: nowrap;
}

.card-overlay dd {
  color: var(--fg);
}

/* ── No footer (was card-footer) — removed entirely ──── */
.card-footer { display: none; }

/* ── Drag states ──────────────────────────────────────── */
.card-ghost {
  opacity: 0.25;
}

.card-dragging {
  opacity: 0.0;            /* original slot is invisible */
}

@keyframes sweepUpAnim {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-110vh); opacity: 0; }
}

@keyframes sweepInAnim {
  0% { transform: translateY(110vh); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.sweep-up {
  animation: sweepUpAnim 0.4s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}

.sweep-in {
  animation: sweepInAnim 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* The floating clone while dragging */
#drag-clone {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  opacity: 0.88;
  transform: rotate(1.5deg) scale(1.04);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  transition: transform 0.08s ease;
  border-radius: 0;
  overflow: hidden;
}

/* ── Loading / Error ──────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  background: var(--bg);
  z-index: 200;
}

#error {
  margin: 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #5a2222;
  background: #1a0808;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #d48888;
  line-height: 1.8;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
  #grid { columns: 4 150px; }
}
@media (max-width: 800px) {
  #grid { columns: 3 130px; }
}
@media (max-width: 520px) {
  #grid { columns: 2 120px; }
  h1 { font-size: 0.9rem; }
}

/* ── Export Tag (Screenshot Only) ─────────────────────── */
#export-tag {
  position: fixed;
  bottom: 6rem;
  right: 2.5rem;
  width: 155px;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  z-index: 9999;
  font-family: var(--font-body);
  /* Slight tilt to feel like a sticker */
  transform: rotate(-3deg) scale(0.9);

  /* Hidden by default, shown on hover */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#export-tag.show {
  opacity: 1;
  transform: rotate(-3deg) scale(1);
}

#export-tag .tag-header {
  background: #2a2a2d;
  color: #fff;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

#export-tag .tag-title {
  font-size: 0.36rem;
  color: #aaa;
  letter-spacing: 0.05em;
  font-family: 'Noto Sans', sans-serif;
}

#export-tag .tag-id {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-family: 'Noto Sans', sans-serif;
}

#export-tag .tag-body {
  background: #e8e8e8;
  padding: 0.6rem;
  color: #333;
  font-size: 0.42rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

#export-tag .tag-row {
  display: flex;
  gap: 0.35rem;
}

#export-tag .tag-row strong {
  color: #000;
  min-width: 60px;
  font-family: 'Noto Sans', sans-serif;
}

#export-tag .tag-row span {
  color: #444;
}
