UNPKG

hexo-theme-halunhaku

Version:

A modern, responsive Hexo theme with enhanced code blocks, perfect cover images, and Chinese text optimization. Production-ready with mobile-first design.

1,102 lines (962 loc) 24 kB
/* Additional styles for the Stitch theme */ .card-hover { @apply transition-transform duration-300 ease-in-out; } .card-hover:hover { @apply transform -translate-y-1 shadow-lg; } .nav-link { @apply text-[var(--text-secondary-color)] hover:text-[var(--text-primary-color)] transition-colors duration-300; } /* Modern prose styles for post content - Apply to both .prose and .prose-lg */ .prose, .prose-lg { @apply text-[var(--text-primary-color)] leading-7; font-family: 'Newsreader', serif; font-size: 1.125rem; line-height: 1.8; max-width: none !important; letter-spacing: 0.01em; } /* Ensure all child elements inherit styles for both classes */ .prose *, .prose-lg * { color: inherit; } /* Headings with modern styling - optimized for Chinese characters */ .prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6, .prose-lg h1, .prose-lg h2, .prose-lg h3, .prose-lg h4, .prose-lg h5, .prose-lg h6 { @apply text-[var(--text-primary-color)] font-bold tracking-tight; font-family: 'Newsreader', serif; line-height: 1.4 !important; /* Better for Chinese characters */ padding-top: 0.1em; padding-bottom: 0.1em; } .prose h1, .prose-lg h1 { @apply text-4xl mb-8 mt-12 pb-4; border-bottom: 2px solid var(--border-color); } .prose h2, .prose-lg h2 { @apply text-3xl mb-6 mt-10 pb-3; border-bottom: 1px solid var(--border-color); } .prose h3, .prose-lg h3 { @apply text-2xl mb-4 mt-8; color: var(--primary-color); } .prose h4, .prose-lg h4 { @apply text-xl mb-3 mt-6 font-semibold; } .prose h5, .prose-lg h5 { @apply text-lg mb-2 mt-4 font-semibold; } .prose h6, .prose-lg h6 { @apply text-base mb-2 mt-4 font-semibold text-[var(--text-secondary-color)]; } /* Paragraphs with better spacing */ .prose p, .prose-lg p { @apply mb-6 leading-relaxed; text-align: justify; text-indent: 2em; position: relative; } .prose p:first-of-type, .prose-lg p:first-of-type { text-indent: 0; font-size: 1.1em; font-weight: 500; color: var(--text-primary-color); } /* First letter styling removed for cleaner appearance */ /* Enhanced links */ .prose a, .prose-lg a { @apply text-[var(--primary-color)] font-medium no-underline; border-bottom: 1px solid transparent; transition: all 0.2s ease; } .prose a:hover, .prose-lg a:hover { border-bottom-color: var(--primary-color); background-color: rgba(12, 127, 242, 0.1); padding: 2px 4px; border-radius: 4px; } /* Modern list styling */ .prose ul, .prose ol, .prose-lg ul, .prose-lg ol { @apply mb-6 pl-0; } .prose ul, .prose-lg ul { list-style: none; } .prose ul>li, .prose-lg ul>li { @apply mb-3 pl-6 relative; } .prose ul>li::before, .prose-lg ul>li::before { content: "\2022"; color: var(--primary-color); font-weight: bold; position: absolute; left: 0; font-size: 1.2em; } .prose ol, .prose-lg ol { counter-reset: item; } .prose ol>li, .prose-lg ol>li { @apply mb-3 pl-6 relative; counter-increment: item; } .prose ol>li::before, .prose-lg ol>li::before { content: counter(item) "."; color: var(--primary-color); font-weight: bold; position: absolute; left: 0; } /* Enhanced blockquotes */ .prose blockquote, .prose-lg blockquote { @apply my-8 pl-6 pr-4 py-4 relative; background: linear-gradient(90deg, var(--primary-color) 0%, transparent 100%); background-size: 4px 100%; background-repeat: no-repeat; background-color: rgba(12, 127, 242, 0.05); border-radius: 0 8px 8px 0; font-style: italic; color: var(--text-secondary-color); } .prose blockquote::before, .prose-lg blockquote::before { content: """; font-size: 3rem; color: var(--primary-color); position: absolute; left: 12px; top: -10px; opacity: 0.3; } /* Modern code styling */ .prose code, .prose-lg code { padding: 0.25rem 0.5rem; border-radius: 0.375rem; font-size: 0.875rem; font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace; background-color: var(--secondary-color); color: var(--primary-color); border: 1px solid var(--border-color); word-break: break-all; overflow-wrap: break-word; } /* Inline code should break when necessary */ .prose p code, .prose-lg p code, .prose li code, .prose-lg li code { word-break: break-all; overflow-wrap: break-word; white-space: pre-wrap; } /* Enhanced code block styling with proper container */ .prose pre, .prose-lg pre { margin: 2rem 0; background: linear-gradient(135deg, var(--secondary-color) 0%, rgba(var(--secondary-color), 0.95) 100%); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.05); position: relative; overflow: hidden; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: all 0.3s ease; } .prose pre::before, .prose-lg pre::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 45px; background: linear-gradient(135deg, rgba(12, 127, 242, 0.08) 0%, rgba(12, 127, 242, 0.03) 50%, rgba(12, 127, 242, 0.08) 100%); border-bottom: 1px solid rgba(12, 127, 242, 0.1); backdrop-filter: blur(4px); } .prose pre code, .prose-lg pre code { background: transparent; border: 0; color: var(--text-primary-color); display: block; padding: 3.5rem 1.5rem 1.5rem 1.5rem; white-space: pre; overflow-x: auto; -webkit-overflow-scrolling: touch; font-family: 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace; font-size: 0.875rem; line-height: 1.6; position: relative; z-index: 2; scrollbar-width: thin; scrollbar-color: var(--primary-color) transparent; } /* Enhanced copy button styles - Modern Design */ .copy-btn { position: absolute; top: 8px; right: 12px; background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%); border: 1px solid rgba(12, 127, 242, 0.15); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; opacity: 0; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); z-index: 15; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; font-size: 14px; user-select: none; -webkit-user-select: none; -moz-user-select: none; transform: translateY(-2px) scale(0.95); } .copy-btn:hover { opacity: 1; background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%); border-color: var(--primary-color); transform: translateY(0) scale(1.02); box-shadow: 0 4px 12px rgba(12, 127, 242, 0.15); } .copy-btn:active { transform: translateY(-1px) scale(1.02); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); } .copy-btn.success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-color: #10b981; color: white; transform: translateY(-2px) scale(1.05); } .copy-btn.error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); border-color: #ef4444; color: white; transform: translateY(-2px) scale(1.05); } /* Show copy button on hover for desktop */ .prose pre:hover .copy-btn, .prose-lg pre:hover .copy-btn { opacity: 0.8; transform: translateY(0) scale(1); } .prose pre:hover .copy-btn:hover, .prose-lg pre:hover .copy-btn:hover { opacity: 1; transform: translateY(-2px) scale(1.05); } /* Always show copy button on mobile and tablets */ @media (max-width: 1024px) { .prose pre .copy-btn, .prose-lg pre .copy-btn { opacity: 0.8; transform: translateY(0) scale(1); } } @media (max-width: 768px) { .copy-btn { top: 6px; right: 8px; width: 28px; height: 28px; font-size: 12px; border-radius: 4px; } .prose pre, .prose-lg pre { border-radius: 8px; } .prose pre::before, .prose-lg pre::before { height: 36px; } .prose pre code, .prose-lg pre code { padding: 2.5rem 1rem 1rem 1rem; font-size: 0.8rem; } } @media (max-width: 480px) { .copy-btn { top: 4px; right: 6px; width: 24px; height: 24px; font-size: 10px; border-radius: 3px; } .prose pre::before, .prose-lg pre::before { height: 32px; } .prose pre code, .prose-lg pre code { padding: 2rem 0.75rem 0.75rem 0.75rem; font-size: 0.75rem; } } /* Dark mode adjustments */ @media (prefers-color-scheme: dark) { .copy-btn { background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%); border-color: rgba(12, 127, 242, 0.3); color: rgba(255, 255, 255, 0.9); } .copy-btn:hover { background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.8) 100%); border-color: var(--primary-color); box-shadow: 0 8px 24px rgba(12, 127, 242, 0.3); } .copy-btn.success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-color: #10b981; } .copy-btn.error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); border-color: #ef4444; } } /* Prevent text selection on copy button */ .copy-btn::selection { background: transparent; } .copy-btn::-moz-selection { background: transparent; } /* Enhanced code block styling */ .prose pre, .prose-lg pre { position: relative; overflow: visible; } /* Shake animation for error state */ @keyframes shake { 0%, 100% { transform: translateX(0) scale(1.1); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-2px) scale(1.1); } 20%, 40%, 60%, 80% { transform: translateX(2px) scale(1.1); } } /* Rotate animation for success state */ @keyframes rotate { from { transform: scale(1.1) rotate(0deg); } to { transform: scale(1.1) rotate(360deg); } } /* Beautiful image styling */ .prose img, .prose-lg img { @apply rounded-xl my-8 max-w-full h-auto; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); transition: transform 0.3s ease; } .prose img:hover, .prose-lg img:hover { transform: scale(1.02); } /* Modern table styling */ .prose table, .prose-lg table { @apply w-full my-8 rounded-lg overflow-hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); } .prose th, .prose-lg th { @apply px-6 py-4 font-semibold text-left; background-color: var(--primary-color); color: white; } .prose td, .prose-lg td { @apply px-6 py-4 border-t border-[var(--border-color)]; } .prose tbody tr:nth-child(even), .prose-lg tbody tr:nth-child(even) { background-color: var(--secondary-color); } .prose tbody tr:hover, .prose-lg tbody tr:hover { background-color: rgba(12, 127, 242, 0.05); } /* Enhanced text formatting */ .prose strong, .prose b, .prose-lg strong, .prose-lg b { @apply font-bold; color: var(--primary-color); } .prose em, .prose i, .prose-lg em, .prose-lg i { @apply italic; color: var(--text-secondary-color); } .prose del, .prose s, .prose-lg del, .prose-lg s { @apply line-through opacity-75; background-color: rgba(239, 68, 68, 0.1); padding: 1px 2px; border-radius: 3px; } .prose mark, .prose-lg mark { background: linear-gradient(120deg, #fbbf24 0%, #f59e0b 100%); color: #1f2937; padding: 2px 4px; border-radius: 4px; font-weight: 500; } /* Modern horizontal rule */ .prose hr, .prose-lg hr { @apply my-12 border-0; height: 2px; background: linear-gradient(90deg, transparent 0%, var(--primary-color) 50%, transparent 100%); position: relative; } .prose hr::after, .prose-lg hr::after { content: "\2726"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background-color: var(--background-color); color: var(--primary-color); padding: 0 12px; font-size: 1.2em; } /* Code syntax highlighting support */ .prose pre[class*="language-"], .prose-lg pre[class*="language-"] { @apply bg-[var(--secondary-color)] text-[var(--text-primary-color)]; } .prose code[class*="language-"], .prose-lg code[class*="language-"] { @apply bg-transparent; } /* Modern task lists */ .prose .task-list-item, .prose-lg .task-list-item { @apply list-none mb-3 pl-8 relative; } .prose .task-list-item input[type="checkbox"], .prose-lg .task-list-item input[type="checkbox"] { position: absolute; left: 0; top: 2px; width: 18px; height: 18px; accent-color: var(--primary-color); cursor: pointer; } .prose .task-list-item input[type="checkbox"]:checked+*, .prose-lg .task-list-item input[type="checkbox"]:checked+* { color: var(--text-secondary-color); text-decoration: line-through; } /* Enhanced footnotes */ .prose .footnote-ref, .prose-lg .footnote-ref { @apply text-[var(--primary-color)] no-underline font-medium; background-color: var(--primary-color); color: white; padding: 2px 6px; border-radius: 50%; font-size: 0.75rem; vertical-align: super; margin-left: 2px; } .prose .footnote-ref:hover, .prose-lg .footnote-ref:hover { background-color: var(--text-primary-color); } .prose .footnotes, .prose-lg .footnotes { @apply border-t border-[var(--border-color)] mt-12 pt-8 text-sm; background-color: rgba(12, 127, 242, 0.02); padding: 24px; border-radius: 8px; } .prose .footnotes::before, .prose-lg .footnotes::before { content: "\1F4DD Notes"; font-weight: bold; color: var(--primary-color); display: block; margin-bottom: 12px; } /* Alert/Callout boxes */ .prose .alert, .prose-lg .alert { @apply my-6 p-4 rounded-lg border-l-4; } .prose .alert-info, .prose-lg .alert-info { background-color: rgba(59, 130, 246, 0.1); border-left-color: #3b82f6; color: var(--text-primary-color); } .prose .alert-warning, .prose-lg .alert-warning { background-color: rgba(245, 158, 11, 0.1); border-left-color: #f59e0b; color: var(--text-primary-color); } .prose .alert-success, .prose-lg .alert-success { background-color: rgba(34, 197, 94, 0.1); border-left-color: #22c55e; color: var(--text-primary-color); } .prose .alert-error, .prose-lg .alert-error { background-color: rgba(239, 68, 68, 0.1); border-left-color: #ef4444; color: var(--text-primary-color); } /* Code block with language label */ .prose pre[data-lang]::before, .prose-lg pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 12px; left: 12px; background-color: var(--primary-color); color: white; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; text-transform: none; z-index: 5; letter-spacing: 0.5px; } /* Code blocks are already positioned relative above */ /* Code block scroll indicator */ .prose pre::-webkit-scrollbar, .prose-lg pre::-webkit-scrollbar { height: 6px; } .prose pre::-webkit-scrollbar-track, .prose-lg pre::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 3px; } .prose pre::-webkit-scrollbar-thumb, .prose-lg pre::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 3px; } .prose pre::-webkit-scrollbar-thumb:hover, .prose-lg pre::-webkit-scrollbar-thumb:hover { background: var(--text-primary-color); } } } /* Keyboard keys */ .prose kbd, .prose-lg kbd { background-color: var(--secondary-color); border: 1px solid var(--border-color); border-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 2px 0 0 rgba(255, 255, 255, 0.7) inset; color: var(--text-primary-color); display: inline-block; font-size: 0.85em; font-weight: 700; line-height: 1; padding: 2px 4px; white-space: nowrap; font-family: monospace; } /* Math expressions (if using MathJax/KaTeX) */ .prose .math, .prose-lg .math { overflow-x: auto; padding: 8px 0; } .prose .math-display, .prose-lg .math-display { text-align: center; margin: 24px 0; padding: 16px; background-color: var(--secondary-color); border-radius: 8px; border: 1px solid var(--border-color); } /* Enhanced post styling */ .post-cover-container { display: block; width: 100%; height: 350px; background-color: var(--secondary-color); border-radius: 12px; overflow: hidden; position: relative; box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1); } .post-cover-image { display: block; margin: 0 auto; width: 100%; height: 100%; background-color: var(--secondary-color); border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; object-fit: cover; object-position: center; } .post-cover-image:hover { transform: scale(1.02); box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15); } /* Reading progress indicator */ .reading-progress-container { position: fixed; top: 0; left: 0; width: 100%; height: 3px; background-color: var(--secondary-color); z-index: 1000; } .reading-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-color), #60a5fa); width: 0%; transition: width 0.3s ease; } /* Enhanced content wrapper */ .content-wrapper { position: relative; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); margin: 0 auto; max-width: 100%; } .content-wrapper::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--primary-color), transparent); } /* Ensure proper centering on all devices */ @media (max-width: 768px) { .content-wrapper { margin-left: auto; margin-right: auto; } } /* Line clamp utility */ .line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* Smooth animations for content */ .content-wrapper { animation: fadeInUp 0.6s ease-out; } @keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } } /* Enhanced hover effects */ .prose a, .prose-lg a { position: relative; transition: all 0.3s ease; } .prose a::after, .prose-lg a::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px; background: linear-gradient(90deg, var(--primary-color), #60a5fa); transition: width 0.3s ease; } .prose a:hover::after, .prose-lg a:hover::after { width: 100%; } /* Improved focus states */ .prose a:focus, .prose-lg a:focus { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 2px; } /* Mobile-first responsive adjustments */ /* Prevent horizontal overflow on all screen sizes */ * { box-sizing: border-box; } html, body { overflow-x: hidden; width: 100%; } /* Chinese text and tag optimization */ .whitespace-nowrap { white-space: nowrap; } /* Prevent Chinese characters from breaking inappropriately */ a, span, p { word-break: keep-all; overflow-wrap: break-word; } /* Fix for Chinese character display in titles */ h1, h2, h3, h4, h5, h6 { line-height: 1.4 !important; padding-top: 0.1em !important; padding-bottom: 0.1em !important; word-break: keep-all !important; overflow-wrap: break-word !important; } /* Specific fixes for article titles */ article h1, article h2, .post-title, .card-title { line-height: 1.5 !important; min-height: 1.5em; display: flex; align-items: center; } /* Mobile optimizations */ @media (max-width: 768px) { /* Ensure containers don't cause horizontal scroll */ .container { max-width: 100%; margin-left: auto; margin-right: auto; } /* Optimize prose content for mobile */ .prose, .prose-lg { font-size: 1rem; padding-left: 1rem; padding-right: 1rem; line-height: 1.6; max-width: 100%; } .prose h1, .prose-lg h1 { font-size: 1.5rem; margin-bottom: 1.5rem; margin-top: 2rem; } .prose h2, .prose-lg h2 { font-size: 1.25rem; margin-bottom: 1rem; margin-top: 1.5rem; } .prose h3, .prose-lg h3 { font-size: 1.125rem; margin-bottom: 0.75rem; margin-top: 1.25rem; } .prose h4, .prose-lg h4 { font-size: 1rem; margin-bottom: 0.5rem; margin-top: 1rem; } /* Mobile-friendly blockquotes */ .prose blockquote, .prose-lg blockquote { margin-left: 0; margin-right: 0; padding-left: 1rem; padding-right: 0.5rem; padding-top: 0.75rem; padding-bottom: 0.75rem; margin-top: 1.5rem; margin-bottom: 1.5rem; font-size: 0.95rem; } /* Mobile code blocks */ .prose pre, .prose-lg pre { margin-top: 1.5rem; margin-bottom: 1.5rem; margin-left: -1rem; margin-right: -1rem; max-width: calc(100% + 2rem); border-radius: 12px; border-width: 2px; box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.2); } .prose pre::before, .prose-lg pre::before { height: 32px; } .prose pre code, .prose-lg pre code { padding: 2.5rem 1.5rem 1rem 1.5rem; font-size: 0.8rem; line-height: 1.6; } /* Mobile tables */ .prose table, .prose-lg table { font-size: 0.875rem; min-width: 100%; } .prose th, .prose-lg th, .prose td, .prose-lg td { padding-left: 0.75rem; padding-right: 0.75rem; padding-top: 0.5rem; padding-bottom: 0.5rem; } /* Mobile images */ .prose img, .prose-lg img { margin-top: 1.5rem; margin-bottom: 1.5rem; border-radius: 0.5rem; max-width: 100%; height: auto; } /* Mobile cover image optimization */ .post-cover-container { height: 250px !important; } .post-cover-image { height: 100% !important; } /* Mobile lists */ .prose ul, .prose ol, .prose-lg ul, .prose-lg ol { margin-bottom: 1rem; padding-left: 1rem; } .prose ul>li, .prose-lg ul>li, .prose ol>li, .prose-lg ol>li { margin-bottom: 0.5rem; padding-left: 1rem; } } /* Extra small screens */ @media (max-width: 480px) { /* Further optimize for very small screens */ .container { padding-left: 0.75rem; padding-right: 0.75rem; } .prose, .prose-lg { padding-left: 0.5rem; padding-right: 0.5rem; font-size: 0.95rem; } .prose h1, .prose-lg h1 { font-size: 1.25rem; } .prose h2, .prose-lg h2 { font-size: 1.125rem; } /* Very small screen adjustments */ .prose pre, .prose-lg pre { margin-left: -0.75rem; margin-right: -0.75rem; max-width: calc(100% + 1.5rem); border-radius: 8px; border-width: 1px; box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.15); } .prose pre::before, .prose-lg pre::before { height: 24px; background: linear-gradient(90deg, var(--primary-color)/8, transparent, var(--primary-color)/8); } .prose pre code, .prose-lg pre code { padding: 1.75rem 1rem 0.75rem 1rem; font-size: 0.75rem; line-height: 1.5; } .prose blockquote, .prose-lg blockquote { padding-left: 0.75rem; padding-right: 0.25rem; padding-top: 0.5rem; padding-bottom: 0.5rem; font-size: 0.9rem; } /* Ensure text wrapping on very small screens */ h1, h2, h3, h4, h5, h6 { word-wrap: break-word; overflow-wrap: break-word; } }