:root,
[data-theme="light"] {
  --font-display: 'Cabinet Grotesk', 'Inter', sans-serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
  --bg: #f4f4f0;
  --surface: rgba(255,255,255,0.78);
  --surface-strong: rgba(255,255,255,0.92);
  --text: #171717;
  --muted: #5f5f67;
  --border: rgba(23,23,23,0.08);
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.10);
  --accent: #111827;
}

[data-theme="dark"] {
  --bg: #0b0d10;
  --surface: rgba(18,20,24,0.72);
  --surface-strong: rgba(24,27,33,0.88);
  --text: #f5f7fb;
  --muted: #a3acb9;
  --border: rgba(255,255,255,0.10);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --accent: #f3f4f6;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(37,99,235,0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(124,58,237,0.14), transparent 30%),
    var(--bg);
  color: var(--text);
  transition: background-color 180ms ease, color 180ms ease;
}
button { font: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  background: var(--surface-strong);
  color: var(--text);
  padding: .75rem 1rem;
  border-radius: 999px;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.section-head,
.hero-actions,
.overlay-meta,
.brand {
  display: flex;
  align-items: center;
}

.topbar,
.section-head {
  justify-content: space-between;
}

.topbar {
  margin-bottom: 28px;
  gap: 16px;
}

.brand { gap: 14px; }
.brand h1,
.hero h2,
.palette h3,
.notes h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
}
.brand h1 { font-size: clamp(1.5rem, 2vw, 2rem); }
.brand-mark { width: 52px; color: var(--text); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
}

.layout {
  display: grid;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 24px;
  padding: 24px;
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.02;
  max-width: 11ch;
  margin-bottom: 16px;
}
.hero-copy,
.section-note,
.notes li {
  color: var(--muted);
  font-size: 1rem;
}
.hero-copy { max-width: 62ch; }
.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.action-button,
.theme-toggle,
.overlay-exit {
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.action-button,
.overlay-exit {
  padding: 14px 20px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}
.action-button.secondary,
.theme-toggle {
  background: transparent;
  color: var(--text);
}
.theme-toggle {
  min-width: 48px;
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.action-button:hover,
.theme-toggle:hover,
.overlay-exit:hover,
.swatch:hover,
.swatch:focus-visible {
  transform: translateY(-1px);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.swatch {
  position: relative;
  border: 0;
  border-radius: 22px;
  min-height: 140px;
  padding: 0;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.swatch::after {
  content: '';
  position: absolute;
  inset: auto 12px 12px auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.32);
  opacity: 0;
  transition: opacity 180ms ease;
}
.swatch:hover::after,
.swatch:focus-visible::after {
  opacity: 1;
}
.swatch:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.notes ul {
  margin: 14px 0 0;
  padding-left: 20px;
}
.notes li + li { margin-top: 10px; }

.screen-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 999;
  cursor: default;
}
.screen-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.screen-overlay.ui-hidden {
  cursor: none;
}
.screen-overlay.ui-hidden .overlay-ui {
  opacity: 0;
  pointer-events: none;
}
.overlay-ui {
  transition: opacity 220ms ease;
}

.overlay-exit {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.overlay-meta {
    position: absolute;
    left: 24px;
    bottom: 24px;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

kbd {
  font-family: inherit;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 8px;
  padding: 0.1rem 0.45rem;
  background: var(--surface-strong);
}

@media (max-width: 640px) {
  .app-shell { padding: 16px; }
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .overlay-meta { left: 16px; right: 16px; bottom: 16px; justify-content: space-between; }
  .overlay-exit { top: 16px; right: 16px; }
}