mercury/src/styles/global.css
2025-05-15 10:34:16 +08:00

276 lines
No EOL
4.7 KiB
CSS

@import url(@fontsource/space-mono);
/* Global Styles for Terminal Blog */
:root {
/* Dark theme (default) */
--bg-color: #2e3440;
--text-color: #d8dee9;
--accent-color: #81a1c1;
--border-color: #3b4351;
--header-color: #2e3440;
--terminal-green: #a3be8c;
--terminal-yellow: #ebcb8b;
--terminal-red: #bf616a;
--font-mono: 'Space Mono',ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
/* Light theme */
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--bg-color: #eceff4;
--text-color: #2e3440;
--accent-color: #81a1c1;
--border-color: #d1d5db;
--header-color: #2e3440;
--terminal-green: #a3be8c;
--terminal-yellow: #ebcb8b;
--terminal-red: #bf616a;
}
}
/* Light theme override (for switch) */
:root[data-theme="light"] {
--bg-color: #eceff4;
--text-color: #2e3440;
--accent-color: #81a1c1;
--border-color: #d1d5db;
--header-color: #2e3440;
--terminal-green: #a3be8c;
--terminal-yellow: #ebcb8b;
--terminal-red: #bf616a;
}
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
font-family: var(--font-mono);
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.5;
height: 100%;
width: 100%;
transition: background-color 0.3s ease, color 0.3s ease;
text-align: left;
word-wrap: break-word;
overflow-wrap: break-word;
}
a {
color: var(--accent-color);
text-decoration: none;
transition: opacity 0.2s ease;
}
a:hover {
opacity: 0.8;
}
main {
max-width: 1200px;
margin: 0 auto;
padding: 2rem 1rem;
min-height: calc(100vh - 120px);
}
.container {
max-width: 900px;
margin: 0 auto;
}
.terminal-path {
color: var(--terminal-green);
padding: 1rem;
font-size: 1.2rem;
font-weight: 500;
border-radius: 4px;
margin-bottom: 1rem;
display: inline-block;
}
.content-box {
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 2rem;
margin-bottom: 2rem;
transition: border-color 0.3s ease;
}
.nav {
display: flex;
gap: 2rem;
margin: 1.5rem 0;
}
.nav a {
font-size: 1.1rem;
}
.nav a::before {
content: "./";
opacity: 0.7;
}
.cursor {
display: inline-block;
width: 0.6em;
height: 1em;
background-color: var(--text-color);
margin-left: 0.2em;
animation: blink 1s step-end infinite;
}
@keyframes blink {
from, to { opacity: 1; }
50% { opacity: 0; }
}
.footer {
text-align: center;
padding: 2rem 0;
font-size: 0.9rem;
color: var(--text-color);
opacity: 0.7;
}
.footer img {
vertical-align: middle;
}
.footer .floating {
position: fixed;
bottom: 20px;
right: 30px;
z-index: 10;
display: flex;
flex-direction: column;
border: none;
outline: none;
padding: 15px;
}
#toTopBtn {
display: none;
background: var(--border-color);
border: none;
color: var(--text-color);
padding: 0.5rem 1rem;
font-family: var(--font-mono);
cursor: pointer;
}
#toTopBtn:hover {
background: var(--accent-color);
color: var(--bg-color);
}
/* Theme Switcher */
.theme-switcher {
background: var(--border-color);
border: none;
color: var(--text-color);
padding: 0.5rem 1rem;
font-family: var(--font-mono);
cursor: pointer;
transition: background-color 0.3s ease, color 0.3s ease;
}
.theme-switcher:hover {
background: var(--accent-color);
color: var(--bg-color);
}
/* Contents */
h1.title {
color: var(--header-color);
font-size: 1.75rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
div.content {
margin-bottom: 2rem;
ul, ol, li {
list-style-position: inside;
}
ul {
padding-left: 20px;
margin-top: 0.5em;
margin-bottom: 1em;
}
ul li {
padding-left: 0.5em;
margin-bottom: 0.5em;
line-height: 1.3;
}
pre {
padding: 1rem;
}
/* Highlighted Code Blocks */
pre.astro-code,
pre.astro-code span {
background-color: #3b4252 !important;
}
h1, h2, h3, h4 {
margin: 0.5rem 0;
line-height: 1.3;
}
}
/* Terminal Commands */
.command {
color: var(--terminal-green);
margin-right: 0.5rem;
}
.command::before {
content: "$ ";
opacity: 0.7;
}
/* helper Class */
.fade-in {
opacity: 1;
transition-property: opacity;
transition-duration: .7s;
transition-timing-function: cubic-bezier(.4,0,1,1);
}
.fade-out {
opacity: 0;
transition-property: opacity;
transition-duration: .7s;
transition-timing-function: cubic-bezier(.4,0,1,1);
}
/* Media Queries */
@media (max-width: 768px) {
.terminal-path {
font-size: 1rem;
}
.nav {
gap: 1rem;
}
.content-box {
padding: 1.5rem;
}
}
@media (max-width: 480px) {
.terminal-path {
font-size: 0.9rem;
}
.nav {
gap: 0.8rem;
}
.content-box {
padding: 1rem;
}
}