/* ===============================================
   COMP3421 — Lab 8: Responsive Design & CSS Sprites
   Student practice template.
   =============================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

:root {
  --space: 8px;
  --radius: 12px;
  --border: 1px;

  --text: #0f172a;
  --muted: #475569;
  --bg-page: #f8fafc;

  --accent: #2563eb;
  --accent-2: #60a5fa;

  --btn-bg: #111827;
  --btn-text: #ffffff;
  --btn-glow: rgba(37, 99, 235, 0.45);
}

/* Base styles for lab container */
.lab-container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding-inline: calc(var(--space) * 2);
}

.section {
  margin-block: calc(var(--space) * 3);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 calc(var(--space) * 1.25);
}

p {
  margin: 0 0 calc(var(--space) * 1.25);
  color: var(--muted);
}

.site-header,
.site-footer {
  padding-block: calc(var(--space) * 2.5);
  text-align: center;
}

/* Overview and Objectives sections */
.overview-section .card {
  background: linear-gradient(135deg, #dbeafe 0%, #f0f9ff 100%);
  border-left: 4px solid var(--accent);
}

.objectives-section .card {
  background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
  border-left: 4px solid #22c55e;
}

.objectives-section ul {
  margin-left: 20px;
}

.objectives-section li {
  margin: calc(var(--space) * 1) 0;
}

.submission-section .card {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
  border-left: 4px solid #f59e0b;
}

.submission-section ul {
  margin-left: 20px;
}

.submission-section li {
  margin: calc(var(--space) * 1) 0;
}

/* Questions section */
.questions-section .question-card {
  background: linear-gradient(135deg, #e0e7ff 0%, #f5f3ff 100%);
  border-left: 4px solid #6366f1;
}

.question-item {
  margin-top: calc(var(--space) * 3);
}

.question-item:first-of-type {
  margin-top: calc(var(--space) * 2);
}

.question-item h3 {
  color: var(--text);
  margin-bottom: calc(var(--space) * 1);
}

.answer-area {
  margin-top: calc(var(--space) * 2);
  padding: calc(var(--space) * 2);
  background: #f8fafc;
  border-radius: 8px;
  border: 2px dashed #cbd5e1;
}

.answer-area h4 {
  color: #475569;
  font-size: 0.95rem;
  margin-bottom: calc(var(--space) * 1.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.answer-box {
  min-height: 120px;
  padding: calc(var(--space) * 2);
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.answer-box p {
  margin: 0;
  color: #94a3b8;
  line-height: 1.8;
}

.answer-box p em {
  font-style: italic;
}

.card {
  padding: calc(var(--space) * 3);
  border-radius: var(--radius);
  background: #fff;
  border: var(--border) solid #e5e7eb;
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.06);
}

.card+.card {
  margin-top: calc(var(--space) * 2);
}

/* Base body styling */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===============================================
   TASK 1: CSS Sprite Animation
   
   Create an animated running character using sprite
   sheet and CSS @keyframes animation.
   =============================================== */

/* Container for sprite animation */
.sprite-container {
  /* TODO: Set display to flex */
  /* TODO: Set justify-content to center */
  /* TODO: Set align-items to center */
  /* TODO: Set min-height to 200px */
  /* TODO: Set background to linear-gradient(135deg, #667eea 0%, #764ba2 100%) */
  /* TODO: Set border-radius to 12px */
  /* TODO: Set padding to 40px */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 40px;
}

/* Running character sprite */
.running-character {
  /* TODO: Set width to 76px */
  /* TODO: Set height to 134px */
  /* TODO: Set background-image to url('images/sprites.png') */
  /* TODO: Set background-repeat to no-repeat */
  /* TODO: Set overflow to hidden */
  /* TODO: Set animation to run 0.8s steps(1) infinite */
  width: 76px;
  height: 134px;
  background-image: url('images/sprites.png');
  background-repeat: no-repeat;
  overflow: hidden;
  animation: run 0.8s steps(1) infinite;
}

/* Keyframe animation for running character */
/* TODO: Create @keyframes run */
/* TODO: 0%:      background-position: 0 0 */
/* TODO: 16.66%:  background-position: -78px 0 */
/* TODO: 33.33%:  background-position: -156px 0 */
/* TODO: 50%:     background-position: -234px 0 */
/* TODO: 66.66%:  background-position: -312px 0 */
/* TODO: 83.33%:  background-position: -390px 0 */
/* TODO: 100%:    background-position: 0 0 */
@keyframes run{
  0%{
    background-position: 0 0;
  }
  16.66%{
    background-position: -74px 0;
  }
  33.33%{
    background-position: -154px 0;
  }
  50%{
    background-position: -226px 0;
  }
  66.66%{
    background-position: -294px 0;
  }
  83.33%{
    background-position: -366px 0;
  }
  100%{
    background-position: 0 0;
  }
}

/* ===============================================
   TASK 2: CSS Grid Responsive Layout
   
   Create auto-responsive grids using CSS Grid
   with auto-fit, minmax, and grid spanning.
   =============================================== */

/* ===============================================
   Part A: Auto-Responsive Grid Gallery (Steps 1-6)
   =============================================== */

/* Steps 1-6: Auto-responsive grid that adapts without media queries */
.grid-gallery {
  /* TODO: Set display to grid */
  /* TODO: Set grid-template-columns to repeat(auto-fit, minmax(250px, 1fr)) */
  /* TODO: Set gap to 20px */
  /* TODO: Set padding to 20px */
  /* TODO: Set background to linear-gradient(135deg, #667eea 0%, #764ba2 100%) */
  /* TODO: Set border-radius to 12px */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
}

/* ===============================================
   Part B: Grid Item Styling (Steps 7-10)
   =============================================== */

/* Steps 7-10: Individual grid item styling */
.grid-item {
  /* TODO: Set background to white */
  /* TODO: Set border-radius to 12px */
  /* TODO: Set padding to 30px */
  /* TODO: Set box-shadow to 0 4px 12px rgba(0, 0, 0, 0.1) */
  /* TODO: Set transition to transform 0.3s ease */
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.grid-item:hover {
  /* TODO: Set transform to translateY(-5px) */
  /* TODO: Set box-shadow to 0 8px 20px rgba(0, 0, 0, 0.15) */
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ===============================================
   Part C: Grid Item Content (Steps 11-12)
   =============================================== */

/* Steps 11-12: Grid item content styling */
.grid-item h3 {
  /* TODO: Set color to #667eea */
  /* TODO: Set margin to 0 0 12px 0 */
  /* TODO: Set font-size to 1.5rem */
  color: #667eea;
  margin: 0 0 12px 0;
  font-size: 1.5rem;
}

.grid-item p {
  /* TODO: Set color to #64748b */
  /* TODO: Set line-height to 1.6 */
  /* TODO: Set margin to 0 */
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

/* ===============================================
   Part D: Magazine Layout Container (Steps 13-17)
   =============================================== */

/* Steps 13-17: Magazine-style grid with explicit columns */
.magazine-grid {
  /* TODO: Set display to grid */
  /* TODO: Set grid-template-columns to repeat(4, 1fr) */
  /* TODO: Set grid-template-rows to auto */
  /* TODO: Set gap to 20px */
  /* TODO: Set margin-top to 40px */
  /* TODO: Set padding to 20px */
  /* TODO: Set background to #f8fafc */
  /* TODO: Set border-radius to 12px */
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto;
  gap: 20px;
  margin-top: 40px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}

/* ===============================================
   Part E: Featured Item Spanning (Steps 18-22)
   =============================================== */

/* Steps 18-22: Featured item that spans multiple grid cells */
.featured-item {
  /* TODO: Set grid-column to span 2 */
  /* TODO: Set grid-row to span 2 */
  /* TODO: Set background to linear-gradient(135deg, #667eea 0%, #764ba2 100%) */
  /* TODO: Set color to white */
  /* TODO: Set padding to 40px */
  /* TODO: Set border-radius to 12px */
  /* TODO: Set display to flex */
  /* TODO: Set flex-direction to column */
  /* TODO: Set justify-content to center */
  grid-column: span 2;
  grid-row: span 2;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ===============================================
   Part F: Regular Magazine Items (Steps 23-26)
   =============================================== */

/* Steps 23-26: Regular magazine grid items */
.magazine-item {
  /* TODO: Set background to white */
  /* TODO: Set padding to 24px */
  /* TODO: Set border-radius to 12px */
  /* TODO: Set box-shadow to 0 2px 8px rgba(0, 0, 0, 0.08) */
  /* TODO: Set transition to transform 0.3s ease */
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
}

.magazine-item:hover {
  /* TODO: Set transform to scale(1.02) */
  transform: scale(1.02);
}

/* ===============================================
   Part G: Media Query - Tablet (Steps 27-29)
   Screen width: ≤ 1024px
   =============================================== */

/* Steps 27-29: Tablet responsive styles */
/* TODO: Create media query: @media (max-width: 1024px) */

  /* TODO: For .magazine-grid, set grid-template-columns to repeat(2, 1fr) */
  
  
  /* TODO: For .featured-item, set grid-column to span 2 */
  /* TODO: For .featured-item, set grid-row to span 1 */
@media (max-width: 1024px){
  .margin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .featured-item {
    grid-column: span 2;
    grid-row: span 1;
  }
}


/* ===============================================
   Part H: Media Query - Mobile (Steps 30-33)
   Screen width: < 768px
   =============================================== */

/* Steps 30-33: Mobile responsive styles */
/* TODO: Create media query: @media (max-width: 767px) */

  /* TODO: For .magazine-grid, set grid-template-columns to 1fr */
  
  
  /* TODO: For .featured-item, set grid-column to span 1 */
  /* TODO: For .featured-item, set grid-row to span 1 */
  
  
  /* TODO: For .grid-item, set padding to 20px */
@media (max-width: 767px){
  .margin-grid {
    grid-template-columns: 1fr;
  }
  .featured-item {
    grid-column: span 1;
    grid-row: span 1;
  }
}

