:root {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --border-color: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-title: #ffffff;
    --accent-color: #ffffff;
    --highlight-bg: rgba(88, 166, 255, 0.3);
    --note-bg: rgba(48, 209, 88, 0.3);
}
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --border-color: rgba(0, 0, 0, 0.15);
    --text-primary: #000000;
    --text-secondary: #666666;
    --text-title: #000000;
    --accent-color: #000000;
    --highlight-bg: rgba(255, 230, 100, 0.5);
    --note-bg: rgba(175, 255, 175, 0.5);
}
/* Default (dark theme) selection style */
::selection {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* For Firefox (because it sometimes needs extra handling) */
::-moz-selection {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* Light theme selection override */
[data-theme="light"] ::selection {
  background: var(--text-primary);
  color: var(--bg-primary);
}

[data-theme="light"] ::-moz-selection {
  background: var(--text-primary);
  color: var(--bg-primary);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.75; transition: background-color 0.3s ease, color 0.3s ease; overflow-x: hidden; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
a { color: var(--accent-color); text-decoration: none; transition: opacity 0.3s ease; }
a:hover { opacity: 0.7; }
img { max-width: 100%; display: block; }
.blog-post .container { max-width: 720px; }
.page-wrapper { transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-bar { position: fixed; top: 0; left: 0; width: 0%; height: 4px; background: var(--text-primary); z-index: 1050; }
.header-container.is-fixed { position: fixed; top: 0; left: 0; right: 0; padding: 1rem 1.5rem; background: rgba(0,0,0,0.5); backdrop-filter: blur(10px); z-index: 1000; transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1); border-bottom: 1px solid var(--border-color); }
[data-theme="light"] .header-container.is-fixed { background: rgba(255,255,255,0.7); }
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; height: 40px; }
.logo { font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 600; color: var(--text-title); }
.logo span { opacity: 0.6; }
#theme-toggle { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; transition: color 0.3s ease; }
#theme-toggle:hover { color: var(--text-primary); }
main { padding-top: 72px; }
.blog-header { text-align: center; padding: 3rem 0; }
.blog-meta { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.75rem; }
.blog-header h1 { font-family: 'Poppins', sans-serif; font-size: 2.8rem; font-weight: 700; line-height: 1.2; letter-spacing: -1.2px; margin-bottom: 1rem; color: var(--text-title); }
.subtitle { font-size: 1.15rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }
.blog-content { font-family: 'Source Serif 4', serif; font-size: 1.1rem; padding-top: 3rem; }
.blog-content h2 { font-family: 'Poppins', sans-serif; font-size: 1.7rem; font-weight: 600; margin: 2.5rem 0 1rem; color: var(--text-title); line-height: 1.3; }
.blog-content mark, .blog-content .note-highlight { border-radius: 3px; cursor: pointer; color: inherit; }
.blog-content mark { background: var(--highlight-bg); }
.blog-content .note-highlight { background: var(--note-bg); position: relative; }
.blog-content .is-focused { animation: pulse 1s ease-in-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--highlight-bg); } 70% { box-shadow: 0 0 0 10px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }
.image-showcase-container { position: relative; overflow: hidden; border-radius: 25px; margin-bottom: 0; }
.showcase-slides-wrapper { display: flex; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); cursor: grab; }
.showcase-slides-wrapper.grabbing { cursor: grabbing; }
.showcase-slides-wrapper > img { flex: 0 0 100%; min-width: 100%; border-radius: 25px; border: 1px solid var(--border-color); cursor: pointer; display: block; user-select: none; }
.showcase-controls { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 1rem; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); padding: 0.5rem 1rem; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.1); }
.showcase-nav { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; display: flex; align-items: center; transition: opacity 0.3s; }
.showcase-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.showcase-counter { color: white; font-family: 'Inter', sans-serif; font-size: 0.9rem; min-width: 40px; text-align: center; }
.share-section { text-align: center; margin: 3rem 0; padding: 2rem 0; border-top: 1px solid var(--border-color); }
.share-title { font-family: 'Poppins', sans-serif; font-weight: 500; color: var(--text-secondary); margin-bottom: 1.25rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
.share-buttons { display: flex; justify-content: center; gap: 1rem; }
.share-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 1.4rem; transition: all 0.3s ease; cursor: pointer; }
.share-btn:hover { color: var(--text-primary); border-color: var(--text-primary); }
[data-tooltip]::after, [data-note]::after { content: attr(data-tooltip); position: absolute; bottom: 115%; left: 50%; transform: translateX(-50%) translateY(5px); background: var(--text-primary); color: var(--bg-primary); padding: 6px 12px; border-radius: 6px; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 500; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; z-index: 10; }
[data-tooltip]:hover::after, [data-note]:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
[data-note]:hover::after { content: attr(data-note); max-width: 350px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-footer { background: var(--bg-primary); padding: 4rem 0 2rem; border-top: 1px solid var(--border-color); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 3rem; }
.footer-col h5 { font-family: 'Poppins', sans-serif; font-size: 1rem; font-weight: 600; color: var(--text-title); margin-bottom: 1rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.75rem; }
.footer-col ul a { color: var(--text-secondary); font-size: 0.95rem; }
.footer-col ul a:hover { color: var(--text-primary); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 2rem; border-top: 1px solid var(--border-color); font-size: 0.9rem; color: var(--text-secondary); flex-wrap: wrap; gap: 1rem; }
.social-links { display: flex; gap: 1.5rem; }
.social-links a { font-size: 1.5rem; color: var(--text-secondary); transition: color 0.3s ease, opacity 0.3s ease; }
.social-links a:hover { color: var(--text-primary); opacity: 0.8; }
.lightbox { position: fixed; z-index: 1030; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s; display: flex; align-items: center; justify-content: center; }
.lightbox.show { opacity: 1; visibility: visible; }
.lightbox-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); }
.lightbox-content-wrapper { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: relative; cursor: grab; }
.lightbox-content-wrapper.grabbing { cursor: grabbing; }
.lightbox-content { display: block; max-width: 90vw; max-height: 80vh; width: auto; height: auto; object-fit: contain; transform: scale(0.95) translateY(10px); opacity: 0; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s; will-change: transform, opacity; }
.lightbox.show .lightbox-content { transform: scale(1) translateY(0); opacity: 1; }
.lightbox-close-btn { position: absolute; top: 20px; right: 20px; z-index: 2; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 50%; color: white; width: 44px; height: 44px; font-size: 1.8rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s ease, transform 0.3s ease; }
.lightbox-close-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.1); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 50%; color: white; width: 44px; height: 44px; font-size: 2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s ease, opacity 0.3s; }
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-nav.hidden { opacity: 0; pointer-events: none; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.5); color: white; padding: 5px 15px; border-radius: 20px; font-family: 'Inter', sans-serif; font-size: 0.9rem; z-index: 2; }
.selection-popover { position: absolute; background: var(--bg-secondary); color: var(--text-primary); border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); display: flex; gap: 4px; padding: 4px; opacity: 0; visibility: hidden; transform: translateY(10px) scale(0.95); transition: opacity 0.3s ease, transform 0.3s ease; z-index: 100; }
.selection-popover.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.selection-popover button { background: none; border: none; color: var(--text-primary); cursor: pointer; font-size: 1.2rem; padding: 0.5rem; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.selection-popover button:hover { background-color: var(--border-color); }
.selection-popover[data-mode="create"] #unhighlight-btn, .selection-popover[data-mode="edit"] #highlight-btn { display: none; }
.notes-sidebar { position: fixed; top: 0; right: 0; width: 100%; max-width: 360px; height: 100%; background: var(--bg-secondary); border-left: 1px solid var(--border-color); transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; z-index: 1020; }
body.sidebar-is-open .notes-sidebar { transform: translateX(0); }
.notes-sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; height: 73px; }
.notes-sidebar-header h3 { font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 600; color: var(--text-title); }
#notes-sidebar-close-btn { background: none; border: none; font-size: 1.8rem; color: var(--text-primary); cursor: pointer; }
.notes-sidebar-content { overflow-y: auto; flex-grow: 1; padding: 1.5rem; }
.notes-sidebar-content h2 { font-family: 'Poppins', sans-serif; font-size: 1rem; color: var(--text-secondary); margin-top: 1rem; margin-bottom: 1rem; }
.notes-sidebar-content h2:first-child { margin-top: 0; }
.notes-sidebar-list { list-style: none; }
.notes-sidebar-list li { margin-bottom: 1.5rem; cursor: pointer; border-radius: 6px; padding: 0.5rem; transition: background-color 0.2s ease; }
.notes-sidebar-list li:hover { background-color: var(--border-color); }
.notes-sidebar-list li blockquote { border-left: 3px solid var(--border-color); padding-left: 1rem; font-style: italic; color: var(--text-secondary); margin-bottom: 0.5rem; pointer-events: none; }
.notes-sidebar-list li p { font-family: 'Inter', sans-serif; font-size: 0.95rem; pointer-events: none; }
.note-modal-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1040; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); visibility: hidden; opacity: 0; transition: opacity 0.3s, visibility 0.3s; }
.note-modal-container.is-open { visibility: visible; opacity: 1; }
.note-modal { background: var(--bg-secondary); padding: 1.5rem; border-radius: 12px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); transform: scale(0.95); transition: transform 0.3s; }
.note-modal-container.is-open .note-modal { transform: scale(1); }
.note-modal h3 { font-family: 'Poppins', sans-serif; margin-bottom: 1rem; }
.note-modal textarea { width: 100%; height: 100px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.75rem; color: var(--text-primary); font-family: 'Inter', sans-serif; resize: vertical; }
.note-modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1rem; }
.note-modal-actions button { border: none; padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 500; }
#note-modal-cancel { background: var(--border-color); color: var(--text-primary); }
#note-modal-save { background: var(--text-primary); color: var(--bg-primary); }
#back-to-top-btn { position: fixed; bottom: 20px; right: 20px; width: 44px; height: 44px; background-color: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 50%; font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 998; opacity: 0; visibility: hidden; transform: translateY(20px); transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease; }
#back-to-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top-btn:hover { background-color: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }
@media (min-width: 1024px) {
    body.sidebar-is-open .page-wrapper, body.sidebar-is-open .header-container.is-fixed { margin-right: 360px; }
}
@media (max-width: 1023px) {
    .notes-sidebar-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1020; visibility: hidden; pointer-events: none; } 
    body.sidebar-is-open .notes-sidebar-container { visibility: visible; pointer-events: auto; }
    .notes-sidebar-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; }
    body.sidebar-is-open .notes-sidebar-container::before { opacity: 1; }
}
@media (max-width: 768px) {
    .blog-header h1 { font-size: 2.2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-bottom { flex-direction: column-reverse; text-align: center; }
    .lightbox-nav { display: none; }
    .lightbox-content { max-width: 100vw; max-height: 85vh; }
}
@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .notes-sidebar { max-width: 90%; }
}