mantra/sass/main.scss

833 lines
20 KiB
SCSS

// mantra · book-grade reader typography
// Fraunces (variable) body + IBM Plex Sans (labels) + IBM Plex Mono (non-Latin)
// Pergament-ink light · deep-ink dark · 62ch measure
// Headings H2 as margin-labels on wide, inline-before on mobile
// --- Fonts (self-hosted) ---------------------------------------------
@font-face {
font-family: "Fraunces";
src: url("/fonts/fraunces-variable.woff2") format("woff2-variations");
font-weight: 100 900;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Fraunces";
src: url("/fonts/fraunces-italic-variable.woff2") format("woff2-variations");
font-weight: 100 900;
font-style: italic;
font-display: swap;
}
@font-face {
font-family: "IBM Plex Sans";
src: url("/fonts/plex-sans-variable.woff2") format("woff2-variations");
font-weight: 100 900;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IBM Plex Mono";
src: url("/fonts/plex-mono-variable.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
// --- Color tokens ----------------------------------------------------
:root {
// Pergament (light)
--mantra-bg: #fdfbf5;
--mantra-fg: #1c1917;
--mantra-muted: #78716c;
--mantra-faint: #d6d3d0;
--mantra-accent: #5e4b3a;
--mantra-hairline: rgba(28, 25, 23, 0.08);
--mantra-measure: 62ch;
--mantra-serif: "Fraunces", Georgia, "Times New Roman", serif;
--mantra-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
--mantra-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
:root {
--mantra-bg: #0f1012;
--mantra-fg: #e7e3dd;
--mantra-muted: #8a857d;
--mantra-faint: #2a2826;
--mantra-accent: #c9b999;
--mantra-hairline: rgba(231, 227, 221, 0.10);
}
}
// --- Reset + base ----------------------------------------------------
* { box-sizing: border-box; }
::selection {
background: var(--mantra-accent);
color: var(--mantra-bg);
}
html, body {
margin: 0;
padding: 0;
background: var(--mantra-bg);
color: var(--mantra-fg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
body {
font-family: var(--mantra-serif);
font-size: 19px;
line-height: 1.68;
letter-spacing: 0.002em;
// Variable-axis tuning: a warmer serif without eccentricity
font-variation-settings: "opsz" 18, "SOFT" 30, "WONK" 0, "wght" 400;
font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "onum" 1;
}
a {
color: inherit;
text-decoration: none;
border-bottom: 1px solid var(--mantra-hairline);
transition: border-color 0.2s, color 0.2s;
}
a:hover { border-bottom-color: var(--mantra-accent); color: var(--mantra-accent); }
main {
max-width: var(--mantra-measure);
margin: 0 auto;
padding: 6rem 1.5rem 8rem;
}
@media (max-width: 640px) {
main { padding: 3rem 1.25rem 5rem; }
body { font-size: 18px; line-height: 1.65; }
}
// --- Landing --------------------------------------------------------
.landing {
max-width: 74ch;
}
.landing-head { margin-bottom: 4rem; }
.landing-title {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0, "wght" 350;
font-size: clamp(3rem, 7vw, 4.5rem);
font-weight: 350;
line-height: 1.02;
letter-spacing: -0.02em;
margin: 0;
color: var(--mantra-fg);
}
.landing-subtitle {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 400;
font-size: 0.78rem;
color: var(--mantra-muted);
text-transform: uppercase;
letter-spacing: 0.22em;
margin: 1rem 0 3rem;
}
.landing-question {
font-family: var(--mantra-serif);
font-style: italic;
font-variation-settings: "opsz" 36, "SOFT" 50, "WONK" 0, "wght" 380;
font-size: 1.4rem;
line-height: 1.4;
color: var(--mantra-fg);
margin: 0 0 4rem;
max-width: 34ch;
}
.landing-section-label {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 500;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.28em;
color: var(--mantra-muted);
margin: 0 0 1.5rem;
}
.landing-artifacts {
margin-bottom: 5rem;
}
.artifacts-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.9rem;
border-top: 1px solid var(--mantra-hairline);
border-bottom: 1px solid var(--mantra-hairline);
padding: 1rem 0;
}
.artifact-line a {
display: block;
border-bottom: none;
line-height: 1.4;
}
.artifact-title {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 22, "SOFT" 40, "WONK" 0, "wght" 520;
font-size: 1.05rem;
color: var(--mantra-fg);
}
.artifact-sep { color: var(--mantra-faint); font-size: 0.85rem; }
.artifact-subtitle {
font-style: italic;
color: var(--mantra-muted);
font-size: 0.88rem;
}
.artifact-line a:hover .artifact-title { color: var(--mantra-accent); }
.landing-cycle {
margin-bottom: 4.5rem;
padding-top: 2rem;
border-top: 1px solid var(--mantra-hairline);
&:first-of-type { border-top: none; padding-top: 0; }
}
.landing-cycle-head {
margin-bottom: 2.5rem;
}
.landing-cycle-title {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 60, "SOFT" 50, "WONK" 0, "wght" 400;
font-size: clamp(1.6rem, 3vw, 2.1rem);
line-height: 1.1;
letter-spacing: -0.01em;
margin: 0;
color: var(--mantra-fg);
}
.landing-cycle-subtitle {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 400;
font-size: 0.72rem;
color: var(--mantra-muted);
text-transform: uppercase;
letter-spacing: 0.2em;
margin: 0.4rem 0 0;
}
.landing-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 3.5rem;
}
@media (max-width: 760px) {
.landing-grid { grid-template-columns: 1fr; gap: 3rem; }
}
.landing-col-label {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 500;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.28em;
color: var(--mantra-muted);
margin: 0 0 1.75rem;
}
.works-list, .themes-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.work-line {
a {
display: block;
border-bottom: none;
line-height: 1.35;
}
a:hover { color: var(--mantra-fg); }
a:hover .work-author { color: var(--mantra-accent); }
}
.work-author {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 18, "SOFT" 30, "WONK" 0, "wght" 500;
color: var(--mantra-fg);
}
.work-sep { color: var(--mantra-faint); }
.work-title {
font-style: italic;
color: var(--mantra-muted);
}
.work-claim {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 14, "SOFT" 30, "WONK" 0, "wght" 380;
font-size: 0.88rem;
color: var(--mantra-muted);
line-height: 1.5;
margin-top: 0.3rem;
}
.theme-line a {
display: block;
border-bottom: none;
}
.theme-title {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 18, "SOFT" 30, "WONK" 0, "wght" 500;
}
.theme-count {
font-family: var(--mantra-sans);
color: var(--mantra-muted);
font-size: 0.82rem;
letter-spacing: 0.02em;
}
// --- Source page ----------------------------------------------------
.source-breadcrumb {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 450;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.22em;
color: var(--mantra-muted);
margin-bottom: 3rem;
.sep { margin: 0 0.5em; color: var(--mantra-faint); }
a { color: var(--mantra-muted); border-bottom: none; }
a:hover { color: var(--mantra-fg); }
}
.source-body {
// Positioning anchor for H2 margin-labels below.
position: relative;
// H1 is the work title
h1 {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 96, "SOFT" 50, "WONK" 0, "wght" 380;
font-size: clamp(2rem, 5vw, 2.75rem);
line-height: 1.1;
letter-spacing: -0.012em;
margin: 0 0 2.5rem;
color: var(--mantra-fg);
}
// H2 as margin-label on wide screens (pulled into left margin)
h2 {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 500;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.24em;
color: var(--mantra-muted);
font-weight: 500;
margin: 3.5rem 0 1.25rem;
position: relative;
}
@media (min-width: 1100px) {
h2 {
position: absolute;
// Pull the label into the left gutter, outside the article box.
// 16ch for the label + 2.5rem breathing room before the text
// column (which starts at the article's padding-left, i.e. 0).
left: calc(-16ch - 2.5rem);
margin: 0;
padding-top: 0.5rem;
width: 16ch;
text-align: right;
}
// Insert spacing where H2 would have been inline
h2 + * { margin-top: 3rem; }
}
h3 {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 24, "SOFT" 40, "WONK" 0, "wght" 520;
font-size: 1.12rem;
letter-spacing: -0.005em;
margin: 2.2rem 0 0.8rem;
color: var(--mantra-fg);
}
p {
margin: 0 0 1.35rem;
hyphens: auto;
-webkit-hyphens: auto;
}
em, i {
font-style: italic;
font-variation-settings: "opsz" 18, "SOFT" 40, "WONK" 0, "wght" 400;
}
strong, b {
font-variation-settings: "opsz" 18, "SOFT" 30, "WONK" 0, "wght" 600;
}
a {
border-bottom: 1px solid var(--mantra-muted);
}
a:hover { border-bottom-color: var(--mantra-accent); }
blockquote {
border-left: 2px solid var(--mantra-accent);
margin: 2rem 0 2rem -0.5rem;
padding: 0.3rem 0 0.3rem 1.5rem;
font-style: italic;
font-variation-settings: "opsz" 17, "SOFT" 50, "WONK" 0, "wght" 400;
color: var(--mantra-fg);
font-size: 0.98rem;
p { margin-bottom: 0.6rem; &:last-child { margin-bottom: 0; } }
}
code {
font-family: var(--mantra-mono);
font-size: 0.85em;
background: var(--mantra-faint);
padding: 0.1rem 0.35rem;
border-radius: 3px;
}
pre {
font-family: var(--mantra-mono);
font-size: 0.82rem;
background: var(--mantra-faint);
padding: 1rem 1.25rem;
border-radius: 6px;
overflow-x: auto;
margin: 1.75rem 0;
line-height: 1.5;
code { background: none; padding: 0; font-size: inherit; }
}
ul, ol {
margin: 0 0 1.35rem;
padding-left: 1.5rem;
}
li { margin: 0.3rem 0; }
hr {
border: none;
border-top: 1px solid var(--mantra-hairline);
margin: 3rem auto;
width: 12ch;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
margin: 1.5rem 0;
th, td {
padding: 0.5rem 0.8rem;
border-bottom: 1px solid var(--mantra-hairline);
text-align: left;
vertical-align: top;
}
th {
font-family: var(--mantra-sans);
font-variation-settings: "wght" 500;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.15em;
color: var(--mantra-muted);
}
}
// Paragraph click-target + margin dot (M.3 margin-layer).
// - Empty paragraphs: faint dot appears only on hover (affordance).
// - Annotated paragraphs (.has-notes): dot is always visible in the
// accent colour, so readers see at a glance where the marginalia is.
p[data-para-id] {
position: relative;
cursor: pointer;
}
@media (min-width: 900px) {
p[data-para-id]::before {
content: "";
position: absolute;
left: -1.25rem;
top: 0.75em;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--mantra-faint);
opacity: 0;
transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
p[data-para-id]:hover::before {
opacity: 1;
background: var(--mantra-muted);
}
p[data-para-id].has-notes::before {
opacity: 1;
background: var(--mantra-accent);
}
p[data-para-id].has-notes:hover::before {
transform: scale(1.3);
}
}
}
.source-foot {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 1rem;
margin-top: 5rem;
padding-top: 2rem;
border-top: 1px solid var(--mantra-hairline);
font-family: var(--mantra-sans);
font-size: 0.78rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--mantra-muted);
a { border-bottom: none; color: var(--mantra-muted); }
a:hover { color: var(--mantra-fg); }
.nav-prev { justify-self: start; }
.nav-home { justify-self: center; }
.nav-next { justify-self: end; }
}
// --- Theme page -----------------------------------------------------
.theme-h1 {
font-family: var(--mantra-serif);
font-variation-settings: "opsz" 72, "SOFT" 50, "WONK" 0, "wght" 380;
font-size: clamp(2rem, 4.5vw, 2.75rem);
line-height: 1.1;
letter-spacing: -0.01em;
margin: 0 0 2rem;
color: var(--mantra-fg);
}
.theme-desc {
margin-bottom: 3rem;
p { color: var(--mantra-fg); margin-bottom: 1.2rem; }
}
.theme-contributing { margin-top: 3rem; }
// --- Misc -----------------------------------------------------------
// --- Language toggle (top-right) ---
.lang-toggle {
position: fixed;
top: 1.25rem;
right: 1.5rem;
z-index: 10;
display: flex;
align-items: center;
gap: 0.4rem;
font-family: var(--mantra-sans);
font-variation-settings: "wght" 450;
font-size: 0.78rem;
letter-spacing: 0.1em;
a {
color: var(--mantra-faint);
text-decoration: none;
border-bottom: none;
padding: 0.1rem 0.1rem;
transition: color 0.15s;
}
a:hover { color: var(--mantra-fg); }
a.lang-active {
color: var(--mantra-fg);
font-variation-settings: "wght" 600;
}
.lang-dot {
color: var(--mantra-faint);
}
}
@media (max-width: 640px) {
.lang-toggle { top: 1rem; right: 1rem; font-size: 0.72rem; }
}
.err {
color: #b45309;
font-family: var(--mantra-mono);
font-size: 0.88rem;
}
.not-found { padding: 2rem 0; }
.back-link {
color: var(--mantra-muted);
font-family: var(--mantra-sans);
font-size: 0.85rem;
border-bottom: none;
}
// --- Margin drawer (M.3) --------------------------------------------
.margin-drawer {
position: fixed;
top: 0;
right: 0;
max-height: 100vh;
width: min(420px, 90vw);
background: var(--mantra-bg);
border-left: 1px solid var(--mantra-hairline);
box-shadow: -12px 0 32px rgba(0, 0, 0, 0.04);
z-index: 20;
display: flex;
flex-direction: column;
font-family: var(--mantra-sans);
font-size: 0.92rem;
color: var(--mantra-fg);
animation: drawer-in 0.22s ease-out;
overflow: hidden;
}
@keyframes drawer-in {
from { transform: translateX(16px); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
.margin-drawer-head {
position: relative;
padding: 0.9rem 1.1rem 0.7rem;
border-bottom: 1px solid var(--mantra-hairline);
text-align: center;
}
.margin-drawer-tabs {
display: inline-flex;
gap: 0.2rem;
.tab {
background: transparent;
border: none;
cursor: pointer;
font-family: var(--mantra-sans);
font-size: 0.8rem;
font-variation-settings: "wght" 450;
letter-spacing: 0.08em;
text-transform: lowercase;
color: var(--mantra-muted);
padding: 0.3rem 0.9rem;
border-radius: 14px;
transition: color 0.15s, background 0.15s;
&:hover { color: var(--mantra-fg); }
&.tab-active {
color: var(--mantra-bg);
background: var(--mantra-accent);
font-variation-settings: "wght" 600;
}
}
}
.margin-drawer-close {
position: absolute;
top: 0.55rem;
right: 0.9rem;
background: transparent;
border: none;
cursor: pointer;
font-family: var(--mantra-serif);
font-size: 1.5rem;
line-height: 1;
color: var(--mantra-muted);
padding: 0.2rem 0.45rem;
transition: color 0.15s;
&:hover { color: var(--mantra-fg); }
}
.margin-drawer-excerpt {
padding: 0.8rem 1.1rem;
font-family: var(--mantra-serif);
font-style: italic;
font-size: 0.88rem;
line-height: 1.5;
color: var(--mantra-muted);
border-bottom: 1px solid var(--mantra-hairline);
max-height: 6.5em;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
// Entries sit below the form (reading flows downward: write → record).
// They scroll within their own area when long; when empty, they add
// minimal height so the drawer collapses to just head+excerpt+form.
.margin-drawer-entries {
flex: 0 1 auto;
max-height: 42vh;
overflow-y: auto;
padding: 0.6rem 1.1rem 1rem;
display: flex;
flex-direction: column;
gap: 0.9rem;
border-top: 1px solid var(--mantra-hairline);
&:empty { display: none; }
}
.margin-empty {
color: var(--mantra-muted);
font-style: italic;
font-family: var(--mantra-serif);
font-size: 0.9rem;
margin: 1.2rem 0;
text-align: center;
}
.note-card {
border-left: 2px solid var(--mantra-hairline);
padding: 0.1rem 0 0.1rem 0.8rem;
&.note-card-ask { border-left-color: var(--mantra-accent); }
.note-card-meta {
font-size: 0.72rem;
letter-spacing: 0.08em;
color: var(--mantra-muted);
margin-bottom: 0.3rem;
font-variation-settings: "wght" 500;
}
.note-q {
font-family: var(--mantra-serif);
font-style: italic;
font-size: 0.94rem;
line-height: 1.5;
margin: 0 0 0.5rem;
color: var(--mantra-fg);
}
.note-a {
font-family: var(--mantra-serif);
font-size: 0.94rem;
line-height: 1.55;
margin: 0;
color: var(--mantra-fg);
white-space: pre-wrap;
}
}
.margin-drawer-form {
padding: 0.9rem 1.1rem 1rem;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.margin-drawer-input {
width: 100%;
resize: vertical;
min-height: 4.5rem;
background: var(--mantra-bg);
color: var(--mantra-fg);
border: 1px solid var(--mantra-hairline);
border-radius: 4px;
padding: 0.55rem 0.7rem;
font-family: var(--mantra-serif);
font-size: 0.95rem;
line-height: 1.45;
transition: border-color 0.15s;
&:focus {
outline: none;
border-color: var(--mantra-accent);
}
}
.margin-drawer-actions {
display: flex;
align-items: center;
gap: 0.8rem;
}
.margin-drawer-author {
display: inline-flex;
align-items: center;
gap: 0.35rem;
flex: 1;
min-width: 0;
.margin-drawer-author-label {
font-size: 0.72rem;
color: var(--mantra-muted);
letter-spacing: 0.06em;
text-transform: lowercase;
font-variation-settings: "wght" 500;
}
.margin-drawer-author-input {
flex: 1;
min-width: 0;
background: transparent;
border: none;
border-bottom: 1px dashed var(--mantra-faint);
font-family: var(--mantra-sans);
font-size: 0.82rem;
color: var(--mantra-fg);
padding: 0.1rem 0 0.15rem;
outline: none;
transition: border-color 0.15s;
&:focus { border-bottom-color: var(--mantra-accent); }
&::placeholder { color: var(--mantra-faint); }
}
}
.margin-drawer-submit {
background: var(--mantra-accent);
color: var(--mantra-bg);
border: none;
border-radius: 14px;
padding: 0.45rem 1.1rem;
font-family: var(--mantra-sans);
font-size: 0.82rem;
font-variation-settings: "wght" 600;
letter-spacing: 0.06em;
text-transform: lowercase;
cursor: pointer;
transition: opacity 0.15s, transform 0.12s;
&:hover:not(:disabled) { transform: translateY(-1px); }
&:disabled {
opacity: 0.4;
cursor: not-allowed;
}
}
.margin-drawer-error {
color: #b45309;
font-family: var(--mantra-mono);
font-size: 0.78rem;
margin: 0;
word-break: break-word;
}
// Mobile: drawer becomes a bottom sheet
@media (max-width: 720px) {
.margin-drawer {
top: auto;
right: 0;
left: 0;
bottom: 0;
width: 100vw;
max-height: 75vh;
border-left: none;
border-top: 1px solid var(--mantra-hairline);
box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
animation: drawer-up 0.22s ease-out;
}
@keyframes drawer-up {
from { transform: translateY(16px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
}