/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
hamiltonian_systems / app / style.css
387 lines · 12.1 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; }
203/* A diagram with its Start/Stop and reset buttons in the top-right corner. */
204.stage { position: relative; }
205.run-controls { position: absolute; top: 0; right: 0; display: flex; gap: 10px; }
206button.run { font-size: 26px; padding: 6px 20px; background: var(--bg); }
207button.run:hover { background: var(--accent); color: var(--bg); }
208.run-controls select { font-size: 26px; }
210.readout { font-size: 30px; font-variant-numeric: tabular-nums; }
212.preset { display: inline-flex; align-items: center; gap: 16px; }
214select {
215 font: inherit;
216 color: var(--fg);
217 background: var(--bg);
218 border: 2px solid var(--accent);
219 border-radius: 8px;
220 padding: 6px 12px;
223/* The q0 slider sits right under the phase plot; main.js stretches it so the
224 thumb lines up with q0 on the diagram. */
225.q0-row { margin-top: -18px; text-align: left; }
226.q0-row input { display: block; }
227.slider-caption { margin-top: -14px !important; font-size: 28px; opacity: 0.8; }
229/* Grouped sliders: symbol, slider and value line up in columns. */
230.control-groups {
231 display: grid;
232 gap: 24px;
233 max-width: 520px;
234 margin: 0 0 28px;
237.control-groups fieldset {
238 display: grid;
239 grid-template-columns: 1.5em 1fr 3.2em;
240 align-items: center;
241 gap: 10px 16px;
242 margin: 0;
243 padding: 14px 24px 20px;
244 border: 2px solid color-mix(in srgb, var(--fg) 15%, transparent);
245 border-radius: 12px;
248.control-groups legend { padding: 0 8px; font-size: 24px; opacity: 0.7; }
249.control-groups .row { display: contents; }
250.control-groups input { width: 100%; }
251.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
253/* Sliders drawn large enough to use when the deck is scaled down. The thumb
254 is 30px wide; main.js relies on that to line up the q0 slider. */
255input[type="range"] {
256 -webkit-appearance: none;
257 appearance: none;
258 height: 34px;
259 margin: 0;
260 background: transparent;
261 cursor: pointer;
263input[type="range"]::-webkit-slider-runnable-track {
264 height: 8px;
265 border-radius: 4px;
266 background: color-mix(in srgb, var(--fg) 18%, transparent);
268input[type="range"]::-webkit-slider-thumb {
269 -webkit-appearance: none;
270 width: 30px;
271 height: 30px;
272 margin-top: -11px;
273 border: none;
274 border-radius: 50%;
275 background: var(--accent);
277input[type="range"]::-moz-range-track {
278 height: 8px;
279 border-radius: 4px;
280 background: color-mix(in srgb, var(--fg) 18%, transparent);
282input[type="range"]::-moz-range-thumb {
283 width: 30px;
284 height: 30px;
285 border: none;
286 border-radius: 50%;
287 background: var(--accent);
289input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
291.pager {
292 position: fixed;
293 bottom: 0;
294 left: 0;
295 right: 0;
296 z-index: 1;
297 display: flex;
298 align-items: center;
299 justify-content: space-between;
300 padding: 10px 16px;
301 background: var(--window-bg);
302 color: var(--window-fg);
303 border-top: 1px solid color-mix(in srgb, var(--window-fg) 12%, transparent);
306.pager button { padding: 0.35rem 0.8rem; font-size: 0.9rem; border-width: 1px; }
307.pager button:disabled { opacity: 0.3; cursor: default; background: none; color: var(--accent); }
308/* Slide counter; opens the table of contents. */
309.pager .nav-toc { border-color: transparent; color: inherit; font-size: 0.85rem; opacity: 0.75; }
310.pager .nav-toc:hover, .pager .nav-toc[aria-expanded="true"] { opacity: 1; background: color-mix(in srgb, var(--window-fg) 10%, transparent); color: inherit; }
312/* Table of contents, opening upward from the nav bar. */
313.toc {
314 position: absolute;
315 bottom: calc(100% + 8px);
316 left: 50%;
317 transform: translateX(-50%);
318 width: min(460px, calc(100vw - 32px));
319 max-height: min(70vh, 560px);
320 overflow-y: auto;
321 padding: 6px;
322 border-radius: 10px;
323 border: 1px solid color-mix(in srgb, var(--window-fg) 18%, transparent);
324 background: var(--window-bg);
325 box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
327.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: slide; }
328.toc li { counter-increment: slide; }
329.toc button {
330 display: flex;
331 gap: 12px;
332 width: 100%;
333 text-align: left;
334 border: none;
335 border-radius: 6px;
336 padding: 7px 10px;
337 font-size: 0.95rem;
338 color: var(--window-fg);
340.toc button::before { content: counter(slide); min-width: 1.6em; text-align: right; opacity: 0.5; font-variant-numeric: tabular-nums; }
341.toc button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--window-fg); }
342.toc button.current { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 600; }
344button {
345 font: inherit;
346 color: var(--accent);
347 background: none;
348 border: 2px solid var(--accent);
349 border-radius: 8px;
350 padding: 10px 24px;
351 cursor: pointer;
354button:hover { background: var(--accent); color: var(--bg); }
356/* The suggested next step: filled and pulsing gently. */
357button.next {
358 font-size: 32px;
359 padding: 14px 36px;
360 background: var(--accent);
361 color: var(--bg);
362 visibility: hidden;
363 opacity: 0;
364 transition: opacity 0.6s;
367button.next.ready {
368 visibility: visible;
369 opacity: 1;
370 animation: pulse 2s ease-in-out 0.6s 3;
373button.next:hover { opacity: 0.85; }
375@keyframes pulse {
376 0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
377 50% { box-shadow: 0 0 0 12px transparent; }
380button.link {
381 border: none;
382 padding: 4px 0;
383 text-decoration: underline;
384 text-underline-offset: 5px;
387button.link:hover { background: none; color: var(--accent); opacity: 0.8; }
↑↓ move↵openescclose