dhammawatthumpra's picture
feat: highlight search keywords on reader page with auto-scroll to first match
05b80f3
Raw
History Blame Contribute Delete
7.52 kB
@import "tailwindcss";
@plugin "@tailwindcss/typography";
@theme {
--color-sacred-gold: #D4AF37;
--color-sacred-gold-light: #F4E7A5;
--color-parchment: #F9F4E8;
--color-pali-text: #2C1810;
--font-sarabun: "Sarabun", "Noto Serif Thai", "Noto Sans Thai Looped", sans-serif;
}
:root {
font-family: var(--font-sarabun);
line-height: 1.7;
font-weight: 400;
color: var(--color-pali-text);
background-color: var(--color-parchment);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
margin: 0;
display: flex;
min-width: 320px;
min-height: 100vh;
/* Safe area padding for PWA notch/status bar (iOS black-translucent) */
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
/* Default bg matches dark theme β€” seamless PWA splash/status bar */
background-color: #1a1a2e;
}
#root {
width: 100%;
}
/* ── Search Highlight ──────────────────────────────────────────── */
mark.search-highlight {
background-color: #c8860a;
color: #fff;
border-radius: 2px;
padding: 0 2px;
font-weight: inherit;
animation: highlight-fade 3s ease-out 0.5s forwards;
}
@keyframes highlight-fade {
0% { background-color: #c8860a; color: #fff; }
60% { background-color: #c8860a55; color: inherit; }
100% { background-color: transparent; color: inherit; }
}
/* ── Thai/Pali Typography ──────────────────────────────────────── */
/* Font-kerning and Thai OpenType features for the body reading text */
.reader-content p,
.content-body p {
/* !important overrides Tailwind typography plugin defaults and any inherited text-center */
text-align: justify !important;
text-align-last: left !important;
text-justify: auto !important;
text-indent: 2em;
margin-bottom: 0.6rem !important;
line-height: 1.75 !important;
word-break: normal;
line-break: loose;
overflow-wrap: anywhere;
font-kerning: normal;
font-feature-settings: "kern" 1, "liga" 1, "clig" 1;
orphans: 2;
widows: 2;
}
.reader-content p.numbered-line,
.content-body p.numbered-line {
padding-left: 2.8em;
text-indent: -2.8em;
text-align: left !important;
text-justify: none;
}
/* Structured/tabular lines (e.g. Abhidhamma Patthana) β€” kept as standalone rows */
.reader-content p.structured-line,
.content-body p.structured-line {
text-align: left !important;
text-indent: 0;
text-justify: none;
margin-bottom: 0.1rem !important;
}
/* Numbered-list paragraphs (ΰΉ‘)/(ΰΉ’)/(ΰΉ“) β€” cancel text-indent so all items align left */
.reader-content p.numbered-list,
.content-body p.numbered-list {
text-indent: 0 !important;
}
/* Continuation / repetition lines starting with "..." β€” no paragraph indent */
.reader-content p.continuation-line,
.content-body p.continuation-line {
text-indent: 0 !important;
}
/* All inline reference superscripts β€” same colour, same cursor for future click-to-expand */
sup.footnote-ref,
sup.abbrev-ref {
font-size: 0.7em;
color: #f59e0b;
opacity: 0.8;
vertical-align: super;
cursor: pointer;
letter-spacing: 0.03em;
transition: opacity 0.15s;
}
sup.footnote-ref:hover,
sup.abbrev-ref:hover {
opacity: 1;
text-decoration: underline;
}
/* Standalone fallback block β€” remove gaps so it reads like part of the paragraph above */
.reader-content p.footnote-ref {
display: inline; /* collapses to inline flow β€” no block gap */
font-size: 0.72em;
opacity: 0.55;
margin: 0;
padding: 0;
text-indent: 0;
}
/* Wrap each footnote-ref in a block-level container so "display:inline" still works inside prose */
.reader-content p.footnote-ref::before {
content: " "; /* space before the marker */
}
/* Paragraph immediately before a footnote-ref: kill its bottom margin */
.reader-content p:has(+ p.footnote-ref) {
margin-bottom: 0 !important;
}
/* Paragraph immediately after a footnote-ref: normal top gap resumes */
.reader-content p.footnote-ref + p {
margin-top: 0;
}
/* Remove gap when <br/> is at the start of a <p> (edge case) */
.reader-content p:first-child {
margin-top: 0;
}
/* Custom Utilities */
.text-pali {
font-family: var(--font-sarabun);
font-size: 1.125rem;
line-height: 1.8;
}
.sacred-border {
border-image: linear-gradient(to bottom, #D4AF37, #F4E7A5, #D4AF37) 1;
}
/* ── Theme Backgrounds with Textures ────────────────────────── */
.theme-light-bg {
background-color: #f8f6f0;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.45' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.012'/%3E%3C/svg%3E");
}
.theme-classic-bg {
background-color: #f5edd8;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.45' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.015'/%3E%3C/svg%3E");
}
.theme-dark-bg {
background-color: #1a1a2e;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.45' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.018'/%3E%3C/svg%3E");
}
.glass-panel {
background: rgba(255, 255, 255, 0.03);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
.glass-panel-light {
background: rgba(255, 255, 255, 0.6);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(200, 134, 10, 0.1);
}
/* ── Inline Content Headings ── smaller than body text, highlight makes it stand out */
.content-heading {
color: #c8860a;
font-weight: 700;
font-size: 0.85em;
margin: 1.2em 0 0.6em 0;
padding: 0.4em 0.75em;
background: rgba(200, 134, 10, 0.08);
border-left: 3px solid rgba(200, 134, 10, 0.5);
border-radius: 0 0.375rem 0.375rem 0;
line-height: 1.4;
text-align: left;
}
/* Remove extra margin when following another heading */
.content-heading + .content-heading {
margin-top: -0.3em;
}
/* Italic footnote styling */
.content-body i {
opacity: 0.75;
font-style: italic;
}
/* Underline reference styling */
.content-body u {
text-decoration: none;
border-bottom: 1px dotted rgba(200, 134, 10, 0.3);
}
/* ── First Page Top Section ────────────────────────────────────── */
.first-page-top {
text-align: center;
}
.first-page-top .content-heading {
text-align: center;
background: transparent;
border: none;
padding: 0;
margin: 0.2em 0;
font-weight: 400;
font-size: 1em;
color: inherit;
line-height: inherit;
border-radius: 0;
}