/*
 * ItsHomeopathy Repertory — front-end styles
 *
 * Every colour and radius here is drawn from the ItsHomeopathy theme's own
 * design tokens (--ih-green, --ih-cream, --ih-line and friends), with literal
 * fallbacks so the plugin still looks correct if it is ever activated on a
 * different theme. Nothing here sets a global element style, and every selector
 * is namespaced under .ihr-app, so the repertory cannot leak into or be broken
 * by the surrounding theme.
 */

.ihr-app {
	--ihr-green: var(--ih-green, #1a5c4a);
	--ihr-green-dark: var(--ih-green-dark, #124434);
	--ihr-cream: var(--ih-cream, #faf7f0);
	--ihr-ink: var(--ih-ink, #17211d);
	--ihr-muted: var(--ih-muted, #5d6f69);
	--ihr-card: var(--ih-card, #ffffff);
	--ihr-line: var(--ih-line, #e7e0d2);
	--ihr-accent: var(--ih-accent, #e9b44c);

	--ihr-radius: 16px;
	--ihr-radius-sm: 10px;
	--ihr-shadow: 0 8px 30px rgba(26, 92, 74, .08);

	/*
	 * Optional embedded height, set inline by the shortcode's height attribute.
	 * Only applies when the repertory is dropped into a fixed-height slot — on a
	 * normal page the panels size themselves and this is simply unused.
	 */
	--ihr-embed-height: auto;

	--ihr-g1: #6b7f78;
	--ihr-g2: #1a5c4a;
	--ihr-g3: #b8860b;

	display: block;
	max-width: 1160px;
	margin: 0 auto;
	padding: 8px 0 32px;
	color: var(--ihr-ink);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.6;
	font-size: 16px;
	container-type: inline-size;
}

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

.ihr-app[hidden] { display: none; }

/* ---------------------------------------------------------------- header */

.ihr-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.ihr-head__title {
	margin: 0 0 4px;
	font-size: 28px;
	line-height: 1.2;
	letter-spacing: -.02em;
	color: var(--ihr-ink);
}

.ihr-head__sub {
	margin: 0;
	color: var(--ihr-muted);
	font-size: 15px;
	max-width: 62ch;
}

.ihr-head__case { display: flex; align-items: baseline; gap: 6px; }
.ihr-case-badge__num {
	font-size: 26px;
	font-weight: 800;
	color: var(--ihr-green);
	line-height: 1;
}
.ihr-case-badge__label { font-size: 13px; color: var(--ihr-muted); font-weight: 600; }

/* ------------------------------------------------------------------ tabs */

.ihr-tabs {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	border-bottom: 1px solid var(--ihr-line);
	margin-bottom: 20px;
}

.ihr-tab {
	appearance: none;
	border: 0;
	background: transparent;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	color: var(--ihr-muted);
	padding: 10px 14px;
	border-radius: var(--ihr-radius-sm) var(--ihr-radius-sm) 0 0;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.ihr-tab:hover { color: var(--ihr-green); background: rgba(26, 92, 74, .05); }

.ihr-tab.is-active {
	color: var(--ihr-green);
	border-bottom-color: var(--ihr-green);
	background: transparent;
}

.ihr-tab:focus-visible {
	outline: 2px solid var(--ihr-green);
	outline-offset: 2px;
}

/* --------------------------------------------------------------- toolbar */

.ihr-toolbar {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 16px;
}

.ihr-search {
	position: relative;
	flex: 1 1 320px;
	min-width: 240px;
}

.ihr-search__input {
	width: 100%;
	font: inherit;
	font-size: 16px;
	padding: 13px 40px 13px 42px;
	border: 1px solid var(--ihr-line);
	border-radius: 999px;
	background: var(--ihr-card);
	color: var(--ihr-ink);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ihr-search__input:focus {
	outline: 0;
	border-color: var(--ihr-green);
	box-shadow: 0 0 0 3px rgba(26, 92, 74, .12);
}

.ihr-search__icon {
	position: absolute;
	left: 15px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--ihr-muted);
	pointer-events: none;
	display: flex;
}

.ihr-search__clear {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	border: 0;
	background: transparent;
	font-size: 20px;
	line-height: 1;
	color: var(--ihr-muted);
	cursor: pointer;
	padding: 6px 9px;
	border-radius: 50%;
}

.ihr-search__clear:hover { background: rgba(23, 33, 29, .06); color: var(--ihr-ink); }

.ihr-select {
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	padding: 12px 36px 12px 14px;
	border: 1px solid var(--ihr-line);
	border-radius: 999px;
	background: var(--ihr-card);
	color: var(--ihr-ink);
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d6f69' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.ihr-select:focus { outline: 0; border-color: var(--ihr-green); }

/* ---------------------------------------------------------------- chips */

.ihr-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.ihr-chip {
	appearance: none;
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	padding: 6px 13px;
	border: 1px solid var(--ihr-line);
	border-radius: 999px;
	background: var(--ihr-card);
	color: var(--ihr-muted);
	cursor: pointer;
	transition: all .15s ease;
}

.ihr-chip:hover { border-color: var(--ihr-green); color: var(--ihr-green); }
.ihr-chip.is-active {
	background: var(--ihr-green);
	border-color: var(--ihr-green);
	color: #fff;
}

/* --------------------------------------------------------------- groups */

.ihr-chapter-group { margin-bottom: 26px; }

.ihr-chapter-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 8px;
	margin-bottom: 10px;
	border-bottom: 1px solid var(--ihr-line);
}

.ihr-chapter-head__title {
	margin: 0;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ihr-green);
}

.ihr-chapter-head__count { font-size: 12.5px; color: var(--ihr-muted); }

/* --------------------------------------------------------------- rubrics */

.ihr-results { display: flex; flex-direction: column; gap: 8px; }

.ihr-hit {
	background: var(--ihr-card);
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius-sm);
	padding: 13px 15px;
	display: flex;
	gap: 14px;
	align-items: flex-start;
	justify-content: space-between;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ihr-hit:hover { border-color: var(--ihr-green); box-shadow: var(--ihr-shadow); }

.ihr-hit__main { min-width: 0; flex: 1; }

.ihr-hit__path {
	font-size: 15px;
	font-weight: 600;
	color: var(--ihr-ink);
	margin: 0 0 5px;
	overflow-wrap: anywhere;
}

.ihr-hit__path em {
	color: var(--ihr-green);
	font-style: normal;
	background: rgba(233, 180, 76, .22);
	border-radius: 3px;
	padding: 0 2px;
}

.ihr-hit__meta {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 12.5px;
	color: var(--ihr-muted);
	align-items: center;
}

.ihr-hit__actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

.ihr-grade-dots { display: inline-flex; gap: 3px; align-items: center; }

.ihr-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ihr-dot--g1 { background: var(--ihr-g1); }
.ihr-dot--g2 { background: var(--ihr-g2); }
.ihr-dot--g3 { background: var(--ihr-g3); width: 9px; height: 9px; }

/* --------------------------------------------------------------- buttons */

.ihr-btn {
	appearance: none;
	font: inherit;
	font-size: 13.5px;
	font-weight: 700;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid var(--ihr-green);
	background: var(--ihr-green);
	color: #fff !important;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	transition: background-color .15s ease, border-color .15s ease;
}

.ihr-btn:hover { background: var(--ihr-green-dark); border-color: var(--ihr-green-dark); }
.ihr-btn:focus-visible { outline: 2px solid var(--ihr-green); outline-offset: 2px; }

.ihr-btn--ghost {
	background: var(--ihr-card);
	color: var(--ihr-green) !important;
	border-color: var(--ihr-line);
}
.ihr-btn--ghost:hover { background: var(--ihr-cream); border-color: var(--ihr-green); }

.ihr-btn--danger {
	background: transparent;
	border-color: transparent;
	color: var(--ihr-muted) !important;
	padding: 6px 9px;
	font-size: 17px;
	line-height: 1;
}
.ihr-btn--danger:hover { background: rgba(163, 45, 45, .08); color: #a32d2d !important; }

.ihr-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- browse */

.ihr-tree { display: flex; flex-direction: column; gap: 4px; }

.ihr-node {
	border: 1px solid transparent;
	border-radius: var(--ihr-radius-sm);
	background: var(--ihr-card);
}

.ihr-node__row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 14px;
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius-sm);
	background: var(--ihr-card);
}

.ihr-node__toggle {
	appearance: none;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 12px;
	color: var(--ihr-muted);
	cursor: pointer;
	padding: 2px 4px;
	width: 22px;
	flex-shrink: 0;
	text-align: center;
}

.ihr-node__toggle[hidden] { visibility: hidden; display: block; }

.ihr-node__text {
	flex: 1;
	min-width: 0;
	font-size: 15px;
	font-weight: 500;
	overflow-wrap: anywhere;
}

.ihr-node__text--leaf { font-weight: 400; }

.ihr-node__count {
	font-size: 12px;
	color: var(--ihr-muted);
	flex-shrink: 0;
	background: var(--ihr-cream);
	border: 1px solid var(--ihr-line);
	border-radius: 999px;
	padding: 2px 9px;
}

.ihr-node__children {
	margin: 4px 0 4px 20px;
	padding-left: 12px;
	border-left: 2px solid var(--ihr-line);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* ------------------------------------------------------------- remedies */

.ihr-remedy-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
}

/* A card is now two elements, because a buy link cannot legally nest inside a
   button. The outer element carries the visual box; the inner button is the
   part you click to open the remedy, and the buy link sits beside the name. */
.ihr-remedy-card {
	position: relative;
	background: var(--ihr-card);
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius-sm);
	padding: 14px 15px;
	text-align: left;
	font: inherit;
	color: inherit;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.ihr-remedy-card:hover { border-color: var(--ihr-green); box-shadow: var(--ihr-shadow); }

/* The click target. Stretched over the card so the whole box opens the remedy,
   while staying *behind* the buy link so the link keeps its own hit area. */
.ihr-remedy-card__open {
	display: block;
	width: 100%;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

/* Name and buy link share a row; the name wraps, the link never shrinks. */
.ihr-name-row {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.ihr-remedy-card__name {
	margin: 0 0 3px;
	font-size: 15.5px;
	font-weight: 700;
	color: var(--ihr-ink);
	overflow-wrap: anywhere;
}

.ihr-remedy-card__abbr {
	font-size: 12.5px;
	color: var(--ihr-muted);
	font-style: italic;
	margin: 0 0 9px;
}

.ihr-remedy-card__stats {
	display: flex;
	gap: 10px;
	font-size: 12px;
	color: var(--ihr-muted);
	flex-wrap: wrap;
}

.ihr-remedy-card__stats strong { color: var(--ihr-green); font-size: 14px; }

/* --------------------------------------------------------- affiliate links */

.ihr-buy {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
	padding: 2px 9px;
	border: 1px solid var(--ihr-green);
	border-radius: 999px;
	background: transparent;
	color: var(--ihr-green);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-decoration: none;
	white-space: nowrap;
	transition: background .15s ease, color .15s ease;
}

.ihr-buy:hover,
.ihr-buy:focus {
	background: var(--ihr-green);
	color: #fff;
	text-decoration: none;
}

.ihr-buy:focus-visible {
	outline: 2px solid var(--ihr-accent);
	outline-offset: 2px;
}

/* Inside a card the link is small and sits on the name's baseline. */
.ihr-buy--compact { font-size: 11.5px; padding: 1px 8px; }

.ihr-buy__icon { font-size: 11px; }

/* Standalone link in the remedy view gets a bit more presence. */
.ihr-buy-row { margin-top: 10px; }

.ihr-buy-row .ihr-buy { font-size: 13px; padding: 6px 14px; }

/* The required Amazon disclosure. Quiet by design — present and legible, but
   not competing with the repertory content it sits under. */
.ihr-affiliate-note {
	margin: 10px 0 0;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--ihr-muted);
	font-style: italic;
}

.ihr-remedy-grid + .ihr-affiliate-note { margin-top: 12px; }

/* ------------------------------------------------------------- case view */

.ihr-case-empty {
	background: var(--ihr-card);
	border: 1px dashed var(--ihr-line);
	border-radius: var(--ihr-radius);
	padding: 40px 24px;
	text-align: center;
	color: var(--ihr-muted);
}

.ihr-case-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.ihr-case-item {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--ihr-card);
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius-sm);
	padding: 12px 14px;
}

.ihr-case-item__text { flex: 1; min-width: 0; font-size: 14.5px; overflow-wrap: anywhere; }

.ihr-weight {
	display: inline-flex;
	border: 1px solid var(--ihr-line);
	border-radius: 999px;
	overflow: hidden;
	flex-shrink: 0;
}

.ihr-weight button {
	appearance: none;
	border: 0;
	background: var(--ihr-card);
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	color: var(--ihr-muted);
	padding: 5px 10px;
	cursor: pointer;
}

.ihr-weight button.is-active { background: var(--ihr-green); color: #fff; }
.ihr-weight button:not(.is-active):hover { background: var(--ihr-cream); color: var(--ihr-green); }

.ihr-controls {
	display: flex;
	gap: 18px;
	flex-wrap: wrap;
	align-items: center;
	background: var(--ihr-card);
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius);
	padding: 14px 16px;
	margin-bottom: 18px;
}

.ihr-control { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ihr-muted); font-weight: 600; }
.ihr-control input[type="range"] { accent-color: var(--ihr-green); width: 130px; }

/* ------------------------------------------------------------- rankings */

.ihr-rank { display: flex; flex-direction: column; gap: 7px; }

.ihr-rank-row {
	display: flex;
	align-items: center;
	gap: 13px;
	background: var(--ihr-card);
	border: 1px solid var(--ihr-line);
	border-radius: var(--ihr-radius-sm);
	padding: 12px 15px;
}

.ihr-rank-row--top {
	border-color: var(--ihr-green);
	box-shadow: var(--ihr-shadow);
}

.ihr-rank-row__pos {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--ihr-cream);
	border: 1px solid var(--ihr-line);
	display: grid;
	place-items: center;
	font-size: 12.5px;
	font-weight: 800;
	color: var(--ihr-muted);
	flex-shrink: 0;
}

.ihr-rank-row--top .ihr-rank-row__pos {
	background: var(--ihr-green);
	border-color: var(--ihr-green);
	color: #fff;
}

.ihr-rank-row__body { flex: 1; min-width: 0; }

.ihr-rank-row__name { font-size: 15.5px; font-weight: 700; margin: 0 0 5px; }

.ihr-rank-row__meter {
	height: 6px;
	background: var(--ihr-cream);
	border-radius: 999px;
	overflow: hidden;
	border: 1px solid var(--ihr-line);
}

.ihr-rank-row__meter span {
	display: block;
	height: 100%;
	background: var(--ihr-green);
	border-radius: 999px;
	transition: width .3s ease;
}

.ihr-rank-row__stats {
	font-size: 12px;
	color: var(--ihr-muted);
	margin-top: 5px;
	display: flex;
	gap: 11px;
	flex-wrap: wrap;
}

.ihr-rank-row__score {
	font-size: 17px;
	font-weight: 800;
	color: var(--ihr-green);
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
}

.ihr-synth {
	background: var(--ihr-cream);
	border: 1px solid var(--ihr-line);
	border-left: 4px solid var(--ihr-accent);
	border-radius: var(--ihr-radius-sm);
	padding: 13px 16px;
	margin-bottom: 16px;
	font-size: 14px;
	color: var(--ihr-ink);
}

.ihr-synth strong { color: var(--ihr-green); }

.ihr-panels { min-height: 0; }

.ihr-panel { min-height: var(--ihr-embed-height); }

/* ------------------------------- utility */

.ihr-section-title {
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ihr-green);
	margin: 0 0 12px;
}

.ihr-empty {
	text-align: center;
	padding: 48px 20px;
	color: var(--ihr-muted);
	background: var(--ihr-card);
	border: 1px dashed var(--ihr-line);
	border-radius: var(--ihr-radius);
}

.ihr-empty__title { font-size: 17px; font-weight: 700; color: var(--ihr-ink); margin: 0 0 6px; }
.ihr-empty__hint { margin: 0; font-size: 14px; }

.ihr-more { margin-top: 16px; text-align: center; }

.ihr-tag {
	display: inline-block;
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--ihr-green);
	background: rgba(26, 92, 74, .08);
	border-radius: 999px;
	padding: 2px 9px;
}

.ihr-tag--warn { color: #8a6d1f; background: rgba(233, 180, 76, .2); }

.ihr-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 16px;
	color: var(--ihr-muted);
	font-size: 14px;
}

.ihr-status[hidden] { display: none; }

.ihr-status--error { color: #a32d2d; }

.ihr-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--ihr-line);
	border-top-color: var(--ihr-green);
	border-radius: 50%;
	animation: ihr-spin .7s linear infinite;
	flex-shrink: 0;
}

.ihr-spinner[hidden] { display: none; }

@keyframes ihr-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.ihr-app *, .ihr-app *::before, .ihr-app *::after {
		animation-duration: .01ms !important;
		transition-duration: .01ms !important;
	}
}

.ihr-disclaimer {
	margin-top: 26px;
	padding-top: 16px;
	border-top: 1px solid var(--ihr-line);
	font-size: 12.5px;
	color: var(--ihr-muted);
	line-height: 1.55;
}

.ihr-notice {
	border-radius: var(--ihr-radius-sm);
	padding: 14px 16px;
	font-size: 14px;
}

.ihr-notice--error {
	background: #fcebeb;
	border: 1px solid #f7c1c1;
	color: #a32d2d;
}

.ihr-hidden { display: none !important; }

/* --------------------------------------------------------------- mobile */

@container (max-width: 620px) {
	.ihr-head__title { font-size: 23px; }
	.ihr-tabs { gap: 0; }
	.ihr-tab { flex: 1 1 auto; text-align: center; padding: 10px 8px; font-size: 14px; }
	.ihr-search { flex: 1 1 100%; }
	.ihr-select { flex: 1 1 100%; }
	.ihr-hit { flex-direction: column; gap: 10px; }
	.ihr-hit__actions { width: 100%; justify-content: flex-end; }
	.ihr-remedy-grid { grid-template-columns: 1fr; }
	.ihr-controls { gap: 12px; }
	.ihr-control { flex: 1 1 100%; justify-content: space-between; }
	.ihr-control input[type="range"] { width: 45%; }
	.ihr-rank-row { gap: 10px; padding: 11px 12px; }
	.ihr-rank-row__score { font-size: 15px; }
	.ihr-node__children { margin-left: 10px; padding-left: 9px; }
}
