/* ==========================================================================
   Custom enhancements layered on top of the Minimal Mistakes dark skin.
   Palette is kept identical to the original theme.
   ========================================================================== */

:root {
  --bg: #252a34;
  --bg-deep: #1a1d24;
  --bg-card: #2b313d;
  --text: #eaeaea;
  --muted: #9aa1ab;
  --border: #3d4046;
  --border-strong: #51555d;
  --accent: #00adb5;
  --accent-soft: rgba(0, 173, 181, 0.15);
  --link: #8cd2d5;
  --link-hover: #a9dde0;
}

html { scroll-behavior: smooth; scroll-padding-top: 5em; }

::selection { background: var(--accent); color: #fff; }

/* Scrollbar ---------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg-deep); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Keyboard focus ------------------------------------------------------------ */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Masthead ------------------------------------------------------------------ */
.masthead {
  position: sticky;
  top: 0;
  background: rgba(37, 42, 52, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}
.masthead .site-title { font-weight: 800; letter-spacing: 0.02em; }
.masthead .site-title::before {
  content: ">_";
  color: var(--accent);
  margin-right: 0.4em;
  font-family: Monaco, Consolas, "Lucida Console", monospace;
}
.greedy-nav .visible-links a::before { background: var(--accent); }
.greedy-nav .visible-links a.is-active { color: var(--accent); }
.greedy-nav .visible-links a.is-active::before { right: 1rem; }

/* Reading progress bar ------------------------------------------------------ */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--link-hover));
  box-shadow: 0 0 8px var(--accent);
  z-index: 100;
  transition: width 0.1s linear;
}

/* Sidebar / author profile -------------------------------------------------- */
.sidebar { opacity: 1; }

.author__avatar img {
  width: 150px;
  max-width: 150px;
  height: 150px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 28%;
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), #5ee7ec, #1a1d24, var(--accent));
  box-shadow: 0 0 0 4px var(--bg), 0 8px 30px rgba(0, 173, 181, 0.25);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.author__avatar { position: relative; }
@media (min-width: 1024px) {
  .author__avatar { display: inline-block; }
  .sidebar.sticky { top: 5em; max-height: calc(100vh - 6em); }
}
.author__avatar img:hover {
  transform: scale(1.04) rotate(-2deg);
  box-shadow: 0 0 0 4px var(--bg), 0 10px 40px rgba(0, 173, 181, 0.45);
}
/* "online" status dot */
.author__avatar::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3ddc84;
  border: 3px solid var(--bg);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(61, 220, 132, 0); }
}

.author__name { font-size: 1.15em; letter-spacing: 0.01em; }
.author__bio { color: var(--muted); }

.author__urls.social-icons li a {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.15em 0;
  transition: color 0.2s ease, transform 0.2s ease;
}
.author__urls.social-icons li a:hover { color: var(--accent); transform: translateX(3px); }

.author__urls-wrapper .btn--inverse {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
}
.author__urls-wrapper .btn--inverse:hover { background: var(--accent); color: #fff; }

@media (max-width: 1023px) {
  .author__avatar { width: 64px; height: 64px; }
  .author__avatar img { width: 64px; height: 64px; max-width: 64px; padding: 3px; }
  .author__avatar::after { right: 2px; bottom: 2px; width: 12px; height: 12px; border-width: 2px; }
}

/* Home hero ----------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 0 0 2em;
  padding: 1.6em 1.6em 1.4em;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 173, 181, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-card), var(--bg-deep));
  overflow: hidden;
}
.hero::before {
  /* subtle grid texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.hero > * { position: relative; }
.hero__prompt {
  margin: 0 0 0.6em;
  font-family: Monaco, Consolas, "Lucida Console", monospace;
  font-size: 0.75em;
  color: var(--accent);
}
.hero__title {
  margin: 0 0 0.35em;
  font-size: 1.75em;
  line-height: 1.2;
}
.hero__title .accent { color: var(--accent); }
.hero__typed {
  min-height: 1.5em;
  margin: 0 0 1em;
  font-family: Monaco, Consolas, "Lucida Console", monospace;
  font-size: 0.8em;
  color: var(--link);
}
.hero__typed::after {
  content: "\2588";
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__text { margin: 0 0 1.2em; font-size: 0.85em; color: var(--muted); max-width: 38em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.6em; }
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  margin-top: 1.4em;
  padding-top: 1em;
  border-top: 1px dashed var(--border);
  font-size: 0.75em;
  color: var(--muted);
}
.hero__stats strong { display: block; font-size: 1.6em; color: var(--text); line-height: 1.1; }

.btn--pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 1.2em;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn--pill:hover { transform: translateY(-2px); }
.btn--pill.is-primary, .btn--pill.is-primary:visited { background: var(--accent); color: #fff; }
.btn--pill.is-primary:hover { background: #00c4cd; color: #fff; }
.btn--pill.is-ghost, .btn--pill.is-ghost:visited { color: var(--accent); background: transparent; }
.btn--pill.is-ghost:hover { background: var(--accent-soft); color: var(--link-hover); }

/* Post list toolbar (filters) --------------------------------------------- */
.posts-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  margin-bottom: 1.2em;
}
.posts-toolbar .archive__subtitle { margin: 0; padding: 0; border: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4em; margin: 0; padding: 0; list-style: none; }
.filter-chips li { margin: 0; }
.chip {
  display: inline-block;
  padding: 0.3em 0.85em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.65em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Post cards ---------------------------------------------------------------- */
.layout--home .entries-list .list__item { animation: cardIn 0.35s ease both; }
.layout--home .entries-list .list__item[hidden] { display: none !important; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.layout--home .archive__item,
.layout--archive .archive__item,
.layout--categories .archive__item,
.layout--tags .archive__item {
  position: relative;
  width: 100% !important;
  margin-bottom: 1.2em;
  padding: 1.2em 1.4em;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-card);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.layout--home .archive__item:hover,
.layout--archive .archive__item:hover,
.layout--categories .archive__item:hover,
.layout--tags .archive__item:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 173, 181, 0.5);
  border-left-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.archive__item-title a { text-decoration: none; transition: color 0.2s ease; }
.archive__item-title a:hover { color: var(--accent); }
.archive__item .archive__item-title { margin-top: 0; }
/* tag pills sit above the theme's full-card permalink overlay */
.layout--home .archive__item .post-tags { position: relative; z-index: 1; }

.archive__item-excerpt { color: #c9ccd1; }

.post-tags { display: flex; flex-wrap: wrap; gap: 0.35em; margin: 0.8em 0 0; padding: 0; list-style: none; }
.post-tags li { margin: 0; }
.post-tags .tag {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--link);
  font-size: 0.6em;
  font-family: Monaco, Consolas, "Lucida Console", monospace;
  text-decoration: none;
}
.post-tags .tag:hover { background: var(--accent); color: #fff; }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-top: 0.6em;
  font-size: 0.7em;
  font-weight: 700;
  color: var(--accent);
}
.read-more i { transition: transform 0.2s ease; }
.archive__item:hover .read-more i { transform: translateX(4px); }

.new-badge {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.1em 0.5em;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.5em;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Pagination ---------------------------------------------------------------- */
.layout--home .pagination { float: none; border-top: 0; margin-top: 0.5em; padding-top: 0.5em; }
.layout--home .pagination ul { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4em; }
.layout--home .pagination li { float: none; margin: 0; }
.layout--home .pagination li a {
  min-width: 2.6em;
  border-radius: 8px !important;
  border-color: var(--border-strong);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.layout--home .pagination li a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.layout--home .pagination li a.current,
.layout--home .pagination li a.current:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: none; }
.layout--home .pagination li a.disabled { opacity: 0.4; }
.pagination__status { margin: 0.6em 0 0; text-align: center; font-size: 0.65em; color: var(--muted); }
.no-results { padding: 2em 1em; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }

/* Post content -------------------------------------------------------------- */
.page__content h2 { border-bottom-color: var(--border); }
.page__content h2::before {
  content: "#";
  margin-right: 0.35em;
  color: var(--accent);
  opacity: 0.7;
}
.page__content blockquote { border-left-color: var(--accent); background: rgba(0, 173, 181, 0.06); padding: 0.6em 1em; border-radius: 0 8px 8px 0; }
.page__content img { border-radius: 8px; }
.page__content .author__avatar img { border-radius: 50%; }

/* Code block copy button */
.code-wrap { position: relative; }
.copy-code {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  z-index: 2;
  padding: 0.25em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: rgba(26, 29, 36, 0.9);
  color: var(--muted);
  font-size: 0.6em;
  font-family: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.code-wrap:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
.copy-code:hover { color: var(--accent); border-color: var(--accent); }
.copy-code.is-copied { color: #3ddc84; border-color: #3ddc84; opacity: 1; }
@media (hover: none) { .copy-code { opacity: 1; } }

/* TOC */
.toc { border-radius: 10px; overflow: hidden; border-color: var(--border); }
.toc .nav__title { background: var(--accent); }
.toc__menu a:hover { color: var(--accent); }
.toc__menu li.active > a { color: var(--accent); }

/* About page profile card --------------------------------------------------- */
.about-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.4em;
  margin-bottom: 1.6em;
  padding: 1.4em;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: radial-gradient(circle at 0% 0%, rgba(0, 173, 181, 0.15), transparent 60%), var(--bg-card);
}
.about-card .author__avatar { display: inline-block; width: auto; height: auto; }
.about-card .author__avatar img { width: 120px; height: 120px; max-width: 120px; }
.about-card .author__avatar::after { right: 8px; bottom: 8px; }
.page__content .about-card p { margin: 0; }
.about-card__name { margin: 0; font-size: 1.3em; font-weight: 800; }
.page__content .about-card .about-card__handle { margin: 0.1em 0 0.8em; font-family: Monaco, Consolas, "Lucida Console", monospace; color: var(--accent); font-size: 0.8em; }
.about-card__links { display: flex; flex-wrap: wrap; gap: 0.5em; }
.about-card__body { flex: 1 1 240px; }

/* Back to top --------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 1.2em;
  bottom: 1.2em;
  z-index: 50;
  width: 2.6em;
  height: 2.6em;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: rgba(26, 29, 36, 0.9);
  color: var(--accent);
  font-size: 0.8em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { background: var(--accent); color: #fff; }

/* Footer -------------------------------------------------------------------- */
.page__footer { border-top: 1px solid var(--border); }
.page__footer footer { text-align: center; }
.page__footer-follow .social-icons a { display: inline-flex; align-items: center; gap: 0.4em; transition: color 0.2s ease; }
.page__footer-follow .social-icons a:hover { color: var(--accent); text-decoration: none; }
.page__footer-follow .social-icons a:hover i { color: var(--accent); }
.page__footer-copyright { color: var(--muted); }

/* Motion preferences -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
