/* ============================================================
   Mikadodeco · Nuancier Fermob widget
   Self-contained palette + detail panel + ambiances. All classes
   are .nf-* to stay safe under any host (page autonome ou article).
   Reuses Mikado design tokens — no new colors/fonts introduced.
   ============================================================ */

.nf-root { display: block; }

/* ============================================================
   Sticky nav · the square swatch rail (samples + Dock hover)
   ============================================================ */
.nf-nav {
  position: sticky;
  top: calc(var(--nav-h) + 4px);
  z-index: 40;
  background: var(--paper);
  padding: 18px 0 14px;
  margin-bottom: clamp(28px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

/* Active-colour feature · sits beside the hero in the stage, fades on change */
.nf-active {
  opacity: 1;
  transition: opacity 150ms var(--ease);
  margin-bottom: 20px;
}
.nf-active.is-fading { opacity: 0; }
.nf-active__name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink-deep);
  margin-bottom: 12px;
}
.nf-active__meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nf-active__index {
  font-family: var(--sans-product);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
}
.nf-active__hex {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans-product);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.nf-active__chip {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--swatch-color, var(--ink));
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ============================================================
   Swatch bar · square samples · active marked by a ring
   ============================================================ */
.nf-swatches { padding: 0; }
.nf-swatches__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 10px;
  align-items: center;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}
.nf-swatch {
  all: unset;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-sizing: border-box;
}
.nf-swatch__dot {
  width: 28px;
  height: 28px;
  border-radius: 0;                   /* sharp square sample — matches the angular .btn convention */
  background: var(--swatch-color, var(--ink));
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform-origin: bottom center;    /* Dock fish-eye grows upward */
  transition: transform 0.15s var(--ease);
}
.nf-swatch:hover .nf-swatch__dot { transform: scale(1.12); }
.nf-swatch:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 0; }

/* Active state · a marked ring around the square sample */
.nf-swatch[aria-pressed="true"] .nf-swatch__dot {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink-deep);
}

/* ============================================================
   Magazine stage · moodboard + narrative
   ============================================================ */
.nf-stage {
  display: grid;
  grid-template-columns: clamp(360px, 42vw, 580px) 1fr;   /* hero = medium landscape, present but not envahissant */
  gap: clamp(24px, 3vw, 48px);
  align-items: center;          /* centre the short text column against the tall image — no bottom void */
  margin-bottom: clamp(28px, 3.5vw, 44px);
}

.nf-stage__media { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 580px; }
.nf-stage__hero-wrap { position: relative; width: 100%; aspect-ratio: 3/2; background: var(--tile); overflow: hidden; }
.nf-stage__hero { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 280ms var(--ease); }
.nf-stage__hero.is-front { opacity: 1; }
.nf-stage__moodgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nf-stage__moodgrid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--tile); }

.nf-stage__body { padding-top: 4px; }
.nf-stage__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(18px, 1.6vw, 22px);
  color: var(--accent-ink);
  margin-bottom: 18px;
}
.nf-stage__desc {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  max-width: 48ch;
  margin-bottom: 26px;
}

/* Harmonies · full-width band — big editorial title on the left, the four
   colour compositions on the right (visual only, no navigation). */
.nf-stage__harmonies {
  display: grid;
  grid-template-columns: clamp(220px, 24vw, 320px) minmax(0, 840px);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.nf-stage__harmonies-label {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.0;
  letter-spacing: -0.015em;
  color: var(--ink-deep);
}
/* Harmonies = 4 compositions of overlapping flat-colour squares (active colour
   big top-left + its 1-2 partners staggered). The name reveals inside a square
   on hover, with auto-contrast text. Sharp corners, no image — our angular
   take on Fermob's component. */
.nf-stage__harmonies-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;                 /* capped by the band's 840px right column */
}
/* The exact Fermob composition · a 5×5 fr grid; three squares placed by span
   so they overlap artistically (not a diagonal). Stacking via z-index below. */
.nf-harm {
  display: grid;
  grid-template-columns: 87fr 29fr 29fr 38fr 28fr;
  grid-template-rows: 26fr 60fr 26fr 26fr 36fr;
  aspect-ratio: 1 / 1;
  max-width: 200px;
}
.nf-harm-sq {
  background: var(--sq, var(--ink));
  width: 100%;
  aspect-ratio: 1 / 1;        /* a TRUE square — size driven by its grid-area width */
  align-self: start;          /* anchor at the top of its (taller) area, like Fermob */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.nf-harm-sq--active { grid-column: 1 / 4; grid-row: 1 / 5; z-index: 1; }   /* active behind */
.nf-harm-sq--p1     { grid-column: 3 / 6; grid-row: 2 / 4; z-index: 2; }
.nf-harm-sq--p2     { grid-column: 2 / 5; grid-row: 3 / 6; z-index: 3; }   /* partners in front */
.nf-harm-sq__name {
  font-family: var(--sans-product);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-align: center;
  padding: 0 6px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.nf-harm-sq:hover {
  transform: translateY(-8px) scale(1.05);
  z-index: 10;
  box-shadow: 0 12px 26px rgba(26, 25, 22, 0.22);
}
.nf-harm-sq:hover .nf-harm-sq__name { opacity: 1; }
@media (max-width: 760px) {
  .nf-stage__harmonies-list { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Ambiances grid
   ============================================================ */
.nf-ambiances { margin-top: 8px; }
.nf-ambiances__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 2.2vw, 30px);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}
.nf-ambiances__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nf-amb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--tile);
  border-radius: 0;
}
.nf-amb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease);
}
.nf-amb:hover img { transform: scale(1.05); }

/* ============================================================
   Error fallback
   ============================================================ */
.nf-error {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 920px) {
  .nf-stage { grid-template-columns: 1fr; gap: 24px; }
  .nf-stage__hero-wrap { aspect-ratio: 3/2; }
  .nf-active__name { font-size: clamp(2rem, 8vw, 3rem); }
  .nf-stage__harmonies { grid-template-columns: 1fr; gap: clamp(20px, 4vw, 28px); }
  .nf-ambiances__grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 760px) {
  .nf-nav {
    top: calc(var(--nav-h) - 8px);
    padding: 12px 0 10px;
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }
  .nf-active { margin-bottom: 10px; }
  .nf-swatches__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    justify-content: flex-start;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .nf-swatches__list::-webkit-scrollbar { display: none; }
  .nf-swatch { width: 34px; height: 34px; flex-shrink: 0; }
  .nf-swatch__dot { width: 26px; height: 26px; }
}

@media (max-width: 480px) {
  .nf-ambiances__grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-active,
  .nf-swatch__dot,
  .nf-stage__hero,
  .nf-amb img,
  .nf-harm-sq { transition: none; }
  .nf-amb:hover img,
  .nf-harm-sq:hover { transform: none; }   /* name still reveals (z-index + opacity), no motion */
}
