.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--container), calc(100% - 32px));
  margin: 16px auto 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
  font-weight: 700;
}

.logo__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--color-primary);
}

.logo__text {
  letter-spacing: -0.03em;
}

.site-nav {
  position: relative;
  display: flex;
  gap: 4px;
}

.site-nav__indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: var(--nav-indicator-width, 0);
  height: var(--nav-indicator-height, 0);
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 10px 24px rgba(47, 45, 42, 0.14);
  opacity: 0;
  transform: translate3d(var(--nav-indicator-x, 0), var(--nav-indicator-y, 0), 0);
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    width 280ms cubic-bezier(0.22, 1, 0.36, 1),
    height 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
  pointer-events: none;
}

.site-nav--ready .site-nav__indicator {
  opacity: 1;
}

.site-nav__link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  background: transparent;
  transition:
    color 220ms ease,
    font-weight 220ms ease,
    transform 220ms ease;
}

.site-nav__button {
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
  background: transparent;
  cursor: pointer;
}

.site-nav__link:hover {
  color: var(--color-text);
  transform: translateY(-1px);
}

.site-nav__link--active {
  color: #fff;
  font-weight: 700;
}

.site-nav__button.site-nav__link--active {
  color: #fff;
  font-weight: 700;
}

.site-nav__link--active:hover {
  color: #fff;
}

.site-nav__link[href$="admin.html"] {
  display: none;
}

.site-nav__link[href$="admin.html"].site-nav__link--admin-visible {
  display: inline-flex;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button--primary {
  color: #fff;
  background: var(--color-primary);
  box-shadow: 0 12px 28px rgba(47, 45, 42, 0.18);
}

.button--secondary {
  color: var(--color-text);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.button--danger {
  color: #fff;
  background: var(--color-danger);
}

.button--ghost {
  min-height: 38px;
  padding-inline: 14px;
  border-color: var(--color-border);
  background: transparent;
}

.button--saved {
  color: var(--color-text);
  background: var(--color-primary-soft);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 14px;
  margin-bottom: 16px;
}

.search-field input,
.input,
.select,
.textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  box-shadow: 0 10px 30px rgba(47, 45, 42, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-field input,
.input,
.select {
  min-height: 50px;
  border-radius: 999px;
}

.textarea {
  min-height: 120px;
  padding: 15px 18px;
  border-radius: 22px;
  resize: vertical;
}

.search-field input,
.input {
  padding: 0 20px;
}

.select {
  appearance: none;
  padding: 0 54px 0 20px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text) 50%),
    linear-gradient(135deg, var(--color-text) 50%, transparent 50%);
  background-position:
    calc(100% - 30px) 22px,
    calc(100% - 22px) 22px;
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
}

.search-field input:focus,
.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(47, 45, 42, 0.35);
  box-shadow: 0 0 0 4px rgba(48, 47, 44, 0.08);
}

/* Placeholder styled to match the page (Poppins, muted warm tone). */
.search-field input::placeholder,
.input::placeholder,
.textarea::placeholder {
  color: var(--color-muted);
  opacity: 0.7;
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.search-field input:focus::placeholder,
.input:focus::placeholder,
.textarea:focus::placeholder {
  opacity: 0.55;
}

/* Bold typed text in the search fields (placeholder stays regular weight above). */
input[type="search"] {
  font-weight: 600;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-button,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tag-button {
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  background: var(--color-surface);
}

.tag-button:hover,
.tag-button--active {
  color: #fff;
  background: var(--color-primary);
}

.tag {
  color: var(--color-muted);
  background: var(--color-surface-strong);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.palette-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 242, 0.78);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: palette-card-in 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes palette-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Gentle cascade so results ripple in as you search. */
.palette-card:nth-child(1) { animation-delay: 0ms; }
.palette-card:nth-child(2) { animation-delay: 65ms; }
.palette-card:nth-child(3) { animation-delay: 130ms; }
.palette-card:nth-child(4) { animation-delay: 195ms; }
.palette-card:nth-child(5) { animation-delay: 260ms; }
.palette-card:nth-child(6) { animation-delay: 325ms; }
.palette-card:nth-child(7) { animation-delay: 390ms; }
.palette-card:nth-child(8) { animation-delay: 455ms; }
.palette-card:nth-child(n + 9) { animation-delay: 500ms; }

@media (prefers-reduced-motion: reduce) {
  .palette-card {
    animation: none;
  }
}

.palette-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.palette-card__title {
  margin: 0 0 6px;
  font-size: 1.18rem;
  letter-spacing: -0.04em;
}

.palette-card__meta {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.palette-card__colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 130px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(47, 45, 42, 0.08);
}

.color-swatch {
  position: relative;
  border: 0;
  background: var(--swatch-color);
  -webkit-tap-highlight-color: transparent;
}

.color-swatch::after {
  content: attr(data-color);
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translate(-50%, 10px);
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.48);
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  transition:
    opacity 260ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.color-swatch:hover::after,
.color-swatch:focus-visible::after,
.color-swatch--revealed::after {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* On touch devices hover "sticks", so suppress the hover reveal — but only when the
   swatch is not explicitly revealed by a tap (.color-swatch--revealed wins). */
@media (hover: none) {
  .color-swatch:not(.color-swatch--revealed):hover::after {
    transform: translate(-50%, 10px);
    opacity: 0;
  }
}

.palette-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.palette-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.contrast-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--color-text);
  background: var(--color-primary-soft);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 44px 24px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  background: rgba(255, 250, 242, 0.58);
  animation: empty-state-in 550ms ease both;
}

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

.empty-state h3 {
  margin-bottom: 8px;
  animation: empty-line-in 500ms ease 120ms both;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--color-muted);
  animation: empty-line-in 500ms ease 280ms both;
}

@keyframes empty-line-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .empty-state,
  .empty-state h3,
  .empty-state p {
    animation: none;
  }
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 36px));
}

.toast {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  animation: toast-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: opacity 250ms ease, transform 250ms ease;
}

.toast--error {
  color: #fff;
  background: var(--color-danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.hint {
  color: var(--color-muted);
  font-weight: 500;
}

.code-output {
  min-height: 520px;
  padding: 22px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: #f7f2eb;
  background: #252421;
  font-size: 0.9rem;
  line-height: 1.7;
}


.native-select--enhanced {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* When JS is present, hide the native select before it is enhanced (keeps its box,
   so no layout shift) to avoid a flash of the native control on page load. */
.js select.select:not(.native-select--enhanced) {
  opacity: 0;
}

.custom-select {
  position: relative;
  width: 100%;
  z-index: 5;
}

.custom-select--open {
  z-index: 35;
}

.custom-select__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  padding: 0 22px 0 28px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(255, 250, 242, 0.82));
  box-shadow: 0 10px 30px rgba(47, 45, 42, 0.04);
  font-weight: 700;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.custom-select__button:hover,
.custom-select--open .custom-select__button {
  border-color: rgba(47, 45, 42, 0.28);
  box-shadow: 0 0 0 4px rgba(48, 47, 44, 0.07), 0 12px 34px rgba(47, 45, 42, 0.08);
}

.custom-select__button:focus-visible {
  outline: none;
  border-color: rgba(47, 45, 42, 0.38);
  box-shadow: 0 0 0 4px rgba(48, 47, 44, 0.12);
}

.custom-select__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__chevron {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin-right: 2px;
  border-radius: 50%;
  background: rgba(48, 47, 44, 0.08);
  transition: transform var(--transition), background var(--transition);
}

.custom-select__chevron::before,
.custom-select__chevron::after {
  content: "";
  position: absolute;
  top: 16px;
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-text);
}

.custom-select__chevron::before {
  left: 10px;
  transform: rotate(45deg);
}

.custom-select__chevron::after {
  right: 10px;
  transform: rotate(-45deg);
}

.custom-select--open .custom-select__chevron {
  transform: rotate(180deg);
  background: rgba(48, 47, 44, 0.13);
}

.custom-select__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 290px;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 24px 70px rgba(47, 45, 42, 0.18);
  backdrop-filter: blur(18px);
  animation: custom-select-in 150ms ease both;
}

.custom-select__menu[hidden] {
  display: none !important;
}

.custom-select__option {
  display: flex;
  align-items: center;
  min-height: 42px;
  width: 100%;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  color: var(--color-muted);
  background: transparent;
  font-weight: 700;
  text-align: left;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  outline: none;
  color: var(--color-text);
  background: var(--color-primary-soft);
}

.custom-select__option--selected {
  color: #fff;
  background: var(--color-primary);
}

.custom-select__option--selected:hover,
.custom-select__option--selected:focus-visible {
  color: #fff;
  background: var(--color-primary);
}

@keyframes custom-select-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* Custom search clear button (home + export). The native webkit button is hidden and
   replaced with a real, perfectly-centered button for full control and cross-browser. */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  display: block;
}

/* Room on the right so the text never runs under the clear button. */
.search-field input[type="search"],
.search-input-wrap input[type="search"] {
  padding-right: 58px;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  display: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  cursor: pointer;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' stroke='%23746c63' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 21px 21px;
  transition: transform var(--transition), background-image var(--transition);
}

/* Show only when the field has text (placeholder no longer shown). */
.search-field input[type="search"]:not(:placeholder-shown) ~ .search-clear,
.search-input-wrap input[type="search"]:not(:placeholder-shown) ~ .search-clear {
  display: block;
}

.search-clear:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' stroke='%23302f2c' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E");
  transform: translateY(-50%) scale(1.12);
}

.search-clear:active {
  transform: translateY(-50%) scale(0.92);
}

.search-clear:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Custom select viewport fit — v3.2 */
.custom-select__menu {
  max-height: min(280px, calc(100vh - 180px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.custom-select__menu[hidden] {
  display: none !important;
}

.custom-select__option {
  min-height: 42px;
}

.export-panel .custom-select__menu {
  max-height: 220px;
}


/* Bottom info panel — v3.2 */
.site-footer {
  margin-top: 44px;
  margin-bottom: 24px;
}

.site-footer__panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 242, 0.84);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.site-footer__eyebrow {
  margin: 0 0 6px;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-footer__text {
  max-width: 680px;
  margin: 0;
  color: var(--color-muted);
  line-height: 1.7;
}

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* The [hidden] attribute must beat the display rules above (admin-only links). */
.site-footer__meta[hidden] {
  display: none !important;
}

.site-footer__meta span,
.site-footer__meta a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  background: var(--color-surface);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.site-footer__meta a {
  color: #fff;
  background: var(--color-primary);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.site-footer__meta a:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(47, 45, 42, 0.14);
}

@media (max-width: 820px) {
  .site-footer__panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer__meta {
    justify-content: flex-start;
  }
}

/* Footer project highlights — v3.2 */
.site-footer__content {
  display: grid;
  gap: 12px;
}

.site-footer__features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer__features span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid rgba(47, 45, 42, 0.12);
  border-radius: 999px;
  color: var(--color-text);
  background: rgba(239, 231, 220, 0.72);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.site-footer__meta {
  min-width: max-content;
}

@media (max-width: 820px) {
  .site-footer__meta {
    min-width: 0;
  }

  .site-footer__features span {
    white-space: normal;
  }
}

/* Changelog page — v3.2 */
.changelog-layout {
  display: grid;
  gap: 18px;
  padding-bottom: 34px;
}

.changelog-card {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 242, 0.82);
  box-shadow: var(--shadow-soft);
}

.changelog-card__version {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 0 0 12px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--color-primary);
  font-size: 0.84rem;
  font-weight: 800;
}

.changelog-card h2 {
  margin-bottom: 12px;
}

.changelog-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--color-muted);
  line-height: 1.7;
}

/* Email verification */
.verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(233, 86, 35, 0.35);
  background: rgba(233, 86, 35, 0.1);
}

.verify-banner__text {
  margin: 0;
  flex: 1 1 240px;
  color: var(--color-text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.site-header--bare {
  justify-content: center;
}

.auth-card--centered {
  margin: 0 auto;
  max-width: 460px;
  text-align: center;
}

.form-actions--centered {
  justify-content: center;
}

/* Verify page: center the card in the viewport with breathing room below the header. */
.verify-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  padding: clamp(32px, 8vh, 96px) 16px 48px;
}

.verify-shell .auth-card--centered {
  width: min(460px, 100%);
}
