/*
 * Components — Naccarato Insurance
 *
 * Reusable UI pieces. Header, mega-menu, footer, cards, carrier wall and
 * form styling arrive in their own tasks; this file starts with the button
 * system, which the design uses across the header, hero and footer.
 * Depends on tokens.css.
 */

/* ===================================================================
 * Buttons
 *
 * The design's CTA is a gold plaque with a small square notch cut from each
 * corner — measured on the footer button: 225×45 overall, with the top and
 * bottom 4px inset by 4px on each side.
 *
 * The notch is drawn on a pseudo-element rather than clipping the button
 * itself, so the keyboard focus ring stays intact.
 * =================================================================== */

.button {
	--button-notch: 4px;

	position: relative;
	z-index: 0;
	display: inline-block;
	padding: var(--space-3) var(--space-8);
	border: 0;
	background-color: transparent;
	color: var(--color-on-accent);
	font-family: var(--font-body);
	font-size: var(--fs-sm);
	font-weight: var(--fw-bold);
	letter-spacing: var(--ls-wide);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	/* The nav beside it is nowrap and squeezes this column; without this the
	   CTA breaks onto two lines and the header grows. */
	white-space: nowrap;
}

.button::before {
	position: absolute;
	z-index: -1;
	inset: 0;
	background-color: var(--color-accent);
	clip-path: polygon(
		var(--button-notch) 0,
		calc(100% - var(--button-notch)) 0,
		calc(100% - var(--button-notch)) var(--button-notch),
		100% var(--button-notch),
		100% calc(100% - var(--button-notch)),
		calc(100% - var(--button-notch)) calc(100% - var(--button-notch)),
		calc(100% - var(--button-notch)) 100%,
		var(--button-notch) 100%,
		var(--button-notch) calc(100% - var(--button-notch)),
		0 calc(100% - var(--button-notch)),
		0 var(--button-notch),
		var(--button-notch) var(--button-notch)
	);
	content: "";
	transition: background-color var(--transition-fast);
}

.button:hover,
.button:focus {
	color: var(--color-on-accent);
}

.button:hover::before,
.button:focus::before {
	background-color: var(--color-accent-hover);
}

.button--primary {
	color: var(--color-on-primary);
}

.button--primary::before {
	background-color: var(--color-primary);
}

.button--primary:hover::before,
.button--primary:focus::before {
	background-color: var(--nac-black);
}

.button--outline {
	color: var(--color-accent);
}

.button--outline::before {
	background-color: transparent;
	box-shadow: inset 0 0 0 2px var(--color-accent);
}

.button--outline:hover,
.button--outline:focus {
	color: var(--color-on-accent);
}

.button--outline:hover::before,
.button--outline:focus::before {
	background-color: var(--color-accent);
}

/* On dark bands the outline button flips to white. */
.section--primary .button--outline,
.hero .button--outline {
	color: var(--nac-white);
}

.section--primary .button--outline::before,
.hero .button--outline::before {
	box-shadow: inset 0 0 0 2px var(--nac-white);
}

.section--primary .button--outline:hover,
.section--primary .button--outline:focus,
.hero .button--outline:hover,
.hero .button--outline:focus {
	color: var(--color-primary);
}

.section--primary .button--outline:hover::before,
.section--primary .button--outline:focus::before,
.hero .button--outline:hover::before,
.hero .button--outline:focus::before {
	background-color: var(--nac-white);
}

.button--sm {
	padding: var(--space-2) var(--space-5);
	font-size: var(--fs-xs);
}

.button--lg {
	padding: var(--space-4) var(--space-10);
	font-size: var(--fs-body);
}

.button--block {
	display: block;
	width: 100%;
}

/* Service icons
 * -------------------------------------------------------------------
 * The five-icon row (Auto, Home, Business, Life, Health). Homepage
 * section 2 and the /get-a-free-quote/ hubs.
 * ------------------------------------------------------------------- */

.service-icons {
	display: grid;
	gap: var(--space-6) var(--space-4);
	/* Five across on desktop; wraps on its own below that. */
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.service-icons__item {
	margin: 0;
}

.service-icons__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	color: var(--color-heading);
	text-decoration: none;
}

.service-icons__icon {
	width: auto;
	/* ~100px in the art. */
	height: clamp(64px, calc(var(--frame-width) * 0.077), 100px);
}

.service-icons__label {
	font-family: var(--font-display);
	/* ~44px in the art — the labels are as large as a section heading. */
	font-size: clamp(1.5rem, calc(var(--frame-width) * 0.0338), 2.75rem);
	font-weight: var(--fw-black);
	letter-spacing: var(--ls-display);
	line-height: 1;
	text-transform: uppercase;
}

.service-icons__link:hover .service-icons__label,
.service-icons__link:focus .service-icons__label {
	color: var(--color-primary);
}

/* ===================================================================
 * Carrier wall
 *
 * Shared by the homepage (section 9) and /carriers/. Eight columns in the
 * art, collapsing down to two on a phone.
 *
 * The logos come from the old site at whatever size and proportion each
 * insurer published, so the box is what is held constant, not the image:
 * every logo is centred in a fixed-height cell and scaled to fit inside
 * it. Sizing by width instead would render a long wordmark as a sliver
 * next to a square badge.
 * =================================================================== */

.carrier-wall {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--space-6) var(--space-8);
	margin: var(--space-12) 0 0;
	padding: 0;
	list-style: none;
}

.carrier-wall__item {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 64px;
}

.carrier-wall__logo {
	max-width: 100%;
	max-height: 64px;
	width: auto;
	height: auto;
	object-fit: contain;
}

@media (min-width: 560px) {
	.carrier-wall {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (min-width: 900px) {
	.carrier-wall {
		grid-template-columns: repeat(6, 1fr);
	}
}

@media (min-width: 1100px) {
	/* The art's eight columns; only at a width that can hold them. */
	.carrier-wall {
		grid-template-columns: repeat(8, 1fr);
	}
}
