/**
 * Kozaru Honbu - Frontend App Shell
 *
 * Version: 1.0.0
 *
 * Theme-neutral compact page mode for Kozaru shortcode/app pages. This module
 * removes common theme page-title wrappers and pulls Kozaru content up under
 * the site header so the plugin behaves like an app inside any WordPress theme.
 */

body.kozaru-frontend-app-page {
	--kozaru-app-ink: var(--kozaru-ink, #111111);
	--kozaru-app-charcoal: var(--kozaru-charcoal, #2b2b2b);
	--kozaru-app-bone: var(--kozaru-bone, #f7f6f2);
	--kozaru-app-paper: var(--kozaru-paper, #ffffff);
	--kozaru-app-crimson: var(--kozaru-crimson, #c62828);
	--kozaru-app-line: var(--kozaru-line, rgba(17, 17, 17, .12));
	--kozaru-app-shadow-soft: var(--kozaru-shadow-soft, 0 14px 40px rgba(17, 17, 17, .08));
	--kozaru-app-radius: var(--kozaru-radius, 22px);
	--kozaru-app-max: 1680px;
}

/*
 * Hide the theme's page title/chrome on Kozaru app pages only.
 * Kozaru renders its own operational headers inside the shortcode output.
 */
body.kozaru-frontend-app-page .entry-header,
body.kozaru-frontend-app-page .page-header,
body.kozaru-frontend-app-page .post-header,
body.kozaru-frontend-app-page .single-post-header,
body.kozaru-frontend-app-page .ast-single-entry-banner,
body.kozaru-frontend-app-page .et_post_meta_wrapper,
body.kozaru-frontend-app-page .elementor-page-title,
body.kozaru-frontend-app-page .wp-block-post-title,
body.kozaru-frontend-app-page .entry-title,
body.kozaru-frontend-app-page h1.entry-title,
body.kozaru-frontend-app-page .page-title,
body.kozaru-frontend-app-page h1.page-title,
body.kozaru-frontend-app-page .post-title,
body.kozaru-frontend-app-page h1.post-title,
body.kozaru-frontend-app-page .kozaru-page-header {
	display: none !important;
}

/* Keep public/in-app pages close to the site's main navigation/header. */
body.kozaru-frontend-app-page .site-content,
body.kozaru-frontend-app-page .content-area,
body.kozaru-frontend-app-page .site-main,
body.kozaru-frontend-app-page #primary,
body.kozaru-frontend-app-page #main,
body.kozaru-frontend-app-page main,
body.kozaru-frontend-app-page .wp-site-blocks > main,
body.kozaru-frontend-app-page .wp-block-group:has(> .entry-content) {
	margin-top: 0 !important;
	padding: 0 !important;
}

/* Theme-specific page wrapper neutralisation, kept harmless outside Kozaru pages. */
body.kozaru-frontend-app-page .kozaru-section {
	padding-top: clamp(.5rem, 1.2vw, 1rem) !important;
	padding-bottom: clamp(1.75rem, 4vw, 3.5rem) !important;
}

body.kozaru-frontend-app-page .kozaru-content-wrap,
body.kozaru-frontend-app-page .kozaru-container,
body.kozaru-frontend-app-page .kozaru-container--wide,
body.kozaru-frontend-app-page .site-main > .container,
body.kozaru-frontend-app-page .site-main > .wrap,
body.kozaru-frontend-app-page .content-area > .container,
body.kozaru-frontend-app-page .entry-content,
body.kozaru-frontend-app-page .wp-block-post-content,
body.kozaru-frontend-app-page .is-layout-constrained,
body.kozaru-frontend-app-page .is-layout-flow {
	max-width: none !important;
}

body.kozaru-frontend-app-page article.kozaru-content,
body.kozaru-frontend-app-page .type-page.kozaru-content,
body.kozaru-frontend-app-page .hentry.kozaru-content,
body.kozaru-frontend-app-page article.page,
body.kozaru-frontend-app-page .entry-content {
	margin-top: 0 !important;
}

body.kozaru-frontend-app-page article.kozaru-content,
body.kozaru-frontend-app-page .type-page.kozaru-content,
body.kozaru-frontend-app-page .hentry.kozaru-content {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
}

/*
 * Give the actual Kozaru app output its own predictable width regardless of
 * whether the host theme is narrow, block-based, classic, boxed, or chaos in a hat.
 */
body.kozaru-frontend-app-page .entry-content > .kozaru-frontend-wrap,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-frontend-wrap,
body.kozaru-frontend-app-page .entry-content > .kozaru-calendar-shortcode,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-calendar-shortcode,
body.kozaru-frontend-app-page .entry-content > .kozaru-registration-box,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-registration-box {
	margin-top: 0 !important;
	margin-bottom: clamp(1.5rem, 4vw, 3.5rem) !important;
}

body.kozaru-frontend-app-page .entry-content > .kozaru-frontend-wrap:first-child,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-frontend-wrap:first-child,
body.kozaru-frontend-app-page .entry-content > .kozaru-calendar-shortcode:first-child,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-calendar-shortcode:first-child,
body.kozaru-frontend-app-page .entry-content > .kozaru-registration-box:first-child,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-registration-box:first-child {
	margin-top: 0 !important;
}

body.kozaru-frontend-staff-app-page .entry-content > .kozaru-frontend-wrap,
body.kozaru-frontend-staff-app-page .wp-block-post-content > .kozaru-frontend-wrap {
	width: min(calc(100vw - 1.25rem), var(--kozaru-app-max)) !important;
	max-width: min(calc(100vw - 1.25rem), var(--kozaru-app-max)) !important;
}

body.kozaru-frontend-app-page .entry-content > .kozaru-frontend-wrap,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-frontend-wrap,
body.kozaru-frontend-app-page .entry-content > .kozaru-calendar-shortcode,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-calendar-shortcode,
body.kozaru-frontend-app-page .entry-content > .kozaru-registration-box,
body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-registration-box {
	margin-left: auto !important;
	margin-right: auto !important;
}

/* Prevent themes from injecting giant block gaps above the first Kozaru component. */
body.kozaru-frontend-app-page .entry-content > :first-child,
body.kozaru-frontend-app-page .wp-block-post-content > :first-child,
body.kozaru-frontend-app-page .is-layout-flow > :first-child,
body.kozaru-frontend-app-page .is-layout-constrained > :first-child {
	margin-block-start: 0 !important;
}

/* Mobile gets the same compact behaviour without turning into a postage stamp. */
@media (max-width: 782px) {
	body.kozaru-frontend-app-page .kozaru-section {
		padding-top: .5rem !important;
	}

	body.kozaru-frontend-app-page .entry-content > .kozaru-frontend-wrap,
	body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-frontend-wrap,
	body.kozaru-frontend-app-page .entry-content > .kozaru-calendar-shortcode,
	body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-calendar-shortcode,
	body.kozaru-frontend-app-page .entry-content > .kozaru-registration-box,
	body.kozaru-frontend-app-page .wp-block-post-content > .kozaru-registration-box {
		width: min(calc(100vw - .75rem), var(--kozaru-app-max)) !important;
		max-width: min(calc(100vw - .75rem), var(--kozaru-app-max)) !important;
	}
}

/* v0.3.3.10: centred app-stage alignment for constrained themes.
 *
 * The previous full-bleed trick used left:50vw-style negative margins on the
 * shortcode wrapper itself. That works in tidy block themes, then cheerfully
 * punts the cockpit half off-screen when a theme nests content inside an
 * offset/narrow page container. This pass makes the containing Kozaru page
 * area full-width first, then centres the actual app shell normally. Much less
 * witchcraft; considerably fewer layout corpses.
 */
body.kozaru-frontend-app-page {
	overflow-x: clip;
}

@supports not (overflow-x: clip) {
	body.kozaru-frontend-app-page {
		overflow-x: hidden;
	}
}

body.kozaru-frontend-staff-app-page .site-content,
body.kozaru-frontend-staff-app-page .content-area,
body.kozaru-frontend-staff-app-page .site-main,
body.kozaru-frontend-staff-app-page #primary,
body.kozaru-frontend-staff-app-page #main,
body.kozaru-frontend-staff-app-page main,
body.kozaru-frontend-staff-app-page .site-main > .container,
body.kozaru-frontend-staff-app-page .site-main > .wrap,
body.kozaru-frontend-staff-app-page .content-area > .container,
body.kozaru-frontend-staff-app-page .content-area > .wrap,
body.kozaru-frontend-staff-app-page .page-content,
body.kozaru-frontend-staff-app-page .page .entry-content,
body.kozaru-frontend-staff-app-page .kozaru-section,
body.kozaru-frontend-staff-app-page .kozaru-content-wrap,
body.kozaru-frontend-staff-app-page .kozaru-container,
body.kozaru-frontend-staff-app-page .kozaru-container--wide,
body.kozaru-frontend-staff-app-page .entry-content,
body.kozaru-frontend-staff-app-page .wp-block-post-content,
body.kozaru-frontend-staff-app-page .is-layout-flow,
body.kozaru-frontend-staff-app-page .is-layout-constrained,
body.kozaru-frontend-student-app-page .site-content,
body.kozaru-frontend-student-app-page .content-area,
body.kozaru-frontend-student-app-page .site-main,
body.kozaru-frontend-student-app-page #primary,
body.kozaru-frontend-student-app-page #main,
body.kozaru-frontend-student-app-page main,
body.kozaru-frontend-student-app-page .site-main > .container,
body.kozaru-frontend-student-app-page .site-main > .wrap,
body.kozaru-frontend-student-app-page .content-area > .container,
body.kozaru-frontend-student-app-page .content-area > .wrap,
body.kozaru-frontend-student-app-page .page-content,
body.kozaru-frontend-student-app-page .page .entry-content,
body.kozaru-frontend-student-app-page .kozaru-section,
body.kozaru-frontend-student-app-page .kozaru-content-wrap,
body.kozaru-frontend-student-app-page .kozaru-container,
body.kozaru-frontend-student-app-page .kozaru-container--wide,
body.kozaru-frontend-student-app-page .entry-content,
body.kozaru-frontend-student-app-page .wp-block-post-content,
body.kozaru-frontend-student-app-page .is-layout-flow,
body.kozaru-frontend-student-app-page .is-layout-constrained {
	box-sizing: border-box !important;
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	transform: none !important;
}

body.kozaru-frontend-staff-app-page .entry-content > .kozaru-frontend-wrap.kozaru-staff-interface,
body.kozaru-frontend-staff-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-staff-interface,
body.kozaru-frontend-staff-app-page .kozaru-frontend-wrap.kozaru-staff-interface,
body.kozaru-frontend-student-app-page .entry-content > .kozaru-frontend-wrap.kozaru-student-interface,
body.kozaru-frontend-student-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-student-interface,
body.kozaru-frontend-student-app-page .kozaru-frontend-wrap.kozaru-student-interface {
	box-sizing: border-box !important;
	position: static !important;
	left: auto !important;
	right: auto !important;
	transform: none !important;
	float: none !important;
	clear: both !important;
	display: block !important;
	width: min(calc(100vw - 1.25rem), 1320px) !important;
	max-width: min(calc(100vw - 1.25rem), 1320px) !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

@media (min-width: 1440px) {
	body.kozaru-frontend-staff-app-page .entry-content > .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-staff-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-staff-app-page .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-student-app-page .entry-content > .kozaru-frontend-wrap.kozaru-student-interface,
	body.kozaru-frontend-student-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-student-interface,
	body.kozaru-frontend-student-app-page .kozaru-frontend-wrap.kozaru-student-interface {
		width: min(calc(100vw - 2rem), 1400px) !important;
		max-width: min(calc(100vw - 2rem), 1400px) !important;
	}
}

@media (max-width: 782px) {
	body.kozaru-frontend-staff-app-page .entry-content > .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-staff-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-staff-app-page .kozaru-frontend-wrap.kozaru-staff-interface,
	body.kozaru-frontend-student-app-page .entry-content > .kozaru-frontend-wrap.kozaru-student-interface,
	body.kozaru-frontend-student-app-page .wp-block-post-content > .kozaru-frontend-wrap.kozaru-student-interface,
	body.kozaru-frontend-student-app-page .kozaru-frontend-wrap.kozaru-student-interface {
		width: calc(100vw - .75rem) !important;
		max-width: calc(100vw - .75rem) !important;
	}
}
