/* My Atlas – motion and glass (next_steps 191). Tokens, the glass window, and the quiet effects of the dark design.
   The movement itself is in motion.js; with html[data-motion="off"] (or the system's "reduce motion") nothing moves. */
:root {
  --app-ease-out: cubic-bezier(.2, .8, .2, 1);
  --app-ease-io: cubic-bezier(.65, 0, .35, 1);
  --app-ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --app-dur-1: 160ms; --app-dur-2: 320ms; --app-dur-3: 520ms;
  --app-glass-blur: 18px; --app-glass-alpha: 62%;
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) .app-press:active { transform: none; } }

/* glass window: see-through, blurred and a little more saturated behind, a thin light rim and a soft sheen on top;
   without backdrop-filter the plain modal background stays */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .app-glass {
    background: color-mix(in srgb, var(--m-card-solid) var(--app-glass-alpha), transparent) !important;
    -webkit-backdrop-filter: blur(var(--app-glass-blur)) saturate(160%); backdrop-filter: blur(var(--app-glass-blur)) saturate(160%);
    border: 1px solid rgba(var(--m-ink), .14);
    box-shadow: 0 40px 100px -20px rgba(var(--m-shade), calc(.9 * var(--m-sk))), inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 0 0 1px rgba(255, 255, 255, .03);
    position: relative;
  }
  .app-glass::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 38%);
  }
}

/* a window moved by its head (motion.js drag()): while it moves, the dim and blur behind it go away and the window
   itself gets thin and less glossy, so what is under it shows through */
@property --app-glass-alpha { syntax: '<percentage>'; inherits: true; initial-value: 62%; }
@property --app-glass-blur { syntax: '<length>'; inherits: true; initial-value: 18px; }
.app-drag-handle { cursor: grab; touch-action: none; user-select: none; }
.m-modal-box.is-dragging .app-drag-handle, .app-bug-panel.is-dragging .app-drag-handle { cursor: grabbing; }
.m-modal.is-open.app-drag-host { transition: opacity .2s, visibility 0s, background-color var(--app-dur-2) var(--app-ease-out), -webkit-backdrop-filter var(--app-dur-2) var(--app-ease-out), backdrop-filter var(--app-dur-2) var(--app-ease-out); }
.m-modal.is-open.is-dragging { background-color: transparent; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
.m-modal-box, .app-bug-panel { transition: transform .42s var(--m-spring), opacity var(--app-dur-2) var(--app-ease-out), box-shadow var(--app-dur-2) var(--app-ease-out), --app-glass-alpha var(--app-dur-2) var(--app-ease-out), --app-glass-blur var(--app-dur-2) var(--app-ease-out); }
/* the report window (report.js) is a glass window of its own, outside a modal: it goes thin the same way */
.m-modal-box.is-dragging, .app-bug-panel.is-dragging { --app-glass-alpha: 28%; --app-glass-blur: 3px; box-shadow: 0 12px 32px -12px rgba(var(--m-shade), calc(.6 * var(--m-sk))) !important; }
.m-modal-box.is-dragging:not(.app-glass), .app-bug-panel.is-dragging:not(.app-glass) { opacity: .82; }
.app-glass::before { transition: opacity var(--app-dur-2) var(--app-ease-out); }
.m-modal-box.is-dragging.app-glass::before, .app-bug-panel.is-dragging.app-glass::before { opacity: 0; }

/* a card that follows the pointer with a faint light (motion.js glow() sets --mx, --my) */
.app-glow { position: relative; isolation: isolate; }
.app-glow::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity var(--app-dur-2) var(--app-ease-out); z-index: -1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--m-accent-rgb), .10), transparent 60%);
}
.app-glow:hover::after { opacity: 1; }

/* a 1px glowing rim (the highlighted card) and an inner rim instead of a deep shadow */
.app-rim { position: relative; }
.app-rim::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(var(--m-accent-rgb), .75), rgba(var(--m-accent-rgb), .05) 40%, rgba(255, 255, 255, .06) 70%, rgba(var(--m-accent-rgb), .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.app-inrim { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px rgba(var(--m-ink), .06); }

/* loading: a slow shimmer on the placeholder */
.app-skel { border-radius: 8px; background: linear-gradient(90deg, rgba(var(--m-ink), .05) 0 40%, rgba(var(--m-ink), .11) 50%, rgba(var(--m-ink), .05) 60% 100%) 0 0 / 300% 100%; animation: app-skel 1.6s linear infinite; }
@keyframes app-skel { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* a small light on the selected item */
.app-spot { position: relative; }
.app-spot::after { content: ''; position: absolute; left: -10px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: var(--m-accent); box-shadow: 0 0 6px 1px rgba(var(--m-accent-rgb), .7); }

/* numbers that keep their width while they count */
.app-tnum { font-variant-numeric: tabular-nums; }

/* a button pressed in */
.app-press { transition: transform var(--app-dur-1) var(--app-ease-out); }
.app-press:active { transform: scale(.96); }

/* view change (View Transitions API): a short cross-fade with a small rise */
::view-transition-old(root) { animation: app-vt-out var(--app-dur-1) var(--app-ease-out) both; }
::view-transition-new(root) { animation: app-vt-in var(--app-dur-2) var(--app-ease-out) both; }
@keyframes app-vt-out { to { opacity: 0; } }
@keyframes app-vt-in { from { opacity: 0; transform: translateY(6px); } }

/* every table's rows on hover (191/2a): an accent stripe on the left, the flag lifts a little, and a faint light
   follows the pointer (motion.js sets --mx); a selected row keeps its own light */
.m-table:not(.lab-tt) tbody tr td:first-child { transition: box-shadow var(--app-dur-2) var(--app-ease-out); }
.m-table:not(.lab-tt) tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--m-accent); }
.m-table:not(.lab-tt) tbody .app-flag { transition: transform var(--app-dur-2) var(--app-ease-spring); }
.m-table:not(.lab-tt) tbody tr:hover .app-flag { transform: translateY(-2px) scale(1.18); }
.m-table:not(.lab-tt) tbody tr:not(.is-sel):hover { background: radial-gradient(260px circle at var(--mx, 50%) 50%, rgba(var(--m-accent-rgb), .12), transparent 70%); }
html[data-motion="off"] .m-table tbody tr:hover .app-flag { transform: none; }
/* the copies of the rows that went (motion.js ghost()), over everything, on the card's own background */
.bmap-pin { transform-box: fill-box; transform-origin: center; }
.app-ghost { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.app-ghost tr { background: var(--m-card-solid); }

/* a chart's title replays its motion when clicked (C0130) */
html:not([data-motion="off"]) .app-replay { cursor: pointer; }
html:not([data-motion="off"]) .app-replay:hover { color: var(--m-accent); }

/* a tile with a back side (C0125): one side shown at a time, both in the same place */
.app-flip { cursor: pointer; display: grid; }
.app-flip > .m-stat { grid-area: 1 / 1; }
.app-flip > .app-flip-back, .app-flip.is-flip > .app-flip-front { visibility: hidden; }
.app-flip.is-flip > .app-flip-back { visibility: visible; }
.app-flip.is-flip { box-shadow: inset 0 0 0 1px rgba(var(--m-accent-rgb), .35); }
.app-flip:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--m-ring); }

/* 191/2c odometer: each digit a window over a strip of 0–9 twice (motion.js odo) */
.app-odo { font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-odo-c { display: inline-block; height: 1em; line-height: 1; overflow: hidden; vertical-align: baseline; }
.app-odo-c > span { display: flex; flex-direction: column; }
.app-odo-c > span > span { height: 1em; }
/* 191/2c shine: a light runs over the text once (motion.js shine) */
.app-shine { background: linear-gradient(100deg, var(--m-text) 0 40%, var(--m-accent) 47%, #fff 50%, var(--m-accent) 53%, var(--m-text) 60% 100%) 100% 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="light"] .app-shine, [data-theme="beige"] .app-shine { background-image: linear-gradient(100deg, var(--m-text) 0 40%, var(--m-accent) 50%, var(--m-text) 60% 100%); }
/* 191/2c radar pulse: rings widen around the place of the trip going on now */
.app-lay-now { pointer-events: none; }
.app-now-dot { fill: var(--m-accent); stroke: var(--m-card-solid); stroke-width: 1.2; vector-effect: non-scaling-stroke; pointer-events: auto; }
.app-now-ring { fill: none; stroke: var(--m-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: app-pulse 2.4s cubic-bezier(.2,.7,.3,1) infinite; }
.app-now-ring + .app-now-ring { animation-delay: 1.2s; }
@keyframes app-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(6); opacity: 0; } }
html[data-motion="off"] .app-now-ring { display: none; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) .app-now-ring { animation-duration: 4s; } }

/* 191/2c sparks from a badge just earned (motion.js sparks) */
.app-cel-lv { position: relative; }
.app-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 2; }
.app-sparks > i { position: absolute; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #F6D77A; box-shadow: 0 0 6px rgba(246, 215, 122, .8); opacity: 0; }
.app-sparks > i:nth-child(odd) { background: var(--m-accent); box-shadow: 0 0 6px rgba(var(--m-accent-rgb), .8); }
/* 191/2c a badge tilting towards the pointer, its light moving with it (motion.js tilt) */
.app-tilt { transform: perspective(320px) rotateX(var(--app-rx, 0deg)) rotateY(var(--app-ry, 0deg)); transition: transform .3s var(--app-ease-out); }
.app-tilt.is-tilt { transition-duration: .08s; }
.app-tilt::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--app-sx, 50%) var(--app-sy, 30%), rgba(255, 255, 255, .4), transparent 55%); }
.app-tilt.is-tilt::after { opacity: 1; }
html[data-motion="off"] .app-tilt { transform: none; }
html[data-motion="off"] .app-tilt::after { display: none; }

/* C0136, C0139, C0161: a flight glows softly while it is drawn, a small plane at its head (motion.js fly) */
.app-lay-flight.is-drawing { stroke: #6ea8fe; opacity: 1; filter: drop-shadow(0 0 1.5px rgba(61, 139, 253, .7)); }
.app-fly-head { fill: #e7f1ff; stroke: #3d8bfd; stroke-width: .35; pointer-events: none; filter: drop-shadow(0 0 2px rgba(61, 139, 253, .95)); }
