/* /css/redesign.css — Huezit Playful Accessible Redesign */

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

:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-subtle: #dbe2ea;
  --text-main: #0b0f19;
  --text-muted: #334155;
  --brand-blue: #1d4ed8;
  --brand-coral: #c81e45;
  --brand-coral-hover: #a81638;
  --brand-gradient: linear-gradient(135deg, #0160d1 0%, #0cc5a9 35%, #f5cd2e 68%, #eb1265 100%);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
}

:focus-visible {
  outline: 3px solid #1d4ed8 !important;
  outline-offset: 2px !important;
}

/* ====== HEADER & NAV ====== */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  background-color: #ffffff;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 6px;
  border-radius: 12px;
}

#huezit-embed {
  height: 32px;
  width: auto;
  display: block;
}

path {
  transition: fill 0.4s ease;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: #ffffff;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}

.nav-link:hover {
  background-color: #f1f5f9;
  transform: translateY(-1px);
}

.nav-link.is-active {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 700;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
}

/* ====== HOME HERO (MOCKUP STYLE) ====== */
.home-hero-section {
  position: relative;
  overflow: hidden;
  padding: 40px 24px 36px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1d4ed8;
  background-color: var(--bg-page);
  margin: 0 0 14px;
}

.hero-h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(2.5rem, 5vw, 4.35rem);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.035em;
  color: var(--text-main);
  margin: 0 0 20px;
}

.text-brand {
  color: #1d4ed8;
}

.hero-lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 0 28px;
  line-height: 1.6;
}

.btn-coral-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  min-width: 44px;
  padding: 0 28px;
  border-radius: 999px;
  background-color: var(--brand-coral);
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(200, 30, 69, 0.25);
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.btn-coral-cta:hover {
  background-color: var(--brand-coral-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(200, 30, 69, 0.32);
}

.btn-coral-cta:active {
  transform: translateY(0);
}

/* Decorative blobs & Hero Preview Card */
.hero-visual-wrap {
  position: relative;
  padding: 22px 12px;
}

.hero-blob {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

.hero-blob-yellow {
  width: 340px;
  height: 120px;
  background-color: #ffd43b;
  top: -12px;
  left: 6%;
  transform: rotate(-14deg);
}

.hero-blob-purple {
  width: 140px;
  height: 190px;
  background-color: #8b5cf6;
  top: -26px;
  right: 10%;
  transform: rotate(-18deg);
}

.hero-blob-coral {
  width: 240px;
  height: 105px;
  background-color: #ff6b6b;
  bottom: 62px;
  left: -18px;
  transform: rotate(-12deg);
}

.hero-blob-blue {
  width: 240px;
  height: 96px;
  background-color: #2563ff;
  bottom: 6px;
  left: -12px;
  transform: rotate(-14deg);
}

.hero-blob-mint {
  width: 180px;
  height: 96px;
  background-color: #34d399;
  bottom: 12px;
  right: -10px;
  transform: rotate(-12deg);
}

.hero-preview-card {
  position: relative;
  z-index: 2;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.hero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-card-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.hero-card-gen-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.14s ease;
}

.hero-card-gen-btn:hover {
  background-color: #f1f5f9;
  transform: translateY(-1px);
}

.hero-mini-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.hero-mini-swatch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: none;
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  border-radius: 14px;
  min-height: 44px;
  min-width: 44px;
}

.hero-mini-swatch-color {
  width: 100%;
  height: 76px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: block;
}

.hero-mini-swatch-hex {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  background-color: #ffffff;
}

.hero-card-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.hero-subcard {
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 14px;
  background-color: #f8fafc;
}

.hero-subcard-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 10px;
}

.hero-contrast-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-circles {
  display: flex;
  align-items: center;
}

.hero-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.hero-circle + .hero-circle {
  margin-left: -14px;
}

.hero-ratio-num {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.hero-aa-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: #d1fae5;
  color: #065f46;
  font-size: 0.75rem;
  font-weight: 800;
}

.hero-preview-pillbox {
  background-color: #1d4ed8;
  color: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

/* ====== 4 FEATURE CARDS ROW ====== */
.feature-cards-section {
  max-width: 1320px;
  margin: 0 auto 36px;
  padding: 0 24px;
  width: 100%;
}

.feature-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.feature-card {
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.13);
}

.feature-card.card-coral {
  background-color: #ff6b6b;
  color: #0b0f19;
}

.feature-card.card-blue {
  background-color: #1d4ed8;
  color: #ffffff;
}

.feature-card.card-yellow {
  background-color: #ffd43b;
  color: #0b0f19;
}

.feature-card.card-mint {
  background-color: #34d399;
  color: #0b0f19;
}

.feature-card h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 10px 0 6px;
  color: inherit;
}

.feature-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: inherit;
}

.feature-card-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background-color: #ffffff;
  color: #0b0f19;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease;
}

.feature-card-arrow:hover {
  transform: scale(1.06);
}

/* ====== PALETTE GENERATOR SECTION ====== */
.generator-section {
  max-width: 1320px;
  margin: 0 auto 48px;
  padding: 28px 24px 0;
  width: 100%;
}

.generator-header {
  text-align: center;
  margin-bottom: 22px;
}

.generator-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--text-main);
}

.palette-hex-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.9rem;
  font-weight: 700;
}

.generator-subtitle {
  margin: 0 auto;
  max-width: 580px;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* Toolbar */
.generator-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.generator-toolbar button,
.generator-toolbar .icon-button {
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.16s ease, transform 0.14s ease, border-color 0.16s ease;
}

.generator-toolbar button.btn-primary-action {
  background-color: var(--brand-coral);
  border-color: var(--brand-coral);
  color: #ffffff;
}

.generator-toolbar button:hover,
.generator-toolbar .icon-button:hover {
  background-color: #e2e8f0;
  transform: translateY(-1px);
}

.generator-toolbar button.btn-primary-action:hover {
  background-color: var(--brand-coral-hover);
}

.generator-toolbar .icon-button input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.hue-picker-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.styled-dropdown {
  appearance: none;
  background-color: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
}

.swatch-preview {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 2px dashed #64748b;
  background-color: #ffffff;
  display: inline-block;
  cursor: pointer;
  flex-shrink: 0;
}

/* ====== PALETTE CONTAINER & SWATCH PANELS ====== */
#paletteContainer {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.color-box {
  --panel-fg: #000000;
  flex: 1 1 0;
  min-width: 0;
  min-height: 310px;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background-color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.color-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.15);
}

.swatch-color-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  width: 100%;
}

.panel-top-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lock-button,
.delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.lock-button.is-locked {
  box-shadow: 0 0 0 2px currentColor;
}

.lock-button:hover,
.delete-button:hover {
  transform: scale(1.04);
}

.color-meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 16px;
}

.swatch-value-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1.5px solid currentColor;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease;
}

.swatch-value-btn:hover {
  transform: translateY(-1px);
}

.hex-text {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.rgb-text,
.hsl-text {
  font-size: 0.76rem;
  font-weight: 600;
}

/* Accessibility contrast helper info per swatch (C6) */
.swatch-a11y-helper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed currentColor;
  opacity: 0.95;
}

.a11y-helper-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.a11y-helper-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.a11y-ratio-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid currentColor;
  background-color: rgba(255, 255, 255, 0.12);
  display: inline-block;
  white-space: nowrap;
}

.is-light-swatch .a11y-ratio-badge {
  background-color: rgba(0, 0, 0, 0.08);
}

/* ====== BOTTOM GENERATE + LIVE EXPORT CARDS ====== */
.generator-bottom-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 20px;
  align-items: stretch;
}

.gen-cta-card,
.export-live-card {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.gen-cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.btn-big-generate {
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  background-color: var(--brand-coral);
  color: #ffffff;
  border: none;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(200, 30, 69, 0.25);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-big-generate:hover {
  background-color: var(--brand-coral-hover);
  transform: translateY(-2px);
}

.space-caption {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.export-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.export-card-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
}

.export-card-desc {
  font-size: 0.82rem;
  color: #475569;
  margin: 4px 0 0;
  font-weight: 500;
}

.cvd-active-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background-color: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 14px;
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.cvd-reset-btn {
  background-color: #ffffff;
  border: 1px solid #d97706;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
  transition: background-color 0.15s ease;
}

.cvd-reset-btn:hover {
  background-color: #fef08a;
}

.swatch-cvd-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.28);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 6px;
  backdrop-filter: blur(2px);
}

.export-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: 14px;
}

.export-tab-btn {
  min-height: 44px;
  min-width: 76px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background-color: #f1f5f9;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.export-tab-btn.is-active {
  background-color: #1d4ed8;
  color: #ffffff;
}

.export-code-wrap {
  position: relative;
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 56px 16px 16px;
}

.export-code-wrap pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #0f172a;
  background-color: #f8fafc;
  overflow-x: auto;
}

.copy-export-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.copy-export-btn:hover {
  background-color: #e2e8f0;
}

/* ====== FOOTER ====== */
.site-footer {
  margin-top: auto;
  background-color: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 20px 24px;
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-main);
  background-color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-link:hover {
  background-color: #f1f5f9;
  color: #1d4ed8;
}

/* ====== TOAST & IN-PAGE MODALS ====== */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background-color: #0f172a;
  color: #ffffff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1500;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1400;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  color: var(--text-main);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-main);
}

.modal-close-btn {
  background-color: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-swatch-strip {
  display: flex;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
}

.modal-swatch-chip {
  flex: 1;
  height: 100%;
}

.modal-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 12px;
}

.modal-error {
  color: #9f1239;
  background-color: #ffe4e6;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: #f1f5f9;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-btn.primary {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.contrast-pair-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contrast-pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
}

.contrast-sample-chip {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  border: 1px solid rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
}

.contrast-pair-meta {
  flex: 1;
  min-width: 0;
}

.contrast-pair-codes {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.contrast-pair-ratio {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
}

.contrast-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-aaa, .badge-aa {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-aa-large {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-fail {
  background-color: #ffe4e6;
  color: #9f1239;
}

/* ====== RESPONSIVE / MOBILE 390 ====== */
@media (max-width: 960px) {
  .home-hero-grid {
    grid-template-columns: 1fr;
  }
  .feature-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .generator-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 10px 14px;
    flex-wrap: wrap;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .primary-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .nav-link {
    justify-content: flex-start;
    width: 100%;
  }

  .home-hero-section {
    padding: 24px 14px 20px;
  }

  .hero-card-subgrid {
    grid-template-columns: 1fr;
  }

  .hero-mini-swatches {
    gap: 4px;
  }

  .hero-mini-swatch-color {
    height: 48px;
  }

  .hero-mini-swatch-hex {
    font-size: 0.62rem;
  }

  .feature-cards-section {
    padding: 0 14px;
  }

  .feature-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .generator-section {
    padding: 16px 14px 0;
  }

  .generator-toolbar {
    justify-content: flex-start;
    padding: 10px;
    gap: 6px;
  }

  .generator-toolbar button,
  .generator-toolbar .icon-button {
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .styled-dropdown {
    min-height: 44px;
    max-width: 128px;
    font-size: 0.8rem;
  }

  #paletteContainer {
    flex-direction: column;
    gap: 12px;
  }

  .color-box {
    width: 100%;
    min-height: auto;
  }

  .color-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .swatch-value-btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ====== RELATED TOOLS CROSS-LINKS ====== */
.related-tools-section {
  max-width: 1320px;
  margin: 40px auto 20px;
  padding: 0 24px;
  width: 100%;
}

.related-tools-card {
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.related-tools-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--text-main);
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.related-tool-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-main);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.related-tool-item:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.08);
}

.related-tool-item svg {
  color: #1d4ed8;
  flex-shrink: 0;
}

.related-tool-item strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.related-tool-item span {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Palette Empty State */
.palette-empty-state {
  width: 100%;
  padding: 48px 24px;
  text-align: center;
  background-color: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
}

.empty-state-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 8px;
}

.empty-state-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* Generator & Contrast Workspace Loading and Error States */
.generator-error-box,
.contrast-error-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: #ffe4e6;
  border: 1px solid #fecdd3;
  color: #9f1239;
  padding: 10px 16px;
  border-radius: 14px;
  margin: 12px 0 16px;
  font-weight: 600;
  font-size: 0.92rem;
}

.generator-error-text,
.contrast-error-text {
  flex: 1;
}

.btn-retry,
.generator-retry-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background-color: #e11d48;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.btn-retry:hover,
.generator-retry-btn:hover {
  background-color: #be123c;
}
