/* === Color Palette Generator — style.css === */
/* Colors: #6366f1 primary, #ec4899 secondary, #f8fafc bg, #1e293b text */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --secondary-dark: #db2777;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(99, 102, 241, 0.08);
  --shadow-hover: 0 8px 32px rgba(99, 102, 241, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.1);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.lang-switch {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.lang-switch:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

/* --- Main Content --- */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Controls --- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.controls label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-select {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.mode-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.generate-btn {
  padding: 0.65rem 1.75rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

/* --- Palette Container --- */
.palette-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

/* --- Color Card --- */
.color-card {
  animation: cardFadeIn 0.5s ease forwards;
  opacity: 0;
}

.color-card-inner {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
}

.color-card-inner:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.color-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.15));
  pointer-events: none;
}

.color-swatch:hover {
  transform: scale(1.03);
}

.color-swatch:active {
  transform: scale(0.97);
}

.color-info {
  padding: 0.85rem 1rem;
}

.color-hex-row,
.color-rgb-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.color-label {
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 28px;
}

.color-hex-value {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  letter-spacing: 0.02em;
}

.color-rgb-value {
  font-size: 0.75rem;
  color: var(--text-light);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

.copy-btn {
  margin-left: auto;
  padding: 0.25rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.copy-btn.copied {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

/* --- Lock Button --- */
.lock-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.9rem;
  z-index: 2;
}

.lock-btn:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,0.95);
}

.lock-btn.locked {
  background: var(--secondary);
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

.lock-icon {
  line-height: 1;
}

/* --- Harmony Info --- */
.harmony-info {
  text-align: center;
  padding: 0.75rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* --- Footer --- */
footer {
  background: var(--text);
  color: #e2e8f0;
  padding: 3rem 1.5rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.footer-section h3 {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.footer-section ul li a:hover {
  color: var(--primary);
}

.footer-company {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: #64748b;
}

.footer-company p {
  margin-bottom: 0.25rem;
}

/* --- Legal Pages --- */
.legal-page {
  max-width: 800px;
  margin: 0 auto;
}

.legal-page h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.legal-page h2 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.legal-page p,
.legal-page li {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.legal-page ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

/* --- Animations --- */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes swatchPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .palette-container {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
  }

  .color-info {
    padding: 0.6rem 0.75rem;
  }

  .color-hex-value {
    font-size: 0.75rem;
  }

  .color-rgb-value {
    font-size: 0.65rem;
  }
}

@media (max-width: 640px) {
  .palette-container {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .color-swatch {
    aspect-ratio: 3/1;
    min-height: 80px;
  }

  .controls {
    flex-direction: column;
    padding: 1rem;
  }

  .control-group {
    width: 100%;
  }

  .mode-select {
    width: 100%;
  }

  .generate-btn {
    width: 100%;
    text-align: center;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  main {
    padding: 1.25rem 1rem;
  }

  header {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 480px) {
  .color-hex-row {
    flex-wrap: wrap;
  }

  .copy-btn {
    margin-left: 0;
    width: 100%;
    margin-top: 0.25rem;
  }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}