/**
 * YourCodeName India Directory — front-end styles.
 *
 * Scoped entirely under .ycd-* class names so nothing here can reach into the
 * host theme. Colours are drawn from custom properties, which lets a theme
 * restyle the directory by redefining four variables instead of overriding
 * dozens of rules.
 */

.ycd-wrap {
	--ycd-max-width: 1200px;
	--ycd-accent: #12496b;
	--ycd-accent-dark: #0c3450;
	--ycd-text: #1d2327;
	--ycd-muted: #5b6570;
	--ycd-border: #dcdfe3;
	--ycd-surface: #ffffff;
	--ycd-surface-alt: #f5f7f9;
	--ycd-radius: 6px;

	box-sizing: border-box;
	margin: 0 auto;
	max-width: var(--ycd-max-width);
	padding: 1.5rem 1rem 3rem;
	width: 100%;
}

.ycd-wrap *,
.ycd-wrap *::before,
.ycd-wrap *::after {
	box-sizing: inherit;
}

.ycd-main {
	color: var(--ycd-text);
}

/* Breadcrumbs ----------------------------------------------------------- */

.ycd-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
	font-size: 0.85rem;
	color: var(--ycd-muted);
}

.ycd-breadcrumbs li:not(:last-child)::after {
	content: "/";
	margin-left: 0.35rem;
	color: var(--ycd-border);
}

.ycd-breadcrumbs a {
	color: var(--ycd-accent);
	text-decoration: none;
}

.ycd-breadcrumbs a:hover,
.ycd-breadcrumbs a:focus {
	text-decoration: underline;
}

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

.ycd-page-header {
	margin-bottom: 1.5rem;
}

.ycd-title {
	font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
	line-height: 1.25;
	margin: 0 0 0.4rem;
}

.ycd-count {
	color: var(--ycd-muted);
	font-size: 0.95rem;
	margin: 0;
}

/* Search ---------------------------------------------------------------- */

.ycd-search {
	background: var(--ycd-surface-alt);
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	margin-bottom: 2rem;
	padding: 1rem;
	position: relative;
}

.ycd-search__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ycd-search__input {
	background: var(--ycd-surface);
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	flex: 1 1 16rem;
	font-size: 1rem;
	min-width: 0;
	padding: 0.7rem 0.85rem;
}

.ycd-search__input:focus {
	border-color: var(--ycd-accent);
	outline: 2px solid rgba(18, 73, 107, 0.25);
	outline-offset: 1px;
}

.ycd-search__button {
	background: var(--ycd-accent);
	border: 0;
	border-radius: var(--ycd-radius);
	color: #fff;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.7rem 1.4rem;
}

.ycd-search__button:hover,
.ycd-search__button:focus {
	background: var(--ycd-accent-dark);
}

.ycd-search__hint {
	color: var(--ycd-muted);
	font-size: 0.8rem;
	margin: 0.6rem 0 0;
}

/* Suggestions ----------------------------------------------------------- */

.ycd-suggestions {
	background: var(--ycd-surface);
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
	left: 1rem;
	max-height: 20rem;
	overflow-y: auto;
	position: absolute;
	right: 1rem;
	top: calc(100% - 2.6rem);
	z-index: 40;
}

.ycd-suggestions[hidden] {
	display: none;
}

.ycd-suggestion {
	border-bottom: 1px solid var(--ycd-border);
	color: inherit;
	cursor: pointer;
	display: block;
	padding: 0.6rem 0.85rem;
	text-decoration: none;
}

.ycd-suggestion:last-child {
	border-bottom: 0;
}

.ycd-suggestion.is-active,
.ycd-suggestion:hover {
	background: var(--ycd-surface-alt);
}

.ycd-suggestion__label {
	display: block;
	font-weight: 600;
}

.ycd-suggestion__context {
	color: var(--ycd-muted);
	display: block;
	font-size: 0.8rem;
}

.ycd-suggestions__status {
	color: var(--ycd-muted);
	font-size: 0.85rem;
	padding: 0.7rem 0.85rem;
}

/* Group grid ------------------------------------------------------------ */

.ycd-groups {
	margin-bottom: 2.5rem;
}

.ycd-groups__title {
	font-size: 1.15rem;
	margin: 0 0 0.9rem;
}

.ycd-groups__list {
	display: grid;
	gap: 0.6rem;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.ycd-groups__item a {
	align-items: center;
	background: var(--ycd-surface);
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	color: inherit;
	display: flex;
	gap: 0.75rem;
	justify-content: space-between;
	padding: 0.7rem 0.9rem;
	text-decoration: none;
}

.ycd-groups__item a:hover,
.ycd-groups__item a:focus {
	border-color: var(--ycd-accent);
}

.ycd-groups__count {
	background: var(--ycd-surface-alt);
	border-radius: 999px;
	color: var(--ycd-muted);
	font-size: 0.78rem;
	padding: 0.15rem 0.55rem;
}

/* Tables ---------------------------------------------------------------- */

.ycd-table-wrap {
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	margin-bottom: 2rem;
	overflow-x: auto;
}

.ycd-table {
	border-collapse: collapse;
	min-width: 100%;
	width: 100%;
}

.ycd-table th,
.ycd-table td {
	border-bottom: 1px solid var(--ycd-border);
	padding: 0.65rem 0.85rem;
	text-align: left;
	vertical-align: top;
}

.ycd-table thead th {
	background: var(--ycd-surface-alt);
	font-size: 0.8rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	white-space: nowrap;
}

.ycd-table tbody tr:last-child th,
.ycd-table tbody tr:last-child td {
	border-bottom: 0;
}

.ycd-table tbody tr:hover {
	background: var(--ycd-surface-alt);
}

.ycd-table a {
	color: var(--ycd-accent);
	font-weight: 600;
	text-decoration: none;
}

.ycd-table a:hover,
.ycd-table a:focus {
	text-decoration: underline;
}

/* Record detail --------------------------------------------------------- */

.ycd-detail {
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	margin-bottom: 2rem;
	overflow: hidden;
}

.ycd-detail__list {
	margin: 0;
}

.ycd-detail__row {
	border-bottom: 1px solid var(--ycd-border);
	display: grid;
	gap: 0.25rem 1rem;
	grid-template-columns: minmax(9rem, 15rem) 1fr;
	padding: 0.7rem 0.9rem;
}

.ycd-detail__row:last-child {
	border-bottom: 0;
}

.ycd-detail__row:nth-child(odd) {
	background: var(--ycd-surface-alt);
}

.ycd-detail dt {
	color: var(--ycd-muted);
	font-size: 0.85rem;
	font-weight: 600;
}

.ycd-detail dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.ycd-copy {
	align-items: center;
	display: inline-flex;
	gap: 0.5rem;
}

.ycd-copy code {
	background: var(--ycd-surface);
	border: 1px solid var(--ycd-border);
	border-radius: 4px;
	font-size: 0.95rem;
	letter-spacing: 0.04em;
	padding: 0.15rem 0.45rem;
}

.ycd-copy__button {
	background: transparent;
	border: 1px solid var(--ycd-border);
	border-radius: 4px;
	color: var(--ycd-muted);
	cursor: pointer;
	font-size: 0.75rem;
	padding: 0.2rem 0.5rem;
}

.ycd-copy__button:hover,
.ycd-copy__button:focus {
	border-color: var(--ycd-accent);
	color: var(--ycd-accent);
}

/* Search results -------------------------------------------------------- */

.ycd-result-count {
	color: var(--ycd-muted);
	margin: 0 0 1rem;
}

.ycd-result-group {
	margin-bottom: 2rem;
}

.ycd-result-group__title {
	align-items: center;
	display: flex;
	font-size: 1.1rem;
	gap: 0.6rem;
	margin: 0 0 0.75rem;
}

.ycd-badge {
	background: var(--ycd-surface-alt);
	border-radius: 999px;
	color: var(--ycd-muted);
	font-size: 0.75rem;
	font-weight: 500;
	padding: 0.15rem 0.55rem;
}

.ycd-result-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ycd-result {
	border-bottom: 1px solid var(--ycd-border);
	padding: 0.7rem 0;
}

.ycd-result:last-child {
	border-bottom: 0;
}

.ycd-result__link {
	align-items: baseline;
	color: inherit;
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	text-decoration: none;
}

.ycd-result__title {
	color: var(--ycd-accent);
	font-weight: 600;
}

.ycd-result__link:hover .ycd-result__title,
.ycd-result__link:focus .ycd-result__title {
	text-decoration: underline;
}

.ycd-result__code {
	background: var(--ycd-surface-alt);
	border-radius: 4px;
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	padding: 0.1rem 0.4rem;
}

.ycd-result__meta {
	color: var(--ycd-muted);
	display: block;
	font-size: 0.85rem;
	margin-top: 0.15rem;
}

/* Related --------------------------------------------------------------- */

.ycd-related {
	margin-bottom: 2rem;
}

.ycd-related__title {
	font-size: 1.05rem;
	margin: 0 0 0.75rem;
}

.ycd-related__list {
	display: grid;
	gap: 0.4rem;
	grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.ycd-related__list a {
	color: var(--ycd-accent);
	display: block;
	font-size: 0.92rem;
	padding: 0.3rem 0;
	text-decoration: none;
}

.ycd-related__list a:hover,
.ycd-related__list a:focus {
	text-decoration: underline;
}

.ycd-related__code {
	color: var(--ycd-muted);
	font-size: 0.8rem;
	margin-left: 0.3rem;
}

/* Stats ----------------------------------------------------------------- */

.ycd-stats {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	list-style: none;
	margin: 0 0 2rem;
	padding: 0;
}

.ycd-stats__item a {
	background: var(--ycd-surface-alt);
	border: 1px solid var(--ycd-border);
	border-radius: var(--ycd-radius);
	color: inherit;
	display: block;
	padding: 1rem;
	text-align: center;
	text-decoration: none;
}

.ycd-stats__item a:hover,
.ycd-stats__item a:focus {
	border-color: var(--ycd-accent);
}

.ycd-stats__value {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
}

.ycd-stats__label {
	color: var(--ycd-muted);
	display: block;
	font-size: 0.85rem;
}

/* Pagination ------------------------------------------------------------ */

.ycd-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 2rem;
}

.ycd-pagination__link {
	border: 1px solid var(--ycd-border);
	border-radius: 4px;
	color: var(--ycd-accent);
	display: inline-block;
	min-width: 2.25rem;
	padding: 0.4rem 0.65rem;
	text-align: center;
	text-decoration: none;
}

.ycd-pagination__link:hover,
.ycd-pagination__link:focus {
	border-color: var(--ycd-accent);
}

.ycd-pagination__link.is-current {
	background: var(--ycd-accent);
	border-color: var(--ycd-accent);
	color: #fff;
	font-weight: 600;
}

.ycd-pagination__gap {
	color: var(--ycd-muted);
	padding: 0.4rem 0.2rem;
}

/* Notices --------------------------------------------------------------- */

.ycd-empty {
	background: var(--ycd-surface-alt);
	border: 1px dashed var(--ycd-border);
	border-radius: var(--ycd-radius);
	margin-bottom: 2rem;
	padding: 2rem 1.25rem;
	text-align: center;
}

.ycd-empty p {
	margin: 0 0 0.4rem;
}

.ycd-empty__hint {
	color: var(--ycd-muted);
	font-size: 0.9rem;
	margin: 0;
}

.ycd-attribution {
	border-top: 1px solid var(--ycd-border);
	color: var(--ycd-muted);
	font-size: 0.82rem;
	margin-top: 2rem;
	padding-top: 1rem;
}

.ycd-attribution p {
	margin: 0 0 0.3rem;
}

/* Ad slots -------------------------------------------------------------- */

.ycd-ad {
	margin: 1.25rem 0;
	overflow: hidden;
	text-align: center;
}

.ycd-ad img,
.ycd-ad iframe {
	max-width: 100%;
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 600px) {
	.ycd-detail__row {
		grid-template-columns: 1fr;
	}

	.ycd-search__button {
		flex: 1 1 100%;
	}

	.ycd-suggestions {
		top: calc(100% - 3.6rem);
	}
}

/* Respect a reduced-motion preference and forced-colours mode. */

@media (prefers-reduced-motion: reduce) {
	.ycd-wrap * {
		animation: none !important;
		transition: none !important;
	}
}

@media (forced-colors: active) {
	.ycd-pagination__link.is-current,
	.ycd-search__button {
		border: 1px solid currentColor;
	}
}
