/*
 * EPR Collective theme foundation
 *
 * Keep brand decisions in the tokens below. Prefer mapping a token to an
 * existing Frappe semantic variable over styling individual components.
 */

@font-face {
	font-family: "DM Sans";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("/assets/epr_collective/fonts/dm-sans/dm-sans-latin-ext-400-800.woff2")
		format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

@font-face {
	font-family: "DM Sans";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("/assets/epr_collective/fonts/dm-sans/dm-sans-latin-400-800.woff2")
		format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Sora";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("/assets/epr_collective/fonts/sora/sora-latin-ext-400-800.woff2")
		format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

@font-face {
	font-family: "Sora";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("/assets/epr_collective/fonts/sora/sora-latin-400-800.woff2")
		format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	/* Brand typography: change these aliases to replace fonts globally. */
	--epr-font-body: "DM Sans", "Segoe UI", sans-serif;
	--epr-font-heading: "Sora", "DM Sans", "Segoe UI", sans-serif;

	/* Core palette: keep canonical brand values here. */
	--epr-color-primary: #296e9e;
	--epr-color-secondary: #74c0ab;
	--epr-color-dark-background: #084260;

	/* Active Frappe mappings. */
	--font-stack: var(--epr-font-body);
	--primary: var(--epr-color-primary);
	--brand-color: var(--epr-color-primary);
	--primary-color: var(--epr-color-primary);
	--btn-primary: var(--epr-color-primary);
	--border-primary: var(--epr-color-primary);

	/*
	 * Reserved future tokens. Define these when the extended palette and
	 * interaction states are approved instead of scattering colours below.
	 *
	 * --epr-color-primary-hover: ...;
	 * --epr-color-secondary-hover: ...;
	 * --epr-color-focus-ring: ...;
	 * --epr-color-success: ...;
	 * --epr-color-warning: ...;
	 * --epr-color-danger: ...;
	 */
}

[data-theme="dark"] {
	/* Initial dark-theme application; supporting surface tokens can follow. */
	--bg-color: var(--epr-color-dark-background);
	--navbar-bg: var(--epr-color-dark-background);
}

body {
	font-family: var(--epr-font-body);
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.modal-title,
.workspace-title,
.page-card-head h4 {
	font-family: var(--epr-font-heading);
}

/* Login-specific adjustments. Keep structural layout changes in this block. */
#page-login .app-logo {
	object-fit: contain;
}

/*
 * Future component mappings can be added here once their intended use is
 * agreed. Examples: secondary buttons, selected navigation and focus rings.
 */

/* Frappe 16 Desktop welcome and launchpad context. */
.desktop-container.epr-desktop-enhanced {
	width: min(1120px, 100%);
	margin: 0 auto;
	padding: 32px 32px 48px;
	align-items: stretch;
	justify-content: flex-start;
	flex-direction: column;
}

.epr-desktop-enhanced > .icons-container {
	align-self: center;
	margin-top: 4px;
}

.epr-desktop-welcome {
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: 100%;
}

.epr-desktop-hero {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 28px 30px;
	border: 1px solid var(--outline-gray-2);
	border-radius: 20px;
	background:
		linear-gradient(135deg, rgb(41 110 158 / 12%), rgb(116 192 171 / 10%)),
		var(--card-bg);
}

.epr-desktop-logo {
	width: 72px;
	height: 72px;
	object-fit: contain;
	flex: 0 0 auto;
}

.epr-desktop-hero-copy {
	min-width: 0;
}

.epr-desktop-eyebrow {
	margin: 0 0 4px;
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--epr-color-primary);
}

.epr-desktop-hero h1 {
	margin: 0;
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	line-height: 1.2;
	color: var(--text-color);
}

.epr-desktop-introduction {
	max-width: 780px;
	margin: 10px 0 0;
	font-size: var(--text-md);
	line-height: 1.55;
	color: var(--text-muted);
}

.epr-desktop-context {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 4px;
}

.epr-desktop-identity {
	display: flex;
	align-items: baseline;
	gap: 8px;
	color: var(--text-muted);
}

.epr-desktop-identity strong {
	color: var(--text-color);
}

.epr-desktop-environment {
	display: inline-flex;
	align-items: center;
	padding: 6px 10px;
	border-radius: 999px;
	background: rgb(116 192 171 / 18%);
	color: var(--epr-color-dark-background);
	font-size: var(--text-sm);
	font-weight: var(--weight-medium);
}

[data-theme="dark"] .epr-desktop-environment {
	color: var(--epr-color-secondary);
}

.epr-desktop-announcement {
	display: grid;
	grid-template-columns: minmax(120px, auto) 1fr;
	gap: 16px;
	padding: 16px 18px;
	border: 1px solid rgb(41 110 158 / 24%);
	border-radius: 12px;
	background: rgb(41 110 158 / 8%);
	color: var(--text-color);
}

.epr-desktop-resources {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.epr-desktop-resource {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--outline-gray-2);
	border-radius: 12px;
	background: var(--card-bg);
	color: var(--text-color);
	text-decoration: none;
}

.epr-desktop-resource:hover {
	border-color: var(--epr-color-primary);
	color: var(--text-color);
	text-decoration: none;
}

.epr-desktop-resource-icon {
	display: inline-flex;
	color: var(--epr-color-primary);
}

.epr-desktop-resource-copy {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.epr-desktop-resource-copy span {
	color: var(--text-muted);
	font-size: var(--text-sm);
}

.epr-desktop-applications-heading {
	margin: 4px 4px 0;
	font-size: var(--text-lg);
	color: var(--text-color);
}

.epr-desktop-footer {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	width: 100%;
	margin-top: 28px;
	padding: 20px 4px 0;
	border-top: 1px solid var(--outline-gray-2);
	color: var(--text-muted);
	font-size: var(--text-sm);
}

.epr-desktop-footer-copy,
.epr-desktop-footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
}

.epr-desktop-footer-copy {
	flex-direction: column;
}

.epr-desktop-footer-copy span {
	white-space: pre-line;
}

.epr-desktop-footer-link {
	color: var(--epr-color-primary);
	font-weight: var(--weight-medium);
	text-decoration: none;
}

.epr-desktop-footer-link:hover {
	color: var(--epr-color-primary);
	text-decoration: underline;
}

@media screen and (max-width: 700px) {
	.desktop-container.epr-desktop-enhanced {
		padding: 20px 13px 36px;
	}

	.epr-desktop-hero {
		align-items: flex-start;
		padding: 22px 20px;
	}

	.epr-desktop-logo {
		width: 54px;
		height: 54px;
	}

	.epr-desktop-context,
	.epr-desktop-identity {
		align-items: flex-start;
		flex-direction: column;
	}

	.epr-desktop-resources {
		grid-template-columns: 1fr;
	}

	.epr-desktop-announcement {
		grid-template-columns: 1fr;
		gap: 4px;
	}

	.epr-desktop-footer {
		flex-direction: column;
	}
}

@media screen and (max-width: 430px) {
	.epr-desktop-hero {
		flex-direction: column;
	}
}

/* Dashboard page: retain its actions but hide Frappe's cross-dashboard links. */
#page-dashboard-view
	.page-actions
	.menu-btn-group
	.dropdown-menu
	> li:not(.user-action),
#page-dashboard-view
	.page-actions
	.menu-btn-group
	.dropdown-menu
	> li.dropdown-divider {
	display: none !important;
}

/* Comments are independently controlled; the clinical Activity timeline stays visible. */
.epr-comments-disabled .comment-box {
	display: none !important;
}
