/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
hamiltonian_systems / app / style.css
281 lines · 6.6 KBBlameHistoryRaw
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;
114/* A diagram with its Start/Stop button in the top-right corner. */
115.stage { position: relative; }
116.stage > canvas { margin-bottom: 0; }
117.run-controls { position: absolute; top: 0; right: 0; display: flex; gap: 0.4rem; }
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); }
126canvas.bars { height: 100px; margin-top: -0.5rem; }
127canvas.phase { height: 260px; }
128.readout { font-variant-numeric: tabular-nums; }
129canvas.pendulum { height: 260px; }
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; }
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;
152 margin: 0 0 1.25rem;
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; }
162.control-groups fieldset {
163 display: grid;
164 grid-template-columns: 1.5em 1fr 3em;
165 align-items: center;
166 gap: 0.4rem 0.6rem;
167 align-content: start;
168 margin: 0;
169 padding: 0.6rem 0.9rem 0.8rem;
170 border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
171 border-radius: 8px;
174.control-groups legend { padding: 0 0.3rem; font-size: 0.85rem; opacity: 0.7; }
175.control-groups .row { display: contents; }
176.control-groups input { width: 100%; margin: 0; }
177.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
179input[type="range"] { accent-color: var(--accent); }
181h1 {
182 font-weight: 500;
183 font-size: clamp(1.6rem, 5vw, 2.6rem);
184 margin: 0 0 1.5rem;
187/* Link on the title slide to the replay of how the recipe was written. */
188.crafted { margin-top: 2.5rem; font-size: 0.9rem; }
189.crafted a { color: var(--fg); opacity: 0.6; text-decoration: none; }
190.crafted a:hover { opacity: 1; text-decoration: underline; }
192button {
193 font: inherit;
194 color: var(--accent);
195 background: none;
196 border: 1px solid var(--accent);
197 border-radius: 6px;
198 padding: 0.6rem 1.2rem;
199 cursor: pointer;
202button:hover { background: var(--accent); color: var(--bg); }
204/* The suggested next step: hidden until the user has tried the demo, then filled and pulsing gently. */
205button.next {
206 margin-top: 1.5rem;
207 background: var(--accent);
208 color: var(--bg);
209 visibility: hidden;
210 opacity: 0;
211 transition: opacity 0.6s;
214button.next.ready {
215 visibility: visible;
216 opacity: 1;
217 animation: pulse 2s ease-in-out 0.6s 3;
220button.next:hover { opacity: 0.85; }
222@keyframes pulse {
223 0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
224 50% { box-shadow: 0 0 0 6px transparent; }
227.equations {
228 text-align: left;
229 margin: 0;
230 line-height: 1.6;
231 display: grid;
232 grid-template-columns: 1fr 1fr;
233 gap: 0 2.5rem;
236.equations[hidden] { display: none; }
238.equations > div > :first-child { margin-top: 0; }
240/* Two columns of equations only when the text panel is wide enough. */
241@media (max-width: 1100px) and (min-width: 861px), (max-width: 600px) {
242 .equations { grid-template-columns: 1fr; }
243 .equations > div + div { margin-top: 1.5rem; }
246.equations h3 {
247 font-weight: 500;
248 font-size: 1.05rem;
249 margin: 1.5rem 0 0.25rem;
252button.link {
253 border: none;
254 padding: 0.3rem 0;
255 text-decoration: underline;
256 text-underline-offset: 3px;
259button.link:hover { background: none; color: var(--accent); opacity: 0.8; }
261.exercise {
262 text-align: left;
263 margin: 2rem 0 0;
264 padding: 1rem 1.25rem;
265 border-left: 3px solid var(--accent);
266 line-height: 1.6;
269.exercise h3 {
270 font-weight: 500;
271 font-size: 1.05rem;
272 margin: 0 0 0.25rem;
275.defs {
276 list-style: none;
277 padding: 0;
278 margin: 0;
281.defs li { margin: 0.35rem 0; }
↑↓ move↵openescclose