/* ==========================================================================
   Colori d'Italia — Benjamin Moore Italia
   Static, framework-free stylesheet. Fonts loaded via <link> in index.html.
   Substitutes (per brand system): DM Serif Display ≈ Macklin Display,
   Work Sans ≈ Moderat. Swap @font-face in when licensed fonts are available.
   ========================================================================== */

.coi {
  /* Brand */
  --bm-red: #D50032;
  --bm-blue: #0A2240;
  --bm-gray: #63666A;

  /* Canvas */
  --bg-cream: #F7F5F1;   /* dominant editorial canvas */
  --bg-white: #ffffff;
  --bg-stone: #ECE8E1;   /* master-palette section */
  --ink: #1a1a1a;
  --ink-2: #2A2A2A;
  --ink-muted: #5B5E63;
  --ink-faint: #9A9CA0;
  --hairline: #E6E3DE;

  /* Campaign accent bars */
  --accent-italia:   #7FA199;  /* sage    — overall / master */
  --accent-serenis:  #BA6B5E;  /* terracotta — Venice */
  --accent-offwhite: #7895C9;  /* periwinkle — whites */
  --accent-riviera:  #F4B8B5;  /* coral   — Riviera */
  --accent-urban:    #D9B86A;  /* gold    — Milan */

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --maxw: 1280px;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

.coi, .coi * { box-sizing: border-box; }
.coi {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg-cream);
  -webkit-font-smoothing: antialiased;
}
.coi img { display: block; max-width: 100%; }
.coi a { color: inherit; text-decoration: none; }
.coi a:hover { color: var(--bm-red); }
.coi button { font-family: inherit; }
.coi ::selection { background: var(--accent-serenis); color: #fff; }

/* ---- Language visibility -------------------------------------------------
   Body carries data-lang="it" | "en". Elements tagged data-l show/hide. */
.coi [data-l] { display: none; }
[data-lang="it"] .coi [data-l="it"] { display: revert; }
[data-lang="en"] .coi [data-l="en"] { display: revert; }
[data-lang="it"] .coi .langbtn[data-lang-set="en"] { opacity: .45; }
[data-lang="en"] .coi .langbtn[data-lang-set="it"] { opacity: .45; }

/* Optional campaign-local controls. Set data-tools="false" on .coi to hide. */
.coi .coi-tools {
  position: sticky; top: 0; z-index: 35; min-height: 54px; padding: 8px 24px;
  display: flex; align-items: center; gap: 8px; background: rgba(247,245,241,.94);
  border-bottom: 1px solid var(--hairline); backdrop-filter: blur(14px);
}
.coi[data-tools="false"] .coi-tools { display: none; }
.coi .coi-tools__chapters { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.coi .coi-tools__chapters::-webkit-scrollbar { display: none; }
.coi .coi-tools__spacer { flex: 1; }
.coi .coi-tools__language { display: flex; align-items: center; gap: 2px; }
.coi .coi-tools .langbtn,
.coi .coi-tools__favorite {
  min-height: 36px; border: 1px solid transparent; background: transparent; color: var(--bm-blue);
  cursor: pointer; padding: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; white-space: nowrap;
}
.coi .coi-tools .langbtn:hover,
.coi .coi-tools__favorite:hover { border-color: var(--hairline); background: #fff; }
.coi .coi-tools__favorite { position: relative; display: inline-flex; align-items: center; gap: 7px; }
.coi .coi-tools__favorite svg { width: 16px; fill: transparent; stroke: currentColor; }
.coi .coi-tools__badge {
  min-width: 18px; height: 18px; padding: 0 5px; display: none; place-items: center;
  border-radius: 20px; background: var(--bm-red); color: #fff; font-size: 10px; letter-spacing: 0;
}
.coi .coi-tools__badge.is-visible { display: grid; }

.coi .wrap { max-width: var(--maxw); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.coi .eyebrow {
  font-size: 12px; letter-spacing: .24em; text-transform: uppercase;
  font-weight: 600;
}

/* ---- Top utility bar ----------------------------------------------------- */
.coi .topbar { background: var(--bm-blue); color: #fff; }
.coi .topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 7px 24px;
  display: flex; align-items: center; gap: 18px;
}
.coi .topbar-brand {
  opacity: .62; letter-spacing: .2em; text-transform: uppercase;
  font-size: 10px; font-weight: 500;
}
.coi .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 11.5px; }
.coi .langgroup { display: flex; align-items: center; gap: 2px; font-weight: 600; letter-spacing: .1em; }
.coi .langbtn { background: none; border: 0; color: #fff; cursor: pointer; padding: 2px 5px; font-size: 11.5px; letter-spacing: .1em; }
.coi .topbar .sep { opacity: .35; }
.coi .topbar-link { opacity: .85; display: inline-flex; align-items: center; gap: 6px; }
.coi .topbar-link:hover { opacity: 1; color: #fff; }

/* ---- Header + nav -------------------------------------------------------- */
.coi .header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.coi .header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 13px 24px;
  display: flex; align-items: center; gap: 30px;
}
.coi .logo { flex: none; display: block; }
.coi .logo img { height: 28px; }
.coi .nav {
  display: flex; gap: 26px; font-size: 11.5px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 500; color: var(--ink);
}
.coi .nav a { padding: 4px 0; }
.coi .nav a:hover { opacity: .6; color: var(--ink); }
.coi .nav a.is-current { border-bottom: 2px solid var(--bm-red); }
.coi .header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.coi .icon-btn {
  position: relative; background: none; border: 0; cursor: pointer;
  color: var(--ink); padding: 8px; display: flex;
}
.coi .icon-btn:hover { opacity: .6; }
.coi .fav-badge {
  position: absolute; top: 0; right: 0; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: var(--bm-red); color: #fff;
  font-size: 10px; font-weight: 600; display: none;
  align-items: center; justify-content: center; line-height: 1;
}
.coi .fav-badge.is-visible { display: flex; }

/* ---- Chapter nav (scroll-spy) -------------------------------------------- */
.coi .chapters { border-top: 1px solid #EFECE5; background: rgba(255,255,255,.86); }
.coi .chapters-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 4px; overflow-x: auto;
}
.coi .chapters-label {
  flex: none; font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: #B6B1A8; font-weight: 600; margin-right: 10px;
}
.coi .chapter-btn {
  position: relative; flex: none; background: none; border: 0; cursor: pointer;
  padding: 13px 12px; white-space: nowrap; font-size: 12.5px; letter-spacing: .02em;
  display: flex; align-items: center; gap: 8px; color: var(--bm-gray); font-weight: 500;
}
.coi .chapter-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: #D6D1C8; }
.coi .chapter-btn .underline { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: transparent; }
.coi .chapter-btn.is-active { color: var(--ink); font-weight: 600; }
.coi .chapter-btn.is-active .dot { background: var(--accent, var(--accent-italia)); }
.coi .chapter-btn.is-active .underline { background: var(--accent, var(--accent-italia)); }

/* ---- Breadcrumb ---------------------------------------------------------- */
.coi .breadcrumb { background: var(--bg-cream); border-bottom: 1px solid #EAE7E1; }
.coi .breadcrumb-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 11px 24px;
  font-size: 12px; letter-spacing: .02em; color: #7A7D82;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.coi .breadcrumb a:hover { color: var(--ink); }
.coi .breadcrumb .sep { opacity: .5; }
.coi .breadcrumb .current { color: var(--ink); font-weight: 500; }

/* ---- Hero ---------------------------------------------------------------- */
.coi .hero {
  position: relative; height: 86vh; min-height: 540px; max-height: 880px;
  overflow: hidden; background: var(--bm-blue);
}
.coi .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.coi .hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,34,64,.28) 0%, rgba(10,34,64,0) 32%, rgba(18,18,18,.16) 62%, rgba(18,18,18,.62) 100%);
}
.coi .hero-bar { position: absolute; top: 0; right: 0; width: 9px; height: 100%; background: var(--accent-italia); }
.coi .hero-content {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 24px clamp(44px, 7vw, 80px);
  display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff;
}
.coi .hero .eyebrow { letter-spacing: .32em; color: rgba(255,255,255,.88); }
.coi .hero h1 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  line-height: 1; font-size: clamp(3rem, 8.5vw, 6.6rem); margin: 18px 0 0;
  color: #fff; text-shadow: 0 2px 30px rgba(0,0,0,.25);
}
.coi .hero-sub {
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem); margin-top: 12px;
  color: rgba(255,255,255,.94); max-width: 640px; line-height: 1.3;
}

/* ---- Intro --------------------------------------------------------------- */
.coi .intro { background: var(--bg-cream); padding: clamp(58px, 9vw, 116px) 24px; }
.coi .intro-inner { max-width: 790px; margin: 0 auto; text-align: center; }
.coi .intro .eyebrow { letter-spacing: .26em; color: var(--accent-serenis); }
.coi .rule { width: 42px; height: 3px; background: var(--accent-italia); margin: 20px auto 30px; }
.coi .lead {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.35rem, 2.7vw, 2.05rem); line-height: 1.46; color: var(--ink); margin: 0;
}
.coi .intro .body-copy {
  font-size: clamp(15px, 1.7vw, 17px); line-height: 1.78; color: var(--ink-muted);
  margin: 26px auto 0; max-width: 660px;
}

/* ---- Color story --------------------------------------------------------- */
.coi .story { position: relative; padding: clamp(56px, 8vw, 104px) 0; }
.coi .story--white { background: var(--bg-white); }
.coi .story--cream { background: var(--bg-cream); }
.coi .story-bar { position: absolute; top: 0; bottom: 0; width: 7px; background: var(--accent); }
.coi .story-bar--left { left: 0; }
.coi .story-bar--right { right: 0; }
.coi .story-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.coi .story-grid { display: flex; flex-wrap: wrap; gap: clamp(28px, 5vw, 72px); align-items: center; }
.coi .story-media { flex: 1 1 330px; min-width: 270px; }
.coi .story-media img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.coi .story-text { flex: 1 1 440px; min-width: 280px; }
.coi .story-text .eyebrow { color: var(--accent-ink); }
.coi .story-text h2 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  line-height: 1.04; font-size: clamp(2.1rem, 4.4vw, 3.3rem); margin: 14px 0 0;
}
.coi .story-body { margin-top: 24px; }
.coi .story-body p { font-size: 16px; line-height: 1.78; color: var(--ink-2); margin: 0 0 16px; }
.coi .story-body p:last-child { margin-bottom: 0; }
/* media-second variant (text leads on desktop) */
.coi .story--flip .story-media { order: 2; }
.coi .story--flip .story-text { order: 1; }

/* ---- Palette block ------------------------------------------------------- */
.coi .palette { margin-top: clamp(40px, 6vw, 72px); }
.coi .palette-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--hairline); padding-top: 22px; margin-bottom: 26px; flex-wrap: wrap;
}
.coi .palette-head .eyebrow { font-size: 11px; letter-spacing: .22em; color: var(--ink-faint); }
.coi .palette-head .title { font-family: var(--font-display); font-size: 1.45rem; margin-top: 5px; color: var(--ink); }
.coi .palette-hint { font-size: 12px; color: var(--ink-faint); letter-spacing: .03em; }
.coi .palette-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}
.coi .swatch { cursor: pointer; transition: transform .2s var(--ease); }
.coi .swatch:hover { transform: translateY(-3px); }
.coi .swatch-copy:focus-visible, .coi .swatch-fav:focus-visible { outline: 2px solid var(--bm-blue); outline-offset: 3px; }
.coi .swatch-chip { position: relative; aspect-ratio: 1/1; border: 1px solid rgba(0,0,0,.07); }
.coi .swatch-fav {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.85); display: flex; align-items: center;
  justify-content: center; cursor: pointer; padding: 0;
}
.coi .swatch-fav:hover { background: #fff; }
.coi .swatch-fav svg {
  display: block; width: 16px; height: 16px; overflow: visible;
  fill: none; stroke: var(--ink-faint); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.coi .swatch.is-faved .swatch-fav svg { fill: var(--accent); stroke: var(--accent); }
.coi .swatch-name { margin-top: 9px; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.coi .swatch-code {
  display: block; border: 0; background: transparent; padding: 2px 0 0; cursor: copy;
  font-size: 11.5px; color: var(--ink-faint); letter-spacing: .07em; margin-top: 2px;
}

/* ---- Master palette ------------------------------------------------------ */
.coi .master { background: var(--bg-stone); padding: clamp(56px, 8vw, 104px) 24px; }
.coi .master-inner { max-width: var(--maxw); margin: 0 auto; }
.coi .master-head { text-align: center; max-width: 700px; margin: 0 auto clamp(40px, 5vw, 60px); }
.coi .master-head .eyebrow { letter-spacing: .26em; color: var(--accent-italia); }
.coi .master-head h2 {
  font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em;
  line-height: 1.06; font-size: clamp(2.1rem, 4.4vw, 3.3rem); margin: 14px 0 0;
}
.coi .master-head p { font-size: 16px; line-height: 1.7; color: var(--ink-muted); margin: 18px 0 0; }
.coi .master-img { max-width: 1160px; margin: 0 auto; }
.coi .master-img img { width: 100%; display: block; }
.coi .disclaimer {
  max-width: 760px; margin: clamp(40px, 5vw, 58px) auto 0; text-align: center;
  font-size: 12.5px; color: #8A8D92; line-height: 1.7;
}

/* ---- Footer -------------------------------------------------------------- */
.coi .footer { background: var(--bm-blue); color: #fff; padding: clamp(48px, 7vw, 76px) 24px 28px; }
.coi .footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 44px; }
.coi .footer-brand { flex: 1 1 280px; min-width: 240px; }
.coi .footer-brand img { height: 40px; margin-bottom: 18px; }
.coi .footer-tag { font-family: var(--font-display); font-style: italic; font-size: 19px; opacity: .92; }
.coi .social { display: flex; gap: 10px; margin-top: 24px; }
.coi .social a {
  width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
}
.coi .social a:hover { background: rgba(255,255,255,.12); color: #fff; }
.coi .footer-col { flex: 1 1 190px; min-width: 160px; }
.coi .footer-col h5 {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  font-weight: 600; margin: 0 0 16px; opacity: .6;
}
.coi .footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 11px; font-size: 13.5px; }
.coi .footer-col a { opacity: .82; }
.coi .footer-col a:hover { opacity: 1; color: #fff; }
.coi .footer-lang { display: flex; gap: 6px; align-items: center; font-size: 13.5px; margin-bottom: 18px; }
.coi .footer-lang .langbtn { padding: 0; font-size: 13.5px; }
.coi .footer-site { font-size: 13.5px; opacity: .82; display: inline-flex; align-items: center; gap: 7px; }
.coi .footer-site:hover { opacity: 1; color: #fff; }
.coi .footer-legal {
  max-width: var(--maxw); margin: 42px auto 0; padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-wrap: wrap;
  gap: 10px 28px; justify-content: space-between; font-size: 11.5px; opacity: .6;
}

/* ---- Favorites drawer ---------------------------------------------------- */
.coi .scrim { position: fixed; inset: 0; background: rgba(10,34,64,.42); z-index: 45; animation: coiFade .2s ease; }
.coi .drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(390px, 92vw); background: #fff;
  z-index: 46; box-shadow: -14px 0 40px rgba(10,34,64,.2);
  display: flex; flex-direction: column; animation: coiDraw .32s var(--ease);
}
.coi .drawer[hidden], .coi .scrim[hidden] { display: none; }
.coi .drawer-head {
  padding: 22px 24px; border-bottom: 1px solid #EFECE5;
  display: flex; align-items: center; justify-content: space-between;
}
.coi .drawer-title { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.1; }
.coi .drawer-count { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.coi .drawer-close { background: none; border: 0; cursor: pointer; color: var(--bm-gray); padding: 6px; display: flex; }
.coi .drawer-close:hover { color: var(--ink); }
.coi .drawer-body { flex: 1; overflow-y: auto; padding: 8px 12px; }
.coi .drawer-empty { padding: 54px 28px; text-align: center; color: var(--ink-faint); }
.coi .drawer-empty svg { margin: 0 auto 16px; }
.coi .drawer-empty div { font-size: 14px; line-height: 1.6; }
.coi .fav-row { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-bottom: 1px solid #F2EFEA; }
.coi .fav-swatch { width: 46px; height: 46px; flex: none; border: 1px solid rgba(0,0,0,.08); }
.coi .fav-meta { flex: 1; min-width: 0; }
.coi .fav-name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.coi .fav-code { display: block; font-size: 11.5px; color: var(--ink-faint); letter-spacing: .07em; margin-top: 1px; }
.coi .fav-remove { background: none; border: 0; cursor: pointer; color: #BFC2C6; padding: 7px; display: flex; }
.coi .fav-remove:hover { color: var(--bm-red); }
.coi .drawer-foot { padding: 16px 20px; border-top: 1px solid #EFECE5; }
.coi .drawer-clear {
  width: 100%; background: none; border: 1px solid var(--hairline); color: var(--bm-gray);
  padding: 12px; cursor: pointer; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 600;
}
.coi .drawer-clear:hover { border-color: var(--ink); color: var(--ink); }

/* ---- Toast --------------------------------------------------------------- */
.coi .toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 13px 22px; font-size: 13.5px;
  letter-spacing: .02em; box-shadow: 0 14px 36px rgba(0,0,0,.28);
  display: flex; align-items: center; gap: 10px; animation: coiToast .26s ease;
}
.coi .toast[hidden] { display: none; }
.coi .toast svg { stroke: var(--accent-italia); }

@keyframes coiToast { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes coiDraw { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes coiFade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 880px) {
  .coi .nav { display: none; }
  .coi .coi-tools { padding-inline: 12px; }
  .coi .coi-tools__chapters .chapter-btn { padding-inline: 8px; }
  .coi .coi-tools__favorite span:not(.coi-tools__badge) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .coi *, .coi *::before, .coi *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
