← back to Model Arena

data/artifacts/15fb25164101/gpt.html

1095 lines

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Designer Wallcoverings — Shop by Color Wheel</title>
<style>
:root {
  /* design tokens */
  --bg: #0d0d0f;
  --surface: #17171c;
  --surface-soft: #1f1f26;
  --ink: #f5f2ea;
  --muted: #8a8578;
  --accent: #c9a961; /* soft metallic gold */
  --accent-dark: #7d6a45;
  --line: rgba(201, 169, 97, 0.35);
  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.6);
  --shadow-subtle: 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.6);

  --ease-main: cubic-bezier(.22,.9,.24,1);
  --ease-hero: cubic-bezier(.22,1,.36,1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 999px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 40px;
  --border-hairline: 1px solid rgba(245, 242, 234, 0.08);

  --font-display: "Playfair Display", "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Avenir Next", "Century Gothic", Futura, "Segoe UI", sans-serif;

  --fs-caption: 12px;
  --fs-label: 11px;
  --fs-body: 16px;
  --fs-lead: 21px;
  --fs-h3: 28px;
  --fs-h2: 38px;
  --fs-h1: 50px;

  --swatch-size: 260px;
  --pattern-radius: 18px;
}

/* keyframes from HyperFrames */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: none; }
}
@keyframes clipReveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0); }
}
@keyframes blurIn {
  from { opacity: 0; filter: blur(12px); }
  to { opacity: 1; filter: blur(0); }
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #16161c 0, var(--bg) 52%, #050506 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* layout shell */
.app {
  position: relative;
  width: min(960px, 100vw);
  height: min(540px, 100vh);
  margin: 0 auto;
  padding: 0;
  color: var(--ink);
  overflow: hidden;
}

/* fixed top bar */
.app-header {
  position: absolute;
  inset: 0 0 auto 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-lg);
  pointer-events: none;
  z-index: 10;
}

.wordmark-lockup {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  max-width: 220px;
  pointer-events: auto;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--ink);
}

.wordmark-sub {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.meta-pill {
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 242, 234, 0.14);
  background: linear-gradient(120deg, rgba(23,23,28,0.95), rgba(10,10,13,0.95));
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: 10px;
}

.meta-label {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-value {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* main card */
.card {
  position: absolute;
  inset: 56px var(--spacing-lg) var(--spacing-lg);
  border-radius: 20px;
  background:
    radial-gradient(circle at 10% 0, rgba(201,169,97,0.12) 0, transparent 46%),
    radial-gradient(circle at 90% 100%, rgba(201,169,97,0.16) 0, transparent 52%),
    linear-gradient(145deg, #131318, #050506);
  border: 1px solid rgba(245, 242, 234, 0.04);
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr);
  gap: 32px;
  padding: 32px 32px 28px;
  overflow: hidden;
}

/* responsive stacking */
@media (max-width: 800px) {
  .card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    padding: 24px;
    gap: 24px;
  }
  .app-header {
    padding-inline: var(--spacing-md);
  }
}

/* left: wheel area */
.wheel-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

/* hero copy */
.hero-copy {
  animation: fadeUp 0.8s var(--ease-hero) both;
}

.hero-kicker {
  font-size: var(--fs-caption);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.hero-title span {
  color: var(--accent);
}

.hero-sub {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(245, 242, 234, 0.78);
  max-width: 28rem;
}

/* wheel container */
.wheel-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
}

.wheel-instructions {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
  transform: translateY(6px);
}

/* actual wheel */
.color-wheel-wrap {
  position: relative;
  width: var(--swatch-size);
  height: var(--swatch-size);
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  animation: scaleIn 0.7s var(--ease-hero) both 0.08s;
}

.color-wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    conic-gradient(
      #fbd2c4 0deg 30deg,
      #f7b0c4 30deg 60deg,
      #f28da6 60deg 90deg,
      #f06974 90deg 120deg,
      #f4a64f 120deg 150deg,
      #f2d45f 150deg 180deg,
      #8fd38a 180deg 210deg,
      #46b7a4 210deg 240deg,
      #3ba3e6 240deg 270deg,
      #5b6be2 270deg 300deg,
      #9862e1 300deg 330deg,
      #e094e6 330deg 360deg
    );
  box-shadow:
    0 0 0 1px rgba(245, 242, 234, 0.18),
    0 28px 60px rgba(0, 0, 0, 0.85);
  cursor: grab;
  touch-action: none;
  transition: box-shadow 260ms var(--ease-main), transform 260ms var(--ease-main);
}

.color-wheel:active {
  cursor: grabbing;
  transform: scale(0.99);
  box-shadow:
    0 0 0 1px rgba(245, 242, 234, 0.26),
    0 16px 40px rgba(0, 0, 0, 0.85);
}

/* inner mask */
.color-wheel::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 0, rgba(255,255,255,0.4) 0, transparent 52%),
    radial-gradient(circle at 50% 120%, rgba(0,0,0,0.8) 0, transparent 70%);
  mix-blend-mode: soft-light;
  opacity: 0.45;
  pointer-events: none;
}

/* wheel center label */
.wheel-center {
  position: absolute;
  width: 52%;
  height: 52%;
  border-radius: 50%;
  background: radial-gradient(circle at 27% 0, rgba(255,255,255,0.16) 0, rgba(0,0,0,0.94) 46%, #050506 100%);
  border: 1px solid rgba(245, 242, 234, 0.16);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
  padding: 10px;
}

.center-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.center-hue-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.center-hue-tone {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 1px;
}

/* selection indicator */
.wheel-indicator {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 1px dashed rgba(245, 242, 234, 0.32);
  pointer-events: none;
}

.wheel-indicator::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(245, 242, 234, 0.8);
  background: radial-gradient(circle at 30% 0, rgba(255,255,255,0.9) 0, rgba(201,169,97,0.9) 80%);
  box-shadow: 0 0 0 4px rgba(201,169,97,0.22), 0 0 18px rgba(201,169,97,0.9);
}

/* right: patterns strip */
.pattern-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.pattern-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  animation: fadeUp 0.8s var(--ease-hero) both 0.08s;
}

.pattern-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pattern-label {
  font-size: var(--fs-caption);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.pattern-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pattern-meta {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* filmstrip */
.pattern-strip-shell {
  position: relative;
  flex: 1;
  border-radius: 18px;
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.04) 0, transparent 50%), #0a0a0d;
  border: 1px solid rgba(245, 242, 234, 0.08);
  box-shadow: var(--shadow-subtle);
  padding: 14px 16px 10px;
  overflow: hidden;
  animation: clipReveal 0.9s var(--ease-hero) both 0.12s;
}

.pattern-strip {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

/* card for each pattern */
.pattern-card {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 16px 30px rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
}

.pattern-art {
  position: relative;
  flex: 1;
  min-height: 120px;
  background-color: #333;
  overflow: hidden;
}

.pattern-art::before,
.pattern-art::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* specific pattern styles, driven by CSS variables for color */
.pattern-card[data-style="stripes"] .pattern-art {
  background-image: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--pattern-base) 90%, black 4%) 0 12px,
    color-mix(in srgb, var(--pattern-base) 70%, black 20%) 12px 26px
  );
}

.pattern-card[data-style="geom"] .pattern-art::before {
  background-image:
    radial-gradient(circle at 0 0, transparent 0 46%, color-mix(in srgb, var(--pattern-base) 90%, black 20%) 46% 52%, transparent 52%),
    radial-gradient(circle at 100% 0, transparent 0 46%, color-mix(in srgb, var(--pattern-base) 85%, black 15%) 46% 52%, transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 0 38%, color-mix(in srgb, var(--pattern-base) 80%, black 24%) 38% 44%, transparent 44%);
  background-size: 40px 40px;
  opacity: 0.95;
}

.pattern-card[data-style="linen"] .pattern-art {
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.38) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 0, transparent 40%);
  background-size: 24px 100%, 100% 20px, 80px 100%;
  background-color: color-mix(in srgb, var(--pattern-base) 85%, black 15%);
}

.pattern-card[data-style="marble"] .pattern-art::before {
  background-image: linear-gradient(
    120deg,
    color-mix(in srgb, var(--pattern-base) 100%, black 14%) 0,
    color-mix(in srgb, var(--pattern-base) 95%, black 26%) 24%,
    color-mix(in srgb, var(--pattern-base) 90%, black 10%) 50%,
    color-mix(in srgb, var(--pattern-base) 98%, black 12%) 80%,
    color-mix(in srgb, var(--pattern-base) 85%, black 30%) 100%
  );
}

.pattern-card[data-style="marble"] .pattern-art::after {
  background-image:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.22) 0 1px, transparent 1px 18px),
    radial-gradient(circle at 0 0, rgba(0,0,0,0.7) 0, transparent 45%);
  mix-blend-mode: soft-light;
  opacity: 0.6;
}

/* pattern footer */
.pattern-footer {
  padding: 10px 11px 9px;
  border-top: 1px solid rgba(245, 242, 234, 0.06);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.08) 0, transparent 50%), rgba(8, 8, 11, 0.96);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pattern-name {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.pattern-note {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* share bar */
.share-bar {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(245, 242, 234, 0.08);
}

.share-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-btn {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 242, 234, 0.18);
  background: radial-gradient(circle at 0 0, rgba(201,169,97,0.4) 0, transparent 60%), rgba(10,10,12,0.96);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 7px 12px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 220ms var(--ease-main), border-color 220ms var(--ease-main), transform 220ms var(--ease-main), box-shadow 220ms var(--ease-main), color 220ms var(--ease-main);
}

.share-btn-icon {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 242, 234, 0.7);
  position: relative;
}

.share-btn-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: radial-gradient(circle at 40% 0, rgba(255,255,255,0.9) 0, rgba(201,169,97,1) 90%);
}

.share-btn:hover {
  border-color: rgba(245, 242, 234, 0.5);
  box-shadow: 0 18px 30px rgba(0,0,0,0.9);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0,0,0,0.9);
}

/* subtle shimmer */
.share-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 0, rgba(255,255,255,0.18) 50%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-40%);
}

.share-btn:hover::after {
  opacity: 1;
  transform: translateX(40%);
  transition: transform 700ms cubic-bezier(.22,1,.36,1), opacity 400ms ease-out;
}

/* micro tag */
.save-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* subtle tag icon */
.save-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border-radius: 3px;
  border: 1px solid rgba(245, 242, 234, 0.4);
  background: linear-gradient(135deg, rgba(201,169,97,0.2), transparent 70%);
  position: relative;
  top: 2px;
}

.save-icon::before {
  content: "";
  position: absolute;
  inset: 2px 4px;
  border-radius: 2px;
  border-bottom-left-radius: 0;
  background: rgba(245, 242, 234, 0.9);
}

/* selection glow around active pattern row (optional) */
.pattern-strip-shell::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(201,169,97,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 340ms var(--ease-main);
}

.pattern-strip-shell[data-active="true"]::before {
  opacity: 1;
}

/* accessibility focus */
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
</style>
</head>
<body>
<div class="app">
  <header class="app-header">
    <div class="wordmark-lockup">
      <div class="wordmark">DESIGNER WALLCOVERINGS</div>
      <div class="wordmark-sub">Atelier Color Edit</div>
    </div>
    <div class="header-meta">
      <div class="meta-pill">
        <span class="meta-label">Hue</span>
        <span class="meta-value" id="metaHue">Sunset Blush</span>
      </div>
    </div>
  </header>

  <main class="card">
    <section class="wheel-panel">
      <div class="hero-copy">
        <div class="hero-kicker">Shop by color</div>
        <h1 class="hero-title">Turn the wheel.<br><span>Find your wall.</span></h1>
        <p class="hero-sub">Drag or tap the color wheel to reveal four made-to-order wallcovering patterns curated in that hue family.</p>
      </div>

      <div class="wheel-shell">
        <div class="wheel-instructions">Drag to explore the spectrum</div>
        <div class="color-wheel-wrap">
          <div class="color-wheel" id="colorWheel" aria-label="Color selection wheel"></div>
          <div class="wheel-indicator"></div>
          <div class="wheel-center">
            <div class="center-label">Curated hue</div>
            <div class="center-hue-name" id="centerHueName">Sunset Blush</div>
            <div class="center-hue-tone" id="centerHueTone">Soft rose neutrals</div>
          </div>
        </div>
      </div>
    </section>

    <section class="pattern-panel" aria-live="polite">
      <header class="pattern-header">
        <div class="pattern-heading">
          <div class="pattern-label">Color family edit</div>
          <div class="pattern-title" id="patternTitle">Blush Salon</div>
        </div>
        <div class="pattern-meta" id="patternMeta">4 wallcoverings in soft rose</div>
      </header>

      <div class="pattern-strip-shell" id="patternStripShell" data-active="true">
        <div class="pattern-strip" id="patternStrip">
          <!-- pattern cards injected by JS -->
        </div>
      </div>

      <footer class="share-bar">
        <div class="share-label">
          <span class="save-icon" aria-hidden="true"></span>
          <span class="save-tag">Tap to save this palette</span>
        </div>
        <div class="share-actions">
          <button class="share-btn" type="button" id="sharePalette">
            <span class="share-btn-icon" aria-hidden="true"></span>
            <span>Share palette</span>
          </button>
        </div>
      </footer>
    </section>
  </main>
</div>

<script>
(function() {
  const wheel = document.getElementById('colorWheel');
  const centerHueName = document.getElementById('centerHueName');
  const centerHueTone = document.getElementById('centerHueTone');
  const metaHue = document.getElementById('metaHue');
  const patternTitle = document.getElementById('patternTitle');
  const patternMeta = document.getElementById('patternMeta');
  const patternStrip = document.getElementById('patternStrip');
  const patternStripShell = document.getElementById('patternStripShell');
  const sharePalette = document.getElementById('sharePalette');

  // Palette definitions across the wheel (12 segments)
  const segments = [
    {
      name: 'Sunset Blush',
      tone: 'Soft rose neutrals',
      collection: 'Blush Salon',
      meta: '4 wallcoverings in soft rose',
      baseHue: 10,
      patterns: [
        { style: 'stripes', name: 'Salon Stripe', note: 'Oyster & petal' },
        { style: 'geom',   name: 'Gallery Grid', note: 'Rosé lacquer' },
        { style: 'linen',  name: 'Blush Linen', note: 'Powdered silk' },
        { style: 'marble', name: 'Marais Vein', note: 'Rosy travertine' }
      ]
    },
    {
      name: 'Rose Atelier',
      tone: 'Tailored pinks',
      collection: 'Rosé Drawing Room',
      meta: '4 wallcoverings in rosewood',
      baseHue: 340,
      patterns: [
        { style: 'geom',   name: 'Atelier Panel', note: 'Dusty rose' },
        { style: 'linen',  name: 'Salon Weave', note: 'Tea-rose flax' },
        { style: 'stripes',name: 'Ribbon Stripe', note: 'Rouge & shell' },
        { style: 'marble', name: 'Opera Marble', note: 'Blushed stone' }
      ]
    },
    {
      name: 'Burnished Coral',
      tone: 'Warm terracotta',
      collection: 'Terracotta Loft',
      meta: '4 wallcoverings in terracotta',
      baseHue: 20,
      patterns: [
        { style: 'linen',  name: 'Clay Canvas', note: 'Sienna wash' },
        { style: 'stripes',name: 'Column Stripe', note: 'Bronzed clay' },
        { style: 'geom',   name: 'Arcade Mosaic', note: 'Amber tile' },
        { style: 'marble', name: 'Palazzo Vein', note: 'Smoked clay' }
      ]
    },
    {
      name: 'Champagne Ember',
      tone: 'Gilded neutrals',
      collection: 'Champagne Salon',
      meta: '4 wallcoverings in champagne',
      baseHue: 40,
      patterns: [
        { style: 'marble', name: 'Champagne Onyx', note: 'Gilded vein' },
        { style: 'stripes',name: 'Salon Panel', note: 'Champagne satin' },
        { style: 'linen',  name: 'Ivory Weave', note: 'Clouded silk' },
        { style: 'geom',   name: 'Prism Inlay', note: 'Brass lattice' }
      ]
    },
    {
      name: 'Gilded Ochre',
      tone: 'Golden saffron',
      collection: 'Saffron Gallery',
      meta: '4 wallcoverings in saffron',
      baseHue: 50,
      patterns: [
        { style: 'geom',   name: 'Gallery Lattice', note: 'Muse gold' },
        { style: 'linen',  name: 'Saffron Silk', note: 'Brushed sheen' },
        { style: 'marble', name: 'Aurora Stone', note: 'Honey onyx' },
        { style: 'stripes',name: 'Salon Column', note: 'Gilt band' }
      ]
    },
    {
      name: 'Verdant Salon',
      tone: 'Deep garden greens',
      collection: 'Verdant Parlour',
      meta: '4 wallcoverings in emerald',
      baseHue: 145,
      patterns: [
        { style: 'marble', name: 'Emerald Vein', note: 'Inked jade' },
        { style: 'geom',   name: 'Garden Screen', note: 'Tea leaf' },
        { style: 'stripes',name: 'Conservatory Stripe', note: 'Palm & dusk' },
        { style: 'linen',  name: 'Moss Cloth', note: 'Soft moss' }
      ]
    },
    {
      name: 'Celadon Mist',
      tone: 'Mineral greens',
      collection: 'Celadon Suite',
      meta: '4 wallcoverings in celadon',
      baseHue: 160,
      patterns: [
        { style: 'linen',  name: 'Celadon Wash', note: 'Soft mineral' },
        { style: 'geom',   name: 'Tea Room Grid', note: 'Porcelain' },
        { style: 'marble', name: 'Spa Stone', note: 'Veiled jade' },
        { style: 'stripes',name: 'Quiet Panel', note: 'Mist & pearl' }
      ]
    },
    {
      name: 'Regency Teal',
      tone: 'Inked blue-greens',
      collection: 'Regency Salon',
      meta: '4 wallcoverings in teal',
      baseHue: 190,
      patterns: [
        { style: 'geom',   name: 'Regency Filigree', note: 'Gilt teal' },
        { style: 'stripes',name: 'Drawing Room Stripe', note: 'Ink & foam' },
        { style: 'linen',  name: 'Sea Silk', note: 'Tidewashed' },
        { style: 'marble', name: 'Regent Stone', note: 'Inked teal' }
      ]
    },
    {
      name: 'Midnight Azure',
      tone: 'Nocturne blues',
      collection: 'Azure Salon',
      meta: '4 wallcoverings in midnight',
      baseHue: 220,
      patterns: [
        { style: 'marble', name: 'Nightfall Vein', note: 'Blue slate' },
        { style: 'linen',  name: 'Velvet Sky', note: 'Washed velvet' },
        { style: 'geom',   name: 'Starlight Grid', note: 'Celestial' },
        { style: 'stripes',name: 'Opera Stripe', note: 'Ink drape' }
      ]
    },
    {
      name: 'Cobalt Gallery',
      tone: 'Gallery blues',
      collection: 'Cobalt Gallery',
      meta: '4 wallcoverings in cobalt',
      baseHue: 210,
      patterns: [
        { style: 'stripes',name: 'Gallery Rail', note: 'Cobalt band' },
        { style: 'geom',   name: 'Blueprint Panel', note: 'Ink line' },
        { style: 'linen',  name: 'Studio Ground', note: 'Dry pigment' },
        { style: 'marble', name: 'Lapiz Stone', note: 'Gilded vein' }
      ]
    },
    {
      name: 'Amethyst Noir',
      tone: 'Smoked violets',
      collection: 'Amethyst Parlour',
      meta: '4 wallcoverings in violet',
      baseHue: 280,
      patterns: [
        { style: 'marble', name: 'Noir Vein', note: 'Smoked stone' },
        { style: 'geom',   name: 'Parlour Facet', note: 'Cut glass' },
        { style: 'linen',  name: 'Violet Weave', note: 'Shadowed silk' },
        { style: 'stripes',name: 'Crescent Stripe', note: 'Night plum' }
      ]
    },
    {
      name: 'Champagne Ivory',
      tone: 'Quiet ivories',
      collection: 'Ivory Atelier',
      meta: '4 wallcoverings in ivory',
      baseHue: 50,
      patterns: [
        { style: 'linen',  name: 'Atelier Ground', note: 'Plastered lime' },
        { style: 'stripes',name: 'Gallery Stripe', note: 'Ivory moulding' },
        { style: 'geom',   name: 'Parade Panel', note: 'Bone lattice' },
        { style: 'marble', name: 'Salon Marble', note: 'Soft travertine' }
      ]
    }
  ];

  function hueToSegmentIndex(angle) {
    const normalized = (angle % 360 + 360) % 360;
    const step = 360 / segments.length;
    return Math.floor(normalized / step);
  }

  function hueToColor(hue, lightness) {
    const l = lightness || 62;
    return `hsl(${hue}, 52%, ${l}%)`;
  }

  function renderPatterns(segment) {
    patternStripShell.setAttribute('data-active', 'true');
    patternStrip.innerHTML = '';

    segment.patterns.forEach((p, i) => {
      const card = document.createElement('article');
      card.className = 'pattern-card';
      card.dataset.style = p.style;

      const art = document.createElement('div');
      art.className = 'pattern-art';
      art.style.setProperty('--pattern-base', hueToColor(segment.baseHue + (i - 1) * 4, 54 + i * 3));

      const footer = document.createElement('div');
      footer.className = 'pattern-footer';

      const name = document.createElement('div');
      name.className = 'pattern-name';
      name.textContent = p.name;

      const note = document.createElement('div');
      note.className = 'pattern-note';
      note.textContent = p.note;

      footer.appendChild(name);
      footer.appendChild(note);
      card.appendChild(art);
      card.appendChild(footer);
      patternStrip.appendChild(card);
    });
  }

  function setSegment(segment) {
    centerHueName.textContent = segment.name;
    centerHueTone.textContent = segment.tone;
    metaHue.textContent = segment.name;
    patternTitle.textContent = segment.collection;
    patternMeta.textContent = segment.meta;
    renderPatterns(segment);
  }

  let currentAngle = -15;
  let isDragging = false;
  let startAngle = 0;

  function getAngleFromEvent(evt) {
    const rect = wheel.getBoundingClientRect();
    const cx = rect.left + rect.width / 2;
    const cy = rect.top + rect.height / 2;
    const clientX = evt.touches ? evt.touches[0].clientX : evt.clientX;
    const clientY = evt.touches ? evt.touches[0].clientY : evt.clientY;
    const dx = clientX - cx;
    const dy = clientY - cy;
    const rad = Math.atan2(dy, dx);
    let deg = rad * (180 / Math.PI);
    deg = deg + 90;
    return deg;
  }

  function updateFromAngle(angle) {
    currentAngle = angle;
    wheel.style.transform = `rotate(${angle}deg)`;
    const segIdx = hueToSegmentIndex(-angle + 180);
    setSegment(segments[segIdx]);
  }

  function startDrag(evt) {
    evt.preventDefault();
    isDragging = true;
    wheel.style.transition = 'none';
    const angleAtPointer = getAngleFromEvent(evt);
    startAngle = angleAtPointer - currentAngle;
  }

  function moveDrag(evt) {
    if (!isDragging) return;
    evt.preventDefault();
    const angleAtPointer = getAngleFromEvent(evt);
    const newAngle = angleAtPointer - startAngle;
    updateFromAngle(newAngle);
  }

  function endDrag() {
    if (!isDragging) return;
    isDragging = false;
    wheel.style.transition = 'transform 420ms var(--ease-main), box-shadow 260ms var(--ease-main)';
    const step = 360 / segments.length;
    const snapTarget = Math.round(currentAngle / step) * step;
    updateFromAngle(snapTarget);
  }

  wheel.addEventListener('mousedown', startDrag);
  window.addEventListener('mousemove', moveDrag);
  window.addEventListener('mouseup', endDrag);

  wheel.addEventListener('touchstart', startDrag, { passive: false });
  window.addEventListener('touchmove', moveDrag, { passive: false });
  window.addEventListener('touchend', endDrag);
  window.addEventListener('touchcancel', endDrag);

  wheel.addEventListener('click', function(evt) {
    if (isDragging) return;
    const angleAtPointer = getAngleFromEvent(evt);
    const newAngle = angleAtPointer - startAngle;
    const step = 360 / segments.length;
    const snapTarget = Math.round(newAngle / step) * step;
    wheel.style.transition = 'transform 420ms var(--ease-main), box-shadow 260ms var(--ease-main)';
    updateFromAngle(snapTarget);
  });

  wheel.setAttribute('role', 'slider');
  wheel.setAttribute('aria-valuemin', '0');
  wheel.setAttribute('aria-valuemax', '360');
  wheel.setAttribute('tabindex', '0');

  wheel.addEventListener('keydown', function(e) {
    const step = 360 / segments.length;
    if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
      e.preventDefault();
      const newAngle = currentAngle - step;
      updateFromAngle(newAngle);
    } else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
      e.preventDefault();
      const newAngle = currentAngle + step;
      updateFromAngle(newAngle);
    }
  });

  if (navigator.share) {
    sharePalette.addEventListener('click', function() {
      const title = 'Designer Wallcoverings — Shop by Color';
      const text = `Palette saved: ${centerHueName.textContent} · ${centerHueTone.textContent}`;
      navigator.share({ title, text }).catch(function() {});
    });
  } else {
    sharePalette.addEventListener('click', function() {
      const msg = `${centerHueName.textContent.toUpperCase()} · ${centerHueTone.textContent}`;
      if (navigator.clipboard && navigator.clipboard.writeText) {
        navigator.clipboard.writeText(msg).then(function() {
          sharePalette.querySelector('span:last-child').textContent = 'Copied palette';
          setTimeout(function() {
            sharePalette.querySelector('span:last-child').textContent = 'Share palette';
          }, 1500);
        }).catch(function() {});
      }
    });
  }

  const initialSegment = segments[hueToSegmentIndex(-currentAngle + 180)];
  setSegment(initialSegment);
  updateFromAngle(currentAngle);
})();
</script>
</body>
</html>