@layer base, layout, components, utilities;

@layer base {
  :root {
    --bg-color: oklch(98% 0.01 240);
    --text-color: oklch(20% 0.02 240);
    --accent-color: oklch(65% 0.2 280);
    --surface-color: oklch(100% 0 0);
    --shadow-color: oklch(0% 0 0 / 10%);
    --font-family: 'Pretendard', system-ui, sans-serif;
  }

  html {
    scroll-behavior: smooth;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 2rem 0;
  }
}

@layer layout {
  .background-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
    background-image: radial-gradient(var(--accent-color) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
    filter: contrast(120%) brightness(110%);
  }

  .app-container {
    width: 95%;
    max-width: 600px;
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 2rem;
    box-shadow: 0 20px 50px var(--shadow-color);
    text-align: center;
    container-type: inline-size;
    position: relative;
  }

  .app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid oklch(95% 0.01 240);
  }

  .nav-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-color);
  }

  .nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
  }

  .nav-links a {
    text-decoration: none;
    color: oklch(50% 0.02 240);
    font-weight: 700;
    font-size: 0.9rem;
    transition: color 0.2s ease;
  }

  .nav-links a:hover {
    color: var(--accent-color);
  }

  .app-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
  }

  .accent {
    color: var(--accent-color);
    text-shadow: 0 0 20px oklch(65% 0.2 280 / 30%);
  }

  .app-header p {
    color: oklch(50% 0.02 240);
    margin-bottom: 3rem;
  }
}

@layer components {
  .generator-section {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: center;
  }

  .ball-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    min-height: 80px;
  }

  .placeholder {
    color: oklch(70% 0.02 240);
    font-style: italic;
  }

  .generate-btn {
    appearance: none;
    border: none;
    background: var(--accent-color);
    color: white;
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px oklch(65% 0.2 280 / 40%);
  }

  .generate-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px oklch(65% 0.2 280 / 60%);
  }

  .generate-btn:active {
    transform: translateY(0) scale(0.98);
  }

  /* Contact Form Styles */
  .divider {
    border: none;
    border-top: 1px solid oklch(90% 0.02 240);
    margin: 3rem 0;
  }

  .contact-section {
    text-align: left;
  }

  .contact-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .contact-section p {
    color: oklch(50% 0.02 240);
    margin-bottom: 1.5rem;
  }

  .contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-group label {
    font-weight: 700;
    font-size: 0.9rem;
    color: oklch(40% 0.02 240);
  }

  .form-group input,
  .form-group textarea {
    padding: 1rem;
    border: 1px solid oklch(85% 0.02 240);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: oklch(99% 0.01 240);
  }

  .form-group input:focus,
  .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px oklch(65% 0.2 280 / 10%);
    background: white;
  }

  .submit-btn {
    appearance: none;
    border: none;
    background: var(--text-color);
    color: white;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
  }

  .submit-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
  }

  .form-status {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
  }

  .form-status.success { color: oklch(60% 0.15 150); }
  .form-status.error { color: oklch(60% 0.15 20); }
}

@layer utilities {
  @container (max-width: 400px) {
    .app-header h1 {
      font-size: 2rem;
    }
    .ball-container {
      gap: 0.5rem;
    }
    .nav-links {
      gap: 1rem;
    }
  }
}
