UNPKG

agahi

Version:

Client-side engine that renders Markdown files as a docs site in the browser—no build step.

566 lines (504 loc) 10.9 kB
:root { /* Font Sizes */ --text-size-sm: 0.75rem; --text-size-md: 1rem; --text-size-lg: 1.25rem; /* Spacing & Layout */ --space-vertical: 0.75rem 0; --letter-spacing: 0.0625rem; --border-radius: 0.3125rem; --img-radius: 10px; --header-height: 3.75rem; --blur-radius: 1.5625rem; /* Colors */ --background: #f9fafb; --background-hover: #e5e7eb; --background-blur: rgba(249, 250, 251, 0.7); --text-color: #111827; --text-muted: #6b7280; --text-strong: #000000; --border-color: #d1d5db; --border-color-strong: #9ca3af; --link: #2563eb; --link-hover: #1d4ed8; --link-background: #bfdbfe; --scrollbar-thumb: #9ca3af; --scrollbar-track: #f9fafb; --hamburger-color: #27272a; }/* Base Reset & Scrollbar */ * { box-sizing: border-box; padding: 0; margin: 0; scrollbar-width: thin; scrollbar-color: #9ca3af #f9fafb; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); } /* Layout Grid */ body, #app { display: grid; grid-template-areas: 'aside header header' 'aside main main' 'aside footer footer'; grid-template-columns: 15rem 1fr 1fr; grid-template-rows: 3.75rem 1fr auto; grid-template-rows: var(--header-height) 1fr auto; font-size: 1rem; font-size: var(--text-size-md); background: #f9fafb; background: var(--background); color: #111827; color: var(--text-color); } /* Header */ header { grid-area: header; display: flex; align-items: center; justify-content: flex-end; position: sticky; top: 0; padding: 0 1rem; border-bottom: 0.125rem solid #d1d5db; border-bottom: 0.125rem solid var(--border-color); z-index: 99; background: rgba(249, 250, 251, 0.7); background: var(--background-blur); backdrop-filter: blur(1.5625rem); backdrop-filter: blur(var(--blur-radius)); -webkit-backdrop-filter: blur(1.5625rem); -webkit-backdrop-filter: blur(var(--blur-radius)); } header #header-nav { font-weight: 600; } header #header-nav ul { display: flex; align-items: center; list-style: none; gap: 0.9375rem; } /* Sidebar */ aside { grid-area: aside; padding: 1rem; text-align: center; border-right: 0.0625rem solid #d1d5db; border-right: 0.0625rem solid var(--border-color); position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 100; transition: transform 0.3s ease, opacity 0.3s ease; } aside > *:not(:last-child) { margin-bottom: 1rem; } aside #aside-nav ul { list-style: none; padding: 0; text-align: left; } aside #aside-nav ul li { position: relative; } aside #aside-nav ul ul { padding-left: 1rem; border-left: 0.125rem solid #d1d5db; border-left: 0.125rem solid var(--border-color); } aside #aside-nav ul li a { display: block; width: 100%; padding: 0.5rem 0.35rem; border-radius: 0.3125rem; border-radius: var(--border-radius); transition: background-color 0.2s ease; } aside #aside-nav ul li a:hover { background-color: #e5e7eb; background-color: var(--background-hover); } aside #aside-nav ul ul li a:hover { background-color: #e5e7eb; background-color: var(--background-hover); } /* search-aside */ #search-aside { display: block; width: 100%; padding: 0.5rem 1rem; font-size: 1rem; font-size: var(--text-size-md); color: #111827; color: var(--text-color); background-color: #f9fafb; background-color: var(--background); border: 1px solid #d1d5db; border: 1px solid var(--border-color); border-radius: 0.3125rem; border-radius: var(--border-radius); transition: all 0.3s ease; } #search-aside:focus { outline: none; border-color: #2563eb; border-color: var(--link); box-shadow: 0 0 0.25rem #bfdbfe; box-shadow: 0 0 0.25rem var(--link-background); } #search-aside::-moz-placeholder { color: #6b7280; color: var(--text-muted); opacity: 1; } #search-aside::placeholder { color: #6b7280; color: var(--text-muted); opacity: 1; } input#search-aside:-webkit-autofill, input#search-aside:-webkit-autofill:hover, input#search-aside:-webkit-autofill:focus, input#search-aside:-internal-autofill-selected { background-color: #f9fafb !important; background-color: var(--background) !important; -webkit-box-shadow: 0 0 0px 1000px #f9fafb inset !important; -webkit-box-shadow: 0 0 0px 1000px var(--background) inset !important; color: #111827 !important; color: var(--text-color) !important; } /* Main */ main { grid-area: main; } #md { max-width: 100%; padding: 1rem; word-wrap: break-word; word-break: break-word; font-size: 1rem; line-height: 1.6; } #md > * { margin-bottom: 0.75rem; padding: 0 0.5rem; } #md > *:first-child { padding: 0.75rem 0.5rem; border-bottom: 0.125rem solid #d1d5db; border-bottom: 0.125rem solid var(--border-color); } #md ul, #md ol { margin-left: 1rem; } #md li { margin: 0.75rem 0 0 1rem; } /* Headings */ #md h1, #md h2, #md h3, #md h4, #md h5, #md h6 { font-weight: 600; letter-spacing: 0.0625rem; letter-spacing: var(--letter-spacing); margin: 1rem 0 0.5rem; line-height: 1.4; } #md h1 { font-size: 2rem; } #md h2 { font-size: 1.75rem; } #md h3 { font-size: 1.5rem; } #md h4 { font-size: 1.25rem; } #md h5 { font-size: 1.1rem; } #md h6 { font-size: 1rem; } /* Paragraph */ #md p { line-height: 1.6; margin-bottom: 1rem; } /* Blockquote */ #md blockquote { margin: 1rem 0; padding: 0.75rem 1rem; border-left: 0.25rem solid #d1d5db; border-left: 0.25rem solid var(--border-color); background: rgba(255, 255, 255, 0.03); color: #6b7280; color: var(--text-muted); font-style: italic; } /* Code */ #md code { background: rgba(255, 255, 255, 0.05); padding: 0.2rem 0.4rem; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 0.95em; word-break: break-word; } #md pre { position: relative; background: #1e1e20; color: #f4f4f5; overflow-x: auto; padding: 1rem; border-radius: 0.3125rem; border-radius: var(--border-radius); font-size: 0.9rem; line-height: 1.5; font-family: 'Courier New', monospace; white-space: pre; overflow-x: auto; -webkit-overflow-scrolling: touch; } #md pre code { padding: 0; background: none; color: inherit; } /* Tables */ #md table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; font-size: 0.95rem; border: 1px solid #d1d5db; border: 1px solid var(--border-color); border-radius: 0.3125rem; border-radius: var(--border-radius); } #md table th, #md table td { border: 1px solid #d1d5db; border: 1px solid var(--border-color); padding: 0.5rem 0.75rem; text-align: left; } #md table th { color: #000000; color: var(--text-strong); } #md table td { background-color: #f9fafb; background-color: var(--background); color: #111827; color: var(--text-color); } #md table::before { content: 'Swipe → to scroll'; display: block; font-size: 0.75rem; color: #6b7280; color: var(--text-muted); margin-bottom: 0.25rem; } /* Task lists */ #md input[type='checkbox'] { margin-right: 0.5rem; accent-color: #2563eb; accent-color: var(--link); } #md kbd { background: #1e293b; color: #000000; color: var(--text-strong); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; font-family: monospace; border: 1px solid #d1d5db; border: 1px solid var(--border-color); } #md dl { margin: 1rem 0; } #md dt { font-weight: bold; } #md dd { margin-left: 1rem; margin-bottom: 0.5rem; } /* Links */ a { color: #2563eb; color: var(--link); -webkit-text-decoration: none; text-decoration: none; transition: color 0.2s ease; } a:hover { color: #1d4ed8; color: var(--link-hover); -webkit-text-decoration: underline; text-decoration: underline; } a:not(#md a):not(footer a):not(#page-actions a) { -webkit-text-decoration: none; text-decoration: none; color: inherit; } /* HR */ #md > hr { width: 50%; border: 0.0625rem solid #d1d5db; border: 0.0625rem solid var(--border-color); border-radius: 0.3125rem; border-radius: var(--border-radius); justify-self: center; margin: 2rem auto; } /* img */ #md img { display: block; width: 100%; max-height: 80vh; aspect-ratio: 16 / 9; -o-object-fit: cover; object-fit: cover; border-radius: 10px; border-radius: var(--img-radius); margin: 0.75rem 0; transition: transform 0.3s ease; cursor: zoom-in; } #md img:hover { transform: scale(1.02); } /* Footer */ footer { grid-area: footer; padding: 0.5rem 1rem; text-align: center; border-top: 0.125rem solid #d1d5db; border-top: 0.125rem solid var(--border-color); } /* Page Actions */ #page-actions { padding: 0.5rem; max-height: -moz-fit-content; max-height: fit-content; } /* Toggle Button */ #toggle-aside { display: none; flex-direction: column; justify-content: space-between; width: 1.5rem; height: 1.125rem; background: none; border: none; cursor: pointer; margin-right: auto; padding: 0; } #toggle-aside span { display: block; margin: auto; width: 100%; height: 0.1875rem; background-color: #27272a; background-color: var(--hamburger-color); border-radius: 0.125rem; transition: all 0.3s ease; transform-origin: center; } #toggle-aside.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); } #toggle-aside.open span:nth-child(2) { opacity: 0; } #toggle-aside.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); } /* Responsive Layout */ @media (max-width: 810px) { body, #app { grid-template-areas: 'header' 'main' 'footer'; grid-template-columns: 1fr; grid-template-rows: 3.75rem 1fr auto; grid-template-rows: var(--header-height) 1fr auto; } #toggle-aside { display: flex; } aside { position: fixed; top: 3.75rem; top: var(--header-height); left: 0; width: 70%; height: 100%; background: rgba(249, 250, 251, 0.7); background: var(--background-blur); backdrop-filter: blur(1.5625rem); backdrop-filter: blur(var(--blur-radius)); -webkit-backdrop-filter: blur(1.5625rem); -webkit-backdrop-filter: blur(var(--blur-radius)); border-right: 0.0625rem solid #d1d5db; border-right: 0.0625rem solid var(--border-color); transform: translateX(-100%); opacity: 0; visibility: hidden; transition: all 0.3s ease; } aside.active-aside { transform: translateX(0); opacity: 1; visibility: visible; } #md h1 { font-size: 1.5rem; } #md h2 { font-size: 1.25rem; } #md h3 { font-size: 1.1rem; } #md h4, #md h5, #md h6 { font-size: 1rem; } #md { padding: 0.75rem; font-size: 0.95rem; } #md table th, #md table td { padding: 0.5rem; font-size: 0.875rem; } #md pre { font-size: 0.875rem; } }