/*
Theme Name: JRPG Hex
Template: twentytwentyfive
Description: 16-bit side-view JRPG battle stage, reduced GUI, and retro command window HUD.
Version: 1.2.0
Text Domain: jrpg-hex
*/

/* Base canvas background with soft hex overlay */
body {
	background-color: #0b1226;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 0l28 16v33L28 65 0 49V16zM28 65v33' fill='none' stroke='%23b8c4e6' stroke-opacity='.05' stroke-width='1.5'/%3E%3C/svg%3E");
	color: #e4e9f7;
	font-family: inherit;
}

/* ==========================================================================
   16-Bit JRPG Window Aesthetic (Beveled Blue & Gold Borders)
   ========================================================================== */
.jrpg-window,
.xgmj,
.xgmt,
.xgmc,
.xgm-battle {
	background: linear-gradient(180deg, #1b2a5e 0%, #0c1538 50%, #070d24 100%);
	border: 3px solid #b8c4e6;
	border-radius: 12px;
	box-shadow: 0 0 0 2px #040817, 0 8px 24px rgba(0, 0, 0, 0.7);
	position: relative;
}

/* ==========================================================================
   Battle Page Layout & Reduced GUI
   ========================================================================== */
body.page-id-59 main { margin-top: .5rem !important; }
body.page-id-59 .wp-block-post-title { display: none; }
body.page-id-59 .entry-content {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr);
	gap: 1.2rem;
	align-items: start;
	max-width: 1440px;
	margin-inline: auto;
}
body.page-id-59 .entry-content > * { max-width: none !important; margin: 0 !important; }
body.page-id-59 .entry-content > .xgmt,
body.page-id-59 .entry-content > .xgmj,
body.page-id-59 .entry-content > .xgm-battle-message { grid-column: 1 / -1; }
body.page-id-59 .entry-content > .xgm-battle { grid-column: 1; }
body.page-id-59 .entry-content > .xgmc { grid-column: 2; position: sticky; top: .5rem; }

/* Hide redundant titles on battle stage for clean look */
.xgm-battle__title,
.xgm-battle__side h3 { display: none; }

/* ==========================================================================
   Narrative Action Banner (Top of Battle Stage)
   ========================================================================== */
.jrpg-narrative-banner {
	display: flex;
	align-items: center;
	gap: .6rem;
	background: linear-gradient(90deg, rgba(232, 198, 106, 0.25), rgba(27, 42, 94, 0.9) 15%, rgba(27, 42, 94, 0.9) 85%, rgba(232, 198, 106, 0.25));
	border: 2px solid #e8c66a;
	border-radius: 8px;
	padding: .5rem .9rem;
	margin: 0 0 .8rem;
	font-size: 1.05rem;
	font-weight: 600;
	color: #fff6d0;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
	animation: jrpg-banner-glow 2s ease-in-out infinite alternate;
}
.jrpg-banner-icon { color: #e8c66a; font-size: 1.2rem; }
@keyframes jrpg-banner-glow {
	from { border-color: #d9c98a; }
	to { border-color: #ffe696; box-shadow: 0 0 14px rgba(232, 198, 106, 0.4); }
}

/* ==========================================================================
   Side-View Battle Stage Backdrop & Layout
   ========================================================================== */
.xgm-battle { padding: 1rem; }
.xgm-battle__field {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	min-height: 340px;
	padding: 1.5rem 1.2rem .75rem;
	border-radius: 10px;
	position: relative;
	overflow: hidden;
	box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.85);
}

/* Biome Backdrops */
.xgm-battle__field.is-biome-shore {
	background: linear-gradient(180deg, #0e1c3d 0%, #172d54 55%, #1d3e66 75%, #0f2238 100%);
}
.xgm-battle__field.is-biome-coast {
	background: linear-gradient(180deg, #0a1b24 0%, #133333 55%, #184236 75%, #0d2119 100%);
}
.xgm-battle__field.is-biome-ash {
	background: linear-gradient(180deg, #240c15 0%, #3d141e 55%, #4a191f 75%, #260a0f 100%);
}

/* Battle stage ground mist / floor */
.xgm-battle__field::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 35%;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.65) 70%, rgba(0, 0, 0, 0.9));
	pointer-events: none;
	z-index: 1;
}

/* Character Roster on Stage */
.xgm-battle__side { position: relative; z-index: 2; }
.xgm-battle__cards {
	display: flex;
	flex-direction: column;
	gap: .9rem;
	margin: 0;
	padding: 0;
	list-style: none;
	justify-content: center;
	min-height: 100%;
}

/* Individual Actor Card on Stage */
.xgm-battle__card {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .4rem .6rem;
	border-radius: 8px;
	background: rgba(8, 14, 38, 0.65);
	border: 1px solid rgba(184, 196, 230, 0.25);
	backdrop-filter: blur(4px);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Side alignments */
.xgm-battle__side--enemies .xgm-battle__card { flex-direction: row; }
.xgm-battle__side--party .xgm-battle__card { flex-direction: row-reverse; text-align: right; }

/* Active Actor Highlight & Step-Forward */
.xgm-battle__card.is-current {
	border-color: #e8c66a !important;
	background: rgba(27, 42, 94, 0.9) !important;
	box-shadow: 0 0 16px rgba(232, 198, 106, 0.6) !important;
}
.xgm-battle__side--enemies .xgm-battle__card.is-current {
	transform: translateX(20px) scale(1.04);
}
.xgm-battle__side--party .xgm-battle__card.is-current {
	transform: translateX(-20px) scale(1.04);
}

/* Sprite Container */
.xgm-battle__portrait {
	flex: 0 0 68px;
	width: 68px;
	height: 68px;
	display: flex;
	align-items: center;
	justify-content: center;
	filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.6));
}

/* Fallback Icon styling */
.jrpg-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #b8c4e6;
	background: linear-gradient(180deg, #2a427e, #121f48);
	clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
}
.jrpg-icon svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 3.5; }
.jrpg-icon--enemy { color: #e6b8b8; background: linear-gradient(180deg, #5a2a3a, #2a1222); }
.jrpg-icon--ally { color: #c9e6c9; background: linear-gradient(180deg, #2f5d3a, #12301c); }

/* Supplied Sprite Art */
.jrpg-sprite {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.jrpg-sprite--party { transform: scaleX(-1); }
.jrpg-sprite.is-defeated {
	filter: grayscale(1) brightness(.55);
	transform: rotate(-75deg);
	opacity: .6;
}
.jrpg-sprite--party.is-defeated {
	transform: scaleX(-1) rotate(-75deg);
	opacity: .6;
}

/* Character Info & Health Meters */
.xgm-battle__info { flex: 1; min-width: 0; font-size: .85rem; }
.xgm-battle__name { font-weight: 700; color: #fff; font-size: .95rem; }
.jrpg-ally-tag {
	display: inline-block;
	margin-inline: .35rem;
	padding: 0 .4rem;
	font-size: .68rem;
	border: 1px solid rgba(201, 230, 201, .6);
	border-radius: 999px;
	color: #c9e6c9;
}
.xgm-battle__health-bar {
	height: 7px;
	border-radius: 4px;
	background: #3b1212;
	overflow: hidden;
	margin: .25rem 0 .15rem;
	border: 1px solid rgba(0,0,0,0.5);
}
.xgm-battle__health-fill {
	height: 100%;
	background: linear-gradient(90deg, #4ade80, #22c55e);
	transition: width .4s ease;
}
.xgm-battle__health-text { font-size: .75rem; opacity: .85; }

/* Turn Order Bar (Slim Chips) */
.xgm-battle__turns {
	display: flex;
	flex-wrap: wrap;
	gap: .35rem;
	margin: .6rem 0 0;
	padding: 0;
	list-style: none;
	font-size: .78rem;
}
.xgm-battle__turns li {
	padding: .15rem .55rem;
	border: 1px solid rgba(184, 196, 230, .35);
	border-radius: 999px;
	background: rgba(11, 18, 64, 0.6);
}
.xgm-battle__turns li.is-current {
	border-color: #e8c66a;
	background: rgba(232, 198, 106, .25);
	color: #fff6d0;
	font-weight: 700;
}

/* ==========================================================================
   Combat Panel & Collapsible Log
   ========================================================================== */
.xgmc { padding: .85rem 1.1rem; }
.xgmc h3 { margin: 0 0 .4rem; font-size: 1.15rem; color: #b8c4e6; }
.jrpg-log-accordion {
	margin-top: .8rem;
	background: rgba(0, 0, 0, 0.3);
	border: 1px solid rgba(184, 196, 230, 0.2);
	border-radius: 8px;
	padding: .4rem .6rem;
}
.jrpg-log-summary {
	cursor: pointer;
	font-size: .85rem;
	color: #b8c4e6;
	user-select: none;
	outline: none;
}
.jrpg-log-summary:hover { color: #fff6d0; }
.xgmc__log {
	max-height: 25vh;
	overflow-y: auto;
	margin: .5rem 0 0;
	padding-left: 1rem;
	font-size: .82rem;
}

/* ==========================================================================
   Fixed Bottom Actions Tray on Player's Turn
   ========================================================================== */
.xgmc__actions {
	position: fixed;
	left: 50%;
	bottom: 1rem;
	transform: translateX(-50%);
	z-index: 9000;
	width: min(780px, calc(100% - 1.5rem));
	max-height: 55vh;
	overflow-y: auto;
	padding: .9rem 1.2rem;
	background: linear-gradient(180deg, #24407a, #0d1838);
	border: 3px solid #e8c66a;
	border-radius: 12px;
	box-shadow: 0 0 0 4px rgba(13, 24, 56, .85), 0 0 28px rgba(232, 198, 106, .55);
	animation: jrpg-actions-in .35s ease-out both;
}
.xgmc__actions-head { font-size: 1.15rem; margin: 0 0 .4rem; color: #fff6d0; letter-spacing: .03em; }
.xgmc__actions .xgmc__move { margin: .3rem 0; padding: .35rem 0 0; border-top: 1px solid rgba(184, 196, 230, .2); }
.xgmc__actions .wp-element-button { font-size: 1.05rem; padding: .55rem 1rem; }
body:has(.xgmc__actions) { padding-bottom: 18rem; }
@keyframes jrpg-actions-in { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ==========================================================================
   Victory / Defeat Banners
   ========================================================================== */
.xgmc__end.is-victory {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	border-color: #e8c66a !important;
	animation: jrpg-pop .8s cubic-bezier(.2, 1.6, .4, 1) both, jrpg-glow 1.6s ease-in-out .8s infinite alternate;
}
.xgmc__end.is-victory::before {
	content: "";
	position: absolute;
	inset: -60%;
	z-index: -1;
	background: repeating-conic-gradient(from 0deg, rgba(255, 230, 150, .22) 0 10deg, transparent 10deg 20deg);
	animation: jrpg-spin 12s linear infinite;
}
.jrpg-victory-title {
	background: linear-gradient(90deg, #fff6d0, #e8c66a, #fffbe8, #e8c66a, #fff6d0);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	text-shadow: none !important;
	filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .55));
	animation: jrpg-shimmer 2.5s linear infinite;
}
.jrpg-victory-title span { display: inline-block; animation: jrpg-bounce .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.jrpg-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.jrpg-confetti i {
	position: absolute;
	top: -20px;
	width: 10px;
	height: 14px;
	border-radius: 2px;
	animation: jrpg-fall linear forwards;
}

@keyframes jrpg-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes jrpg-glow { from { box-shadow: 0 0 10px rgba(232, 198, 106, .4); } to { box-shadow: 0 0 34px rgba(232, 198, 106, .95); } }
@keyframes jrpg-spin { to { transform: rotate(360deg); } }
@keyframes jrpg-shimmer { to { background-position: -200% 0; } }
@keyframes jrpg-bounce { from { transform: translateY(-1.2em) scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes jrpg-fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }

/* Responsive adjustments */
@media (max-width: 800px) {
	body.page-id-59 .entry-content { grid-template-columns: 1fr; }
	body.page-id-59 .entry-content > .xgm-battle,
	body.page-id-59 .entry-content > .xgmc { grid-column: 1; position: static; }
	.xgm-battle__field { grid-template-columns: 1fr; gap: 1rem; }
	.xgm-battle__side--party .xgm-battle__card { flex-direction: row; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
	.xgmc__end.is-victory, .xgmc__end.is-victory::before, .jrpg-victory-title, .jrpg-victory-title span, .xgmc__actions { animation: none; }
	.jrpg-confetti { display: none; }
}