@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,650&display=swap");

:root {
  --bg: #f4efe8;
  --bg-2: #ece4f7;
  --ink: #17141f;
  --muted: #5e5668;
  --card: rgba(255, 253, 250, 0.78);
  --card-solid: #fffdf9;
  --line: rgba(23, 20, 31, 0.1);
  --accent: #c43b6e;
  --accent-2: #4d47e5;
  --shadow: 0 18px 50px rgba(62, 36, 84, 0.12);
  --radius: 22px;
  --wrap: 1120px;
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 8% -10%, #ffd3e4 0%, transparent 55%),
    radial-gradient(800px 520px at 100% 0%, #cfc4ff 0%, transparent 50%),
    radial-gradient(700px 420px at 80% 100%, #c8f3ea 0%, transparent 48%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.55;
}
img, canvas { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.wrap {
  width: min(var(--wrap), calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 40;
  margin: 12px auto 0;
  width: min(var(--wrap), calc(100% - 32px));
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
}
.logo-mark {
  width: 22px;
  height: 22px;
  background: conic-gradient(from 210deg, #ff5d8f, #7a5cff, #2ec8c8, #ffd166, #ff5d8f);
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.site-nav a {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: #17141f;
  color: #fff;
}
.nav-toggle {
  display: none;
  border: 0;
  background: #17141f;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.hero, .page-head {
  padding: 42px 0 18px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
h1, h2, h3 { letter-spacing: -0.04em; line-height: 1.12; margin: 0 0 12px; }
h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.15rem, 5.4vw, 3.85rem);
  font-weight: 650;
  max-width: 16ch;
  font-optical-sizing: auto;
}
.hero h1, .page-head h1 { max-width: 18ch; }
.lede, .page-head p {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(12px);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: end;
  margin-bottom: 18px;
}
.field { display: grid; gap: 8px; min-width: min(100%, 220px); }
.field span, .field label { font-size: 0.82rem; font-weight: 650; color: var(--muted); }
input[type="text"], input[type="email"], input[type="search"], input[type="color"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
}
input[type="range"] { width: min(420px, 100%); accent-color: var(--accent-2); }
textarea { min-height: 140px; resize: vertical; }

.btn, .btn-ghost {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
}
.btn { background: #17141f; color: #fff; }
.btn:hover { transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92rem;
}

.octagon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
}
.swatch {
  aspect-ratio: 1;
  border: 0;
  padding: 8px 4px;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  display: grid;
  place-items: center;
  text-align: center;
  transition: transform 0.16s ease, filter 0.16s ease;
}
.swatch:hover, .swatch:focus-visible, .swatch.is-selected {
  transform: scale(1.08);
  filter: drop-shadow(0 10px 16px rgba(23, 20, 31, 0.22));
  z-index: 1;
}

.selected-bar {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 4px 0 22px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}
input[type="color"] {
  height: 46px;
  padding: 4px;
  cursor: pointer;
}
.selected-preview {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}
.selected-meta h3 { margin-bottom: 4px; font-size: 1.2rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
}

.prose {
  display: grid;
  gap: 14px;
  color: var(--muted);
  padding: 28px 0 48px;
  max-width: 78ch;
  counter-reset: chapter;
}
.prose h2, .prose h3 { color: var(--ink); }
.prose h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.18;
  max-width: 22ch;
}
.prose h2::before {
  counter-increment: chapter;
  content: counter(chapter, decimal-leading-zero);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.prose h3 {
  margin-top: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  max-width: none;
}
.prose ul, .prose ol { margin: 0; padding-left: 1.2em; }
.prose li { margin: 8px 0; }
.prose li strong { color: var(--ink); }
.prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.feature-grid, .use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 8px 0 28px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.card h3 { font-size: 1.05rem; }
.card p, .card li { color: var(--muted); }

.palette-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 280px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.palette-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  color: #fff;
  min-height: 220px;
}
.lock {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: inherit;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.mini-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 92px;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}
.converter-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
}
.preview-block {
  height: 180px;
  border-radius: 24px;
  border: 1px solid var(--line);
}
.color-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.color-table th, .color-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: inline-block;
  vertical-align: middle;
}
.image-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  background:
    linear-gradient(var(--card-solid), var(--card-solid)),
    repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 18px 18px;
  border-radius: 18px;
  overflow: hidden;
}
.image-stage canvas { cursor: crosshair; max-height: 520px; }
.picked-list { display: flex; flex-wrap: wrap; gap: 10px; }
.picked {
  width: 72px;
  border: 0;
  background: transparent;
  padding: 0;
}
.picked span {
  display: block;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.legal { max-width: 78ch; }
.legal h2 { margin-top: 28px; }
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.site-footer {
  margin-top: 48px;
  padding: 28px 0 36px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: #17141f;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 80;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .nav-toggle { display: grid; place-items: center; }
  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
    flex-direction: column;
  }
  .site-nav.is-open { display: flex; }
  .site-header { position: relative; }
  .header-inner { border-radius: 22px; }
  .selected-bar, .converter-grid, .contact-grid { grid-template-columns: 1fr; }
  .palette-row { grid-template-columns: 1fr; min-height: unset; }
  .palette-swatch { min-height: 92px; }
  h1 { max-width: none; }
}
