libog-twi / styles.css
danieldzikunuofmarvel's picture
The overflow-y rule needs !important to beat Gradio own
b0b41cd verified
Raw History Blame Contribute Delete
10.1 kB
/* SPEC-03 §7 design tokens and §8 accessibility rules.
Single light theme; Gradio's dark mode is disabled in app.py. */
:root {
--paper: #FAF9F6;
--ink: #1A211F;
--card: #FFFFFF;
/* SPEC-03 §7 specifies #6A7873, but §8 requires 4.5:1 against --paper and says
to verify rather than assume. Measured, #6A7873 gives 4.39:1 on --paper — it
fails on the subtitle, the footer and the baseline block, which all sit on
paper rather than card. Darkened until it clears: 4.84:1. Update SPEC-03 §7
to match. */
--muted: #64716C;
--line: #DCE3E0;
--accent: #0E6F68;
--warn: #9C5410;
--warn-bg: #FBEFE0;
--bad: #962F2F;
--bad-bg: #F9EAEA;
--serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
--sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
--mono: ui-monospace, 'Cascadia Mono', Menlo, monospace;
}
/* Fallback for the head redirect in app.py, which does the real work. Without
this, a browser with JavaScript restricted would show Gradio's dark body
behind our light panels. */
body,
body.dark {
--body-background-fill: var(--paper);
--body-text-color: var(--ink);
background: var(--paper) !important;
color: var(--ink) !important;
color-scheme: light;
}
.gradio-container {
background: var(--paper) !important;
color: var(--ink) !important;
font-family: var(--sans) !important;
max-width: 1080px !important;
margin: 0 auto !important;
padding: 0 16px 40px !important;
/* This element is where the page's overflow actually lands once html and body
have a definite height (see the body rule below), so it is the one that has
to be scrollable. `overflow-y` must be stated explicitly: with a definite
height and `overflow-x: hidden` it otherwise computes to `hidden`, which a
script can still scroll but a user's mouse wheel cannot - the page then
looks frozen while every measurement says the content is reachable. */
overflow-x: hidden !important;
overflow-y: auto !important;
}
/* The page scrolls inside <body>, not in the viewport, and that is deliberate.
Hugging Face embeds a Space in an iframe carrying scrolling="no", which
disables scrolling of the *viewport* (documentElement) inside that frame.
Gradio also ships iframe-resizer configured `autoResize: false`, so nothing
reports our height and the frame does not grow: measured at 615-689px against
1569px of real content, leaving most of the page clipped and unreachable.
Giving html and body a definite height and putting the overflow on body makes
<body> the scroll container. scrolling="no" does not affect that, and it does
not depend on the parent sizing the frame correctly: whatever height we are
given, every part of the page stays reachable inside it.
`overflow-x: hidden` on body still satisfies §8's no-horizontal-scroll rule.
Its old side effect - turning body into a scroll container - is now the
intent rather than an accident. */
html {
height: 100%;
min-height: 0;
overflow: hidden;
}
body {
height: 100%;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
}
/* --- Header ------------------------------------------------------------- */
#libog-header { padding: 28px 0 14px; }
#libog-header h1 {
font-family: var(--serif);
font-size: 1.85rem;
line-height: 1.15;
margin: 0 0 8px;
color: var(--ink);
}
#libog-header p {
margin: 0;
color: var(--muted);
font-size: 0.95rem;
max-width: 62ch;
}
/* --- Provenance banner (never dismissible, §1) --------------------------- */
#libog-banner {
background: var(--warn-bg);
border: 1px solid var(--warn);
border-left-width: 4px;
border-radius: 6px;
padding: 10px 14px;
margin-bottom: 20px;
font-size: 0.88rem;
color: var(--ink);
}
#libog-banner strong { color: var(--warn); }
/* --- Panels ------------------------------------------------------------- */
.libog-panel {
background: var(--card) !important;
border: 1px solid var(--line) !important;
border-radius: 10px !important;
padding: 18px !important;
}
.libog-panel-head {
display: flex;
align-items: baseline;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 12px;
padding-bottom: 10px;
border-bottom: 1px solid var(--line);
}
.libog-panel-head h2 {
font-family: var(--serif);
font-size: 1.15rem;
margin: 0;
color: var(--ink);
}
.libog-panel-head span {
font-size: 0.78rem;
color: var(--muted);
}
/* Two columns from 780px, one below it (§1). */
@media (max-width: 779px) {
#libog-panels { flex-direction: column !important; }
#libog-panels > * { min-width: 100% !important; }
}
/* --- Twi and machine text (§7) ------------------------------------------ */
.libog-twi textarea,
.libog-twi input {
font-family: var(--serif) !important;
font-size: 1.12rem !important;
line-height: 1.55 !important;
color: var(--ink) !important;
background: var(--card) !important;
border: 1px solid var(--line) !important;
}
#libog-transcript {
font-family: var(--serif);
font-size: 1.12rem;
line-height: 1.55;
min-height: 2.6em;
color: var(--ink);
}
#libog-transcript .placeholder { color: var(--muted); }
#libog-baseline {
margin-top: 14px;
padding: 10px 12px;
background: var(--paper);
border: 1px solid var(--line);
border-radius: 6px;
}
#libog-baseline .label {
display: block;
font-size: 0.78rem;
color: var(--muted);
margin-bottom: 4px;
}
#libog-baseline .value {
font-family: var(--serif);
font-size: 1.05rem;
color: var(--muted);
}
.libog-meta {
font-family: var(--mono);
font-size: 0.72rem;
color: var(--muted);
margin-top: 10px;
word-break: break-word;
}
#libog-english {
font-family: var(--serif);
font-size: 1.12rem;
line-height: 1.55;
min-height: 2.6em;
}
/* --- Notices (§6, §8) ---------------------------------------------------- */
.libog-notice {
border-radius: 6px;
padding: 9px 12px;
margin-bottom: 12px;
font-size: 0.88rem;
border: 1px solid;
border-left-width: 4px;
}
/* §8: colour never carries meaning alone, so each notice names itself. */
.libog-notice .kind {
display: block;
font-weight: 700;
font-size: 0.74rem;
letter-spacing: 0.04em;
text-transform: uppercase;
margin-bottom: 2px;
}
.libog-notice.error {
background: var(--bad-bg);
border-color: var(--bad);
color: var(--ink);
}
.libog-notice.error .kind { color: var(--bad); }
.libog-notice.warning {
background: var(--warn-bg);
border-color: var(--warn);
color: var(--ink);
}
.libog-notice.warning .kind { color: var(--warn); }
/* --- Vowel buttons (§3) -------------------------------------------------- */
#libog-vowels { gap: 6px !important; margin: 6px 0 10px; }
#libog-vowels button {
font-family: var(--serif) !important;
font-size: 1.15rem !important;
min-width: 46px !important;
padding: 4px 10px !important;
background: var(--card) !important;
border: 1px solid var(--line) !important;
color: var(--ink) !important;
}
#libog-vowels button:hover { border-color: var(--accent) !important; }
.libog-vowel-label {
font-size: 0.78rem;
color: var(--muted);
margin-bottom: 2px;
}
/* --- Buttons ------------------------------------------------------------- */
.libog-action button,
button.libog-action {
background: var(--accent) !important;
color: #FFFFFF !important;
border: 1px solid var(--accent) !important;
font-family: var(--sans) !important;
font-weight: 600 !important;
}
/* --- Focus ring (§8: 2px solid accent, 2px offset) ----------------------- */
/* Written as a plain selector list rather than `:where(...)`. Gradio scopes
custom CSS by rewriting selectors textually, and it mangles the grouping
inside `:where(a, b, c)` — observed in the served stylesheet. A comma list
survives that rewrite intact. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
outline: 2px solid var(--accent) !important;
outline-offset: 2px !important;
border-radius: 4px;
}
/* --- Footer -------------------------------------------------------------- */
#libog-footer {
margin-top: 28px;
padding-top: 16px;
border-top: 1px solid var(--line);
font-size: 0.8rem;
color: var(--muted);
line-height: 1.6;
}
#libog-footer a { color: var(--accent); }
#libog-footer p { margin: 0 0 6px; }
/* --- Level meter (§2). aria-hidden; motion is decorative only. ----------- */
#libog-meter {
display: flex;
align-items: flex-end;
gap: 3px;
height: 26px;
margin-top: 8px;
}
#libog-meter i {
display: block;
width: 4px;
background: var(--accent);
opacity: 0.75;
border-radius: 2px;
height: 30%;
animation: libog-bounce 900ms ease-in-out infinite;
}
#libog-meter i:nth-child(2) { animation-delay: 120ms; }
#libog-meter i:nth-child(3) { animation-delay: 240ms; }
#libog-meter i:nth-child(4) { animation-delay: 60ms; }
#libog-meter i:nth-child(5) { animation-delay: 300ms; }
#libog-meter i:nth-child(6) { animation-delay: 180ms; }
#libog-meter i:nth-child(7) { animation-delay: 360ms; }
@keyframes libog-bounce {
0%, 100% { height: 25%; }
50% { height: 100%; }
}
/* §2 and §8: hold static rather than animate. */
@media (prefers-reduced-motion: reduce) {
#libog-meter i { animation: none; height: 55%; }
}
/* Gradio chrome we don't want.
`:not(#libog-footer)` is not tidiness: our own footer is a <footer> element
inside .gradio-container, so the unqualified rule hid it too - taking the
BibleTTS attribution, the privacy statement and the disclaimer off the page
with it. SPEC-03 §1 requires that footer and CC BY-SA requires the
attribution in it. */
footer.svelte-1ax1toq:not(#libog-footer),
.gradio-container footer:not(#libog-footer) { display: none !important; }