/*
 * TCIO Treatment Schedule — brand-accented layout.
 *
 * Typography (Rubik), base text color, and link color are INHERITED from the
 * Faith theme — there are no font-family declarations here. The spacing scale
 * maps onto the theme's preset spacing tokens (with local fallbacks). The only
 * non-inherited color is a small, scoped, overridable accent layer: the brand
 * blue and the warm cream surface, both lifted from the live theme. Re-theme by
 * overriding the three --tcio-ts-* color custom properties below.
 */

.tcio-ts {
	/* Spacing — track the theme's preset scale, fall back to sane defaults. */
	--tcio-space-1: var(--wp--preset--spacing--20, 0.44rem);
	--tcio-space-2: var(--wp--preset--spacing--30, 0.67rem);
	--tcio-space-3: var(--wp--preset--spacing--40, 1rem);
	--tcio-space-4: var(--wp--preset--spacing--50, 1.5rem);
	--tcio-space-5: var(--wp--preset--spacing--60, 2.25rem);

	/* Brand accent layer (override to re-theme). */
	--tcio-ts-accent: #1e74a9;
	--tcio-ts-accent-tint: rgba(30, 116, 169, 0.08);
	--tcio-ts-surface: #f2f0e4;
	--tcio-ts-border: rgba(0, 0, 0, 0.12);
	--tcio-ts-border-soft: rgba(0, 0, 0, 0.08);
	--tcio-ts-muted: rgba(0, 0, 0, 0.6);
}

.tcio-ts section {
	margin-bottom: var(--tcio-space-5);
}

/* Section headings get a thin accent rule to tie the component together. */
.tcio-ts-heading {
	margin: 0 0 var(--tcio-space-3);
	padding-bottom: var(--tcio-space-2);
	border-bottom: 2px solid var(--tcio-ts-accent);
}

/* Section 1 — header panel. */
.tcio-ts-header {
	padding: var(--tcio-space-4);
	background: var(--tcio-ts-surface);
	border-left: 4px solid var(--tcio-ts-accent);
	border-radius: 6px;
}

.tcio-ts-title {
	margin-top: 0;
}

.tcio-ts-intro {
	margin: var(--tcio-space-2) 0 0;
	max-width: 62ch;
}

.tcio-ts-updated {
	margin: var(--tcio-space-3) 0 0;
	font-size: var(--wp--preset--font-size--small, 0.85em);
	color: var(--tcio-ts-muted);
}

.tcio-ts-empty {
	color: var(--tcio-ts-muted);
}

/* Section 2 — this month cards. */
.tcio-ts-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--tcio-space-3);
}

.tcio-ts-card {
	padding: var(--tcio-space-3);
	border: 1px solid var(--tcio-ts-border);
	border-left: 4px solid var(--tcio-ts-accent);
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

.tcio-ts-card > * {
	margin: 0;
}

.tcio-ts-card > * + * {
	margin-top: var(--tcio-space-1);
}

.tcio-ts-card-center {
	font-weight: 700;
	color: var(--tcio-ts-accent);
}

.tcio-ts-card-meta {
	display: inline-block;
	padding: 0.15em 0.6em;
	background: var(--tcio-ts-surface);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small, 0.85em);
}

.tcio-ts-card-group {
	font-weight: 600;
}

.tcio-ts-notes {
	font-style: italic;
	color: var(--tcio-ts-muted);
}

/* Section 3 — open slots. */
.tcio-ts-open-list {
	margin: 0 0 var(--tcio-space-3);
	padding: 0;
	list-style: none;
}

.tcio-ts-open-item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--tcio-space-1) var(--tcio-space-3);
	padding: var(--tcio-space-2) 0;
	border-bottom: 1px solid var(--tcio-ts-border-soft);
}

.tcio-ts-open-slot {
	font-weight: 600;
}

.tcio-ts-open-months {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--tcio-space-1);
	color: var(--tcio-ts-muted);
}

.tcio-ts-pill {
	display: inline-block;
	padding: 0.1em 0.55em;
	background: var(--tcio-ts-surface);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small, 0.85em);
	color: #181818;
}

.tcio-ts-open-contact {
	margin: 0;
	padding: var(--tcio-space-3);
	background: var(--tcio-ts-surface);
	border-left: 4px solid var(--tcio-ts-accent);
	border-radius: 6px;
}

/* Section 4 — full schedule table + filter. */
.tcio-ts-filter-label {
	display: block;
	margin-bottom: var(--tcio-space-1);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small, 0.9em);
}

.tcio-ts-filter {
	display: block;
	width: 100%;
	max-width: 340px;
	margin-bottom: var(--tcio-space-3);
	padding: var(--tcio-space-2) var(--tcio-space-3);
	border: 1px solid var(--tcio-ts-border);
	border-radius: 6px;
	font: inherit;
}

.tcio-ts-filter:focus {
	outline: none;
	border-color: var(--tcio-ts-accent);
	box-shadow: 0 0 0 3px var(--tcio-ts-accent-tint);
}

.tcio-ts-table-wrap {
	overflow-x: auto;
}

.tcio-ts-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small, 0.95em);
}

.tcio-ts-table th,
.tcio-ts-table td {
	padding: var(--tcio-space-2) var(--tcio-space-3);
	border: 1px solid var(--tcio-ts-border-soft);
	text-align: left;
	vertical-align: top;
}

.tcio-ts-table thead th {
	background: var(--tcio-ts-surface);
	font-weight: 700;
	border-bottom: 2px solid var(--tcio-ts-accent);
}

.tcio-ts-current-month {
	background: var(--tcio-ts-accent-tint);
}

.tcio-ts-table thead th.tcio-ts-current-month {
	color: var(--tcio-ts-accent);
}

.tcio-ts-open {
	font-style: italic;
	color: var(--tcio-ts-muted);
}

.tcio-ts-subnote {
	display: block;
	margin-top: 0.2em;
	font-size: 0.8em;
	color: var(--tcio-ts-muted);
}

/* Section 5 — addresses. */
.tcio-ts-addresses {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tcio-ts-address-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--tcio-space-3);
	padding: var(--tcio-space-3) 0;
	border-bottom: 1px solid var(--tcio-ts-border-soft);
}

.tcio-ts-address-row:first-of-type {
	border-top: 1px solid var(--tcio-ts-border-soft);
}

.tcio-ts-address-name {
	font-weight: 600;
}

.tcio-ts-address-detail {
	color: var(--tcio-ts-muted);
}

/* Error fallback. */
.tcio-ts-error {
	padding: var(--tcio-space-4);
	background: var(--tcio-ts-surface);
	border-left: 4px solid var(--tcio-ts-accent);
	border-radius: 6px;
}

/* Mobile: collapse grids and reflow the table into cards. */
@media (max-width: 760px) {
	.tcio-ts-grid {
		grid-template-columns: 1fr;
	}

	.tcio-ts-address-row {
		grid-template-columns: 1fr;
		gap: var(--tcio-space-1);
		padding: var(--tcio-space-3) 0;
	}

	.tcio-ts-table thead {
		display: none;
	}

	.tcio-ts-table,
	.tcio-ts-table tbody,
	.tcio-ts-table tr,
	.tcio-ts-table td {
		display: block;
		width: 100%;
	}

	.tcio-ts-table tr {
		margin-bottom: var(--tcio-space-3);
		border: 1px solid var(--tcio-ts-border);
		border-radius: 6px;
		overflow: hidden;
	}

	.tcio-ts-table td {
		display: flex;
		justify-content: space-between;
		gap: var(--tcio-space-3);
		border: none;
		border-bottom: 1px solid var(--tcio-ts-border-soft);
	}

	.tcio-ts-table td:last-child {
		border-bottom: none;
	}

	.tcio-ts-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: var(--tcio-ts-muted);
	}

	.tcio-ts-table td.tcio-ts-current-month {
		background: var(--tcio-ts-accent-tint);
	}
}
