:root {
  --bg:        #1a0e2e;
  --bg-card:   #2a1745;
  --bg-card-2: #1f0f33;
  --text:      #ece0d0;
  --text-muted:#9a8ab0;
  --accent:    #d4a8c0;
  --accent-2:  #c89a4d;
  --line:      #4a2d6e;
}
[data-theme="light"] {
  --bg:        #efe4cf;
  --bg-card:   #e2d2b3;
  --bg-card-2: #f3e8d2;
  --text:      #2a1745;
  --text-muted:#5d4a72;
  --accent:    #6e2d6e;
  --accent-2:  #8a5a2b;
  --line:      #b89a64;
}

* { box-sizing: border-box; }
html {
  font-size: 16px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", "Liberation Serif", serif;
  line-height: 1.7;
  font-size: 1rem;
  padding: 2.5rem 1.25rem 4rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* Subtle background grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] body::before {
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 1px);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* Minimal header */
.site-header {
  position: relative; z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1.25rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
  font-family: "Courier New", monospace;
  gap: 1rem;
}
.site-title {
  font-size: 1.2rem;
  font-weight: normal;
  letter-spacing: 0.05em;
  margin: 0;
}
.site-title a {
  color: var(--accent-2);
  font-style: italic;
  font-family: Georgia, serif;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .user-status { color: var(--accent-2); }
.theme-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent-2);
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 2px;
}
.theme-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
}

/* Content */
main {
  position: relative; z-index: 1;
}

/* Post list on home page */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-item {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--line);
}
.post-item:last-child {
  border-bottom: none;
}
.post-date {
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex: 0 0 95px;
}
.post-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: normal;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.post-heading a {
  color: var(--text);
}
.post-heading a:hover {
  color: var(--accent);
  text-decoration: none;
}
.badge-lock {
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  color: var(--accent-2);
  border: 1px solid var(--line);
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
}

/* Post view */
.post-header {
  margin-bottom: 2rem;
}
.post-header h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
  font-weight: normal;
  font-style: italic;
  color: var(--accent);
  line-height: 1.3;
}
.post-meta {
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.post-lead {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--accent-2);
  margin: 1.25rem 0;
  padding-left: 0.85rem;
  border-left: 2px solid var(--line);
}
.post-body {
  margin-top: 1.5rem;
}
.post-body p {
  margin: 0 0 1.25rem;
}
.post-body h2, .post-body h3 {
  font-family: "Courier New", monospace;
  color: var(--accent-2);
  font-weight: normal;
  margin: 2rem 0 0.75rem;
  font-size: 1.15rem;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

/* Code, blockquotes, tables from Markdown */
.post-body pre {
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}
.post-body code {
  font-family: "Courier New", monospace;
  font-size: 0.88em;
  background: var(--bg-card-2);
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
}
.post-body blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-card-2);
  color: var(--text-muted);
  font-style: italic;
}
.post-body blockquote p { margin: 0.4rem 0; }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  display: block;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
}
.post-body th, .post-body td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
}
.post-body th {
  background: var(--bg-card-2);
  color: var(--accent-2);
}
.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

/* Locked post gate */
.gate-box {
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
}
.gate-box p {
  margin: 0 0 0.5rem;
}
.gate-box p:last-child {
  margin-bottom: 0;
}

/* Post navigation */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
}

/* Forms (Login/Register) */
.auth-box {
  max-width: 320px;
  margin: 2rem auto;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
}
.auth-box h2 {
  font-size: 1.1rem;
  color: var(--accent-2);
  margin-bottom: 1rem;
  font-weight: normal;
}
.auth-box label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}
.auth-box input {
  width: 100%;
  padding: 0.55rem;
  margin-bottom: 1rem;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: "Courier New", monospace;
  font-size: 16px;
}
.auth-box button {
  width: 100%;
  padding: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--accent-2);
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
}
.auth-box button:hover {
  background: var(--accent);
  color: var(--bg);
}
.auth-switch {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Minimal footer */
.site-footer {
  position: relative; z-index: 1;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 600px) {
  body {
    padding: 1.25rem 1rem 3rem;
  }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }
  .site-nav {
    width: 100%;
    justify-content: space-between;
    font-size: 0.8rem;
  }
  .post-item {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.6rem 0;
  }
  .post-date {
    font-size: 0.72rem;
    flex: none;
  }
  .post-header h1 {
    font-size: 1.4rem;
  }
}
