/*
  BlogCMS base theme.
  This file is intentionally plain CSS (no build step).
*/

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #0b0f14;
  color: #e6edf3;
}

a { color: #7dd3fc; text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  padding: 16px 20px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wrap {
  display: flex;
  gap: 20px;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

main { flex: 1; min-width: 0; }

aside {
  width: 260px;
  border-left: 1px solid #1f2937;
  padding-left: 16px;
}

.card {
  background: #0f1620;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.muted { color: #9aa4b2; }

.tag {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #1f2937;
  border-radius: 999px;
  margin: 4px 6px 0 0;
  font-size: 12px;
}

.tag-current {
  background: #111827;
  border-color: #374151;
}

.tag-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

textarea, input {
  width: 100%;
  background: #0b0f14;
  color: #e6edf3;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px;
}

button {
  background: #111827;
  color: #e6edf3;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover { background: #0f172a; }

.row { display: flex; gap: 12px; }
.row > div { flex: 1; }

.danger { color: #fca5a5; }
.ok { color: #86efac; }

pre, code {
  background: #0b0f14;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 2px 6px;
}

article h1, article h2, article h3 { margin-top: 1.2em; }
article img { max-width: 100%; height: auto; display: block; }
article pre { overflow: auto; }
article table { display: block; max-width: 100%; overflow: auto; }

/* Utility-ish classes to replace previous inline styles */
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-0 { margin-top: 0; }
.m-0 { margin: 0; }

.fs-12 { font-size: 12px; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-between-gap12 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.flex-between-baseline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.inline { display: inline; }
.relative { position: relative; }
.hidden { display: none; }

.btn-tag {
  /* Make a button look like a tag link */
  background: transparent;
  border: 1px solid #1f2937;
  border-radius: 999px;
  padding: 4px 10px;
}

.btn-tag:hover { background: #111827; }

/* Tags editor (admin) */
.tags-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 8px;
  background: #0b0f14;
  border: 1px solid #1f2937;
  border-radius: 10px;
}

.tags-input {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  padding: 6px 8px;
  background: transparent;
  color: #e6edf3;
}

.tags-input:focus { outline: none; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #1f2937;
  border-radius: 999px;
  background: #0f1620;
  font-size: 12px;
}

.tag-chip-x {
  border: none;
  background: transparent;
  color: #9aa4b2;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.tag-chip-x:hover { color: #e6edf3; }

.tags-suggest { position: relative; }

#tags_suggest {
  position: absolute;
  z-index: 50;
  width: calc(100% - 2px);
  margin-top: 6px;
  background: #0f1620;
  border: 1px solid #1f2937;
  border-radius: 10px;
  overflow: hidden;
}

.tags-suggest-item { padding: 10px 12px; cursor: pointer; }
.tags-suggest-item:hover { background: #111827; }

/* Home preview: keep first line fully readable, then fade */
.post-excerpt {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  max-height: 4.8em; /* ~3 lines */
  overflow: hidden;
  /*
    Use a mask so the first line remains fully opaque.
    The fade starts after ~1 line height and progresses to transparent.
  */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0, rgba(0,0,0,1) 1.6em, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0, rgba(0,0,0,1) 1.6em, rgba(0,0,0,0) 100%);
}

/* Footer */
.footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 24px 20px;
}

/* Responsive: phones/tablets */
@media (max-width: 900px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wrap {
    flex-direction: column;
  }

  aside {
    width: auto;
    border-left: none;
    padding-left: 0;
  }

  /* These are used in multiple templates; on narrow screens they should stack */
  .flex-between,
  .flex-between-gap12,
  .flex-between-baseline {
    flex-direction: column;
    align-items: flex-start;
  }

  .row {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  header { padding: 14px 14px; }
  .wrap { padding: 12px; gap: 12px; }
  .card { padding: 14px; border-radius: 14px; }
  .tag { padding: 5px 10px; font-size: 12px; }
  .post-excerpt { font-size: 14px; }
}

/* EasyMDE / CodeMirror dark theme tweaks */
.editor-toolbar { background: #0f1620; border: 1px solid #1f2937; border-radius: 10px; }
.editor-toolbar a { color: #9aa4b2 !important; }
.editor-toolbar a:hover { color: #e6edf3 !important; background: #111827; border-radius: 8px; }
.editor-toolbar a.active { color: #e6edf3 !important; }
.CodeMirror { background: #0b0f14; color: #e6edf3; border: 1px solid #1f2937; border-radius: 10px; }
.CodeMirror-cursor { border-left: 1px solid #e6edf3; }
.CodeMirror-gutters { background: #0b0f14; border-right: 1px solid #1f2937; }
.editor-preview, .editor-preview-side { background: #0b0f14; color: #e6edf3; }
