/*
 * MMO Realm — Global CSS
 * Accessibility, skip links, pixel art accents, custom block styles
 */

/* ============================================================
   1. RESET & BASE
   ============================================================ */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
	display: block;
	max-width: 100%;
	height: auto;
}

/* ============================================================
   2. SKIP LINK — Accessibility (WCAG 2.1 AA)
   ============================================================ */

.skip-link {
	position: absolute;
	top: -100%;
	left: 1rem;
	z-index: 99999;
	padding: 0.75rem 1.5rem;
	background-color: var(--wp--preset--color--realm-gold);
	color: var(--wp--preset--color--realm-void);
	font-family: var(--wp--preset--font-family--realm-display);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	letter-spacing: var(--wp--custom--letter-spacing-caps);
	text-transform: uppercase;
	text-decoration: none;
	border: 2px solid var(--wp--preset--color--realm-void);
	outline: none;
	transition: top 0s;
}

.skip-link:focus {
	top: 1rem;
}

/* ============================================================
   3. FOCUS VISIBLE — Global accessible focus ring
   ============================================================ */

:focus-visible {
	outline: 3px solid var(--wp--preset--color--realm-gold);
	outline-offset: 3px;
	border-radius: 0;
}

/* Remove default focus for mouse users only */
:focus:not(:focus-visible) {
	outline: none;
}

/* Nav links */
.wp-block-navigation a:focus-visible,
.wp-block-navigation .wp-block-navigation-item__content:focus-visible {
	outline: 3px solid var(--wp--preset--color--realm-gold);
	outline-offset: 3px;
}

/* ============================================================
   4. SCREEN READER ONLY UTILITY
   ============================================================ */

.screen-reader-text,
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

.screen-reader-text:focus {
	position: static;
	width: auto;
	height: auto;
	padding: 0.5rem 1rem;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
}

/* ============================================================
   5. MAIN CONTENT LANDMARK
   ============================================================ */

#wp--skip-link--target,
#wp--skip-link--target {
	outline: none;
}

/* ============================================================
   6. PIXEL ART DECORATIVE ELEMENTS
   ============================================================ */

/* Pixel divider using CSS — no images needed */
.realm-pixel-divider {
	display: block;
	width: 100%;
	height: 4px;
	background-image: repeating-linear-gradient(
		90deg,
		var(--wp--preset--color--realm-gold) 0px,
		var(--wp--preset--color--realm-gold) 8px,
		transparent 8px,
		transparent 16px
	);
	margin: 0;
	border: none;
}

.realm-pixel-divider--emerald {
	background-image: repeating-linear-gradient(
		90deg,
		var(--wp--preset--color--realm-emerald) 0px,
		var(--wp--preset--color--realm-emerald) 8px,
		transparent 8px,
		transparent 16px
	);
}

.realm-pixel-divider--sapphire {
	background-image: repeating-linear-gradient(
		90deg,
		var(--wp--preset--color--realm-sapphire) 0px,
		var(--wp--preset--color--realm-sapphire) 8px,
		transparent 8px,
		transparent 16px
	);
}

/* Pixel corner decoration */
.realm-pixel-corner {
	position: relative;
}

.realm-pixel-corner::before,
.realm-pixel-corner::after {
	content: '';
	position: absolute;
	width: 8px;
	height: 8px;
	background-color: var(--wp--preset--color--realm-gold);
}

.realm-pixel-corner::before {
	top: -2px;
	left: -2px;
}

.realm-pixel-corner::after {
	bottom: -2px;
	right: -2px;
}

/* ============================================================
   7. BLOCK STYLES — realm-card
   ============================================================ */

.is-style-realm-card {
	background-color: var(--wp--preset--color--realm-stone) !important;
	border: 1px solid var(--wp--preset--color--realm-mist) !important;
	padding: var(--wp--preset--spacing--60) !important;
	box-shadow: var(--wp--preset--shadow--realm-card);
	transition: border-color 200ms ease, box-shadow 200ms ease;
}

.is-style-realm-card:hover {
	border-color: var(--wp--preset--color--realm-gold-dim) !important;
	box-shadow: var(--wp--preset--shadow--realm-glow-gold);
}

/* ============================================================
   8. BLOCK STYLES — realm-pixel-card
   ============================================================ */

.is-style-realm-pixel-card {
	background-color: var(--wp--preset--color--realm-abyss) !important;
	border: 2px solid var(--wp--preset--color--realm-gold) !important;
	padding: var(--wp--preset--spacing--60) !important;
	position: relative;
	image-rendering: pixelated;
}

/* Pixel corners on the card */
.is-style-realm-pixel-card::before {
	content: '';
	position: absolute;
	top: -6px;
	left: -6px;
	right: -6px;
	bottom: -6px;
	border: 2px solid var(--wp--preset--color--realm-gold-dim);
	pointer-events: none;
}

/* ============================================================
   9. BLOCK STYLES — realm-section-title (heading)
   ============================================================ */

.is-style-realm-section-title {
	position: relative;
	padding-bottom: 0.75rem;
}

.is-style-realm-section-title::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 3rem;
	height: 3px;
	background-color: var(--wp--preset--color--realm-gold);
}

/* ============================================================
   10. BLOCK STYLES — Buttons
   ============================================================ */

/* Outline button */
.wp-block-button.is-style-realm-outline .wp-block-button__link {
	background-color: transparent !important;
	color: var(--wp--preset--color--realm-gold) !important;
	border: 2px solid var(--wp--preset--color--realm-gold) !important;
}

.wp-block-button.is-style-realm-outline .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--realm-gold) !important;
	color: var(--wp--preset--color--realm-void) !important;
}

/* Danger button */
.wp-block-button.is-style-realm-danger .wp-block-button__link {
	background-color: var(--wp--preset--color--realm-ruby) !important;
	color: var(--wp--preset--color--realm-ivory) !important;
	border: 2px solid var(--wp--preset--color--realm-ruby) !important;
}

.wp-block-button.is-style-realm-danger .wp-block-button__link:hover {
	background-color: transparent !important;
	color: var(--wp--preset--color--realm-ruby) !important;
}

/* ============================================================
   11. NAVIGATION OVERRIDES
   ============================================================ */

.wp-block-navigation {
	--navigation-layout-justification-setting: flex-start;
}

.wp-block-navigation .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--realm-abyss);
	border: 1px solid var(--wp--preset--color--realm-mist);
	border-top: 2px solid var(--wp--preset--color--realm-gold);
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .wp-block-navigation-item__content:focus {
	color: var(--wp--preset--color--realm-gold);
	text-decoration: none;
}

/* Mobile nav overlay */
.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--realm-void);
}

/* ============================================================
   12. HEADER TEMPLATE PART
   ============================================================ */

.realm-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background-color: rgba(10, 10, 15, 0.95);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--wp--preset--color--realm-mist);
}

/* ============================================================
   13. HERO SECTION
   ============================================================ */

.realm-hero {
	min-height: 90vh;
	display: flex;
	align-items: center;
	position: relative;
	overflow: hidden;
}

.realm-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(10, 10, 15, 0.3) 0%,
		rgba(10, 10, 15, 0.7) 60%,
		rgba(10, 10, 15, 1) 100%
	);
	z-index: 1;
}

.realm-hero > * {
	position: relative;
	z-index: 2;
}

/* ============================================================
   14. SERVER STATUS BADGE (utility)
   ============================================================ */

.realm-status-online,
.realm-status-offline {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--wp--preset--font-family--realm-mono);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.05em;
	padding: 0.25rem 0.75rem;
	border: 1px solid;
}

.realm-status-online {
	color: var(--wp--preset--color--realm-emerald);
	border-color: var(--wp--preset--color--realm-emerald);
}

.realm-status-online::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	background-color: var(--wp--preset--color--realm-emerald);
	animation: realm-pulse 2s ease-in-out infinite;
}

.realm-status-offline {
	color: var(--wp--preset--color--realm-ruby);
	border-color: var(--wp--preset--color--realm-ruby);
}

.realm-status-offline::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	background-color: var(--wp--preset--color--realm-ruby);
}

@keyframes realm-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
	.realm-status-online::before {
		animation: none;
	}
}

/* ============================================================
   15. LEADERBOARD TABLE
   ============================================================ */

.realm-leaderboard {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--wp--preset--font-family--realm-mono);
	font-size: var(--wp--preset--font-size--sm);
}

.realm-leaderboard th {
	text-align: left;
	padding: 0.75rem 1rem;
	background-color: var(--wp--preset--color--realm-mist);
	color: var(--wp--preset--color--realm-gold);
	font-family: var(--wp--preset--font-family--realm-display);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: var(--wp--custom--letter-spacing-caps);
	text-transform: uppercase;
	border-bottom: 2px solid var(--wp--preset--color--realm-gold);
}

.realm-leaderboard td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--wp--preset--color--realm-mist);
	color: var(--wp--preset--color--realm-parchment);
	vertical-align: middle;
}

.realm-leaderboard tr:hover td {
	background-color: var(--wp--preset--color--realm-stone);
}

.realm-leaderboard .rank-1 td:first-child {
	color: var(--wp--preset--color--realm-gold);
	font-weight: 700;
}

.realm-leaderboard .rank-2 td:first-child {
	color: var(--wp--preset--color--realm-parchment);
}

.realm-leaderboard .rank-3 td:first-child {
	color: var(--wp--preset--color--realm-topaz);
}

/* ============================================================
   16. STAFF GRID
   ============================================================ */

.realm-staff-card {
	text-align: center;
	padding: var(--wp--preset--spacing--60);
	background-color: var(--wp--preset--color--realm-stone);
	border: 1px solid var(--wp--preset--color--realm-mist);
	transition: border-color 200ms ease;
}

.realm-staff-card:hover {
	border-color: var(--wp--preset--color--realm-gold-dim);
}

.realm-staff-card img {
	width: 80px;
	height: 80px;
	margin: 0 auto var(--wp--preset--spacing--40);
	image-rendering: pixelated; /* pixel art avatars */
	border: 2px solid var(--wp--preset--color--realm-gold-dim);
}

.realm-staff-role {
	display: inline-block;
	font-family: var(--wp--preset--font-family--realm-mono);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 0.15rem 0.5rem;
	border: 1px solid;
}

.realm-staff-role--admin    { color: var(--wp--preset--color--realm-ruby);    border-color: var(--wp--preset--color--realm-ruby); }
.realm-staff-role--mod      { color: var(--wp--preset--color--realm-sapphire); border-color: var(--wp--preset--color--realm-sapphire); }
.realm-staff-role--dev      { color: var(--wp--preset--color--realm-emerald); border-color: var(--wp--preset--color--realm-emerald); }
.realm-staff-role--builder  { color: var(--wp--preset--color--realm-topaz);   border-color: var(--wp--preset--color--realm-topaz); }

/* ============================================================
   17. NEWS / BLOG CARDS
   ============================================================ */

.realm-news-card {
	background-color: var(--wp--preset--color--realm-stone);
	border: 1px solid var(--wp--preset--color--realm-mist);
	overflow: hidden;
	transition: border-color 200ms ease, transform 200ms ease;
}

.realm-news-card:hover {
	border-color: var(--wp--preset--color--realm-gold-dim);
	transform: translateY(-2px);
}

.realm-news-card .card-category {
	font-family: var(--wp--preset--font-family--realm-mono);
	font-size: var(--wp--preset--font-size--xs);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--wp--preset--color--realm-gold);
}

/* ============================================================
   18. JOIN STEPS
   ============================================================ */

.realm-step {
	display: flex;
	gap: var(--wp--preset--spacing--50);
	align-items: flex-start;
}

.realm-step-number {
	flex-shrink: 0;
	width: 2.5rem;
	height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--wp--preset--color--realm-gold);
	color: var(--wp--preset--color--realm-void);
	font-family: var(--wp--preset--font-family--realm-display);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	border: 2px solid var(--wp--preset--color--realm-gold-dim);
}

/* ============================================================
   19. RESPONSIVE UTILITIES
   ============================================================ */

@media (max-width: 600px) {
	.realm-hero {
		min-height: 70vh;
	}
}

/* ============================================================
   20. PRINT
   ============================================================ */

@media print {
	.realm-header,
	.skip-link,
	.wp-block-navigation {
		display: none !important;
	}

	body {
		background: white !important;
		color: black !important;
	}
}

/* ============================================================
   21. RESPONSIVE — Mobile first
   ============================================================ */

/* Tablette (≤ 768px) */
@media (max-width: 768px) {

	/* Header : logo + titre sur une ligne, nav en dessous si besoin */
	.realm-header .wp-block-group {
		flex-wrap: wrap;
		gap: 0.75rem;
	}

	/* Hero */
	.realm-hero {
		min-height: 75vh !important;
	}

	.realm-hero h1 {
		font-size: clamp(2rem, 8vw, 3rem) !important;
	}

	/* Stats bar : wrap en colonnes */
	.realm-hero .wp-block-group[class*="flex"] {
		gap: var(--wp--preset--spacing--50) !important;
	}

	/* News grid : 2 colonnes → 1 colonne */
	.wp-block-post-template.is-flex-container.is-flex-container-3-columns {
		grid-template-columns: repeat(2, 1fr) !important;
	}

	/* Footer : colonnes empilées */
	.wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
		flex-basis: 100% !important;
		min-width: 100% !important;
	}

	/* Steps : colonnes empilées */
	.realm-step {
		gap: var(--wp--preset--spacing--40);
	}

	/* Boutons : full width sur mobile */
	.wp-block-buttons.is-content-justification-center .wp-block-button {
		width: 100%;
	}

	.wp-block-buttons.is-content-justification-center .wp-block-button__link {
		width: 100%;
		text-align: center;
	}

	/* Leaderboard : scroll horizontal */
	.realm-leaderboard-wrapper {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

}

/* Mobile (≤ 480px) */
@media (max-width: 480px) {

	.realm-hero {
		min-height: 65vh !important;
		padding-top: var(--wp--preset--spacing--70) !important;
		padding-bottom: var(--wp--preset--spacing--70) !important;
	}

	/* News grid : 1 colonne */
	.wp-block-post-template.is-flex-container {
		grid-template-columns: 1fr !important;
	}

	/* Boutons hero : empilés */
	.wp-block-buttons {
		flex-direction: column;
	}

	.wp-block-buttons .wp-block-button {
		width: 100%;
	}

	.wp-block-buttons .wp-block-button__link {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	/* Staff card : 1 colonne */
	.realm-staff-card {
		padding: var(--wp--preset--spacing--50);
	}

}

/* ============================================================
   22. MENU NAVIGATION — Mobile overlay
   ============================================================ */

/* Burger button */
.wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--realm-gold) !important;
	background: transparent !important;
	border: 1px solid var(--wp--preset--color--realm-mist) !important;
	padding: 0.4rem 0.6rem !important;
	cursor: pointer;
	transition: border-color 200ms ease;
}

.wp-block-navigation__responsive-container-open:hover,
.wp-block-navigation__responsive-container-open:focus-visible {
	border-color: var(--wp--preset--color--realm-gold) !important;
	outline: 3px solid var(--wp--preset--color--realm-gold);
	outline-offset: 3px;
}

/* Close button */
.wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--realm-gold) !important;
	background: transparent !important;
}

.wp-block-navigation__responsive-container-close:focus-visible {
	outline: 3px solid var(--wp--preset--color--realm-gold);
	outline-offset: 3px;
}

/* Overlay panel */
.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--realm-void) !important;
	border-left: 2px solid var(--wp--preset--color--realm-gold);
	padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--60);
}

/* Nav links dans l'overlay */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: 1.25rem !important;
	padding: 0.5rem 0 !important;
	color: var(--wp--preset--color--realm-parchment) !important;
	border-bottom: 1px solid var(--wp--preset--color--realm-mist);
	display: block;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus {
	color: var(--wp--preset--color--realm-gold) !important;
}

/* Sous-menus */
.wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--realm-abyss) !important;
	border: 1px solid var(--wp--preset--color--realm-mist) !important;
	border-top: 2px solid var(--wp--preset--color--realm-gold) !important;
	box-shadow: 0 8px 24px rgba(0,0,0,0.6) !important;
}

.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.6rem 1rem !important;
	font-size: 0.875rem !important;
}

.wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background-color: var(--wp--preset--color--realm-stone) !important;
	color: var(--wp--preset--color--realm-gold) !important;
}

/* Indicateur sous-menu (flèche) */
.wp-block-navigation__submenu-icon svg {
	fill: var(--wp--preset--color--realm-gold) !important;
}

/* ============================================================
   23. NO-LIST-STYLE utility (footer lists)
   ============================================================ */

.no-list-style {
	list-style: none !important;
	padding-left: 0 !important;
	margin-left: 0 !important;
}

.no-list-style li {
	margin-bottom: 0.4rem;
}

.no-list-style li a {
	color: var(--wp--preset--color--realm-slate);
	text-decoration: none;
	font-size: 0.875rem;
	transition: color 200ms ease;
}

.no-list-style li a:hover {
	color: var(--wp--preset--color--realm-gold);
}

/* ============================================================
   24. 404 PAGE
   ============================================================ */

.realm-404-number {
	font-family: var(--wp--preset--font-family--realm-mono);
	font-size: 5rem;
	font-weight: 700;
	color: var(--wp--preset--color--realm-gold);
	margin: 0;
	line-height: 1;
}

/* 404 cover background image */
.realm-404-cover {
	background-image: url('../images/404.png');
	background-size: cover;
	background-position: center;
}
