/*
 * Bufan homepage (front-page.php only). Loaded after main.css and redesign.css.
 * Idea: unbleached canvas, ink-indigo, one embroidery-yellow. The page is a product wall;
 * the hero is a wall of real product photos multiplied into the canvas; the single orchestrated motion is the wall hanging itself, piece by piece.
 */

.hm-hero,
.hm-sec,
.hm-factory,
.hm-quote {
	--hm-canvas: #ece9e1;
	--hm-paper: #f6f4ef;
	--hm-ink: #0d122e;
	--hm-denim: #16204f;
	--hm-mute: #5f6378;
	--hm-thread: #f5b800;
	--hm-line: rgba(13, 18, 46, 0.14);
	--hm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	color: var(--hm-ink);
}

.home .site-main { background: var(--hm-canvas); }

.hm-wrap {
	width: 100%;
	max-width: 1360px;
	margin-inline: auto;
	padding-inline: clamp(18px, 4vw, 56px);
}

.hm-kicker {
	margin: 0 0 28px;
	font-size: 14px;
	letter-spacing: 0.04em;
	color: var(--hm-mute);
}

.hm-h2 {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: clamp(1.9rem, 3.6vw, 3.2rem);
	line-height: 1.08;
	letter-spacing: -0.025em;
	max-width: 18ch;
}

.hm-link {
	font-size: 15px;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
	border-bottom: 1.5px solid currentColor;
	padding-bottom: 2px;
	transition: color 0.2s, border-color 0.2s;
}
.hm-link:hover { color: var(--hm-denim); border-color: var(--hm-thread); }
.hm-link--light:hover { color: var(--hm-thread); }

/* Buttons */
.hm-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 17px 30px;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 2px;
	border: 1.5px solid var(--hm-ink);
	transition: background-color 0.25s, color 0.25s, transform 0.25s var(--hm-ease);
}
.hm-btn--solid { background: var(--hm-ink); color: #fff; }
.hm-btn--solid:hover { background: var(--hm-thread); color: var(--hm-ink); border-color: var(--hm-thread); }
.hm-btn--solid .icon { transition: transform 0.25s var(--hm-ease); }
.hm-btn--solid:hover .icon { transform: translateX(4px); }
.hm-btn--line { color: var(--hm-ink); }
.hm-btn--line:hover { background: var(--hm-ink); color: #fff; }
.hm-btn:focus-visible,
.hm-link:focus-visible,
.hm-tile:focus-visible,
.hm-cat a:focus-visible,
.hm-quote__link:focus-visible { outline: 3px solid var(--hm-thread); outline-offset: 4px; }

/* ---------- Hero ---------- */
.hm-hero { padding: clamp(36px, 6vw, 84px) 0 0; background: var(--hm-canvas); overflow: hidden; }
.hm-hero__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(32px, 4vw, 72px);
	align-items: center;
}
.hm-hero__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(2.6rem, 6.4vw, 6rem);
	line-height: 1;
	letter-spacing: -0.04em;
	text-wrap: balance;
}
.hm-hero__text {
	margin: 32px 0 0;
	max-width: 46ch;
	font-size: clamp(1rem, 1.3vw, 1.15rem);
	line-height: 1.65;
	color: var(--hm-mute);
}
.hm-hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }

/* Product wall: real photos on pure white, multiplied into the canvas so each pouch sits
   directly on the page. The middle column drops a little so the wall reads as hung, not gridded. */
.hm-wall {
	list-style: none;
	margin: 0 auto;
	padding: 0;
	width: 100%;
	max-width: 660px;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(2px, 0.6vw, 10px);
	align-items: start;
}
.hm-wall__item { mix-blend-mode: multiply; }   /* on the item, not the img: the entrance animation isolates the img */
.hm-wall__item:nth-child(3n + 2) { margin-top: clamp(28px, 5vw, 72px); }
.hm-wall__item a {
	display: block;
	aspect-ratio: 5 / 4;
	transition: transform 0.5s var(--hm-ease);
}
.hm-wall__item a:hover,
.hm-wall__item a:focus-visible { transform: translateY(-8px) rotate(-1.5deg); }
.hm-wall__item a:focus-visible { outline: 3px solid var(--hm-thread); outline-offset: 4px; }
.hm-wall img { width: 100%; height: 100%; object-fit: cover; display: block; }

@keyframes hm-pop { to { opacity: 1; transform: none; } }

.hm-in { opacity: 0; transform: translateY(18px); animation: hm-pop 0.8s calc(0.1s + var(--d, 0) * 0.12s) var(--hm-ease) forwards; }

/* Numbers */
.hm-nums {
	list-style: none;
	margin: clamp(48px, 7vw, 96px) 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	border-top: 1.5px solid var(--hm-ink);
}
.hm-nums li { padding: 22px 24px 30px 0; }
.hm-nums li + li { padding-left: 24px; border-left: 1px solid var(--hm-line); }
.hm-nums strong {
	display: block;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: clamp(2.2rem, 4.4vw, 4rem);
	line-height: 1;
	letter-spacing: -0.04em;
	font-variant-numeric: tabular-nums;
}
.hm-nums small { font-size: 0.34em; font-weight: 500; letter-spacing: 0; margin-left: 6px; color: var(--hm-mute); }
.hm-nums span { display: block; margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--hm-mute); max-width: 22ch; }

/* ---------- Sections ---------- */
.hm-sec { padding: clamp(64px, 9vw, 128px) 0; background: var(--hm-canvas); }
.hm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: clamp(28px, 4vw, 56px); }

/* Product wall */
.hm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(14px, 1.8vw, 28px) clamp(12px, 1.4vw, 20px); }
.hm-tile { display: block; color: inherit; text-decoration: none; }
.hm-tile__img { display: block; aspect-ratio: 1; overflow: hidden; background: var(--hm-paper); }
.hm-tile__img img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; transition: transform 0.7s var(--hm-ease); }
.hm-tile:hover .hm-tile__img img { transform: scale(1.04); }
.hm-tile__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 14px; }
.hm-tile__name { font-weight: 600; font-size: 16px; line-height: 1.3; background: linear-gradient(var(--hm-thread), var(--hm-thread)) 0 100% / 0 2px no-repeat; transition: background-size 0.35s var(--hm-ease); }
.hm-tile:hover .hm-tile__name { background-size: 100% 2px; }
.hm-tile__moq { font-size: 13px; color: var(--hm-mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hm-tile__cat { display: block; margin-top: 4px; font-size: 13px; color: var(--hm-mute); }

/* Range: typographic list, thumbnail follows the hovered row */
.hm-sec--cats { padding-top: 0; }
.hm-cats { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--hm-ink); }
.hm-cat { border-bottom: 1px solid var(--hm-line); }
.hm-cat a {
	position: relative;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 24px;
	padding: clamp(18px, 2.4vw, 32px) 0;
	color: inherit;
	text-decoration: none;
	transition: padding 0.4s var(--hm-ease);
}
.hm-cat__name { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4.4vw, 3.8rem); letter-spacing: -0.03em; line-height: 1.05; }
.hm-cat__count { font-size: 14px; color: var(--hm-mute); }
.hm-cat__thumb {
	position: absolute;
	right: 22%;
	top: 50%;
	width: clamp(96px, 11vw, 160px);
	aspect-ratio: 1;
	overflow: hidden;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-50%) rotate(-4deg) scale(0.9);
	transition: opacity 0.3s, transform 0.5s var(--hm-ease);
	box-shadow: 0 18px 40px -18px rgba(13, 18, 46, 0.55);
}
.hm-cat__thumb { background: var(--hm-paper); }
.hm-cat__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.hm-cat a:hover { padding-left: 18px; }
.hm-cat a:hover .hm-cat__thumb,
.hm-cat a:focus-visible .hm-cat__thumb { opacity: 1; transform: translateY(-50%) rotate(-4deg) scale(1); }

/* Factory */
.hm-factory { background: var(--hm-denim); color: #eceaf5; padding: clamp(64px, 9vw, 128px) 0; }
.hm-factory__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 112px); align-items: center; }
.hm-factory__media { overflow: hidden; background: #0d1538; }
.hm-factory__media img { width: 100%; display: block; }
.hm-factory__media--duo { position: relative; aspect-ratio: 1; background: none; overflow: visible; }
.hm-factory__media .hm-factory__shot { position: absolute; width: auto; height: auto; object-fit: cover; box-shadow: 0 34px 60px -34px rgba(0, 0, 0, 0.7); }
.hm-factory__media .hm-factory__shot--1 { left: 0; top: 0; width: 68%; height: 78%; }
.hm-factory__media .hm-factory__shot--2 { right: 0; bottom: 0; width: 54%; height: 58%; border: 10px solid var(--hm-denim); }
.hm-factory .hm-h2 { color: #fff; }
.hm-prose { margin: 28px 0 32px; max-width: 52ch; font-size: 1.05rem; line-height: 1.75; color: rgba(236, 234, 245, 0.82); }
.hm-prose p { margin: 0 0 1em; }

/* Process: a thread runs through the four steps and fills as they scroll in */
.hm-flow { background: var(--hm-paper); }
.hm-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(20px, 3vw, 48px); position: relative; counter-reset: s; }
.hm-steps::before,
.hm-steps::after { content: ""; position: absolute; left: 0; top: 22px; height: 0; border-top: 2px dashed var(--hm-ink); width: 100%; opacity: 0.18; }
.hm-steps::after { opacity: 1; border-color: var(--hm-ink); width: calc(var(--p, 0) * 100%); transition: width 1.4s cubic-bezier(0.5, 0, 0.2, 1); }
.hm-step { position: relative; padding-top: 64px; }
.hm-step__n {
	position: absolute; top: 0; left: 0;
	width: 46px; height: 46px; display: grid; place-items: center;
	border-radius: 50%; background: var(--hm-paper); border: 2px solid var(--hm-ink);
	font-family: var(--font-display); font-weight: 700; font-size: 18px;
	transition: background-color 0.4s, border-color 0.4s;
}
.hm-step.is-lit .hm-step__n { background: var(--hm-thread); border-color: var(--hm-thread); }
.hm-step h3 { margin: 0 0 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em; }
.hm-step p { margin: 0; max-width: 30ch; font-size: 15px; line-height: 1.65; color: var(--hm-mute); }

/* Big quote link */
.hm-quote { background: var(--hm-thread); padding: clamp(40px, 6vw, 88px) 0; }
.hm-quote__link {
	display: flex; align-items: center; justify-content: space-between; gap: 24px;
	color: var(--hm-ink); text-decoration: none;
	font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 10vw, 9rem); line-height: 1; letter-spacing: -0.05em;
}
.hm-quote__link svg { width: 0.8em; height: 0.8em; flex: none; transition: transform 0.4s var(--hm-ease); }
.hm-quote__link:hover svg { transform: translateX(0.18em); }

/* The inquiry form section keeps its markup; sit it on the same canvas */
.home .section--inquiry { background: var(--hm-canvas, #ece9e1); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.hm-hero__grid,
	.hm-factory__grid { grid-template-columns: 1fr; }
	.hm-wall { max-width: 460px; margin-top: 12px; }
	.hm-nums { grid-template-columns: 1fr 1fr; }
	.hm-nums li:nth-child(3) { padding-left: 0; border-left: 0; }
	.hm-nums li:nth-child(n+3) { border-top: 1px solid var(--hm-line); }
	.hm-grid { grid-template-columns: 1fr 1fr; }
	.hm-steps { grid-template-columns: 1fr 1fr; row-gap: 40px; }
	.hm-steps::before, .hm-steps::after { display: none; }
	.hm-cat__thumb { display: none; }
}
@media (max-width: 520px) {
	.hm-steps { grid-template-columns: 1fr; }
	.hm-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
	.hm-in { opacity: 1; transform: none; animation: none; }
	.hm-wall__item a { transition: none; }
	.hm-steps::after { transition: none; }
}

@media (max-width: 600px) {
	.hm-hero__actions .hm-btn { flex: 1 1 100%; justify-content: center; }
}
