/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
hamiltonian_systems / app / style.css
375 lines · 11.2 KBBlameHistoryRaw
1/* Styled after the CCM PowerPoint template (2025): navy text on white, Flatiron
2 orange and blue accents, Tiempos Headline titles and Founders Grotesk body text.
3 The brand fonts are used when installed; otherwise the bundled open fonts
4 Source Serif 4 and Hanken Grotesk stand in. */
5@font-face { font-family: "Source Serif 4"; font-weight: 300; src: url("vendor/fonts/source-serif-4-latin-300-normal.woff2") format("woff2"); }
6@font-face { font-family: "Source Serif 4"; font-weight: 400; src: url("vendor/fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
7@font-face { font-family: "Hanken Grotesk"; font-weight: 400; src: url("vendor/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); }
8@font-face { font-family: "Hanken Grotesk"; font-weight: 600; src: url("vendor/fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2"); }
9@font-face { font-family: "Hanken Grotesk"; font-weight: 700; src: url("vendor/fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2"); }
11/* Slides keep the template's light colors in both themes; only the window
12 around them and the nav bar follow the system theme. */
13:root {
14 --bg: #ffffff;
15 --fg: #1c2954;
16 --accent: #537eba;
17 --brand-orange: #f6862d;
18 --force: #c0392b;
19 --momentum: #2e8b57;
20 --potential: #c98a1b;
21 --font-head: "Tiempos Headline", "Source Serif 4", Georgia, serif;
22 --font-body: "Founders Grotesk", "Hanken Grotesk", system-ui, sans-serif;
23 --window-bg: #eef0f4;
24 --window-fg: #1c2954;
27@media (prefers-color-scheme: dark) {
28 :root {
29 --window-bg: #141416;
30 --window-fg: #e8e8ea;
31 }
34* { box-sizing: border-box; }
36body {
37 margin: 0;
38 background: var(--window-bg);
39 color: var(--window-fg);
40 font-family: var(--font-body);
43/* The area above the nav bar (main.js sets bottom); the deck is scaled to fit inside it. */
44main {
45 position: fixed;
46 top: 0;
47 left: 0;
48 right: 0;
49 bottom: 0;
50 overflow: hidden;
53/* Slides are laid out at 1920 x 1080 and scaled as a whole by main.js,
54 so sizes below are in slide pixels. */
55#deck {
56 position: absolute;
57 width: 1920px;
58 height: 1080px;
59 transform-origin: 0 0;
62.page {
63 display: none;
64 position: absolute;
65 inset: 0;
66 background: var(--bg);
67 color: var(--fg);
68 border: 3px solid color-mix(in srgb, var(--fg) 35%, transparent);
69 text-align: center;
72/* Content slides: the title on top and the content below it. */
73.page.active {
74 display: flex;
75 flex-direction: column;
76 padding: 84px 98px 40px;
79/* Flatiron logo, added to every slide by main.js: top right as in the
80 template's content layouts, bottom right on the title slide. */
81.page > .logo { position: absolute; top: 30px; right: 98px; height: 42px; }
82#landing > .logo { top: auto; bottom: 90px; height: 50px; }
84/* Title slide: the template's white title layout, text left-aligned. */
85#landing.active {
86 align-items: flex-start;
87 justify-content: flex-start;
88 padding: 240px 98px 0;
89 text-align: left;
92h1, h2 { font-family: var(--font-head); font-weight: 300; }
94h1 {
95 font-size: 108px;
96 line-height: 1.08;
97 max-width: 1400px;
98 margin: 0 0 120px;
101h2 {
102 font-size: 76px;
103 line-height: 1.1;
104 text-align: left;
105 margin: 0 0 34px;
108button.start { font-size: 40px; padding: 18px 44px; }
110/* Link on the title slide to the replay of how the recipe was written. */
111.crafted { margin-top: 64px; font-size: 28px; }
112.crafted a { color: inherit; opacity: 0.8; text-decoration: none; }
113.crafted a:hover { opacity: 1; text-decoration: underline; }
115/* Slides with a title on top, text on the left and the interactive content
116 on the right. Each panel scrolls on its own if its content is too tall. */
117.page.split.active {
118 display: grid;
119 grid-template-columns: 960px minmax(0, 1fr);
120 grid-template-rows: auto minmax(0, 1fr);
121 grid-template-areas: "title title" "text demo";
122 gap: 0 72px;
123 text-align: left;
125/* Controls on the left need less room than equations. */
126.page.split.narrow-left.active { grid-template-columns: 600px minmax(0, 1fr); }
127/* The double pendulum's long equations: slightly smaller text. */
128.page.compact-text > .text { font-size: 26px; }
130.page.split > h2 { grid-area: title; }
131.page.split > .text { grid-area: text; }
132.page.split > .demo { grid-area: demo; min-width: 0; }
133.page.split > .text,
134.page.split > .demo { min-height: 0; overflow-y: auto; }
136/* Slides that are not split: the interactive content centered below the title. */
137.page:not(.split) > .demo { align-self: center; width: 1100px; }
139.text { font-size: 30px; line-height: 1.45; text-align: left; }
140.text p { margin: 0 0 16px; }
142h3 { font-weight: 600; font-size: 32px; margin: 28px 0 6px; }
144.katex-display { margin: 12px 0; }
146.equations {
147 display: grid;
148 grid-template-columns: 1fr 1fr;
149 gap: 0 56px;
150 text-align: left;
152.equations > div > :first-child { margin-top: 0; }
154/* Hamilton's equations: a title and two columns of equations. */
155.page.text-only > .equations {
156 align-self: center;
157 width: 1500px;
158 margin-top: 40px;
159 font-size: 40px;
160 line-height: 1.45;
162.page.text-only h3 { font-size: 42px; margin: 48px 0 10px; }
163.page.text-only p { margin: 0 0 16px; }
165.defs { list-style: none; padding: 0; margin: 0; }
166.defs li { margin: 6px 0; }
168.exercise {
169 margin: 32px 0 0;
170 padding: 16px 28px;
171 border-left: 4px solid var(--accent);
173.exercise h3 { margin-top: 0; }
175/* Interactive content: diagrams, plots and their controls, stacked. */
176.demo { display: flex; flex-direction: column; gap: 24px; text-align: center; }
177.demo > p { margin: 0; }
179canvas { display: block; width: 100%; height: 300px; }
180canvas.bars { height: 150px; }
181canvas.phase { height: 390px; }
182canvas.pendulum { height: 360px; }
183canvas.pendulum-centered { height: 390px; }
184#liouville-canvas, #liouville-pendulum-canvas { height: 360px; }
185canvas.double { height: 700px; }
186#double-phase-canvas, #liouville-double-diagram { height: 340px; }
187/* Two phase planes side by side. */
188.plane-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
189.plane-pair canvas { height: 360px; }
190.caption { font-size: 26px; opacity: 0.8; }
192/* A diagram with its Start/Stop and reset buttons in the top-right corner. */
193.stage { position: relative; }
194.run-controls { position: absolute; top: 0; right: 0; display: flex; gap: 10px; }
195button.run { font-size: 26px; padding: 6px 20px; background: var(--bg); }
196button.run:hover { background: var(--accent); color: var(--bg); }
198.readout { font-size: 30px; font-variant-numeric: tabular-nums; }
200.preset { display: inline-flex; align-items: center; gap: 16px; }
202select {
203 font: inherit;
204 color: var(--fg);
205 background: var(--bg);
206 border: 2px solid var(--accent);
207 border-radius: 8px;
208 padding: 6px 12px;
211/* The q0 slider sits right under the phase plot; main.js stretches it so the
212 thumb lines up with q0 on the diagram. */
213.q0-row { margin-top: -18px; text-align: left; }
214.q0-row input { display: block; }
215.slider-caption { margin-top: -14px !important; font-size: 28px; opacity: 0.8; }
217/* Grouped sliders: symbol, slider and value line up in columns. */
218.control-groups {
219 display: grid;
220 gap: 24px;
221 max-width: 520px;
222 margin: 0 0 28px;
225.control-groups fieldset {
226 display: grid;
227 grid-template-columns: 1.5em 1fr 3.2em;
228 align-items: center;
229 gap: 10px 16px;
230 margin: 0;
231 padding: 14px 24px 20px;
232 border: 2px solid color-mix(in srgb, var(--fg) 15%, transparent);
233 border-radius: 12px;
236.control-groups legend { padding: 0 8px; font-size: 24px; opacity: 0.7; }
237.control-groups .row { display: contents; }
238.control-groups input { width: 100%; }
239.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
241/* Sliders drawn large enough to use when the deck is scaled down. The thumb
242 is 30px wide; main.js relies on that to line up the q0 slider. */
243input[type="range"] {
244 -webkit-appearance: none;
245 appearance: none;
246 height: 34px;
247 margin: 0;
248 background: transparent;
249 cursor: pointer;
251input[type="range"]::-webkit-slider-runnable-track {
252 height: 8px;
253 border-radius: 4px;
254 background: color-mix(in srgb, var(--fg) 18%, transparent);
256input[type="range"]::-webkit-slider-thumb {
257 -webkit-appearance: none;
258 width: 30px;
259 height: 30px;
260 margin-top: -11px;
261 border: none;
262 border-radius: 50%;
263 background: var(--accent);
265input[type="range"]::-moz-range-track {
266 height: 8px;
267 border-radius: 4px;
268 background: color-mix(in srgb, var(--fg) 18%, transparent);
270input[type="range"]::-moz-range-thumb {
271 width: 30px;
272 height: 30px;
273 border: none;
274 border-radius: 50%;
275 background: var(--accent);
277input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
279.pager {
280 position: fixed;
281 bottom: 0;
282 left: 0;
283 right: 0;
284 z-index: 1;
285 display: flex;
286 align-items: center;
287 justify-content: space-between;
288 padding: 10px 16px;
289 background: var(--window-bg);
290 color: var(--window-fg);
291 border-top: 1px solid color-mix(in srgb, var(--window-fg) 12%, transparent);
294.pager button { padding: 0.35rem 0.8rem; font-size: 0.9rem; border-width: 1px; }
295.pager button:disabled { opacity: 0.3; cursor: default; background: none; color: var(--accent); }
296/* Slide counter; opens the table of contents. */
297.pager .nav-toc { border-color: transparent; color: inherit; font-size: 0.85rem; opacity: 0.75; }
298.pager .nav-toc:hover, .pager .nav-toc[aria-expanded="true"] { opacity: 1; background: color-mix(in srgb, var(--window-fg) 10%, transparent); color: inherit; }
300/* Table of contents, opening upward from the nav bar. */
301.toc {
302 position: absolute;
303 bottom: calc(100% + 8px);
304 left: 50%;
305 transform: translateX(-50%);
306 width: min(460px, calc(100vw - 32px));
307 max-height: min(70vh, 560px);
308 overflow-y: auto;
309 padding: 6px;
310 border-radius: 10px;
311 border: 1px solid color-mix(in srgb, var(--window-fg) 18%, transparent);
312 background: var(--window-bg);
313 box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
315.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: slide; }
316.toc li { counter-increment: slide; }
317.toc button {
318 display: flex;
319 gap: 12px;
320 width: 100%;
321 text-align: left;
322 border: none;
323 border-radius: 6px;
324 padding: 7px 10px;
325 font-size: 0.95rem;
326 color: var(--window-fg);
328.toc button::before { content: counter(slide); min-width: 1.6em; text-align: right; opacity: 0.5; font-variant-numeric: tabular-nums; }
329.toc button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--window-fg); }
330.toc button.current { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 600; }
332button {
333 font: inherit;
334 color: var(--accent);
335 background: none;
336 border: 2px solid var(--accent);
337 border-radius: 8px;
338 padding: 10px 24px;
339 cursor: pointer;
342button:hover { background: var(--accent); color: var(--bg); }
344/* The suggested next step: filled and pulsing gently. */
345button.next {
346 font-size: 32px;
347 padding: 14px 36px;
348 background: var(--accent);
349 color: var(--bg);
350 visibility: hidden;
351 opacity: 0;
352 transition: opacity 0.6s;
355button.next.ready {
356 visibility: visible;
357 opacity: 1;
358 animation: pulse 2s ease-in-out 0.6s 3;
361button.next:hover { opacity: 0.85; }
363@keyframes pulse {
364 0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
365 50% { box-shadow: 0 0 0 12px transparent; }
368button.link {
369 border: none;
370 padding: 4px 0;
371 text-decoration: underline;
372 text-underline-offset: 5px;
375button.link:hover { background: none; color: var(--accent); opacity: 0.8; }
↑↓ move↵openescclose