/* ==========================================================================
   A16A · LIGHT PRO MALL — "big market" homepage skin
   Loaded after quiet-luxury.css so it wins for homepage-only structures.
   Scoped / additive: only the classes emitted by front-page.php big-market
   layout are touched; nothing else on the site is affected.
   ========================================================================== */

/* -------- Portal layout -------- */
.bm-portal {
	display: grid;
	grid-template-columns: 232px 1fr 232px;
	gap: var(--sp-2);
	margin-top: var(--sp-4);
	align-items: stretch;
}
@media (max-width: 1180px) { .bm-portal { grid-template-columns: 220px 1fr; } .bm-portal .portal-right { display: none; } }
@media (max-width: 900px)  { .bm-portal { grid-template-columns: 1fr; } .bm-portal .dept { display: none; } }

/* Left dept menu */
.bm-portal .dept {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	position: relative;
	display: flex;
	flex-direction: column;
}
.bm-portal .dept-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .78rem .9rem;
	border-bottom: 1px solid var(--line);
	cursor: pointer;
	font-size: var(--fs-sm);
	font-weight: 500;
	color: var(--text-2);
	transition: all .18s;
	position: relative;
}
.bm-portal .dept-row:last-child { border-bottom: 0; }
.bm-portal .dept-row .di { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex: none; margin-right: .6rem; }
.bm-portal .dept-row .di svg { width: 16px; height: 16px; }
.bm-portal .dept-row .nm { flex: 1; }
.bm-portal .dept-row .arr { opacity: .5; font-size: .8rem; }
.bm-portal .dept-row:hover, .bm-portal .dept-row.open { background: var(--primary); color: #fff; }
.bm-portal .dept .mega {
	display: none; position: absolute; left: 100%; top: -1px; bottom: -1px; width: 262px;
	background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--primary);
	border-radius: 0 var(--radius) var(--radius) 0; z-index: 30; padding: var(--sp-3);
	box-shadow: var(--shadow-lg); overflow-y: auto;
}
.bm-portal .dept .mega.show { display: block; }
.bm-portal .mega h4 { font-size: .68rem; letter-spacing: .12em; color: var(--primary); font-weight: 800; text-transform: uppercase; padding: .35rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.bm-portal .mega a { display: block; padding: .4rem .6rem; font-size: var(--fs-sm); color: var(--text-2); border-radius: 6px; }
.bm-portal .mega a:hover { color: var(--primary); background: var(--primary-soft); }

/* Centre carousel */
.bm-portal .carousel {
	position: relative; border-radius: var(--radius); overflow: hidden; min-height: 340px; background: #1F3A93;
}
.bm-portal .carousel .slide {
	position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
	padding: var(--sp-5); color: #fff; opacity: 0; pointer-events: none;
	transition: opacity .6s var(--ease); background: linear-gradient(120deg,#1F3A93 0%,#2C4FD6 62%,#4366E8 100%);
}
.bm-portal .carousel .slide.on { opacity: 1; pointer-events: auto; }
.bm-portal .carousel .sl-tag { display: inline-block; background: rgba(255,255,255,.16); padding: .28rem .8rem; border-radius: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .08em; width: fit-content; }
.bm-portal .carousel h2 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -.01em; margin: .8rem 0 .5rem; line-height: 1.15; max-width: 16ch; color: #fff; }
.bm-portal .carousel p { opacity: .92; max-width: 42ch; font-size: var(--fs-body); }
.bm-portal .carousel .b-btn { background: #fff; color: var(--primary); font-weight: 700; padding: .8rem 1.5rem; border-radius: var(--radius-sm); margin-top: var(--sp-3); width: fit-content; transition: transform .2s; }
.bm-portal .carousel .b-btn:hover { transform: translateY(-2px); }
.bm-portal .carousel .dots { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.bm-portal .carousel .dots span { width: 16px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.4); cursor: pointer; }
.bm-portal .carousel .dots span.on { background: #fff; }

/* Right rail */
.bm-portal .portal-right { display: flex; flex-direction: column; gap: var(--sp-2); }
.bm-portal .side-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); }
.bm-portal .side-panel h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: .6rem; display: flex; align-items: center; justify-content: space-between; }
.bm-portal .side-panel h4 span { font-size: .68rem; color: var(--text-3); font-weight: 500; }
.bm-portal .side-user .hi { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; }
.bm-portal .side-user .btns { display: flex; gap: .5rem; margin-top: .8rem; }
.bm-portal .rank-mini { display: flex; flex-direction: column; gap: .55rem; }
.bm-portal .rank-mini a { display: flex; gap: .6rem; align-items: center; font-size: var(--fs-sm); color: var(--text-2); }
.bm-portal .rank-mini .no { width: 20px; height: 20px; border-radius: 5px; background: var(--bg-deep); display: flex; align-items: center; justify-content: center; font-size: .66rem; font-weight: 800; color: var(--text-2); flex: none; }
.bm-portal .rank-mini .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-portal .rank-mini .pr { margin-left: auto; color: var(--accent); font-weight: 700; flex: none; font-size: var(--fs-sm); }
.bm-portal .rank-mini .pr small { font-size: .6em; }
.bm-portal .ad-panel { border-radius: var(--radius); overflow: hidden; position: relative; background: linear-gradient(120deg,#2FA46B,#7AD1A0); color: #fff; padding: var(--sp-3); min-height: 96px; }
.bm-portal .ad-panel .ad-t { font-weight: 800; font-size: var(--fs-h4); }
.bm-portal .ad-panel .ad-s { font-size: .72rem; opacity: .92; margin-top: .2rem; }

/* -------- Flash -------- */
.bm-home .flash { display: grid; grid-template-columns: 190px 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.bm-home .flash-head { background: linear-gradient(160deg,#E5484D,#FF7A45); color: #fff; padding: var(--sp-4); display: flex; flex-direction: column; justify-content: center; }
.bm-home .flash-head .fk { font-size: 2rem; font-weight: 900; line-height: 1; }
.bm-home .flash-head h3 { font-size: var(--fs-h3); font-weight: 800; margin: .4rem 0 .2rem; color: #fff; }
.bm-home .flash-head .sub { font-size: .72rem; opacity: .92; }
.bm-home .flash-head .count { display: flex; gap: 6px; margin-top: .9rem; }
.bm-home .flash-head .count b { background: rgba(0,0,0,.28); min-width: 34px; text-align: center; padding: .25rem .4rem; border-radius: 6px; font-size: 1.05rem; font-weight: 800; }
.bm-home .flash-head .count i { font-style: normal; align-self: center; opacity: .7; font-size: .8rem; }
.bm-home .flash-grid { display: grid; grid-template-columns: repeat(5,1fr); }
.bm-home .flash-grid .pf { position: relative; padding: var(--sp-2); border-left: 1px solid var(--line); }
.bm-home .flash-grid .pf:first-child { border-left: 0; }
@media (max-width: 900px) { .bm-home .flash { grid-template-columns: 1fr; } .bm-home .flash-head { flex-direction: row; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); } .bm-home .flash-head .count { margin-top: 0; } }
@media (max-width: 640px) { .bm-home .flash-grid { grid-template-columns: repeat(2,1fr); } }

/* -------- Departments -------- */
.bm-home .zone { display: grid; grid-template-columns: 188px 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.bm-home .zone-side { background: linear-gradient(#fff,#F7F8FB); padding: var(--sp-3); display: flex; flex-direction: column; gap: .4rem; border-right: 1px solid var(--line); }
.bm-home .zone-side .zico { width: 50px; height: 50px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.bm-home .zone-side .zico svg { width: 28px; height: 28px; }
.bm-home .zone-side h3 { font-size: var(--fs-h3); font-weight: 800; line-height: 1.15; color: var(--text); }
.bm-home .zone-side .z-cn { font-size: .72rem; color: var(--text-3); }
.bm-home .zone-side .subs { margin-top: auto; display: flex; flex-direction: column; gap: .18rem; }
.bm-home .zone-side .subs a { font-size: var(--fs-xs); color: var(--text-2); padding: .18rem 0; }
.bm-home .zone-side .subs a:hover { color: var(--primary); }
.bm-home .zone-side .zgo { margin-top: .8rem; }
.bm-home .zone-body { padding: var(--sp-2); }
@media (max-width: 900px) { .bm-home .zone { grid-template-columns: 1fr; } .bm-home .zone-side { flex-direction: row; align-items: center; gap: var(--sp-2); border-right: 0; border-bottom: 1px solid var(--line); } .bm-home .zone-side .subs { display: none; } .bm-home .zone-side .zgo { margin-left: auto; margin-top: 0; } }

/* -------- Brand hall -------- */
.bm-home .brands { display: grid; grid-template-columns: repeat(6,1fr); gap: var(--sp-2); }
.bm-home .brand { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); text-align: center; font-weight: 800; letter-spacing: .04em; color: var(--text-2); transition: all .2s; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.bm-home .brand:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.bm-home .brand .bl { font-size: .78rem; font-weight: 800; }
.bm-home .brand .bs { font-size: .64rem; color: var(--text-3); font-weight: 500; }
@media (max-width: 900px) { .bm-home .brands { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 640px) { .bm-home .brands { grid-template-columns: repeat(2,1fr); } }

/* -------- Rank grid -------- */
.bm-home .rank-grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-2); }
.bm-home .rank-grid .pgrid { display: grid; grid-template-columns: repeat(5,1fr); gap: 0; }
.bm-home .rank-item { position: relative; }
.bm-home .rank-item .rank-num { position: absolute; top: 10px; left: 10px; z-index: 5; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; }
@media (max-width: 900px) { .bm-home .rank-grid .pgrid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 640px) { .bm-home .rank-grid .pgrid { grid-template-columns: repeat(2,1fr); } }

/* -------- Promo wall -------- */
.bm-home .promo-links { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-2); }
.bm-home .promo-link { border-radius: var(--radius); overflow: hidden; padding: var(--sp-4); color: #fff; font-weight: 800; position: relative; }
.bm-home .promo-link .pt { font-size: var(--fs-h4); }
.bm-home .promo-link .ps { font-size: .72rem; opacity: .9; font-weight: 500; margin-top: .2rem; }
@media (max-width: 640px) { .bm-home .promo-links { grid-template-columns: 1fr; } }

/* -------- Compact product card inside the big-market grids --------
   a16a_product_card() outputs .product-card. Inside .zone-body/.flash-grid/
   .rank-grid we compact it to match the design's tight pcard look while
   keeping all JS hooks (add-to-cart, wishlist, quick-view) intact. */
.bm-home .pgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
@media (max-width: 1000px) { .bm-home .pgrid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 640px)  { .bm-home .pgrid { grid-template-columns: repeat(2,1fr); } }

.bm-home .pgrid .product-card,
.bm-home .flash-grid .pf .product-card {
	display: flex; flex-direction: column; height: 100%;
	border: none; border-right: 1px solid var(--line); border-radius: 0;
	box-shadow: none; padding: var(--sp-2); background: transparent;
}
.bm-home .flash-grid .pf .product-card { border-right: 0; }
.bm-home .pgrid .product-card:last-child { border-right: 0; }
.bm-home .product-card:hover { background: var(--surface-2); transform: none; box-shadow: none; }
.bm-home .product-card .product-card-image { aspect-ratio: 1/1; background: linear-gradient(160deg,#F3F5F9,#E9EDF4); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.bm-home .product-card .product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.bm-home .product-card .product-card-content,
.bm-home .product-card > .product-card-info,
.bm-home .product-card > div:not(.product-card-image):not(.product-hover-actions):not(.product-badges) { padding: var(--sp-2) 0 0; }
.bm-home .product-card .product-card-title,
.bm-home .product-card .product-title { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bm-home .product-card-actions { display: flex; gap: .4rem; padding: 0; margin-top: .5rem; }
.bm-home .product-card-actions .btn { flex: 1; padding: .45rem; border-radius: 6px; font-size: var(--fs-sm); }
.bm-home .product-card .price,
.bm-home .product-card .product-price { font-weight: 800; color: var(--accent); font-size: 1.05rem; letter-spacing: -.02em; }
.bm-home .product-badges { top: 8px; left: 8px; }

/* -------- Journal -------- */
.bm-home .jgrid { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-2); }
@media (max-width: 760px) { .bm-home .jgrid { grid-template-columns: 1fr; } }
.bm-home .jcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: all .28s var(--ease); }
.bm-home .jcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.bm-home .jcard .thumb { aspect-ratio: 16/10; background: linear-gradient(160deg,#F3F5F9,#E9EDF4); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.bm-home .jcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.bm-home .jcard .body { padding: var(--sp-3); display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.bm-home .jcard .tag { font-size: .68rem; font-weight: 600; color: var(--primary); letter-spacing: .08em; }
.bm-home .jcard h3 { font-size: var(--fs-h4); line-height: 1.35; font-weight: 700; color: var(--text); }
.bm-home .jcard p { font-size: var(--fs-sm); color: var(--text-2); }
.bm-home .jcard .link-cta { margin-top: auto; padding-top: .5rem; }

/* -------- Services -------- */
.bm-home .services { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--sp-2); }
@media (max-width: 760px) { .bm-home .services { grid-template-columns: repeat(2,1fr); } }
.bm-home .service { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bm-home .service .si { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.bm-home .service .si svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.bm-home .service .st { font-size: var(--fs-sm); font-weight: 600; }
.bm-home .service .ss { font-size: var(--fs-xs); color: var(--text-3); }

/* -------- Section head consistency -------- */
.bm-home .section-head .eyebrow { display: inline-block; font-size: var(--fs-xs); letter-spacing: .14em; color: var(--primary); background: var(--primary-soft); padding: .32rem .85rem; border-radius: 6px; font-weight: 600; }
.bm-home .section-head .title { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.01em; margin-top: .4rem; color: var(--text); }
.bm-home .section-head .head-tip { font-size: var(--fs-xs); color: var(--text-3); margin-top: .2rem; }
.bm-home .link-cta { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); transition: color .25s; }
.bm-home .link-cta:hover { color: var(--primary); }
.bm-home .link-cta .arr { transition: transform .3s var(--ease); }
.bm-home .link-cta:hover .arr { transform: translateX(3px); }

/* ==========================================================================
   Mobile refinements (≤ 640px)
   The desktop big-market grids are border-joined zero-gap blocks tuned for
   wide screens. On phones that reads as cramped, edge-to-edge rows with no
   breathing room, so we switch to a clean two-column card grid with gaps,
   rounded cards, softer shadows, and trim oversized text.
   ========================================================================== */
@media (max-width: 640px) {

	/* --- Portal: carousel gets shorter, tighter text --- */
	.bm-portal .carousel { min-height: 300px; }
	.bm-portal .carousel .slide { padding: var(--sp-4); padding-bottom: 44px; }
	.bm-portal .carousel h2 { font-size: 1.5rem; }
	.bm-portal .carousel p { font-size: .82rem; max-width: 100%; }

	/* --- Product grids everywhere: gapped two-column cards --- */
	.bm-home .pgrid { gap: var(--sp-2); }
	.bm-home .zone-body { padding: var(--sp-2); }
	.bm-home .pgrid .product-card,
	.bm-home .flash-grid .pf .product-card {
		border: 1px solid var(--line);
		border-radius: var(--radius);
		box-shadow: var(--shadow-sm);
		background: var(--surface);
		padding: var(--sp-2);
	}
	.bm-home .pgrid .product-card:hover { background: var(--surface); box-shadow: var(--shadow); }
	.bm-home .product-card .product-card-image { border-radius: var(--radius-sm); }

	/* --- Flash: side header stacks, cards keep rounded card look --- */
	.bm-home .flash-head { padding: var(--sp-2) var(--sp-3); }
	.bm-home .flash-head .fk { font-size: 1.3rem; }
	.bm-home .flash-head h3 { font-size: var(--fs-h4); }
	.bm-home .flash-grid { gap: var(--sp-2); padding: var(--sp-2); }
	.bm-home .flash-grid .pf { padding: 0; border-left: 0; }
	.bm-home .flash-grid .pf .product-card { border: 1px solid var(--line); }

	/* --- Zone header: shorter label, icon smaller, CTA becomes arrow --- */
	.bm-home .zone-side { gap: var(--sp-2); }
	.bm-home .zone-side .zico { width: 40px; height: 40px; border-radius: 11px; flex: none; }
	.bm-home .zone-side .zico svg { width: 22px; height: 22px; }
	.bm-home .zone-side h3 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.bm-home .zone-side .zgo .arr { display: none; }           /* tighten the CTA link */
	.bm-home .zone-side .z-cn { display: none; }               /* drop CN subtitle on mobile */

	/* --- Brand hall: 3-across compact tiles --- */
	.bm-home .brands { grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
	.bm-home .brand { padding: var(--sp-2); }

	/* --- Rank grid: card-style --- */
	.bm-home .rank-grid { padding: var(--sp-2); }
	.bm-home .rank-grid .pgrid { gap: var(--sp-2); }

	/* --- Services: 2×2 --- */
	.bm-home .services { grid-template-columns: repeat(2, 1fr); }
	.bm-home .service { padding: var(--sp-2); gap: var(--sp-1); }
	.bm-home .service .ss { display: none; }                    /* keep tiles short */
	.bm-home .service .st { font-size: .78rem; }

	/* --- Promo wall: stacked, but keep readable padding --- */
	.bm-home .promo-links { gap: var(--sp-2); }
	.bm-home .promo-link { padding: var(--sp-3); }
}

/* Extra-small phones (≤ 400px): two columns still, but tighter card text */
@media (max-width: 400px) {
	.bm-home .pgrid .p-name,
	.bm-home .pgrid .product-card-title { font-size: .8rem; }
	.bm-home .product-card .price,
	.bm-home .product-card .product-price { font-size: .95rem; }
	.bm-home .product-card-actions .btn { font-size: .72rem; padding: .4rem .2rem; }
	.bm-home .section-head .title { font-size: 1.3rem; }
}
