/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --fg: #e0e0e0;
  --fg-dim: #888;
  --fg-bright: #fff;
  --accent: #6ec1e4;
  --accent-2: #e4a06e;
  --accent-3: #a0e46e;
  --accent-4: #e46ea0;
  --accent-5: #c16ee4;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--fg-bright);
}

/* ===== Header ===== */
.site-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #222;
}

.site-header nav {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

.site-title:hover {
  color: var(--fg-bright);
}

.nav-links a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-left: 1.5rem;
  letter-spacing: 0.05em;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--fg-bright);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 3rem 2rem 1rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--fg-dim);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.tagline {
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ===== Word Cloud ===== */
.wordcloud {
  max-width: 800px;
  margin: 2rem auto 4rem;
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.8rem 1.2rem;
}

.tag-word {
  font-family: var(--mono);
  color: var(--fg);
  transition: all 0.2s ease;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

/* Rotate through accent colours */
.tag-word:nth-child(5n+1) { color: var(--accent); }
.tag-word:nth-child(5n+2) { color: var(--accent-2); }
.tag-word:nth-child(5n+3) { color: var(--accent-3); }
.tag-word:nth-child(5n+4) { color: var(--accent-4); }
.tag-word:nth-child(5n+5) { color: var(--accent-5); }

.tag-word:hover {
  color: var(--fg-bright) !important;
  background: #1a1a1a;
}

.random-btn {
  color: var(--fg-dim) !important;
  font-style: italic;
  border: 1px dashed #333;
}

.random-btn:hover {
  color: var(--fg-bright) !important;
  border-color: var(--fg-dim);
  background: #1a1a1a;
}

/* ===== Tooltip ===== */
.tooltip {
  position: absolute;
  background: #1a1a1a;
  border: 1px solid #333;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  max-width: 250px;
  line-height: 1.5;
}

.tooltip.visible {
  opacity: 1;
}

/* ===== Content Pages ===== */
.content-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.content-page h1 {
  font-family: var(--mono);
  font-size: 1.6rem;
  color: var(--fg-bright);
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ===== Post List ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  grid-template-rows: auto auto;
  gap: 0 1rem;
  align-items: baseline;
}

.post-item time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
  grid-row: 1;
}

.post-item > a {
  font-size: 1rem;
  grid-row: 1;
}

.post-item .post-tags {
  grid-column: 2;
  grid-row: 2;
}

/* ===== Single Post ===== */
.post-header {
  margin-bottom: 2rem;
}

.post-header time {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  display: block;
  margin-top: 0.5rem;
}

.post-content {
  font-size: 1rem;
  line-height: 1.8;
}

.post-content h2 {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--fg-bright);
  margin: 2rem 0 0.75rem;
}

.post-content h3 {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--fg-bright);
  margin: 1.5rem 0 0.5rem;
}

.post-content p {
  margin-bottom: 1rem;
}

.post-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.post-content code {
  font-family: var(--mono);
  background: #1a1a1a;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-content pre {
  background: #111;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content blockquote {
  border-left: 2px solid #333;
  padding-left: 1rem;
  color: var(--fg-dim);
  margin: 1.5rem 0;
}

/* ===== Tags ===== */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.post-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-dim);
  border: 1px solid #333;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.post-tag:hover {
  color: var(--fg-bright);
  border-color: var(--fg-dim);
}

/* ===== Post Footer ===== */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #222;
}

.post-footer a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* ===== Site Footer ===== */
.site-footer {
  margin-top: auto;
  padding: 2rem;
  border-top: 1px solid #222;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.footer-copy {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #444;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .site-header {
    padding: 1rem;
  }

  .site-header nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-links a {
    margin-left: 0.75rem;
  }

  .hero {
    padding: 2rem 1rem 0.5rem;
  }

  .wordcloud {
    padding: 1rem;
    gap: 0.6rem 0.8rem;
  }

  .content-page {
    padding: 2rem 1rem;
  }

  .post-item {
    grid-template-columns: 1fr;
  }

  .post-item time {
    font-size: 0.75rem;
  }
}
