/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
hamiltonian_systems / app / style.css
284 lines · 6.7 KBCodeBlameHistory
51ce1cdInteractive Hamiltonian systems tutorialJeremy Magland 1:root {
2 --bg: #fafaf7;
3 --fg: #1d1d1f;
4 --accent: #2f5d8a;
5 --force: #c0392b;
6 --momentum: #2e8b57;
7 --potential: #c98a1b;
8}
10@media (prefers-color-scheme: dark) {
11 :root {
12 --bg: #141416;
13 --fg: #e8e8ea;
14 --accent: #7fb0e0;
15 --force: #ec7063;
16 --momentum: #58d68d;
17 --potential: #f0b450;
18 }
21* { box-sizing: border-box; }
23body {
24 margin: 0;
25 background: var(--bg);
26 color: var(--fg);
27 font-family: system-ui, -apple-system, sans-serif;
30main {
31 min-height: 100vh;
32 display: flex;
33 align-items: flex-start;
34 justify-content: center;
35 padding: 64px 16px 16px;
38/* Slide titles sit at the top; only the title slide is centered vertically. */
39#landing { align-self: center; }
41.page { display: none; text-align: center; width: 100%; max-width: 720px; }
42.page.active { display: block; }
44/* Slides: text and equations on the left, interactive content on the right.
45 On narrow screens they stack, with the interactive part first. */
46.page.split, .page.text-only { max-width: 1200px; }
48.page.split.active {
49 display: grid;
50 grid-template-columns: 1fr 1fr;
51 grid-template-areas: "title title" "text demo";
52 gap: 0 3rem;
53 align-items: start;
56.page.split > h2 { grid-area: title; }
57.page.split > .text { grid-area: text; text-align: left; }
58.page.split > .demo { grid-area: demo; min-width: 0; }
60/* On desktop the slide fills the window below the nav bar, and the two
61 panels scroll independently. */
62@media (min-width: 861px) {
63 .page.split.active {
64 height: calc(100vh - 64px - 16px);
65 grid-template-rows: auto minmax(0, 1fr);
66 }
67 .page.split > .text,
68 .page.split > .demo {
69 height: 100%;
70 overflow-y: auto;
71 padding: 0 8px 16px;
72 }
75@media (max-width: 860px) {
76 .page.split.active {
77 grid-template-columns: 1fr;
78 grid-template-areas: "title" "demo" "text";
79 }
80 .page.split > .text { margin-top: 1.5rem; }
83.pager {
84 position: fixed;
85 top: 0;
86 left: 0;
87 right: 0;
88 z-index: 1;
89 display: flex;
90 align-items: center;
91 justify-content: space-between;
92 padding: 10px 16px;
93 background: var(--bg);
94 border-bottom: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
97.pager button { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
98.pager button:disabled { opacity: 0.3; cursor: default; background: none; color: var(--accent); }
99#nav-pos { font-size: 0.85rem; opacity: 0.6; }
101h2 {
102 font-weight: 500;
103 font-size: clamp(1.2rem, 4vw, 1.6rem);
104 margin: 0 0 1.5rem;
107canvas {
108 display: block;
109 width: 100%;
110 height: 200px;
111 margin: 0 0 1.5rem;
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 114/* A diagram with its Start/Stop button in the top-right corner. */
115.stage { position: relative; }
116.stage > canvas { margin-bottom: 0; }
443a2ccBundle KaTeX locally and add reset buttonsJeremy Magland 117.run-controls { position: absolute; top: 0; right: 0; display: flex; gap: 0.4rem; }
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 118.stage + * { margin-top: 1.5rem; }
119button.run {
120 padding: 0.3rem 0.8rem;
121 font-size: 0.9rem;
122 background: var(--bg);
124button.run:hover { background: var(--accent); }
51ce1cdInteractive Hamiltonian systems tutorialJeremy Magland 126canvas.bars { height: 100px; margin-top: -0.5rem; }
127canvas.phase { height: 260px; }
1aac419Add Liouville pages, crafted-by-human link and CLAUDE.mdJeremy Magland 128.readout { font-variant-numeric: tabular-nums; }
51ce1cdInteractive Hamiltonian systems tutorialJeremy Magland 129canvas.pendulum { height: 260px; }
443a2ccBundle KaTeX locally and add reset buttonsJeremy Magland 130canvas.pendulum-centered { height: 300px; }
132.preset { display: inline-flex; align-items: center; gap: 0.5rem; }
134select {
135 font: inherit;
136 color: var(--fg);
137 background: var(--bg);
138 border: 1px solid var(--accent);
139 border-radius: 6px;
140 padding: 0.35rem 0.5rem;
143.q0-row { text-align: left; margin-top: -1.25rem; }
144.q0-row input { display: block; margin: 0; }
145.slider-caption { margin: 0.25rem 0 1rem; font-size: 0.9rem; opacity: 0.8; }
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 147/* Grouped sliders: symbol, slider and value line up in columns. */
148.control-groups {
149 display: grid;
150 grid-template-columns: 1fr 1fr;
151 gap: 1rem;
51ce1cdInteractive Hamiltonian systems tutorialJeremy Magland 152 margin: 0 0 1.25rem;
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 153 text-align: left;
156@media (max-width: 560px) {
157 .control-groups { grid-template-columns: 1fr; }
160.control-groups.single { grid-template-columns: 1fr; max-width: 340px; margin-left: auto; margin-right: auto; }
f283ebaTwo-panel layout for phase space pagesJeremy Magland 162/* Controls in the left panel stack in one column. */
163.page.split > .text .control-groups { grid-template-columns: 1fr; max-width: 360px; margin-left: 0; }
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 165.control-groups fieldset {
166 display: grid;
167 grid-template-columns: 1.5em 1fr 3em;
168 align-items: center;
169 gap: 0.4rem 0.6rem;
170 align-content: start;
171 margin: 0;
172 padding: 0.6rem 0.9rem 0.8rem;
173 border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
174 border-radius: 8px;
27967abLayout refinements for phase space pages and run buttonsJeremy Magland 177.control-groups legend { padding: 0 0.3rem; font-size: 0.85rem; opacity: 0.7; }
178.control-groups .row { display: contents; }
179.control-groups input { width: 100%; margin: 0; }
180.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
182input[type="range"] { accent-color: var(--accent); }
184h1 {
185 font-weight: 500;
186 font-size: clamp(1.6rem, 5vw, 2.6rem);
187 margin: 0 0 1.5rem;
1aac419Add Liouville pages, crafted-by-human link and CLAUDE.mdJeremy Magland 190/* Link on the title slide to the replay of how the recipe was written. */
191.crafted { margin-top: 2.5rem; font-size: 0.9rem; }
192.crafted a { color: var(--fg); opacity: 0.6; text-decoration: none; }
193.crafted a:hover { opacity: 1; text-decoration: underline; }
51ce1cdInteractive Hamiltonian systems tutorialJeremy Magland 195button {
196 font: inherit;
197 color: var(--accent);
198 background: none;
199 border: 1px solid var(--accent);
200 border-radius: 6px;
201 padding: 0.6rem 1.2rem;
202 cursor: pointer;
205button:hover { background: var(--accent); color: var(--bg); }
207/* The suggested next step: hidden until the user has tried the demo, then filled and pulsing gently. */
208button.next {
209 margin-top: 1.5rem;
210 background: var(--accent);
211 color: var(--bg);
212 visibility: hidden;
213 opacity: 0;
214 transition: opacity 0.6s;
217button.next.ready {
218 visibility: visible;
219 opacity: 1;
220 animation: pulse 2s ease-in-out 0.6s 3;
223button.next:hover { opacity: 0.85; }
225@keyframes pulse {
226 0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
227 50% { box-shadow: 0 0 0 6px transparent; }
230.equations {
231 text-align: left;
232 margin: 0;
233 line-height: 1.6;
234 display: grid;
235 grid-template-columns: 1fr 1fr;
236 gap: 0 2.5rem;
239.equations[hidden] { display: none; }
241.equations > div > :first-child { margin-top: 0; }
243/* Two columns of equations only when the text panel is wide enough. */
244@media (max-width: 1100px) and (min-width: 861px), (max-width: 600px) {
245 .equations { grid-template-columns: 1fr; }
246 .equations > div + div { margin-top: 1.5rem; }
249.equations h3 {
250 font-weight: 500;
251 font-size: 1.05rem;
252 margin: 1.5rem 0 0.25rem;
255button.link {
256 border: none;
257 padding: 0.3rem 0;
258 text-decoration: underline;
259 text-underline-offset: 3px;
262button.link:hover { background: none; color: var(--accent); opacity: 0.8; }
264.exercise {
265 text-align: left;
266 margin: 2rem 0 0;
267 padding: 1rem 1.25rem;
268 border-left: 3px solid var(--accent);
269 line-height: 1.6;
272.exercise h3 {
273 font-weight: 500;
274 font-size: 1.05rem;
275 margin: 0 0 0.25rem;
278.defs {
279 list-style: none;
280 padding: 0;
281 margin: 0;
284.defs li { margin: 0.35rem 0; }
↑↓ move↵openescclose