/* =========================================================
   Great Gnome Hunt — Shared Stylesheet
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,700;1,9..144,400&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --blue:        #2563eb;
  --blue-light:  #38bdf8;
  --blue-dim:    #eef2ff;
  --blue-text:   #4338ca;
  --dark:        #111827;
  --mid:         #374151;
  --muted:       #6b7280;
  --faint:       #9ca3af;
  --border:      #e5e7eb;
  --surface:     #f9fafb;
  --card:        #ffffff;
  --bg:          #f3f4f6;
  --green:       #22c55e;
  --red:         #b91c1c;

  --radius-card: 20px;
  --radius-sm:   12px;
  --radius-pill: 999px;

  --shadow-card: 0 4px 20px rgba(0,0,0,0.07);
  --shadow-btn:  0 2px 8px rgba(37,99,235,0.25);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue:        #3b82f6;
    --blue-light:  #7dd3fc;
    --blue-dim:    #1e3a5f;
    --blue-text:   #93c5fd;
    --dark:        #f9fafb;
    --mid:         #d1d5db;
    --muted:       #9ca3af;
    --faint:       #6b7280;
    --border:      #374151;
    --surface:     #1f2937;
    --card:        #111827;
    --bg:          #0f172a;
    --green:       #4ade80;
    --red:         #f87171;
    --shadow-card: 0 4px 20px rgba(0,0,0,0.4);
  }
}

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

body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 540px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ── Card ─────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 22px 20px 26px;
  box-shadow: var(--shadow-card);
}

/* ── Pill badge ───────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--blue-dim);
  color: var(--blue-text);
  border-radius: var(--radius-pill);
  padding: 5px 10px;
  margin-bottom: 14px;
  letter-spacing: 0.01em;
}
.pill-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* ── Hero gradient banner ─────────────────────── */
.hero {
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: #fff;
  padding: 18px 16px;
  margin-bottom: 20px;
}
.hero-title  { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.hero-text   { font-size: 13px; opacity: .93; margin: 0 0 10px; line-height: 1.55; }
.hero-note   { font-size: 11px; opacity: .85; margin: 8px 0 0; }
.hero-cta    { display: flex; gap: 8px; margin-top: 12px; }
.hero-button {
  flex: 1;
  text-align: center;
  background: rgba(255,255,255,0.92);
  color: var(--dark);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 9px 10px;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.hero-button:hover { background: #fff; transform: translateY(-1px); }
@media (max-width: 360px) { .hero-cta { flex-direction: column; } }

/* ── Section title ────────────────────────────── */
.section-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 10px;
}

/* ── Search ───────────────────────────────────── */
.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.search-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--dark);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ── Gnome list (index page) ──────────────────── */
.gnome-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.gnome-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 11px 13px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  border: 1.5px solid transparent;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.gnome-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 12px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}
.gnome-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.gnome-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gnome-main { flex: 1; min-width: 0; }
.gnome-name-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.gnome-name  { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gnome-id-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue-text);
  background: var(--blue-dim);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.gnome-tagline { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Gnome detail page ────────────────────────── */
.detail-id {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 4px;
}
.detail-name {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.15;
}
.detail-tagline {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 10px;
  line-height: 1.5;
}
.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mid);
  margin-bottom: 14px;
}
.color-swatch {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.gnome-photo {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface);
  display: block;
  margin-bottom: 18px;
}
.gnome-photo-placeholder {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 18px;
  border: 2px dashed var(--border);
}
.story {
  font-size: 15px;
  line-height: 1.65;
  color: var(--mid);
  margin-bottom: 22px;
}

/* ── Buttons ──────────────────────────────────── */
.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.btn {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}
.btn:hover  { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-secondary {
  background: var(--dark);
  color: var(--card);
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 14px;
  transition: color .15s;
}
.btn-back:hover { color: var(--blue); }

/* ── Utility ──────────────────────────────────── */
.hint   { font-size: 12px; color: var(--faint); text-align: center; margin-top: 6px; line-height: 1.5; }
.footer { margin-top: 14px; text-align: center; font-size: 11px; color: var(--faint); letter-spacing: 0.02em; }
.loading { font-size: 13px; color: var(--muted); text-align: center; padding: 12px 0; }
.empty  { font-size: 13px; color: var(--muted); text-align: center; padding: 16px 0; }
.error  { font-size: 13px; color: var(--red);   text-align: center; padding: 16px 0; }
.count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 8px;
}
