/* BMS interface polish, shared by the Desk and the website: raised cards, the page-change motion (keyframes and the reduced-motion switch), the number
   cards' figures, and the line icons. Loaded after bms_theme.css (hooks.py: app_include_css and web_include_css), so it reads that file's palette tokens.

   Motion: a page change is a View Transition (the browser's own mechanism). The old page fades out while it slides down 8px, the new one fades in while it
   slides up from 8px, in 180ms (under 200ms). The Desk starts the transition from bms_desk.js; the website opts in with @view-transition in bms_web.css.
   Reduced motion: no transition at all (the rules below, and the scripts, check prefers-reduced-motion). */

:root {
	--bms-radius: 10px;   /* every raised surface uses this one radius: Frappe 16's own --border-radius-md, so the cards sit with the rest of the Desk */
	--bms-shadow-raised: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
	--bms-shadow-raised-hover: 0 2px 6px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.06);
	--bms-accent-on-navy: #3fbfa8;   /* the brighter teal, for icons on the navy sidebar (6.5:1; the dark brand colour on navy) */
}
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		--bms-shadow-raised: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
		--bms-shadow-raised-hover: 0 2px 6px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	}
}
html[data-theme="dark"] {
	--bms-shadow-raised: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
	--bms-shadow-raised-hover: 0 2px 6px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}


/* ===== 1. Page-change motion ======================================================================================== */

@keyframes bms-vt-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
@keyframes bms-vt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* the strip the slide uncovers takes the page colour, not black */
::view-transition { background-color: var(--bms-bg); }
::view-transition-group(root) { animation-duration: 180ms; }
::view-transition-old(root) { animation: bms-vt-out 180ms cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: bms-vt-in 180ms cubic-bezier(0, 0, 0.2, 1) both; }

/* what stays put (the Desk's sidebar while the script runs a transition) is its own layer, shown once, so it does not slide or fade with the page */
html.bms-vt .body-sidebar { view-transition-name: bms-sidebar; }
::view-transition-group(bms-sidebar), ::view-transition-group(bms-navbar) { animation-duration: 0s; }
::view-transition-old(bms-sidebar), ::view-transition-old(bms-navbar) { display: none; }
::view-transition-new(bms-sidebar), ::view-transition-new(bms-navbar) { animation: none; }

@media (prefers-reduced-motion: reduce) {
	::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
	.widget.number-widget-box, .widget.dashboard-widget-box, .widget.quick-list-widget-box, .frappe-list .result, .report-wrapper .datatable, .bms-portal .card, .bms-portal .table-responsive { transition: none !important; }
}


/* ===== 2. Raised surfaces (Desk) ====================================================================================
   List and report views and the workspace's cards read as raised surfaces: the palette's card colour, its border, one radius, one soft shadow. */

.widget.number-widget-box,
.widget.dashboard-widget-box,
.widget.quick-list-widget-box,
.frappe-list .result,
.report-wrapper .datatable {
	background-color: var(--bms-surface);
	border: 1px solid var(--bms-border);
	border-radius: var(--bms-radius);
	box-shadow: var(--bms-shadow-raised);
}
.frappe-list .result { overflow: clip; }   /* clips the header row to the radius without making a scroll container (a sticky header keeps working) */

@media (prefers-reduced-motion: no-preference) {
	.widget.number-widget-box, .widget.dashboard-widget-box, .widget.quick-list-widget-box { transition: box-shadow 150ms ease; }
	.widget.number-widget-box:hover, .widget.dashboard-widget-box:hover { box-shadow: var(--bms-shadow-raised-hover); }
}

/* figures keep their width while they count up */
.number-widget-box .widget-content > .number { font-variant-numeric: tabular-nums; }


/* ===== 3. Line icons (building, floor, unit, wallet, keys) =========================================================
   In the Desk they are a sprite (bms/public/icons/bms_icons.svg, hooks.py app_include_icons) used as icon names "bms-building" and so on, coloured below.
   Elsewhere (the portal) a span takes the same drawing as a mask, so it follows the palette: <span class="bms-icon bms-icon-wallet" aria-hidden="true"></span>. */

.bms-icon {
	display: inline-block;
	flex: none;
	width: 1.15em;
	height: 1.15em;
	vertical-align: -0.2em;
	margin-inline-end: 0.4em;
	background-color: var(--bms-primary);
	-webkit-mask: var(--bms-icon) center / contain no-repeat;
	mask: var(--bms-icon) center / contain no-repeat;
}
.bms-icon-building { --bms-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M6%2021V4.5A1.5%201.5%200%200%201%207.5%203h9A1.5%201.5%200%200%201%2018%204.5V21'/%3E%3Cpath%20d='M3%2021h18'/%3E%3Cpath%20d='M9.5%207h1'/%3E%3Cpath%20d='M13.5%207h1'/%3E%3Cpath%20d='M9.5%2011h1'/%3E%3Cpath%20d='M13.5%2011h1'/%3E%3Cpath%20d='M9.5%2015h1'/%3E%3Cpath%20d='M13.5%2015h1'/%3E%3Cpath%20d='M10.5%2021v-3.5h3V21'/%3E%3C/svg%3E"); }
.bms-icon-floor { --bms-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%203.5%203%208.5l9%205%209-5-9-5Z'/%3E%3Cpath%20d='M3%2012.5l9%205%209-5'/%3E%3Cpath%20d='M3%2016.5l9%205%209-5'/%3E%3C/svg%3E"); }
.bms-icon-unit { --bms-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M3%2011%2012%204l9%207'/%3E%3Cpath%20d='M5%209.5V20a1%201%200%200%200%201%201h12a1%201%200%200%200%201-1V9.5'/%3E%3Cpath%20d='M10%2021v-6h4v6'/%3E%3Cpath%20d='M8%2012h1.5'/%3E%3Cpath%20d='M14.5%2012H16'/%3E%3C/svg%3E"); }
.bms-icon-wallet { --bms-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M4%207.5A2.5%202.5%200%200%201%206.5%205H18v3'/%3E%3Cpath%20d='M4%207.5V18a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2v-7a2%202%200%200%200-2-2H6.5A2.5%202.5%200%200%201%204%207.5Z'/%3E%3Cpath%20d='M16%2014.5h.5'/%3E%3C/svg%3E"); }
.bms-icon-keys { --bms-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10.5%2013.5%2019%205'/%3E%3Cpath%20d='M16.5%207.5%2019%2010'/%3E%3Cpath%20d='M14%2010l2.5%202.5'/%3E%3Cpath%20d='M8%2021a4.5%204.5%200%201%201%200-9%204.5%204.5%200%200%201%200%209Z'/%3E%3C/svg%3E"); }

/* the sprite's symbols do not pin a colour (a stroke set on a <symbol> would override the one set here), so the colour comes from the page: the text colour
   by default, the bright teal on the navy sidebar */
svg:has(use[href^="#icon-bms-"]) { stroke: currentColor; stroke-width: 1.5; }
.body-sidebar svg:has(use[href^="#icon-bms-"]) { stroke: var(--bms-accent-on-navy); }
