/* Haven Gear: item cards, pop-ups and the gear table. Fixed colours so it looks the same with any theme. */
:root {
	--hg-bg: #181b23;
	--hg-raised: #20242f;
	--hg-high: #2a2f3d;
	--hg-line: #363c4e;
	--hg-text: #ebe5d4;
	--hg-muted: #9a9fae;
	--hg-gold: #e3a83e;
	--hg-gold-ink: #1d1506;
	--hg-r-common: #b8bcc8;
	--hg-r-rare: #5aa9ff;
	--hg-r-special: #c38bff;
	--hg-r-unique: #e3a83e;
	--hg-r-none: #6b7183;
}
.hg-rarity-common { --hg-r: var(--hg-r-common); }
.hg-rarity-rare { --hg-r: var(--hg-r-rare); }
.hg-rarity-special { --hg-r: var(--hg-r-special); }
.hg-rarity-unique { --hg-r: var(--hg-r-unique); }
.hg-rarity-none { --hg-r: var(--hg-r-none); }

.hg-chip {
	display: inline-block;
	padding: 0.15em 0.6em;
	margin: 0 0.35em 0.35em 0;
	border: 1px solid var(--hg-line);
	border-radius: 2px;
	font-size: 0.8em;
	letter-spacing: 0.03em;
	color: var(--hg-text);
	text-decoration: none;
	background: var(--hg-high);
}
a.hg-chip:hover { border-color: var(--hg-gold); }
.hg-chip.hg-rarity { color: var(--hg-r, var(--hg-text)); border-color: var(--hg-r, var(--hg-line)); }
.hg-chip.hg-featured { color: var(--hg-gold); border-color: var(--hg-gold); }

/* Item page card */
.haven-gear-card {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 1.25rem;
	align-items: start;
	margin: 0 0 2rem;
	padding: 1.25rem;
	color: var(--hg-text);
	background: var(--hg-raised);
	border: 1px solid var(--hg-line);
	border-left: 4px solid var(--hg-r, var(--hg-line));
	border-radius: 2px;
}
.haven-gear-card .hg-media img {
	display: block;
	width: 96px;
	height: 96px;
	object-fit: contain;
	image-rendering: pixelated;
	background: var(--hg-bg);
	border: 1px solid var(--hg-line);
	border-radius: 2px;
}
.haven-gear-card .hg-body { min-width: 0; }
.hg-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0.5rem 0 0.75rem; }
.hg-stats div { min-width: 6rem; }
.hg-stats dt { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--hg-muted); }
.hg-stats dd { margin: 0; font-size: 1.25em; font-weight: 600; font-variant-numeric: tabular-nums; }
.hg-effects { margin: 0 0 0.75rem; padding-left: 1.2em; }
.hg-effects li + li { margin-top: 0.25em; }
.hg-checked { margin: 0; font-size: 0.85em; color: var(--hg-muted); }
.hg-unchecked { color: var(--hg-gold); }
.hg-button {
	display: inline-block;
	padding: 0.55em 1em;
	border: 1px solid var(--hg-gold);
	border-radius: 2px;
	color: var(--hg-gold);
	text-decoration: none;
	font-weight: 600;
}
.hg-button:hover { background: var(--hg-gold); color: var(--hg-gold-ink); }
.hg-builds { padding-left: 1.2em; }
.hg-builds li + li { margin-top: 0.35em; }
@media (max-width: 540px) {
	.haven-gear-card { grid-template-columns: 1fr; }
}

/* Pop-up card */
.haven-gear-pop {
	position: absolute;
	z-index: 100000;
	width: min(320px, calc(100vw - 16px));
	box-sizing: border-box;
	padding: 0.85rem 0.95rem;
	background: var(--hg-raised);
	color: var(--hg-text);
	border: 1px solid var(--hg-line);
	border-top: 3px solid var(--hg-r, var(--hg-gold));
	border-radius: 2px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
	font-size: 14px;
	line-height: 1.45;
}
.haven-gear-pop[hidden] { display: none !important; }
.hgp-head { display: flex; gap: 0.7rem; align-items: center; }
.hgp-head img { width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated; background: var(--hg-bg); border: 1px solid var(--hg-line); border-radius: 2px; flex: none; }
.hgp-name { font-weight: 700; font-size: 1.05em; color: var(--hg-r, var(--hg-text)); }
.hgp-meta { font-size: 0.8em; color: var(--hg-muted); letter-spacing: 0.03em; }
.hgp-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin-top: 0.6rem; font-size: 0.9em; color: var(--hg-muted); font-variant-numeric: tabular-nums; }
.hgp-stats b { color: var(--hg-text); }
.hgp-effects { margin: 0.55rem 0 0; padding-left: 1.1em; }
.hgp-note { margin-top: 0.5rem; font-size: 0.8em; color: var(--hg-gold); }
.hgp-loading { color: var(--hg-muted); }
.hgp-open {
	display: inline-block;
	margin-top: 0.7rem;
	color: var(--hg-gold);
	font-weight: 600;
	font-size: 0.9em;
}

/* Gear table */
.haven-gear-table { margin: 1.5rem 0; }
.hgt-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.hgt-controls label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8em; color: var(--hg-muted); text-transform: uppercase; letter-spacing: 0.08em; flex: 1 1 10rem; min-width: 0; }
.hgt-controls label:first-child { flex-basis: 16rem; }
.hgt-controls input,
.hgt-controls select {
	font: inherit;
	font-size: 15px;
	text-transform: none;
	letter-spacing: normal;
	padding: 0.5em 0.6em;
	color: var(--hg-text);
	background: var(--hg-raised);
	border: 1px solid var(--hg-line);
	border-radius: 2px;
}
.hgt-controls input:focus-visible,
.hgt-controls select:focus-visible { outline: 2px solid var(--hg-gold); outline-offset: 1px; }
.hgt-count { margin: 0 0 0.5rem; font-size: 0.85em; color: var(--hg-muted); }
.hgt-scroll { overflow-x: auto; }
.hgt-scroll table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.95em; }
.hgt-scroll th,
.hgt-scroll td { padding: 0.5em 0.7em; border: 1px solid var(--hg-line); text-align: left; vertical-align: middle; }
.hgt-scroll thead th { background: var(--hg-raised); color: var(--hg-text);border-bottom: 2px solid var(--hg-gold); font-weight: 600; }
.hgt-scroll tbody tr { border-left: 3px solid var(--hg-r, transparent); }
.hgt-name { white-space: nowrap; }
.hgt-name img,
.hgt-noimg { width: 28px; height: 28px; vertical-align: middle; margin-right: 0.5em; object-fit: contain; image-rendering: pixelated; display: inline-block; background: var(--hg-bg); border: 1px solid var(--hg-line); border-radius: 2px; }
.hgt-name a { color: var(--hg-r, var(--hg-text)); font-weight: 600; }
.hgt-num { font-variant-numeric: tabular-nums; }
.hgt-empty { color: var(--hg-muted); }
@media (prefers-reduced-motion: reduce) {
	.haven-gear-pop { transition: none; }
}

/* ---------- 2.0: sections built from the game data ---------- */
.hg-flavour { margin: 0.25rem 0 0.75rem; font-style: italic; color: var(--hg-muted); }
.hg-fixed { margin: 0 0 0.5rem; }
.hg-fixed strong { color: var(--hg-r, var(--hg-gold)); }
.hg-muted { color: var(--hg-muted); }
.hg-chip.hg-arch { color: var(--hg-muted); }
.hg-chip.hg-el-fire { color: #f07a50; }
.hg-chip.hg-el-frost { color: #7cc0ea; }
.hg-chip.hg-el-lightning { color: #f0d050; }
.hg-chip.hg-el-poison { color: #8ad060; }
.hg-chip.hg-el-soul { color: #9aa8f0; }
.hg-fxi { display: inline-block; width: 22px; height: 22px; margin-right: 0.4em; vertical-align: -6px; background-repeat: no-repeat; }
.hg-notes { margin: 0 0 2rem; }
.hg-table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.hg-table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.hg-table th,
.hg-table td { padding: 0.5em 0.7em; border: 1px solid var(--hg-line); text-align: left; vertical-align: top; }
.hg-table thead th { background: var(--hg-raised); color: var(--hg-text); border-bottom: 2px solid var(--hg-gold); font-weight: 600; white-space: nowrap; }
.hg-table td { font-variant-numeric: tabular-nums; }
.hg-table tbody th { font-weight: 600; }
.hg-table small { font-weight: 400; color: var(--hg-muted); }
.hg-rolls { min-width: 560px; }
.hg-rolls td { text-align: right; white-space: nowrap; }
.hg-drops tr.hg-sure td { color: var(--hg-gold); font-weight: 600; }
.hg-stats-table td { white-space: nowrap; }
.hg-power { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.5rem; font-size: 0.9em; }
.hg-power input { width: min(320px, 60vw); accent-color: var(--hg-gold); }
.hg-note { font-size: 0.85em; color: var(--hg-muted); margin: 0 0 1.5rem; }
.hg-ench li { margin-bottom: 0.4em; }

/* ---------- 2.1: Gear hub [haven_gear_hub] ---------- */
.haven-gear-hub { color: var(--hg-text); }
.haven-gear-hub h2 { margin-top: 2.5rem; }
.haven-gear-hub h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.hgh-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; align-items: baseline; margin: 0 0 1rem; padding: 0.9rem 1.1rem; list-style: none; background: var(--hg-raised); border: 1px solid var(--hg-line); border-radius: 2px; color: var(--hg-muted); }
.hgh-stats b { color: var(--hg-gold); font-size: 1.35em; font-variant-numeric: tabular-nums; margin-right: 0.2em; }
.hgh-stats .hgh-src { margin-left: auto; font-size: 0.85em; }

.hgh-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; }
.hgh-slot { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto 1fr; column-gap: 0.75rem; padding: 0.9rem; color: var(--hg-text); text-decoration: none; background: var(--hg-raised); border: 1px solid var(--hg-line); border-radius: 2px; transition: border-color .15s, transform .15s; }
.hgh-slot:hover, .hgh-slot:focus-visible { border-color: var(--hg-gold); transform: translateY(-2px); }
.hgh-slot-img { grid-row: 1 / span 2; }
.hgh-slot-img img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; background: var(--hg-bg); border: 1px solid var(--hg-line); border-radius: 2px; display: block; }
.hgh-slot-name { font-weight: 700; color: var(--hg-gold); line-height: 1.2; }
.hgh-slot-n { font-size: 0.85em; color: var(--hg-muted); font-variant-numeric: tabular-nums; }
.hgh-slot-d { grid-column: 1 / -1; margin-top: 0.6rem; font-size: 0.85em; line-height: 1.45; color: var(--hg-muted); }

.hgh-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.75rem; }
.hgh-how > div { padding: 1rem 1.1rem; background: var(--hg-raised); border: 1px solid var(--hg-line); border-top: 3px solid var(--hg-gold); border-radius: 2px; }
.hgh-how h3 { color: var(--hg-gold); }
.hgh-how p { margin: 0; font-size: 0.92em; line-height: 1.55; }
.hgh-note { margin: 0.75rem 0 0; font-size: 0.85em; color: var(--hg-muted); }

.hgh-filters { position: sticky; top: 0; z-index: 5; display: grid; gap: 0.7rem; margin: 0 0 0.75rem; padding: 0.9rem 0 0.6rem; background: var(--wp--preset--color--base, var(--hg-bg)); border-bottom: 1px solid var(--hg-line); }
.admin-bar .hgh-filters { top: 32px; }
.hgh-filters label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--hg-muted); min-width: 0; }
.hgh-filters input, .hgh-filters select { font: inherit; font-size: 15px; text-transform: none; letter-spacing: normal; padding: 0.5em 0.6em; color: var(--hg-text); background: var(--hg-raised); border: 1px solid var(--hg-line); border-radius: 2px; min-width: 0; }
.hgh-filters input:focus-visible, .hgh-filters select:focus-visible, .hgh-chips button:focus-visible { outline: 2px solid var(--hg-gold); outline-offset: 1px; }
.hgh-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.hgh-chips button { font: inherit; font-size: 14px; padding: 0.4em 0.85em; color: var(--hg-muted); background: var(--hg-raised); border: 1px solid var(--hg-line); border-radius: 2px; cursor: pointer; }
.hgh-chips button:hover { color: var(--hg-text); border-color: var(--hg-muted); }
.hgh-chips button[aria-pressed="true"] { color: var(--hg-gold-ink); background: var(--hg-gold); border-color: var(--hg-gold); font-weight: 600; }
.hgh-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; }
.hgh-count { margin: 0; font-size: 0.85em; color: var(--hg-muted); }

.hgh-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hg-line); }
.hgh-row { display: grid; grid-template-columns: 40px minmax(180px, 1.3fr) minmax(120px, 0.9fr) minmax(110px, 0.7fr) minmax(200px, 2fr); gap: 0.4rem 1rem; align-items: center; margin: 0; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--hg-line); border-left: 3px solid var(--hg-r, transparent); }
.hgh-row:hover { background: var(--hg-raised); }
.hgh-row[hidden] { display: none; }
.hgh-ic img, .hgh-noimg { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; display: block; background: var(--hg-bg); border: 1px solid var(--hg-line); border-radius: 2px; }
.hgh-main { display: flex; flex-direction: column; min-width: 0; }
.hgh-name a { color: var(--hg-r, var(--hg-text)); font-weight: 600; text-decoration: none; }
.hgh-name a:hover { text-decoration: underline; }
.hgh-row.hg-rarity-none .hgh-name a, .hgh-row.hg-rarity-none .hgh-fx strong { color: var(--hg-text); }
.hgh-kind { font-size: 0.8em; color: var(--hg-muted); }
.hgh-tags .hg-chip { margin: 0.1em 0.25em 0.1em 0; font-size: 0.75em; }
.hgh-stat { font-size: 0.9em; font-variant-numeric: tabular-nums; color: var(--hg-text); }
.hgh-fx { font-size: 0.88em; line-height: 1.4; color: var(--hg-muted); }
.hgh-fx strong { color: var(--hg-r, var(--hg-text)); font-weight: 600; }
.hgh-fx .hg-fxi { width: 18px; height: 18px; vertical-align: -4px; }
.hgh-none { padding: 1rem 0; color: var(--hg-muted); }

.hgh-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.75rem; }
.hgh-set { padding: 0.85rem 1rem; background: var(--hg-raised); border: 1px solid var(--hg-line); border-left: 3px solid var(--hg-r, var(--hg-line)); border-radius: 2px; }
.hgh-set h3 { color: var(--hg-r, var(--hg-text)); }
.hgh-set h3 small { display: block; margin-top: 0.15rem; font-size: 0.72em; font-weight: 400; color: var(--hg-muted); }
.hgh-set ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.hgh-set li { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: 0.92em; }
.hgh-set li img, .hgh-set li .hgh-noimg { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; background: var(--hg-bg); border: 1px solid var(--hg-line); border-radius: 2px; flex: none; }
.hgh-set a { color: var(--hg-text); text-decoration: none; }
.hgh-set a:hover { color: var(--hg-gold); text-decoration: underline; }
.hgh-credit { margin-top: 2.5rem; font-size: 0.8em; color: var(--hg-muted); }

@media (max-width: 860px) {
	.hgh-row { grid-template-columns: 40px 1fr auto; grid-template-areas: "ic main stat" "ic tags tags" "ic fx fx"; align-items: start; }
	.hgh-ic { grid-area: ic; } .hgh-main { grid-area: main; } .hgh-stat { grid-area: stat; text-align: right; font-size: 0.8em; color: var(--hg-muted); }
	.hgh-tags { grid-area: tags; } .hgh-fx { grid-area: fx; }
	.hgh-tags:empty { display: none; }
	.hgh-stats .hgh-src { margin-left: 0; width: 100%; }
}
@media (max-width: 600px) {
	.hgh-filters { position: static; }
	.hgh-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
	.hgh-chips button { flex: none; }
	.hgh-selects { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .hgh-slot { transition: none; } .hgh-slot:hover { transform: none; } }
/* Line the page title and intro up with the wide hub */
body:has(.haven-gear-hub) .wp-block-post-title { max-width: var(--wp--style--global--wide-size, 1340px); }
.hg-try { margin: -1rem 0 2rem; }
