uncloseai.com/public/css/sidebar-theme.css

307 lines
No EOL
6.2 KiB
CSS

/* CSS Grid-based sidebar navigation theme for PicoCSS */
:root {
--sidebar-width: 280px;
--content-max-width: 1200px;
--base-font-size: 16px;
--heading-scale: 1.125;
}
/* Adjust default font sizes */
html {
font-size: var(--base-font-size);
}
body {
font-size: 1rem;
line-height: 1.6;
}
h1 { font-size: calc(1rem * var(--heading-scale) * var(--heading-scale) * var(--heading-scale) * var(--heading-scale)); }
h2 { font-size: calc(1rem * var(--heading-scale) * var(--heading-scale) * var(--heading-scale)); }
h3 { font-size: calc(1rem * var(--heading-scale) * var(--heading-scale)); }
h4 { font-size: calc(1rem * var(--heading-scale)); }
h5, h6 { font-size: 1rem; }
/* Main grid layout */
body {
display: grid;
grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
grid-template-areas:
"sidebar main sidebar-right";
gap: 2rem;
min-height: 100vh;
margin: 0;
padding: 1rem;
/* Ensure body doesn't expand beyond viewport */
max-width: 100vw;
overflow-x: auto;
}
/* Sidebar navigation */
aside.sidebar {
grid-area: sidebar;
background: var(--card-background-color);
border-right: 1px solid var(--muted-border-color);
padding: 2rem;
position: sticky;
top: 1rem;
height: calc(100vh - 2rem);
overflow-y: auto;
overflow-x: hidden;
border-radius: 0.5rem;
}
/* Right sidebar navigation */
aside.sidebar-right {
grid-area: sidebar-right;
background: var(--card-background-color);
border-left: 1px solid var(--muted-border-color);
padding: 2rem;
position: sticky;
top: 1rem;
height: calc(100vh - 2rem);
overflow-y: auto;
overflow-x: hidden;
border-radius: 0.5rem;
}
/* Main content area */
main {
grid-area: main;
padding: 2rem;
max-width: 960px !important;
margin: 0 auto;
/* Prevent content overflow */
overflow-x: auto;
overflow-y: visible;
}
/* Responsive main content */
@media (min-width: 769px) and (max-width: 1024px) {
main {
max-width: 100% !important;
margin-right: 2rem;
}
}
@media (min-width: 1025px) and (max-width: 1440px) {
main {
max-width: 900px !important;
margin-right: 3rem;
}
}
@media (min-width: 1441px) {
main {
max-width: 960px !important;
margin-right: 4rem;
}
}
/* Large monitor adjustments - bring sidebar closer to content */
@media (min-width: 1600px) {
body {
grid-template-columns: minmax(var(--sidebar-width), auto) minmax(0, 960px) minmax(var(--sidebar-width), auto);
grid-template-areas:
"sidebar main sidebar-right";
justify-content: center;
gap: 3rem 2rem;
}
main {
margin: 0;
}
}
/* Table of contents styling */
.table-of-contents {
font-size: 0.875rem;
}
.table-of-contents h2 {
font-size: 1.125rem;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--muted-border-color);
}
.table-of-contents nav ul {
list-style: none;
padding-left: 0;
margin: 0;
}
.table-of-contents nav ul ul {
padding-left: 1.25rem;
margin-top: 0.25rem;
}
.table-of-contents nav li {
margin: 0.25rem 0;
}
.table-of-contents nav a {
text-decoration: none;
color: var(--color);
display: block;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
transition: background-color 0.2s;
}
.table-of-contents nav a:hover {
background-color: var(--secondary-focus);
}
.table-of-contents nav a.active {
background-color: var(--primary-focus);
color: var(--primary-inverse);
}
/* Responsive behavior */
@media (max-width: 768px) {
body {
grid-template-columns: 1fr;
grid-template-areas:
"main";
padding: 0;
/* Reset max-width for mobile */
max-width: none;
}
main {
max-width: 100% !important;
margin-right: 0;
padding: 1rem;
/* Ensure proper width on mobile */
width: 100%;
overflow-x: visible;
}
aside.sidebar {
position: fixed;
left: -100%;
width: var(--sidebar-width);
z-index: 1000;
transition: left 0.3s ease;
background: var(--card-background-color);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
height: 100vh;
top: 0;
}
aside.sidebar.open {
left: 0;
box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.7);
}
/* Hide right sidebar on mobile */
aside.sidebar-right {
display: none;
}
/* Overlay effect when sidebar is open */
aside.sidebar.open::before {
content: '';
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
z-index: -1;
}
/* Mobile menu toggle */
.sidebar-toggle {
display: block;
position: fixed;
top: 1rem;
left: 1rem;
z-index: 1001;
background: var(--primary);
color: var(--primary-inverse);
border: none;
padding: 0.5rem;
border-radius: 0.25rem;
cursor: pointer;
}
}
@media (min-width: 769px) {
.sidebar-toggle {
display: none;
}
}
/* Sidebar scrollbar styling */
aside.sidebar::-webkit-scrollbar,
aside.sidebar-right::-webkit-scrollbar {
width: 6px;
}
aside.sidebar::-webkit-scrollbar-track,
aside.sidebar-right::-webkit-scrollbar-track {
background: transparent;
}
aside.sidebar::-webkit-scrollbar-thumb,
aside.sidebar-right::-webkit-scrollbar-thumb {
background: var(--muted-color);
border-radius: 3px;
}
aside.sidebar::-webkit-scrollbar-thumb:hover,
aside.sidebar-right::-webkit-scrollbar-thumb:hover {
background: var(--color);
}
/* Make pre tags scrollable instead of expanding the page */
pre {
overflow-x: auto;
max-width: 100%;
}
/* Prevent horizontal scroll on mobile */
@media (max-width: 768px) {
/* Don't use overflow-x: hidden on body to preserve pinch-to-zoom */
html, body {
overflow-x: auto;
}
pre, code {
white-space: pre-wrap;
word-wrap: break-word;
word-break: break-word;
}
/* More specific selectors to prevent breaking zoom */
main > *,
aside > * {
max-width: 100%;
box-sizing: border-box;
}
/* Make header nav use full width on mobile */
header nav {
width: 100%;
}
header nav ul {
width: 100%;
display: flex;
justify-content: space-around;
}
header nav ul li {
flex: 1;
text-align: center;
}
header nav ul li a {
display: block;
width: 100%;
padding: 0.75rem 0.5rem;
}
}