:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #5b6472;
  --card: #ffffff;
  --line: #1f2937;
  --soft: #f3f4f6;
  --indigo: #4f46e5;
  --green: #10b981;
  --pink: #ec4899;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --brutal-shadow: 4px 4px 0 var(--line);
  --page-width: 1180px;
}

body.dark {
  --bg: #1a1a2e;
  --text: #e4e4e4;
  --muted: #b9bdd1;
  --card: #16213e;
  --line: #e4e4e4;
  --soft: #202744;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  --brutal-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--indigo) 14%, transparent) 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
.donate-link {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 20px;
  transition: all 0.2s ease;
}

button {
  cursor: pointer;
}

button:hover,
.donate-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--line);
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--card);
  border-bottom: 3px solid var(--line);
  padding: 14px clamp(18px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  width: min(var(--page-width), 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-footer {
  border-top: 3px solid var(--line);
  border-bottom: 0;
  position: static;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  rotate: -5deg;
  background: var(--indigo);
  color: #ffffff;
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--line);
  font-size: 24px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong {
  color: var(--indigo);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.donate-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pink);
  color: #ffffff;
  font-weight: 700;
}

.donate-link span {
  font-size: 0.9em;
}

.icon-btn {
  width: 46px;
  height: 46px;
  padding: 0;
  background: var(--green);
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 700;
}

.hero {
  border-bottom: 3px solid var(--line);
  padding: clamp(56px, 8vw, 96px) 18px clamp(48px, 7vw, 82px);
}

.hero-inner {
  width: min(900px, 100%);
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  padding: 8px 14px;
  background: var(--green);
  color: #ffffff;
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--line);
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-inline: auto;
  margin-bottom: 18px;
  font-size: clamp(2.65rem, 6.5vw, 5.35rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h1 span {
  color: var(--indigo);
}

.hero-copy {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2.3vw, 1.22rem);
  line-height: 1.55;
}

.search-panel {
  max-width: 780px;
  margin: 34px auto 0;
  padding: 16px;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--brutal-shadow);
  text-align: left;
}

.search-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.autocomplete {
  position: relative;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  z-index: 1;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-53%);
  pointer-events: none;
}

#search-input {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0 14px 0 44px;
  outline: 0;
}

#search-input:focus {
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  max-height: 280px;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
  background: #ffffff;
  color: #1f2937;
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.14);
}

.autocomplete-list.is-visible {
  display: grid;
  gap: 4px;
}

.autocomplete-option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1f2937;
  padding: 9px 10px;
  text-align: left;
  font-weight: 700;
}

.autocomplete-option:hover,
.autocomplete-option.is-active {
  background: #eef2ff;
  color: var(--indigo);
  box-shadow: none;
  transform: none;
}

.search-row button {
  background: var(--indigo);
  color: #ffffff;
  font-weight: 700;
  min-height: 48px;
  white-space: nowrap;
}

.results-section,
.favorites-section,
.popular-section {
  padding: clamp(36px, 6vw, 72px) clamp(14px, 4vw, 48px);
}

.results-section {
  background: color-mix(in srgb, var(--soft) 75%, transparent);
  border-bottom: 3px solid var(--line);
}

.favorites-section {
  background: var(--bg);
  border-bottom: 3px solid var(--line);
}

.section-heading {
  width: min(var(--page-width), 100%);
  margin: 0 auto 24px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.palette-grid {
  width: min(var(--page-width), 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

@media (min-width: 900px) {
  .palette-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.palette-card {
  min-width: 0;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.palette-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--brutal-shadow);
}

.palette-card h3 {
  margin-bottom: 6px;
  color: var(--indigo);
  font-size: clamp(1rem, 2.3vw, 1.35rem);
}

.palette-card p {
  color: var(--muted);
  line-height: 1.4;
}

.swatch-strip {
  display: flex;
  min-height: 86px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 10px;
}

.swatch-strip span {
  flex: 1;
}

.color-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.color-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.color-dot {
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-radius: 8px;
}

.color-row code {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
}

.copy-btn {
  padding: 7px 10px;
  background: var(--green);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  border-width: 1.5px;
}

.share-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--indigo);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--line);
}

.favorite-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--pink);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--line);
}

.favorite-btn.is-favorite {
  background: var(--green);
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: none;
  max-width: min(340px, calc(100vw - 40px));
  background: #10b981;
  color: white;
  padding: 10px 20px;
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--line);
  font-weight: 700;
}

.toast.is-visible {
  display: block;
  animation: fadeIn 0.3s, fadeOut 0.3s 2s forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 640px) {
  .header-inner {
    align-items: flex-start;
  }

  .header-actions {
    max-width: 180px;
  }

  .donate-link {
    width: 100%;
    padding-inline: 12px;
    text-align: center;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .palette-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .palette-card {
    padding: 12px;
  }

  .color-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .copy-btn {
    grid-column: 1 / -1;
  }
}

/* Refined VibePalette direction */
:root {
  --bg: #ffffff;
  --text: #172033;
  --muted: #647083;
  --card: #ffffff;
  --line: #172033;
  --soft: #f5f6fa;
  --indigo: #4338ca;
  --green: #00a878;
  --pink: #f43f8c;
  --shadow: 0 8px 24px rgba(23, 32, 51, 0.07);
  --brutal-shadow: 6px 6px 0 var(--line);
}

body.dark {
  --bg: #101426;
  --text: #f2f4ff;
  --muted: #aeb7cc;
  --card: #171d35;
  --line: #dfe4ff;
  --soft: #13192e;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

body {
  background:
    linear-gradient(color-mix(in srgb, var(--bg) 86%, transparent), color-mix(in srgb, var(--bg) 86%, transparent)),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--indigo) 24%, transparent) 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
  font-family: "IBM Plex Sans", sans-serif;
}

h1,
h2,
h3,
.brand strong {
  font-family: "Space Grotesk", sans-serif;
}

.site-header {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 18%, transparent);
  padding-block: 18px;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--card) 92%, transparent);
}

.brand-mark {
  width: 40px;
  height: 40px;
  rotate: 4deg;
  border-radius: 11px;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--indigo) 25%, transparent);
}

.brand strong {
  color: var(--text);
  letter-spacing: -0.03em;
}

.brand small {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.donate-link,
.icon-btn {
  border-width: 1.5px;
  box-shadow: 0 6px 14px color-mix(in srgb, currentColor 14%, transparent);
}

.donate-link {
  border-radius: 999px;
}

.hero {
  min-height: 620px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 22%, transparent);
  padding: 64px 18px 70px;
}

.hero-inner {
  width: min(960px, 100%);
}

.hero .eyebrow {
  margin-bottom: 26px;
  padding: 7px 14px;
  border: 0;
  box-shadow: none;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

h1 {
  max-width: 880px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 6.2vw, 5.2rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

h1 span {
  position: relative;
  display: inline-block;
}

h1 span::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -6px;
  height: 3px;
  border-radius: 999px;
  background: var(--indigo);
  transform: rotate(-2deg);
}

.hero-copy {
  max-width: 680px;
  font-size: 1.08rem;
  font-weight: 500;
}

.search-panel {
  max-width: 760px;
  margin-top: 40px;
  padding: 11px;
  border-radius: 20px;
  box-shadow: var(--brutal-shadow);
}

.search-label {
  margin: 0;
  padding: 3px 6px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

#search-input {
  min-height: 52px;
  border: 1.5px solid color-mix(in srgb, var(--line) 32%, transparent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--soft) 52%, var(--card));
}

.search-row button {
  min-height: 52px;
  border-radius: 11px;
  padding-inline: 24px;
}

.feature-notes {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 34px);
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feature-notes span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
}

.results-section,
.favorites-section,
.popular-section {
  padding-block: clamp(48px, 6vw, 78px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 20%, transparent);
  padding-bottom: 18px;
  margin-bottom: 28px;
}

.section-heading .eyebrow {
  order: 2;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  box-shadow: none;
  letter-spacing: 0.08em;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
}

.palette-grid {
  gap: 20px;
}

.palette-card {
  border-width: 2px;
  border-radius: 16px;
  padding: 20px;
}

.palette-card:hover {
  transform: translateY(-4px);
  box-shadow: 5px 5px 0 var(--line);
}

.palette-card h3 {
  letter-spacing: -0.025em;
}

.swatch-strip {
  min-height: 96px;
  border-width: 1.5px;
  border-radius: 12px;
}

.favorite-btn,
.share-btn {
  width: calc(50% - 5px);
  margin-top: 16px;
  padding-inline: 10px;
}

.favorite-btn + .share-btn {
  margin-left: 6px;
}

.site-footer {
  border-top-width: 1px;
}

@media (max-width: 640px) {
  .site-header {
    padding-inline: 14px;
  }

  .brand small {
    display: none;
  }

  .donate-link {
    width: auto;
    font-size: 0.75rem;
  }

  .hero {
    min-height: auto;
    padding-top: 52px;
  }

  .search-panel {
    border-radius: 16px;
  }

  .feature-notes {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .section-heading {
    display: block;
  }

  .section-heading .eyebrow {
    display: block;
    margin-bottom: 7px;
  }
}
