/* ============================================
   syafiy.dev — Custom style overrides
   Theme: Terminal by panr
   ============================================ */

/* --- Light mode --- */
[data-theme="light"] {
  --background: #f5f5f5;
  --foreground: #1a1a1a;
  --accent: #e67300;
}

/* --- Dark mode --- */
[data-theme="dark"] {
  --background: #1a1a1a;
  --foreground: #e0e0e0;
  --accent: #ffb366;
}

/* --- Fallback: respect system preference when no data-theme set --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background: #1a1a1a;
    --foreground: #e0e0e0;
    --accent: #ffb366;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --background: #f5f5f5;
    --foreground: #1a1a1a;
    --accent: #e67300;
  }
}

/* --- Reading progress bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* --- Heading anchor links --- */
.hanchor {
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  text-decoration: none;
  cursor: pointer;
}

.hanchor svg {
  display: block;
}

h1:hover .hanchor,
h2:hover .hanchor,
h3:hover .hanchor,
h4:hover .hanchor,
h5:hover .hanchor,
h6:hover .hanchor,
.hanchor:focus {
  opacity: 1;
}

.hanchor.copied {
  opacity: 1;
  color: #22863a;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--accent);
  color: var(--background);
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Mobile menu fix --- */
@media (max-width: 684px) {
  ul.menu.menu--mobile {
    position: static !important;
  }

  ul.menu.menu--mobile > li > ul.menu__dropdown {
    position: absolute !important;
    left: auto !important;
    right: 0 !important;
    width: auto !important;
    white-space: nowrap !important;
    z-index: 999 !important;
  }
}

/* --- Remove image border and center post images --- */
img {
  border: none !important;
  padding: 0 !important;
}

.post-content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* --- Push footer to bottom --- */
.content {
  flex: 1;
}

/* --- Theme toggle button --- */
#theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--accent);
  color: var(--background);
  border: none;
  border-radius: 50%;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease, transform 0.15s ease;
}

#theme-toggle:hover {
  transform: scale(1.1);
}
