/* ══════════════════════════════════════════════
   Talespark Registry — Vercel/Next.js Aesthetic
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap');

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

/* ──── Tokens ──── */
:root {
  --bg: #000000;
  --bg-subtle: #0a0a0a;
  --surface: #111111;
  --surface-hover: #191919;
  --border: hsla(0, 0%, 100%, 0.08);
  --border-hover: hsla(0, 0%, 100%, 0.14);
  --text: #ededed;
  --text-secondary: #a1a1a1;
  --text-muted: #666666;
  --accent: #ededed;
  --accent-blue: #47a3f3;
  --success: #50e3c2;
  --success-bg: hsla(168, 72%, 60%, 0.08);
  --success-border: hsla(168, 72%, 60%, 0.2);
  --error: #ee5a5a;
  --error-bg: hsla(0, 78%, 64%, 0.08);
  --error-border: hsla(0, 78%, 64%, 0.2);
  --warning: #f5a623;
  --warning-bg: hsla(36, 91%, 55%, 0.08);
  --warning-border: hsla(36, 91%, 55%, 0.2);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 1px var(--border);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 1px var(--border-hover);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --duration: 0.2s;
}

/* ──── Base ──── */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover { color: var(--text); }

::selection {
  background: hsla(0, 0%, 100%, 0.15);
  color: #fff;
}

/* ──── Page animation ──── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin { to { transform: rotate(360deg); } }

.container, .container-wide {
  animation: fadeUp 0.5s var(--ease) both;
}

/* ──── Layout ──── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* ──── Header ──── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

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

/* ──── Cards ──── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.card h2 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.card-link {
  display: block;
  text-decoration: none;
  position: relative;
  transition: border-color var(--duration) var(--ease),
              box-shadow 0.3s var(--ease),
              transform 0.3s var(--ease);
}

.card-link h2 {
  transition: color var(--duration) var(--ease);
}

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

.card-link:hover h2 {
  color: #fff;
}

/* Card arrow indicator */
.card-link::after {
  content: '\2192';
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 1rem;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease), transform 0.3s var(--ease);
}

.card-link:hover::after {
  color: var(--text);
  transform: translateX(2px);
}

/* ──── Forms ──── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row .form-group { flex: 1; margin-bottom: 0; }

input, select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              background var(--duration) var(--ease);
}

input::placeholder { color: var(--text-muted); }

input:focus, select:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 2px hsla(0, 0%, 100%, 0.04);
  background: var(--bg-subtle);
}

small {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ──── Buttons ──── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  letter-spacing: -0.01em;
}

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

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 2px 12px rgba(255,255,255,0.1);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error-border);
}

.btn-danger:hover {
  background: var(--error-bg);
  border-color: var(--error);
}

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

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ──── Messages ──── */
.msg {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: none;
  line-height: 1.5;
}

.msg.show { display: block; }

.msg-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.msg-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

/* ──── Config Blocks ──── */
.config-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.config-body {
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
}

.btn-copy {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: var(--font);
}

.btn-copy.copied {
  color: var(--success);
  border-color: var(--success-border);
}

/* ──── Table ──── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td { color: var(--text-secondary); }

tr:hover td {
  color: var(--text);
  background: var(--bg-subtle);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* ──── Loading ──── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ──── Utilities ──── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ──── Page-specific: Home ──── */
.home-hero {
  padding: 64px 0 0;
  text-align: center;
  animation: fadeUp 0.6s var(--ease) both;
}

.home-hero h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  color: #fff;
}

.home-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.home-cards {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  animation: fadeUp 0.6s 0.1s var(--ease) both;
}

.home-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  animation: fadeIn 0.6s 0.3s var(--ease) both;
}

.home-footer a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color var(--duration), border-color var(--duration);
}

.home-footer a:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* ──── Stagger children ──── */
.stagger > *:nth-child(1) { animation: fadeUp 0.5s 0.05s var(--ease) both; }
.stagger > *:nth-child(2) { animation: fadeUp 0.5s 0.1s var(--ease) both; }
.stagger > *:nth-child(3) { animation: fadeUp 0.5s 0.15s var(--ease) both; }
.stagger > *:nth-child(4) { animation: fadeUp 0.5s 0.2s var(--ease) both; }
.stagger > *:nth-child(5) { animation: fadeUp 0.5s 0.25s var(--ease) both; }

/* ──── Responsive ──── */
@media (max-width: 860px) {
  .home-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .form-row { flex-direction: column; }
  .container, .container-wide { padding: 32px 16px; }
  .header h1 { font-size: 1.1rem; }
  .home-hero h1 { font-size: 1.5rem; }
  .home-cards { grid-template-columns: 1fr; }
}
