/* ===========================
   Global Variables
   =========================== */
:root {
  --bg: #0a192f;
  --surface: #112240;
  --text: #e6f1ff;
  --muted: #a8b2d1;
  --accent: #64ffda;
  --border: rgba(100, 255, 218, 0.12);
  --radius: 12px;
  --shadow: 0 10px 30px rgba(2, 12, 27, 0.6);
  
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Inter, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(
      1200px 800px at 10% -20%,
      rgba(100, 255, 218, 0.08),
      transparent 50%
    ),
    var(--bg);
  line-height: 1.6;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

/* ===========================
   Header & Navigation
   =========================== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  background: rgba(1, 22, 39, 0.95);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1100px;
  margin: auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.brand {
  font-weight: 700;
}

.links {
  display: flex;
  gap: 14px;
}

.links a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  transition: color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(100, 255, 218, 0.15);
  background: rgba(100, 255, 218, 0.06);
}

/* ===========================
   Layout Container
   =========================== */
.container {
  max-width: 1100px;
  margin: auto;
  padding: 24px 16px 64px;
  text-align: center;
}

.cards-intro {
  margin: 12px auto 22px;
  max-width: 72ch;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.95;
  padding-bottom: 6px;
  text-align: center;
}

@media (min-width: 768px) {
  .cards-intro {
    box-shadow: 0 2px 0 rgba(100, 255, 218, 0.08);
  }
}

/* ===========================
   Card Grid
   =========================== */
.grid {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

@media (min-width: 1100px) {
  .grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 32px;
  }
}

/* ===========================
   Cards
   =========================== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
  cursor: pointer;
  text-align: center;
}

.card:hover {
  box-shadow: 0 0 0 1px rgba(100, 255, 218, 0.2), var(--shadow);
}

.cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
}

.body {
  padding: 14px;
}

/* Meta & Title */
.meta {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.h2 {
  font-size: 1.1rem;
  margin: 8px 0 6px;
}

.excerpt {
  color: var(--muted);
  margin: 0;
}

/* ===========================
   Tags
   =========================== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  background: rgba(100, 255, 218, 0.08);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(100, 255, 218, 0.4);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background: rgba(100, 255, 218, 0.15);
  color: #ffffff;
}

.modal {
  display: none;
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: flex-start;
  z-index: 999;
  text-align: center;
}

.modal-content {
  position: relative;
  top: 80px; /* offset below header */
  margin: 0 auto;
  max-width: 640px;
  max-height: calc(90vh - 80px); /* account for header */
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
}



/* Styled scrollbar */
.modal-content::-webkit-scrollbar {
  width: 10px;
}
.modal-content::-webkit-scrollbar-track {
  background: rgba(17, 34, 64, 0.8);
  border-radius: var(--radius);
}
.modal-content::-webkit-scrollbar-thumb {
  background-color: var(--accent);
  border-radius: var(--radius);
  border: 2px solid rgba(17, 34, 64, 0.8);
}
.modal-content::-webkit-scrollbar-thumb:hover {
  background-color: #52eac8;
}

/* Close button */
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--muted);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover,
.close:focus-visible {
  color: var(--accent);
}


/* Modal content elements */
.modal-cover {
  max-width: 560px;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 12px;
  text-align: center;
}

.modal-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

#modalTags {
  margin-bottom: 12px;
}

.modal-content h2 {
  margin: 6px 0 12px;
  font-size: clamp(20px, 3.2vw, 28px);
  text-align: center;
}

.modal-content p,
.modal-content ul,
.modal-content pre {
  margin: 0 0 12px;
}

/* ===========================
   Code Blocks
   =========================== */
pre {
  background: #0b1a30;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
}

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #b8ffe9;
}
