:root { --nav-surface: #1b2d50f2; --nav-ink: #f4f7ff; }
html[data-theme="day"] { --nav-surface: #edf3fbf2; --nav-ink: #172e48; }
.site-header { position: fixed; box-sizing: border-box; top: 0; width: 100%; z-index: 20; justify-content: space-between; gap: 22px; padding-top: 20px; padding-bottom: 20px; border-bottom: 1px solid transparent; color: var(--nav-ink); transition: background-color .3s ease, border-color .3s ease, padding .3s ease; }
.nav-scrolled .site-header { padding-top: 8px; padding-bottom: 8px; background: var(--nav-surface); border-bottom-color: var(--section-rule); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.primary-nav { display: flex; align-items: center; gap: clamp(14px, 2.3vw, 34px); min-width: 0; }
.primary-nav a { display: flex; align-items: center; min-height: 44px; box-sizing: border-box; border-bottom: 1px solid transparent; color: inherit; font-size: 13px; text-decoration: none; line-height: 1.3; }
.primary-nav a:hover { opacity: .7; }
.primary-nav a[aria-current="location"] { border-bottom-color: currentColor; }
.primary-nav a:focus-visible { outline: 2px solid var(--section-accent); outline-offset: 4px; border-radius: 2px; }
.scene-controls { flex-shrink: 0; }
#work, #approach, #about, #contact { scroll-margin-top: 84px; }

/* In the compact experience each picture sits beside its own explanation. */
.story-pinned { grid-template-columns: 1fr; }
.story-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; padding-left: 0; }
.story-steps li { min-width: 0; margin-bottom: 0; }
.story-steps::before, .story-steps::after, .story-steps li::before { display: none; }
.story-anchor { position: static; display: block; height: 0; scroll-margin-top: 90px; }
.story-stage { display: none; }
.story-static-note { color: var(--section-muted); font-size: 10px; margin: 18px 0 0; }
.story-steps .story-panel { min-height: 0; padding: 18px; margin-top: 18px; }
.story-steps .diagram-top, .story-steps .scan-list, .story-steps .doc-section, .story-steps .review-sheets { display: none; }
.story-steps .site-map { margin: 0 auto; }
.story-steps .document-study { padding: 0; }
.story-steps .doc-title { font-size: 26px; margin: 9px 0 12px; }
.story-steps .doc-added { font-size: 9px; padding-top: 12px; }
.story-steps .review-loop { margin: 0 0 15px; gap: 5px; }
.story-steps .review-loop > span { padding: 6px 4px; font-size: 9px; }
.story-steps .review-question { margin: 0; font-size: 13px; }
.story-enhanced .story-pinned { grid-template-columns: 1fr 1fr; }
.story-enhanced .story-steps { display: block; padding-left: 24px; }
.story-enhanced .story-steps li { margin-bottom: 24px; }
.story-enhanced .story-steps li:last-child { margin-bottom: 0; }
.story-enhanced .story-steps::before, .story-enhanced .story-steps::after, .story-enhanced .story-steps li::before { display: block; }
.story-enhanced .story-anchor { position: absolute; scroll-margin-top: 12svh; }
.story-enhanced .story-stage { display: block; }
.story-enhanced .story-static-note { display: none; }

/* Sparse, distant movement in the sky; no added bitmap downloads. */
.sky-details { position: absolute; inset: 0 auto auto 0; width: 100%; height: auto; aspect-ratio: 1487 / 1058; pointer-events: none; transition: opacity 1s ease; }
.night-sky { opacity: 1; }
.sky-star { fill: #e5edff; opacity: .4; animation: sky-twinkle var(--twinkle-time) ease-in-out var(--twinkle-delay) infinite; }
.meteor { opacity: 0; transform-box: view-box; animation: meteor-pass 6s linear var(--meteor-delay) infinite; }
@keyframes meteor-pass {
  0% { opacity: 0; transform: translate(var(--meteor-x), var(--meteor-y)); }
  2% { opacity: .7; }
  12%, 100% { opacity: 0; transform: translate(calc(var(--meteor-x) - 110px), calc(var(--meteor-y) + 72px)); }
}
html[data-theme="day"] .night-sky { opacity: 0; }
html[data-theme="day"] .sky-star { animation-play-state: paused; }
html[data-theme="day"] .meteor { animation-play-state: paused; }
.day-birds { opacity: 0; }
html[data-theme="day"] .day-birds { opacity: 1; }
.distant-flock { opacity: 0; transform-box: view-box; animation: distant-flight 55s linear -13s infinite; }
.bird-wing { transform-box: fill-box; transform-origin: center; animation: wing-glide 1.7s ease-in-out infinite alternate; }
html[data-theme="evening"] .distant-flock, html[data-theme="evening"] .bird-wing { animation-play-state: paused; }
.is-resting .sky-star, .is-resting .distant-flock, .is-resting .bird-wing, .is-resting .fog-drift, .is-resting .screen-cursor { animation-play-state: paused !important; }
.is-resting .meteor { animation-play-state: paused !important; }
@keyframes sky-twinkle { 0%, 65%, 100% { opacity: .15; } 30% { opacity: .82; } }
@keyframes distant-flight {
  0%, 12% { opacity: 0; transform: translate(860px, 135px); }
  18%, 72% { opacity: .48; }
  82%, 100% { opacity: 0; transform: translate(1180px, 100px); }
}
@keyframes wing-glide { from { transform: scaleY(.55); } to { transform: scaleY(1.05); } }
@media (max-width: 899px) {
  .story-steps { gap: 20px; }
  .story-steps .story-panel { padding: 14px; }
  .story-steps .map-branches { gap: 6px; }
  .story-steps .map-branches > span { font-size: 9px; padding-left: 2px; padding-right: 2px; }
}
@media (max-width: 650px) {
  .site-header { padding: 10px 6%; gap: 10px; }
  .primary-nav { gap: clamp(9px, 3vw, 16px); }
  .primary-nav a { font-size: 11px; }
  .scene-controls button { font-size: 10px; padding-left: 8px; padding-right: 8px; min-height: 36px; }
  .hero-role { max-width: 340px; }
  .hero-summary { max-width: 290px; font-size: 15px; }
  .sky-details { width: 1100px; left: calc(50% - 730px); top: 160px; }
  .story-steps { grid-template-columns: 1fr; gap: 27px; margin-top: 27px; }
  .story-steps li { padding-bottom: 25px; border-bottom: 1px solid var(--section-rule); }
  .story-steps li:last-child { padding-bottom: 0; border-bottom: 0; }
  .story-steps p { max-width: 48ch; }
  .story-steps .story-panel { margin-top: 14px; padding: 17px; }
  .story-steps .site-map { max-width: 260px; }
  .story-steps .document-study { max-width: 285px; }
  .story-steps .review-loop { max-width: 285px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sky-star { animation: none; opacity: .3; }
  .meteor { display: none; }
  .day-birds { display: none; }
  .site-header { transition: none; }
}
@media print {
  .site-header, .sky-details { display: none; }
  .story-enhanced .story-runway { height: auto; min-height: 0; }
  .story-enhanced .story-pinned { position: static; }
}
