/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400..700;1,400..700&display=swap');

:root {
  --bg: #faf5ef;
  --ink: #050301;
  --pad: 2rem;
}

.dark {
  --bg: #050301;
  --ink: #faf5ef;
}

body {
  margin: 0;
  font-family: "Crimson Text", serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

/* FRAME */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  box-shadow: inset 0 0 0 var(--pad) var(--bg);
  z-index: 30;
  pointer-events: none;
}

/* TOP BAR */
.topbar {
  position: fixed;
  top: var(--pad);
  left: var(--pad);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo,
.top-archive {
  font-style: italic;
  font-size: 3rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.top-menu {
  display: flex;
  gap: 1rem;
  margin-left: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.topbar:hover .top-menu {
  opacity: 1;
  pointer-events: auto;
}

.entry {
  font-style: italic;
  font-size: 2rem;
  opacity: 0.5; /* dimmer default */
  cursor: pointer;
}

.entry:hover {
  opacity: 1;
}

/* MENU NAV BUTTONS */
.menu-nav button {
  font-size: 1.5rem;
  margin-left: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

/* BACKGROUND */
#bg-ghosts {
  position: fixed;
  inset: 0;
  padding: var(--pad);
  padding-top: calc(var(--pad) + 4rem);
  z-index: 0;
  display: flex;
  flex-direction: column;
  opacity: 0.8; /* normal dim, subtle ghosts */
  transition: opacity 1s ease; /* smooth dim transition */
}

body.article-open #bg-ghosts {
  opacity: 0.35; /* dim more when article loaded */
}

.bg-row {
  display: flex;
  white-space: nowrap;
  font-style: italic;
  font-size: 3rem;
}

.bg-cell {
  margin-right: 1rem;
  transition: opacity 0.6s ease, color 0.8s ease;
}

/* CARD */
.card {
  position: relative;
  z-index: 10;
  max-width: 1100px;
  width: calc(100% - 6rem);
  margin: 10vh auto;
  padding: 3.5rem;
  background: var(--bg);
  backdrop-filter: blur(16px);
  border-radius: 28px;
  border: 1px solid var(--ink);
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}

/* ARTICLE */
#content {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.1rem;
  line-height: 1.7;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* scrollbar only on scroll */
#content::-webkit-scrollbar {
  width: 8px;
}
#content::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}
#content::-webkit-scrollbar-track {
  background: transparent;
}
#content {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

#content.default {
  opacity: 0.6;
  font-style: italic;
}

#content hr {
  width: 100%;
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid #ccc;
}

#content img {
  display: block;
  max-width: 100%;
  margin: 1rem auto;
  border-radius: 8px;
}

#content p {
  display: block;
  margin: 0.7rem 0;
  line-height: 1.7;
  word-wrap: break-word; /* allow normal wrapping */
}

#content em, 
#content strong, 
#content code, 
#content a {
  display: inline; 
}

#content h1 { font-size: 1.6rem; margin-top: 1rem; text-align:left; }
#content h2 { font-size: 1.3rem; margin-top: 1rem; text-align:left; }
#content a { color: #29042b; text-decoration: underline; }
#content ul { margin-left: 1.5rem; }
#content li { margin-bottom: 0.4rem; }
#content code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 6px; }
#content pre { background: rgba(0,0,0,0.06); padding: 1rem; border-radius: 10px; overflow-x: auto; }
#content blockquote { border-left: 3px solid rgba(0,0,0,0.2); padding-left: 1rem; opacity:0.8; }