/* ==========================================================================
   Blogs MineOrgin — design tokens (v2: navy editorial theme)
   A calm, editorial navy palette with a single azure accent. Fraunces
   (serif) carries headlines, Inter carries everything else — no gaming
   affectation, just a well-set blog.
   ========================================================================== */

:root {
  --bg: #060b16;
  --surface: #0d1728;
  --surface-2: #12203a;
  --surface-3: #17284a;
  --border: #1f3155;
  --border-soft: #16233f;

  --accent: #5b8def;
  --accent-soft: #8fb3ff;
  --accent-dim: #2a4d96;
  --accent-wash: rgba(91, 141, 239, 0.12);

  --heart: #ef6f8e;
  --heart-wash: rgba(239, 111, 142, 0.12);

  --text: #edf1fb;
  --text-muted: #9aabce;
  --text-faint: #5f6f92;

  --danger: #f87171;

  --font-display: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Merriweather", Georgia, "Times New Roman", serif;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-dim); color: #fff; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(6, 11, 22, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--text);
}

.logo img.mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border), 0 6px 16px -6px rgba(91, 141, 239, 0.45);
}

.logo span.accent { color: var(--accent-soft); font-style: italic; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.main-nav a { display: inline-flex; align-items: center; gap: 7px; transition: color 0.15s ease; }
.main-nav a svg { width: 15px; height: 15px; opacity: 0.85; }
.main-nav a:hover, .main-nav a.active { color: var(--accent-soft); }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #06101f; }
.btn-primary:hover:not(:disabled) { background: var(--accent-soft); }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-soft); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); }

/* ---------- Hero (homepage intro) ---------- */
.hero {
  position: relative;
  padding: 80px 0 54px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(ellipse at center, rgba(91, 141, 239, 0.22), transparent 68%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(154, 171, 206, 0.14) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), transparent 75%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), transparent 75%);
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--accent-soft);
  background: var(--accent-wash);
  border: 1px solid rgba(91, 141, 239, 0.28);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  margin-bottom: 22px;
}
.hero-badge svg { width: 15px; height: 15px; }
.hero-badge img { width: 16px; height: 16px; border-radius: 4px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 0 0 20px;
  max-width: 16ch;
}
.hero h1 em { color: var(--accent-soft); font-style: italic; }

.hero p.lead {
  color: var(--text-muted);
  max-width: 58ch;
  font-size: 17px;
  margin: 0 0 30px;
}

/* ---------- Featured post ---------- */
.featured {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 56px;
}

.featured { position: relative; }

.featured .thumb { position: relative; }

.featured .featured-ribbon {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #06101f;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 12px;
  z-index: 2;
}
.featured .featured-ribbon svg { width: 13px; height: 13px; }

.featured .thumb {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
}
.featured .thumb img { width: 100%; height: 100%; object-fit: cover; }
.featured .thumb .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 64px;
  color: var(--accent-dim);
}

.featured .body { padding: 12px 28px 12px 8px; }

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-soft);
  background: var(--accent-wash);
  border: 1px solid rgba(91, 141, 239, 0.28);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 16px;
}

.featured .body h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.3;
  margin: 0 0 14px;
}

.featured .body p.excerpt {
  color: var(--text-muted);
  font-size: 15.5px;
  margin: 0 0 22px;
}

@media (max-width: 780px) {
  .featured { grid-template-columns: 1fr; }
  .featured .body { padding: 4px 8px 12px; }
}

/* ---------- Meta row (views, likes, date) ---------- */
.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-faint);
}
.post-meta .stat { display: inline-flex; align-items: center; gap: 5px; }
.post-meta svg { width: 15px; height: 15px; opacity: 0.85; }

/* ---------- Post grid ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 26px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 0;
}
.section-head .count { font-size: 13px; color: var(--text-faint); }

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-bottom: 90px;
}
@media (max-width: 880px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.post-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
  box-shadow: 0 16px 34px -18px rgba(91, 141, 239, 0.35);
}

.post-card .thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
  overflow: hidden;
}
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .thumb .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--accent-dim);
}

.post-card .card-body {
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.post-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.4;
  margin: 0;
}

.post-card p.excerpt {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .post-meta { padding-top: 10px; border-top: 1px solid var(--border-soft); position: relative; }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-soft);
  margin-top: 4px;
}
.read-more svg { width: 13px; height: 13px; flex-shrink: 0; }

.post-card .read-more {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.post-card:hover .read-more { opacity: 1; transform: translateX(0); }

.featured .read-more { margin-top: 16px; font-size: 14px; }
.featured .read-more svg { width: 15px; height: 15px; }

/* ---------- Empty / loading states ---------- */
.state-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.state-box .state-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  color: var(--accent-soft);
  opacity: 0.8;
}
.state-box .state-icon svg { width: 100%; height: 100%; }
.state-box .state-icon.spin svg { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-box strong { display: block; color: var(--text); margin-bottom: 6px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }

/* ---------- Post detail ---------- */
.post-detail { padding: 48px 0 100px; max-width: 760px; margin: 0 auto; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 30px;
  transition: gap 0.15s ease, color 0.15s ease;
}
.back-link svg { width: 15px; height: 15px; transition: transform 0.15s ease; }
.back-link:hover { color: var(--accent-soft); }
.back-link:hover svg { transform: translateX(-3px); }

.post-detail .hero-img {
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 32px;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
}
.post-detail .hero-img img { width: 100%; height: 100%; object-fit: cover; }

.post-detail h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.28;
  letter-spacing: -0.3px;
  margin: 0 0 20px;
}

.post-detail .post-meta { margin-bottom: 40px; padding-bottom: 28px; border-bottom: 1px solid var(--border-soft); }

.post-body { font-size: 17px; color: #dbe3f5; }
.post-body p { margin: 0 0 22px; }
.post-body p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 54px;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  margin: 6px 10px 0 0;
  color: var(--accent-soft);
}
.post-body h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 44px 0 18px; }
.post-body h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 34px 0 14px; }
.post-body a { color: var(--accent-soft); border-bottom: 1px solid var(--accent-dim); }
.post-body img { margin: 30px 0; border-radius: var(--radius); }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 19px;
}
.post-body code {
  font-family: "SFMono-Regular", Menlo, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  font-size: 13.5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.post-body ul, .post-body ol { margin: 0 0 22px; padding-left: 22px; color: #dbe3f5; }
.post-body li { margin-bottom: 8px; }

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 28px;
  font-size: 15.5px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.post-body th, .post-body td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.post-body th {
  background: var(--surface-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  color: var(--accent-soft);
}
.post-body td { color: #dbe3f5; }
.post-body tbody tr:last-child td { border-bottom: none; }
.post-body tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

/* ---------- Like button ---------- */
.like-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 44px;
  margin-top: 44px;
  border-top: 1px solid var(--border-soft);
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.like-btn:hover:not(:disabled) { border-color: var(--heart); color: var(--heart); background: var(--heart-wash); }
.like-btn:active:not(:disabled) { transform: scale(0.97); }
.like-btn.liked { border-color: var(--heart); color: var(--heart); background: var(--heart-wash); }
.like-btn:disabled { cursor: default; }
.like-btn svg { width: 18px; height: 18px; }

/* ---------- Admin ---------- */
.admin-shell { max-width: 720px; margin: 0 auto; padding: 56px 24px 100px; }
.admin-shell h1 { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin: 0 0 8px; }
.admin-shell .sub { color: var(--text-muted); font-size: 14.5px; margin: 0 0 36px; }

.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 28px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14.5px;
  resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 260px; line-height: 1.75; }
.field .hint { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

.form-actions { display: flex; gap: 12px; margin-top: 26px; }

.admin-post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.admin-post-row:last-child { border-bottom: none; }
.admin-post-row .info h4 { margin: 0 0 4px; font-size: 15px; }
.admin-post-row .info span { font-size: 12.5px; color: var(--text-faint); }
.admin-post-row .actions { display: flex; gap: 8px; flex-shrink: 0; }
.admin-post-row .actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 7px 12px;
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
}
.admin-post-row .actions button svg { width: 13px; height: 13px; }
.admin-post-row .actions button:hover { border-color: var(--accent); color: var(--accent-soft); }
.admin-post-row .actions button.del:hover { border-color: var(--danger); color: var(--danger); }

.login-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-dim) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06101f;
  margin-bottom: 22px;
}
.login-icon svg { width: 26px; height: 26px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 14px 20px;
  font-size: 13.5px;
  z-index: 100;
  max-width: 320px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.5);
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent-soft); }
.toast.error { border-color: var(--danger); }
.toast.error svg { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); padding: 36px 0; color: var(--text-faint); font-size: 13.5px; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.site-footer .brand { display: inline-flex; align-items: center; gap: 8px; }
.site-footer .brand img { width: 18px; height: 18px; border-radius: 4px; }
.site-footer .server-link { display: inline-flex; align-items: center; gap: 6px; }
.site-footer .server-link svg { width: 14px; height: 14px; }
.site-footer a:hover { color: var(--accent-soft); }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.mb-0 { margin-bottom: 0; }
