:root {
  --primary-color: #3182F6; /* Vibrant Toss Blue */
  --primary-hover: #1E6BFF; /* Slightly darker blue on hover */
  --bg-color: #F8F9FA; /* Very light gray background */
  --card-bg: #FFFFFF; /* Pure white for cards */
  --text-main: #212529; /* Dark charcoal for main text */
  --text-sub: #495057; /* Slightly lighter charcoal for subtext */
  --border-light: #E0E0E0; /* Subtle light gray border */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08); /* Lighter, cleaner shadow */
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1); /* Soft, modern shadow */
  --radius-lg: 16px; /* More rounded corners for modern feel */
  --radius-md: 8px;
  --font-stack: 'Pretendard', 'Noto Sans KR', sans-serif; /* Modern sans-serif stack for Korean and general text */
}

body {
  font-family: var(--font-stack);
  margin: 0;
  padding: 0; /* Remove global border padding */
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6; /* Adjusted line height */
  -webkit-font-smoothing: antialiased;
  /* Remove global gold border */
}

/* Header Styles */
.main-header {
  text-align: center;
  padding: 80px 20px 60px;
  background-color: var(--bg-color);
}

.main-header h1 {
  font-family: var(--font-stack); /* Use new sans-serif font stack */
  font-size: 2.8rem; /* Adjusted font size */
  font-weight: 700;
  margin: 0;
  color: var(--text-main); /* Dark text color */
  letter-spacing: -0.02em; /* Tighter letter spacing */
  /* Remove text-shadow */
}

.main-header p {
  font-family: var(--font-stack); /* Use new sans-serif font stack */
  font-size: 1.15rem; /* Adjusted font size */
  color: var(--text-sub); /* Sub-text color */
  margin-top: 15px;
  letter-spacing: -0.01em; /* Tighter letter spacing */
}

/* Recipe List Grid */
#recipe-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* Adjusted minmax for wider cards */
  gap: 24px; /* Reduced gap for a tighter, cleaner grid */
  max-width: 1200px; /* Adjusted max-width */
  margin: 48px auto 80px; /* Adjusted margins */
  padding: 0 20px; /* Adjusted padding */
}

/* Recipe Card Styles */
.recipe-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg); /* More rounded corners */
  box-shadow: var(--shadow-sm); /* Softer shadow */
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease; /* Faster, smoother transitions */
  display: flex;
  flex-direction: column;
  border: none; /* Remove explicit border, rely on shadow */
}

.recipe-card:hover {
  transform: translateY(-5px); /* Subtle lift on hover */
  box-shadow: var(--shadow-md); /* More pronounced, soft shadow on hover */
}

.recipe-card img {
  width: 100%;
  height: 180px; /* Adjusted image height */
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recipe-card-content {
  padding: 20px; /* Adjusted padding */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--card-bg);
}

.recipe-card h2 {
  font-family: var(--font-stack); /* Use sans-serif font */
  font-size: 1.3rem; /* Adjusted font size */
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 8px; /* Adjusted margin */
  color: var(--text-main); /* Dark text color */
  line-height: 1.4;
  letter-spacing: -0.01em; /* Tighter letter spacing */
  text-transform: none; /* Remove uppercase */
}

.recipe-card p {
  font-family: var(--font-stack); /* Use sans-serif font */
  font-size: 0.9rem; /* Adjusted font size */
  color: var(--text-sub); /* Sub-text color */
  line-height: 1.6;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px; /* Adjusted margin */
}

.view-recipe-btn {
  background-color: var(--primary-color); /* Vibrant Toss Blue */
  color: #FFFFFF; /* White text */
  font-family: var(--font-stack); /* Use new sans-serif font stack */
  font-weight: 600;
  padding: 14px 28px; /* Adjusted padding for better tap target */
  border-radius: 9999px; /* Pill shape */
  border: none; /* Remove explicit border */
  cursor: pointer;
  align-self: flex-start; /* Align to the start for consistency */
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  width: auto;
  text-align: center;
  font-size: 1rem;
  box-shadow: none; /* Remove shadow, Toss buttons are typically flat */
  letter-spacing: normal; /* Normal letter spacing */
  text-transform: none; /* No uppercase */
}

.view-recipe-btn:hover {
  background-color: var(--primary-hover); /* Darker blue on hover */
  transform: translateY(-2px); /* Subtle lift on hover */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow on hover */
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent dark overlay */
  backdrop-filter: blur(4px); /* Subtle blur for modern feel */
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: var(--card-bg);
  margin: 5vh auto;
  padding: 32px; /* Adjusted padding */
  border: none; /* Remove explicit border */
  width: 90%;
  max-width: 768px; /* Adjusted max-width */
  min-height: auto; /* Allow content to define height */
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); /* Soft shadow */
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#modal-body {
  overflow-y: auto;
  padding: 0;
  flex: 1;
}

/* Scrollbar styling for modal */
#modal-body::-webkit-scrollbar {
  width: 8px;
}
#modal-body::-webkit-scrollbar-track {
  background: var(--bg-color);
}
#modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color); /* Use primary color for thumb */
  border-radius: 4px;
}

.close-button {
  color: var(--text-sub); /* Dark gray icon */
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 24px; /* Smaller icon */
  font-weight: normal;
  z-index: 10;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: rgba(0, 0, 0, 0.05); /* Subtle hover background */
  color: var(--text-main);
  transform: none; /* Remove rotation effect */
}

/* Modal Internal Styling */
.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 24px; /* Adjusted padding */
  margin-bottom: 32px; /* Adjusted margin */
}

.modal-header h2 {
  font-family: var(--font-stack);
  text-transform: none; /* Remove uppercase */
  font-size: 2rem; /* Adjusted font size */
  margin: 0 0 10px 0;
  color: var(--text-main);
  padding-right: 40px;
  letter-spacing: -0.02em; /* Tighter letter spacing */
}

.modal-header p {
  font-family: var(--font-stack);
  color: var(--text-sub);
  font-size: 0.95rem; /* Adjusted font size */
  background: none; /* Remove background */
  display: inline-block;
  padding: 0; /* Remove padding */
  border-radius: none; /* Remove border-radius */
  margin: 0;
  border: none; /* Remove border */
}

.modal-section {
  margin-bottom: 40px; /* Adjusted margin */
}

.modal-section h3 {
  font-family: var(--font-stack);
  text-transform: none; /* Remove uppercase */
  font-size: 1.25rem; /* Adjusted font size */
  font-weight: 600;
  margin-bottom: 16px; /* Adjusted margin */
  color: var(--text-main);
  display: flex;
  align-items: center;
  letter-spacing: -0.01em; /* Tighter letter spacing */
}

.modal-section h3::before {
  content: '';
  display: inline-block;
  width: 4px; /* Thinner accent */
  height: 18px; /* Shorter accent */
  background-color: var(--primary-color);
  margin-right: 10px;
  border-radius: 2px;
}

/* Nutrition Grid */
.nutrition-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px; /* Adjusted gap */
  background: var(--bg-color);
  padding: 20px;
  border-radius: var(--radius-md);
  border: none; /* Remove border */
}

.nutrition-item {
  font-family: var(--font-stack);
  font-size: 0.9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.nutrition-item strong {
  color: var(--primary-color);
  font-size: 1.1em;
  margin-bottom: 4px;
}

/* Ingredients */
.modal-section p {
    font-family: var(--font-stack);
    line-height: 1.7; /* Adjusted line height */
    color: var(--text-main);
}

/* Steps */
.step-item {
  display: flex;
  margin-bottom: 24px; /* Adjusted margin */
  align-items: flex-start;
  background: var(--card-bg);
  padding: 16px; /* Adjusted padding */
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light); /* Subtle light border */
}

.step-item img {
  width: 80px; /* Smaller image */
  height: 80px;
  margin-right: 20px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  border: none; /* Remove border from image */
}

.step-text {
  font-family: var(--font-stack);
  flex: 1;
  font-size: 0.95rem; /* Adjusted font size */
  color: var(--text-main);
  line-height: 1.6; /* Adjusted line height */
}