/* WebWrite Global Blog Stylesheet */

/* Google Fonts Import (Georgia is a system font, not on Google Fonts) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Fira+Code:wght@300;400;500;600;700&display=swap');

/* Custom Scrollbar Styles - Auto-hide behavior */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}

/* Webkit scrollbar styles */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: transparent;
}

/* Show scrollbar when scrolling */
.scrolling *::-webkit-scrollbar-thumb {
  background: var(--color-divider);
}

.scrolling *::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

.scrolling {
  scrollbar-color: var(--color-divider) transparent;
}

/* Dark theme scrollbar colors */
:root[data-theme="dark"] .scrolling *::-webkit-scrollbar-thumb {
  background: #808080;
}

:root[data-theme="dark"] .scrolling *::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

:root[data-theme="dark"] .scrolling {
  scrollbar-color: #808080 transparent;
}

/* Light theme scrollbar colors */
:root[data-theme="light"] .scrolling *::-webkit-scrollbar-thumb {
  background: #666666;
}

:root[data-theme="light"] .scrolling *::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

:root[data-theme="light"] .scrolling {
  scrollbar-color: #666666 transparent;
}

/* CSS Reset & Base Styles */
*, *::before, *::after {
  margin: 0;
  padding: 0;
}

/* Disable all focus rings globally */
*:focus,
*:focus-visible,
*:focus-within {
  outline: none;
}

/* Override any existing focus styles with higher specificity */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus,
[contenteditable]:focus {
  outline: none;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Content sizing variable: used to cap image max-height to container width */
:root {
  --content-max-width: 100vw;
}

/* Theme Variables - Matching Editor Styles */
:root[data-theme="light"] {
  --color-background: #D1D1D1;
  --color-primary: #000000;
  --color-secondary: #666666;
  --color-accent: #F58738;
  --color-divider: #666666;
  --color-buttonBg: #000000;
  --color-buttonText: #FFFFFF;
  --color-muted: #999999;
  --color-navBg: #FFFFFF;
  --color-reviewStepBg: #F8F9FA;
  --color-input-filled: #F0F8FF;
  --color-code-bg: #f7fafc;
  --color-blockquote-bg: #f8fafc;
  --color-blockquote-border: #e2e8f0;
  --color-card-bg: #ffffff;
  --color-card-border: #e2e8f0;
  --color-shadow: rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: +4px +4px 10px 0px rgba(0, 0, 0, 0.25);
  --shadow-top: -4px +4px 10px 0px rgb(0 0 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md-lg: 0 7px 10px -2px rgb(0 0 0 / 0.1), 0 3px 5px -3px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

:root[data-theme="dark"] {
  --color-background: #2E2E2E;
  --color-primary: #E3E3E3;
  --color-secondary: #D1D1D1;
  --color-accent: #F58738;
  --color-divider: #808080;
  --color-buttonBg: #FFFFFF;
  --color-buttonText: #000000;
  --color-muted: #999999;
  --color-navBg: #000000;
  --color-reviewStepBg: #404040;
  --color-input-filled: #E8F0FE;
  --color-code-bg: #1e293b;
  --color-blockquote-bg: #1e293b;
  --color-blockquote-border: #475569;
  --color-card-bg: #1e293b;
  --color-card-border: #334155;
  --color-shadow: rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: +4px +4px 10px 0px rgba(0, 0, 0, 0.25);
  --shadow-top: -4px +4px 10px 0px rgb(0 0 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md-lg: 0 7px 10px -2px rgb(0 0 0 / 0.1), 0 3px 5px -3px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-primary);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: none;
}

/* Typography Scale */
h1, h2, h3 {
  font-family: var(--font-family, 'Inter'), sans-serif;
  color: var(--color-primary);
  letter-spacing: -0.025em;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

h2 {
  font-size: 2rem;
  margin: 3rem 0 1.5rem 0;
  font-weight: 600;
  position: relative;
}



h3 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem 0;
  font-weight: 600;
}

p {
  margin: 0 0 1.5rem 0;
  font-size: 1.125rem;
  color: var(--color-primary);
  font-weight: 400;
}

/* Links */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

a:hover {
  color: var(--color-accent);
  opacity: 0.8;
}

/* Link underline effect disabled */
.blog-content a:hover::after,
.prose-editor a:hover::after,
.blog-footer a:hover::after,
.blog-author a:hover::after { content: none; }

/* Horizontal Rule */
hr {
  border: none;
  height: 1px;
  background: var(--color-divider);
  margin: 2rem 0;
  opacity: 1;
  display: block;
  width: 100%;
}

/* Lists */
ul, ol {
  margin: 0 0 1.5rem 0;
  padding-left: 1.75rem;
}

ul li, ol li {
  margin: 0.75rem 0;
  color: var(--color-primary);
  font-size: 1.125rem;
}

ul li::marker {
  color: var(--color-primary);
  font-weight: 400;
}

ol li::marker {
  color: var(--color-primary);
  font-weight: 400;
}

/* Blockquotes */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--color-accent);
  background: var(--color-card-bg);
  font-family: 'Inter', sans-serif;
  font-style: italic;
  color: var(--color-secondary);
  position: relative;
  border-radius: 0 0.5rem 0.5rem 0;
  box-shadow: none;
}

/* Removed quotation marks from blockquotes */

blockquote p {
  margin-bottom: 0;
  color: var(--color-secondary);
  position: relative;
  z-index: 1;
  font-size: 1.125rem;
}

/* Code */
code {
  font-family: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  background-color: var(--color-code-bg);
  color: var(--color-accent);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  border: 1px solid var(--color-divider);
  font-feature-settings: "liga" 1, "calt" 1; /* Enable ligatures */
}

pre {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--color-code-bg);
  border-radius: 0.75rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  border: 1px solid var(--color-divider);
  box-shadow: none;
  font-feature-settings: "liga" 1, "calt" 1; /* Enable ligatures */
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  border: none;
}

/* Syntax Highlighting Overrides */
.hljs {
  background: var(--color-code-bg) !important;
  color: var(--color-primary) !important;
  padding: 1.5rem !important;
  border-radius: 0.75rem !important;
  border: 1px solid var(--color-divider) !important;
  font-family: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
  font-feature-settings: "liga" 1, "calt" 1; /* Enable ligatures */
}

/* Dark theme syntax highlighting */
:root[data-theme="dark"] .hljs {
  background: var(--color-code-bg) !important;
  color: var(--color-primary) !important;
}

/* Blog Container Layouts */
.blog-container {
  max-width: 100vw;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
}

.blog-header {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 0.5px solid var(--color-muted);
  text-align: center;
}

.blog-title {
  font-size: 2.5rem;
  font-family: var(--font-family, 'Inter'), sans-serif;
  font-weight: 700; /* Match editor's font-bold */
  color: var(--color-primary);
  margin-bottom: 2rem;
  margin-top: 4rem; /* Add space for fixed theme toggle button */
  letter-spacing: -0.025em;
}

.blog-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: 1rem;
  color: var(--color-secondary);
  flex-wrap: wrap;
}

.blog-author {
  font-weight: 600;
  color: var(--color-secondary);
}

.blog-author a {
  color: var(--color-accent);
  text-decoration: none;
  transition: all 0.2s ease;
}

.blog-author a:hover {
  color: var(--color-accent);
  opacity: 0.8;
}

.blog-date {
  color: var(--color-muted);
  font-weight: 500;
}

.blog-content, .prose-editor {
  font-size: 1.125rem;
  color: var(--color-primary);
  max-width: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.blog-content > *:first-child,
.prose-editor > *:first-child {
  margin-top: 0;
}

.blog-content > *:last-child,
.prose-editor > *:last-child {
  margin-bottom: 0;
}

.blog-footer {
  margin-top: 5rem;
  padding-top: 3rem;
  border-top: 0.5px solid var(--color-muted);
  text-align: center;
  font-size: 1rem;
  color: var(--color-secondary);
}

.blog-footer a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.blog-footer a:hover {
  color: var(--color-accent);
  opacity: 0.8;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0;
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
}

/* Syntax Highlighting - Light Theme */
.hljs-comment,
.hljs-quote {
  color: #6a737d;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
  color: #d73a49;
  font-weight: 600;
}

.hljs-number,
.hljs-string,
.hljs-meta .hljs-meta-string,
.hljs-literal,
.hljs-doctag,
.hljs-regexp {
  color: #032f62;
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
  color: #6f42c1;
  font-weight: 600;
}

.hljs-attribute,
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-class .hljs-title,
.hljs-type {
  color: #e36209;
}

.hljs-symbol,
.hljs-bullet,
.hljs-subst,
.hljs-meta,
.hljs-meta .hljs-keyword,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-link {
  color: #005cc5;
}

.hljs-built_in,
.hljs-deletion {
  color: #22863a;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

/* Syntax Highlighting - Dark Theme */
:root[data-theme="dark"] .hljs-comment,
:root[data-theme="dark"] .hljs-quote {
  color: #8b949e;
  font-style: italic;
}

:root[data-theme="dark"] .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-tag,
:root[data-theme="dark"] .hljs-addition {
  color: #ff7b72;
  font-weight: 600;
}

:root[data-theme="dark"] .hljs-number,
:root[data-theme="dark"] .hljs-string,
:root[data-theme="dark"] .hljs-meta .hljs-meta-string,
:root[data-theme="dark"] .hljs-literal,
:root[data-theme="dark"] .hljs-doctag,
:root[data-theme="dark"] .hljs-regexp {
  color: #a5d6ff;
}

:root[data-theme="dark"] .hljs-title,
:root[data-theme="dark"] .hljs-section,
:root[data-theme="dark"] .hljs-name,
:root[data-theme="dark"] .hljs-selector-id,
:root[data-theme="dark"] .hljs-selector-class {
  color: #d2a8ff;
  font-weight: 600;
}

:root[data-theme="dark"] .hljs-attribute,
:root[data-theme="dark"] .hljs-attr,
:root[data-theme="dark"] .hljs-variable,
:root[data-theme="dark"] .hljs-template-variable,
:root[data-theme="dark"] .hljs-class .hljs-title,
:root[data-theme="dark"] .hljs-type {
  color: #ffa657;
}

:root[data-theme="dark"] .hljs-symbol,
:root[data-theme="dark"] .hljs-bullet,
:root[data-theme="dark"] .hljs-subst,
:root[data-theme="dark"] .hljs-meta,
:root[data-theme="dark"] .hljs-meta .hljs-keyword,
:root[data-theme="dark"] .hljs-selector-attr,
:root[data-theme="dark"] .hljs-selector-pseudo,
:root[data-theme="dark"] .hljs-link {
  color: #79c0ff;
}

:root[data-theme="dark"] .hljs-built_in,
:root[data-theme="dark"] .hljs-deletion {
  color: #7ee787;
}

/* Responsive Design */
@media (max-width: 768px) {
  .blog-container {
    max-width: 100vw;
    padding: 1.5rem 1rem;
  }
  :root { --content-max-width: calc(100vw - 2rem); }
  
  /* Typography scaling for mobile */
  body {
    font-size: 16px; /* Base font size for mobile */
  }
  
  .blog-title {
    font-size: 1.875rem; /* 30px - reduced from 2.5rem */
    margin-top: 3rem; /* Reduced margin for mobile theme toggle */
    line-height: 1.2;
  }
  
  .blog-content, .prose-editor {
    font-size: 1rem; /* 16px - optimal for mobile reading */
    line-height: 1.6;
  }
  
  /* Heading scaling for mobile */
  h1 {
    font-size: 1.75rem; /* 28px */
    margin-bottom: 1rem;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.5rem; /* 24px */
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.25rem; /* 20px */
    margin: 1.5rem 0 0.75rem 0;
    line-height: 1.4;
  }
  
  /* Paragraph and text scaling */
  p {
    font-size: 1rem;
    margin: 0 0 1rem 0;
    line-height: 1.6;
  }
  
  /* Blog meta scaling */
  .blog-meta {
    font-size: 0.875rem; /* 14px */
    flex-direction: column;
    gap: 0.75rem;
  }
  
  /* Code scaling */
  code {
    font-size: 0.875rem; /* 14px */
  }
  
  pre {
    font-size: 0.875rem;
    padding: 1rem;
  }
  
  /* Blockquote scaling */
  blockquote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 1rem;
  }
  
  blockquote p {
    font-size: 1rem;
  }
  
  /* List scaling */
  ul, ol {
    font-size: 1rem;
  }
  
  ul li, ol li {
    font-size: 1rem;
    margin: 0.5rem 0;
  }
  
  /* Theme toggle scaling */
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }
  
  pre {
    font-size: 0.75rem;
    padding: 1rem;
  }
  
  code {
    font-size: 0.75rem;
  }
  
  blockquote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
  }

  blockquote::before {
    font-size: 2.5rem;
    top: -0.25rem;
    left: -0.25rem;
  }

  blockquote::after {
    font-size: 2.5rem;
    bottom: -1.25rem;
    right: 0rem;
  }
  
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }
  
  .blog-meta {
    flex-direction: column;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .blog-container {
    padding: 1rem 0.75rem;
  }
  
  /* Typography scaling for very small screens */
  body {
    font-size: 15px; /* Slightly smaller base for very small screens */
  }
  
  .blog-title {
    font-size: 1.625rem; /* 26px - further reduced for small screens */
    margin-top: 3rem;
    line-height: 1.2;
  }
  
  .blog-content, .prose-editor {
    font-size: 0.9375rem; /* 15px */
    line-height: 1.6;
  }
  
  /* Heading scaling for very small screens */
  h1 {
    font-size: 1.5rem; /* 24px */
    margin-bottom: 0.875rem;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.375rem; /* 22px */
    margin: 1.75rem 0 0.875rem 0;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.125rem; /* 18px */
    margin: 1.25rem 0 0.625rem 0;
    line-height: 1.4;
  }
  
  /* Paragraph and text scaling */
  p {
    font-size: 0.9375rem; /* 15px */
    margin: 0 0 0.875rem 0;
    line-height: 1.6;
  }
  
  /* Blog meta scaling */
  .blog-meta {
    font-size: 0.8125rem; /* 13px */
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  
  /* Code scaling */
  code {
    font-size: 0.8125rem; /* 13px */
  }
  
  pre {
    font-size: 0.8125rem;
    padding: 0.875rem;
  }
  
  /* Blockquote scaling */
  blockquote {
    padding: 0.875rem 1.25rem;
    margin: 1.25rem 0;
    font-size: 0.9375rem;
  }
  
  blockquote p {
    font-size: 0.9375rem;
  }
  
  /* List scaling */
  ul, ol {
    font-size: 0.9375rem;
  }
  
  ul li, ol li {
    font-size: 0.9375rem;
    margin: 0.4375rem 0;
  }
  
  /* Theme toggle scaling */
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  /* Author page small mobile scaling */
  .author-container {
    padding: 1rem 0.75rem;
  }
  
  .author-title {
    font-size: 1.5rem; /* 24px */
    line-height: 1.2;
  }
  
  .author-username {
    font-size: 0.9375rem; /* 15px */
  }
  
  .author-avatar {
    width: 72px; /* Even smaller avatar for very small screens */
    height: 72px;
    font-size: 1.25rem;
  }
  
  /* Post card scaling for very small screens */
  .post-card-title {
    font-size: 1rem; /* 16px */
  }
  
  .post-card-desc {
    font-size: 0.875rem; /* 14px */
  }
  
  .post-date {
    font-size: 0.75rem; /* 12px */
  }
  
  /* Social links scaling */
  .social-link {
    font-size: 0.75rem; /* 12px */
    padding: 0.25rem 0.5rem;
  }
}

/* Tablet Styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .blog-container {
    max-width: 700px;
    padding: 2rem 1.5rem;
  }
  :root { --content-max-width: 700px; }
  
  /* Typography scaling for tablet */
  body {
    font-size: 16px; /* Base font size for tablet */
  }
  
  .blog-title {
    font-size: 2.25rem; /* 36px - intermediate between mobile and desktop */
    margin-top: 4rem;
    line-height: 1.2;
  }
  
  .blog-content, .prose-editor {
    font-size: 1.125rem; /* 18px - optimal for tablet reading */
    line-height: 1.6;
  }
  
  /* Heading scaling for tablet */
  h1 {
    font-size: 2rem; /* 32px */
    margin-bottom: 1.25rem;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.75rem; /* 28px */
    margin: 2.5rem 0 1.25rem 0;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.375rem; /* 22px */
    margin: 2rem 0 1rem 0;
    line-height: 1.4;
  }
  
  /* Paragraph and text scaling */
  p {
    font-size: 1.125rem;
    margin: 0 0 1.25rem 0;
    line-height: 1.6;
  }
  
  /* Blog meta scaling */
  .blog-meta {
    font-size: 0.9375rem; /* 15px */
  }
  
  /* Code scaling */
  code {
    font-size: 0.9375rem; /* 15px */
  }
  
  pre {
    font-size: 0.9375rem;
    padding: 1.25rem;
  }
  
  /* Blockquote scaling */
  blockquote {
    padding: 1.25rem 1.75rem;
    margin: 1.75rem 0;
    font-size: 1.125rem;
  }
  
  blockquote p {
    font-size: 1.125rem;
  }
  
  /* List scaling */
  ul, ol {
    font-size: 1.125rem;
  }
  
  ul li, ol li {
    font-size: 1.125rem;
    margin: 0.625rem 0;
  }
  
  /* Author page tablet scaling */
  .author-container {
    max-width: 700px;
    padding: 2rem 1.5rem;
  }
  
  .author-title {
    font-size: 2rem; /* 32px */
    line-height: 1.2;
  }
  
  .author-username {
    font-size: 1.125rem; /* 18px */
  }
  
  .author-avatar {
    width: 88px;
    height: 88px;
    font-size: 1.75rem;
  }
  
  /* Post card scaling for tablet */
  .post-card-title {
    font-size: 1.125rem; /* 18px */
    min-height: 2.5rem;
  }

  .post-card-desc {
    font-size: 0.9375rem; /* 15px */
  }

  .post-date {
    font-size: 0.8125rem; /* 13px */
  }
  
  /* Social links scaling */
  .social-link {
    font-size: 0.875rem; /* 14px */
    padding: 0.5rem 0.75rem;
  }
}

/* Desktop Styles */
@media (min-width: 1025px) {
  .blog-container {
    max-width: 45vw;
    padding: 3rem 2rem;
  }
  :root { --content-max-width: 45vw; }
  
  .blog-title {
    font-size: 2.5rem;
    margin-top: 4rem; /* Space for fixed theme toggle button */
  }
  
  .blog-content, .prose-editor {
    font-size: 1.25rem;
  }
}

/* Print Styles */
@media print {
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
  
  .blog-container {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  
  .blog-header {
    border-bottom: 1pt solid #000;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }
  
  .blog-title {
    font-size: 18pt;
    margin-bottom: 0.5rem;
  }
  
  .blog-meta {
    font-size: 10pt;
  }
  
  pre {
    background: #f5f5f5;
    font-size: 10pt;
    padding: 0.5rem;
  }
  
  blockquote {
    background: #f9f9f9;
    border-left: 3pt solid #ccc;
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0;
  }

  blockquote::before,
  blockquote::after {
    display: none;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  .blog-footer {
    margin-top: 2rem;
    border-top: 1pt solid #000;
    padding-top: 1rem;
    font-size: 10pt;
  }
  
  .theme-toggle {
    display: none;
  }
}

/* Focus styles disabled globally */

/* Selection styles - Using default browser selection colors */
/* Removed custom selection colors to restore default browser behavior */

/* User-select support */
* {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

/* Smooth transitions */
* {
  transition: none;
}

/* Author page - minimal styles */
.author-header {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  border-bottom: 1px solid var(--color-divider);
}

.author-container {
  max-width: 45vw;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-background);
  font-weight: 700;
  font-size: 2rem;
  object-fit: cover;
}

.author-title {
  margin: 0;
  margin-top: 4rem; /* Add space for fixed theme toggle button */
  font-size: 2rem;
  font-weight: 700;
}

.author-username {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--color-card-border);
  background: var(--color-card-bg);
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.875rem;
}

.social-link:hover {
  background: var(--color-accent);
  color: var(--color-background);
}

.post-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-card-border);
}

.post-item:last-child {
  border-bottom: none;
}

.post-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.post-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--color-accent);
}

.post-date {
  color: var(--color-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 2rem 0;
}

.author-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--color-card-border);
  color: var(--color-muted);
}

.custom-header-text p,
.custom-footer-text p {
  margin: 0.5rem 0 0;
  color: var(--color-secondary);
}

@media (max-width: 768px) {
  .author-container {
    max-width: 100vw;
    padding: 1.5rem 1rem;
  }
  
  .author-title {
    margin-top: 3rem; /* Reduced margin for mobile theme toggle */
    font-size: 1.75rem; /* 28px - scaled for mobile */
    line-height: 1.2;
  }
  
  .author-username {
    font-size: 1rem; /* 16px */
    margin: 0.25rem 0 0;
  }
  
  .author-avatar {
    width: 80px; /* Smaller avatar for mobile */
    height: 80px;
    font-size: 1.5rem;
  }
  
  /* Post card scaling for mobile */
  .post-card-title {
    font-size: 1rem; /* 16px */
    min-height: 2.4rem;
  }

  .post-card-desc {
    font-size: 0.875rem; /* 14px */
  }

  .post-date {
    font-size: 0.75rem; /* 12px */
  }
  
  /* Social links scaling */
  .social-link {
    font-size: 0.8125rem; /* 13px */
    padding: 0.375rem 0.625rem;
  }
}

/* Grid-based blog cards */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
}

.post-card {
  border: 1px solid var(--color-card-border);
  background: var(--color-card-bg);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Light mode hover effect */
:root[data-theme="light"] .post-card:hover {
  background: rgba(77, 166, 255, 0.1);
}

/* Dark mode hover effect */
:root[data-theme="dark"] .post-card:hover {
  background: rgba(0, 0, 0, 0.8);
}

.post-card-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8rem;
}

.post-card-title a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--color-accent);
}

.post-card-meta {
  margin-bottom: 0.5rem;
}

.post-card-desc {
  margin: 0 0 0.5rem 0;
  color: var(--color-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Editor styles */
.ProseMirror {
  outline: none;
}

/* Keep placeholder text and animated dots on one line */
.ProseMirror p.is-editor-empty:first-child {
  white-space: nowrap;
  overflow: hidden;
}

/* ProseMirror inserts a trailing <br> for caret placement. Hide it only for the empty placeholder line */
.ProseMirror p.is-editor-empty:first-child > .ProseMirror-trailingBreak {
  display: none;
}

.ProseMirror p.is-editor-empty:first-child::before {
  color: var(--color-muted);
  content: attr(data-placeholder);
  display: inline;
  pointer-events: none;
  white-space: nowrap;
  margin-right: 2px;
}

/* Animated ellipsis for the editor placeholder */
@keyframes placeholder-ellipsis {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

.ProseMirror p.is-editor-empty:first-child::after {
  color: var(--color-muted);
  content: '';
  display: inline-block;
  margin-left: 2px;
  animation: placeholder-ellipsis 1.2s steps(4, end) infinite;
  white-space: nowrap;
  width: 3ch;
  text-align: left;
}

/* Three-dot animation when editor is blurred at the trailing empty paragraph */
/* 1) Case: paragraph has only the ProseMirror trailing BR */
.ProseMirror.pm-blurred p:last-child:has(> br.ProseMirror-trailingBreak)::after {
  color: var(--color-muted);
  content: '';
  display: inline-block;
  width: 3ch;
  animation: placeholder-ellipsis 1.2s steps(4, end) infinite;
  white-space: nowrap;
  text-align: left;
}
/* Hide the trailing BR so :empty rule (below) can also apply in some engines */
.ProseMirror.pm-blurred p:last-child > .ProseMirror-trailingBreak {
  display: none;
}
/* 2) Fallback: paragraph truly empty (some engines hide the BR) */
.ProseMirror.pm-blurred p:last-child:empty::after {
  color: var(--color-muted);
  content: '';
  display: inline-block;
  width: 3ch;
  animation: placeholder-ellipsis 1.2s steps(4, end) infinite;
  white-space: nowrap;
  text-align: left;
}

/* Editor-specific styles */
.prose-editor p {
  margin: 0 0 1.5rem 0;
  font-size: inherit; /* Inherit from .prose-editor parent */
  color: var(--color-primary);
  font-weight: 400;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Override Tailwind prose styles for images */
.prose-editor img,
.blog-content img,
.prose :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
  margin-top: 0 !important;
  margin-bottom: 0.75rem !important;
}

/* Image and Drawing Components */
.image-node {
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.drawing-image-node {
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Shared image styles for both regular and drawing images */
.image-node img,
.drawing-image-node img {
  height: auto;
  max-width: 100%;
  max-height: var(--content-max-width);
  width: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  border-radius: 0.75rem;
  transition: none;
  -webkit-image-rendering: -webkit-optimize-contrast;
  -moz-image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  box-shadow: none;
}

/* Responsive max-height constraints to match content container widths */
@media (max-width: 768px) {
  .image-node img,
  .drawing-image-node img {
    max-height: calc(100vw - 2rem); /* Account for mobile padding */
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .image-node img,
  .drawing-image-node img {
    max-height: 700px; /* Match tablet container width */
  }
}

.image-node img:hover,
.drawing-image-node img:hover { transform: none; box-shadow: none; }

/* Blue hover overlay (subtle) */
.image-node > div,
.drawing-image-node > div {
  position: relative;
  display: inline-block;
}

.image-node::after,
.drawing-image-node::after { content: none; }

.image-node:hover::after,
.drawing-image-node:hover::after {}

/* Blog content image and drawing styling */
.blog-content .image-node img,
.blog-content .drawing-image-node img {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  margin-left: auto;
  margin-right: auto;
  display: block;
  height: auto;
  max-width: 100%;
  max-height: var(--content-max-width);
  width: auto;
  object-fit: contain;
}

/* Responsive max-height for blog content images */
@media (max-width: 768px) {
  .blog-content .image-node img,
  .blog-content .drawing-image-node img {
    max-height: calc(100vw - 2rem);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .blog-content .image-node img,
  .blog-content .drawing-image-node img {
    max-height: 700px;
  }
}

/* Ensure published images (plain <img> in content) look like editor images */
.blog-content img {
  max-width: 100%;
  max-height: var(--content-max-width);
  width: auto;
  height: auto;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
  display: block;
  border-radius: 0.75rem;
  transition: none;
  -webkit-image-rendering: -webkit-optimize-contrast;
  -moz-image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  box-shadow: none;
}

/* Responsive max-height for general blog images */
@media (max-width: 768px) {
  .blog-content img {
    max-height: calc(100vw - 2rem);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .blog-content img {
    max-height: 700px;
  }
}

.blog-content img:hover { transform: none; box-shadow: none; }

/* Ensure all images in blog content fit the container */
.blog-content img {
  max-width: 100%;
  width: auto;
  height: auto;
}

.blog-content .image-node,
.blog-content .drawing-image-node {
  display: inline-block;
  max-width: 100%;
}

/* Container for images to maintain aspect ratio */
.blog-content .image-node,
.blog-content .drawing-image-node {
  display: inline-block;
  margin: 2rem auto;
  text-align: center;
}

/* Responsive image sizing for different screen sizes */
@media (max-width: 768px) {
  .blog-content .image-node img,
  .blog-content .drawing-image-node img,
  .blog-content img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .blog-content .image-node img,
  .blog-content .drawing-image-node img,
  .blog-content img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
}

@media (min-width: 1025px) {
  .blog-content .image-node img,
  .blog-content .drawing-image-node img,
  .blog-content img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
}

/* YouTube embed styles for published blog content */
.blog-content .embed-node {
  margin: 2rem auto;
  text-align: center;
  max-width: 100%;
}

.blog-content .embed-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  border-radius: 8px;
  min-height: auto;
  height: auto;
}

.blog-content .embed-container iframe {
  width: 100%;
  max-width: 100%;
  border: 0;
  display: block;
  margin: 0 auto;
}

/* YouTube embed styling for published blogs */
.blog-content .embed-node .embed-container {
  height: auto;
  min-height: 200px;
}

.blog-content .embed-node .embed-container iframe[src*="youtube.com"] {
  aspect-ratio: 16/9;
  height: auto;
  min-height: 200px;
}

