/* sky/prompts — design tokens */
:root {
  --paper: #faf8f4;
  --surface: #ffffff;
  --surface-soft: #f3efe8;
  --ink: #1d1a16;
  --ink-soft: #6f675e;
  --ink-faint: #a39a8e;
  --line: #e7e1d6;
  --line-strong: #d8d0c2;
  --accent: #1e6b4a;
  --accent-deep: #155239;
  --accent-soft: #e3efe8;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --radius-outer: 16px;
  --radius-inner: 10px;
  --shadow-card: 0 1px 2px rgba(29, 26, 22, 0.05), 0 4px 16px rgba(29, 26, 22, 0.05);
  --shadow-lift: 0 2px 4px rgba(29, 26, 22, 0.06), 0 12px 28px rgba(29, 26, 22, 0.1);
  --shadow-modal: 0 8px 24px rgba(29, 26, 22, 0.16), 0 24px 64px rgba(29, 26, 22, 0.2);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

::selection { background: var(--accent-soft); }

/* ---------- layout ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  text-wrap: balance;
}
.wordmark-slash { color: var(--accent); }

.tagline {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 52ch;
  text-wrap: pretty;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  height: 44px;
  min-width: 240px;
  transition-property: border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon { color: var(--ink-faint); flex: none; }
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  width: 100%;
  color: var(--ink);
}
.search input::placeholder { color: var(--ink-faint); }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition-property: transform, background-color, border-color, color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-copied { background: var(--accent-soft); color: var(--accent-deep); border-color: transparent; }

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
  transition-property: background-color, color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 8px;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  appearance: none;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition-property: background-color, border-color, color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:active { transform: scale(0.96); }
.chip[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.count {
  margin: 0;
  color: var(--ink-faint);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.count span { color: var(--ink-soft); font-weight: 700; }

/* ---------- grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-outer);
  padding: 20px;
  box-shadow: var(--shadow-card);
  animation: rise 420ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition-property: transform, box-shadow, border-color;
  transition-duration: 180ms;
  transition-timing-function: ease-out;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 9px;
}
.card-admin { display: none; gap: 4px; }
body.admin .card-admin { display: inline-flex; }
.mini-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 4px 9px;
  min-height: 30px;
  cursor: pointer;
  transition-property: background-color, color, border-color, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.mini-btn:hover { color: var(--ink); border-color: var(--ink); }
.mini-btn:active { transform: scale(0.94); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.card-title {
  margin: 14px 0 6px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.card-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  text-wrap: pretty;
}
.card-preview {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}
.card-foot .btn { flex: 1; }

/* ---------- empty states ---------- */
.empty {
  text-align: center;
  padding: 72px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-outer);
  margin-top: 16px;
  animation: rise 420ms var(--ease-out) both;
}
.empty-title { margin: 0; font-size: 18px; font-weight: 700; }
.empty-text { margin: 8px auto 0; color: var(--ink-soft); max-width: 52ch; text-wrap: pretty; }
.empty .btn { margin-top: 18px; }

/* ---------- footer ---------- */
.footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
}
.footer p { margin: 4px 0; }
.footer-note { color: var(--ink-faint); font-size: 13px; }


/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 16px;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 26, 22, 0.45);
  animation: fade 160ms ease-out both;
}
.modal-panel {
  position: relative;
  width: min(680px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-outer);
  box-shadow: var(--shadow-modal);
  padding: 24px;
  animation: rise 240ms var(--ease-out) both;
}
.modal-panel-narrow { width: min(420px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-cat {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.modal-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.modal-desc { margin: 10px 0 0; color: var(--ink-soft); text-wrap: pretty; }
.prompt-code {
  margin: 18px 0 0;
  padding: 16px 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 52vh;
  overflow-y: auto;
  outline: 1px solid rgba(0, 0, 0, 0.04);
  outline-offset: -1px;
}
.modal-foot {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ---------- form ---------- */
.form { margin-top: 18px; }
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.field-hint { color: var(--ink-faint); font-weight: 400; }
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-inner);
  background: var(--surface);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 10px 12px;
  outline: 0;
  transition-property: border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.field textarea {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  resize: vertical;
  min-height: 180px;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-error {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  pointer-events: none;
  transition-property: opacity, transform;
  transition-duration: 200ms;
  transition-timing-function: ease-out;
  z-index: 60;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---------- motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .page { padding: 28px 16px 140px; }
  .wordmark { font-size: 24px; }
  .search { min-width: 0; flex: 1; }
  .top-actions { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 24px 12px 12px; }
  .modal-panel { padding: 20px 16px; }
  .publish-actions input { width: 100%; }
}

/* ---------- dashboard (admin.html) ---------- */
.footer-admin { color: var(--ink-faint); text-decoration: none; }
.footer-admin:hover { color: var(--ink); }

.pin-wrap {
  display: flex;
  justify-content: center;
  padding: 64px 0 32px;
}
.pin-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-outer);
  box-shadow: var(--shadow-card);
  padding: 28px;
  animation: rise 420ms var(--ease-out) both;
}
.pin-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.pin-text { margin: 6px 0 0; color: var(--ink-soft); font-size: 14.5px; }
.pin-card .form { margin-top: 20px; }
.pin-card .btn { width: 100%; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-outer);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  animation: rise 420ms var(--ease-out) both;
}
.stat-card:nth-child(2) { animation-delay: 45ms; }
.stat-card:nth-child(3) { animation-delay: 90ms; }
.stat-num {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-num.stat-status { font-size: 22px; padding-top: 4px; }
.stat-num.is-dirty { color: #9a6b00; }
.stat-label { margin: 6px 0 0; color: var(--ink-soft); font-size: 13.5px; }

.dash-section { margin-top: 40px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.row-list { margin-top: 16px; }
.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-outer);
  box-shadow: var(--shadow-card);
  padding: 16px 20px;
  margin-bottom: 10px;
  animation: rise 420ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition-property: transform, box-shadow, border-color;
  transition-duration: 180ms;
  transition-timing-function: ease-out;
}
.row-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}
.row-main { min-width: 0; }
.row-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row-desc {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}
.row-actions { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.pub-card {
  margin-top: 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-outer);
  padding: 22px 24px;
  box-shadow: var(--shadow-modal);
  animation: rise 420ms var(--ease-out) both;
}
.pub-status { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; }
.pub-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb97f;
  flex: none;
}
.pub-note {
  margin: 10px 0 0;
  color: rgba(250, 248, 244, 0.65);
  font-size: 13.5px;
  text-wrap: pretty;
}
.pub-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pub-actions input {
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(250, 248, 244, 0.25);
  background: rgba(250, 248, 244, 0.08);
  color: var(--paper);
  font: inherit;
  font-size: 13.5px;
  padding: 0 14px;
  width: 220px;
  outline: 0;
}
.pub-actions input::placeholder { color: rgba(250, 248, 244, 0.55); }
.pub-actions input:focus { border-color: rgba(250, 248, 244, 0.6); }
.pub-card .btn-ghost {
  background: transparent;
  border-color: rgba(250, 248, 244, 0.35);
  color: var(--paper);
}
.pub-card .btn-ghost:hover { border-color: var(--paper); }
.pub-card .btn-danger-ghost { color: #f3a9a4; }
.pub-card .btn-danger-ghost:hover { background: rgba(179, 38, 30, 0.25); }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .row-item { flex-direction: column; align-items: flex-start; }
  .row-desc { max-width: none; white-space: normal; }
  .pub-actions input { width: 100%; }
}
