/* ============================================
   BLOG - CSS VARIABLES
   ============================================ */

:root {
  --ai-primary: #070707;
  --ai-secondary: #f0f4f8;
  --ai-bg: #000000;
  --ai-border: #e0e0e0;
  --ai-text: #030303;
  --primary-blue: #D4A017;
  --font-stack: system-ui, -apple-system, sans-serif;
  --radius-md: 8px;
  --comment-bg: #ffffff;
  --page-bg: #FFFDF5;
  --comment-text: #1A1A1A;
  --comment-secondary: #333333;
  --comment-border: #E8E0D0;
  --thread-line: #E8E0D0;
  --primary-accent: #E8B830;
  --primary-accent-hover: #D4A017;
  --like-color: #1A1A1A;
  --like-active: #E8B830;
  --dislike-color: #1A1A1A;
  --comment-hover: #D4C9B0;
  --shadow-sm: 0 1px 2px rgba(183, 181, 181, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(211, 208, 208, 0.1);
  --bg: #FFFDF5;
  --surface: #ffffff;
  --muted: #6B7280;
  --text: #1A1A1A;
  --accent: #D4A017;
  --accent-2: #B8860B;
  --radius: 12px;
  --container-max-width: 900px;
  --content-gap: 1.25rem;
  --measure: 65ch;
  --media-max-height: 56vh;
  --shadow-soft: 0 6px 24px rgba(0, 0, 0, 0.06);
  --glass: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.4));
  --code-bg: #0b1220;
  --code-fg: #e6eef6;
  --transition: 240ms cubic-bezier(.2,.9,.3,1);
}



/* Floating Chat Button */
.ai-chat-button {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: var(--ai-primary);
  border: none;
  color: white;
  font-size: 1.5rem;
  z-index: 999;
  transition: all 0.3s ease;
  animation: pulse-button 2s infinite;
}

.ai-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(6, 95, 212, 0.3);
}

@keyframes pulse-button {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(6, 95, 212, 0.3);
  }
  50% {
    box-shadow: 0 4px 24px rgba(6, 95, 212, 0.5);
  }
}

/* Chatbot Offcanvas */
#aiChatbot {
  width: 420px;
  background: var(--ai-bg);
  color: var(--ai-text);
}

#aiChatbot .offcanvas-header {
  background: var(--ai-secondary);
  border-color: var(--ai-border);
}

#aiChatbot .offcanvas-body {
  background: var(--ai-bg);
}

/* AI Avatar */
.ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ai-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Chat Messages Container */
.chat-messages {
  background: var(--ai-bg);
  border-bottom: 1px solid var(--ai-border);
}

/* Message Styles */
.ai-message,
.user-message {
  display: flex;
  margin-bottom: 1.5rem;
  animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message {
  justify-content: flex-start;
}

.ai-message .message-content {
  background: var(--ai-secondary);
  padding: 1rem;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: var(--ai-primary);
  color: white;
  padding: 1rem;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
}

.message-content p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.message-content a {
  color: inherit;
  text-decoration: underline;
}

.ai-message .message-content a {
  color: var(--ai-primary);
}

/* Suggested Questions */
.suggested-questions {
  margin-top: 0.75rem;
}

.suggest-btn {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-color: var(--ai-border);
  color: var(--ai-text);
  white-space: normal;
  text-align: left;
  height: auto;
  line-height: 1.4;
}

.suggest-btn:hover {
  background: var(--ai-primary);
  color: white;
  border-color: var(--ai-primary);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 1rem;
  background: var(--ai-secondary);
  border-radius: 12px;
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ai-primary);
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

/* Chat Input Area */
.chat-input-area {
  background: var(--ai-bg);
  border-top-color: var(--ai-border);
}

#chatInput {
  border-color: var(--ai-border);
  color: var(--ai-text);
  background: var(--ai-secondary);
  font-size: 0.9rem;
}

#chatInput::placeholder {
  color: var(--ai-text);
  opacity: 0.6;
}

#chatInput:focus {
  background: var(--ai-secondary);
  color: var(--ai-text);
  border-color: var(--ai-primary);
  box-shadow: 0 0 0 3px rgba(6, 95, 212, 0.1);
}

#sendBtn {
  background: var(--ai-primary);
  border-color: var(--ai-primary);
  color: white;
  font-size: 0.9rem;
}

#sendBtn:hover {
  background: #0d47a1;
  border-color: #000000;
}

#sendBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error Message */
.error-message {
  background: #fee;
  color: #c33;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Loading State */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
  #aiChatbot {
    width: 100% !important;
    max-width: 100%;
  }

  .ai-chat-button {
    width: 50px;
    height: 50px;
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .ai-message .message-content,
  .user-message .message-content {
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .ai-chat-button {
    width: 45px;
    height: 45px;
    bottom: 1rem;
    right: 1rem;
    font-size: 1.2rem;
  }

  #chatInput {
    font-size: 16px; /* Prevent iOS zoom */
  }
}

/* ============================================
   DISCUSSION SECTION - YOUTUBE STYLE
   ============================================ */








.discussion-section {
  background: transparent;
  border-top: 1px solid var(--comment-border);
  padding-top: 2rem !important;
}

/* -------- HEADER SECTION -------- */
.discussion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.discussion-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--comment-text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.discussion-title i {
  font-size: 1.5rem;
  color: var(--primary-blue);
}

/* Sort Options */
.sort-options {
  display: flex;
  gap: 0.5rem;
}

.sort-btn {
  background: transparent;
  border: 1px solid var(--comment-border);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  color: var(--comment-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.sort-btn:hover {
  background: var(--comment-hover);
  color: var(--comment-text);
}

.sort-btn.active {
  background: var(--comment-text);
  color: var(--comment-bg);
  border-color: var(--comment-text);
}

/* -------- COMMENT INPUT SECTION -------- */
.comment-input-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.user-avatar-small {
  flex-shrink: 0;
}

.avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--comment-hover);
}

.input-container {
  flex: 1;
}

.comment-input-box {
  background: var(--comment-bg);
  border: 1px solid var(--comment-border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.comment-input-box:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(6, 95, 212, 0.1);
}

.comment-textarea {
  width: 100%;
  border: none;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--comment-text);
  background: transparent;
  resize: vertical;
  max-height: 150px;
  min-height: 40px;
}

.comment-textarea::placeholder {
  color: var(--comment-secondary);
}

.comment-textarea:focus {
  outline: none;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--comment-border);
  background: var(--comment-hover);
}

.format-btn {
  background: transparent;
  border: none;
  color: var(--comment-secondary);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  border-radius: 4px;
}

.format-btn:hover {
  background: var(--comment-border);
  color: var(--comment-text);
}

.action-spacer {
  flex: 1;
}

.btn-cancel,
.btn-submit {
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-cancel {
  background: transparent;
  color: var(--comment-secondary);
}

.btn-cancel:hover {
  background: var(--comment-border);
}

.btn-submit {
  background: var(--primary-blue);
  color: white;
}

.btn-submit:hover {
  background: #0d47a1;
}

.btn-submit:active {
  transform: scale(0.98);
}

/* -------- LOGIN PROMPT -------- */
.login-prompt {
  background: var(--comment-hover);
  border: 1px solid var(--comment-border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.prompt-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--comment-secondary);
}

.prompt-content i {
  font-size: 1.5rem;
  color: var(--primary-blue);
}

.login-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
}

.login-link:hover {
  text-decoration: underline;
}

/* -------- COMMENTS CONTAINER -------- */
.comments-container {
  margin-top: 2rem;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--comment-secondary);
}

.spinner-dots {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.spinner-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-blue);
  animation: pulse 1.4s infinite;
}

.spinner-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.spinner-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

/* -------- COMMENT ITEM -------- */
.comment-item {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--comment-border);
  transition: background 0.2s ease;
  animation: slideIn 0.3s ease;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-item:hover {
  background: var(--comment-hover);
  margin: 0 -1rem;
  padding: 1.5rem 1rem;
  border-radius: 8px;
}

.comment-avatar {
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.comment-avatar .avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-content {
  flex: 1;
  min-width: 0;
}

/* Comment Header */
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.comment-author {
  color: var(--comment-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.2s;
}

.comment-author:hover {
  color: var(--primary-blue);
}

.author-badge {
  background: var(--primary-blue);
  color: rgb(9, 9, 9);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.comment-time {
  font-size: 0.85rem;
}

.comment-header .dropdown {
  position: relative;
  flex-shrink: 0;
}

.comment-menu-btn {
  background: transparent;
  border: none;
  color: var(--comment-secondary);
  cursor: pointer;
  padding: 0.4rem;
  font-size: 1rem;
  transition: all 0.2s;
  border-radius: 4px;
}

.comment-menu-btn:hover {
  background: var(--comment-border);
  color: var(--comment-text);
}

.comment-header .dropdown-menu {
  min-width: 130px;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border: 1px solid var(--comment-border);
  margin-top: 4px !important;
  z-index: 1050;
  opacity: 1;
  transform: none;
  animation: none;
  display: none;
}
.comment-header .dropdown-menu.show {
  display: block;
  animation: none;
  opacity: 1;
  transform: none;
}

.comment-header .dropdown-item {
  padding: 0.4rem 1rem;
  transition: background 0.15s;
  display: block;
  transform: none !important;
}

.comment-header .dropdown-item:hover {
  background: var(--comment-border);
  transform: none !important;
}

.comment-header .dropdown-item.text-danger:hover {
  background: rgba(220,38,38,0.08);
}

/* Comment Text */
.comment-text {
  color: var(--comment-text);
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

/* Comment Actions */
.comment-actions {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-top: 1rem;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--comment-secondary);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.action-btn:hover {
  color: var(--comment-text);
  background: var(--comment-border);
}

.like-btn.active,
.like-btn.liked {
  color: var(--like-color);
}

.dislike-btn.active,
.dislike-btn.disliked {
  color: var(--dislike-color);
}

.action-count {
  font-size: 0.8rem;
  min-width: 20px;
}

/* -------- REPLIES SECTION (YOUTUBE STYLE) -------- */
.replies-container {
  margin-top: 1rem;
}

.toggle-replies-btn {
  background: transparent;
  border: none;
  color: var(--primary-blue);
  cursor: pointer;
  padding: 0.5rem 0;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.toggle-replies-btn:hover {
  color: #0d47a1;
}

.toggle-replies-btn i {
  font-size: 0.8rem;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.toggle-replies-btn.open i {
  transform: rotate(90deg);
}

.toggle-replies-btn .reply-count {
  font-weight: 600;
}

.toggle-replies-btn .reply-text {
  font-weight: 400;
}

.replies-list {
  margin-top: 1rem;
  position: relative;
  animation: slideIn 0.2s ease;
}

.replies-list.hidden {
  display: none;
}

/* VERTICAL LINE FOR REPLIES (YOUTUBE STYLE) */
.replies-thread {
  position: relative;
  margin-left: 20px;
  padding-left: 16px;
  border-left: 2px solid var(--thread-line);
}

.replies-thread::before {
  content: '';
  position: absolute;
  left: -2px;
  top: -16px;
  width: 2px;
  height: 16px;
  background: var(--thread-line);
}

/* Reply Item */
.reply-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--comment-border);
  animation: slideIn 0.2s ease;
}

.reply-item:last-child {
  border-bottom: none;
}

.reply-item:hover {
  background: var(--comment-hover);
  margin: 0 -1rem;
  padding: 1rem;
  border-radius: 8px;
}

.reply-avatar {
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.reply-avatar .avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.reply-content {
  flex: 1;
  min-width: 0;
}

.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.reply-author {
  color: var(--comment-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.reply-author:hover {
  color: var(--primary-blue);
}

.reply-time {
  font-size: 0.8rem !important;
}

.reply-text {
  color: var(--comment-text);
  line-height: 1.4;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.reply-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.reply-like-btn,
.reply-dislike-btn {
  padding: 0.3rem 0.6rem !important;
  font-size: 0.8rem !important;
  gap: 0.3rem !important;
}

.reply-like-btn.liked,
.reply-dislike-btn.disliked {
  color: var(--primary-blue);
}

/* -------- REPLY INPUT BOX -------- */
.reply-input-box {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--comment-border);
  animation: slideIn 0.2s ease;
}

.reply-input-container {
  flex: 1;
}

.reply-textarea-wrapper {
  background: var(--comment-bg);
  border: 1px solid var(--comment-border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.reply-textarea-wrapper:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(6, 95, 212, 0.1);
}

.reply-textarea {
  width: 100%;
  border: none;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--comment-text);
  background: transparent;
  resize: vertical;
  max-height: 100px;
  min-height: 35px;
}

.reply-textarea:focus {
  outline: none;
}

.reply-textarea::placeholder {
  color: var(--comment-secondary);
}

.reply-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1rem 0.75rem 1rem;
  border-top: 1px solid var(--comment-border);
  background: var(--comment-hover);
}

.btn-cancel-reply,
.btn-submit-reply {
  padding: 0.35rem 1rem;
  border-radius: 20px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-cancel-reply {
  background: transparent;
  color: var(--comment-secondary);
}

.btn-cancel-reply:hover {
  background: var(--comment-border);
  color: var(--comment-text);
}

.btn-submit-reply {
  background: var(--primary-blue);
  color: white;
}

.btn-submit-reply:hover {
  background: #0d47a1;
}

.btn-submit-reply:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* -------- ANIMATIONS -------- */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.action-btn.active {
  background: rgba(252, 255, 59, 0.1);
}

.action-btn.active i {
  color: var(--primary-blue);
}

/* -------- RESPONSIVE -------- */
@media (max-width: 768px) {
  .discussion-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sort-options {
    width: 100%;
    justify-content: flex-start;
  }

  .comment-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .user-info {
    width: 100%;
  }

  .comment-actions {
    gap: 1rem;
  }

  .action-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  .comment-textarea,
  .reply-textarea {
    font-size: 1rem; /* Prevent zoom on iOS */
  }

  .reply-item:hover {
    margin: 0;
    padding: 1rem 0;
    background: transparent;
  }

  .discussion-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .sort-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .comment-item:hover {
    margin: 0;
    padding: 1.5rem 0;
    background: transparent;
  }

  .action-btn {
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
  }

  .reply-item:hover {
    margin: 0;
    padding: 1rem 0;
    background: transparent;
  }

  .replies-thread {
    margin-left: 16px;
    padding-left: 12px;
  }
}



/* Page container */
.blog-container{
  max-width: var(--container-max-width);
  margin: 2.25rem auto;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Content measure and flow */
.blog-content{
  max-width: var(--measure);
  margin: 0 auto;
  display: grid;
  gap: var(--content-gap);
  align-items: start;
}

/* Fluid responsive typography */
h1,h2,h3,h4,h5,h6{
  font-family: "Merriweather", Georgia, serif;
  color: var(--text);
  margin: 0 0 0.45em 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1{ font-size: clamp(1.6rem, 2.6vw + 0.8rem, 2.6rem); border-bottom: 4px solid rgba(37,99,235,0.12); padding-bottom: 0.45rem; }
h2{ font-size: clamp(1.25rem, 2.1vw + 0.6rem, 1.8rem); padding-left: 0.6rem; border-left: 6px solid rgba(14,165,233,0.12); }
h3{ font-size: clamp(1.05rem, 1.6vw + 0.4rem, 1.25rem); color: #0b1220; }
p{ margin: 0 0 1rem 0; color: #334155; font-size: 1rem; }

/* Paragraph lead */
.lead{
  font-size: 1.06rem;
  color: #0f172a;
  font-weight: 500;
  margin-bottom: 0.9rem;
  opacity: 0.95;
}

/* Figures and media wrapper ensures image fits within container max height */
.figure{
  display: block;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.01));
  box-shadow: 0 8px 30px rgba(2,6,23,0.06);
}

/* Media wrapper constrains height and centers content */
.media-wrap{
  width: 100%;
  max-height: var(--media-max-height);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f8fafc;
}

/* Images and videos scale to fill while preserving aspect ratio */
.figure img,
.figure video,
.figure iframe{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  -o-object-fit: cover;
  transition: transform var(--transition), filter var(--transition);
}

/* Prevent images from exceeding container height while keeping width responsive */
.blog-content img{
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utility to strictly cap image height inside a container */
.img-contained{
  width: 100%;
  height: 100%;
  max-height: var(--media-max-height);
  object-fit: contain;
  object-position: center;
  background: #f3f4f6;
}

/* Caption styling */
.figcaption{
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.4));
  border-top: 1px solid rgba(15,23,42,0.03);
}

/* Image hover subtle zoom for decorative images */
.figure:hover img{ transform: scale(1.03); filter: saturate(1.03); }

/* Lists */
ul, ol{
  margin: 0 0 1rem 1.25rem;
  color: #334155;
}
ul li, ol li{ margin: 0.45rem 0; }

/* Fancy list bullets */
ul.custom-bullets li{
  position: relative;
  padding-left: 1.25rem;
}
ul.custom-bullets li::before{
  content: "";
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg,var(--accent),var(--accent-2));
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 0.55rem;
  transform: translateY(-50%);
}

/* Blockquote and pullquote */
blockquote{
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid rgba(37,99,235,0.12);
  background: rgba(37,99,235,0.03);
  color: #0b1220;
  font-style: italic;
  border-radius: 8px;
}

/* Code blocks */
pre, code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", monospace;
  font-size: 0.92rem;
}
pre{
  background: linear-gradient(180deg, rgba(11,18,32,0.96), rgba(8,12,20,0.96));
  color: var(--code-fg);
  padding: 1rem;
  border-radius: 10px;
  overflow: auto;
  box-shadow: 0 6px 20px rgba(2,6,23,0.45);
}

/* Tables responsive */
.table-wrap{
  width: 100%;
  overflow: auto;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.04);
}
table{
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.95rem;
}
th, td{
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(15,23,42,0.06);
  text-align: left;
}
th{
  background: linear-gradient(90deg, rgba(14,165,233,0.12), rgba(37,99,235,0.08));
  color: #06202a;
  position: sticky;
  top: 0;
}

/* Links */
a{
  color: var(--accent-2);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover{ color: var(--accent); text-decoration: underline; }

/* Accessibility focus */
a:focus, button:focus, input:focus{
  outline: 3px solid rgba(14,165,233,0.18);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Utilities */
.center{ text-align: center; }
.kicker{ font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.35rem; }
.badge{ display:inline-block; padding: 0.25rem 0.6rem; background: rgba(37,99,235,0.08); color: var(--accent-2); border-radius: 999px; font-weight:600; font-size:0.8rem; }

/* Responsive adjustments */
@media (max-width: 880px){
  .blog-container{ padding: 1rem; margin: 1rem; }
  :root{ --media-max-height: 44vh; }
  .blog-content{ gap: 1rem; }
  pre{ font-size: 0.86rem; }
}



/* ============================================
   BLOG POST PAGE - HERO & LAYOUT
   ============================================ */
/* ---- BLOG HERO - AESTHETIC REDESIGN ---- */
.blog-hero {
  position: relative;
  padding: 5rem 0 4rem;
  overflow: hidden;
  background: linear-gradient(160deg, #0f0c29 0%, #1a1a3e 35%, #24243e 60%, #1e1e3a 100%);
}

.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(212,160,23,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(100,50,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(212,160,23,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.blog-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M50 50c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10zM10 10c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10S0 25.523 0 20s4.477-10 10-10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

/* Floating decorative blobs */
.blog-hero .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: blobFloat 20s ease-in-out infinite alternate;
}
.blog-hero .blob-1 {
  width: 400px; height: 400px;
  background: rgba(212,160,23,0.08);
  top: -100px; right: -100px;
  animation-delay: 0s;
}
.blog-hero .blob-2 {
  width: 300px; height: 300px;
  background: rgba(100,50,255,0.06);
  bottom: -80px; left: -80px;
  animation-delay: -7s;
}
.blog-hero .blob-3 {
  width: 200px; height: 200px;
  background: rgba(212,160,23,0.05);
  top: 50%; left: 60%;
  animation-delay: -14s;
}

@keyframes blobFloat {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
  100% { transform: translate(15px, -25px) scale(1.02); }
}

.blog-hero .container { position: relative; z-index: 2; }

/* Breadcrumb in hero */
.blog-hero .hero-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 1.5rem;
}
.blog-hero .hero-breadcrumb a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.2s;
}
.blog-hero .hero-breadcrumb a:hover { color: #ffd700; }
.blog-hero .hero-breadcrumb .sep { color: rgba(255,255,255,0.3); margin: 0 0.25rem; }
.blog-hero .hero-breadcrumb .current { color: rgba(255,255,255,0.9); font-weight: 600; }

/* Category badge */
.blog-hero .hero-category {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  background: linear-gradient(135deg, rgba(212,160,23,0.2), rgba(212,160,23,0.08));
  border: 1px solid rgba(212,160,23,0.25);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

/* Title */
.blog-hero h1 {
  color: #ffffff;
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  max-width: 900px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

/* Meta card - glassmorphism */
.blog-hero .hero-meta-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  margin-top: 1rem;
  max-width: fit-content;
}

.blog-hero .hero-meta-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.blog-hero .hero-meta-item .meta-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.blog-hero .hero-meta-item .meta-icon.gold { background: rgba(212,160,23,0.15); color: #ffd700; }
.blog-hero .hero-meta-item .meta-icon.purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.blog-hero .hero-meta-item .meta-icon.blue { background: rgba(59,130,246,0.15); color: #93c5fd; }
.blog-hero .hero-meta-item .meta-icon.green { background: rgba(16,185,129,0.15); color: #6ee7b7; }

.blog-hero .hero-meta-item .meta-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  line-height: 1;
}
.blog-hero .hero-meta-item .meta-value {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.blog-hero .hero-meta-item .meta-value .views-num { color: #ffd700; }

/* Author avatar in hero */
.blog-hero .author-avatar-hero {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(212,160,23,0.4);
  object-fit: cover;
  flex-shrink: 0;
}

/* Gradient line separator */
.blog-hero .hero-divider {
  width: 60px; height: 3px;
  background: linear-gradient(90deg, #ffd700, rgba(212,160,23,0.2));
  border-radius: 999px;
  margin: 1.5rem 0;
}

@media (max-width: 768px) {
  .blog-hero { padding: 3rem 0 2.5rem; }
  .blog-hero h1 { font-size: 1.4rem; }
  .blog-hero .hero-meta-card {
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    width: 100%;
  }
  .blog-hero .blob-1 { width: 250px; height: 250px; top: -80px; right: -80px; }
  .blog-hero .blob-2 { width: 200px; height: 200px; }
}

@media (max-width: 480px) {
  .blog-hero .hero-meta-item .meta-value { font-size: 0.82rem; white-space: normal; }
  .blog-hero .hero-breadcrumb { font-size: 0.75rem; padding: 0.3rem 0.8rem; }
}

/* Reading Progress Bar */
#reading-progress {
  position: fixed; top: 0; left: 0; width: 0; height: 4px;
  background: linear-gradient(90deg, #ffd700, #ff6b6b);
  z-index: 9999; transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

/* Social Sidebar */
.social-sidebar {
  position: fixed; left: 1rem; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.75rem; z-index: 100;
}
.social-sidebar a {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; color: #111; border: 2px solid #ffd700;
  transition: all 0.2s ease; text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.social-sidebar a:hover {
  background: #ffd700; color: #111; transform: scale(1.1);
}

/* Breadcrumb */
.breadcrumb {
  background: #ffffff !important; border-radius: 12px !important;
  padding: 0.6rem 1.2rem !important; border: 1px solid #f3e27a !important;
  margin-bottom: 1.5rem !important; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.breadcrumb a { color: #D4A017 !important; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .breadcrumb-item { color: #333333 !important; }
.breadcrumb .breadcrumb-item+.breadcrumb-item::before { color: #D4A017 !important; content: "/" !important; }
.breadcrumb .breadcrumb-item.active { color: #888888 !important; }
.breadcrumb .breadcrumb-item i { margin-right: 0.25rem; }

/* Content Box */
.content-box {
  max-width: 900px; margin: 0 auto; padding: 2rem 1rem;
}
.content-box .container { max-width: 100%; padding: 0; }

/* Blog Content Typography */
.blog-content {
  font-size: 1.05rem; line-height: 1.8; color: #1a1a2e;
}
.blog-content p { margin-bottom: 1.25rem; }
.blog-content h2, .blog-content h3, .blog-content h4 {
  margin-top: 2rem; margin-bottom: 1rem; font-weight: 700;
  color: #0f0f0f;
}
.blog-content h2 { font-size: 1.6rem; border-bottom: 3px solid #ffd700; padding-bottom: 0.5rem; }
.blog-content h3 { font-size: 1.3rem; }
.blog-content img { max-width: 100%; height: auto; border-radius: 12px; margin: 1.5rem 0; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.blog-content blockquote {
  border-left: 4px solid #ffd700; background: #fffdf2;
  padding: 1rem 1.5rem; margin: 1.5rem 0; border-radius: 0 12px 12px 0;
  font-style: italic; color: #333;
}
.blog-content ul, .blog-content ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.blog-content li { margin-bottom: 0.5rem; }
.blog-content pre {
  background: #0f0f0f; color: #e6eef6; padding: 1.25rem; border-radius: 12px;
  overflow-x: auto; font-size: 0.9rem; margin: 1.5rem 0;
  border: 1px solid #333;
}
.blog-content code {
  background: #f0f0f0; color: #d63384; padding: 0.15rem 0.4rem;
  border-radius: 4px; font-size: 0.9rem;
}
.blog-content pre code { background: transparent; color: inherit; padding: 0; }
.blog-content a { color: #d4a900; text-decoration: underline; }

/* Post Navigation (Prev/Next) */
.pagination .page-link {
  border-radius: 50px !important; padding: 0.55rem 1.2rem !important;
  font-weight: 600; color: #111; border: 2px solid #f2dc6f;
  background: #fff; transition: all 0.3s ease;
}
.pagination .page-link:hover {
  background: #ffd700; color: #111; border-color: #ffd700;
}
.pagination .page-item.disabled .page-link {
  opacity: 0.5; cursor: not-allowed; background: #faf7e8;
}

/* Print Button */
.btn-info {
  background: #111 !important; color: #ffd700 !important;
  border: 2px solid #ffd700 !important; border-radius: 50px !important;
  padding: 0.55rem 1.2rem !important; font-weight: 600 !important;
}
.btn-info:hover { background: #ffd700 !important; color: #111 !important; }

/* Ad Section */
.adsbygoogle { border-radius: 12px; overflow: hidden; }

/* Mobile */
@media (max-width: 768px) {
  .social-sidebar { display: none; }
  .content-box { padding: 1rem 0.75rem; }
  .blog-content { font-size: 1rem; }
  .custom-bg { padding: 2rem 0; }
  .custom-bg h1 { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .breadcrumb { font-size: 0.85rem; padding: 0.5rem 0.8rem !important; }
}


