/* Bounded miniature scenes. Large cinematic compositions live in portfolio-cinematic.css. */
:root { --scene-ink: #e8eddc; --scene-muted: #a5bcaa; --scene-accent: #d9dc9b; }
.motion-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 12px; background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: .69rem; color: var(--muted); }
.motion-toggle:hover { color: var(--brand); border-color: var(--line); }
.motion-toggle:disabled { cursor: default; opacity: .75; }

/* Bitmap dimensions must never determine layout, including at high device pixel ratios. */
.motion-scene { position: relative; display: block; width: 100%; height: 215px; min-width: 0; max-width: 100%; overflow: hidden; isolation: isolate; contain: size layout paint; background: radial-gradient(ellipse at 45% 28%, #25494477, transparent 68%), linear-gradient(145deg, #132e2c, #091e26); }
.motion-scene::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .24; background-image: radial-gradient(#b7d7c0 .6px, transparent .6px); background-size: 18px 18px; mask-image: linear-gradient(transparent, #0008); }
.motion-scene canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .5s ease; }
.motion-scene.is-ready canvas { opacity: 1; }
.motion-scene .scene-fallback { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: cover; object-position: center; margin: 0; border: 0; border-radius: 0; opacity: .85; transition: opacity .35s; }
.motion-scene.is-ready .scene-fallback { opacity: 0; }
.scene-fallback-symbol { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #b8d8b9; font-size: 3rem; font-family: var(--serif); }
.is-ready .scene-fallback-symbol { display: none; }
.scene-eyebrow { display: block; color: var(--scene-accent); font-size: .61rem; font-weight: 500; letter-spacing: .14em; line-height: 1.5; }
.scene-topline { display: flex; justify-content: space-between; align-items: center; position: absolute; top: 18px; left: 21px; right: 21px; z-index: 2; color: #cee2d3; font-size: .58rem; font-weight: 500; letter-spacing: .13em; line-height: 1.5; }
.scene-spark { font: 1.2rem/1 var(--serif); color: var(--scene-accent); }
.scene-footnote { position: absolute; left: 21px; bottom: 18px; z-index: 2; color: #a9beb3; font-size: .52rem; letter-spacing: .12em; line-height: 1.5; }

/* These small explanatory scenes sit next to the actual tool and source evidence. */
.motion-chapter { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); align-items: stretch; min-height: 250px; margin: 0 0 30px; color: #e5eee0; border: 1px solid #2b4a45; border-radius: 11px; overflow: hidden; background: #102c2b; }
.chapter-copy { position: relative; padding: 28px 34px; background: linear-gradient(110deg, #153b33, #102c2b); }
.chapter-copy h3 { margin: 13px 0 11px; color: #e6eddd; font-size: clamp(1.15rem, 1.9vw, 1.55rem); font-weight: 500; line-height: 1.25; letter-spacing: -.04em; }
.chapter-copy > p { color: #adbfaf; font-size: .75rem; line-height: 1.7; max-width: 340px; margin-bottom: 18px; }
.chapter-flow { display: flex; flex-wrap: wrap; gap: 9px 15px; font-size: .62rem; color: #d2e4bc; }
.chapter-flow span { display: inline-flex; align-items: center; gap: 15px; }
.chapter-flow span:not(:last-child)::after { content: '→'; color: #7ca998; }
.chapter-scene { height: 250px; align-self: center; border-left: 1px solid #718d6c26; }
.chapter-scene .scene-footnote { bottom: 14px; font-size: .49rem; opacity: .8; }
.inset-scene { height: 210px; margin-bottom: 24px; border-radius: 6px; }
.inset-scene .scene-topline { left: 15px; right: 15px; font-size: .5rem; }
.inset-scene .scene-footnote { left: 15px; font-size: .48rem; }
.retrieval-scene { height: 280px; }
html[data-motion="paused"] *, html[data-motion="reduced"] * { animation-play-state: paused !important; }
@media (min-width: 821px) {
  #ml-projects .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #ml-projects .project-card.featured { grid-column: auto; }
}
@media (max-width: 820px) {
  .chapter-copy { padding: 24px; }
  .motion-chapter { grid-template-columns: 1fr 1.12fr; }
  .chapter-scene { height: 245px; }
}
@media (max-width: 640px) {
  .motion-chapter { grid-template-columns: 1fr; margin-bottom: 24px; }
  .chapter-copy { padding: 24px 25px 20px; }
  .chapter-copy h3 { font-size: 1.4rem; }
  .chapter-copy > p { max-width: 100%; font-size: .77rem; }
  .chapter-scene { height: 220px; border-left: 0; border-top: 1px solid #718d6c26; }
}
@media (prefers-reduced-motion: reduce) {
  .motion-scene canvas, .scene-fallback { transition: none; }
}
@media print {
  .motion-chapter, .motion-toggle, .inset-scene, .retrieval-scene { display: none !important; }
}
