/* ===== blog.niyazi.cv Enhancements ===== */

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  width: 0;
  z-index: 9999;
  transition: width 80ms linear;
  box-shadow: 0 0 8px var(--accent);
}

/* Sort/Filter Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.toolbar select, .toolbar input[type="search"] {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.toolbar select:focus, .toolbar input:focus {
  border-color: var(--accent);
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
}
.toolbar .result-count {
  font-size: .78rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}
.toolbar-icon {
  font-size: 1rem;
  opacity: .5;
}

/* Tag filter chips */
.tag-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 250ms ease;
}
.tag-filter-bar.visible {
  max-height: 200px;
}
.tag-chip {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .76rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  user-select: none;
}
.tag-chip:hover {
  border-color: var(--accent);
}
.tag-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tag-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: .78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.tag-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Post list wrapper */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* No results */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  display: none;
}
.no-results.visible {
  display: block;
}
.no-results .emoji {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Reading mode controls (floating bottom bar) */
.reading-controls {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 8px 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  z-index: 1000;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity .2s, transform .2s;
}
.reading-controls.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.reading-controls button {
  border: none;
  background: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reading-controls button:hover {
  background: var(--bg);
  color: var(--accent);
}
.reading-controls button.active {
  background: var(--accent);
  color: #fff;
}
.reading-controls .rc-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}
.reading-controls .rc-label {
  font-size: .68rem;
  color: var(--text-muted);
  padding: 0 4px;
  min-width: 28px;
  text-align: center;
}
.reading-controls .rc-speed-btns {
  display: flex;
  gap: 2px;
}
.reading-controls .rc-speed-btns button {
  width: 28px;
  height: 28px;
  font-size: .68rem;
  border-radius: 6px;
}

/* Sepia mode */
body.mode-sepia {
  background: #f4ecd8;
  color: #5b4636;
}
body.mode-sepia article,
body.mode-sepia .reading-controls,
body.mode-sepia .toc {
  background: #f9f0dc;
  border-color: #e0d4b0;
  color: #5b4636;
}
body.mode-sepia .reading-controls button {
  color: #5b4636;
}
body.mode-sepia .tag-chip {
  background: #ede0c8;
  color: #8b6914;
}
body.mode-sepia .reading-progress {
  background: #8b6914;
}

/* Focus mode — dims everything except the article */
body.mode-focus::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45);
  z-index: 998;
  pointer-events: none;
  transition: opacity .2s;
}
body.mode-focus article {
  position: relative;
  z-index: 999;
  max-width: 680px;
  margin: 40px auto;
  box-shadow: 0 0 80px rgba(0,0,0,.2);
  border-radius: 16px;
}
body.mode-focus header,
body.mode-focus footer,
body.mode-focus .breadcrumbs,
body.mode-focus .back-nav,
body.mode-focus .toc {
  opacity: .15;
  pointer-events: none;
}
body.mode-focus .reading-controls {
  z-index: 1001;
  opacity: 1;
  pointer-events: auto;
}

/* Wide mode */
body.mode-wide .container {
  max-width: 1000px;
}
body.mode-wide article .content {
  font-size: 1.1rem;
}

/* Font size classes */
body.font-small article .content { font-size: .95rem; }
body.font-normal article .content { font-size: 1.05rem; }
body.font-large article .content { font-size: 1.18rem; }
body.font-xlarge article .content { font-size: 1.32rem; }

/* TOC (Table of Contents) */
.toc {
  position: fixed;
  right: 24px;
  top: 100px;
  width: 240px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .82rem;
  z-index: 100;
  display: none;
  scrollbar-width: thin;
}
.toc.active {
  display: block;
}
.toc h4 {
  font-size: .85rem;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -.3px;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc li {
  margin: 5px 0;
  padding-left: 14px;
  border-left: 2px solid var(--border-light);
  transition: border-color .15s;
}
.toc li.toc-active {
  border-left-color: var(--accent);
}
.toc li.toc-active a {
  color: var(--accent);
  font-weight: 500;
}
.toc li.toc-h3 {
  padding-left: 28px;
  font-size: .78rem;
}
.toc a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .8rem;
  line-height: 1.4;
  display: block;
  padding: 2px 0;
  transition: color .15s;
}
.toc a:hover {
  color: var(--accent);
}
.toc-toggle {
  display: none;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  opacity: 0;
  pointer-events: none;
  transition: all .2s;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* Keyboard hint */
.kbd-hint {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .72rem;
  color: var(--text-muted);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
}
.kbd-hint.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .68rem;
  font-family: 'SF Mono', Menlo, monospace;
  background: var(--bg);
  color: var(--text);
  min-width: 18px;
  text-align: center;
}

/* Auto-scroll visual indicator */
.autoscroll-active .btn-autoscroll {
  background: var(--accent);
  color: #fff;
}

/* Smooth scroll for TOC */
html { scroll-behavior: smooth; }

/* Card entrance animation */
.post-card {
  animation: fadeInUp .3s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger animation for sorted cards */
.post-list .post-card:nth-child(1) { animation-delay: 0ms; }
.post-list .post-card:nth-child(2) { animation-delay: 30ms; }
.post-list .post-card:nth-child(3) { animation-delay: 60ms; }
.post-list .post-card:nth-child(4) { animation-delay: 90ms; }
.post-list .post-card:nth-child(5) { animation-delay: 120ms; }
.post-list .post-card:nth-child(6) { animation-delay: 150ms; }
.post-list .post-card:nth-child(7) { animation-delay: 180ms; }
.post-list .post-card:nth-child(8) { animation-delay: 210ms; }
.post-list .post-card:nth-child(9) { animation-delay: 240ms; }
.post-list .post-card:nth-child(10) { animation-delay: 270ms; }

/* Responsive */
@media (max-width: 900px) {
  .toc { display: none !important; }
}
@media (max-width: 600px) {
  .reading-controls {
    bottom: 16px;
    padding: 6px 10px;
  }
  .reading-controls button {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .kbd-hint { display: none !important; }
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}