/* ===============================================
   COMP3421 — Lab 6: CSS Positioning & Animation
   One-hour practice answer key.
   =============================================== */

*,
*::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);
}


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;
}

.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;
}

/* Reference Screenshot sections */
.reference-screenshot {
  margin-top: calc(var(--space) * 3);
  padding: calc(var(--space) * 2);
  background: #f1f5f9;
  border-radius: 8px;
  border: 2px dashed #cbd5e1;
}

.reference-screenshot h4 {
  margin: 0 0 calc(var(--space) * 1.5);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.reference-screenshot img {
  max-width: 800px;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  display: block;
  margin: 0 auto;
}


.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);
}

/* Screenshot link styling */
.screenshot-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.screenshot-link:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

/* ===============================================
   TASK 1: Build an Analog Clock with CSS Positioning & Transitions
   
   Build a beautiful analog clock using CSS positioning, transforms, and transitions. 
   This exercise demonstrates how position: absolute combined with transform-origin 
   allows you to precisely position and rotate clock hands from a central pivot point.
   =============================================== */

/* Wrapper for clock demo */
.clock-demo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(var(--space) * 5) 0;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  margin: calc(var(--space) * 3) 0;
}

/* ===============================================
   Part A: Clock Container Setup (Steps 1-7)
   =============================================== */
.clock-container {
  /* Step 1: Add position: relative; */
  position: relative;
  /* Step 2: Add width and height */
  width: 350px;
  height: 350px;
  /* Step 3: Add margin to center horizontally */
  margin: 40px auto;
  /* Step 4: Add gradient background */
  background: linear-gradient(135deg,#f093fb 0%,#f5576c 100%);
  /* Step 5: Add border-radius */
  border-radius: 50%;
  /* Step 6: Add box-shadow */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.1);
  /* Step 7: Add border */
  border: 10px solid white;
}

/* ===============================================
   Part B: Clock Center Dot (Steps 8-15)
   =============================================== */
.clock-center {
  /* Step 8: Add position: absolute; */
  position: absolute;
  /* Step 9: Add top and left positioning */
  top: 50%;
  left: 50%;
  /* Step 10: Add transform to center */
  transform: translate(-50%, -50%);
  /* Step 11: Add width and height */
  width: 20px;
  height: 20px;
  /* Step 12: Add background */
  background: white;
  /* Step 13: Add border-radius */
  border-radius: 50%;
  /* Step 14: Add z-index */
  z-index: 10;
  /* Step 15: Add box-shadow */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===============================================
   Part C: Clock Hands Base Styling (Steps 16-22)
   =============================================== */
.clock-hand {
  /* Step 16: Add position: absolute; */
  position: absolute;
  /* Step 17: Add bottom positioning */
  bottom: 50%;
  /* Step 18: Add left positioning */
  left: 50%;
  /* Step 19: Add transform-origin (CRUCIAL!) */
  transform-origin: center bottom; 
  /* Step 20: Add background */
  background: white; 
  /* Step 21: Add border-radius */
  border-radius: 4px 4px 0 0;
  /* Step 22: Add box-shadow */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ===============================================
   Part D: Individual Hand Styling (Steps 22-33)
   =============================================== */

/* CSS Animations for Clock Hands */
@keyframes rotate-hour-hand {
  from {
    transform: translateX(-50%) rotate(0deg);
  }
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@keyframes rotate-minute-hand {
  from {
    transform: translateX(-50%) rotate(90deg);
  }
  to {
    transform: translateX(-50%) rotate(450deg);
  }
}

@keyframes rotate-second-hand {
  from {
    transform: translateX(-50%) rotate(180deg);
  }
  to {
    transform: translateX(-50%) rotate(540deg);
  }
}

/* Hour Hand Styling (Steps 22-25) */
.hour-hand {
  /* Step 22: Add width and height */
  width: 8px;
  height: 70px;
  
  /* Step 23: Add initial transform (starting at 12 o'clock) */
  transform: translateX(-50%) rotate(0deg);
  
  /* Step 24: Add background color */
  background: rgba(255, 255, 255, 0.9);
  
  /* Step 25: Add z-index */
  z-index: 3;
  
}

/* Minute Hand Styling (Steps 26-29) */
.minute-hand {
  /* Step 26: Add width and height */
  width: 6px;
  height: 100px;
  
  /* Step 27: Add initial transform (starting at 3 o'clock) */
  transform: translateX(-50%) rotate(90deg);
  
  /* Step 28: Add background color */
  background: rgba(255, 255, 255, 0.95);
  
  /* Step 29: Add z-index */
  z-index: 4;
  
}

/* Second Hand Styling (Steps 30-33) */
.second-hand {
  /* Step 30: Add width and height */
  width: 3px;
  height: 120px;
  
  /* Step 31: Add initial transform (starting at 6 o'clock) */
  transform: translateX(-50%) rotate(180deg);
  
  /* Step 32: Add background color (red) */
  background: #ef4444;
  
  /* Step 33: Add z-index */
  z-index: 5;
  
}

/* ===============================================
   Part E: Adding Animations to Clock Hands (Steps 34-36)
   =============================================== */

/* Step 34: Add animation to hour hand */
.hour-hand {
  animation: rotate-hour-hand 120s linear infinite;
}

/* Step 35: Add animation to minute hand */
.minute-hand {
  animation: rotate-minute-hand 10s linear infinite;
}

/* Step 36: Add animation to second hand */
.second-hand {
  animation: rotate-second-hand 6s linear infinite;
}

/* ===============================================
   Part F: Hour Markers (Steps 37-43)
   =============================================== */
.hour-marker {
  /* Step 37: Add position: absolute; */
  position: absolute;
  /* Step 38: Add width and height */
  width: 4px;
  height: 15px;
  /* Step 39: Add background */
  background: rgba(255, 255, 255, 0.6);
  /* Step 40: Add top and left positioning */
  top: 10px;
  left: 50%;
  /* Step 41: Add transform to center */
  transform: translateX(-50%);
  /* Step 42: Add transform-origin */
  transform-origin: center 140px;
}

/* Step 43: Rotate markers using :nth-child selectors (30-degree increments) */

/* Example: First two markers are done for you */
.hour-marker:nth-child(1) {
  transform: translateX(-50%) rotate(0deg); /* 12 o'clock */
}

.hour-marker:nth-child(2) {
  transform: translateX(-50%) rotate(30deg); /* 1 o'clock */
}

/* TODO: Complete the remaining 10 markers (3-12) following the pattern above */
/* Hint: Each marker should rotate 30 degrees more than the previous one */
/* .hour-marker:nth-child(3) should be 60deg (2 o'clock) */
/* .hour-marker:nth-child(4) should be 90deg (3 o'clock) */
/* ... continue the pattern up to :nth-child(12) at 330deg (11 o'clock) */

.hour-marker:nth-child(3) {
  transform: translateX(-50%) rotate(60deg);
}

.hour-marker:nth-child(4) {
  transform: translateX(-50%) rotate(90deg);
}

.hour-marker:nth-child(5) {
  transform: translateX(-50%) rotate(120deg);
}

.hour-marker:nth-child(6) {
  transform: translateX(-50%) rotate(150deg);
}

.hour-marker:nth-child(7) {
  transform: translateX(-50%) rotate(180deg);
}

.hour-marker:nth-child(8) {
  transform: translateX(-50%) rotate(210deg);
}

.hour-marker:nth-child(9) {
  transform: translateX(-50%) rotate(240deg);
}

.hour-marker:nth-child(10) {
  transform: translateX(-50%) rotate(270deg);
}

.hour-marker:nth-child(11) {
  transform: translateX(-50%) rotate(300deg);
}

.hour-marker:nth-child(12) {
  transform: translateX(-50%) rotate(330deg);
}