/* Modern & Refined Palette Styles */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}


body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #fcfcfc;
  margin: 0;
  padding: 40px 20px;
  color: #1a1a1a;
  touch-action: manipulation;
}


.container {
  max-width: 1000px;
  margin: auto;
}


h1 {
  text-align: left;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  font-size: 2rem;
  color: #111;
}


.site-description {
  text-align: left;
  color: #666;
  font-size: 0.9rem;
  max-width: 600px;
  margin: 0 0 40px 0;
  line-height: 1.5;
}


/* Category Buttons */
.controls {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}


.controls button {
  padding: 6px 16px;
  border: 1px solid #eee;
  background: white;
  cursor: pointer;
  border-radius: 100px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
}


.controls button:hover {
  background: #f5f5f5;
  color: #111;
  border-color: #ddd;
}


.controls button.active {
  background: #111;
  color: white;
  border-color: #111;
}


/* Category Description */
.category-desc {
  color: #666;
  font-size: 0.85rem;
  line-height: 1.65;
  margin-bottom: 24px;
  max-width: 700px;
  padding: 10px 14px;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 3px solid #e5e5e5;
}


/* Mode Switch Buttons */
.mode-switch {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}


.mode-switch button {
  padding: 6px;
  background: #fff;
  border: 1px solid #e5e5e5;
  color: #777;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}


.mode-switch button:hover {
  color: #444;
  border-color: #d0d0d0;
  background: #fafafa;
}


.mode-switch button.active {
  background: #f0f0f0;
  color: #111;
  border-color: #ccc;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}


.mode-switch button svg {
  stroke-width: 2.5px;
}


/* Palette Grid Modes */
.palette-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 60px;
}


.palette-grid.grid-mode {
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 15px;
}


/* Color Card Item */
.color-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  transition: all 0.3s ease;
}


.grid-mode .color-item {
  flex-direction: column;
  padding: 0;
  border: none;
  background: none;
}


.color-item:hover {
  border-color: #e0e0e0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}


.grid-mode .color-item:hover {
  box-shadow: none;
}


.color-swatch {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 8px;
  margin-right: 20px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  cursor: pointer;
}


.grid-mode .color-swatch {
  width: 100%;
  padding-bottom: 100%; /* Square aspect ratio */
  height: 0;
  margin-right: 0;
  border-radius: 12px;
}


.color-info {
  display: flex;
  gap: 8px;
  flex-grow: 1;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}


.grid-mode .color-info {
  display: none;
}


/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
}


.modal-content {
  background: white;
  padding: 30px;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  width: 90%;
  max-width: 400px;
  text-align: center;
}


.modal-swatch {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px auto;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}


.modal-info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.modal-info-list .info-box {
  width: 100%;
  padding: 12px;
  font-size: 0.9rem;
}


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


/* Information Boxes */
.info-box {
  padding: 6px 10px;
  background: #f9f9f9;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 500;
  color: #555;
  border: 1px solid transparent;
  transition: all 0.15s;
  flex: 0 1 auto;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.info-box:hover {
  background: #f0f0f0;
  border-color: #ddd;
  color: #111;
}


/* Share Section (bottom) */
.share-section {
  margin-top: 60px;
  text-align: center;
}

.share-label {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 10px;
}

.share-section .a2a_kit {
  justify-content: center;
}

/* Share Button (fixed right) */
.share-fixed {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
}


/* Footer */
footer {
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
  color: #888;
  font-size: 0.85rem;
}


footer a {
  color: #555;
  text-decoration: none;
}


footer a:hover {
  text-decoration: underline;
}


/* Responsive adjustments */
@media (max-width: 768px) {
  body { padding: 20px 10px; }
  .color-swatch { width: 40px; height: 40px; min-width: 40px; margin-right: 12px; }
  .info-box {
    font-size: 0.7rem;
    padding: 4px 6px;
  }
  .color-info { gap: 4px; }
}


@media (max-width: 480px) {
  /* reserved for future mobile adjustments */
}


/* Toast Notification Styling */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  color: white;
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 3000;
  white-space: nowrap;
  animation: slideUp 0.3s ease-out;
}


@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

#to-top-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: none;
  padding: 10px 15px;
  border: 1px solid #ccc;
  background-color: white;
  color: #333;
  border-radius: 5px;
  cursor: pointer;
  z-index: 100;
  touch-action: manipulation;
}


#to-top-btn:hover {
  background-color: #f0f0f0;
}


/* ============================================
   Content Sections (AdSense content additions)
   ============================================ */

.content-section {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid #f0f0f0;
}

.content-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 20px 0;
  letter-spacing: -0.02em;
}

.content-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 28px 0 10px 0;
}

.content-section p {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.75;
  margin: 0 0 16px 0;
  max-width: 700px;
}

.content-section a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-section a:hover {
  color: #555;
}

.content-section code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 4px;
  color: #333;
}

/* How to Use list */
.how-to-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: how-to;
}

.how-to-list li {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  max-width: 700px;
}

.how-to-list li::before {
  counter-increment: how-to;
  content: counter(how-to);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: #111;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 2px;
  flex-shrink: 0;
}

.how-to-list li strong {
  display: block;
  font-size: 0.9rem;
  color: #222;
  margin-bottom: 4px;
}

.how-to-list li p {
  margin: 0;
  color: #666;
}

/* Color Psychology list */
.color-psychology-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.color-psychology-list li {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
}

.color-psychology-list li strong {
  color: #222;
}

/* FAQ */
.faq-section .faq-item {
  max-width: 700px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f5f5f5;
}

.faq-section .faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.faq-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  margin: 0 0 8px 0;
}

.faq-section p {
  margin: 0;
}

@media (max-width: 768px) {
  .content-section {
    margin-top: 48px;
    padding-top: 28px;
  }
  .color-psychology-list {
    grid-template-columns: 1fr;
  }
  .how-to-list li {
    gap: 12px;
  }
}

/* Site navigation */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid #f0f0f0;
}
.site-nav a {
  font-size: 0.78rem;
  color: #888;
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 5px;
  transition: all 0.15s;
  white-space: nowrap;
}
.site-nav a:hover { background: #f5f5f5; color: #333; }
.site-nav a.active { background: #111; color: #fff; }


/* ── Palette generator ─────────────────────────────────────── */
.generator { margin: 0 0 48px; }
.gen-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.gen-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border: 0; border-radius: 100px;
  background: #111; color: #fff; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.gen-primary:hover { background: #333; }
.gen-primary kbd {
  font: 600 0.7rem/1 ui-monospace, Menlo, monospace; padding: 3px 6px; border-radius: 5px;
  background: rgba(255,255,255,.18); color: #fff;
}
.gen-select { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #666; }
.gen-select select {
  padding: 8px 12px; border: 1px solid #e5e5e5; border-radius: 100px; background: #fff;
  font-size: 0.85rem; color: #111; cursor: pointer;
}
.gen-photo-btn {
  padding: 8px 16px; border: 1px solid #e5e5e5; border-radius: 100px; background: #fff;
  font-size: 0.85rem; font-weight: 500; color: #444; cursor: pointer;
}
.gen-photo-btn:hover, .gen-export button:hover { background: #f5f5f5; border-color: #ddd; color: #111; }

.gen-swatches {
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: 300px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
.gen-swatch {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  gap: 4px; padding: 16px 14px; transition: background-color .25s ease;
}
.gen-hex {
  align-self: flex-start; padding: 0; border: 0; background: none; color: inherit; cursor: pointer;
  font: 700 1.05rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em;
}
.gen-rgb { font: 0.72rem/1.2 ui-monospace, Menlo, Consolas, monospace; opacity: .75; }
.gen-contrast { font-size: 0.72rem; font-weight: 600; opacity: .9; }
.gen-actions { position: absolute; top: 12px; right: 10px; display: flex; gap: 4px; }
.gen-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.0); color: inherit; opacity: .55; transition: opacity .15s, background .15s;
}
.gen-swatch:hover .gen-icon, .gen-icon:focus-visible, .gen-lock[aria-pressed="true"] { opacity: 1; }
.gen-icon:hover { background: rgba(127,127,127,.18); }

.gen-export { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.gen-export__label { font-size: 0.8rem; color: #999; margin-right: 4px; }
.gen-export button {
  padding: 6px 14px; border: 1px solid #eee; border-radius: 100px; background: #fff;
  font-size: 0.8rem; font-weight: 500; color: #666; cursor: pointer;
}
.gen-hint { font-size: 0.78rem; color: #999; margin: 12px 0 0; line-height: 1.6; max-width: 720px; }
.browse-title { font-size: 1.25rem; letter-spacing: -0.02em; margin: 0 0 16px; color: #111; }

@media (max-width: 640px) {
  .gen-swatches { grid-template-columns: 1fr; height: auto; }
  .gen-swatch { min-height: 76px; padding: 12px 14px; }
  .gen-actions { top: 50%; transform: translateY(-50%); }
  .gen-icon { opacity: 1; }
}
