/* Mots fleches — a crossword whose definitions live in the grid. Clue cells hold
   one or two tiny definitions with an arrow (-> across, v down); letter cells are
   the answer tiles. On the warm design-system paper. */

.mf-root { padding: clamp(6px, 2vw, 14px); max-inline-size: 560px; margin: 0 auto; color: var(--color-text); display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }

.mf-grid {
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  inline-size: min(100%, 480px); aspect-ratio: 1; gap: 1px; background: var(--color-neutral-400);
  outline: 2px solid var(--color-neutral-400); border-radius: 2px;
}
.mf-cell { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }

.mf-letter {
  background: var(--color-neutral-100); cursor: pointer;
  font-family: var(--font-heading, var(--font-body)); font-weight: 700; text-transform: uppercase;
  font-size: clamp(13px, 3.6vw, 22px); color: var(--color-text);
}
.mf-letter.inentry { background: var(--color-accent-100); }
.mf-letter.active { background: var(--color-accent-200); box-shadow: inset 0 0 0 2px var(--color-accent); }
.mf-letter.given { color: var(--color-accent-700, #7d5411); font-weight: 800; cursor: default; }

/* empty spacer blocks recede; clue cells are pale with edge-arrow triangles */
.mf-block { background: var(--color-neutral-300); }
.mf-clued { align-items: stretch; justify-content: stretch; background: var(--color-neutral-200); }
.mf-defs { display: flex; flex-direction: column; inline-size: 100%; block-size: 100%; }
/* one definition per row; the two-clue cell splits with a divider line */
.mf-def {
  position: relative; flex: 1 1 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-block-size: 0; padding: 2px 3px; text-align: center;
  font-family: var(--font-body); font-weight: 700; line-height: 1.03;
  font-size: clamp(6px, 1.95vw, 10px); text-transform: uppercase; letter-spacing: 0;
  color: var(--color-neutral-900);
}
.mf-def + .mf-def { border-block-start: 1px solid var(--color-neutral-400); }
.mf-def-t { display: block; overflow: hidden; }
.mf-def-a { padding-inline: 8px; }      /* symmetric, so text stays centred beside the right arrow */
.mf-def-d { padding-block-end: 8px; }   /* clears the bottom arrow while staying centred */

/* arrow triangles on the edge of each definition, pointing into its answer */
.mf-tri { position: absolute; inline-size: 0; block-size: 0; z-index: 1; }
.mf-tri-r {
  inset-inline-end: 0; inset-block-start: 50%; transform: translateY(-50%);
  border-block-start: 5px solid transparent; border-block-end: 5px solid transparent;
  border-inline-start: 7px solid var(--color-accent-600, #a06f24);
}
.mf-tri-d {
  inset-block-end: 0; inset-inline-start: 50%; transform: translateX(-50%);
  border-inline-start: 5px solid transparent; border-inline-end: 5px solid transparent;
  border-block-start: 7px solid var(--color-accent-600, #a06f24);
}

.mf-hintbar {
  min-block-size: 22px; text-align: center; font-family: var(--font-body); font-size: 14px;
  color: var(--color-neutral-700); inline-size: 100%; padding: 4px 8px;
}

/* Dark page */
.mf-root.mode-dark { color: #ece8e2; }
.mf-root.mode-dark .mf-grid { background: #403c38; outline-color: #403c38; }
.mf-root.mode-dark .mf-letter { background: #2b2825; color: #f2eee7; }
.mf-root.mode-dark .mf-letter.inentry { background: #3d3220; }
.mf-root.mode-dark .mf-letter.active { background: var(--color-accent-700, #7d5411); color: #fff; box-shadow: inset 0 0 0 2px var(--color-accent-400); }
.mf-root.mode-dark .mf-letter.given { color: var(--color-accent-300, #facb8d); }
.mf-root.mode-dark .mf-block { background: #161513; }
.mf-root.mode-dark .mf-clued { background: #211f1c; }
.mf-root.mode-dark .mf-def { color: #e7e0d4; }
.mf-root.mode-dark .mf-def + .mf-def { border-block-start-color: #45403a; }
.mf-root.mode-dark .mf-tri-r { border-inline-start-color: var(--color-accent-400); }
.mf-root.mode-dark .mf-tri-d { border-block-start-color: var(--color-accent-400); }
.mf-root.mode-dark .mf-hintbar { color: #cfc9c0; }
