/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
  --bg:          #0e0c0a;
  --bg2:         #141210;
  --bg3:         #1c1916;
  --border:      #2a2520;
  --border-lit:  #3d3630;
  --text:        #e8e0d4;
  --text-muted:  #7a7068;
  --text-dim:    #4a4540;
  --accent:      #c8a96e;       /* warm gold — ink on old paper */
  --accent-dim:  #7a6540;
  --red:         #c26060;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --radius:       4px;
  --max-w:        720px;
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, button, textarea { font-family: inherit; }

/* ─── UTILITIES ──────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border-lit);
  padding: 48px 40px;
  max-width: 380px; width: 90%;
  text-align: center;
  border-radius: var(--radius);
}
.modal-ink {
  font-size: 28px; color: var(--accent);
  margin-bottom: 16px;
  display: block;
}
.modal-box h2 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400;
  margin-bottom: 8px;
}
.modal-box p {
  color: var(--text-muted); font-size: 13px;
  margin-bottom: 28px; line-height: 1.6;
}
.modal-box input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border-lit);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-box input:focus { border-color: var(--accent); }
.modal-box button {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none; cursor: pointer;
  padding: 12px;
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: var(--radius);
  transition: opacity 0.2s;
}
.modal-box button:hover { opacity: 0.85; }

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(14,12,10,0.92);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(6px);
}
.header-inner {
  max-width: calc(var(--max-w) + 80px);
  margin: 0 auto;
  padding: 0 40px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 400;
  color: var(--text); letter-spacing: 0.02em;
}
.logo-ornament { color: var(--accent); margin: 0 4px; font-size: 16px; }
.header-nav { display: flex; align-items: center; gap: 20px; }
.user-greeting {
  font-size: 12px; color: var(--text-muted);
  font-style: italic;
}
.nav-link {
  font-size: 12px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--accent); text-decoration: none; }

/* ─── HERO ───────────────────────────────────────────────── */
.hero {
  max-width: calc(var(--max-w) + 80px);
  margin: 0 auto;
  padding: 72px 40px 48px;
}
.hero-eyebrow {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--accent);
  margin-bottom: 16px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 7vw, 68px);
  font-weight: 300; font-style: italic;
  line-height: 1.1; color: var(--text);
  margin-bottom: 16px;
}
.hero-sub {
  color: var(--text-muted); font-size: 14px;
  max-width: 440px; line-height: 1.8;
}
.hero-divider {
  width: 40px; height: 1px;
  background: var(--accent-dim);
  margin-top: 36px;
}

/* ─── BLOG FEED ──────────────────────────────────────────── */
.blog-feed {
  max-width: calc(var(--max-w) + 80px);
  margin: 0 auto;
  padding: 0 40px 80px;
}

/* Loading */
.loading-state {
  display: flex; gap: 8px;
  justify-content: center; padding: 60px;
}
.loader-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-dim);
  animation: pulse 1.2s ease-in-out infinite;
}
.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1); }
}

/* Empty */
.empty-state {
  text-align: center; padding: 80px 20px;
  color: var(--text-muted); font-style: italic;
  font-family: var(--font-display); font-size: 18px;
  line-height: 1.8;
}

/* ─── POST CARD ──────────────────────────────────────────── */
.post-card {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  animation: fadeUp 0.4s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-meta {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 14px;
}
.post-date {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--accent);
}
.post-author {
  font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.05em;
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 400; line-height: 1.25;
  color: var(--text); margin-bottom: 20px;
}

.post-body {
  color: var(--text-muted); font-size: 14.5px;
  line-height: 1.85; margin-bottom: 20px;
  white-space: pre-wrap;
}

.post-source {
  margin-bottom: 20px;
  font-size: 12px; color: var(--text-dim);
}
.source-label { margin-right: 6px; }
.source-link { color: var(--accent-dim); font-size: 12px; }

/* ─── ACTIONS ────────────────────────────────────────────── */
.post-actions {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 0;
}
.action-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  transition: all 0.2s;
}
.action-btn:hover { border-color: var(--border-lit); color: var(--text); }
.like-btn:hover   { border-color: var(--accent-dim); color: var(--accent); }
.dislike-btn:hover { border-color: #5a3030; color: var(--red); }
.action-icon { font-size: 12px; }

/* ─── COMMENTS ───────────────────────────────────────────── */
.comment-section {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.comments-list { margin-bottom: 20px; }
.comment-item {
  display: flex; gap: 12px;
  margin-bottom: 18px;
  animation: fadeUp 0.25s ease both;
}
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border-lit);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--accent); flex-shrink: 0;
  font-family: var(--font-display); font-style: italic;
}
.comment-body {}
.comment-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  margin-bottom: 2px;
}
.comment-text {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.6;
}
.comment-time {
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
}

.comment-form { display: flex; gap: 10px; }
.comment-input {
  flex: 1;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 14px;
  border-radius: var(--radius); font-size: 13px;
  outline: none; transition: border-color 0.2s;
}
.comment-input:focus { border-color: var(--accent-dim); }
.comment-submit {
  background: var(--bg3); border: 1px solid var(--border-lit);
  color: var(--text-muted); cursor: pointer;
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 12px; letter-spacing: 0.05em;
  transition: all 0.2s; white-space: nowrap;
}
.comment-submit:hover {
  border-color: var(--accent-dim); color: var(--accent);
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center; padding: 32px 20px;
  font-size: 12px; color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ─── ADMIN PAGES ────────────────────────────────────────── */
.admin-layout {
  max-width: 860px; margin: 0 auto;
  padding: 40px 40px 80px;
}
.admin-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.admin-header h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400; font-style: italic;
}
.admin-btn {
  background: var(--accent); color: var(--bg);
  border: none; cursor: pointer;
  padding: 10px 22px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: opacity 0.2s; text-decoration: none;
  display: inline-block;
}
.admin-btn:hover { opacity: 0.8; text-decoration: none; color: var(--bg); }
.admin-btn.secondary {
  background: var(--bg3); color: var(--text-muted);
  border: 1px solid var(--border-lit);
}
.admin-btn.secondary:hover { color: var(--text); opacity: 1; }
.admin-btn.danger {
  background: transparent; color: var(--red);
  border: 1px solid #5a3030;
}
.admin-btn.danger:hover { background: #3a1515; }

/* Login form */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
}
.login-box {
  background: var(--bg2); border: 1px solid var(--border-lit);
  padding: 52px 44px; width: 100%; max-width: 380px;
  border-radius: var(--radius); text-align: center;
}
.login-box .logo {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 400; font-style: italic;
  color: var(--text); margin-bottom: 8px;
}
.login-box .sub {
  font-size: 12px; color: var(--text-dim);
  margin-bottom: 36px; letter-spacing: 0.05em;
  text-transform: uppercase;
}
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
  display: block; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 11px 14px;
  border-radius: var(--radius); font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent-dim); }
.form-group textarea { resize: vertical; min-height: 140px; }
.form-group select { cursor: pointer; }
.form-group select option { background: var(--bg3); }
.error-msg {
  color: var(--red); font-size: 12px;
  margin-top: 12px; text-align: center; min-height: 18px;
}

/* Post list in admin */
.post-list { display: flex; flex-direction: column; gap: 2px; }
.admin-post-row {
  display: flex; align-items: center;
  background: var(--bg2); border: 1px solid var(--border);
  padding: 18px 22px; gap: 20px;
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.admin-post-row:hover { border-color: var(--border-lit); }
.admin-post-info { flex: 1; }
.admin-post-title {
  font-family: var(--font-display);
  font-size: 17px; color: var(--text); margin-bottom: 4px;
}
.admin-post-meta { font-size: 12px; color: var(--text-dim); }
.admin-post-actions { display: flex; gap: 8px; }

/* Post editor */
.editor-form { display: flex; flex-direction: column; gap: 18px; }
.inline-row { display: flex; gap: 16px; }
.inline-row .form-group { flex: 1; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  background: var(--bg3); border: 1px solid var(--accent-dim);
  color: var(--text); padding: 12px 20px;
  border-radius: var(--radius); font-size: 13px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner, .hero, .blog-feed, .admin-layout { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 44px; }
  .inline-row { flex-direction: column; }
  .admin-post-row { flex-direction: column; align-items: flex-start; }
}
