/*
 * HCDSB Forms — directory styles.
 *
 * HCDSB Forms plugin. Built from the prototype in ~/sites/hcdsb-forms. No
 * Bootstrap.
 *
 * Sizes are in px, never rem: the secondary sites keep a 10px root font size
 * (WordPress block spacing, Kadence and TEC size against it), so 1rem there
 * is 10px.
 *
 * Colours follow each school's --sk-* palette (HCDSB-child-theme style.css,
 * sections 10-11). Buttons use --sk-accent, never --sk-primary: every school's accent holds white text (6.9:1 or better),
 * while three primaries do not (Holy Trinity 2.5:1, Corpus Christi 3.9:1,
 * St. Kateri 4.4:1).
 *
 * Topics have no colour or icon of their own (decided 2026-10-26: too much
 * colour). The only colours on a card are the form type's: PDF red, Google
 * purple, Microsoft teal.
 */

.hcdsb-forms {
	--f-accent: var(--sk-accent, #1565c0);
	--f-accent-hover: color-mix(in srgb, var(--f-accent), #000 20%);
	--f-heading: var(--sk-heading, #1b365d);
	--f-text: #212529;
	--f-muted: #5c6670;
	--f-surface: #f4f6f9;
	--f-border: #dfe4ea;
	--f-radius: 8px;
	--f-radius-lg: 12px;
	--f-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--f-focus: 0 0 0 3px #fff, 0 0 0 5px var(--f-accent);

	/* Neutral ink for the topic pills: hover and the selected pill. */
	--f-ink: #263238;
	--f-ink-tint: #eceff1;

	/* Form types. Google Forms purple; Microsoft Forms teal, darkened from
	 * the logo's #038387 (4.6:1) to hold 4.5:1 on its tint as well. */
	--f-pdf: #b71c1c;
	--f-google: #673ab7;
	--f-microsoft: #036c70;
	/* Web links (collections that offer them): slate, so they read as neither a form service nor a PDF. */
	--f-link: #3d5a80;

	color: var(--f-text);
	font-size: 16px;
	line-height: 1.5;
	margin-block: 24px 48px;
}

.hcdsb-forms *,
.hcdsb-forms *::before,
.hcdsb-forms *::after { box-sizing: border-box; }

.hcdsb-icon { width: 20px; height: 20px; flex: none; }
.hcdsb-icon--sm { width: 16px; height: 16px; }
.hcdsb-icon--xs { width: 14px; height: 14px; }

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

/* ---------------------------------------------------------------------
 * 1. Toolbar
 * ------------------------------------------------------------------ */

.hcdsb-forms__toolbar {
	display: grid;
	gap: 20px;
	padding: 20px;
	background: var(--f-surface);
	border: 1px solid var(--f-border);
	border-radius: var(--f-radius-lg);
}

.hcdsb-forms__label {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--f-text);
}

.hcdsb-forms__search-field {
	position: relative;
	display: flex;
	align-items: center;
}
.hcdsb-forms__search-field > .hcdsb-icon {
	position: absolute;
	left: 14px;
	color: var(--f-muted);
	pointer-events: none;
}
/* Doubled up to outrank the theme's own input styles (grey fill, rem sizes). */
.hcdsb-forms .hcdsb-forms__search-field input[type="search"] {
	width: 100%;
	min-height: 48px;
	padding: 10px 48px 10px 44px;
	font: inherit;
	font-size: 17px;
	color: var(--f-text);
	background: #fff;
	border: 1px solid #b8c1cc;
	border-radius: var(--f-radius);
	appearance: none;
}
.hcdsb-forms .hcdsb-forms__search-field input::placeholder { color: var(--f-muted); opacity: 1; }
.hcdsb-forms__search-field input::-webkit-search-cancel-button { display: none; }
.hcdsb-forms .hcdsb-forms__search-field input[type="search"]:focus { outline: none; border-color: var(--f-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-accent) 25%, transparent); }

.hcdsb-forms__clear-q {
	position: absolute;
	right: 4px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: var(--f-muted);
	background: none;
	border: 0;
	border-radius: var(--f-radius);
	cursor: pointer;
}
.hcdsb-forms__clear-q:hover { color: var(--f-text); background: var(--f-surface); }
.hcdsb-forms__clear-q:focus-visible { outline: none; box-shadow: var(--f-focus); }
.hcdsb-forms__clear-q[hidden] { display: none; }

.hcdsb-forms__topics { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Topic chips: radio buttons, so the toolbar is a working GET form without JS. */
.hcdsb-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.hcdsb-chip { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.hcdsb-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hcdsb-chip > span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 6px 14px;
	font-size: 15px;
	font-weight: 600;
	color: var(--f-text);
	background: #fff;
	border: 1px solid #b8c1cc;
	border-radius: 999px;
	transition: background-color .15s, border-color .15s, color .15s;
}
.hcdsb-chip__count {
	min-width: 24px;
	padding: 0 6px;
	font-size: 13px;
	text-align: center;
	color: var(--f-muted);
	background: var(--f-surface);
	border-radius: 999px;
}
/* Hover: a 2px ink border (inset shadow, so nothing shifts) on a grey tint. */
.hcdsb-chip:hover > span { color: var(--f-ink); background: var(--f-ink-tint); border-color: var(--f-ink); box-shadow: inset 0 0 0 1px var(--f-ink); }
.hcdsb-chip:hover .hcdsb-chip__count { background: #fff; }
/* Selected: solid ink, so it reads at a glance without a colour of its own. */
.hcdsb-chip input:checked + span {
	color: #fff;
	background: var(--f-ink);
	border-color: var(--f-ink);
}
.hcdsb-chip input:checked + span .hcdsb-chip__count { color: #fff; background: rgba(255, 255, 255, .2); }
.hcdsb-chip input:focus-visible + span { box-shadow: var(--f-focus); }

.hcdsb-forms__selects {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
	gap: 12px 16px;
}
.hcdsb-field select {
	width: 100%;
	min-height: 44px;
	padding: 8px 36px 8px 12px;
	font: inherit;
	color: var(--f-text);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6670' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
	border: 1px solid #b8c1cc;
	border-radius: var(--f-radius);
	appearance: none;
}
.hcdsb-field select:focus { outline: none; border-color: var(--f-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-accent) 25%, transparent); }

.hcdsb-forms__submit,
.hcdsb-forms__reset {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	min-height: 44px;
	padding: 8px 16px;
	font: inherit;
	font-weight: 600;
	color: var(--f-accent);
	background: #fff;
	border: 1px solid currentColor;
	border-radius: var(--f-radius);
	cursor: pointer;
}
.hcdsb-forms__submit:hover,
.hcdsb-forms__reset:hover { color: #fff; background: var(--f-accent); border-color: var(--f-accent); text-decoration: none; }
.hcdsb-forms__submit:focus-visible,
.hcdsb-forms__reset:focus-visible { outline: none; box-shadow: var(--f-focus); }
.hcdsb-forms__reset[hidden] { display: none; }

/* ---------------------------------------------------------------------
 * 2. Status line
 * ------------------------------------------------------------------ */

.hcdsb-forms__status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	margin: 20px 0 8px;
	min-height: 44px;
}
.hcdsb-forms__status { margin: 0; font-weight: 600; color: var(--f-muted); }
.hcdsb-forms__status-row .hcdsb-forms__reset { min-height: 36px; padding-block: 4px; font-size: 15px; }

/* ---------------------------------------------------------------------
 * 3. Groups and cards
 * ------------------------------------------------------------------ */

.hcdsb-forms__group { margin: 0 0 40px; scroll-margin-top: 96px; }
.hcdsb-forms__group[hidden],
.hcdsb-forms__flat[hidden],
.hcdsb-forms__empty[hidden],
.hcdsb-form[hidden] { display: none; }

.hcdsb-forms__group-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	margin: 0 0 16px;
	padding-bottom: 10px;
	font-size: clamp(21px, 19.2px + .45vw, 24px);
	line-height: 1.25;
	color: var(--f-heading);
	border-bottom: 2px solid var(--f-border);
}
.hcdsb-forms__group-count {
	margin-left: auto;
	font-size: 14px;
	font-weight: 600;
	color: var(--f-muted);
}

/* Theme list styles (content.css section 1b) must not reach these lists. */
.hcdsb-forms .hcdsb-forms__list,
.hcdsb-forms .hcdsb-form__meta,
.hcdsb-forms .hcdsb-form__badges {
	margin: 0;
	padding: 0;
	list-style: none;
}
.hcdsb-forms .hcdsb-forms__list { display: grid; gap: 12px; }
.hcdsb-forms .hcdsb-forms__list > li { margin: 0; }

.hcdsb-form {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 16px 20px;
	padding: 18px 20px;
	background: #fff;
	border: 1px solid var(--f-border);
	border-radius: var(--f-radius-lg);
	box-shadow: var(--f-shadow);
	scroll-margin-top: 96px;
	transition: border-color .15s, box-shadow .15s;
}
.hcdsb-form:hover { border-color: color-mix(in srgb, var(--f-accent) 40%, var(--f-border)); }
.hcdsb-form:target { border-color: var(--f-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--f-accent) 25%, transparent); }

.hcdsb-form__kind {
	display: grid;
	place-items: center;
	align-self: start;
	gap: 2px;
	width: 64px;
	height: 56px;
	border-radius: var(--f-radius);
}
.hcdsb-form__kind img { display: block; width: 24px; height: 24px; margin-top: 6px; }
.hcdsb-form__kind-label { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.hcdsb-form__kind--pdf { color: var(--f-pdf); background: #fdecea; }
.hcdsb-form__kind--google { color: var(--f-google); background: #ede7f6; }
.hcdsb-form__kind--microsoft { color: var(--f-microsoft); background: #e0f4f4; }
.hcdsb-form__kind--link { color: var(--f-link); background: #e8eef5; }

.hcdsb-form__body { min-width: 0; }
.hcdsb-forms .hcdsb-form__title {
	margin: 0 0 4px;
	font-size: 18px;
	line-height: 1.35;
	color: var(--f-text);
}
.hcdsb-forms .hcdsb-form__desc { margin: 0 0 8px; color: var(--f-text); }

.hcdsb-forms .hcdsb-form__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 0;
	font-size: 14px;
	color: var(--f-muted);
}
.hcdsb-forms .hcdsb-form__meta li { margin: 0; }
/* After, not before: a wrapped line then ends on the dot rather than starting with it. */
.hcdsb-forms .hcdsb-form__meta li:not(:last-child)::after { content: "·"; padding: 0 8px; }

.hcdsb-forms .hcdsb-form__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hcdsb-forms .hcdsb-form__badges:empty { display: none; }
.hcdsb-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 2px 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	color: #33424f;
	background: var(--f-surface);
	border: 1px solid var(--f-border);
	border-radius: 999px;
}
.hcdsb-badge--new { color: #1b5e20; background: #e8f5e9; border-color: #a5d6a7; }

.hcdsb-forms .hcdsb-form__related {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 8px;
	margin-top: 10px;
	font-size: 14px;
}
.hcdsb-form__related-label { font-weight: 600; color: var(--f-muted); }
.hcdsb-forms .hcdsb-form__related ul { display: contents; }
.hcdsb-forms .hcdsb-form__related li { margin: 0; list-style: none; }
.hcdsb-forms .hcdsb-form__related li:not(:last-child)::after { content: ","; color: var(--f-muted); }
.hcdsb-forms .hcdsb-form__related a { color: var(--f-accent); text-decoration: underline; text-underline-offset: 2px; }
.hcdsb-forms .hcdsb-form__related a:hover { color: var(--f-accent-hover); }

.hcdsb-form__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	color: #fff;
	background: var(--f-accent);
	border: 1px solid var(--f-accent);
	border-radius: var(--f-radius);
	text-decoration: none;
	transition: background-color .15s, border-color .15s;
}
.hcdsb-form__action:hover { color: #fff; background: var(--f-accent-hover); border-color: var(--f-accent-hover); text-decoration: none; }
.hcdsb-form__action:focus-visible { outline: none; box-shadow: var(--f-focus); }
/* Online forms: outlined in the service's colour, so the button matches the logo. */
.hcdsb-form__action--google { --brand: var(--f-google); }
.hcdsb-form__action--microsoft { --brand: var(--f-microsoft); }
.hcdsb-form__action--link { --brand: var(--f-link); }
.hcdsb-form__action--google,
.hcdsb-form__action--microsoft,
.hcdsb-form__action--link { color: var(--brand); background: #fff; border-color: var(--brand); }
.hcdsb-form__action--google:hover,
.hcdsb-form__action--microsoft:hover,
.hcdsb-form__action--link:hover { color: #fff; background: var(--brand); border-color: var(--brand); }

/* ---------------------------------------------------------------------
 * 4. Empty state
 * ------------------------------------------------------------------ */

.hcdsb-forms__empty {
	padding: 40px 20px;
	text-align: center;
	background: var(--f-surface);
	border: 1px dashed #b8c1cc;
	border-radius: var(--f-radius-lg);
}
.hcdsb-forms__empty p { margin: 0 0 16px; }

/* ---------------------------------------------------------------------
 * 5. Phones
 * ------------------------------------------------------------------ */

@media (max-width: 767.98px) {
	.hcdsb-forms__toolbar { padding: 16px; }

	/* One row of chips that scrolls sideways beats five wrapped rows. */
	.hcdsb-chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin: 0 -16px;
		padding: 4px 16px;
		scrollbar-width: none;
	}
	.hcdsb-chips::-webkit-scrollbar { display: none; }
	.hcdsb-chip > span { white-space: nowrap; }

	.hcdsb-form {
		grid-template-columns: auto 1fr;
		padding: 16px;
		gap: 12px 16px;
	}
	.hcdsb-form__kind { width: 56px; height: 50px; }
	.hcdsb-form__kind-label { font-size: 10px; }
	.hcdsb-form__kind img { width: 20px; height: 20px; }
	.hcdsb-form__action { grid-column: 1 / -1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.hcdsb-forms * { transition: none !important; }
}

@media print {
	.hcdsb-forms__toolbar,
	.hcdsb-forms__status-row,
	.hcdsb-form__action { display: none; }
	.hcdsb-form { box-shadow: none; break-inside: avoid; }
}

/* No forms published yet. */
.hcdsb-forms--none p { margin: 0; padding: 24px; color: var(--f-muted); background: var(--f-surface); border-radius: var(--f-radius-lg); }
