/**
 * Responsive Design System - Nuclear Engagement Plugin
 *
 * Modern responsive utilities and mixins for mobile-first design.
 * Includes container queries, fluid typography, and responsive spacing.
 */

/* === RESPONSIVE UTILITIES === */

/* Container Query Support */
@supports (container-type: inline-size) {
	.ne-container {
	container-name: main-content;
	container-type: inline-size;
	}

	.ne-sidebar {
	container-name: sidebar;
	container-type: inline-size;
	}

	.ne-quiz {
	container-name: quiz;
	container-type: inline-size;
	}
}

/* === BREAKPOINT UTILITIES === */

/* Screen size utilities */
@media (width <= 639px) {
	.ne-hide-on-mobile { display: none !important; }
}

@media (width >= 640px) {
	.ne-hide-on-tablet-up { display: none !important; }

	.ne-show-on-tablet-up { display: block !important; }
}

@media (width >= 768px) {
	.ne-hide-on-desktop-up { display: none !important; }

	.ne-show-on-desktop-up { display: block !important; }
}

@media (width >= 1024px) {
	.ne-hide-on-large-up { display: none !important; }

	.ne-show-on-large-up { display: block !important; }
}

/* === RESPONSIVE GRID SYSTEM === */

.ne-grid {
	display: grid;
	gap: var(--ne-space-4);

	/* Mobile-first: single column */
	grid-template-columns: 1fr;
}

/* Responsive grid columns */
@media (width >= 640px) {
	.ne-grid--sm-2 { grid-template-columns: repeat(2, 1fr); }

	.ne-grid--sm-3 { grid-template-columns: repeat(3, 1fr); }

	.ne-grid--sm-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (width >= 768px) {
	.ne-grid--md-2 { grid-template-columns: repeat(2, 1fr); }

	.ne-grid--md-3 { grid-template-columns: repeat(3, 1fr); }

	.ne-grid--md-4 { grid-template-columns: repeat(4, 1fr); }

	.ne-grid--md-6 { grid-template-columns: repeat(6, 1fr); }
}

@media (width >= 1024px) {
	.ne-grid--lg-2 { grid-template-columns: repeat(2, 1fr); }

	.ne-grid--lg-3 { grid-template-columns: repeat(3, 1fr); }

	.ne-grid--lg-4 { grid-template-columns: repeat(4, 1fr); }

	.ne-grid--lg-6 { grid-template-columns: repeat(6, 1fr); }

	.ne-grid--lg-12 { grid-template-columns: repeat(12, 1fr); }
}

/* === RESPONSIVE FLEXBOX === */

.ne-flex {
	display: flex;
	gap: var(--ne-space-4);
}

.ne-flex--column {
	flex-direction: column;
}

.ne-flex--wrap {
	flex-wrap: wrap;
}

/* Responsive flex directions */
@media (width <= 767px) {
	.ne-flex--mobile-column {
	flex-direction: column;
	}

	.ne-flex--mobile-stack > * {
	flex: 1 1 100%;
	}
}

@media (width >= 768px) {
	.ne-flex--tablet-row {
	flex-direction: row;
	}
}

/* === RESPONSIVE SPACING === */

/* Mobile spacing (smaller) */
.ne-p-responsive { padding: var(--ne-space-4); }

.ne-px-responsive { padding-inline: var(--ne-space-4); }

.ne-py-responsive { padding-block: var(--ne-space-4); }

.ne-m-responsive { margin: var(--ne-space-4); }

.ne-mx-responsive { margin-inline: var(--ne-space-4); }

.ne-my-responsive { margin-block: var(--ne-space-4); }

/* Tablet spacing (medium) */
@media (width >= 768px) {
	.ne-p-responsive { padding: var(--ne-space-6); }

	.ne-px-responsive { padding-inline: var(--ne-space-6); }

	.ne-py-responsive { padding-block: var(--ne-space-6); }

	.ne-m-responsive { margin: var(--ne-space-6); }

	.ne-mx-responsive { margin-inline: var(--ne-space-6); }

	.ne-my-responsive { margin-block: var(--ne-space-6); }
}

/* Desktop spacing (larger) */
@media (width >= 1024px) {
	.ne-p-responsive { padding: var(--ne-space-8); }

	.ne-px-responsive { padding-inline: var(--ne-space-8); }

	.ne-py-responsive { padding-block: var(--ne-space-8); }

	.ne-m-responsive { margin: var(--ne-space-8); }

	.ne-mx-responsive { margin-inline: var(--ne-space-8); }

	.ne-my-responsive { margin-block: var(--ne-space-8); }
}

/* === FLUID TYPOGRAPHY === */

.ne-text-fluid-sm {
	font-size: clamp(0.875rem, 2vw, 1rem);
	line-height: var(--ne-line-height-normal);
}

.ne-text-fluid-base {
	font-size: clamp(1rem, 2.5vw, 1.125rem);
	line-height: var(--ne-line-height-normal);
}

.ne-text-fluid-lg {
	font-size: clamp(1.125rem, 3vw, 1.25rem);
	line-height: var(--ne-line-height-snug);
}

.ne-text-fluid-xl {
	font-size: clamp(1.25rem, 4vw, 1.5rem);
	line-height: var(--ne-line-height-snug);
}

.ne-text-fluid-2xl {
	font-size: clamp(1.5rem, 5vw, 2.25rem);
	line-height: var(--ne-line-height-tight);
}

.ne-text-fluid-3xl {
	font-size: clamp(1.875rem, 6vw, 3rem);
	line-height: var(--ne-line-height-tight);
}

/* === RESPONSIVE CONTAINERS === */

.ne-container {
	margin-inline: auto;

	/* Fluid max-width */
	max-width: min(var(--ne-container-max-width), calc(100vw - var(--ne-space-8)));
	padding-inline: var(--ne-container-padding);
	width: 100%;
}

/* Container variants */
.ne-container--narrow {
	max-width: min(800px, calc(100vw - var(--ne-space-8)));
}

.ne-container--wide {
	max-width: min(1400px, calc(100vw - var(--ne-space-8)));
}

.ne-container--full {
	max-width: none;
	padding-inline: 0;
}

/* === RESPONSIVE QUIZ COMPONENTS === */

.ne-quiz {
	margin-block: var(--ne-space-6);
	margin-inline: auto;

	/* Mobile-first design */
	padding: var(--ne-space-4);

	/* Fluid width with constraints */
	width: min(100%, 600px);
}

@media (width >= 768px) {
	.ne-quiz {
	margin-block: var(--ne-space-8);
	padding: var(--ne-space-6);
	}
}

.ne-quiz__answers {
	display: grid;
	gap: var(--ne-space-3);

	/* Single column on mobile */
	grid-template-columns: 1fr;
}

@media (width >= 640px) {
	.ne-quiz__answers--columns {
	grid-template-columns: repeat(2, 1fr);
	}
}

/* Container query for quiz when space is limited */
@container quiz (max-width: 480px) {
	.ne-quiz__answers--columns {
	grid-template-columns: 1fr;
	}

	.ne-quiz__button {
	font-size: var(--ne-font-size-sm);
	padding: var(--ne-space-3) var(--ne-space-4);
	}
}

/* === RESPONSIVE ADMIN INTERFACE === */

.ne-admin {
	display: grid;
	gap: var(--ne-space-6);

	/* Mobile: single column */
	grid-template-columns: 1fr;
}

@media (width >= 1024px) {
	.ne-admin--sidebar {
	grid-template-columns: 300px 1fr;
	}

	.ne-admin--wide-sidebar {
	grid-template-columns: 400px 1fr;
	}
}

.ne-admin__form {
	display: grid;
	gap: var(--ne-space-4);

	/* Mobile: single column */
	grid-template-columns: 1fr;
}

@media (width >= 768px) {
	.ne-admin__form--two-column {
	align-items: start;
	grid-template-columns: 1fr 2fr;
	}
}

/* === RESPONSIVE TABLES === */

.ne-table-responsive {
	margin-block: var(--ne-space-4);
	overflow-x: auto;
}

.ne-table {
	min-width: 600px; /* Ensure table doesn't get too cramped */
	width: 100%;
}

/* Stack table on very small screens */
@media (width <= 480px) {
	.ne-table--stack {
	min-width: auto;
	}

	.ne-table--stack thead {
	display: none;
	}

	.ne-table--stack tbody,
	.ne-table--stack tr,
	.ne-table--stack td {
	display: block;
	}

	.ne-table--stack tr {
	border: 1px solid var(--ne-border-primary);
	border-radius: var(--ne-radius-md);
	margin-bottom: var(--ne-space-4);
	padding: var(--ne-space-4);
	}

	.ne-table--stack td {
	border: none;
	padding: var(--ne-space-2) 0;
	}

	.ne-table--stack td::before {
	content: attr(data-label) ": ";
	display: inline-block;
	font-weight: var(--ne-font-weight-semibold);
	width: 120px;
	}
}

/* === RESPONSIVE IMAGES === */

.ne-img-responsive {
	display: block;
	height: auto;
	max-width: 100%;
}

.ne-img-cover {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* === RESPONSIVE NAVIGATION === */

.ne-nav {
	display: flex;

	/* Mobile: stack vertically */
	flex-direction: column;
	gap: var(--ne-space-2);
}

@media (width >= 768px) {
	.ne-nav--horizontal {
	align-items: center;
	flex-direction: row;
	}
}

/* Burger menu for mobile */
.ne-nav__toggle {
	background: none;
	border: none;
	cursor: pointer;
	display: block;
	padding: var(--ne-space-2);
}

@media (width >= 768px) {
	.ne-nav__toggle {
	display: none;
	}
}

/* === RESPONSIVE UTILITIES === */

/* Show/hide based on screen size */
.ne-hidden { display: none !important; }

.ne-sr-only {
	border: 0;
	clip: rect(0, 0, 0, 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Responsive text alignment */
.ne-text-center { text-align: center; }

.ne-text-left { text-align: left; }

.ne-text-right { text-align: right; }

@media (width >= 768px) {
	.ne-md-text-left { text-align: left; }

	.ne-md-text-center { text-align: center; }

	.ne-md-text-right { text-align: right; }
}

/* === RESPONSIVE ASPECT RATIOS === */

.ne-aspect {
	position: relative;
	width: 100%;
}

.ne-aspect::before {
	content: "";
	display: block;
	padding-bottom: var(--aspect-ratio, 100%);
}

.ne-aspect > * {
	height: 100%;
	left: 0;
	object-fit: cover;
	position: absolute;
	top: 0;
	width: 100%;
}

.ne-aspect--square { --aspect-ratio: 100%; }

.ne-aspect--video { --aspect-ratio: 56.25%; } /* 16:9 */
.ne-aspect--photo { --aspect-ratio: 75%; }    /* 4:3 */

/* === PRINT STYLES === */

@media print {
	.ne-no-print { display: none !important; }

	.ne-quiz,
	.ne-admin {
	box-shadow: none;
	break-inside: avoid;
	}

	.ne-container {
	max-width: none;
	padding: 0;
	}
}