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

:root {
  --bg:         #F9F9F9;
  --ink:        #1e1e1e;
  --ink-light:  #191919;
  --ink-faint:  #191919;
  --border:     rgba(25,25,25,0.12);
  --serif:      'Kigelia', Georgia, serif;
  --sans:       'Questrial', sans-serif;
  --margin:     72px;
  --gutter:     36px;
  --gap:        64px;
  --radius:     8px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

/* ── NAV ─────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  padding: 0 var(--margin);
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
}
.nav-links {
  display: flex;
  gap: var(--gutter);
}
.nav-links a {
  font-size: 14px;
  color: var(--ink-light);
  text-decoration: none;
  transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }

/* ── HERO ────────────────────────────────────── */
.hero {
  height: 72vh;
  min-height: 480px;
  background: var(--ink);
  padding: var(--margin);
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(25,25,25,0.35), rgba(25,25,25,0.65));
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
}
.hero-eyebrow {
  font-size: 16px;
  color: rgba(255,255,255,.45);
  margin-bottom: 10px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 5.5vw, 80px);
  font-weight: 400;
  color: #fff;
  line-height: 1.1;
}

/* ── INTRO ───────────────────────────────────── */
.intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
  padding: var(--gap) var(--margin) 0;
}
.intro-label {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 14px;
}
.intro-col p:not(.intro-label) {
  font-size: 16px;
  color: var(--ink-light);
  max-width: 432px;
}

/* ── SECTION HEADER ──────────────────────────── */
.section-header {
  padding: var(--gap) var(--margin);
}
.section-header h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 10px;
}
.section-header p {
  font-size: 16px;
  color: var(--ink);
  max-width: 680px;
}

/* ── COLOUR GRID ─────────────────────────────── */
.colours-section { padding-bottom: 0; }
.colour-grid { padding: 0 var(--margin); }

.hue-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--gutter);
  margin-bottom: 48px;
  align-items: start;
}
.hue-label {
  font-size: 16px;
  color: var(--ink);
  padding-top: 4px;
}
.hue-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}

/* ── SWATCH — click-to-expand ────────────────── */
.swatch {
  cursor: pointer;
  position: relative;
}
.swatch-colour {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 0.5px solid rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
  overflow: hidden;
}
.swatch.open .swatch-colour {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.swatch-colour::after {
  content: 'Click to expand';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 11px;
  text-align: center;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0,0,0,0.28);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.swatch:hover .swatch-colour::after {
  opacity: 1;
}
.swatch-info {
  padding: 10px 0 0;
}
.swatch-tribe {
  color: var(--ink);
  margin-bottom: 2px;
  font-size: 16px;
}
.swatch-name {
  color: var(--ink);
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 2px;
}
.swatch-hex {
  color: var(--ink);
  font-family: monospace;
  font-size: 16px;
}
/* smooth click dropdown — no display:none */
.swatch-hover {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 0.5px solid transparent;
  transition: max-height .35s ease, opacity .3s ease, margin-top .3s ease, padding-top .3s ease, border-color .3s ease;
}
.swatch.open .swatch-hover {
  max-height: 200px;
  opacity: 1;
  margin-top: 8px;
  padding-top: 8px;
  border-top-color: var(--border);
}
.swatch-hover-label {
  font-size: 16px;
  color: var(--ink);
  padding-bottom: 8px;
  margin-bottom: 8px;
  margin-top: 16px;
  border-bottom: 0.5px solid rgba(25,25,25,0.15);
}
.swatch-hover-label:first-child { margin-top: 0; }
.swatch-hover-label:not(:first-child) {
  border-top: 0.5px solid rgba(25,25,25,0.15);
  padding-top: 8px;
}
.swatch-hover-text {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.5;
}

/* ── APPLIED / PROOF BLOCKS ──────────────────── */
.applied-section {
}

.proof-2up {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.proof-3up {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.proof-3up .proof-block {
  border-top: none;
}
.proof-3up + .proof-palette {
  border-top: none;
}
.proof-block {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #E2DDD7;
  overflow: hidden;
  border-right: 0.5px solid var(--border);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.proof-block--tall {
  aspect-ratio: auto;
  overflow: visible;
  background: var(--bg);
}
.proof-block.proof-block--tall img {
  object-fit: contain !important;
  background: var(--bg);
  width: 100%;
  height: auto;
  display: block;
}
.proof-block:last-child { border-right: none; }
.proof-block img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.proof-block[data-empty="true"]::after {
  content: 'Image coming soon';
  font-size: 12px;
  color: rgba(26,23,20,.25);
}

/* Mercedes 2-up — smaller image with rounded corners, white background */
.proof-2up .proof-block {
  padding: 32px;
  overflow: visible;
  background: #ffffff;
}
.proof-2up .proof-block img {
  border-radius: 40px;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Colour palette strip shown beneath applied sections */
.proof-palette {
  padding: 24px var(--margin) 0;
  border-top: 0.5px solid var(--border);
  display: grid;
  gap: 12px;
}
.proof-palette-swatches {
  display: flex;
  gap: 10px;
}
.proof-palette-item {
  flex: 0 0 auto;
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proof-palette-swatch {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  border: 0.5px solid rgba(0,0,0,.06);
}
.proof-palette-name {
  font-size: 16px;
  color: var(--ink);
}
.proof-palette-code {
  font-size: 13px;
  font-family: monospace;
  color: var(--ink);
}

/* ── CONTEXT TABS (Pairings / Values) ────────── */
.context-tabs {
  display: flex;
  gap: 32px;
  padding: 0 var(--margin);
  border-bottom: 0.5px solid var(--border);
}
.context-tab {
  font-family: var(--sans);
  font-size: 16px;
  background: none;
  border: none;
  color: var(--ink);
  padding: 0 0 14px;
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -0.5px;
  transition: color .2s, border-color .2s;
}
.context-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.context-tab-content { display: none; }
.context-tab-content.active { display: block; }

/* ── PAIRINGS ────────────────────────────────── */
.pairings-section { padding-bottom: 0; }


.pairings-section + .applied-section { border-top: none; }

.tribe-block {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--gutter);
  padding: 48px var(--margin);
  border-bottom: 0.5px solid var(--border);
  align-items: start;
}
.tribe-block:last-child { border-bottom: none; padding-bottom: 0; }
.tribe-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
  padding-top: 4px;
}
.tribe-pairings { display: flex; flex-direction: column; }
.pairing { margin-bottom: 32px; }
.pairing:last-child { margin-bottom: 0; }

.pairing-label {
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 10px;
}
.pairing-label-rule {
  font-size: 16px;
  color: var(--ink);
}
.pairing-strip {
  display: flex;
  height: 96px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 0.5px solid var(--border);
  margin-bottom: 10px;
}
.pairing-colour { flex: 1; }
.pairing-names {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
}
.pairing-colour-name {
  flex: 1;
  font-size: 16px;
  color: var(--ink);
}

/* ── VALUES ──────────────────────────────────── */
.values-wrap { padding: 0 var(--margin) 0; }
.values-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--gutter);
  margin-bottom: 36px;
  align-items: start;
}
.values-label {
  font-size: 16px;
  color: var(--ink);
  padding-top: 4px;
}
.values-steps {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
}
.value-col {
  display: flex;
  flex-direction: column;
}
.value-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 0.5px solid rgba(0,0,0,.08);
  cursor: pointer;
  transition: transform .15s;
}
.value-swatch:hover { transform: scale(1.06); }

/* labels sit below each swatch block */
.value-labels {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 6px;
  gap: 2px;
}
.value-label-num {
  font-size: 16px;
  font-family: monospace;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
}
.value-label-code {
  font-size: 13px;
  font-family: monospace;
  color: var(--ink);
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}

/* ── GENERATOR ───────────────────────────────── */
.generator-section {
  padding-bottom: var(--gap);
}
.generator-section .section-header {
  padding-bottom: 24px;
}
.generator-body {
  padding: 0 var(--margin);
}
.generator-tabs {
  display: flex;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 32px;
}
.gen-tab {
  font-family: var(--sans);
  font-size: 16px;
  background: none;
  border: none;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .2s;
}
.gen-tab.active { background: rgba(25,25,25,0.08); }
.gen-tab:hover:not(.active) { background: rgba(25,25,25,0.04); }
.gen-instruction {
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 16px;
}
.gen-tab-content { display: none; }
.gen-tab-content.active { display: block; }

.meaning-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
/* category separator label */
.meaning-category-divider {
  width: 100%;
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 0.5px solid var(--border);
}
.meaning-category-divider:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.meaning-btn {
  padding: 7px 16px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.meaning-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--btn-gradient, var(--border));
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.meaning-btn:hover::before { opacity: .5; }
.meaning-btn.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.meaning-btn.selected::before { display: none; }
/* category buttons slightly different */
.meaning-btn--category {
  opacity: .85;
}

.gen-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding-top: 20px;
  border-top: 0.5px solid var(--border);
}
.gen-size-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
}
.gen-controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.gen-size-label {
  font-size: 16px;
  color: var(--ink);
}
.gen-btn-clear {
  font-family: var(--sans);
  font-size: 16px;
  padding: 7px 18px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  margin-right: auto;
  transition: color .2s, border-color .2s;
}
.gen-btn-clear:hover { border-color: var(--ink); }
.size-buttons { display: flex; gap: 5px; }
.size-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
}
.size-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.gen-btn-done {
  font-family: var(--sans);
  font-size: 16px;
  padding: 7px 24px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity .2s;
}
.gen-btn-done:hover { opacity: .8; }

.generated-palette {
  display: none;
  margin-top: 48px;
}
.generated-palette.show {
  display: block;
  animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.gen-strip {
  display: flex;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 0.5px solid var(--border);
  margin-bottom: 20px;
}
.gen-colour { flex: 1; }
.gen-detail {
  display: grid;
  gap: var(--gutter);
  margin-bottom: 24px;
}
.gen-item { display: flex; flex-direction: column; gap: 6px; }
.gen-item-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 0.5px solid rgba(0,0,0,.08);
}
.gen-item-name { font-size: 16px; color: var(--ink); }
.gen-item-tribe { font-size: 16px; color: var(--ink); }
.gen-context {
  padding: 16px 20px;
  background: rgba(25,25,25,.04);
  border-left: 2px solid var(--ink);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.6;
  border-radius: 0 4px 4px 0;
}

/* ── PICKER ──────────────────────────────────── */
.picker-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
  align-items: stretch;
}
.picker-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.picker-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.picker-left label {
  font-size: 16px;
  color: var(--ink);
}
#image-upload { width: 100%; font-size: 16px; }
#artwork-canvas {
  width: 100%;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
}
#wheel-canvas {
  width: 400px;
  height: 400px;
  max-width: 100%;
  border-radius: 50%;
  flex-shrink: 0;
}
.picker-hint {
  font-size: 16px;
  color: var(--ink);
  max-width: 100%;
}
.picker-reset-btn {
  font-family: var(--sans);
  font-size: 16px;
  padding: 6px 18px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s;
  align-self: flex-start;
}
.picker-reset-btn:hover { border-color: var(--ink); }

/* ── WHEEL TOOLTIP ───────────────────────────── */
.wheel-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 300;
  opacity: 0;
  transition: opacity .15s;
}
.wheel-tooltip.show { opacity: 1; }

/* ── FOOTER ──────────────────────────────────── */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px var(--margin);
  font-size: 14px;
  color: var(--ink-faint);
  border-top: 0.5px solid var(--border);
}

/* ── TOOLTIP MODAL ───────────────────────────── */
.tooltip-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.tooltip-overlay.show { display: flex; }

.tooltip-card {
  background: var(--bg);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  position: relative;
  animation: fadeIn .2s ease;
}
.tooltip-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--ink-faint);
  line-height: 1;
}
.tooltip-close:hover { color: var(--ink); }
.tooltip-swatch {
  width: 100%;
  height: 160px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 0.5px solid rgba(0,0,0,.06);
}
.tooltip-tribe {
  font-size: 12px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 4px;
}
.tooltip-name {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 4px;
}
.tooltip-hex {
  font-size: 13px;
  color: var(--ink-faint);
  font-family: monospace;
  margin-bottom: 20px;
}
.tooltip-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tooltip-label {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 0.5px solid rgba(25,25,25,0.15);
}
.tooltip-text {
  font-size: 13px;
  color: var(--ink-light);
  line-height: 1.5;
}
