@font-face {
  font-family: "Typographic Onedalism";
  src:
    url("https://www.stevec.dev/c/files/TypographicOnedalism.woff2")
      format("woff2"),
    url("https://www.stevec.dev/c/files/TypographicOnedalism.woff")
      format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --h1: "Typographic Onedalism", serif;
  --monospace: "JetBrains Mono", monospace;

  --gradient: linear-gradient(335deg, #345582, #154d8245, #1e3f3e);
  --bg-color: #0e292b;
  --surface-color: #1a1d24;
  --surface-hover: #22262f;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --panel-bg: rgba(26, 29, 36, 0.65);
  --panel-backdrop: blur(40px);

  --hdr-gradient: conic-gradient(
    at top center in oklch,
    oklch(24.395% 0.00934 234.238) 0%,
    oklch(0% 0 0) 100%
  );
  --sdr-gradient: conic-gradient(at top left, #3c6b3c 0%, #0003ff 100%);

  background: var(--hdr-gradient);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background-color: var(--hdr-gradient);
}

body {
  font-family: var(--h1);

  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Header */
.app-header {
  padding: 1rem 2rem;
  text-align: center;
  background: linear-gradient(
    to bottom,
    rgba(32, 3, 3, 0.84) 13%,
    rgb(7, 9, 11, 0.9) 40%,
    rgba(35, 17, 21, 0.86) 90%,
    rgb(36, 26, 34) 100%
  );
  position: sticky;
  top: 0;
  z-index: 10;
  pointer-events: none;
}

.header-content {
  pointer-events: auto;
}

h1 {
  font-family: var(--h1);
  font-size: 4rem;
  font-weight: 800;
  /* margin-bottom: 0.5rem; */
  background: var(--sdr-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-content p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.controls-container {
  display: flex;
  gap: 1rem;
  max-width: 680px;
  margin: 0 auto;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.search-container {
  flex: 1;
  min-width: 280px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 9999px;
}

.sort-container {
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 9999px;
}

.sort-icon {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#sort-select,
input {
  appearance: none;
  background-color: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 1rem 3rem 1rem 1.5rem;
  border-radius: 9999px;
  font-family: var(--monospace);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#sort-select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
  background-color: var(--surface-hover);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

#search-input {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
  color: var(--text-main);
  font-family: var(--monospace);
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

#search-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
  background-color: var(--surface-hover);
}

/* Main Grid */
.app-main {
  padding: 0 2rem 4rem;
  max-width: 1400px;
  margin: 0 auto;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* Color Card */
.color-card {
  background-color: var(--surface-color);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.color-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 32px -10px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

.color-card-swatch {
  height: 140px;
  width: 100%;
  position: relative;
}

.color-card-info {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.color-card-name {
  font-family: var(--monospace);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: capitalize;
}

.color-card-hex {
  font-family: var(--monospace);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

/* Badge */
.badge {
  font-size: 1rem;
  text-transform: uppercase;
  font-weight: 800;
  background: var(--gradient);
  color: white;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* Detail Panel */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}

.detail-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background: var(--panel-bg);
  backdrop-filter: var(--panel-backdrop);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
  transition: right 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.5);
}

.detail-panel.active {
  right: 0;
}

.panel-header {
  padding: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transform: scale(1.1);
}

.panel-hero {
  padding: 0 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.panel-swatch {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
  border: 6px solid var(--surface-color);
  transition: background-color 0.3s;
}

.panel-title-area {
  text-align: center;
}

.panel-title-area h2 {
  font-size: 2.25rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: -0.02em;
}

.panel-formats {
  padding: 0 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: rgba(26, 29, 36, 0.8);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
}

.format-row:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(34, 38, 47, 0.9);
  transform: translateY(-2px);
}

.format-row--highlight {
  background: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.15),
    rgba(236, 72, 153, 0.15)
  );
  border-color: rgba(99, 102, 241, 0.4);
}

.format-row--highlight:hover {
  border-color: rgba(99, 102, 241, 0.7);
  background: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.2),
    rgba(236, 72, 153, 0.2)
  );
}

.format-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.format-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.format-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.97rem;
  color: var(--text-main);
}

.copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.copy-btn--primary {
  background: var(--gradient);
  border: none;
  color: white;
  padding: 0.4rem 1rem;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.copy-btn--primary:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(236, 72, 153, 0.4);
  background: var(--linear);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(150px);
  background: white;
  color: #0f1115;
  padding: 0.875rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
