/* =====================================================================
   Blakletterpress — Trang khuyến mãi thiệp Tết 2026
   BÀI TẬP 1 — CSS ĐÃ ĐƯỢC TÌM VÀ SỬA LỖI (Box model + Position)
   ===================================================================== */

/* SỬA LỖI 1: Thêm box-sizing: border-box toàn cục để padding và border
   không làm tăng kích thước thực tế của phần tử, tránh vỡ layout flex */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: "Segoe UI", Arial, sans-serif;
	color: #222;
	background: #f4f1ea;
	line-height: 1.5;
}

a {
	color: inherit;
}

/* ===== Header / thanh điều hướng ===== */
/* SỬA LỖI 2: position: sticky bắt buộc phải có thuộc tính vị trí (top: 0)
   để xác định điểm dính khi cuộn. Thêm z-index: 100 để luôn nổi trên ảnh hero */
.site-header {
	background: #2b2b2b;
	position: sticky;
	top: 0;
	z-index: 100;
}

.header-inner {
	max-width: 1000px;
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.brand {
	color: #fff;
	font-size: 24px;
	font-weight: bold;
	text-decoration: none;
}

.main-nav ul {
	list-style: none;
	display: flex;
	gap: 24px;
}

.main-nav a {
	color: #ddd;
	text-decoration: none;
}

.main-nav a:hover {
	color: #fff;
}

/* ===== Hero ===== */
/* SỬA LỖI 3: Thêm position: relative cho .hero để làm mốc tọa độ
   cho phần tử con .hero-overlay (position: absolute) căn giữa chính xác */
.hero {
	position: relative;
	height: 360px;
	overflow: hidden;
}

/* SỬA LỖI 4: Thêm object-fit: cover để ảnh phủ kín khung 360px
   mà không bị méo hoặc sai tỉ lệ khung hình */
.hero-bg {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero-overlay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80%;
	max-width: 560px;
	text-align: center;
	color: #fff;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
	z-index: 5;
}

.hero-overlay h1 {
	font-size: 34px;
	margin-bottom: 12px;
}

.hero-overlay p {
	font-size: 18px;
	margin-bottom: 20px;
}

.hero-btn {
	display: inline-block;
	padding: 12px 28px;
	background: #c0392b;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
}

/* ===== Khu sản phẩm ===== */
.products {
	max-width: 1000px;
	margin: 48px auto;
	padding: 0 24px;
}

.products h2 {
	margin-bottom: 24px;
	font-size: 28px;
}

.card-list {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}

/* SỬA LỖI 5:
   - Thêm position: relative để làm mốc tọa độ cho nhãn .badge (position: absolute)
   - Đổi height: 300px thành min-height: 320px để nội dung chữ và giá không bị tràn ra ngoài thẻ */
.card {
	flex: 0 0 calc((100% - 48px) / 3);
	position: relative;
	min-height: 320px;
	background: #fff;
	border: 1px solid #e0d8c8;
	border-radius: 8px;
	padding: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* SỬA LỖI 6: Thêm z-index: 2 để nhãn -20% luôn nổi lên trên ảnh sản phẩm */
.badge {
	position: absolute;
	top: 12px;
	right: 12px;
	background: #c0392b;
	color: #fff;
	font-size: 14px;
	font-weight: bold;
	padding: 4px 10px;
	border-radius: 20px;
	z-index: 2;
}

/* SỬA LỖI 7: Thêm kích thước và object-fit cho ảnh sản phẩm để nằm gọn trong thẻ */
.card img {
	display: block;
	width: 100%;
	height: 180px;
	object-fit: cover;
	border-radius: 4px;
}

.card-body h3 {
	margin: 12px 0 8px;
	font-size: 20px;
}

.card-body p {
	margin-bottom: 8px;
	font-size: 15px;
	color: #555;
}

.card-body .price {
	color: #c0392b;
	font-weight: bold;
	font-size: 18px;
}

/* ===== Nút lên đầu trang ===== */
/* SỬA LỖI 8: Sửa top: 24px thành bottom: 24px để nút cố định ở góc DƯỚI bên phải màn hình.
   Thêm z-index: 200 để nút luôn nổi trên mọi thành phần khi cuộn */
.back-to-top {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 48px;
	height: 48px;
	background: #2b2b2b;
	color: #fff;
	text-align: center;
	line-height: 48px;
	font-size: 22px;
	text-decoration: none;
	border-radius: 50%;
	z-index: 200;
}

/* ===== Footer ===== */
.site-footer {
	margin-top: 48px;
	padding: 32px 24px;
	background: #2b2b2b;
	color: #cfcfcf;
	text-align: center;
	font-size: 14px;
}
