:root {
  --bg: #1a1a2e;
  --gold: #c9a959;
  --parchment: #d4c5a9;
  --blood: #8b3a3a;
  --bg-dark: #12121f;
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'IBM Plex Mono', monospace;
  background-color: var(--bg);
  color: var(--parchment);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* CRT scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  z-index: 9999;
}

/* --- Header --- */

header {
  max-width: 700px;
  width: 100%;
  margin: 2rem auto 0;
  padding: 0 1.5rem 1rem;
  border-bottom: 1px solid var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 1rem;
  color: var(--gold);
  text-decoration: none;
}

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

/* --- Hero logo (homepage) --- */

.hero-logo {
  max-width: 700px;
  width: 100%;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  text-align: center;
}

.hero-logo img {
  width: 100%;
  height: auto;
}

header nav {
  display: flex;
  gap: 1rem;
}

header nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

header nav a:hover {
  color: var(--parchment);
}

/* --- Main content --- */

main {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

/* --- Post list (homepage + list pages) --- */

.post-list article {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
}

.post-list time {
  font-size: 0.8rem;
  color: var(--gold);
  opacity: 0.7;
  flex-shrink: 0;
}

.post-list a {
  color: var(--parchment);
  text-decoration: none;
}

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

.post-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blood);
  border: 1px solid var(--blood);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --- Single post --- */

.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--parchment);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-tags a {
  color: var(--blood);
  text-decoration: none;
  font-size: 0.75rem;
}

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

.post-tags a::before {
  content: '#';
}

.post-tags a + a {
  margin-left: 0.3rem;
}

/* --- Post content prose --- */

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: 'Press Start 2P', cursive;
  color: var(--gold);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

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

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

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

.post-content a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content a:hover {
  color: var(--parchment);
}

.post-content ul,
.post-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--parchment);
  opacity: 0.85;
  font-style: italic;
}

.post-content code {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg-dark);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--bg-dark);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid rgba(201, 169, 89, 0.15);
}

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

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

.post-content hr {
  border: none;
  border-top: 1px solid var(--gold);
  opacity: 0.3;
  margin: 2rem 0;
}

/* --- Footer --- */

footer {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
  border-top: 1px solid var(--gold);
  text-align: center;
}

footer p {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: var(--gold);
  opacity: 0.5;
  letter-spacing: 0.1em;
}

/* --- List page heading --- */

main > h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

/* --- Gallery --- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.gallery-item {
  display: block;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.gallery-item:hover {
  border-color: var(--gold);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-caption {
  display: block;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--parchment);
  text-align: center;
  background: var(--bg-dark);
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 0.75rem;
  }

  .post-header h1 {
    font-size: 0.85rem;
  }

  .post-list article {
    flex-direction: column;
    gap: 0.2rem;
  }

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