/* ============================================================
   Lunarian Database — standalone styles.
   Deliberately self-contained: this site is served from /lunarian/
   via hostname routing, so it shares no CSS with the comic site.
   ============================================================ */

:root {
  --bg:          #14101f;
  --bg-soft:     #1e1830;
  --bg-card:     #241d3a;
  --ink:         #ece8f6;
  --ink-soft:    #a396c4;
  --purple:      #4b2e83;
  --purple-deep: #2e1a52;
  --moon:        #cfd8ff;
  --moon-bright: #eef2ff;
  --amber:       #ffb43c;
  --line:        #362c55;
  --radius:      16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  scroll-behavior: smooth;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- Header ---- */
.site-header {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 54px 24px 40px;
  background:
    radial-gradient(circle at 50% -20%, rgba(207, 216, 255, 0.22), transparent 60%),
    linear-gradient(160deg, var(--purple) 0%, var(--purple-deep) 55%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

/* Faint moon disc behind the title */
.site-header::after {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 242, 255, 0.16), transparent 68%);
  pointer-events: none;
}

/* "Back to the Comic" pill — sits over the header, above the moon glow */
.back-link {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(36, 29, 58, 0.82);
  color: var(--moon);
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.back-link:hover {
  background: var(--purple);
  border-color: var(--moon);
  color: var(--moon-bright);
  transform: translateX(-2px);
}

.back-link svg { flex-shrink: 0; }

.site-title {
  position: relative;
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--moon-bright), var(--moon));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-tagline {
  position: relative;
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ---- Search ---- */
.search-wrap {
  position: relative;
  max-width: 520px;
  margin: 26px auto 0;
}

.search-wrap input {
  width: 100%;
  padding: 13px 18px 13px 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 16, 31, 0.75);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input::placeholder { color: var(--ink-soft); }

.search-wrap input:focus {
  outline: none;
  border-color: var(--moon);
  box-shadow: 0 0 0 3px rgba(207, 216, 255, 0.14);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
  line-height: 0;
}

/* ---- Layout ---- */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 44px 24px 90px;
}

.category { margin-bottom: 46px; }

.category-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}

.category-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--moon-bright);
  letter-spacing: 0.03em;
}

.category-heading .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.category-heading .count {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---- Link cards ---- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.link-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.link-card:hover {
  transform: translateY(-3px);
  border-color: var(--moon);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.link-card .name {
  font-weight: 700;
  color: var(--moon-bright);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.link-card .desc {
  font-size: 0.87rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.link-card.external .name::after {
  content: "↗";
  font-size: 0.8rem;
  opacity: 0.65;
}

/* Shown when a search matches nothing */
.no-results {
  display: none;
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 24px 44px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.87rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer-links a {
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.footer-links a:hover {
  background: var(--purple);
  border-color: var(--moon);
  transform: translateY(-2px);
}

/* ---- Mobile ---- */
@media only screen and (max-width: 768px) {
  .site-header { padding: 20px 16px 30px; }

  /* Let the button sit in the flow so it can't overlap the title */
  .back-link {
    position: static;
    margin: 0 auto 22px;
    display: inline-flex;
  }
  main { padding: 32px 16px 70px; }
  .link-grid { grid-template-columns: 1fr; }
  .category { margin-bottom: 34px; }
}
