/* Lobe Icons cheat sheet — page styles. Swiss/utilitarian, dark-first. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

/* ----- Aurora background ----- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--color-bg-primary);
  pointer-events: none;
}

.aurora__layer {
  position: absolute;
  inset: -10px;
  opacity: 0.3;
  filter: blur(10px);
  background-image:
    repeating-linear-gradient(
      100deg,
      var(--aurora-band) 0%,
      var(--aurora-band) 7%,
      transparent 10%,
      transparent 12%,
      var(--aurora-band) 16%
    ),
    repeating-linear-gradient(
      100deg,
      #3b82f6 10%,
      #a5b4fc 15%,
      #93c5fd 20%,
      #ddd6fe 25%,
      #60a5fa 30%
    );
  background-size:
    300% 100%,
    200% 100%;
  background-position:
    50% 50%,
    50% 50%;
  /* Top-anchored fade so the glow sits behind the hero, not the grid. */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  animation: aurora-drift 100s linear infinite;
}

@keyframes aurora-drift {
  0% {
    background-position:
      50% 50%,
      50% 50%;
  }
  100% {
    background-position:
      350% 50%,
      350% 50%;
  }
}

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

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background var(--duration-fast) var(--easing-default),
    border-color var(--duration-fast) var(--easing-default),
    color var(--duration-fast) var(--easing-default);
}

.btn .li {
  font-size: 1.1em;
}

.btn--solid {
  background: var(--color-text-primary);
  color: var(--color-bg-primary);
}

.btn--solid:hover {
  /* Lighten/darken the inverted surface relative to the page so the label
     stays legible in both dark and light palettes. */
  background: color-mix(
    in srgb,
    var(--color-text-primary) 88%,
    var(--color-bg-primary)
  );
}

.btn--outline {
  position: relative;
  isolation: isolate;
  background: var(--color-bg-primary);
  border-color: transparent;
  color: var(--color-text-primary);
}

/* Animated gradient border ring (lobehub "View all icons" style). */
.btn--outline::before,
.btn--outline::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(-45deg, #ffb224, #e34ba9, #0072f5, #95f3d9);
  background-size: 300% 300%;
  animation: btn-border 5s ease infinite;
}

.btn--outline::before {
  z-index: -1;
  padding: 1px;
  /* Show the gradient only as a ring by masking out the inner content box. */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.btn--outline::after {
  z-index: -2;
  filter: blur(9px);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-default);
}

.btn--outline:hover::after {
  opacity: 0.5;
}

@keyframes btn-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn--outline::before,
  .btn--outline::after {
    animation: none;
  }
}

.btn--ghost {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-primary);
  color: var(--color-text-primary);
}

.btn--ghost:hover {
  background: var(--color-bg-hover);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ----- Header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--color-border-primary);
  background: color-mix(in srgb, var(--color-bg-primary) 80%, transparent);
  backdrop-filter: blur(8px);
}

.site-header__inner {
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
}

.site-header__brand .li {
  font-size: 1.25em;
}

/* ----- Layout ----- */
.site-main {
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

/* ----- Hero ----- */
.hero {
  text-align: center;
  padding: var(--space-8) 0 var(--space-7);
}

.hero__title {
  margin: 0 0 var(--space-3);
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

/* Solid fallback first; gradient text only where background-clip is supported,
   otherwise the word would render invisible. */
.hero__accent {
  color: var(--color-accent);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .hero__accent {
    background: linear-gradient(
      90deg,
      #3b82f6,
      #93c5fd 40%,
      #a5b4fc 70%,
      #60a5fa
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* The pale-blue stops fail contrast on a white page; darken for light mode. */
  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .hero__accent {
      background-image: linear-gradient(90deg, #0a5cc0, #2b7fff 50%, #0969da);
    }
  }
}

.hero__subtitle {
  margin: 0 auto var(--space-5);
  max-width: 36rem;
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
}

.hero__link {
  color: var(--color-text-primary);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border-primary);
}

.hero__link:hover {
  border-bottom-color: var(--color-text-primary);
}

.hero__link .li {
  font-size: 1.1em;
  vertical-align: -0.12em;
}

.hero__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ----- Search ----- */
.search {
  position: relative;
  margin: 0 auto var(--space-5);
  max-width: 640px;
  scroll-margin-top: 5.5rem;
}

.search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.search__icon {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search__input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3)
    calc(var(--space-4) * 2 + 18px);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
}

.search__input::placeholder {
  color: var(--color-text-tertiary);
}

.search__input:focus-visible {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

/* ----- Grid ----- */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* auto-fill keeps empty tracks so a handful of filtered results stay their
     natural width instead of stretching across the row; min() guards against
     overflow below the track min. */
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(var(--grid-item-min), 100%), 1fr)
  );
  gap: var(--space-3);
  scroll-margin-top: var(--space-7);
}

.card[hidden] {
  display: none;
}

/* ----- Card ----- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* 300+ cards render up front; skip layout/paint for off-screen ones. */
  content-visibility: auto;
  contain-intrinsic-size: auto 156px;
}

.card__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  cursor: pointer;
}

.card__glyph .li {
  font-size: 44px;
}

.card__glyph:hover {
  background: var(--color-bg-tertiary);
}

.card__glyph:focus-visible {
  /* Inset so the ring isn't clipped by the card's overflow: hidden. */
  outline: 2px solid var(--color-border-focus);
  outline-offset: -2px;
}

.card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
}

.card__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- Card footer (hex | U+ | </>) ----- */
.card__footer {
  display: flex;
  border-top: 1px solid var(--color-border-secondary);
}

.card__footer-cell {
  height: 32px;
  border: none;
  border-left: 1px solid var(--color-border-secondary);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__footer-cell:first-child {
  border-left: none;
}

.card__hex {
  flex: 1 1 auto;
  letter-spacing: var(--letter-spacing-wide);
}

.card__footer-cell--narrow {
  flex: 0 0 38px;
}

.card__footer-cell:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.card__footer-cell:focus-visible {
  /* Inset so the ring isn't clipped by the card's overflow: hidden. */
  outline: 2px solid var(--color-border-focus);
  outline-offset: -2px;
  z-index: 1;
}

/* Copied confirmation: a quick press-and-settle bounce on the clicked button. */
@keyframes copy-bounce {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(0.86);
  }
  70% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

/* Bounce only the glyph / label, not the whole button box. */
.card__cell-label {
  display: inline-block;
}

.card__glyph.is-copied .li,
.card__footer-cell.is-copied .card__cell-label {
  animation: copy-bounce var(--duration-normal) var(--easing-default);
}

@media (prefers-reduced-motion: reduce) {
  .card__glyph.is-copied .li,
  .card__footer-cell.is-copied .card__cell-label {
    animation: none;
  }
}

/* ----- Empty state ----- */
.empty-state {
  margin: var(--space-6) 0;
  color: var(--color-text-secondary);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

/* ----- Footer ----- */
.site-footer {
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--color-border-primary);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-text-primary);
}

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%) translateY(var(--space-3));
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--duration-normal) var(--easing-default),
    transform var(--duration-normal) var(--easing-default);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----- Mobile ----- */
@media (max-width: 768px) {
  .site-main {
    padding: var(--space-5) var(--space-3);
  }

  .search__input {
    max-width: 100%;
  }
}

@media (max-width: 375px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
