/* ==========================================
   CSS Lesson 1: Box Model & Flow Layout Demo
   File: css-box-model-and-flow.css
   ========================================== */

/* 1. Reset & Global Box-Sizing */
*,
*::before,
*::after {
  box-sizing: border-box; /* Dàn trang nhất quán */
  margin: 0;
  padding: 0;
}

/* 2. Custom Properties (Variables) */
:root {
  --primary-color: #ec4899;
  --secondary-color: #8b5cf6;
  --bg-dark: #0f0f1b;
  --card-bg: #181825;
  --text-color: #cdd6f4;
  --border-color: #313244;
}

/* 3. Base layout style */
body {
  background-color: var(--bg-dark);
  color: var(--text-color);
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

/* 4. The Card Element (Box-sizing border-box Showcase) */
.demo-card {
  width: 320px;
  /* Kích thước thực tế hiển thị ngang sẽ đúng bằng 320px 
     bất kể padding hay border dày thế nào nhờ border-box */
  padding: 24px;
  border: 4px solid var(--border-color);
  background-color: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);

  /* Ngăn cản margin collapsing với các phần tử con */
  overflow: hidden;
}

/* 5. Heading (Block Element flow) */
.demo-card h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 6. Paragraph (Block Element flow) */
.demo-card p {
  font-size: 14px;
  line-height: 1.6;
  color: #a6adc8;
  margin-bottom: 20px;
}

/* 7. Inline-block element (Centering inside container) */
.demo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-color);
  background: rgba(236, 72, 153, 0.08);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

/* 8. Action button hover transform (Compositor-only property for 60fps) */
.demo-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.demo-btn:hover {
  transform: translateY(-2px); /* Animate cheap property transform */
}
