@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic:wght@400;700&family=Noto+Serif+KR:wght@400;700&display=swap');

:root {
  /* Colors inspired by mamaman.co.kr - softer, warmer tones */
  --primary-color: #6A1B9A; /* Deep Purple, but softer */
  --secondary-color: #AB47BC; /* Medium Purple */
  --accent-color: #FFB300; /* Warm Amber for accents */
  --text-color: #424242; /* Darker grey for readability */
  --light-text-color: #616161; /* Lighter grey for secondary text */
  --background-color: #F8F4F9; /* Very light, soft purple background */
  --card-background: #FFFFFF;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --border-color: #E0E0E0; /* Light border for subtle separation */

  /* Fonts - Nanum Gothic for sans-serif, Noto Serif KR for serif */
  --font-family-sans: 'Nanum Gothic', 'Noto Sans KR', sans-serif;
  --font-family-serif: 'Noto Serif KR', serif;

  /* Spacing */
  --spacing-unit: 8px;
  --primary-color-rgb: 106, 27, 154; /* RGB for primary-color for shadow effects */
  --accent-color-light: #FFEB3B; /* Lighter accent for glow */
}

/* Base Styles */
body {
  font-family: var(--font-family-sans);
  line-height: 1.7; /* Slightly increased line height for readability */
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-serif);
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: calc(var(--spacing-unit) * 2.5); /* Adjusted margin for better flow */
  line-height: 1.3;
}

h1 { font-size: 3.2em; font-weight: 700; }
h2 { font-size: 2.4em; font-weight: 700; }
h3 { font-size: 1.8em; font-weight: 700; }

p {
  margin-bottom: calc(var(--spacing-unit) * 2);
  color: var(--light-text-color);
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
  text-decoration: underline;
  color: var(--primary-color);
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); /* Gradient background */
  color: #fff;
  padding: calc(var(--spacing-unit) * 8) var(--spacing-unit) * 3; /* Increased padding */
  text-align: center;
  box-shadow: 0 10px 20px var(--shadow-color); /* Stronger shadow */
  position: relative; /* For potential background elements */
  overflow: hidden; /* Ensure gradient clips properly */
}

header h1 {
  color: #fff;
  margin-bottom: var(--spacing-unit);
  font-size: 3.8em; /* Larger heading */
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2); /* Text shadow for depth */
}

header p {
  font-size: 1.4em;
  opacity: 0.98;
  max-width: 900px;
  margin: 0 auto;
  color: #fff; /* Ensure paragraph text is white */
}

/* Main Content Area */
main {
  flex: 1;
  padding: calc(var(--spacing-unit) * 6) var(--spacing-unit) * 3; /* Increased padding */
  max-width: 1200px;
  margin: 0 auto;
  display: grid; /* Default for cards */
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Adjusted min-width for cards */
  gap: calc(var(--spacing-unit) * 6); /* Increased gap between cards */
}

/* Initial form layout for main before cards are rendered */
main.initial-form-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 50vh; /* Ensure form takes up sufficient vertical space */
  padding: calc(var(--spacing-unit) * 8) var(--spacing-unit) * 3;
}

.birthdate-input-section {
  background-color: var(--card-background);
  border-radius: 12px;
  box-shadow: 0 8px 16px var(--shadow-color);
  padding: calc(var(--spacing-unit) * 5);
  max-width: 500px;
  width: 100%;
  box-sizing: border-box;
}

.birthdate-input-section h2 {
  color: var(--primary-color);
  font-family: var(--font-family-serif);
  margin-bottom: calc(var(--spacing-unit) * 2);
  font-size: 2em;
}

.birthdate-input-section p {
  color: var(--light-text-color);
  margin-bottom: calc(var(--spacing-unit) * 4);
  font-size: 1.1em;
}

#birthdateForm {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 3);
  align-items: center;
}

#birthdateForm label {
  font-size: 1.2em;
  color: var(--text-color);
  font-weight: 700;
}

#birthdateForm input[type="date"] {
  padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1.1em;
  width: 100%;
  max-width: 250px;
  box-sizing: border-box;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  font-family: var(--font-family-sans);
}

#birthdateForm input[type="date"]:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.3);
  outline: none;
}

#birthdateForm button[type="submit"] {
  background-color: var(--accent-color);
  color: var(--primary-color);
  padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 4);
  border: none;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#birthdateForm button[type="submit"]:hover {
  background-color: #FFD54F; /* Lighter accent color on hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Web Component Base Styles (for development-stage-card) */
development-stage-card {
  display: block;
  position: relative; /* For the 'current age' label */
}

development-stage-card[is-current-age="true"] {
  border: 2px solid var(--accent-color); /* Highlight border */
  box-shadow: 0 12px 24px rgba(var(--primary-color-rgb), 0.2), 0 0 0 5px var(--accent-color-light); /* Stronger shadow with accent glow */
  transform: translateY(-5px) scale(1.02); /* Slightly larger and lifted */
  transition: all 0.3s ease-in-out;
  z-index: 10; /* Bring to front */
}

development-stage-card[is-current-age="true"]::before {
  content: '현재 개월수'; /* Label for current age */
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--accent-color);
  color: var(--primary-color);
  padding: 5px 10px;
  border-bottom-left-radius: 8px;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 11; /* Ensure label is above card content */
}

/* Month Navigation Container */
#month-navigation-container {
  display: flex;
  justify-content: center;
  margin-top: calc(var(--spacing-unit) * 4);
  margin-bottom: calc(var(--spacing-unit) * 4);
}

/* Month Navigation Component Specific Styles (via :host and internal elements) */
month-navigation {
  --button-bg: var(--background-color);
  --button-text: var(--primary-color);
  --button-border: var(--primary-color);
  --button-hover-bg: var(--primary-color);
  --button-hover-text: #fff;
  --button-active-bg: var(--primary-color);
  --button-active-text: #fff;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  header h1 {
    font-size: 3.2em;
  }
  main {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 2.8em;
  }

  header p {
    font-size: 1.2em;
  }

  main {
    padding: calc(var(--spacing-unit) * 4) var(--spacing-unit) * 2;
    gap: calc(var(--spacing-unit) * 4);
  }
}

@media (max-width: 480px) {
  header {
    padding: calc(var(--spacing-unit) * 5) var(--spacing-unit) * 2;
  }

  header h1 {
    font-size: 2.2em;
  }

  header p {
    font-size: 1em;
  }

  main {
    grid-template-columns: 1fr;
    padding: calc(var(--spacing-unit) * 3);
  }

  footer {
    padding: calc(var(--spacing-unit) * 4) var(--spacing-unit) * 2;
  }
}