/* assets/blog.css */
:root {
  --bg: #0b0d10;
  --card: #12161b;
  --muted: #8aa0b3;
  --text: #e6eef7;
  --brand: #4cc9f0;
  --brand-2: #f72585;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(76, 201, 240, .08), transparent),
    radial-gradient(1000px 800px at 120% 10%, rgba(247, 37, 133, .08), transparent),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.6;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.header-hero {
  padding: 56px 0 24px;
  text-align: center;
}

.header-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -.02em;
}

.header-hero p {
  color: var(--muted);
  margin: 0 auto;
  max-width: 720px;
}

.searchbar {
  margin: 26px auto 10px;
  max-width: 720px;
  display: flex;
  gap: 10px;
}

.searchbar input[type="search"] {
  flex: 1;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #23303d;
  background: #0f1317;
  color: var(--text);
}

.searchbar button {
  padding: 14px 18px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 28px 0 60px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .01)),
    var(--card);
  border: 1px solid #1d2630;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}

.card .pad {
  padding: 16px;
}

.pad a {
  color: #00d9ff;
}

.pad a:hover {
  color: #259fb4;
}

.card .meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.4;
}

.card p {
  margin: 0 0 12px;
  color: #cfe2f3;
}

.pager {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 60px;
}

.pager a,
.pager span {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #243140;
  color: var(--text);
  text-decoration: none;
}

.pager a:hover {
  background: #17202a;
}

.pager .current {
  background: #182430;
  font-weight: 700;
}

/* Single */
.article-hero {
  padding: 20px 0 10px;
}

.breadcrumbs {
  font-size: 13px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--text);
}

.article-title {
  font-size: clamp(28px, 4.5vw, 44px);
  margin: 8px 0 8px;
}

.article-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.card a>img.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3.6;
  object-fit: cover;
  background: #0f1317;
}

/* Hero/banner image should NOT inherit the card thumbnail aspect-ratio */
.banner>img {
  display: block;
  width: 100%;
  height: auto;
  /* show full image height based on intrinsic ratio */
}

.banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.thumb-wrap>img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* or center 70% for text near top */
  display: block;
}


.article {
  margin: 22px 0 40px;
  font-size: 18px;
  color: #d6e6f5;
}

.article a {
  color: #9bd2ff;
}

.article pre,
.article code {
  background: #0f1317;
  border: 1px solid #223143;
  border-radius: 12px;
}

.article pre {
  padding: 14px;
  overflow: auto;
}

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.related {
  margin: 50px 0;
}

.related h3 {
  margin-bottom: 14px;
}

.related .grid {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .related .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .related .grid {
    grid-template-columns: 1fr;
  }
}

/* Utilities */
.visually-hidden {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

:root {
  --copy-fg-dark: #c9d1d9;
  --copy-fg-light: #24292f;
  --copy-ok: #22c55e;
  /* success green */
}

/* Smaller, tighter button */
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  /* was 28px */
  height: 24px;
  /* was 28px */
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(2px);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity .18s ease,
    background .18s ease,
    border-color .18s ease,
    transform .08s ease;
}

pre:hover .code-copy-btn,
.code-copy-btn:focus-visible {
  opacity: 1;
}

/* Make it always visible on touch devices */
@media (hover: none) {
  .code-copy-btn {
    opacity: 1;
  }
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.code-copy-btn:active {
  transform: translateY(1px);
}

.code-copy-btn svg {
  pointer-events: none;
  fill: currentColor;
  color: var(--copy-fg-dark);
  transition: color .18s ease, transform .18s ease;
}

@media (prefers-color-scheme: light) {
  .code-copy-btn svg {
    color: var(--copy-fg-light);
  }
}

/* Success state: subtle pop + green icon + slight bg tint */
.code-copy-btn.copied {
  background: rgba(34, 197, 94, 0.12);
  /* green tint */
  border-color: rgba(34, 197, 94, 0.25);
  transform: scale(1.06);
}

.code-copy-btn.copied svg {
  color: var(--copy-ok);
  transform: scale(1.1);
}

/* Tooltip using aria-label (unchanged) */
.code-copy-btn::after {
  content: attr(aria-label);
  position: absolute;
  top: -30px;
  right: 0;
  transform: translateY(0);
  white-space: nowrap;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.code-copy-btn:hover::after,
.code-copy-btn:focus-visible::after,
.code-copy-btn.copied::after {
  opacity: 1;
  transform: translateY(-4px);
}

/* Screen-reader only text (unchanged) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* floating tooltip (not clipped by <pre>) */
#copy-tooltip {
  position: absolute;
  /* positioned via JS with scroll offsets */
  z-index: 9999;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}

/* optional: a tiny arrow */
#copy-tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, .78);
}


.blogsby {
  text-decoration: none;
  color: #6fbe81
}

.back-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  transition: 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.back-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.22);
}


/* ── Comment section styles ─────────────────────────────────── */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
}

.comments-heading {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: inherit;
}

.comment-notice {
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: .92rem;
}

.comment-notice--success {
  background: #d1fae5;
  color: #065f46;
}

.comment-notice--error {
  background: #fee2e2;
  color: #991b1b;
}

/* Thread */
.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.comment {
  display: flex;
  gap: .85rem;
}

.comment--reply {
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid #e2e8f0;
}

.comment-replies {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.comment-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment--reply .comment-avatar {
  width: 30px;
  height: 30px;
  font-size: .8rem;
  background: #8b5cf6;
}

.comment-content {
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .3rem;
}

.comment-author {
  font-size: .95rem;
}

.comment-date {
  font-size: .78rem;
  color: #94a3b8;
}

.comment-body {
  font-size: .93rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply-toggle {
  margin-top: .5rem;
  background: none;
  border: none;
  padding: 0;
  font-size: .82rem;
  color: #6366f1;
  cursor: pointer;
  font-weight: 600;
}

.reply-toggle:hover {
  text-decoration: underline;
}

.reply-form {
  margin-top: 1rem;
}

.comment-empty {
  color: #94a3b8;
  font-size: .9rem;
  margin-bottom: 2rem;
}

/* Form */
.comment-form-wrap {
  background: #1e2023;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.comment-form-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
}

.comment-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  margin-bottom: .9rem;
}

@media (max-width: 540px) {
  .comment-fields {
    grid-template-columns: 1fr;
  }
}

.comment-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .9rem;
}

.comment-field:last-child {
  margin-bottom: 0;
}

.comment-field label {
  font-size: .83rem;
  font-weight: 600;
}

.comment-field small {
  font-weight: 400;
  color: #94a3b8;
}

.comment-fields .comment-field {
  margin-bottom: 0;
}

.comment-field input,
.comment-field textarea {
  padding: .55rem .75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: .92rem;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.comment-field input:focus,
.comment-field textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

.comment-field textarea {
  resize: vertical;
}

.char-count {
  font-size: .75rem;
  color: #94a3b8;
  text-align: right;
  display: block;
  margin-top: .2rem;
}

.comment-submit {
  margin-top: 1rem;
  padding: .6rem 1.4rem;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.comment-submit:hover {
  background: #4f46e5;
}

/* Delete button */
.comment-delete {
  background: transparent;
  border: none;
  color: #c0392b; /* soft red */
  font-size: 0.85rem;
  cursor: pointer;
  margin-left: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

/* Hover */
.comment-delete:hover {
  background: rgba(192, 57, 43, 0.1);
  color: #e74c3c;
}

/* Active click */
.comment-delete:active {
  transform: scale(0.95);
}

/* Optional: icon spacing */
.comment-delete::before {
  content: "";
  font-size: 0.9em;
}

.searchbar select {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #23303d;
  background: #0f1317;
  color: var(--text);
  cursor: pointer;
}

.comment--owner {
  border-left: 4px solid #7c3aed;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(124, 58, 237, 0.03));
  border-radius: 12px;
  padding: 14px;
}

.comment--owner .comment-avatar {
  background: #7c3aed;
  color: #fff;
  font-weight: 700;
}

.comment--owner .comment-author {
  color: #955feb;
  font-weight: 800;
}

.comment-owner-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .searchbar {
    flex-direction: column;
  }

  .searchbar input[type="search"],
  .searchbar select,
  .searchbar button {
    width: 100%;
  }
}