/* ==========================================================================
   prompt-archive
   프롬프트는 코드에 가깝습니다. 그래서 모든 메타데이터(모델명·비율·복사수·날짜)와
   프롬프트 본문은 모노스페이스로, 사람이 읽는 문장만 Pretendard 로 씁니다.
   이 대비가 이 사이트의 유일한 장식입니다.
   ========================================================================== */

:root {
  --ink:        #16181d;
  --ink-2:      #565c66;
  --ink-3:      #8d949e;
  --paper:      #f1f2f4;
  --surface:    #ffffff;
  --surface-2:  #f7f8f9;
  --line:       #e2e5e9;
  --line-2:     #cfd4da;
  --accent:     #3b2fe0;
  --accent-ink: #ffffff;
  --accent-bg:  #eceafd;
  --ok:         #0e9f6e;
  --danger:     #d92d20;

  --r:      6px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .05), 0 8px 24px rgba(22, 24, 29, .06);

  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #e8eaed;
    --ink-2:      #a0a6b0;
    --ink-3:      #6e757f;
    --paper:      #0e1013;
    --surface:    #17191e;
    --surface-2:  #1d2026;
    --line:       #292d34;
    --line-2:     #3a3f47;
    --accent:     #8b7dff;
    --accent-ink: #12131a;
    --accent-bg:  #221f45;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 상단 바 ---------- */

.bar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.bar__row {
  max-width: 1440px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 20px;
}

.wordmark {
  font-family: var(--mono);
  font-size: 14px; font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  display: flex; align-items: center; gap: 2px;
}
.wordmark span { color: var(--accent); }
.wordmark::after {
  content: '';
  width: 7px; height: 15px;
  background: var(--accent);
  margin-left: 5px;
  animation: caret 1.1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .wordmark::after { animation: none; }
}

.search {
  flex: 1; max-width: 420px;
  position: relative;
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 14px;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); outline: none; }
.search::before {
  content: '⌕';
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-52%);
  color: var(--ink-3); font-size: 17px;
  pointer-events: none;
}
.search kbd {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 1px 5px;
  pointer-events: none;
}
.search input:focus + kbd { display: none; }

.bar__spacer { flex: 1; }

.sort {
  display: flex; gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.sort button {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .02em;
  padding: 7px 12px;
  color: var(--ink-2);
}
.sort button + button { border-left: 1px solid var(--line); }
.sort button[aria-pressed='true'] {
  background: var(--ink); color: var(--paper);
}

.ghost-link {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); text-decoration: none;
  padding: 7px 10px; border-radius: var(--r);
}
.ghost-link:hover { color: var(--accent); background: var(--accent-bg); }

/* ---------- 태그 칩 ---------- */

.chips {
  max-width: 1440px; margin: 0 auto;
  padding: 0 24px 14px;
  display: flex; gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .01em;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  color: var(--ink-2);
  transition: border-color .12s, color .12s;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip[aria-pressed='true'] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.chip b { font-weight: 400; opacity: .5; margin-left: 5px; }

/* ---------- 그리드 (masonry) ---------- */

main { max-width: 1440px; margin: 0 auto; padding: 24px; }

.grid {
  column-count: 5;
  column-gap: 14px;
}
@media (max-width: 1280px) { .grid { column-count: 4; } }
@media (max-width: 980px)  { .grid { column-count: 3; } }
@media (max-width: 700px)  { .grid { column-count: 2; column-gap: 10px; } }
@media (max-width: 420px)  { .grid { column-count: 1; } }

.card {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: zoom-in;
  display: block; width: 100%;
  text-align: left;
}
@media (max-width: 700px) { .card { margin-bottom: 10px; } }

.card img {
  display: block; width: 100%; height: auto;
  background: var(--surface-2);
  transition: transform .35s cubic-bezier(.2,.7,.3,1);
}
.card:hover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) {
  .card img, .card:hover img { transition: none; transform: none; }
}

/* 카드 위에 겹치는 프롬프트 미리보기 — 모달을 열지 않고도 바로 복사할 수 있게. */
.card__veil {
  position: absolute; inset: auto 0 0 0;
  padding: 32px 10px 10px;
  background: linear-gradient(to top, rgba(10,11,14,.92) 40%, rgba(10,11,14,0));
  opacity: 0;
  transition: opacity .18s;
  display: flex; flex-direction: column; gap: 7px;
}
.card:hover .card__veil,
.card:focus-visible .card__veil { opacity: 1; }
@media (hover: none) { .card__veil { opacity: 1; padding-top: 44px; } }

.card__prompt {
  font-family: var(--mono);
  font-size: 10.5px; line-height: 1.45;
  color: rgba(255,255,255,.82);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__foot {
  display: flex; align-items: center; gap: 8px;
}
.card__model {
  font-family: var(--mono); font-size: 10px;
  color: rgba(255,255,255,.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.card__copy {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(255,255,255,.14);
  color: #fff;
  white-space: nowrap;
  transition: background .12s;
}
.card__copy:hover { background: var(--accent); }
.card__copy[data-done='1'] { background: var(--ok); }

/* ---------- 상태 ---------- */

.state {
  padding: 80px 24px; text-align: center;
  color: var(--ink-3);
}
.state h2 {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--ink-2); margin-bottom: 8px;
}
.state p { font-size: 14px; }
.state a { color: var(--accent); }

.sentinel { height: 1px; }

.skeleton {
  border-radius: var(--r);
  background: var(--line);
  margin-bottom: 14px;
  break-inside: avoid;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- 모달 ---------- */

dialog.modal {
  padding: 0; border: none;
  background: transparent;
  max-width: 100%; max-height: 100%;
  width: 100%; height: 100%;
}
dialog.modal::backdrop {
  background: rgba(10, 11, 14, .72);
  backdrop-filter: blur(3px);
}

.modal__inner {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
}
.modal__box {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 380px);
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 100%;
  width: min(1100px, 100%);
}
@media (max-width: 880px) {
  .modal__inner { padding: 0; align-items: stretch; }
  .modal__box { grid-template-columns: 1fr; border-radius: 0; overflow-y: auto; }
}

.modal__media {
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
.modal__media img {
  max-width: 100%; max-height: 82vh;
  object-fit: contain; display: block;
}
@media (max-width: 880px) { .modal__media img { max-height: 52vh; } }

.modal__side {
  padding: 22px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  border-left: 1px solid var(--line);
}
@media (max-width: 880px) { .modal__side { border-left: none; border-top: 1px solid var(--line); } }

.modal__head { display: flex; align-items: flex-start; gap: 12px; }
.modal__title { font-size: 16px; font-weight: 600; flex: 1; line-height: 1.4; }
.modal__close {
  font-family: var(--mono); font-size: 16px;
  color: var(--ink-3);
  width: 28px; height: 28px; border-radius: 4px;
  flex-shrink: 0;
}
.modal__close:hover { background: var(--surface-2); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}

.promptbox {
  font-family: var(--mono);
  font-size: 12px; line-height: 1.65;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow-y: auto;
  color: var(--ink);
}
.promptbox--neg { color: var(--ink-2); }

.btn {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .12s;
}
.btn:hover { opacity: .88; }
.btn[data-done='1'] { background: var(--ok); color: #fff; }
.btn--quiet {
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn--danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }

.spec {
  display: grid; grid-template-columns: auto 1fr;
  gap: 5px 14px;
  font-family: var(--mono); font-size: 11px;
  padding-top: 4px; border-top: 1px solid var(--line);
}
.spec dt { color: var(--ink-3); }
.spec dd { color: var(--ink-2); word-break: break-all; }

.taglist { display: flex; flex-wrap: wrap; gap: 5px; }
.taglist span {
  font-family: var(--mono); font-size: 10px;
  padding: 3px 8px; border-radius: 100px;
  background: var(--accent-bg); color: var(--accent);
}

/* ---------- 토스트 ---------- */

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 90;
  font-family: var(--mono); font-size: 12px;
  padding: 10px 16px; border-radius: 100px;
  background: var(--ink); color: var(--paper);
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast[data-show='1'] { opacity: 1; transform: translate(-50%, 0); }
