/* ============================================
   DAKIAS DEX — shared stylesheet
   A bestiary/grimoire aesthetic: dark void
   background, parchment folios, ink & gold.
   ============================================ */

:root {
  --void: #0d0a13;
  --void-deep: #07050a;
  --parchment: #e8dfc4;
  --parchment-shadow: #cbbd92;
  --ink: #241a1f;
  --wine: #6d1f2c;
  --wine-bright: #8f2c3a;
  --gold: #a9803f;
  --gold-bright: #c99f4f;

  --font-display: 'Cinzel', serif;
  --font-body: 'EB Garamond', serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #18101f 0%, var(--void) 55%, var(--void-deep) 100%);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

/* ---------- header (index page) ---------- */

.dex-header {
  text-align: center;
  padding: 3.5rem 1.5rem 1.5rem;
}

.dex-header .sigil {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  color: var(--gold-bright);
}

.dex-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--parchment);
}

.dex-header .subtitle {
  font-style: italic;
  color: var(--parchment-shadow);
  margin: 0.6rem 0 0;
  font-size: 1.05rem;
}

/* ---------- ornamental divider ---------- */

.divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: min(340px, 70%);
  margin: 1.5rem auto 2.5rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold);
  opacity: 0.6;
}

.divider .gem {
  width: 7px;
  height: 7px;
  background: var(--gold-bright);
  transform: rotate(45deg);
  flex: none;
}

/* ---------- search / controls ---------- */

.controls {
  display: flex;
  justify-content: center;
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
}

.controls input {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.03);
  border: none;
  border-bottom: 1px solid var(--gold);
  color: var(--parchment);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  padding: 0.6rem 0.25rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.controls input::placeholder { color: var(--parchment-shadow); }
.controls input:focus { border-color: var(--gold-bright); }

/* ---------- folio grid (index page) ---------- */

.grimoire-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.folio {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--parchment);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--gold);
  padding: 1.75rem 1rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.folio-number {
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  font-style: italic;
  font-size: 0.75rem;
  color: var(--wine);
}

.folio-art {
  width: 56px;
  height: 56px;
  margin-bottom: 0.85rem;
  color: var(--wine);
}

.folio-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  margin: 0 0 0.6rem;
  text-align: center;
}

.folio-type {
  font-variant: small-caps;
  font-size: 0.9rem;
  padding: 0.1rem 0.65rem;
  border: 1px solid currentColor;
}

.folio:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  border-color: var(--wine);
}

/* type colors — muted jewel tones, not cartoon-saturated */
.type-ghost  { color: #4f3a63; }
.type-dragon { color: #6d1f2c; }
.type-fire   { color: #8a4a1f; }
.type-fairy  { color: #8a4a63; }
.type-grass  { color: #3f5a3a; }
.type-flying { color: #395366; }
.type-electric { color: #8a6d1f; }

/* ---------- individual entry page ---------- */

.back-link {
  display: inline-block;
  margin: 1.5rem 0 0 1.5rem;
  font-style: italic;
  color: var(--parchment-shadow);
  text-decoration: none;
}
.back-link:hover { color: var(--gold-bright); }

.entry {
  max-width: 620px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.entry-header { text-align: center; }

.entry-number {
  font-style: italic;
  color: var(--gold-bright);
  font-size: 0.95rem;
}

.entry-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  letter-spacing: 0.04em;
  margin: 0.3rem 0 0.9rem;
}

.entry-types { display: flex; justify-content: center; gap: 0.6rem; }

.entry-frame {
  position: relative;
  max-width: 320px;
  margin: 2.25rem auto;
  padding: 0.6rem;
  border: 1px solid var(--gold);
}

.entry-frame::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid var(--wine);
  pointer-events: none;
}

.entry-art {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  color: var(--wine);
}

.entry-flavor {
  font-style: italic;
  text-align: center;
  color: var(--parchment);
  max-width: 58ch;
  margin: 2rem auto;
  line-height: 1.75;
}

.entry-stats {
  max-width: 400px;
  margin: 2.5rem auto;
}

.entry-stats h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.09em;
  text-align: center;
  color: var(--gold-bright);
  margin: 0 0 1.1rem;
  font-weight: 500;
}

.stat-row {
  display: grid;
  grid-template-columns: 64px 1fr 34px;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.stat-label { font-variant: small-caps; color: var(--parchment-shadow); font-size: 0.95rem; }

.stat-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
}

.stat-fill {
  height: 100%;
  width: var(--val);
  background: linear-gradient(to right, var(--wine), var(--gold-bright));
}

.stat-val { text-align: right; font-size: 0.9rem; color: var(--parchment); }

.entry-meta {
  display: flex;
  justify-content: center;
  gap: 2.25rem;
  flex-wrap: wrap;
  margin-top: 2.25rem;
}

.entry-meta div { text-align: center; }

.meta-label {
  display: block;
  font-variant: small-caps;
  font-size: 0.85rem;
  color: var(--gold-bright);
  margin-bottom: 0.15rem;
}

footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-style: italic;
  color: var(--parchment-shadow);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .folio { transition: none; }
}