:root {
  --bg: #f6f2eb;
  --fg: #1a1816;
  --muted: #6e655e;
  --accent: #8a2be2;
  --accent-dim: #c4a6e3;
  --card: #ffffff;
  --border: #d9d3ca;
  --code-bg: #eeeae3;
  --shadow: rgba(0, 0, 0, 0.08);
  --font-h1: "Emilys Candy", cursive;
  --font-h2: "Life Savers", serif;
  --font-h3: "Unkempt", cursive;
  --font-h4: "Comic Neue", cursive;
  --font-body: "Manjari", sans-serif;
  --font-mono: "SUSE Mono", monospace;
}

/* The monospace webfont name requested doesn't exist on Google Fonts as a direct match.
   "SUSE" is loaded with italic thin; we style it as a mono stack fallback. */
:root {
  --font-mono: "SUSE", "Courier New", monospace;
}

.dark {
  --bg: #12100e;
  --fg: #e8e2da;
  --muted: #a79f96;
  --accent: #b78af7;
  --accent-dim: #5a4570;
  --card: #1c1916;
  --border: #2f2b26;
  --code-bg: #181512;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 9999;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--font-h1);
  font-size: 1.8rem;
  color: var(--fg);
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.main-nav a,
.main-nav button {
  font-family: var(--font-h4);
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
}

.main-nav a:hover { color: var(--accent); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--fg);
  cursor: pointer;
}

/* Layout */
#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  min-height: 70vh;
}

.loader {
  text-align: center;
  font-family: var(--font-h3);
  font-size: 1.4rem;
  color: var(--muted);
  margin-top: 4rem;
}

/* Cards */
.post-list {
  display: grid;
  gap: 2rem;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}

.post-card h2 {
  font-family: var(--font-h2);
  font-weight: 800;
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}

.post-card a { color: inherit; text-decoration: none; }
.post-card a:hover { color: var(--accent); }

.meta {
  font-family: var(--font-mono);
  font-style: italic;
  font-weight: 100;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.excerpt {
  color: var(--muted);
  margin-bottom: 1rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }

.thumb {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: block;
}

/* Filters */
.filters {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.filters input {
  flex: 1 1 240px;
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
}

.filters select {
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
}

/* Article Templates */
.article-header {
  margin-bottom: 2rem;
}

.article-header h1 {
  font-family: var(--font-h1);
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 0.8rem;
}

.article-header h2 {
  font-family: var(--font-h2);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hero-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 2rem;
}

/* Content Blocks */
.content-block {
  margin-bottom: 1.8rem;
}

.content-block p {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.content-block h2 {
  font-family: var(--font-h2);
  font-weight: 700;
  font-size: 1.9rem;
  margin-top: 2.5rem;
}

.content-block h3 {
  font-family: var(--font-h3);
  font-size: 1.5rem;
  margin-top: 2rem;
}

.content-block h4 {
  font-family: var(--font-h4);
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 1.6rem;
}

.content-block img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 1.5rem auto;
}

.image-caption {
  text-align: center;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: -1rem;
}

.content-block blockquote {
  font-family: var(--font-mono);
  font-style: italic;
  font-weight: 100;
  font-size: 1.1rem;
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--muted);
}

.content-block pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  position: relative;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}

.copy-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg);
}

.copy-btn:hover { border-color: var(--accent); }

.content-block ul,
.content-block ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.content-block li { margin-bottom: 0.4rem; }

hr.drift {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 2.5rem 0;
  position: relative;
}

hr.drift::after {
  content: "§";
  position: absolute;
  left: 50%;
  top: -0.7rem;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 0.6rem;
  color: var(--accent);
  font-family: var(--font-h2);
}

/* Template Variants */
.template-creepypasta {
  background: var(--card);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.template-creepypasta .article-header h1 {
  color: #a23b3b;
}

.dark .template-creepypasta .article-header h1 {
  color: #ff7a7a;
}

.template-coding pre {
  background: #1e1e1e;
  color: #d4d4d4;
  border-color: #333;
}

.template-review .rating {
  font-family: var(--font-h2);
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.template-review .review-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
}

.template-review .review-poster {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.template-gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.template-gallery .gallery-grid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0;
}

.template-listicle .numbered {
  counter-reset: item;
  list-style: none;
  padding: 0;
}

.template-listicle .numbered > li {
  counter-increment: item;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.2rem;
}

.template-listicle .numbered > li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-h2);
  font-weight: 800;
}

.template-journal .datestamp {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 1rem;
  display: block;
}

.template-interview .qa-pair {
  margin-bottom: 1.5rem;
}

.template-interview .question {
  font-family: var(--font-h4);
  font-weight: 700;
  color: var(--accent);
}

.template-interview .answer {
  margin-left: 1rem;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
}

.template-compare .compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.template-compare .compare-col {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
}

.template-longform .toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
}

.template-longform .toc h4 {
  margin-top: 0;
}

.template-longform .toc ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Archive & Tags */
.archive-list { list-style: none; padding: 0; }
.archive-list li { margin-bottom: 0.6rem; }
.archive-list a { color: var(--fg); text-decoration: none; }
.archive-list a:hover { color: var(--accent); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tag-cloud .tag { font-size: 0.9rem; }

.page-title {
  font-family: var(--font-h1);
  font-size: 2.5rem;
  margin: 0 0 1.5rem;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Mobile */
@media (max-width: 700px) {
  .menu-toggle { display: block; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.8rem;
  }

  .main-nav.open { display: flex; }

  .template-review .review-grid {
    grid-template-columns: 1fr;
  }

  .template-compare .compare-grid {
    grid-template-columns: 1fr;
  }

  .template-creepypasta,
  .template-review .compare-col {
    padding: 1.2rem;
  }

  #statuscafe {
    padding: .5em;
    background-color: azure;
    border: 1px solid midnightblue;
}
#statuscafe-username {
    margin-bottom: .5em;
}
#statuscafe-content {
    margin: 0 1em 0.5em 1em;
}
}

/* === Link colors === */
a {
  color: var(--accent);
  text-decoration: underline;
}

a:hover {
  color: var(--accent);
}

a:active,
a:focus {
  color: var(--accent-dim);
}

/* Keep nav links using the accent too */
.main-nav a {
  color: var(--accent);
}

.main-nav a:hover {
  color: var(--accent);
}

.main-nav a:active,
.main-nav a:focus {
  color: var(--accent-dim);
}

/* === Scrollbars === */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* === Text selection === */
::selection {
  background: var(--accent);
  color: var(--bg);
}

::-moz-selection {
  background: var(--accent);
  color: var(--bg);
}