python-by-example/style.css

497 lines
8.7 KiB
CSS

:root {
--bg-main: #0d1117;
--bg-side: #010409;
--border-color: #30363d;
--text-primary: #c9d1d9;
--text-secondary: #8b949e;
--accent: #58a6ff;
--accent-bg: rgba(56, 139, 253, 0.15);
--code-bg: #161b22;
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
--font-mono: 'Fira Code', ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: var(--bg-main);
color: var(--text-primary);
font-family: var(--font-sans);
line-height: 1.6;
overflow-x: hidden;
}
/* Navigation */
.top-nav {
position: sticky;
top: 0;
background: var(--bg-side);
border-bottom: 1px solid var(--border-color);
padding: 12px 0;
z-index: 1000;
}
.nav-container {
max-width: 1400px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 40px;
}
.logo {
font-weight: 700;
font-size: 1.25rem;
display: flex;
align-items: center;
gap: 10px;
}
.logo span span {
color: var(--accent);
}
.search-box {
position: relative;
width: 300px;
}
.search-box i {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
color: var(--text-secondary);
}
.search-box input {
width: 100%;
background: var(--code-bg);
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 8px 12px 8px 36px;
color: var(--text-primary);
outline: none;
transition: 0.2s;
}
.search-box input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-bg);
}
/* Layout */
.app-layout {
display: flex;
max-width: 1400px;
margin: 40px auto;
padding: 0 40px;
}
.sidebar {
width: 280px;
position: sticky;
top: 100px;
height: calc(100vh - 120px);
overflow-y: auto;
padding-right: 20px;
}
.sidebar-header {
font-size: 0.8rem;
text-transform: uppercase;
color: var(--text-secondary);
letter-spacing: 0.05em;
font-weight: 700;
margin-bottom: 16px;
}
.toc-nav {
display: flex;
flex-direction: column;
gap: 8px;
}
.toc-link {
text-decoration: none;
color: var(--text-secondary);
font-size: 0.95rem;
padding: 6px 12px;
border-radius: 6px;
transition: 0.2s;
}
.toc-link:hover,
.toc-link.active {
color: var(--text-primary);
background: var(--code-bg);
}
.toc-link.active {
border-left: 2px solid var(--accent);
border-radius: 0 6px 6px 0;
}
.content-area {
flex: 1;
max-width: 900px;
margin-left: 40px;
}
/* Header & Typography */
.readme-header {
border-bottom: 1px solid var(--border-color);
padding-bottom: 32px;
margin-bottom: 40px;
}
.readme-header h1 {
font-size: 2.5rem;
margin-bottom: 16px;
}
.version {
font-size: 1rem;
color: var(--text-secondary);
font-weight: 400;
background: var(--code-bg);
padding: 4px 10px;
border-radius: 40px;
margin-left: 12px;
}
.lead {
font-size: 1.25rem;
color: var(--text-secondary);
}
.badges {
display: flex;
gap: 12px;
margin-bottom: 24px;
}
.badge {
padding: 4px 12px;
border-radius: 40px;
font-size: 0.75rem;
font-weight: 600;
}
.badge-blue {
background: #053b6d;
color: #58a6ff;
}
.badge-green {
background: #1b4721;
color: #7ee787;
}
.badge-purple {
background: #4c2889;
color: #d2a8ff;
}
/* Sections */
.doc-section {
margin-bottom: 60px;
scroll-margin-top: 100px;
}
.doc-section h2 {
font-size: 1.75rem;
border-bottom: 1px solid var(--border-color);
padding-bottom: 12px;
margin-bottom: 24px;
}
.doc-section p {
margin-bottom: 20px;
}
.module-card {
background: var(--code-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
transition: 0.2s;
}
.module-card:hover {
border-color: var(--accent);
}
.module-meta {
display: flex;
justify-content: space-between;
margin-top: 20px;
color: var(--text-secondary);
font-size: 0.85rem;
}
/* Skeleton */
.skeleton-line {
height: 16px;
background: var(--code-bg);
border-radius: 4px;
margin-bottom: 12px;
animation: pulse 1.5s infinite;
}
.skeleton-section {
height: 200px;
background: var(--code-bg);
border-radius: 12px;
margin-bottom: 40px;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% {
opacity: 0.5;
}
50% {
opacity: 0.8;
}
100% {
opacity: 0.5;
}
}
/* Modal & Playground */
.modal {
display: none;
position: fixed;
z-index: 2000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.85);
backdrop-filter: blur(8px);
align-items: center;
justify-content: center;
}
.modal.active {
display: flex;
}
.modal-content {
background: var(--bg-side);
width: 90%;
max-width: 1200px;
height: 85vh;
border-radius: 16px;
border: 1px solid var(--border-color);
display: flex;
flex-direction: column;
overflow: hidden;
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
background: var(--bg-main);
padding: 16px 24px;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
}
.file-info {
display: flex;
align-items: center;
gap: 12px;
font-weight: 600;
}
.file-info i {
color: var(--accent);
}
.header-actions {
display: flex;
gap: 16px;
align-items: center;
}
.btn-run {
background: var(--accent);
color: white;
border: none;
padding: 8px 20px;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: 0.2s;
display: flex;
align-items: center;
gap: 8px;
}
.btn-run:hover {
opacity: 0.9;
transform: translateY(-1px);
}
.btn-run:disabled {
background: var(--text-secondary);
cursor: not-allowed;
}
.btn-ghost {
background: transparent;
border: 1px solid var(--border-color);
color: var(--text-secondary);
padding: 8px 16px;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
transition: 0.2s;
display: flex;
align-items: center;
gap: 8px;
}
.btn-ghost:hover {
color: var(--text-primary);
background: var(--code-bg);
border-color: var(--text-secondary);
}
.btn-ghost.active {
color: var(--accent);
border-color: var(--accent);
background: var(--accent-bg);
}
.close-modal {
background: transparent;
border: none;
color: var(--text-secondary);
font-size: 1.25rem;
cursor: pointer;
}
/* Monaco Editor Container */
#monaco-editor-container {
height: 100%;
width: 100%;
}
.playground-body {
flex: 1;
display: grid;
grid-template-columns: 1fr 400px;
overflow: hidden;
}
.editor-pane {
position: relative;
background: #1e1e1e;
overflow: hidden;
/* Monaco handles scroll */
}
/* Individual Lesson Hover */
.lesson-item {
background: transparent;
transition: all 0.2s ease;
}
.lesson-item:hover {
background: var(--accent-bg) !important;
padding-left: 16px !important;
/* Slight organic slide effect */
}
.editor-pane.edit-active {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.output-pane {
background: #010409;
border-left: 1px solid var(--border-color);
display: flex;
flex-direction: column;
}
.output-header {
background: var(--bg-main);
padding: 8px 16px;
font-size: 0.75rem;
text-transform: uppercase;
font-weight: 700;
color: var(--text-secondary);
border-bottom: 1px solid var(--border-color);
}
#output-area {
flex: 1;
padding: 16px;
margin: 0;
font-family: var(--font-mono);
font-size: 0.9rem;
color: #a5d6ff;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
/* Scrollbar Style */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: var(--bg-side);
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-secondary);
}
/* Footer */
.docs-footer {
border-top: 1px solid var(--border-color);
padding: 40px 0;
margin-top: 80px;
text-align: center;
}
@media (max-width: 992px) {
.sidebar {
display: none;
}
.content-area {
margin-left: 0;
}
.playground-body {
grid-template-columns: 1fr;
grid-template-rows: 1fr 250px;
}
.output-pane {
border-left: none;
border-top: 1px solid var(--border-color);
}
}