:root {
  --ink: #171716;
  --muted: #77756f;
  --line: #deddd8;
  --paper: #f4f3ef;
  --white: #fbfaf7;
  --accent: #5b5bd6;
}

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Manrope, system-ui, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: auto; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.04em; }
.brand-mark { width: 20px; height: 20px; display: inline-block; border-radius: 50%; background: conic-gradient(#ff695e, #f2cc55, #58ba8b, #5b5bd6, #bd6cce, #ff695e); box-shadow: inset 0 0 0 5px var(--paper); }
.eyebrow, .kicker { font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow { color: var(--muted); }
.site-nav { display: flex; gap: 26px; font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover, .site-nav a.active { color: var(--ink); border-color: var(--ink); }
.hero { min-height: 355px; padding: 70px 0 56px; display: grid; grid-template-columns: 1.35fr .65fr; gap: 80px; align-items: end; }
.kicker { margin: 0 0 18px; color: var(--muted); }
h1 { font-size: clamp(45px, 6vw, 79px); line-height: .99; letter-spacing: -.065em; margin: 0; font-weight: 500; }
h1 em { font-family: Georgia, serif; font-weight: 400; }
.intro { max-width: 420px; margin: 0 0 4px; color: #54524e; font-size: 16px; line-height: 1.75; }
.studio { background: var(--white); border: 1px solid var(--line); padding: 28px; display: grid; grid-template-columns: 1.05fr 1fr 1.1fr auto; align-items: start; gap: 30px; box-shadow: 0 16px 45px rgba(40,35,25,.045); }
.control > label, .label-row label { display: block; font-weight: 650; font-size: 12px; margin-bottom: 11px; }
.color-input-wrap { height: 50px; display: flex; align-items: center; border: 1px solid #cfcdc6; background: #fff; padding: 5px 12px 5px 5px; }
input[type=color] { width: 40px; height: 40px; padding: 0; border: 0; cursor: pointer; background: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; }
#hexInput { min-width: 0; flex: 1; border: 0; outline: 0; padding: 0 12px; font: 500 14px "DM Mono", monospace; text-transform: uppercase; }
.valid-mark { color: #4e8b61; }
.valid-mark.invalid { color: #b44343; }
.label-row { display: flex; justify-content: space-between; }
.label-row output { font: 500 13px "DM Mono", monospace; }
input[type=range] { width: 100%; accent-color: var(--ink); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font: 10px "DM Mono", monospace; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 15px; top: 11px; pointer-events: none; }
select { appearance: none; width: 100%; height: 50px; background: #fff; border: 1px solid #cfcdc6; padding: 0 40px 0 14px; font-size: 13px; cursor: pointer; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.generate-button { height: 50px; margin-top: 25px; min-width: 184px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--ink); background: var(--ink); color: white; font-weight: 600; font-size: 12px; cursor: pointer; transition: .2s; }
.generate-button:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.results { padding: 66px 0 80px; }
.results-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 26px; }
h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; font-weight: 550; }
.actions { display: flex; gap: 24px; }
.text-button { border: 0; background: none; padding: 5px; cursor: pointer; font-size: 12px; }
.text-button:hover span { text-decoration: underline; text-underline-offset: 4px; }
.palette { display: grid; grid-template-columns: repeat(var(--count, 6), minmax(0, 1fr)); min-height: 355px; border: 1px solid rgba(0,0,0,.08); overflow: hidden; }
.swatch { position: relative; border: 0; min-height: 355px; padding: 18px 13px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; cursor: pointer; transition: flex .2s, filter .2s; overflow: hidden; }
.swatch:hover { filter: saturate(1.08); }
.swatch .hex { font: 500 11px "DM Mono", monospace; }
.swatch .index { position: absolute; top: 16px; font: 10px "DM Mono", monospace; opacity: .7; }
.swatch.seed::after { content: "SEED"; margin-top: 7px; font: 9px "DM Mono", monospace; letter-spacing: .1em; opacity: .75; }
.copy-help { color: var(--muted); text-align: center; font-size: 10px; margin: 14px 0 0; }
.method { border-top: 1px solid var(--line); padding: 70px 0 90px; display: grid; grid-template-columns: .75fr 1.25fr; gap: 80px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.method article { border-top: 1px solid var(--ink); padding-top: 13px; }
.method article span { font: 10px "DM Mono", monospace; color: var(--muted); }
.method h3 { font-size: 14px; margin: 28px 0 8px; }
.method article p { font-size: 11px; line-height: 1.7; color: var(--muted); margin: 0; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; font-size: 11px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr 1fr; }
  .generate-button { margin-top: 10px; }
  .palette { overflow-x: auto; grid-template-columns: repeat(var(--count), minmax(105px, 1fr)); }
  .method { grid-template-columns: 1fr; gap: 45px; }
}
@media (max-width: 600px) {
  .shell { width: min(100% - 24px, 1180px); }
  .eyebrow { display: none; }
  .hero { grid-template-columns: 1fr; gap: 35px; padding: 52px 0; }
  .studio { grid-template-columns: 1fr; gap: 22px; padding: 20px; }
  .generate-button { width: 100%; margin: 0; }
  .results-head { align-items: flex-start; gap: 20px; }
  .actions span { display: none; }
  .palette, .swatch { min-height: 300px; }
  .method-grid { grid-template-columns: 1fr; }
}

/* Collections */
.collection-hero { padding: 64px 0 48px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 70px; align-items: end; }
.collection-hero h1 { font-size: clamp(45px, 5.3vw, 72px); }
.collection-layout { display: grid; grid-template-columns: 230px 1fr; gap: 55px; padding-bottom: 100px; }
.collection-sidebar { position: sticky; top: 24px; align-self: start; }
.collection-sidebar h2 { font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 14px; }
.collection-list { display: grid; gap: 8px; }
.collection-list button { width: 100%; border: 1px solid var(--line); background: var(--white); padding: 14px; text-align: left; cursor: pointer; }
.collection-list button.active { border-color: var(--ink); }
.collection-list strong { display: block; font-size: 12px; }
.collection-list small { color: var(--muted); font: 9px "DM Mono", monospace; }
.collection-main { min-width: 0; }
.collection-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: start; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.collection-title-row p { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.collection-meta { display: flex; gap: 20px; white-space: nowrap; font: 9px "DM Mono", monospace; color: var(--muted); }
.collection-tools { padding: 20px 0; display: flex; gap: 12px; align-items: center; }
.search-wrap { flex: 1; position: relative; }
.search-wrap::before { content: "⌕"; position: absolute; left: 14px; top: 11px; color: var(--muted); }
.search-wrap input, .family-select { width: 100%; height: 42px; border: 1px solid var(--line); background: var(--white); padding: 0 14px; font-size: 11px; }
.search-wrap input { padding-left: 38px; }
.family-select { width: 175px; }
.result-count { font: 9px "DM Mono", monospace; color: var(--muted); min-width: 65px; text-align: right; }
.color-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.color-card { min-width: 0; border: 0; background: var(--white); padding: 0; text-align: left; cursor: pointer; position: relative; }
.color-card:hover .color-chip { transform: scale(.96); }
.color-card.selected::after { content: "✓"; position: absolute; right: 10px; top: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: white; font-size: 11px; }
.color-chip { height: 125px; transition: transform .2s; transform-origin: center; border-bottom: 1px solid rgba(0,0,0,.05); }
.color-info { padding: 11px 12px 13px; min-height: 66px; }
.color-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.color-info span { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font: 9px "DM Mono", monospace; }
.hex-copy { cursor: copy; }
.hex-copy:hover { color: var(--ink); text-decoration: underline; }
.catalogue-note { margin: 18px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.selection-tray { position: fixed; z-index: 5; left: 50%; bottom: 22px; transform: translate(-50%, 120px); width: min(560px, calc(100% - 28px)); background: var(--ink); color: white; padding: 12px 14px 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; transition: transform .25s; box-shadow: 0 16px 45px rgba(0,0,0,.22); }
.selection-tray.show { transform: translate(-50%, 0); }
.selection-tray p { margin: 0; font-size: 11px; }
.selection-tray button, .selection-tray a { border: 1px solid #666; background: transparent; color: white; padding: 9px 12px; font-size: 10px; text-decoration: none; cursor: pointer; }
.selection-actions { display: flex; gap: 7px; }
.empty-state { grid-column: 1/-1; padding: 80px 20px; text-align: center; background: var(--white); color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .collection-layout { grid-template-columns: 1fr; gap: 30px; }
  .collection-sidebar { position: static; }
  .collection-list { grid-template-columns: 1fr; }
  .color-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .collection-hero { grid-template-columns: 1fr; gap: 22px; }
  .collection-title-row { display: block; }
  .collection-meta { margin-top: 16px; }
  .collection-tools { flex-wrap: wrap; }
  .search-wrap { flex-basis: 100%; }
  .family-select { flex: 1; }
  .color-grid { grid-template-columns: repeat(2, 1fr); }
  .color-chip { height: 110px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
