/*
Theme Name: Blogsloop
Theme URI:
Author: Ink & Mist
Author URI:
Description: A minimal dark blogging theme focused on clarity and calm. Writing without distraction, reading without noise.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, dark, minimal, clean, custom-header, featured-images
Text Domain: blogsloop
*/

:root {
  color-scheme: dark;
  --color-ink: #0A0A0A;
  --color-line: #1F1F1F;
  --color-soft: #A3A3A3;
  --color-mist: #E5E5E5;
  --color-white-rgb: 255, 255, 255;
  --color-black-rgb: 0, 0, 0;
  --bg-color-glass: rgba(var(--color-black-rgb), 0.88);
  --border-color: rgba(var(--color-white-rgb), 0.12);
  --text-muted: rgba(var(--color-white-rgb), 0.55);
  --shadow-panel: 0 30px 90px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 22px 50px rgba(0, 0, 0, 0.18);
}

html.light {
  color-scheme: light;
  --color-ink: #F9F9FB;
  --color-line: #E5E5E7;
  --color-soft: #555558;
  --color-mist: #27272A;
  --color-white-rgb: 9, 9, 11;
  --color-black-rgb: 255, 255, 255;
  --bg-color-glass: rgba(var(--color-black-rgb), 0.88);
  --border-color: rgba(0, 0, 0, 0.12);
  --text-muted: rgba(0, 0, 0, 0.55);
  --shadow-panel: 0 30px 90px rgba(9, 9, 11, 0.08);
  --shadow-float: 0 22px 50px rgba(9, 9, 11, 0.04);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(var(--color-white-rgb), 0.08), transparent 30%),
    linear-gradient(180deg, var(--color-ink) 0%, var(--color-ink) 100%);
  color: var(--color-mist);
}

/* Global smooth transition for theme swap */
*, ::before, ::after {
  border-color: var(--border-color);
}

body, header, main, footer, article, aside, div, span, a, button, input {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Blog typography */
.blog-content {
  font-family: Georgia, Cambria, "Times New Roman", Times, serif;
  line-height: 1.8;
  color: #e5e5e5;
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

.blog-content h1 { font-size: 2.5rem; letter-spacing: -0.03em; margin-bottom: 1rem; }
.blog-content h2 { font-size: 1.75rem; letter-spacing: -0.02em; margin-top: 2.5rem; margin-bottom: 1rem; }
.blog-content h3 { font-size: 1.25rem; letter-spacing: -0.01em; margin-top: 2rem; margin-bottom: 0.75rem; }

.blog-content p { margin-bottom: 1.25rem; font-size: 1.125rem; color: #c7c7c7; }

.blog-content a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(var(--color-white-rgb), 0.3);
}

.blog-content a:hover { text-decoration-color: rgba(var(--color-white-rgb), 0.6); }

.blog-content blockquote {
  border-left: 3px solid rgba(var(--color-white-rgb), 0.2);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #a3a3a3;
  font-size: 1.25rem;
  line-height: 1.7;
}

.blog-content code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
  background: rgba(var(--color-white-rgb), 0.05);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e5e5e5;
}

.blog-content pre {
  background: rgba(var(--color-white-rgb), 0.03);
  border: 1px solid rgba(var(--color-white-rgb), 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.blog-content pre code { background: none; padding: 0; }

.blog-content ul,
.blog-content ol { margin: 1rem 0 1.25rem 1.5rem; color: #c7c7c7; }

.blog-content li { margin-bottom: 0.5rem; line-height: 1.7; }

.blog-content img { max-width: 100%; border-radius: 12px; margin: 1.5rem 0; }

.blog-content hr { border: none; border-top: 1px solid rgba(var(--color-white-rgb), 0.1); margin: 2.5rem 0; }

/* WordPress generated classes */
.blog-content .wp-block-image img { border-radius: 12px; }
.blog-content figure.wp-block-image { margin: 1.5rem 0; }
.blog-content figcaption { font-size: 0.875rem; color: #a3a3a3; text-align: center; margin-top: 0.5rem; font-family: Inter, sans-serif; }
.blog-content .wp-block-quote { border-left: 3px solid rgba(var(--color-white-rgb), 0.2); padding-left: 1.5rem; margin: 1.5rem 0; font-style: italic; color: #a3a3a3; font-size: 1.125rem; }
.blog-content .wp-block-code { background: rgba(var(--color-white-rgb), 0.03); border: 1px solid rgba(var(--color-white-rgb), 0.1); border-radius: 8px; padding: 1.5rem; }

/* Fade-in animation */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.fade-in.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-in { opacity: 1; transform: none; transition: none; }
}

input:focus { outline: none; }

article { transition: transform 0.3s ease, box-shadow 0.3s ease; }

/* Table of contents */
.toc {
  border-left: 2px solid rgba(var(--color-white-rgb), 0.1);
  padding-left: 1.5rem;
  margin: 2rem 0;
}

.toc h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a3a3a3;
  margin-bottom: 1rem;
}

.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 0.5rem; }

.toc a {
  font-size: 0.875rem;
  color: #a3a3a3;
  text-decoration: none;
  transition: color 0.2s ease;
  display: block;
  line-height: 1.5;
}

.toc a:hover { color: #ffffff; }
.toc a.toc-active { color: #f97316; }

/* Reading progress */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(var(--color-white-rgb), 0.06);
  z-index: 1000;
}

.reading-progress-bar {
  height: 100%;
  background: #f97316;
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.8);
}

/* Share buttons */
.share-buttons { display: flex; gap: 0.5rem; }

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(var(--color-white-rgb), 0.1);
  background: rgba(var(--color-white-rgb), 0.03);
  color: #a3a3a3;
  transition: all 0.2s ease;
  cursor: pointer;
}

.share-btn:hover {
  background: rgba(var(--color-white-rgb), 0.08);
  color: #ffffff;
  transform: translateY(-2px);
}

/* Author bio */
.author-bio {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(var(--color-white-rgb), 0.1);
}

.author-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(var(--color-white-rgb), 0.1);
  background: rgba(var(--color-white-rgb), 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
}

.author-avatar img { width: 100%; height: 100%; object-fit: cover; }

.author-info h4 { font-size: 1rem; font-weight: 600; color: #ffffff; margin-bottom: 0.25rem; }
.author-info p { font-size: 0.875rem; color: #a3a3a3; margin-bottom: 0.5rem; }

/* Related posts */
.related-posts {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(var(--color-white-rgb), 0.1);
}

.related-posts h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.related-post { padding: 1rem 0; border-bottom: 1px solid rgba(var(--color-white-rgb), 0.05); }
.related-post:last-child { border-bottom: none; }

.related-post a {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: color 0.2s ease;
}

.related-post a:hover .related-post-title { color: #ffffff; }

.related-post-title { font-size: 0.9375rem; font-weight: 500; color: rgba(255,255,255,0.8); transition: color 0.2s ease; }
.related-post-meta { font-size: 0.8125rem; color: #a3a3a3; margin-top: 0.25rem; }

/* Category filter pills */
.filter-btn {
  padding: 0.4375rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(var(--color-white-rgb), 0.1);
  background: rgba(var(--color-white-rgb), 0.03);
  color: rgba(var(--color-white-rgb), 0.5);
  font-size: 0.8125rem;
  font-family: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: rgba(var(--color-white-rgb), 0.2);
  color: rgba(var(--color-white-rgb), 0.85);
  background: rgba(var(--color-white-rgb), 0.05);
}

.filter-btn.active {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

/* Extra posts (load more) */
.extra-post { display: none; }

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 5.5rem; /* moved up to stack above theme-toggle */
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-color-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 100;
}

.back-to-top:hover {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.4);
  transform: translateY(-2px);
}

/* Floating Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-color-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 101;
}

.theme-toggle:hover {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.4);
  transform: translateY(-2px);
}

.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid rgba(var(--color-white-rgb), 0.1);
  background: rgba(var(--color-white-rgb), 0.03);
  color: rgba(var(--color-white-rgb), 0.55);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination a:hover { border-color: rgba(249, 115, 22, 0.4); color: #f97316; }
.pagination .current { border-color: #f97316; background: rgba(249, 115, 22, 0.1); color: #f97316; }

/* Responsive */
@media (max-width: 640px) {
  .blog-content h1 { font-size: 1.875rem; }
  .blog-content h2 { font-size: 1.5rem; }
  .author-bio { flex-direction: column; gap: 1rem; }
  .author-avatar { width: 52px; height: 52px; }
  .back-to-top { bottom: 1.25rem; right: 1.25rem; }
}

/* --- Slider & UI Enhancements --- */

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.slider-dot {
  cursor: pointer;
  height: 0.375rem; /* h-1.5 */
  width: 0.5rem;    /* w-2 */
  border-radius: 9999px;
  background-color: rgba(var(--color-white-rgb), 0.2);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.slider-dot:hover {
  background-color: rgba(var(--color-white-rgb), 0.4);
}

.slider-dot.active {
  width: 1.5rem; /* w-6 */
  background-color: #f97316;
  opacity: 1;
}

/* Category jump hover state for icons */
.category-jump:hover h3 {
  color: #ffffff;
}

.category-jump:hover svg {
  transform: scale(1.1);
  color: #ffffff;
}

/* Search Overlay */
#search-overlay.hidden {
  display: none;
}

#search-overlay:not(.hidden) {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slider button hover refinement */
#slider-prev:hover svg,
#slider-next:hover svg {
  transform: scale(1.1);
}

#slider-prev:active,
#slider-next:active {
  transform: scale(0.95);
}

/* Glassmorphism utility */
.glass {
  background: rgba(var(--color-white-rgb), 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--color-white-rgb), 0.1);
}
