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

:root{
  --bg:#000000;          /* 배경: 블랙 */
  --fg:#eaeaea;          /* 기본 텍스트 */
  --muted:#9a9a9a;
  --line:#4177E9;        /* 라인 컬러 */
  --spore:#4177E9;       /* 테마 컬러 */
}

body{
  background:var(--bg);
  color:var(--fg);
  overflow-x:hidden;
  font-family: Helvetica, Arial, sans-serif;
}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* Top bar */
.topbar{
  width:100%;
  min-height:88px;
  position:fixed;
  top:0;
  left:0;
  z-index:1000;
  background:rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  border-bottom:1.5px solid var(--line);
}

.topbar-inner{
  max-width:1400px;
  margin:0 auto;
  padding:14px 18px;
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
}

.brand .title{
  font-weight:700;
  font-size:2.2rem;
  letter-spacing:-0.02em;
  color:var(--spore);
}

.brand .subtitle{
  margin-top:4px;
  font-size:0.95rem;
  color:var(--muted);
  line-height:1.2;
  max-width:46ch;
}

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

.filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.chip{
  appearance:none;
  border:1.5px solid var(--line);
  background:#000;
  color:var(--fg);
  padding:8px 10px;
  font-size:0.95rem;
  border-radius:999px;
  cursor:pointer;
  transition: transform 120ms ease, background 120ms ease;
  user-select:none;
}
.chip:hover{ transform: translateY(-1px); }
.chip.is-active{
  background:var(--spore);
  color:#000;
}

.search input{
  width:min(260px, 45vw);
  border:1.5px solid var(--line);
  border-radius:999px;
  padding:9px 12px;
  font-size:0.95rem;
  outline:none;
  background:#000;
  color:var(--fg);
}
.search input:focus{
  box-shadow: 0 0 0 3px rgba(65,119,233,0.35);
}

/* Page */
.page{
  padding-top:104px;
}

.meta{
  max-width:1400px;
  margin:0 auto;
  padding:12px 18px 0;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.count{
  font-weight:700;
  color:var(--spore);
}
.hint{
  color:var(--muted);
  font-size:0.95rem;
}

/* Grid */
.container{
  max-width:1400px;
  margin:0 auto;
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  padding:18px 18px 28px;
  gap:26px 16px;
  height:auto;
}

@media (max-width: 1100px){
  .container{ grid-template-columns:repeat(4, 1fr); }
}
@media (max-width: 820px){
  .container{ grid-template-columns:repeat(3, 1fr); }
  .brand .subtitle{ display:none; }
}
@media (max-width: 560px){
  .container{ grid-template-columns:repeat(2, 1fr); }
}

/* Specimen */
.specimen{
  position:relative;
}

.container img{
  width:78%;
  height:auto;
  display:block;
  margin:0 auto;
  cursor:pointer;
  border:1.5px solid transparent;
  transition: transform 120ms ease, border-color 120ms ease;
}
.container img:hover{
  transform: translateY(-2px);
  border-color: var(--line);
}

.badge{
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  margin-top:8px;
  width:max-content;
  max-width:95%;
  font-size:0.85rem;
  color:var(--muted);
  text-align:center;
  line-height:1.2;
}


/* Caption — spore scatter -> gather */
#captionBox{
  position:fixed;
  display:none;
  background-color:var(--spore);
  color:#000;
  padding:10px 12px;
  font-size:1rem;
  border:1.5px solid var(--line);
  pointer-events:none;
  z-index:999;
  max-width:220px;
  white-space:pre-wrap;
  word-break:keep-all;
  box-shadow: 0 6px 0 rgba(0,0,0,1);
  transform-origin: 20% 80%;
  animation: spore-gather 340ms cubic-bezier(.2,.9,.2,1) both;
  will-change: transform, filter, opacity, text-shadow;
}

/* 흩어짐(먼지/가루) -> 모임(캡션) */
@keyframes spore-gather{
  0%{
    opacity:0;
    transform: translateY(12px) scale(0.92);
    filter: blur(3px);
    /* 텍스트를 ‘가루’처럼 분해한 느낌(많은 점들) */
    text-shadow:
      14px -10px 0 rgba(0,0,0,0.35),
      -16px 8px 0 rgba(0,0,0,0.35),
      10px 14px 0 rgba(0,0,0,0.30),
      -12px -14px 0 rgba(0,0,0,0.30),
      22px 2px 0 rgba(0,0,0,0.25),
      -22px -2px 0 rgba(0,0,0,0.25),
      6px -18px 0 rgba(0,0,0,0.22),
      -6px 18px 0 rgba(0,0,0,0.22);
  }
  55%{
    opacity:1;
    transform: translateY(0) scale(1.02);
    filter: blur(1px);
    /* 아직 조금 흩어져 있지만 수렴 중 */
    text-shadow:
      6px -4px 0 rgba(0,0,0,0.28),
      -6px 4px 0 rgba(0,0,0,0.28),
      4px 6px 0 rgba(0,0,0,0.22),
      -4px -6px 0 rgba(0,0,0,0.22);
  }
  100%{
    opacity:1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    /* 완전히 모여서 선명한 캡션 */
    text-shadow: 0 0 0 rgba(0,0,0,0);
  }
}

/* 에세이 버튼 — 기존 chip의 변주 */
/* 에세이 버튼 높이 검색창과 통일 */
.essay-chip{
  padding:9px 14px;   /* search input과 동일한 세로 리듬 */
  line-height:1;
  height:40px;        /* 검색 input 체감 높이 */
  display:flex;
  align-items:center;
}


/* 살짝만 강조 (읽기 버튼이라는 힌트 정도) */
.essay-chip:hover{
  background:var(--spore);
  color:#000;
}

/* 선택 상태처럼 보이지 않게 */
.essay-chip.is-active{
  background:transparent;
  color:var(--fg);
}

/* Essay modal */
.essay-modal{
  position:fixed;
  inset:0;
  z-index:2000;
  display:none;
}

.essay-modal.is-open{
  display:block;
}

/* 어두운 배경 */
.essay-overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
}

/* 에세이 패널 */
.essay-panel{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%);
  width:min(720px, 90vw);
  max-height:80vh;
  overflow-y:auto;
  background:#000;
  border:1.5px solid var(--line);
  padding:32px 28px;
  color:var(--fg);
  box-shadow: 0 0 28px rgba(65,119,233,0.35);
  animation: essay-in 260ms ease-out;
  border-radius:16px;
}

/* 닫기 버튼 */
.essay-close{
  position:absolute;
  top:12px;
  right:14px;
  background:none;
  border:none;
  color:var(--fg);
  font-size:1.6rem;
  cursor:pointer;
}

/* 에세이 텍스트 */
.essay-content h1{
  margin-bottom:18px;
  color:var(--spore);
  font-size:1.6rem;
}

.essay-content p{
  margin-bottom:14px;
  line-height:1.65;
  font-size:1rem;
}

/* 등장 애니메이션 */
@keyframes essay-in{
  from{
    transform:translate(-50%, -46%);
    opacity:0;
  }
  to{
    transform:translate(-50%, -50%);
    opacity:1;
  }
}

/* ===== Intro Layer ===== */
body.intro-on{
  overflow: hidden; /* 인트로 동안 스크롤 막기 */
}

#introCanvas{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 5000; /* 최상단 */
  background: #000;
}

.intro-hint{
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 5001;
  color: #aaa;
  font: 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto;
  user-select: none;
  opacity: .85;
}

