ziex/site/assets/doc.css
2025-11-07 03:18:46 +06:00

1022 lines
21 KiB
CSS

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--border-color: #e0e0e0;
--text-color: #333;
--link-color: #0066cc;
--code-bg: #ffffff;
--nav-bg: #ffffff;
--sidebar-width: 250px;
}
/* Global scrollbar styling - always visible */
::-webkit-scrollbar {
width: 8px;
height: 6px;
background: transparent;
}
::-webkit-scrollbar-track {
background: transparent;
border-radius: 30px;
}
::-webkit-scrollbar-thumb {
background: rgba(176, 176, 176, 0.5);
border-radius: 30px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
color: var(--text-color);
line-height: 1.6;
background: white;
/* Firefox scrollbar styling */
scrollbar-width: thin;
scrollbar-color: rgba(176, 176, 176, 0.5) transparent;
}
.container {
display: flex;
min-height: 100vh;
}
/* Sidebar Navigation */
.sidebar {
position: fixed;
left: 0;
top: 0;
width: var(--sidebar-width);
height: 100vh;
background: var(--nav-bg);
border-right: 2px solid var(--border-color);
overflow-y: auto;
padding: 2rem 0;
scrollbar-gutter: stable;
}
.nav-header {
padding: 0 2rem 2rem;
border-bottom: 2px solid var(--border-color);
}
.nav-header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.25rem;
}
.source-code-link {
font-size: 0.875rem;
color: var(--link-color);
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
}
.source-code-link:hover {
color: #0052a3;
text-decoration: underline;
}
.nav-header h1 {
font-size: 2rem;
font-weight: 700;
color: var(--text-color);
margin-bottom: 0.25rem;
}
.nav-subtitle {
font-size: 0.875rem;
color: #666;
}
.nav-menu {
list-style: none;
padding: 0;
}
.nav-menu li {
border-bottom: 1px solid var(--border-color);
position: relative;
}
.nav-item-with-submenu {
position: relative;
}
.nav-parent {
display: flex;
justify-content: space-between;
align-items: center;
}
.submenu-arrow {
font-size: 0.7em;
transition: transform 0.2s;
margin-left: auto;
}
.nav-item-with-submenu:hover .submenu-arrow,
.nav-item-with-submenu:focus-within .submenu-arrow {
transform: rotate(180deg);
}
.nav-submenu {
list-style: none;
padding: 0;
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
background: rgba(0, 0, 0, 0.02);
}
.nav-item-with-submenu:hover .nav-submenu,
.nav-item-with-submenu:focus-within .nav-submenu {
max-height: 200px;
transition: max-height 0.3s ease-in;
}
.nav-submenu li {
border-bottom: none;
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.nav-submenu a {
padding-left: 3rem;
font-size: 0.9em;
color: #666;
}
.nav-submenu a:hover {
background: rgba(0, 102, 204, 0.05);
border-left-color: var(--link-color);
}
.nav-menu a {
display: block;
padding: 1rem 2rem;
color: var(--text-color);
text-decoration: none;
transition: background-color 0.2s;
border-left: 3px solid transparent;
}
.nav-menu a:hover {
background: white;
border-left-color: var(--link-color);
}
/* Main Content */
.content {
margin-left: var(--sidebar-width);
padding: 3rem 4rem;
flex: 1;
min-width: 0;
max-width: 100%;
overflow-x: hidden;
}
.section {
margin-bottom: 4rem;
scroll-margin-top: 2rem;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid var(--border-color);
}
.section h2 {
font-size: 2rem;
font-weight: 700;
margin: 0;
flex: 1;
}
.section h3 {
font-size: 1.5rem;
font-weight: 600;
margin-top: 2rem;
margin-bottom: 1rem;
}
.section h4 {
font-size: 1.125rem;
font-weight: 600;
margin-top: 1.5rem;
margin-bottom: 0.75rem;
}
.section p {
margin-bottom: 1rem;
}
/* Source Code Badge */
.source-code-badge {
display: inline-block;
margin-left: 1rem;
}
.source-code-badge-link {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: #f6f8fa;
border: 1px solid var(--border-color);
border-radius: 6px;
color: var(--text-color);
text-decoration: none;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.2s ease;
}
.source-code-badge-link:hover {
background: #eaeef2;
border-color: #d0d7de;
color: var(--link-color);
text-decoration: none;
}
.source-code-badge-link svg {
flex-shrink: 0;
width: 16px;
height: 16px;
}
.source-code-badge-link span {
white-space: nowrap;
}
.section ul {
margin-left: 2rem;
margin-bottom: 1rem;
}
.section li {
margin-bottom: 0.5rem;
}
code {
background: var(--code-bg);
padding: 0.2em 0.4em;
border-radius: 3px;
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
font-size: 0.9em;
border: 1px solid var(--border-color);
}
pre {
background: #ffffff;
padding: 1.5rem;
border-radius: 0;
overflow-x: auto;
overflow-y: auto;
margin: 1.5rem 0;
border: 2px solid var(--border-color);
white-space: pre;
max-width: 100%;
box-sizing: border-box;
scrollbar-gutter: stable;
}
pre code {
background: none;
padding: 0;
border: none;
font-size: 0.875rem;
line-height: 1.6;
white-space: pre;
display: block;
overflow: visible;
}
.pane-header {
padding: 0.75rem 1rem;
background: var(--nav-bg);
border-bottom: 2px solid var(--border-color);
display: flex;
align-items: center;
justify-content: space-between;
height: 2.75rem;
min-height: 2.75rem;
box-sizing: border-box;
}
/* Tabs */
.tab-buttons {
display: flex;
gap: 0;
}
.tab-radio {
position: absolute;
opacity: 0;
pointer-events: none;
}
.tab-btn {
padding: 0.5rem 1rem;
background: transparent;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
color: #666;
text-transform: uppercase;
letter-spacing: 0.05em;
transition: all 0.2s;
margin-left: 0.5rem;
}
.tab-btn:hover {
color: var(--text-color);
background: rgba(0, 0, 0, 0.05);
}
/* Default active state for preview tab button (since it's checked by default) */
.example-code .tab-btn[for$="-preview"] {
color: var(--link-color);
border-bottom-color: var(--link-color);
}
.tab-content {
display: none;
flex: 1;
overflow: hidden;
min-height: 0;
min-width: 0;
max-width: 100%;
}
/* Show preview tab by default - higher specificity to override the hide rule above */
.example-code > .tab-content[id^="tab-preview-"] {
display: flex !important;
flex-direction: column;
}
/* Show html tab when html radio is checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-content[id^="tab-html-"] {
display: flex;
flex-direction: column;
}
/* Show zig tab when zig radio is checked */
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-content[id^="tab-zig-"] {
display: flex;
flex-direction: column;
}
/* Hide preview when html or zig tabs are checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-content[id^="tab-preview-"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-content[id^="tab-preview-"] {
display: none !important;
}
/* Reset preview button when other tabs are checked */
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-btn[for$="-preview"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-btn[for$="-preview"] {
color: #666 !important;
border-bottom-color: transparent !important;
}
/* Style active tab button based on checked radio */
.example-code .tab-radio[id$="-preview"]:checked ~ .pane-header .tab-btn[for$="-preview"],
.example-code .tab-radio[id$="-html"]:checked ~ .pane-header .tab-btn[for$="-html"],
.example-code .tab-radio[id$="-zig"]:checked ~ .pane-header .tab-btn[for$="-zig"],
.example-code:has(.tab-radio[id$="-preview"]:checked) .tab-btn[for$="-preview"],
.example-code:has(.tab-radio[id$="-html"]:checked) .tab-btn[for$="-html"],
.example-code:has(.tab-radio[id$="-zig"]:checked) .tab-btn[for$="-zig"] {
color: var(--link-color) !important;
border-bottom-color: var(--link-color) !important;
}
/* Code Wrapper */
.code-wrapper {
flex: 1;
overflow-x: auto;
overflow-y: auto;
min-height: 0;
min-width: 0;
max-width: 100%;
scrollbar-gutter: stable;
}
.code-wrapper pre {
margin: 0;
border: none;
padding: 1.5rem;
background: white;
overflow: visible;
white-space: pre;
max-width: 100%;
box-sizing: border-box;
}
.code-wrapper code {
background: none;
border: none;
padding: 0;
font-size: 0.875rem;
line-height: 1.6;
white-space: pre;
display: block;
overflow: visible;
}
code[contenteditable="true"] {
outline: none;
display: block;
white-space: pre;
cursor: pointer;
overflow: visible;
}
code[contenteditable="true"]:focus {
background: transparent;
outline: none;
cursor: text;
}
/* Overlay on codeblock when tooltip is shown */
.example-code pre:has(code[contenteditable="true"][data-full-content]:not(:focus))::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.25);
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
z-index: 999;
}
.example-code pre:hover:has(code[contenteditable="true"][data-full-content]:not(:focus))::before {
opacity: 1;
}
/* Fallback for browsers without :has() support */
.example-code pre code[contenteditable="true"][data-full-content]:not(:focus) {
position: relative;
}
.example-code pre code[contenteditable="true"][data-full-content]:not(:focus)::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.25);
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
z-index: 998;
}
.example-code pre:hover code[contenteditable="true"][data-full-content]:not(:focus)::after {
opacity: 1;
}
/* CSS-only content toggle - works without JavaScript */
code[contenteditable="true"][data-full-content] {
position: relative;
width: 100%;
height: 100%;
display: block;
white-space: pre;
}
/* Show truncated content when not focused */
code[contenteditable="true"][data-full-content]:not(:focus) {
overflow: hidden;
}
code[contenteditable="true"][data-full-content]:not(:focus)::before {
content: attr(title);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 6px 10px;
background: rgba(51, 51, 51, 0.5);
color: white;
font-size: 0.75rem;
white-space: nowrap;
border-radius: 4px;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
z-index: 1000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-weight: normal;
letter-spacing: normal;
text-transform: none;
}
.example-code pre:hover code[contenteditable="true"][data-full-content]:not(:focus)::before {
opacity: 1;
}
/* Show full content when focused using CSS content property - works without JS */
/* Hide CSS overlay when JS has updated the content */
code[contenteditable="true"][data-full-content]:focus:not(.js-enhanced) {
color: transparent;
caret-color: #333; /* Show cursor */
}
code[contenteditable="true"][data-full-content]:focus:not(.js-enhanced)::before {
content: attr(data-full-content);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: transparent;
color: #333;
padding: inherit;
white-space: pre;
font-family: inherit;
font-size: inherit;
line-height: inherit;
overflow: visible;
pointer-events: none;
z-index: 1;
opacity: 1;
border-radius: 0;
transform: none;
text-align: left;
font-weight: inherit;
letter-spacing: inherit;
text-transform: none;
}
/* When JS has updated content, show actual textContent (with highlighting) */
code[contenteditable="true"][data-full-content]:focus.js-enhanced {
color: inherit; /* Show actual textContent, not transparent */
}
/* For non-editable code blocks (Zig code) - toggle on hover */
/* Hide CSS overlay when JS has updated the content */
code[data-full-content]:not([contenteditable]) {
position: relative;
}
code[data-full-content]:not([contenteditable]):not(:hover):not(.js-enhanced) {
overflow: hidden;
}
code[data-full-content]:not([contenteditable]):hover:not(.js-enhanced) {
color: transparent;
}
code[data-full-content]:not([contenteditable]):hover:not(.js-enhanced)::before {
content: attr(data-full-content);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: transparent;
color: #333;
padding: inherit;
white-space: pre;
font-family: inherit;
font-size: inherit;
line-height: inherit;
overflow: visible;
pointer-events: none;
z-index: 1;
opacity: 1;
border-radius: 0;
transform: none;
text-align: left;
font-weight: inherit;
letter-spacing: inherit;
text-transform: none;
}
/* When JS has updated content, show actual textContent (with highlighting) */
code[data-full-content]:not([contenteditable]).js-enhanced {
color: inherit; /* Show actual textContent, not transparent */
overflow: visible;
}
/* Preview */
.preview-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
background: white;
padding: 10px;
}
.preview-frame {
width: 100%;
height: 100%;
border: none;
background: white;
overflow: hidden;
}
/* Code Examples */
.code-example {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0;
margin: 1.5rem 0;
width: 100%;
max-width: 100%;
overflow: hidden;
}
.example-code {
border: 2px solid var(--border-color);
display: flex;
flex-direction: column;
height: auto;
min-height: 60px;
overflow: hidden;
min-width: 0;
max-width: 100%;
}
.example-code:first-child {
border-right: 1px solid var(--border-color);
}
.example-code:last-child {
border-left: 1px solid var(--border-color);
}
.example-code h4 {
padding: 0.75rem 1rem;
background: var(--nav-bg);
border-bottom: 2px solid var(--border-color);
margin: 0;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: #666;
height: 2.75rem;
min-height: 2.75rem;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.code-tooltip {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
border-radius: 50%;
background: #0066cc;
color: white;
font-size: 0.7rem;
font-weight: normal;
font-style: normal;
cursor: help;
margin-left: auto;
margin-right: 0;
flex-shrink: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.code-tooltip::after {
content: attr(aria-label);
position: absolute;
bottom: 100%;
right: 0;
margin-bottom: 8px;
padding: 6px 10px;
background: #333;
color: white;
font-size: 0.75rem;
white-space: nowrap;
border-radius: 4px;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
z-index: 1000;
font-weight: normal;
letter-spacing: normal;
text-transform: none;
}
.code-tooltip::before {
content: '';
position: absolute;
bottom: 100%;
right: 8px;
margin-bottom: 4px;
border: 4px solid transparent;
border-top-color: #333;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
z-index: 1000;
}
.code-tooltip:hover::after,
.code-tooltip:hover::before {
opacity: 1;
}
.example-code pre {
position: relative;
margin: 0;
border: none;
border-radius: 0;
padding: 1.5rem;
overflow-x: auto;
overflow-y: auto;
white-space: pre;
background: #ffffff;
flex: 1;
min-height: 0;
min-width: 0;
max-width: 100%;
box-sizing: border-box;
scrollbar-gutter: stable;
}
.example-code pre code {
white-space: pre;
display: block;
overflow: visible;
}
/* Prism.js overrides for white background */
pre[class*="language-"] {
background: #ffffff !important;
}
code[class*="language-"] {
background: #ffffff !important;
/* Don't override text color - let tokens handle it */
}
/* Ensure Prism tokens have colors - only override if they're black */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #708090 !important;
}
.token.punctuation {
color: #999 !important;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905 !important;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690 !important;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a !important;
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a !important;
}
.token.function,
.token.class-name {
color: #dd4a68 !important;
}
.token.regex,
.token.important,
.token.variable {
color: #e90 !important;
}
/* JSX specific */
.token.tag {
color: #905 !important;
}
.token.attr-name {
color: #690 !important;
}
.token.attr-value .token.punctuation {
color: #690 !important;
}
/* Responsive - Medium screens */
@media (max-width: 1024px) and (min-width: 769px) {
.code-example {
grid-template-columns: 1fr;
margin-left: 0;
margin-right: 0;
width: 100%;
}
.example-code:first-child {
border-right: 2px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
}
.example-code:last-child {
border-left: 2px solid var(--border-color);
border-top: 1px solid var(--border-color);
}
.sidebar {
transform: translateX(-100%);
}
.content {
margin-left: 0;
padding: 2rem;
}
.example-code {
min-height: 40px;
}
/* Smaller fonts on medium screens */
pre {
font-size: 0.8rem;
padding: 1rem;
}
pre code {
font-size: 0.8rem;
}
.code-wrapper pre {
font-size: 0.8rem;
padding: 1rem;
}
.code-wrapper code {
font-size: 0.8rem;
}
.example-code pre {
font-size: 0.8rem;
padding: 1rem;
}
.example-code pre code {
font-size: 0.8rem;
}
code {
font-size: 0.85em;
}
.section-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.source-code-badge {
margin-left: 0;
}
.section h2 {
font-size: 1.5rem;
}
.section h3 {
font-size: 1.25rem;
}
.section h4 {
font-size: 1rem;
}
}
/* Responsive - Mobile screens */
@media (max-width: 768px) {
.code-example {
grid-template-columns: 1fr;
margin-left: 0;
margin-right: 0;
width: 100%;
}
.example-code:first-child {
border-right: 2px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
}
.example-code:last-child {
border-left: 2px solid var(--border-color);
border-top: 1px solid var(--border-color);
}
.sidebar {
transform: translateX(-100%);
}
.content {
margin-left: 0;
padding: 2rem;
}
.example-code {
min-height: 40px;
}
/* Smaller fonts on mobile */
pre {
font-size: 0.75rem;
padding: 1rem;
}
pre code {
font-size: 0.75rem;
}
.code-wrapper pre {
font-size: 0.75rem;
padding: 1rem;
}
.code-wrapper code {
font-size: 0.75rem;
}
.example-code pre {
font-size: 0.75rem;
padding: 1rem;
}
.example-code pre code {
font-size: 0.75rem;
}
code {
font-size: 0.8em;
}
.section-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.source-code-badge {
margin-left: 0;
}
.section h2 {
font-size: 1.5rem;
}
.section h3 {
font-size: 1.25rem;
}
.section h4 {
font-size: 1rem;
}
}