:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #dbeafe 0, transparent 32%),
    radial-gradient(circle at top right, #fce7f3 0, transparent 28%),
    var(--bg);
  color: var(--text);
}

#app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

#header {
  margin-bottom: 32px;
  padding: 36px 28px;
  border-radius: 28px;
  background: linear-gradient(135deg, #111827, #1e3a8a);
  color: white;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

#header::before {
  content: "Charmaine's Blog";
  display: block;
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

#header::after {
  content: "Engineering notes, AI systems, backend architecture, and practical developer experiments.";
  display: block;
  max-width: 720px;
  margin-bottom: 24px;
  color: #dbeafe;
  font-size: 17px;
  line-height: 1.6;
}

#search {
  width: 100%;
  max-width: 680px;
  padding: 15px 18px;
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  outline: none;
  color: #111827;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

#search:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.35);
}

.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.post-card:hover {
  transform: translateY(-5px);
  border-color: #bfdbfe;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.14);
}

.post-card img,
.post-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.post-card:hover img,
.post-card:hover .post-thumb {
  transform: scale(1.04);
}

.post-card > div {
  padding: 18px 18px 20px;
}

.post-card h3 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.post-meta {
  font-size: 13px;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.tag:hover {
  background: #bfdbfe;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 15px;
  border-radius: 999px;
  background: #111827;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.back-btn:hover {
  background: #1e3a8a;
}

.post-view {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.1);
}

.post-view h1 {
  margin-top: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.post-view h2 {
  margin-top: 42px;
  font-size: 30px;
  letter-spacing: -0.025em;
}

.post-view h3 {
  margin-top: 32px;
  font-size: 23px;
}

.post-view p,
.post-view li {
  font-size: 17px;
  line-height: 1.8;
  color: #374151;
}

.post-view a {
  color: var(--accent);
  font-weight: 650;
}

.post-view img {
  max-width: 100%;
  margin: 24px 0;
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.14);
}

.post-view blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 5px solid var(--accent);
  background: #eff6ff;
  border-radius: 14px;
  color: #1e3a8a;
}

.post-view code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f3f4f6;
  font-size: 0.92em;
}

.post-view pre:not(.mermaid) {
  padding: 18px;
  overflow-x: auto;
  border-radius: 16px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 14px;
  line-height: 1.7;
}

.post-view pre:not(.mermaid) code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.post-view pre.mermaid {
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
  color: inherit;
}

.post-view .mermaid svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

@media (max-width: 700px) {
  #app {
    padding: 18px 14px 40px;
  }

  #header {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .post-card img,
  .post-thumb {
    height: 170px;
  }

  .post-view {
    padding: 24px 18px;
    border-radius: 22px;
  }
}
.post-excerpt {
  margin: 12px 0 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.65;
}
.result-count {
  margin: 0 0 18px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
}

.clear-filter {
  margin: 0 0 14px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.clear-filter:hover {
  background: #1e3a8a;
}

mark {
  padding: 0 3px;
  border-radius: 5px;
  background: #fef3c7;
  color: inherit;
}

.active-tag {
  background: #2563eb;
  color: white;
}

.search-tools {
  max-width: 680px;
}

.search-mode-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}

.search-mode {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding: 11px 42px 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  outline: none;

  background: rgba(255, 255, 255, 0.96);
  color: #111827;

  font-size: 14px;
  font-weight: 650;
  cursor: pointer;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease;
}

.search-mode:hover {
  background: white;
}

.search-mode:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.35),
              0 10px 30px rgba(0, 0, 0, 0.18);
  background: white;
}

.search-mode:active {
  transform: translateY(1px);
}

.search-mode-wrapper::after {
  content: "⌄";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-58%);
  pointer-events: none;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.search-mode-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: #f4f4f4;
  color: #222;

  border: 2px solid transparent;
  border-radius: 999px;

  padding: 10px 42px 10px 18px;

  font-size: 1rem;
  font-weight: 500;

  cursor: pointer;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;

  outline: none;

  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);

  position: relative;
}

/* hover */
.search-mode-select:hover {
  background: #f8f8f8;
}

/* focused / clicked */
.search-mode-select:focus {
  background: white;
  border-color: rgba(255,255,255,0.25);

  box-shadow:
    0 0 0 3px rgba(255,255,255,0.12),
    0 2px 8px rgba(0,0,0,0.18);

  transform: translateY(-1px);
}

/* optional active press effect */
.search-mode-select:active {
  transform: scale(0.99);
}

.hidden {
  display: none;
}

.advanced-filter {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.advanced-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 650;
}

.logic-btn,
.tag-letter,
.filter-tag,
.selected-tag {
  border: 0;
  cursor: pointer;
  font-weight: 650;
}

.logic-btn,
.tag-letter {
  padding: 6px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #111827;
}

.logic-btn.active,
.tag-letter.active,
.filter-tag.active {
  background: #2563eb;
  color: white;
}

.tag-search {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  outline: none;
  font-size: 14px;
}

.selected-tags,
.tag-letters,
.tag-browser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.selected-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #111827;
  color: white;
}

.filter-tag {
  padding: 7px 11px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}

