/**
 * Indian Summer HOA resident directory.
 *
 * Deliberately low-specificity and inheritance-friendly so it sits inside an
 * Elementor page without fighting the theme. Colours pick up the blue already
 * used on the printed directory.
 */

.idr-directory {
	--idr-blue: #355c9b;
	--idr-blue-dark: #24406e;
	--idr-amber: #ffe59a;
	--idr-line: #dfe3e8;
	--idr-text: #1f2937;
	--idr-muted: #6b7280;

	font-size: 18px;
	color: var( --idr-text );
	max-width: 100%;
}

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

/* Nothing renders above the search box, so no stray gap either. */
.idr-directory > *:first-child {
	margin-top: 0;
}

/*
 * The [hidden] attribute only sets display:none in the user-agent sheet, so
 * any author display rule silently beats it. Filtering relies on [hidden],
 * so make it authoritative — without this, hidden rows stay on screen wherever
 * a display rule applies (notably the card layout on phones).
 */
.idr-directory [hidden] {
	display: none !important;
}

.idr-heading {
	margin: 0 0 0.6em;
}

/* ------------------------------------------------------------------ */
/* Toolbar                                                             */
/* ------------------------------------------------------------------ */

.idr-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 16px;
}

.idr-searchwrap {
	flex: 1 1 320px;
	min-width: 0;
}

.idr-label {
	display: block;
	font-weight: 600;
	font-size: 0.95em;
	margin-bottom: 6px;
	color: var( --idr-text );
}

.idr-inputrow {
	position: relative;
	display: flex;
	align-items: center;
}

.idr-icon {
	position: absolute;
	left: 12px;
	width: 20px;
	height: 20px;
	fill: var( --idr-muted );
	pointer-events: none;
}

.idr-search {
	width: 100%;
	padding: 12px 44px 12px 42px;
	font-size: 1.05em;
	line-height: 1.3;
	color: var( --idr-text );
	background: #fff;
	border: 2px solid var( --idr-line );
	border-radius: 8px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.idr-search:focus {
	outline: none;
	border-color: var( --idr-blue );
	box-shadow: 0 0 0 3px rgba( 53, 92, 155, 0.18 );
}

/* Hide the browser's own clear button; we provide our own. */
.idr-search::-webkit-search-decoration,
.idr-search::-webkit-search-cancel-button,
.idr-search::-webkit-search-results-button {
	-webkit-appearance: none;
}

.idr-clear {
	position: absolute;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #eef1f5;
	cursor: pointer;
}

.idr-clear:hover {
	background: #dde3ec;
}

.idr-clear svg {
	width: 14px;
	height: 14px;
	fill: var( --idr-muted );
}

.idr-count {
	margin: 0;
	font-size: 0.95em;
	color: var( --idr-muted );
	white-space: nowrap;
	padding-bottom: 12px;
}

.idr-hint {
	display: block;
	margin-top: 6px;
	font-size: 0.82em;
	color: var( --idr-muted );
}

.idr-hint kbd {
	font-family: inherit;
	font-size: 0.95em;
	background: #f3f4f6;
	border: 1px solid var( --idr-line );
	border-bottom-width: 2px;
	border-radius: 4px;
	padding: 1px 5px;
}

/* ------------------------------------------------------------------ */
/* Table                                                               */
/* ------------------------------------------------------------------ */

/*
 * Fixed layout with explicit proportions. Left to itself the browser gives the
 * Name column roughly half the table, which leaves a wide empty gap beside
 * every name — the longest entries are nowhere near that wide.
 */
.idr-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	table-layout: fixed;
}

.idr-table th:nth-child( 1 ),
.idr-cell-name {
	width: 40%;
}

.idr-table th:nth-child( 2 ),
.idr-cell-address {
	width: 36%;
}

.idr-table th:nth-child( 3 ),
.idr-cell-type {
	width: 24%;
}

.idr-table thead th {
	padding: 0;
	background: var( --idr-blue );
	text-align: left;
	position: sticky;
	top: 0;
	z-index: 2;
}

.idr-sortbtn {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 12px 14px;
	background: none;
	border: 0;
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

.idr-sortbtn:hover {
	background: var( --idr-blue-dark );
}

.idr-sortbtn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -3px;
}

/*
 * Always show an indicator, not only on the sorted column: a control nobody
 * can see is a control nobody uses. The inactive columns get a dimmed
 * downward marker, the sorted one a solid arrow in the direction applied.
 */
.idr-arrow {
	width: 0;
	height: 0;
	flex: 0 0 auto;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top: 7px solid currentColor;
	opacity: 0.45;
}

.idr-sortable[aria-sort="ascending"] .idr-arrow,
.idr-msort[data-dir="asc"] .idr-arrow {
	opacity: 1;
	border-top: 0;
	border-bottom: 7px solid currentColor;
}

.idr-sortable[aria-sort="descending"] .idr-arrow,
.idr-msort[data-dir="desc"] .idr-arrow {
	opacity: 1;
	border-top: 7px solid currentColor;
	border-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Sort control for phones, where the column headings are not shown    */
/* ------------------------------------------------------------------ */

.idr-mobilesort {
	display: none;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	font-size: 0.95em;
}

.idr-mobilesort-label {
	color: var( --idr-muted );
}

.idr-msort {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	background: #fff;
	border: 1px solid var( --idr-line );
	border-radius: 999px;
	color: var( --idr-text );
	font: inherit;
	cursor: pointer;
}

.idr-msort[aria-pressed="true"] {
	background: var( --idr-blue );
	border-color: var( --idr-blue );
	color: #fff;
}

.idr-table tbody tr {
	border-bottom: 1px solid var( --idr-line );
}

.idr-table tbody tr.idr-alt {
	background: #f7f9fc;
}

.idr-cell {
	padding: 8px 14px;
	vertical-align: top;
	line-height: 1.35;
}

.idr-cell-address {
	white-space: nowrap;
}

.idr-cell-type {
	color: var( --idr-muted );
	font-size: 0.95em;
	white-space: nowrap;
}

.idr-directory mark {
	background: var( --idr-amber );
	color: inherit;
	padding: 1px 0;
	border-radius: 2px;
	font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* States                                                              */
/* ------------------------------------------------------------------ */

.idr-noresults {
	padding: 28px 16px;
	text-align: center;
	color: var( --idr-muted );
	background: #f7f9fc;
	border: 1px dashed var( --idr-line );
	border-radius: 8px;
}

.idr-reset {
	margin-left: 8px;
	background: none;
	border: 0;
	padding: 0;
	color: var( --idr-blue );
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.idr-updated,
.idr-privacy {
	margin: 12px 0 0;
	font-size: 0.85em;
	color: var( --idr-muted );
}

.idr-privacy {
	padding-top: 10px;
	border-top: 1px solid var( --idr-line );
	font-style: italic;
}

/* ------------------------------------------------------------------ */
/* The tally printed at the foot of the monthly report                 */
/* ------------------------------------------------------------------ */

.idr-summary {
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid var( --idr-line );
}

.idr-summary-title {
	margin: 0 0 8px;
	font-size: 0.95em;
	font-weight: 600;
	color: var( --idr-muted );
	text-transform: none;
}

.idr-summary-list {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 2px 28px;
	margin: 0;
	font-size: 0.92em;
}

.idr-summary-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 3px 0;
	border-bottom: 1px dotted var( --idr-line );
}

.idr-summary-list dt {
	margin: 0;
	color: var( --idr-muted );
}

.idr-summary-list dd {
	margin: 0;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

.idr-unavailable {
	padding: 20px;
	background: #fff8e5;
	border-left: 4px solid #d9a441;
	color: #6b5320;
}

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

/* ------------------------------------------------------------------ */
/* Phones: the table becomes a list of cards                           */
/* ------------------------------------------------------------------ */

@media ( max-width: 640px ) {
	.idr-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	/*
	 * Once the toolbar stacks, flex-basis applies to height rather than width,
	 * so the search wrapper must not keep its 320px basis or it leaves a large
	 * empty band above the results.
	 */
	.idr-searchwrap {
		flex: 0 0 auto;
	}

	.idr-count {
		padding-bottom: 0;
		margin-top: 4px;
	}

	.idr-mobilesort {
		display: flex;
		flex-wrap: wrap;
	}

	.idr-table,
	.idr-table tbody,
	.idr-table tr,
	.idr-table td {
		display: block;
		width: 100% !important;
	}

	.idr-table {
		table-layout: auto;
	}

	.idr-table thead {
		display: none;
	}

	/*
	 * Each resident is one card. The theme draws a border and a fill on every
	 * table cell, which is invisible in a normal table but stacks into three
	 * nested boxes per resident once the cells become blocks — it reads as a
	 * clutter of horizontal rules. Strip cell decoration and let the card
	 * itself carry the styling.
	 */
	.idr-directory .idr-table td,
	.idr-directory .idr-table th {
		border: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
	}

	.idr-table tbody tr {
		display: flex;
		flex-direction: column;
		margin-bottom: 10px;
		padding: 12px 14px;
		border: 1px solid var( --idr-line );
		border-radius: 8px;
		background: #fff;
	}

	/* Alternate the cards so one resident reads apart from the next. */
	.idr-table tbody tr.idr-alt {
		background: #eef3f9;
		border-color: #dbe5f0;
	}

	.idr-cell {
		padding: 2px 0;
		white-space: normal;
	}

	.idr-cell-name {
		font-weight: 600;
		font-size: 1.05em;
	}

	.idr-cell-type::before {
		content: attr( data-label ) ": ";
	}

	/* Two columns of figures do not fit a phone; stack them. */
	.idr-summary-list {
		grid-template-columns: minmax( 0, 1fr );
	}

	/*
	 * Sorting by address leads each card with the address, and gives it the
	 * heading treatment the name normally has. Without this the list reorders
	 * silently — every card still opens with a name, so the control looks as
	 * though it did nothing. The printed report worked the same way: the
	 * column it was sorted on came first.
	 */
	.idr-directory[data-sortby="address"] .idr-cell-address {
		order: -1;
		font-weight: 600;
		font-size: 1.05em;
	}

	.idr-directory[data-sortby="address"] .idr-cell-name {
		font-weight: 400;
		font-size: 1em;
	}
}

/* ------------------------------------------------------------------ */
/* Print: give residents a clean paper copy                            */
/* ------------------------------------------------------------------ */

@media print {
	.idr-toolbar,
	.idr-noresults,
	.idr-privacy {
		display: none !important;
	}

	.idr-directory {
		font-size: 11pt;
	}

	.idr-table thead th {
		position: static;
		background: #eee !important;
		color: #000 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.idr-sortbtn {
		color: #000 !important;
		padding: 6px 8px;
	}

	.idr-arrow {
		display: none;
	}

	.idr-table tbody tr {
		page-break-inside: avoid;
	}

	.idr-directory mark {
		background: none;
		font-weight: inherit;
	}
}

/* ------------------------------------------------------------------ */
/* Theme armour                                                        */
/*                                                                     */
/* Page-builder themes style every button and input on the site, and   */
/* those rules beat ours on specificity. On ishoa.org that turned the  */
/* clear button into a mystery beige box with an invisible icon, hid   */
/* the start of the placeholder behind the search icon, and repainted  */
/* the sortable column headings so the white sort arrows vanished.     */
/* These declarations are deliberately forceful for that reason.       */
/* ------------------------------------------------------------------ */

.idr-directory .idr-search {
	padding-left: 42px !important;
	padding-right: 44px !important;
	height: auto !important;
	min-height: 0 !important;
	line-height: 1.3 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

.idr-directory .idr-clear {
	width: 30px !important;
	height: 30px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	background: #eef1f5 !important;
	border: 0 !important;
	border-radius: 50% !important;
	box-shadow: none !important;
}

.idr-directory .idr-clear:hover {
	background: #dde3ec !important;
}

.idr-directory .idr-clear svg {
	width: 14px !important;
	height: 14px !important;
	fill: var( --idr-muted ) !important;
}

.idr-directory .idr-sortbtn {
	background: transparent !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 12px 14px !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	font-size: inherit !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
}

.idr-directory .idr-sortbtn:hover {
	background: var( --idr-blue-dark ) !important;
}

.idr-directory .idr-reset {
	background: transparent !important;
	border: 0 !important;
	padding: 0 !important;
	color: var( --idr-blue ) !important;
	box-shadow: none !important;
	text-transform: none !important;
}

/* ------------------------------------------------------------------ */
/* Theme armour, continued: the phone sort control                     */
/*                                                                     */
/* .idr-msort was left out of the block above, so Elementor's button   */
/* rules won on it: uppercase labels, its own padding and font size,   */
/* and a beige fill on the unpressed button. The pills grew until the  */
/* two of them could no longer share a row. text-size-adjust stops     */
/* Chrome on Android inflating the labels further on some screens.     */
/* ------------------------------------------------------------------ */

.idr-directory {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

.idr-directory .idr-mobilesort {
	flex-wrap: nowrap !important;
	gap: 8px !important;
}

.idr-directory .idr-msort {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	width: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 8px 14px !important;
	background: #fff !important;
	border: 1px solid var( --idr-line ) !important;
	border-radius: 999px !important;
	color: var( --idr-text ) !important;
	font-family: inherit !important;
	font-size: 0.95em !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	box-shadow: none !important;
}

.idr-directory .idr-msort[aria-pressed="true"] {
	background: var( --idr-blue ) !important;
	border-color: var( --idr-blue ) !important;
	color: #fff !important;
}

/*
 * Narrow phones. The pills must never wrap, so the row is nowrap — but a
 * nowrap flex row compresses its items instead, which clips the labels.
 * flex: 0 0 auto refuses the compression; the trimming below is what makes
 * the row fit without it. Measured at 280-412px and up to 1.6x text
 * scaling: the row fits at every combination, worst case 13px to spare.
 *
 * Horizontal trimming only. The pills are already 37px tall, under the
 * 44px tap target, so the vertical padding stays where it is.
 */

.idr-directory .idr-msort {
	flex: 0 0 auto !important;
}

@media ( max-width: 400px ) {
	.idr-directory .idr-mobilesort {
		gap: 6px !important;
	}

	.idr-directory .idr-msort {
		padding: 9px 10px !important;
		font-size: 0.85em !important;
		gap: 6px !important;
	}
}

/*
 * Below this the label costs more room than it earns; the arrows carry the
 * meaning. Hidden visually only — screen readers still announce it.
 */
@media ( max-width: 340px ) {
	.idr-directory .idr-mobilesort-label {
		position: absolute !important;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect( 0, 0, 0, 0 );
		white-space: nowrap;
	}
}
