/**
 * Footer
 *
 * Figma Home Page footer (y≈2696–3052)
 * Titles: Tai Heritage Pro 20/37 #B17915
 * Links: Figtree Medium 14px #0B0B0B; title→first link ~10px after lh
 * Social: ~30px icons, gap ~26px
 * Store badges: 122×34; QR: 98×98
 * Copyright: 14/28, opacity 50%; legal: 14/28 #0B0B0B
 */

.footer {
	width: 100%;
	max-width: none;
	background: var(--color-white);
	padding: var(--footer-pad-top) 0 0;
	box-sizing: border-box;
}

.footer__container {
	width: 100%;
	max-width: var(--header-content-max);
	margin: 0 auto;
	padding: 0 32px;
	box-sizing: border-box;
}

.footer__top {
	display: grid;
	grid-template-columns: 341.3fr 177fr 231fr 175.7fr 259fr;
	gap: 40px 48px;
	align-items: flex-start;
}

/* Figma insets the brand block to x99 rather than flushing it to the x32
   content edge (logo 18:392, socials 18:411). */
.footer__brand {
	padding-left: 67px;
}

.footer__brand .custom-logo-link,
.footer__logo .custom-logo-link,
.footer__logo-link {
	display: inline-block;
	line-height: 0;
}

.footer__brand img,
.footer__logo .custom-logo,
.footer__logo-img {
	width: 194px;
	height: auto;
	max-width: 100%;
	margin-bottom: 0;
	object-fit: contain;
}

.footer__logo-fallback {
	display: inline-block;
	margin-bottom: 0;
	font-family: var(--font-heading);
	font-size: 28px;
	color: var(--color-accent);
	text-decoration: none;
}

.footer__description {
	max-width: 280px;
	margin: 16px 0 0;
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 28px;
	color: var(--color-footer-desc);
}

.footer__social {
	display: flex;
	align-items: center;
	gap: 26px;
	margin-top: 28px;
}

.footer__social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	color: var(--color-heading);
	line-height: 0;
	transition: opacity 0.25s ease;
}

.footer__social a:hover,
.footer__social a:focus {
	opacity: 0.7;
	outline: none;
}

.footer__social img,
.footer__social svg {
	width: 30px;
	height: 30px;
	display: block;
	object-fit: contain;
}

/* Figma drops the four column headings to y2711 while the brand logo starts at
   y2696.29 — a 15px offset on an otherwise top-aligned row. */
.footer__title {
	margin: 15px 0 10px;
	font-family: var(--font-heading);
	font-size: 20px;
	font-weight: 400;
	line-height: 37px;
	color: var(--color-accent);
}

/*
 * Accordion control. Above the mobile breakpoint this is the column heading and
 * nothing more — the button resets to inherit the h3's type and sits inert.
 */
.footer__toggle {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: default;
}

.footer__toggle-icon {
	display: none;
}

.footer__links {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.footer__links a {
	display: block;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 17px;
	color: var(--color-heading);
	text-decoration: none;
	transition: color 0.25s ease;
}

.footer__links a:hover,
.footer__links a:focus {
	color: var(--color-accent);
	outline: none;
}

.footer__apps {
	display: flex;
	flex-direction: column;
	gap: 10px; /* Figma badge pitch 44px on 34.07px badges */
	padding-top: 10px; /* heading bottom 2748 → App Store 2768.45 */
}

.footer__store {
	width: 122px;
	display: block;
	line-height: 0;
	transition: opacity 0.25s ease;
}

.footer__store:hover,
.footer__store:focus {
	opacity: 0.85;
	outline: none;
}

.footer__store img {
	width: 100%;
	height: auto;
	display: block;
}

.footer__qr {
	width: 98px;
	margin-top: 26px; /* Google Play bottom 2846 → QR top 2872 */
}

.footer__qr img {
	width: 100%;
	height: auto;
	display: block;
}

.footer__bottom {
	width: 100%;
	margin-top: 42px;
	border-top: 1px solid var(--color-footer-border);
	padding: 10px 0 0;
	box-sizing: border-box;
}

.footer__bottom-inner {
	width: 100%;
	max-width: var(--header-content-max);
	margin: 0 auto;
	padding: 0 32px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	box-sizing: border-box;
}

.footer__copyright {
	margin: 0;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 28px;
	color: var(--color-heading);
	opacity: 0.5;
}

.footer__legal {
	display: flex;
	gap: 35px;
}

.footer__legal a {
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 28px;
	color: var(--color-heading);
	text-decoration: none;
	transition: color 0.25s ease;
}

.footer__legal a:hover,
.footer__legal a:focus {
	color: var(--color-accent);
	outline: none;
}

@media (max-width: 1024px) {
	.footer {
		padding-top: 60px;
	}

	/*
	 * The five desktop columns do not fit here, but the four link columns want
	 * only 533px of content between them (80 + 133 + 100 + 220) — so the brand
	 * takes a row of its own and the links keep the design's single aligned row
	 * beneath it, rather than folding into a 2x2 that stranded every column
	 * against half a page of empty gutter.
	 *
	 * `auto` tracks, not `1fr`: the columns size to their content, which keeps
	 * the 220px "Download the IKEEN App" title on one line so the four headings
	 * stay on a baseline. `space-between` then spends the slack on the gaps.
	 */
	.footer__top {
		grid-template-columns: repeat(4, auto);
		justify-content: space-between;
		gap: 48px 32px;
	}

	/*
	 * On a row of its own the brand would otherwise sit hard left with the
	 * whole rest of the row empty beside it. Centre the mark and the social
	 * icons, the same way the stacked mobile footer below does.
	 */
	.footer__brand {
		grid-column: 1 / -1;
		padding-left: 0;
		text-align: center;
	}

	.footer__description {
		margin-left: auto;
		margin-right: auto;
	}

	.footer__social {
		justify-content: center;
	}

	.footer__apps {
		align-items: flex-start;
	}
}

@media (max-width: 768px) {
	.footer {
		padding-top: 50px;
	}

	.footer__container {
		padding: 0 20px;
	}

	/*
	 * `align-items: flex-start` carries over from the desktop grid, and in a
	 * column flex container it shrink-wraps every child to its content width
	 * (the brand block to 194px, the apps column to 220px of a 350px track).
	 * Stretching them back to full width is what lets the logo centre and the
	 * QR sit against the right edge below.
	 */
	.footer__top {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		/* Reset the tablet row's distribution — in a column flex container it
		   would spread the stack vertically instead of the columns across. */
		justify-content: flex-start;
		gap: 0;
	}

	/* The 15px heading offset only exists to match the desktop row; stacked it
	   just doubles the gap between columns. */
	.footer__title {
		margin: 0;
	}

	.footer__brand {
		grid-column: auto;
		padding-left: 0;
		padding-bottom: 32px;
		text-align: center;
	}

	.footer__description {
		margin-left: auto;
		margin-right: auto;
	}

	.footer__social {
		gap: 22px;
		justify-content: center;
	}

	/* --- Collapsible menu columns --- */

	.footer__column--menu {
		border-top: 1px solid var(--color-footer-border);
	}

	.footer__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 16px 0;
		cursor: pointer;
	}

	.footer__toggle:focus-visible {
		outline: 2px solid var(--color-accent);
		outline-offset: 2px;
	}

	/* Chevron drawn from two borders so it needs no asset. */
	.footer__toggle-icon {
		display: block;
		flex-shrink: 0;
		width: 9px;
		height: 9px;
		margin-bottom: 4px;
		border-right: 2px solid var(--color-accent);
		border-bottom: 2px solid var(--color-accent);
		transform: rotate(45deg);
		transition: transform 0.25s ease, margin 0.25s ease;
	}

	.footer__toggle[aria-expanded="true"] .footer__toggle-icon {
		margin-top: 4px;
		margin-bottom: 0;
		transform: rotate(-135deg);
	}

	.footer__panel {
		padding-bottom: 20px;
	}

	/* --- App column --- */

	/*
	 * Heading spans the row; the store badges and the QR then sit side by side
	 * under it, QR against the right gutter. Stacked they cost ~180px of
	 * scroll for two elements that read better as a pair.
	 */
	.footer__column--apps {
		display: grid;
		grid-template-areas:
			"title title"
			"apps  qr";
		grid-template-columns: auto auto;
		justify-content: space-between;
		align-items: center;
		gap: 0 16px;
		border-top: 1px solid var(--color-footer-border);
		padding: 16px 0 4px;
	}

	.footer__column--apps .footer__title {
		grid-area: title;
		margin-bottom: 16px;
	}

	.footer__apps {
		grid-area: apps;
		padding-top: 0;
	}

	.footer__qr {
		grid-area: qr;
		margin-top: 0;
	}

	.footer__bottom-inner {
		padding: 0 20px;
		flex-direction: column;
		gap: 14px;
		text-align: center;
	}

	.footer__legal {
		gap: 24px;
		justify-content: center;
	}
}
