/* Page des touches : clavier interactif ----------------------------------- */
:root {
  --kb-case: #060b17;
  --kb-cap: #101a30;
  --kb-cap-top: #16223d;
  --kb-cap-edge: #050912;
  --kb-legend: #dbe4f2;
  --kb-legend-dim: #56647c;
  --kb-general: #c3cfe2;
  --kb-vehicule: #f2b134;
  --kb-communication: #39c9db;
  --kb-interaction: #5b8cff;
  --kb-emotes: #e573b5;
  --kb-metier: #7fd47a;
  --kb-urgence: #ff5468;
  --kb-admin: #9a8cff;
}

.md-content__inner:has(.do-keys) { max-width: 1320px !important; }

.do-keys { --kb-accent: var(--do-blue-light); margin-top: 1.5rem; }
.do-keys [hidden] { display: none !important; }

/* Barre de réglages */
.do-keys__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin-bottom: 1rem;
}
.do-keys__group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.do-keys__group-label { margin-right: .35rem; color: var(--do-muted); font-size: .62rem; font-weight: 600; }
.do-keys__chip {
  min-height: 2rem;
  padding: .3rem .8rem;
  border: 1px solid var(--do-border);
  border-radius: 999px;
  background: var(--do-surface);
  color: #b9c6da;
  font: 600 .62rem/1 "Poppins", system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.do-keys__chip:hover { border-color: rgba(91,140,255,.5); color: #fff; }
.do-keys__chip[aria-pressed="true"] { border-color: var(--do-blue); background: rgba(47,107,255,.2); color: #fff; }
.do-keys__chip:focus-visible,
.do-keys__cap:focus-visible,
.do-keys__row:focus-visible,
.do-keys__search:focus-visible { outline: 2px solid var(--do-blue-light); outline-offset: 2px; }

/* Boîtier du clavier */
.do-keys__deck {
  overflow-x: auto;
  padding: 0 0 .6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--do-blue) transparent;
}
.do-keys__case {
  display: flex;
  min-width: 980px;
  align-items: flex-start;
  gap: 1.6%;
  padding: 1.6% 1.6% 1.8%;
  border: 1px solid rgba(91,140,255,.14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(91,140,255,.06), transparent 30%),
    var(--kb-case);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 30px 60px -30px rgba(0,0,0,.9);
}
.do-keys__board { position: relative; flex: 1 1 0; min-width: 0; aspect-ratio: 23 / 7.2; }

.do-keys__cap {
  --cat: transparent;
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .32em .3em .38em;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--kb-cap-top), var(--kb-cap));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 3px 0 var(--kb-cap-edge), 0 4px 6px rgba(0,0,0,.45);
  color: var(--kb-legend-dim);
  font: 600 clamp(9px, .74vw, 12.5px)/1.1 "Poppins", system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: transform 70ms ease, box-shadow 70ms ease, background 140ms ease, opacity 140ms ease;
  -webkit-tap-highlight-color: transparent;
}
.do-keys__cap--enter { padding-left: 1.6em; clip-path: polygon(0 0, 100% 0, 100% 100%, 16.6% 100%, 16.6% 50%, 0 50%); }
.do-keys__legend { white-space: pre; }
.do-keys__hint {
  overflow: hidden;
  max-width: 100%;
  color: var(--cat);
  font-size: .74em;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.do-keys__count {
  position: absolute;
  top: -.45em;
  right: -.35em;
  z-index: 1;
  min-width: 1.45em;
  padding: .1em .3em;
  box-shadow: 0 0 0 2px var(--kb-case);
  border-radius: 999px;
  background: var(--cat);
  color: #050912;
  font-size: .72em;
  font-weight: 700;
  text-align: center;
}

/* Touche affectée : la couleur de catégorie éclaire la touche par en dessous. */
.do-keys__cap.is-bound {
  background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 16%, var(--kb-cap-top)), var(--kb-cap));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -2px 0 var(--cat), 0 3px 0 var(--kb-cap-edge), 0 6px 14px -4px color-mix(in srgb, var(--cat) 45%, transparent);
  color: var(--kb-legend);
}
.do-keys__cap.is-dimmed { opacity: .28; }
.do-keys__cap:hover { background: linear-gradient(180deg, #1c2b4b, #131f38); }
.do-keys__cap.is-bound:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 28%, var(--kb-cap-top)), var(--kb-cap)); }
.do-keys__cap.is-selected { outline: 2px solid #fff; outline-offset: 1px; }
.do-keys__cap.is-pressed {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -2px 0 var(--cat), 0 0 0 var(--kb-cap-edge), 0 0 18px -2px color-mix(in srgb, var(--cat, var(--do-blue)) 70%, transparent);
}

/* Souris */
.do-keys__mouse {
  position: relative;
  flex: 0 0 10%;
  aspect-ratio: 5 / 8.4;
  margin-top: 2.5%;
}
.do-keys__mouse .do-keys__cap { border-radius: 4px; font-size: clamp(8px, .66vw, 10.5px); }
.do-keys__mouse .do-keys__cap[data-code="MOUSE_LEFT"] { border-radius: 46% 6px 6px 6px / 30% 6px 6px 6px; }
.do-keys__mouse .do-keys__cap[data-code="MOUSE_RIGHT"] { border-radius: 6px 46% 6px 6px / 6px 30% 6px 6px; }
.do-keys__mouse-body {
  position: absolute;
  inset: 44% 0 0;
  border-radius: 6px 6px 46% 46% / 6px 6px 28% 28%;
  background: linear-gradient(180deg, var(--kb-cap), #0a1224);
  box-shadow: 0 3px 0 var(--kb-cap-edge);
}

/* Légende des catégories */
.do-keys__legend-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; }
.do-keys__legend-bar .do-keys__chip { display: inline-flex; align-items: center; gap: .45rem; }
.do-keys__legend-bar .do-keys__chip::before {
  width: .55rem;
  height: .55rem;
  border-radius: 2px;
  background: var(--cat);
  content: "";
}
.do-keys__legend-bar .do-keys__chip[aria-pressed="false"] { opacity: .45; }

/* Panneau de détail */
.do-keys__detail {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  min-height: 7.5rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--do-border);
  border-radius: 12px;
  background: var(--do-surface);
}
.do-keys__detail-key {
  display: grid;
  min-width: 4.2rem;
  height: 4.2rem;
  padding: 0 .8rem;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--kb-cap-top), var(--kb-cap));
  box-shadow: inset 0 -2px 0 var(--do-blue), 0 3px 0 var(--kb-cap-edge);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}
.md-typeset .do-keys__detail h3 { margin: 0 0 .5rem; font-size: .95rem; }
.md-typeset .do-keys__detail p { margin: 0; color: #9fb0c8; font-size: .72rem; }
.md-typeset ul.do-keys__bindings { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .9rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.md-typeset .do-keys__bindings li { margin: 0; padding: 0 0 0 .8rem; border-left: 2px solid var(--cat); }
.do-keys__binding-title { color: #fff; font-size: .78rem; font-weight: 600; }
.do-keys__binding-meta { color: var(--do-muted); font-size: .62rem; }
.md-typeset .do-keys__binding-desc { color: #b9c6da !important; }

/* Recherche et liste complète */
.do-keys__list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 2.5rem;
}
.md-typeset .do-keys__list-head h2 { margin: 0; }
.do-keys__search {
  width: min(100%, 22rem);
  min-height: 2.4rem;
  padding: .45rem .9rem;
  border: 1px solid var(--do-border);
  border-radius: 8px;
  background: var(--do-surface);
  color: #fff;
  font: 500 .72rem "Poppins", system-ui, sans-serif;
}
.do-keys__search::placeholder { color: var(--do-muted); }
.md-typeset .do-keys__cat-title { margin: 1.8rem 0 .6rem; color: #fff; font-size: .82rem; }
.do-keys__cat-title::before {
  display: inline-block;
  width: .6rem;
  height: .6rem;
  margin-right: .55rem;
  border-radius: 2px;
  background: var(--cat);
  content: "";
}
.md-typeset ul.do-keys__rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: .4rem; margin: 0; padding: 0; list-style: none; }
.md-typeset .do-keys__rows li { margin: 0; }
.do-keys__row {
  display: grid;
  width: 100%;
  grid-template-columns: 5.5rem 1fr;
  align-items: center;
  height: 100%;
  gap: 1rem;
  padding: .55rem .8rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(13,22,41,.55);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.do-keys__row:hover { border-color: var(--do-border); background: var(--do-surface-soft); }
.do-keys__kbd { display: flex; flex-wrap: wrap; gap: .25rem; }
.do-keys__kbd kbd {
  min-width: 1.7rem;
  padding: .2rem .45rem;
  border: 0;
  border-radius: 5px;
  background: var(--kb-cap-top);
  box-shadow: inset 0 -2px 0 var(--cat), 0 2px 0 var(--kb-cap-edge);
  color: #fff;
  font: 600 .64rem/1.3 "Poppins", system-ui, sans-serif;
  text-align: center;
}
.do-keys__kbd kbd.is-free { box-shadow: inset 0 -2px 0 var(--kb-legend-dim), 0 2px 0 var(--kb-cap-edge); color: var(--do-muted); }
.do-keys__row-text { display: grid; gap: .1rem; }
.do-keys__row-title { color: #fff; font-size: .72rem; font-weight: 600; }
.do-keys__row-desc { color: #9fb0c8; font-size: .66rem; line-height: 1.5; }
.do-keys__empty { margin-top: 1.5rem; color: var(--do-muted); font-size: .72rem; }

@media screen and (max-width: 37.5em) {
  .do-keys__detail { grid-template-columns: 1fr; }
  .do-keys__row { grid-template-columns: 1fr; gap: .4rem; }
}

/* Neutralise les puces et losanges des pages intérieures dans le bloc clavier. */
.md-content__inner:not(:has(.dayone-home)) .do-keys ul { padding-left: 0; }
.md-content__inner:not(:has(.dayone-home)) .do-keys .do-keys__rows > li { margin: 0; padding-left: 0; }
.md-content__inner:not(:has(.dayone-home)) .do-keys .do-keys__bindings > li { margin: 0; padding-left: .8rem; }
.md-content__inner:not(:has(.dayone-home)) .do-keys li::before { display: none; }
.md-content__inner:not(:has(.dayone-home)) .do-keys h3 { margin-top: 0; padding-left: 0; }
.md-content__inner:not(:has(.dayone-home)) .do-keys h3:not(.do-keys__cat-title)::before { display: none; }
.md-content__inner:not(:has(.dayone-home)) .do-keys .do-keys__cat-title { margin-top: 1.8rem; }
.md-content__inner:not(:has(.dayone-home)) .do-keys .do-keys__cat-title::before {
  position: static;
  display: inline-block;
  width: .6rem;
  height: .6rem;
  margin-right: .55rem;
  transform: none;
  border-radius: 2px;
  background: var(--cat);
  box-shadow: none;
}
