/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
hamiltonian_systems / app / style.css
398 lines · 12.9 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, #double-poincare-canvas, #double-dispersion-canvas { 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/* Poincare section explorer: one wide section view with its controls above. */
193.page:not(.split) > .demo.explorer { width: 1500px; }
194.explorer-controls { display: flex; align-items: center; gap: 40px; font-size: 30px; }
195.explorer-energy { display: flex; align-items: center; gap: 16px; flex: 1; }
196.explorer-energy input { flex: 1; }
197.explorer-energy output { width: 4em; text-align: right; font-variant-numeric: tabular-nums; }
198.legend { display: inline-flex; align-items: center; gap: 12px; font-size: 26px; }
199/* a few of the per-orbit cool colors (main.js), then the blend to red */
200.legend-bar { width: 160px; height: 12px; border-radius: 6px; background: linear-gradient(to right, #537eba 0 10%, #2e8b57 10% 20%, #1a9cb0 20% 30%, var(--force)); }
201#double-explorer-canvas { height: 700px; cursor: crosshair; }
202/* Listening to orbits: the section view on the left, the sound controls and
203 spectrogram on the right. */
204.page:not(.split) > .demo.explorer.listen { width: 1724px; }
205.listen-body { display: grid; grid-template-columns: minmax(0, 1fr) 580px; gap: 48px; }
206#double-listen-canvas, #double-damped-canvas { height: 700px; cursor: crosshair; }
207.listen-panel { display: flex; flex-direction: column; gap: 20px; font-size: 28px; text-align: left; }
208.listen-row { display: flex; align-items: center; gap: 16px; }
209.listen-row select, .listen-row input { flex: 1; min-width: 0; }
210.listen-row output { width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
211#double-listen-spectrogram, #double-damped-spectrogram { height: 560px; }
212button.run:disabled { opacity: 0.4; cursor: default; background: var(--bg); color: var(--accent); }
214/* A diagram with its Start/Stop and reset buttons in the top-right corner. */
215.stage { position: relative; }
216.run-controls { position: absolute; top: 0; right: 0; display: flex; gap: 10px; }
217button.run { font-size: 26px; padding: 6px 20px; background: var(--bg); }
218button.run:hover { background: var(--accent); color: var(--bg); }
219.run-controls select { font-size: 26px; }
221.readout { font-size: 30px; font-variant-numeric: tabular-nums; }
223.preset { display: inline-flex; align-items: center; gap: 16px; }
225select {
226 font: inherit;
227 color: var(--fg);
228 background: var(--bg);
229 border: 2px solid var(--accent);
230 border-radius: 8px;
231 padding: 6px 12px;
234/* The q0 slider sits right under the phase plot; main.js stretches it so the
235 thumb lines up with q0 on the diagram. */
236.q0-row { margin-top: -18px; text-align: left; }
237.q0-row input { display: block; }
238.slider-caption { margin-top: -14px !important; font-size: 28px; opacity: 0.8; }
240/* Grouped sliders: symbol, slider and value line up in columns. */
241.control-groups {
242 display: grid;
243 gap: 24px;
244 max-width: 520px;
245 margin: 0 0 28px;
248.control-groups fieldset {
249 display: grid;
250 grid-template-columns: 1.5em 1fr 3.2em;
251 align-items: center;
252 gap: 10px 16px;
253 margin: 0;
254 padding: 14px 24px 20px;
255 border: 2px solid color-mix(in srgb, var(--fg) 15%, transparent);
256 border-radius: 12px;
259.control-groups legend { padding: 0 8px; font-size: 24px; opacity: 0.7; }
260.control-groups .row { display: contents; }
261.control-groups input { width: 100%; }
262.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
264/* Sliders drawn large enough to use when the deck is scaled down. The thumb
265 is 30px wide; main.js relies on that to line up the q0 slider. */
266input[type="range"] {
267 -webkit-appearance: none;
268 appearance: none;
269 height: 34px;
270 margin: 0;
271 background: transparent;
272 cursor: pointer;
274input[type="range"]::-webkit-slider-runnable-track {
275 height: 8px;
276 border-radius: 4px;
277 background: color-mix(in srgb, var(--fg) 18%, transparent);
279input[type="range"]::-webkit-slider-thumb {
280 -webkit-appearance: none;
281 width: 30px;
282 height: 30px;
283 margin-top: -11px;
284 border: none;
285 border-radius: 50%;
286 background: var(--accent);
288input[type="range"]::-moz-range-track {
289 height: 8px;
290 border-radius: 4px;
291 background: color-mix(in srgb, var(--fg) 18%, transparent);
293input[type="range"]::-moz-range-thumb {
294 width: 30px;
295 height: 30px;
296 border: none;
297 border-radius: 50%;
298 background: var(--accent);
300input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
302.pager {
303 position: fixed;
304 bottom: 0;
305 left: 0;
306 right: 0;
307 z-index: 1;
308 display: flex;
309 align-items: center;
310 justify-content: space-between;
311 padding: 10px 16px;
312 background: var(--window-bg);
313 color: var(--window-fg);
314 border-top: 1px solid color-mix(in srgb, var(--window-fg) 12%, transparent);
317.pager button { padding: 0.35rem 0.8rem; font-size: 0.9rem; border-width: 1px; }
318.pager button:disabled { opacity: 0.3; cursor: default; background: none; color: var(--accent); }
319/* Slide counter; opens the table of contents. */
320.pager .nav-toc { border-color: transparent; color: inherit; font-size: 0.85rem; opacity: 0.75; }
321.pager .nav-toc:hover, .pager .nav-toc[aria-expanded="true"] { opacity: 1; background: color-mix(in srgb, var(--window-fg) 10%, transparent); color: inherit; }
323/* Table of contents, opening upward from the nav bar. */
324.toc {
325 position: absolute;
326 bottom: calc(100% + 8px);
327 left: 50%;
328 transform: translateX(-50%);
329 width: min(460px, calc(100vw - 32px));
330 max-height: min(70vh, 560px);
331 overflow-y: auto;
332 padding: 6px;
333 border-radius: 10px;
334 border: 1px solid color-mix(in srgb, var(--window-fg) 18%, transparent);
335 background: var(--window-bg);
336 box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
338.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: slide; }
339.toc li { counter-increment: slide; }
340.toc button {
341 display: flex;
342 gap: 12px;
343 width: 100%;
344 text-align: left;
345 border: none;
346 border-radius: 6px;
347 padding: 7px 10px;
348 font-size: 0.95rem;
349 color: var(--window-fg);
351.toc button::before { content: counter(slide); min-width: 1.6em; text-align: right; opacity: 0.5; font-variant-numeric: tabular-nums; }
352.toc button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--window-fg); }
353.toc button.current { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 600; }
355button {
356 font: inherit;
357 color: var(--accent);
358 background: none;
359 border: 2px solid var(--accent);
360 border-radius: 8px;
361 padding: 10px 24px;
362 cursor: pointer;
365button:hover { background: var(--accent); color: var(--bg); }
367/* The suggested next step: filled and pulsing gently. */
368button.next {
369 font-size: 32px;
370 padding: 14px 36px;
371 background: var(--accent);
372 color: var(--bg);
373 visibility: hidden;
374 opacity: 0;
375 transition: opacity 0.6s;
378button.next.ready {
379 visibility: visible;
380 opacity: 1;
381 animation: pulse 2s ease-in-out 0.6s 3;
384button.next:hover { opacity: 0.85; }
386@keyframes pulse {
387 0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
388 50% { box-shadow: 0 0 0 12px transparent; }
391button.link {
392 border: none;
393 padding: 4px 0;
394 text-decoration: underline;
395 text-underline-offset: 5px;
398button.link:hover { background: none; color: var(--accent); opacity: 0.8; }
↑↓ move↵openescclose