/*
 * Fluid motion for the website, matching the app: quick spring-like movement that never gets in the way.
 * Everything here is progressive: browsers without these features simply show the page as before, and visitors who
 * ask for less motion get no movement at all (see the end of this file).
 */
:root {
	/* Spring curves (CSS linear() approximations of the app's Reanimated springs). */
	--b27-spring-snappy: linear(0, 0.21 6%, 0.66 16%, 0.94 26%, 1.04 34%, 1.03 42%, 1 54%, 1);
	--b27-spring-settle: linear(0, 0.13 8%, 0.47 20%, 0.78 34%, 0.94 48%, 0.99 62%, 1);
	--b27-spring-bouncy: linear(0, 0.36 10%, 0.94 22%, 1.12 30%, 1.07 40%, 0.98 52%, 1.01 66%, 1);
	--b27-motion-fast: 180ms;
	--b27-motion-content: 280ms;
	--b27-motion-page: 340ms;
}

/* Page transitions between pages of the site (programme → session → speaker…): the new page slides in over the
   old one, which recedes slightly. Header and navigation stay put. */
@view-transition { navigation: auto; }
.b27-site-header { view-transition-name: b27-header; }
::view-transition-old(root) { animation: b27-page-out var(--b27-motion-page) var(--b27-spring-settle) both; }
::view-transition-new(root) { animation: b27-page-in var(--b27-motion-page) var(--b27-spring-settle) both; }
@keyframes b27-page-out { to { opacity: 0; transform: translateX(-3%); } }
@keyframes b27-page-in { from { opacity: 0; transform: translateX(6%); } }
/* Going back reverses the direction. */
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: b27-page-out-back; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: b27-page-in-back; }
@keyframes b27-page-out-back { to { opacity: 0; transform: translateX(3%); } }
@keyframes b27-page-in-back { from { opacity: 0; transform: translateX(-6%); } }

/* Press feedback: buttons, chips and session cards sink slightly under the finger and spring back. */
.b27-button,
.b27-filter-chip,
.b27-track__button,
.b27-control-link,
.b27-register-link,
.b27-newsletter-page__button,
.b27-session__open,
.b27-session,
.b27-my-breathe-session,
.b27-faculty-row,
.scan__button,
.b27-press {
	transition: transform var(--b27-motion-fast) var(--b27-spring-snappy), box-shadow var(--b27-motion-fast) ease, background-color var(--b27-motion-fast) ease;
	-webkit-tap-highlight-color: transparent;
}
.b27-button:active,
.b27-filter-chip:active,
.b27-track__button:active,
.b27-control-link:active,
.b27-register-link:active,
.b27-newsletter-page__button:active,
.b27-session__open:active,
.scan__button:active,
.b27-press:active { transform: scale(0.97); }
.b27-session:active,
.b27-my-breathe-session:active,
.b27-faculty-row:active { transform: scale(0.99); }

/* Content that arrives after the page opens fades up into place (added by motion.js). */
.b27-arrive { animation: b27-arrive var(--b27-motion-content) var(--b27-spring-settle) both; }
@keyframes b27-arrive { from { opacity: 0; transform: translateY(8px); } }

/* Loading placeholders: cards in the shape of the content, breathing slowly. */
.b27-skeleton { display: grid; gap: 12px; margin-block: 8px; }
.b27-skeleton__card { display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.08); }
.b27-skeleton__line { height: 14px; border-radius: 7px; background: #e4e1d8; animation: b27-breathe 1.8s ease-in-out infinite alternate; }
.b27-skeleton__line--title { height: 18px; width: 86%; }
.b27-skeleton__line--eyebrow { height: 12px; width: 38%; }
.b27-skeleton__line--short { width: 52%; }
@keyframes b27-breathe { to { opacity: 0.45; } }

/* A small celebration when something becomes true (saved, voted). */
.b27-celebrate { animation: b27-celebrate 520ms var(--b27-spring-bouncy); }
@keyframes b27-celebrate { 40% { transform: scale(1.06); } }

/* Phone bottom sheet (motion.js adds .b27-sheet only on narrow screens; without it the fields stay inline). */
.b27-sheet-toggle {
	display: inline-flex; align-items: center; gap: .5rem; min-block-size: 48px; padding: .7rem 1.1rem;
	border: 1px solid var(--b27-ink, #102033); border-radius: 999px; background: var(--b27-paper, #fbf8f1); color: var(--b27-ink, #102033);
	font: inherit; font-weight: 600; cursor: pointer;
	transition: transform var(--b27-motion-fast) var(--b27-spring-snappy);
	-webkit-tap-highlight-color: transparent;
}
.b27-sheet-toggle:active { transform: scale(0.97); }
.b27-sheet-toggle[hidden] { display: none; }
.b27-sheet-toggle__count {
	display: inline-grid; place-items: center; min-inline-size: 1.5rem; block-size: 1.5rem; padding-inline: .35rem;
	border-radius: 999px; background: var(--b27-ink, #102033); color: var(--b27-paper, #fbf8f1); font-size: .8rem;
}
.b27-sheet-toggle__count[hidden] { display: none; }
.b27-sheet__grabber { display: none; }
.b27-sheet__done[hidden] { display: none; }
.b27-sheet {
	position: fixed; inset: auto 0 0 0; z-index: 210; display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 1rem;
	max-block-size: 85svh; overflow-y: auto; overscroll-behavior: contain;
	padding: .75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
	border-radius: 28px 28px 0 0; border-block-start: 1px solid color-mix(in srgb, currentColor 16%, transparent); background: var(--b27-paper, #fbf8f1); color: var(--b27-ink, #102033);
	box-shadow: 0 -12px 40px rgba(16, 32, 51, 0.22);
	transform: translateY(105%); visibility: hidden;
	transition: transform var(--b27-motion-page) var(--b27-spring-settle), visibility 0s linear var(--b27-motion-page);
}
.b27-sheet[data-open] { transform: translateY(var(--b27-sheet-drag, 0px)); visibility: visible; transition: transform var(--b27-motion-page) var(--b27-spring-settle), visibility 0s; }
.b27-sheet[data-dragging] { transition: none; }
.b27-sheet .b27-sheet__grabber { display: block; justify-self: center; inline-size: 40px; block-size: 5px; margin-block-end: .25rem; border-radius: 3px; background: color-mix(in srgb, currentColor 35%, transparent); touch-action: none; cursor: grab; }
.b27-sheet .b27-sheet__grabber::before { content: ""; display: block; margin: -16px -40px; block-size: 37px; }
.b27-sheet .b27-sheet__done {
	min-block-size: 52px; border: 0; border-radius: 999px; background: var(--b27-ink, #102033); color: var(--b27-paper, #fbf8f1);
	font: inherit; font-weight: 700; cursor: pointer;
}
.b27-sheet-backdrop {
	position: fixed; inset: 0; z-index: 205; background: rgba(16, 32, 51, 0.38); opacity: 0;
	transition: opacity var(--b27-motion-content) ease;
}
.b27-sheet-backdrop[data-open] { opacity: 1; }
html.b27-sheet-locked { overflow: hidden; }

/* Less motion, same site. */
@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }
	.b27-button, .b27-filter-chip, .b27-track__button, .b27-control-link, .b27-register-link, .b27-newsletter-page__button,
	.b27-session__open, .b27-session, .b27-my-breathe-session, .b27-faculty-row, .scan__button, .b27-press { transition: none; }
	.b27-button:active, .b27-filter-chip:active, .b27-track__button:active, .b27-control-link:active, .b27-register-link:active,
	.b27-newsletter-page__button:active, .b27-session__open:active, .scan__button:active, .b27-press:active,
	.b27-session:active, .b27-my-breathe-session:active, .b27-faculty-row:active { transform: none; }
	.b27-arrive, .b27-celebrate { animation: none; }
	.b27-skeleton__line { animation: none; }
	.b27-sheet-toggle, .b27-sheet, .b27-sheet[data-open], .b27-sheet-backdrop { transition: none; }
	.b27-sheet-toggle:active { transform: none; }
}
