/* Motion layer: CSS transitions and a few keyframes, loaded after app.css.
   Timing: 120 ms for presses, 180 ms for hovers, 260-300 ms for things arriving. Everything is switched off for
   prefers-reduced-motion and for ?motion=off (html[data-motion="off"]). */
:root { --ease-out: cubic-bezier(.2, .8, .2, 1); --t-press: 120ms; --t-hover: 180ms; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Days: soft hover lift, pressed squash, selected day pops once. */
.day { transition: background-color var(--t-hover) var(--ease-out), color var(--t-hover), box-shadow var(--t-hover), transform var(--t-press) var(--ease-out); }
@media (hover: hover) {
  .day.open:hover { transform: scale(1.07); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
  .day.sel:hover { transform: none; box-shadow: none; }
}
.day.open:active { transform: scale(.9); transition-duration: 60ms; }
.day.pop { animation: day-pop 340ms var(--ease-out); }
@keyframes day-pop { 0% { transform: scale(.82); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
.cal { position: relative; } /* tweak 1: holds the outgoing month grid while it slides away */
.nav { transition: background-color var(--t-hover), transform var(--t-press) var(--ease-out); }
.nav:hover:not(:disabled) { background: var(--accent-t2); }

/* Time slots: no more border-width jump on hover (today it goes 1px -> 2px and the text shifts). */
.slot { transition: box-shadow var(--t-hover) var(--ease-out), background-color var(--t-hover), color var(--t-hover), transform var(--t-press) var(--ease-out); }
.slot:hover { border: 1px solid var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 3px 10px color-mix(in srgb, var(--accent) 16%, transparent); }
.slot:active { transform: scale(.97); transition-duration: 60ms; }
/* Selected slot: the chosen time turns grey and "Next" wipes in beside it. */
.slot-pair .slot.chosen { animation: chosen-in 260ms var(--ease-out) both; }
.slot-pair .slot.next { animation: next-in 320ms 40ms var(--ease-out) both; }
.slot.next:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
@keyframes chosen-in { from { background: var(--card); color: var(--accent-ink); border-color: var(--accent); } }
@keyframes next-in { from { opacity: 0; transform: translateX(-14px); clip-path: inset(0 100% 0 0 round 8px); } to { clip-path: inset(0 0 0 0 round 8px); } }

/* Buttons: hover glow, pressed state, busy state that keeps its size. */
.primary, .ghost, .back, .link, .tz-btn, .theme-btn, .icon { transition: background-color var(--t-hover), color var(--t-hover), box-shadow var(--t-hover), transform var(--t-press) var(--ease-out); }
.primary:hover:not(:disabled) { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.primary:active:not(:disabled), .ghost:active, .back:active, .nav:active:not(:disabled), .icon:active, .tz-btn:active { transform: scale(.96); transition-duration: 60ms; }
.primary.busy, .primary.busy:disabled { opacity: 1; cursor: progress; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.form input, .form textarea { transition: border-color var(--t-hover), outline-color var(--t-hover), box-shadow var(--t-hover); }
.form input:focus, .form textarea:focus { box-shadow: 0 0 0 4px var(--accent-t); }
.err:not([hidden]), .form-err:not([hidden]) { animation: err-in 220ms var(--ease-out); }
@keyframes err-in { from { opacity: 0; transform: translateY(-4px); } }

/* Loading: a quiet skeleton of the calendar instead of an empty card. */
.skel { display: grid; gap: 20px; max-width: 430px; padding-top: 6px; }
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--line) 0 40%, color-mix(in srgb, var(--line) 35%, var(--card)) 50%, var(--line) 60% 100%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.sk-title { height: 22px; width: 62%; } .sk-month { height: 18px; width: 40%; margin: 4px auto 0; }
.sk-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 10px; justify-items: center; }
.sk-day { width: 40px; height: 40px; border-radius: 50%; opacity: .7; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Confirmation: the tick pops and draws itself. */
.tick { animation: tick-pop 420ms var(--ease-out) both; }
.tick path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: tick-draw 380ms 220ms var(--ease-out) forwards; }
@keyframes tick-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }

/* Time-zone sheet slides up on phones, drops in on desktop. */
.tz-pop:not([hidden]) .tz-panel { animation: sheet-in 240ms var(--ease-out); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 760px) { @keyframes sheet-in { from { transform: translateY(100%); } } }

/* Reduced motion: everything lands instantly (colour changes stay, movement goes). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .day.open:hover { transform: none; } .sk { animation: none; }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
html[data-motion="off"] .day.open:hover { transform: none; } html[data-motion="off"] .sk { animation: none; }

/* Tweak 2: the sliding views and month grids move 12-28 px sideways. Without a clip that made the page briefly wider than a
   phone screen, so the browser resized the whole page for a few frames (the flash at the bottom). Clip sideways overflow only;
   nothing scrolls sideways. The footer also sits at the foot of the screen when the content is short, so changing step or
   month no longer moves it. */
.page { overflow-x: clip; flex: 1 0 auto; }
body.booking { min-height: 100vh; min-height: 100dvh; }
