:root {
  --ink: #f6f0d0;
  --ink-muted: #d3caa0;
  --bg-deep: #0b0f2b;
  --bg-mid: #141a3a;
  --bg-accent: #2a1b4a;
  --gold: #f1c96b;
  --amber: #ffdd86;
  --violet: #7b4ab4;
  --violet-dark: #3f1e6b;
  --blue-glow: #4a77ff;
  --card: rgba(16, 19, 43, 0.72);
  --card-border: rgba(241, 201, 107, 0.28);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --serif: "Cinzel", "Garamond", "Times New Roman", serif;
  --display: "Uncial Antiqua", "Palatino Linotype", "Garamond", serif;
  --sans: "Alegreya Sans", "Optima", "Candara", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(74, 119, 255, 0.18), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(123, 74, 180, 0.22), transparent 45%),
    radial-gradient(circle at 30% 80%, rgba(241, 201, 107, 0.15), transparent 40%),
    linear-gradient(160deg, var(--bg-deep), var(--bg-mid) 45%, var(--bg-accent));
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("images/constellation.svg");
  opacity: 0.25;
  z-index: -1;
  pointer-events: none;
}

a {
  color: var(--amber);
  text-decoration: none;
}

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

img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(10, 12, 30, 0.7);
  border-bottom: 1px solid rgba(241, 201, 107, 0.2);
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 1px;
}

.logo img {
  width: 36px;
  height: 36px;
}

.nav-links {
  display: flex;
  gap: 18px;
  font-weight: 600;
}

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: center;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.hero-card h1 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 3.5vw, 3.4rem);
  margin: 0 0 16px;
}

.hero-card p {
  color: var(--ink-muted);
  line-height: 1.6;
}

.hero-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.hero-crest img {
  width: min(320px, 90%);
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 70px;
}

.section h2 {
  font-family: var(--serif);
  font-size: 26px;
  margin-bottom: 16px;
}

.controls {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(241, 201, 107, 0.35);
  background: rgba(15, 18, 36, 0.7);
  color: var(--ink);
  font-size: 15px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(241, 201, 107, 0.3);
  background: rgba(43, 25, 73, 0.65);
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag.active {
  background: rgba(241, 201, 107, 0.22);
  color: var(--gold);
  border-color: rgba(241, 201, 107, 0.6);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border 0.2s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(241, 201, 107, 0.7);
}

.card-image {
  height: 160px;
  background-size: cover;
  background-position: center;
}

.card-body {
  padding: 18px 20px 24px;
}

.card-body h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 20px;
}

.card-body p {
  margin: 0 0 16px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.article {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.article-hero {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(241, 201, 107, 0.35);
}

.article-title {
  font-family: var(--display);
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  margin: 0 0 12px;
}

.article-meta {
  color: var(--ink-muted);
  margin-bottom: 26px;
}

.article-content {
  background: rgba(12, 14, 34, 0.75);
  border: 1px solid rgba(241, 201, 107, 0.2);
  border-radius: var(--radius);
  padding: 28px;
  line-height: 1.7;
  box-shadow: var(--shadow);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: var(--serif);
  color: var(--gold);
}

.article-content blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 14px;
  color: var(--ink-muted);
  margin: 20px 0;
}

.article-content code {
  background: rgba(241, 201, 107, 0.15);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: "Fira Mono", "Courier New", monospace;
  color: var(--amber);
}

.article-content pre {
  background: rgba(9, 10, 24, 0.85);
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid rgba(241, 201, 107, 0.3);
}

.footer {
  text-align: center;
  padding: 30px 24px 50px;
  color: var(--ink-muted);
  font-size: 13px;
}

.fade-up {
  animation: fadeUp 0.7s ease both;
}

.stagger > * {
  animation: fadeUp 0.7s ease both;
}

.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.16s; }
.stagger > *:nth-child(4) { animation-delay: 0.24s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
