/* Cozy Palette – styles (allineato al sito Cozy Cities Collection) */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- variables ---------- */
:root {
  --ink: #1d1815;
  --ink-soft: #5a4d44;
  --ink-mute: #8a7c73;

  --paper: #F7EFE2;
  --paper-2: #F1E6D2;
  --card: #FFFFFF;
  --card-elev: #FBF6EE;

  --coral: #E8854F;
  --coral-deep: #C7572C;
  --sky: #7ABCC4;
  --rose: #F4B6A6;
  --moss: #6B8F5F;

  --line: #1d1815;
  --line-soft: rgba(29, 24, 21, 0.12);
  --border: 2.5px solid var(--line);
  --border-thin: 1.5px solid var(--line);
  --border-hair: 1px solid var(--line-soft);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --shadow: 0 4px 0 0 var(--line);
  --shadow-sm: 0 2px 0 0 var(--line);
  --shadow-soft: 0 10px 30px rgba(29,24,21,0.08), 0 2px 6px rgba(29,24,21,0.04);

  --font-head: 'Fredoka', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, sans-serif;
}

body[data-theme="sky"] {
  --paper: #ECF6F4;
  --paper-2: #DCEEEB;
  --coral: #4FA8B5;
  --coral-deep: #2F7782;
  --rose: #B5DDE0;
}
body[data-theme="studio"] {
  --paper: #FBF7EF;
  --paper-2: #F3ECDE;
  --shadow: 0 2px 0 0 var(--line-soft);
  --shadow-sm: none;
  --line: #2a2520;
  --border: 1.5px solid rgba(42,37,32,0.18);
  --border-thin: 1px solid rgba(42,37,32,0.15);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 20% 8%, rgba(232,133,79,0.08) 0%, transparent 38%),
    radial-gradient(circle at 90% 12%, rgba(244,182,166,0.10) 0%, transparent 40%),
    radial-gradient(circle at 70% 90%, rgba(122,188,196,0.07) 0%, transparent 45%);
  pointer-events: none; z-index: 0;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--ink); }

/* ---------- layout ---------- */
.cp-app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.cp-bg { display: none; }
.cp-main {
  max-width: 1200px; width: 100%; margin: 0 auto;
  padding: 0 32px 80px; display: flex; flex-direction: column; gap: 40px;
}

/* ---------- header ---------- */
.cp-header {
  max-width: 1200px; width: 100%; margin: 0 auto;
  padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.cp-brand { display: flex; align-items: center; gap: 14px; }
.cp-logo {
  width: 64px; height: 64px; border-radius: 14px;
  background: transparent;
  padding: 0;
}
.cp-brand-text { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.cp-app-title {
  font-family: var(--font-head); font-weight: 700;
  font-size: 28px; letter-spacing: -0.01em; color: var(--ink);
}
.cp-app-sub {
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  margin-top: 5px; text-transform: uppercase; letter-spacing: 0.12em;
}
.cp-header-actions { display: flex; align-items: center; gap: 8px; }
.cp-lang {
  display: inline-flex; background: var(--card); border: var(--border-thin); border-radius: var(--r-pill); padding: 2px;
}
.cp-lang-btn {
  border: none; background: transparent; font-weight: 700; font-size: 12px; padding: 6px 12px;
  border-radius: var(--r-pill); color: var(--ink-soft);
}
.cp-lang-btn.active { background: var(--ink); color: var(--paper); }

.cp-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: var(--border-thin); border-radius: var(--r-pill);
  padding: 8px 16px; font-weight: 600; font-size: 13px;
  background: var(--card); color: var(--ink);
  transition: transform .08s, background .15s;
}
.cp-pill:hover { background: var(--paper-2); }
.cp-pill-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cp-pill-dark:hover { background: #000; color: #fff; }
.cp-pill-ghost { background: var(--card); }
.cp-pill-sm { padding: 6px 12px; font-size: 12px; }
.cp-gear { font-size: 14px; }

/* ---------- intro / hero ---------- */
.cp-intro {
  text-align: center; padding: 16px 0 4px;
}
.cp-intro-eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--coral-deep); letter-spacing: 0.18em; text-transform: uppercase;
  background: rgba(232,133,79,0.10); padding: 6px 14px; border-radius: var(--r-pill);
  margin-bottom: 18px;
}
.cp-h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(36px, 5.4vw, 64px);
  line-height: 1.04; letter-spacing: -0.02em;
  margin: 0 0 14px; color: var(--ink);
  text-wrap: balance; max-width: 18ch; margin-inline: auto;
}
.cp-h1 em {
  font-style: normal; color: var(--coral-deep);
  background: linear-gradient(180deg, transparent 60%, rgba(232,133,79,0.25) 60%);
  padding: 0 4px;
}
.cp-sub {
  font-size: 16px; color: var(--ink-soft); margin: 0 auto; max-width: 540px;
  text-wrap: pretty; line-height: 1.5;
}

/* ---------- pickers ---------- */
.cp-pickers {
  background: var(--card);
  border: var(--border-thin);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1fr) auto minmax(280px, 1fr);
  align-items: stretch;
}
.cp-books { display: flex; gap: 12px; min-width: 0; }
.cp-book {
  flex: 1; min-width: 0;
  display: flex; gap: 12px; align-items: center;
  background: var(--card-elev); border: var(--border-thin); border-radius: var(--r-md);
  padding: 10px; text-align: left;
  color: inherit;
  transition: transform .08s, background .15s, border-color .15s;
}
.cp-book:hover { background: var(--paper-2); }
.cp-book.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cp-book.active .cp-book-count { color: rgba(247,239,226,0.7); }
.cp-book-cover {
  width: 76px; height: 76px; flex: 0 0 76px;
  border-radius: var(--r-sm); border: var(--border-thin); overflow: hidden;
  background: var(--paper-2);
}
.cp-book-cover img, .cp-book-cover svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.cp-book-meta { min-width: 0; }
.cp-book-title { font-family: var(--font-head); font-weight: 600; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; }
.cp-book-count { font-size: 12px; color: var(--ink-mute); margin-top: 4px; font-weight: 500; }

.cp-picker-divider {
  width: 1px; background: var(--line-soft);
}

.cp-city-block { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.cp-label { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); }

/* ---------- city select ---------- */
.cp-citysel { position: relative; }
.cp-citysel-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--card-elev); border: var(--border-thin); border-radius: var(--r-md);
  padding: 14px 18px; font-family: var(--font-head); font-size: 17px; font-weight: 500;
  color: var(--ink); cursor: pointer;
}
.cp-citysel-trigger:hover { background: var(--paper-2); }
.cp-caret { font-size: 14px; opacity: 0.6; }
.cp-citysel-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--card); border: var(--border-thin); border-radius: var(--r-md);
  box-shadow: 0 16px 48px rgba(29,24,21,0.16);
  z-index: 50; max-height: 380px; display: flex; flex-direction: column;
  overflow: hidden;
}
.cp-citysel-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: var(--border-hair);
}
.cp-search-ic { font-size: 14px; opacity: 0.6; }
.cp-citysel-search input {
  flex: 1; border: none; outline: none; font-family: inherit; font-size: 14px;
  background: transparent; color: var(--ink);
}
.cp-citysel-list { overflow-y: auto; padding: 6px; }
.cp-citysel-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; border: none; background: transparent;
  border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink);
  text-align: left;
}
.cp-citysel-item:hover { background: var(--paper-2); }
.cp-citysel-item.selected { background: var(--ink); color: var(--paper); }
.cp-citysel-empty { padding: 16px; text-align: center; color: var(--ink-mute); font-size: 13px; }
.cp-citydot { display: inline-flex; gap: 0; border: var(--border-thin); border-radius: 5px; overflow: hidden; }
.cp-citydot span { width: 9px; height: 16px; display: block; }

/* ---------- empty palette state ---------- */
.cp-empty {
  background: var(--card); border: var(--border-thin); border-radius: var(--r-lg);
  padding: 56px 24px; text-align: center; box-shadow: var(--shadow-soft);
}
.cp-empty-illus svg { width: 200px; height: 80px; }
.cp-empty-text { font-family: var(--font-head); font-size: 20px; font-weight: 500; color: var(--ink-soft); margin: 16px 0 0; }

/* ---------- palette ---------- */
.cp-palette-section {
  background: var(--card); border: var(--border-thin); border-radius: var(--r-lg);
  padding: 32px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 22px;
  position: relative;
}
.cp-palette-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.cp-palette-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--coral-deep);
}
.cp-palette-city {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(36px, 4.8vw, 52px);
  margin: 6px 0 0; line-height: 1; letter-spacing: -0.02em;
}
.cp-palette-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cp-toast {
  position: absolute; top: 16px; right: 16px;
  background: var(--moss); color: #fff; padding: 8px 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  animation: cpFade .3s ease-out;
}
@keyframes cpFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.cp-swatches {
  display: grid; gap: 14px;
  grid-template-columns: repeat(5, 1fr);
}
.cp-swatch {
  display: flex; flex-direction: column; justify-content: space-between;
  border: var(--border-thin); border-radius: var(--r-md);
  padding: 18px 16px 14px; min-height: 220px;
  text-align: left; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  font-family: var(--font-ui);
  position: relative;
  overflow: hidden;
}
.cp-swatch::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.04) 100%);
  pointer-events: none;
}
.cp-swatch:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(29,24,21,0.18); }
.cp-swatch:active { transform: translateY(0); }
.cp-swatch-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; position: relative; z-index: 1; }
.cp-swatch-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.85; line-height: 1.3; }
.cp-swatch-warn {
  font-weight: 700; font-size: 11px;
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(0,0,0,0.18); border: 1px solid currentColor;
}
.cp-swatch-mid { margin: 18px 0 16px; position: relative; z-index: 1; }
.cp-swatch-code {
  font-family: var(--font-head); font-weight: 700; font-size: 30px;
  line-height: 1; letter-spacing: -0.02em;
}
.cp-swatch-hex {
  font-family: 'JetBrains Mono', ui-monospace, 'Menlo', monospace;
  font-size: 12px; font-weight: 500;
  margin-top: 6px; opacity: 0.85; letter-spacing: 0.04em;
}
.cp-swatch-bot { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.cp-swatch-sets { display: flex; gap: 4px; flex-wrap: wrap; }
.cp-set-chip {
  border: 1px solid currentColor; border-radius: 999px;
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  background: rgba(255,255,255,0.16);
  letter-spacing: 0.02em;
}
.cp-swatch-swap {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(0,0,0,0.18); padding: 5px 10px; border-radius: 999px;
  align-self: flex-start;
}
.cp-swatch-hint {
  font-size: 12px; color: var(--ink-mute); display: flex; align-items: center; gap: 6px;
  font-weight: 500;
}

/* ---------- modal ---------- */
.cp-modal-bg {
  position: fixed; inset: 0; background: rgba(29,24,21,0.55); backdrop-filter: blur(2px);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: cpFade .15s ease-out;
}
.cp-modal {
  background: var(--card); border: var(--border-thin); border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 28px;
}
.cp-modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px;
}
.cp-modal-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--coral-deep); }
.cp-modal-title { font-family: var(--font-head); font-size: 26px; font-weight: 600; margin: 6px 0 6px; letter-spacing: -0.01em; }
.cp-modal-help { color: var(--ink-soft); font-size: 14px; margin: 0; line-height: 1.5; }
.cp-modal-body { font-size: 15px; line-height: 1.55; }
.cp-icon-btn {
  border: var(--border-thin); background: var(--card); border-radius: 50%;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex: 0 0 36px;
}
.cp-icon-btn:hover { background: var(--paper-2); }
.cp-modal-current { display: flex; align-items: center; gap: 14px; padding: 12px 0 18px; border-bottom: var(--border-hair); margin-bottom: 18px; }
.cp-modal-current-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; }
.cp-modal-current-swatch {
  display: inline-flex; gap: 10px; align-items: baseline;
  padding: 10px 18px; border: var(--border-thin); border-radius: var(--r-pill);
  font-family: var(--font-head); font-weight: 600;
}
.cp-modal-current-swatch strong { font-size: 16px; }
.cp-modal-current-swatch span { font-size: 12px; opacity: 0.8; font-family: ui-monospace, monospace; }

.cp-alt-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.cp-alt {
  display: flex; flex-direction: column; justify-content: space-between;
  border: var(--border-thin); border-radius: var(--r-md);
  padding: 14px; min-height: 110px;
  text-align: left; transition: transform .1s, box-shadow .1s;
  position: relative; overflow: hidden;
}
.cp-alt::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.04) 100%);
  pointer-events: none;
}
.cp-alt:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.cp-alt-code { font-family: var(--font-head); font-weight: 700; font-size: 18px; position: relative; z-index: 1; }
.cp-alt-hex { font-size: 11px; font-weight: 500; opacity: 0.85; letter-spacing: 0.04em; font-family: ui-monospace, monospace; position: relative; z-index: 1; }
.cp-alt-sets { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; position: relative; z-index: 1; }

/* settings */
.cp-modal-settings { max-width: 600px; }
.cp-settings-block {
  margin-bottom: 22px; padding-bottom: 22px; border-bottom: var(--border-hair);
}
.cp-settings-block:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.cp-settings-block-head { margin-bottom: 12px; }
.cp-settings-block-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.cp-settings-block-help { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.5; }
.cp-settings-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.cp-sets-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
.cp-set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: var(--border-thin); border-radius: var(--r-md);
  background: var(--card-elev); cursor: pointer;
}
.cp-set-row.on { background: var(--paper-2); border-color: rgba(29,24,21,0.4); }
.cp-set-row input { width: 18px; height: 18px; accent-color: var(--coral-deep); }
.cp-set-name { flex: 1; font-weight: 500; font-size: 14px; }
.cp-set-short {
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600;
  background: rgba(29,24,21,0.06); padding: 3px 8px; border-radius: 999px;
}

.cp-modal-about { max-width: 520px; }

/* CTA */
.cp-cta {
  margin-top: 20px;
  display: flex; justify-content: center;
}
.cp-cta-inner {
  width: 100%; max-width: 720px;
  background: linear-gradient(150deg, var(--paper-2) 0%, var(--card-elev) 100%);
  border: var(--border);
  border-radius: var(--r-lg);
  padding: 44px 36px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.cp-cta-inner::before {
  content: ""; position: absolute;
  width: 220px; height: 220px; border-radius: 50%;
  background: var(--coral); opacity: 0.18;
  top: -90px; right: -60px; filter: blur(20px);
  pointer-events: none;
}
.cp-cta-inner::after {
  content: ""; position: absolute;
  width: 180px; height: 180px; border-radius: 50%;
  background: var(--sky); opacity: 0.18;
  bottom: -70px; left: -50px; filter: blur(20px);
  pointer-events: none;
}
.cp-cta-eyebrow {
  position: relative;
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--coral-deep);
  background: rgba(232,133,79,0.14); padding: 6px 14px; border-radius: var(--r-pill);
  margin-bottom: 14px;
}
.cp-cta-title {
  position: relative;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.1; letter-spacing: -0.02em;
  margin: 0 0 12px; color: var(--ink);
  text-wrap: balance;
}
.cp-cta-sub {
  position: relative;
  font-size: 15px; color: var(--ink-soft);
  margin: 0 auto 22px; max-width: 460px;
  line-height: 1.5;
}
.cp-cta-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper);
  border: var(--border);
  border-radius: var(--r-pill);
  padding: 14px 28px;
  font-family: var(--font-head); font-weight: 600;
  font-size: 16px; letter-spacing: -0.005em;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .1s;
}
.cp-cta-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 0 var(--line); background: #000; }
.cp-cta-btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* footer */
.cp-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 24px 0 12px; margin-top: 8px;
  border-top: var(--border-hair);
}
.cp-footer-left { display: flex; gap: 12px; align-items: center; }
.cp-logo-sm { width: 48px; height: 48px; border-radius: 10px; background: transparent; }
.cp-footer-publisher { font-family: var(--font-head); font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.cp-footer-tag { font-size: 11px; font-weight: 500; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.cp-footer-right { display: flex; align-items: center; gap: 10px; }
.cp-link {
  background: none; border: none; padding: 0;
  color: var(--ink); font-weight: 500; font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.cp-link:hover { color: var(--coral-deep); }
.cp-sep { color: var(--ink-mute); }

/* responsive */
@media (max-width: 980px) {
  .cp-pickers { grid-template-columns: 1fr; }
  .cp-picker-divider { display: none; }
  .cp-books { flex-direction: row; }
  .cp-swatches { grid-template-columns: repeat(2, 1fr); }
  .cp-h1 { font-size: 38px; }
  .cp-main { padding: 0 20px 60px; }
  .cp-header { padding: 20px; }
}
@media (max-width: 640px) {
  .cp-header { flex-wrap: wrap; }
  .cp-app-title { font-size: 22px; }
  .cp-books { flex-direction: column; }
  .cp-swatches { grid-template-columns: 1fr; }
  .cp-palette-head { flex-direction: column; align-items: flex-start; }
  .cp-palette-section { padding: 22px; }
}
